00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef MECHSYS_TENSORS_OPERATORS_H
00023 #define MECHSYS_TENSORS_OPERATORS_H
00024
00025 #ifdef HAVE_CONFIG_H
00026 #include "config.h"
00027 #else
00028 #ifndef REAL
00029 #define REAL double
00030 #endif
00031 #endif
00032
00033 #include "tensors/tensors.h"
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054 namespace Tensors
00055 {
00056
00061
00062 void Dot (Tensor2 const & A,
00063 Tensor1 const & u,
00064 Tensor1 & v);
00065
00066
00068 REAL Dot (Tensor2 const & x,
00069 Tensor2 const & y);
00070
00071
00073 void Dot (Tensor2 const & x,
00074 Tensor4 const & A,
00075 Tensor2 & y);
00076
00077
00079 void Dot (Tensor4 const & A,
00080 Tensor2 const & x,
00081 Tensor2 & y);
00082
00083
00085 void Dot (Tensor4 const & A,
00086 Tensor4 const & B,
00087 Tensor4 & C);
00088
00089
00091 void Dyad (Tensor2 const & x,
00092 Tensor2 const & y,
00093 Tensor4 & A);
00094
00095
00097 void AddScaled (REAL const & a,
00098 Tensor4 const & X,
00099 REAL const & b,
00100 Tensor4 const & Y,
00101 Tensor4 & Z);
00102
00103
00105 void Ger (REAL const & a,
00106 Tensor2 const & x,
00107 Tensor2 const & y,
00108 Tensor4 & A);
00109
00110
00112 void GerX (REAL const & a,
00113 Tensor4 const & A,
00114 Tensor2 const & x,
00115 Tensor2 const & y,
00116 Tensor4 const & B,
00117 Tensor4 const & C,
00118 Tensor4 & D);
00119
00120
00122 void Scale (REAL const & a,
00123 Tensor4 & B);
00124
00125
00127 void CopyScale (REAL const & a,
00128 Tensor4 const & A,
00129 Tensor4 & B);
00130
00131
00133 REAL Reduce(Tensor2 const & x,
00134 Tensor4 const & A,
00135 Tensor2 const & y);
00136
00138
00139
00141
00142
00143 inline void Dot(Tensor2 const & A,
00144 Tensor1 const & u,
00145 Tensor1 & v)
00146 {
00147 v(0) = A(0)*u(0) + A(3)*u(1) + A(5)*u(2);
00148 v(1) = A(3)*u(0) + A(1)*u(1) + A(4)*u(2);
00149 v(2) = A(5)*u(0) + A(4)*u(1) + A(2)*u(2);
00150 }
00151
00152
00153 inline REAL Dot (Tensor2 const & x, Tensor2 const & y)
00154 {
00155 return blitz::dot(x,y);
00156 }
00157
00158
00159 inline void Dot (Tensor2 const & x, Tensor4 const & A, Tensor2 & y)
00160 {
00161 y(0) = x(0)*A(0,0) + x(1)*A(1,0) + x(2)*A(2,0) + x(3)*A(3,0) + x(4)*A(4,0) + x(5)*A(5,0);
00162 y(1) = x(0)*A(0,1) + x(1)*A(1,1) + x(2)*A(2,1) + x(3)*A(3,1) + x(4)*A(4,1) + x(5)*A(5,1);
00163 y(2) = x(0)*A(0,2) + x(1)*A(1,2) + x(2)*A(2,2) + x(3)*A(3,2) + x(4)*A(4,2) + x(5)*A(5,2);
00164 y(3) = x(0)*A(0,3) + x(1)*A(1,3) + x(2)*A(2,3) + x(3)*A(3,3) + x(4)*A(4,3) + x(5)*A(5,3);
00165 y(4) = x(0)*A(0,4) + x(1)*A(1,4) + x(2)*A(2,4) + x(3)*A(3,4) + x(4)*A(4,4) + x(5)*A(5,4);
00166 y(5) = x(0)*A(0,5) + x(1)*A(1,5) + x(2)*A(2,5) + x(3)*A(3,5) + x(4)*A(4,5) + x(5)*A(5,5);
00167 }
00168
00169
00170 inline void Dot (Tensor4 const & A, Tensor2 const & x, Tensor2 & y)
00171 {
00172 y(0) = A(0,0)*x(0) + A(0,1)*x(1) + A(0,2)*x(2) + A(0,3)*x(3) + A(0,4)*x(4) + A(0,5)*x(5);
00173 y(1) = A(1,0)*x(0) + A(1,1)*x(1) + A(1,2)*x(2) + A(1,3)*x(3) + A(1,4)*x(4) + A(1,5)*x(5);
00174 y(2) = A(2,0)*x(0) + A(2,1)*x(1) + A(2,2)*x(2) + A(2,3)*x(3) + A(2,4)*x(4) + A(2,5)*x(5);
00175 y(3) = A(3,0)*x(0) + A(3,1)*x(1) + A(3,2)*x(2) + A(3,3)*x(3) + A(3,4)*x(4) + A(3,5)*x(5);
00176 y(4) = A(4,0)*x(0) + A(4,1)*x(1) + A(4,2)*x(2) + A(4,3)*x(3) + A(4,4)*x(4) + A(4,5)*x(5);
00177 y(5) = A(5,0)*x(0) + A(5,1)*x(1) + A(5,2)*x(2) + A(5,3)*x(3) + A(5,4)*x(4) + A(5,5)*x(5);
00178 }
00179
00180
00181 inline void Dot (Tensor4 const & A, Tensor4 const & B, Tensor4 & C)
00182 {
00183 C = blitz::product(A,B);
00184 }
00185
00186
00187 inline void Dyad (Tensor2 const & x, Tensor2 const & y, Tensor4 & A)
00188 {
00189 A(0,0)=x(0)*y(0); A(0,1)=x(0)*y(1); A(0,2)=x(0)*y(2); A(0,3)=x(0)*y(3); A(0,4)=x(0)*y(4); A(0,5)=x(0)*y(5);
00190 A(1,0)=x(1)*y(0); A(1,1)=x(1)*y(1); A(1,2)=x(1)*y(2); A(1,3)=x(1)*y(3); A(1,4)=x(1)*y(4); A(1,5)=x(1)*y(5);
00191 A(2,0)=x(2)*y(0); A(2,1)=x(2)*y(1); A(2,2)=x(2)*y(2); A(2,3)=x(2)*y(3); A(2,4)=x(2)*y(4); A(2,5)=x(2)*y(5);
00192 A(3,0)=x(3)*y(0); A(3,1)=x(3)*y(1); A(3,2)=x(3)*y(2); A(3,3)=x(3)*y(3); A(3,4)=x(3)*y(4); A(3,5)=x(3)*y(5);
00193 A(4,0)=x(4)*y(0); A(4,1)=x(4)*y(1); A(4,2)=x(4)*y(2); A(4,3)=x(4)*y(3); A(4,4)=x(4)*y(4); A(4,5)=x(4)*y(5);
00194 A(5,0)=x(5)*y(0); A(5,1)=x(5)*y(1); A(5,2)=x(5)*y(2); A(5,3)=x(5)*y(3); A(5,4)=x(5)*y(4); A(5,5)=x(5)*y(5);
00195 }
00196
00197
00198 inline void AddScaled (REAL const & a, Tensor4 const & X, RE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or2 const & x, Tensor2 const & y, Tensor4 & A)
00210 {
00211 A(0,0)=a*x(0)*y(0)+A(0,0); A(0,1)=a*x(0)*y(1)+A(0,1); A(0,2)=a*x(0)*y(2)+A(0,2); A(0,3)=a*x(0)*y(3)+A(0,3); A(0,4)=a*x(0)*y(4)+A(0,4); A(0,5)=a*x(0)*y(5)+A(0,5);
00212 A(1,0)=a*x(1)*y(0)+A(1,0); A(1,1)=a*x(1)*y(1)+A(1,1); A(1,2)=a*x(1)*y(2)+A(1,2); A(1,3)=a*x(1)*y(3)+A(1,3); A(1,4)=a*x(1)*y(4)+A(1,4); A(1,5)=a*x(1)*y(5)+A(1,5);
00213 A(2,0)=a*x(2)*y(0)+A(2,0); A(2,1)=a*x(2)*y(1)+A(2,1); A(2,2)=a*x(2)*y(2)+A(2,2); A(2,3)=a*x(2)*y(3)+A(2,3); A(2,4)=a*x(2)*y(4)+A(2,4); A(2,5)=a*x(2)*y(5)+A(2,5);
00214 A(3,0)=a*x(3)*y(0)+A(3,0); A(3,1)=a*x(3)*y(1)+A(3,1); A(3,2)=a*x(3)*y(2)+A(3,2); A(3,3)=a*x(3)*y(3)+A(3,3); A(3,4)=a*x(3)*y(4)+A(3,4); A(3,5)=a*x(3)*y(5)+A(3,5);
00215 A(4,0)=a*x(4)*y(0)+A(4,0); A(4,1)=a*x(4)*y(1)+A(4,1); A(4,2)=a*x(4)*y(2)+A(4,2); A(4,3)=a*x(4)*y(3)+A(4,3); A(4,4)=a*x(4)*y(4)+A(4,4); A(4,5)=a*x(4)*y(5)+A(4,5);
00216 A(5,0)=a*x(5)*y(0)+A(5,0); A(5,1)=a*x(5)*y(1)+A(5,1); A(5,2)=a*x(5)*y(2)+A(5,2); A(5,3)=a*x(5)*y(3)+A(5,3); A(5,4)=a*x(5)*y(4)+A(5,4); A(5,5)=a*x(5)*y(5)+A(5,5);
00217 }
00218
00219
00220 inline void GerX (REAL const & a, Tensor4 const & A, Tensor2 const & x, Tensor2 const & y, Tensor4 const & B,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(0,2); B(0,3)=a*B(0,3); B(0,4)=a*B(0,4); B(0,5)=a*B(0,5);
00271 B(1,0)=a*B(1,0); B(1,1)=a*B(1,1); B(1,2)=a*B(1,2); B(1,3)=a*B(1,3); B(1,4)=a*B(1,4); B(1,5)=a*B(1,5);
00272 B(2,0)=a*B(2,0); B(2,1)=a*B(2,1); B(2,2)=a*B(2,2); B(2,3)=a*B(2,3); B(2,4)=a*B(2,4); B(2,5)=a*B(2,5);
00273 B(3,0)=a*B(3,0); B(3,1)=a*B(3,1); B(3,2)=a*B(3,2); B(3,3)=a*B(3,3); B(3,4)=a*B(3,4); B(3,5)=a*B(3,5);
00274 B(4,0)=a*B(4,0); B(4,1)=a*B(4,1); B(4,2)=a*B(4,2); B(4,3)=a*B(4,3); B(4,4)=a*B(4,4); B(4,5)=a*B(4,5);
00275 B(5,0)=a*B(5,0); B(5,1)=a*B(5,1); B(5,2)=a*B(5,2); B(5,3)=a*B(5,3); B(5,4)=a*B(5,4); B(5,5)=a*B(5,5);
00276 }
00277
00278
00279 inline void CopyScale (REAL const & a, Tensor4 const & A, Tensor4 & B)
00280 {
00281 B(0,0)=a*A(0,0); B(0,1)=a*A(0,1); B(0,2)=a*A(0,2); B(0,3)=a*A(0,3); B(0,4)=a*A(0,4); B(0,5)=a*A(0,5);
00282 B(1,0)=a*A(1,0); B(1,1)=a*A(1,1); B(1,2)=a*A(1,2); B(1,3)=a*A(1,3); B(1,4)=a*A(1,4); B(1,5)=a*A(1,5);
00283 B(2,0)=a*A(2,0); B(2,1)=a*A(2,1); B(2,2)=a*A(2,2); B(2,3)=a*A(2,3); B(2,4)=a*A(2,4); B(2,5)=a*A(2,5);
00284 B(3,0)=a*A(3,0); B(3,1)=a*A(3,1); B(3,2)=a*A(3,2); B(3,3)=a*A(3,3); B(3,4)=a*A(3,4); B(3,5)=a*A(3,5);
00285 B(4,0)=a*A(4,0); B(4,1)=a*A(4,1); B(4,2)=a*A(4,2); B(4,3)=a*A(4,3); B(4,4)=a*A(4,4); B(4,5)=a*A(4,5);
00286 B(5,0)=a*A(5,0); B(5,1)=a*A(5,1); B(5,2)=a*A(5,2); B(5,3)=a*A(5,3); B(5,4)=a*A(5,4); B(5,5)=a*A(5,5);
00287 }
00288
00289
00290 inline REAL Reduce(Tensor2 const & x, Tensor4 const & A, Tensor2 const & y)
00291 {
00292 return x(0)*(A(0,0)*y(0) + A(0,1)*y(1) + A(0,2)*y(2) + A(0,3)*y(3) + A(0,4)*y(4) + A(0,5)*y(5)) +
00293 x(1)*(A(1,0)*y(0) + A(1,1)*y(1) + A(1,2)*y(2) + A(1,3)*y(3) + A(1,4)*y(4) + A(1,5)*y(5)) +
00294 x(2)*(A(2,0)*y(0) + A(2,1)*y(1) + A(2,2)*y(2) + A(2,3)*y(3) + A(2,4)*y(4) + A(2,5)*y(5)) +
00295 x(3)*(A(3,0)*y(0) + A(3,1)*y(1) + A(3,2)*y(2) + A(3,3)*y(3) + A(3,4)*y(4) + A(3,5)*y(5)) +
00296 x(4)*(A(4,0)*y(0) + A(4,1)*y(1) + A(4,2)*y(2) + A(4,3)*y(3) + A(4,4)*y(4) + A(4,5)*y(5)) +
00297 x(5)*(A(5,0)*y(0) + A(5,1)*y(1) + A(5,2)*y(2) + A(5,3)*y(3) + A(5,4)*y(4) + A(5,5)*y(5));
00298 }
00299
00300 };
00301
00302 #endif // MECHSYS_TENSORS_OPERATORS_H
00303
00304