XC Open source finite element analysis program
BJtensor.h
1 //----------------------------------------------------------------------------
2 // XC program; finite element analysis code
3 // for structural analysis and design.
4 //
5 // Copyright (C) Luis Claudio Pérez Tato
6 //
7 // This program derives from OpenSees <http://opensees.berkeley.edu>
8 // developed by the «Pacific earthquake engineering research center».
9 //
10 // Except for the restrictions that may arise from the copyright
11 // of the original program (see copyright_opensees.txt)
12 // XC is free software: you can redistribute it and/or modify
13 // it under the terms of the GNU General Public License as published by
14 // the Free Software Foundation, either version 3 of the License, or
15 // (at your option) any later version.
16 //
17 // This software is distributed in the hope that it will be useful, but
18 // WITHOUT ANY WARRANTY; without even the implied warranty of
19 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 // GNU General Public License for more details.
21 //
22 //
23 // You should have received a copy of the GNU General Public License
24 // along with this program.
25 // If not, see <http://www.gnu.org/licenses/>.
26 //----------------------------------------------------------------------------
27 
28 // $Revision: 1.4 $
29 // $Date: 2005/10/21 22:02:39 $
30 // $Source: /usr/local/cvs/OpenSees/SRC/nDarray/BJtensor.h,v $
31 
32 //#############################################################################
33 // #
34 // #
35 // /~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~/~~\ #
36 // | |____| #
37 // | | #
38 // | | #
39 // | | #
40 // | | #
41 // | B A S E C L A S S E S | #
42 // | | #
43 // | | #
44 // | | #
45 // | | #
46 // | C + + H E A D E R | #
47 // | | #
48 // | | #
49 // | | #
50 // | | #
51 // /~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~/ | #
52 // \_________________________________________\__/ #
53 // #
54 // #
55 //#############################################################################
56 //#############################################################################
58 //################################################################################
59 //# COPYRIGHT (C): :-)) #
60 //# PROJECT: Object Oriented Finite Element Program #
61 //# PURPOSE: #
62 //# CLASS: BJtensor #
63 //# #
64 //# VERSION: #
65 //# LANGUAGE: C++.ver >= 2.0 ( Borland C++ ver=3.10, SUN C++ ver=2.1 ) #
66 //# TARGET OS: DOS || UNIX || . . . #
67 //# DESIGNER(S): Boris Jeremic #
68 //# PROGRAMMER(S): Boris Jeremic #
69 //# #
70 //# #
71 //# DATE: May 28. - July __ '93 #
72 //# UPDATE HISTORY: july 8. '93. BJtensor02 - BJtensor multiplication #
73 //# inner and outer products #
74 //# august 17-19 '93 fixed default constructor that wasted #
75 //# memory ### #
76 //# october 11 '93 added transpose0110, transpose0101, #
77 //# transpose0111 so the creation of #
78 //# isotropic BJtensor is much easer and #
79 //# understandable! #
80 //# januar 06 '93 added BJtensor2BJmatrix_1, BJtensor2BJmatrix_2 #
81 //# BJtensor2BJmatrix_3, inverse_1, inverse_2, #
82 //# inverse_3 #
83 //# januar 20 '93 added inverse TRUE ONE #
84 //# August 22-29 '94 choped to separate files and worked on #
85 //# const and & issues #
86 //# August 30-31 '94 added use_def_dim to full the CC #
87 //# resolved problem with temoraries for #
88 //# operators + and - ( +=, -= ) #
89 //# Oktobar 15 '96 added trasposeoverbar trasposeunderbar #
90 //# ( the same as transpose0110 and #
91 //# transpose0101) but just to make it #
92 //# easier to work with Runesson's notation #
93 //# 28June2004 added val4 for efficiency still #
94 //# to be worked on #
95 //# #
96 //# #
97 //################################################################################
98 //*/
99 
100 #ifndef TENSOR_HH
101 #define TENSOR_HH
102 
103 
104 #include "utility/matrix/nDarray/nDarray.h"
105 
106 
107 namespace XC {
109 //
110 class BJtensor: public nDarray
111  {
112  friend class stresstensor;
113  friend class straintensor;
114 // private:
115  public:
116  mutable std::string indices1; // character array of indices
117  mutable std::string indices2; // they should be checked for matching and
118  // then operator will be identified
119  public: // just send appropriate arguments to the base constructor
120  BJtensor(int rank_of_BJtensor=1,const double &initval=0); // default constructor
121  BJtensor(int rank_of_BJtensor, const int *pdim, double *values);
122  BJtensor(int rank_of_BJtensor, const int *pdim,const double &initvalue);
123  BJtensor(const std::string &flag, int rank_of_BJtensor, const int *pdim); // create a unit nDarray
124  BJtensor(const std::string &flag); //this one used to send "NO" message
125  BJtensor(const BJtensor &x); // instead of: "BJtensor(nDarray & x):" :-)
126  explicit BJtensor(const nDarray &x);
127 
128  //~BJtensor( );
129 
130  BJtensor& operator=( const BJtensor & rval); // BJtensor assignment
131 
132  friend BJtensor operator+(const BJtensor & , const BJtensor & ); // BJtensor addition
133  friend BJtensor operator-(const BJtensor & , const BJtensor & ); // BJtensor substraction
134 
135  BJtensor& operator*=(const double &rval); // Added Zhao Oct2005
136  BJtensor operator*(const double &rval) const; // scalar multiplication, Added const Zhao Oct2005
137  BJtensor operator*(const BJtensor &rval) const; // inner/outter product
138  BJtensor operator/(const BJtensor &rval) const; // BJtensor division rval MUST BE BJtensor of
139  // order 0 ( i.e. scalar in BJtensor form )
140 
141  BJtensor transpose0110( ) const; // transpose ijkl -->> ikjl
142  BJtensor transposeoverbar( ) const; // transpose ijkl -->> ikjl
143  BJtensor transpose0101( ) const; // transpose ijkl -->> ilkj
144  BJtensor transpose0111( ) const; // transpose ijkl -->> iljk
145  BJtensor transposeunderbar( ) const; // transpose ijkl -->> iljk
146  BJtensor transpose1100( ) const; // transpose ijkl -->> jikl First minor symm
147  BJtensor transpose0011( ) const; // transpose ijkl -->> ijlk Second minor symm
148  BJtensor transpose1001( ) const; // transpose ijkl -->> ljki
149  BJtensor transpose11( ) const; // transpose ij -->> ji
150 
151  BJtensor symmetrize11( ) const; // symmetrize with respect to ij
152  double determinant(void) const; // determinant of a BJtensor
153  BJmatrix BJtensor2BJmatrix_1(void) const;// convert BJtensor of even order to BJmatrix
154  // to be used in inversion process
155  // I_ijkl scheme
156  BJmatrix BJtensor2BJmatrix_2(void) const;// convert BJtensor of even order to BJmatrix
157  // to be used in inversion process
158  // I_ikjl scheme
159  BJmatrix BJtensor2BJmatrix_3(void) const;// convert BJtensor of even order to BJmatrix
160  // to be used in inversion process
161  // I_iljk scheme
162  BJtensor inverse(void) const; // inverse of a BJtensor
163  // I_ikjl scheme TRUE ONE ____
164  // |
165  BJtensor inverse_2(void) const; // inverse of a BJtensor <--|
166  // I_ikjl scheme
167 
168  const BJtensor &operator()(const std::string &indices_from_user) const;
169 
170  void null_indices(void) const;
171  const std::string &f_indices1(void) const;
172  const std::string &f_indices2(void) const;
173 
174  private:
175 //K int BJtensor::contracted_ind(const std::string &, const std::string &, int *, int *, int , int );
176 //K int BJtensor::uncontracted_ind(int *, int *, int);
177  int contracted_ind(const std::string &,const std::string &, int *, int *, int , int ) const;
178  int uncontracted_ind(int *, int *, int) const;
179  };
180 
181 // GLOBAL
182 BJtensor operator*(const double &lval,const BJtensor &rval); // REVIEWER global *
183 
184 } // end of XC namespace
185 
186 #endif
187 
188 
189 
BJtensor transpose0101() const
Definition: BJtensor.cpp:1816
BJtensor transpose1100() const
Definition: BJtensor.cpp:1875
BJtensor transpose0011() const
Definition: BJtensor.cpp:1895
Definition: BJtensor.h:110
BJtensor transpose0111() const
Definition: BJtensor.cpp:1836
BJtensor transpose11() const
Definition: BJtensor.cpp:1938
BJtensor symmetrize11() const
Definition: BJtensor.cpp:1956
BJtensor transpose1001() const
Definition: BJtensor.cpp:1915
Definition: stresst.h:68
Strain tensor.
Definition: straint.h:67
BJtensor transposeoverbar() const
Definition: BJtensor.cpp:1797
BJtensor(int rank_of_BJtensor=1, const double &initval=0)
Default constructor.
Definition: BJtensor.cpp:108
Definition: BJmatrix.h:102
BJtensor transpose0110() const
Definition: BJtensor.cpp:1777
================================================================================
Definition: ContinuaReprComponent.h:34
Definition: nDarray.h:158
BJtensor transposeunderbar() const
Definition: BJtensor.cpp:1855