muMECH  1.0
matrixOperations.h
Go to the documentation of this file.
1 //********************************************************************************************************
2 // code: ### ### ##### #### ## ##
3 // ## ## ######## ## ## ## ## ##
4 // ## ## ## ## ## ### ## ######
5 // ## ## ## ## ## ## ## ## ##
6 // ##### ## ## ##### #### ## ##
7 // ##
8 //
9 // name: matrixOperations.h
10 // author(s): Jan Novak
11 // language: C, C++
12 // license: This program is free software; you can redistribute it and/or modify
13 // it under the terms of the GNU Lesser General Public License as published by
14 // the Free Software Foundation; either version 2 of the License, or
15 // (at your option) any later version.
16 //
17 // This program is distributed in the hope that it will be useful,
18 // but WITHOUT ANY WARRANTY; without even the implied warranty of
19 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 // GNU Lesser General Public License for more details.
21 //
22 // You should have received a copy of the GNU Lesser General Public License
23 // along with this program; if not, write to the Free Software
24 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 //********************************************************************************************************
31 #ifndef MUMECH_MATRIX_OPERATIONS_H
32 #define MUMECH_MATRIX_OPERATIONS_H
33 
34 #include "elementaryFunctions.h"
35 
36 namespace mumech {
37 
82 namespace MatrixOperations
83 {
84 
85 // *******************************************************************************************************
86 // /** Operations with tensors of various notations **/
87 // /** @name *** GENERAL TENSOR OPERATIONS *** **/
88 // ***************************************************|***************************************************
89 
90 // @{
91 
92 // ***** PRODUCTS *****
93 
94 //void E = give_TensorTensorProduct (hstrain, hstress, p->nstrain_one());
95 
103 double giveTTproduct_1is2x2to3and2x2to3_SS (const double *T1, const double *T2);
104 
105 
115 void giveIsoTensAndVectorProduct (const double *tens, const double *vec, double *result, int dim);
116 
124 void giveTVproduct_6is6x6to12and6 (double *result, const double *T, const double *vect);
125 
133 void giveTVproduct_3is3x3to5and3 (double *result, const double *T, const double *vect);
140 double giveVTVproduct_1is3and3x3to5and3 (const double *T, const double *vect);
148 void giveTTproduct_3x3to5is3x3to5and3x3to5 (double *result, const double *T1, const double *T2);
149 
150 
151 
152 // energy[pid[lc] = give_TensorTensorProduct (strain[pid][lc], stress[pid][lc], M->P[pid]->nstrain_one());
153 
154 
155 // ***** OTHER *****
156 
157 
164 void giveInverseMatrix (double *mtrx, int n);
166 void giveInverseMatrix (double **mtrx, int n);
173 void giveInverseMatrix_core (double **answer, double **mtrx, int n, bool vect);
174 
175 
176 // ***** PRINT *****
177 
179 void printField( double ** field, int n, int m, const char * notice );
180 
182 void printField( double ** field, int n, int m, int lineBreak, const char * notice );
183 
185 void printAnisoField( double ** field, int n, int * m, int lineBreak, const char * notice );
186 
188 void printAnisoField( int ** field, int n, int * m, int lineBreak, const char * notice );
189 
190 // @}
191 
192 // *******************************************************************************************************
193 // /** Operations with tensors of various notations **/
194 // /** @name *** GENERAL TENSOR OPERATIONS *** **/
195 // ***************************************************|***************************************************
196 
197 // @{
198 
200 //inline void CopyTensor( double * a, double * b ) { CopyVector( a, b, 9 ); }
201 
202 
208 void CopyTensorAndReduceToFeep (const double *a, double *b);
209 
215 void convert2Dtensor_TRtoROW_notation (double *t);
221 void convert3Dtensor_TFEEPtoROW_notation (double *t);
222 
228 void convert2Dtensor_TRtoVR_notation (double *t);
234 void convert3Dtensor_TRtoVR_notation (double *t);
235 
236 
238 void convert3Dtensor_9ROWto6FEEP_notation (double *t);
240 void convert2Dtensor_4ROWto3FEEP_notation (double *t);
241 
247 void copy3Dto2Dtensors_FEEPreduced (const double *a, double *b);
248 
254 void copy2Dto3Dtensors_FEEPreduced (const double *a, double *b);
255 
260 void copy3DeshelbyTensor_reduced2full (const double *a, double **b);
265 void copy2DeshelbyTensor_reduced2full (const double *a, double **b);
266 
271 void copy3DeshelbyTensor_full2reduced (const double *a, double *b);
276 void copy3DeshelbyTensor_reduced2full (const double *a, double *b);
277 
278 
283 void copy2DeshelbyTensor_full2reduced (const double *a, double *b);
288 void copy2DeshelbyTensor_reduced2full (const double *a, double *b);
289 
290 
292 inline void giveUnitSMatrixReduced_2d (double *m) { CleanVector(m, 5); m[0] = m[3] = m[4] = 1.0; }
294 inline void giveUnitSMatrixReduced_3d (double *m) { CleanVector(m, 12); m[0] = m[4] = m[8] = m[9] = m[10] = m[11] = 1.0; }
295 
297 inline void giveUnitSMatrixFull_2d (double *m) { CleanVector(m, 9); m[0] = m[4] = m[8] = 1.0; }
299 inline void giveUnitSMatrixFull_3d (double *m) { CleanVector(m, 36); m[0] = m[7] = m[14] = m[21] = m[28] = m[35] = 1.0; }
300 
301 
302 
306 void printSMatrixReduced (const double S[12], const char * notice, unsigned flag);
307 
308 
309 // @}
310 
311 } // end of namespace MatrixOperaions
312 
313 } // end of namespace mumech
314 
315 #endif
316 
317 /*end of file*/
void convert2Dtensor_TRtoVR_notation(double *t)
Function convert the symmetric double 2D tensor 't'.
void copy2DeshelbyTensor_reduced2full(const double *a, double **b)
Function copies and converts 2D eshelby/stiffness tensor saved in reduced row-wise vector 'a' to full...
void printField(double **field, int n, int m, const char *notice)
Function prints a field which is saved as 2D array.
double giveTTproduct_1is2x2to3and2x2to3_SS(const double *T1, const double *T2)
Function gives scalar left-right product of tensor and tensor.
void giveUnitSMatrixFull_2d(double *m)
Function sets reduced 2d SMatrix to unit matrix.
void convert3Dtensor_9ROWto6FEEP_notation(double *t)
void convert2Dtensor_4ROWto3FEEP_notation(double *t)
void copy3DeshelbyTensor_reduced2full(const double *a, double **b)
Function copies and converts 3D eshelby/stiffness tensor saved in reduced row-wise vector 'a' to full...
double giveVTVproduct_1is3and3x3to5and3(const double *T, const double *vect)
Function gives scalar left-right product of tensor and vector - 'result = vect^T * T * vect'...
void giveUnitSMatrixReduced_3d(double *m)
Function sets reduced 3d SMatrix to unit matrix.
void giveTVproduct_6is6x6to12and6(double *result, const double *T, const double *vect)
Function gives product of tensor and vector - 'result = T * vect'.
void printAnisoField(double **field, int n, int *m, int lineBreak, const char *notice)
Function prints an anisotropic field of type 'double' which is saved as 2D anisotropic array...
void copy2Dto3Dtensors_FEEPreduced(const double *a, double *b)
Function copy the symmetric double 2D tensor 'a' to 3D tensor 'b'.
Collection of the functions of basic manipulations, some of them can be used instead of their counter...
void copy2DeshelbyTensor_full2reduced(const double *a, double *b)
Function copies and converts 2D eshelby/stiffness tensor saved in full row-wise vector 'a' to reduced...
void giveTTproduct_3x3to5is3x3to5and3x3to5(double *result, const double *T1, const double *T2)
Function gives product of tensor and tensor - 'result = T1 * T2'.
void printSMatrixReduced(const double S[12], const char *notice, unsigned flag)
Function prints an reduced SMatrix in matrix form.
void convert3Dtensor_TRtoVR_notation(double *t)
Function convert the symmetric double 3D tensor 't'.
void convert2Dtensor_TRtoROW_notation(double *t)
Function convert the symmetric double 2D tensor 't'.
void giveIsoTensAndVectorProduct(const double *tens, const double *vec, double *result, int dim)
Function gives the product of the isotropic tensor of seccond order with a vector.
void copy3DeshelbyTensor_full2reduced(const double *a, double *b)
Function copies and converts 3D eshelby/stiffness tensor saved in full row-wise vector 'a' to reduced...
void giveTVproduct_3is3x3to5and3(double *result, const double *T, const double *vect)
Function gives product of tensor and vector - 'result = T * vect'.
void convert3Dtensor_TFEEPtoROW_notation(double *t)
Function convert the symmetric double 3D tensor 't'.
void giveInverseMatrix(double *mtrx, int n)
Function computes inversion of squared matrix mtrx.
void giveUnitSMatrixReduced_2d(double *m)
Function sets reduced 2d SMatrix to unit matrix.
void copy3Dto2Dtensors_FEEPreduced(const double *a, double *b)
Function copy the symmetric double 3D tensor 'a' to 2D tensor 'b'.
void giveInverseMatrix_core(double **answer, double **mtrx, int n, bool vect)
Function gives inversion of squared matrix mtrx.
void giveUnitSMatrixFull_3d(double *m)
Function sets reduced 3d SMatrix to unit matrix.
void CleanVector(double *a, long n)
Functin cleans a 'double' vector, initialize each value being 0-zero.
void CopyTensorAndReduceToFeep(const double *a, double *b)
Function copy two double tensor, 'a' -> 'b', saved as 9 component vectors.