KratosMultiphysics
KRATOS Multiphysics (Kratos) is a framework for building parallel, multi-disciplinary simulation software, aiming at modularity, extensibility, and high performance. Kratos is written in C++, and counts with an extensive Python interface.
beam_math_utilities.hpp
Go to the documentation of this file.
1 // | / |
2 // ' / __| _` | __| _ \ __|
3 // . \ | ( | | ( |\__ \.
4 // _|\_\_| \__,_|\__|\___/ ____/
5 // Multi-Physics
6 //
7 // License: BSD License
8 // Main author: Josep Maria Carbonell
9 // coming from StringDynamicsApplication
10 //
11 //
12 
13 #if !defined(KRATOS_BEAM_MATH_UTILITIES)
14 #define KRATOS_BEAM_MATH_UTILITIES
15 
16 // System includes
17 #include <cmath>
18 
19 // External includes
20 
21 // Project includes
22 #include "utilities/math_utils.h"
23 #include "utilities/quaternion.h"
24 #include "geometries/point.h"
25 
26 
27 namespace Kratos
28 {
29 
30 template<class TDataType> class BeamMathUtils
31 {
32 public:
35 
36  typedef Matrix MatrixType;
37  typedef Vector VectorType;
38 
42 
46 
47  //************************************************************************************
48  //************************************************************************************
49 
56  template<class TVector3>
57  static inline TVector3& MapToCurrentLocalFrame(QuaternionType& rQuaternion, TVector3& rVector)
58  {
60 
61  //(rQuaternion.conjugate()).RotateVector3(rVariable);
62  // precision problems due to a rest included in the rotation
63 
64  //vector value : v' = QT * v
65 
66  Matrix RotationMatrix;
67  (rQuaternion.conjugate()).ToRotationMatrix(RotationMatrix);
68 
69  rVector = prod(RotationMatrix,rVector);
70 
71  return rVector;
72 
73  KRATOS_CATCH( "" )
74  }
75 
76 
77  //************************************************************************************
78  //************************************************************************************
79 
80 
87  template<class TVector3>
88  static inline TVector3& MapToReferenceLocalFrame(QuaternionType& rQuaternion, TVector3& rVector)
89  {
91 
92  //rQuaternion.RotateVector3(rVariable);
93  // precision problems due to a rest included in the rotation
94 
95  //vector value : v = Q * v'
96 
97  Matrix RotationMatrix;
98  rQuaternion.ToRotationMatrix(RotationMatrix);
99 
100  rVector = prod(RotationMatrix,rVector);
101 
102  return rVector;
103 
104  KRATOS_CATCH( "" )
105 
106  }
107 
108 
109  //************************************************************************************
110  //************************************************************************************
111 
117  template<class TVector3>
118  static inline void ExponentialTransform(const TVector3& rVector, MatrixType& rExponentialTensor)
119  {
120  KRATOS_TRY
121 
122  //Initialize Local Matrices
123  if( rExponentialTensor.size1() != 3 )
124  rExponentialTensor.resize(3, 3, false);
125 
126  QuaternionType QuaternionValue = QuaternionType::FromRotationVector(rVector);
127  QuaternionValue.ToRotationMatrix(rExponentialTensor);
128 
129 
130  KRATOS_CATCH( "" )
131  }
132 
133  //************************************************************************************
134  //************************************************************************************
135 
141  template<class TVector3>
142  static inline void InverseExponentialTransform(const MatrixType& rExponentialTensor, TVector3& rVector)
143  {
144  KRATOS_TRY
145 
146  //Initialize Local Matrices
147  if( rVector.size() != 3 )
148  rVector.resize(3,false);
149 
150  QuaternionType QuaternionValue = QuaternionType::FromRotationMatrix(rExponentialTensor);
151  QuaternionValue.ToRotationVector(rVector);
152 
153  KRATOS_CATCH( "" )
154  }
155 
156  //************************************************************************************
157  //************************************************************************************
158 
164  template<class TVector3>
165  static inline void CayleyTransform(const TVector3& rVector, MatrixType& rCayleyTensor)
166  {
167  KRATOS_TRY
168 
169  //Initialize Local Matrices
170  if( rCayleyTensor.size1() != 3 )
171  rCayleyTensor.resize(3, 3, false);
172 
173  rCayleyTensor(0,0) = 0.5 * (4.0+rVector[0]*rVector[0]-rVector[1]*rVector[1]-rVector[2]*rVector[2]);
174  rCayleyTensor(1,1) = 0.5 * (4.0-rVector[0]*rVector[0]+rVector[1]*rVector[1]-rVector[2]*rVector[2]);
175  rCayleyTensor(2,2) = 0.5 * (4.0-rVector[0]*rVector[0]-rVector[1]*rVector[1]+rVector[2]*rVector[2]);
176 
177  rCayleyTensor(0,1) = (rVector[0]*rVector[1]-2.0*rVector[2]);
178  rCayleyTensor(0,2) = (rVector[0]*rVector[2]+2.0*rVector[1]);
179  rCayleyTensor(1,2) = (rVector[1]*rVector[2]-2.0*rVector[0]);
180 
181  rCayleyTensor(1,0) = (rVector[0]*rVector[1]+2.0*rVector[2]);
182  rCayleyTensor(2,0) = (rVector[0]*rVector[2]-2.0*rVector[1]);
183  rCayleyTensor(2,1) = (rVector[1]*rVector[2]+2.0*rVector[0]);
184 
185  rCayleyTensor *= (2.0 / (4.0+rVector[0]*rVector[0]+rVector[1]*rVector[1]+rVector[2]*rVector[2]));
186 
187  KRATOS_CATCH( "" )
188  }
189 
190  //***************************************************************************
191  //***************************************************************************
192 
198  template<class TVector3>
199  static inline void InverseCayleyTransform(const MatrixType& rCayleyTensor, TVector3& rVector)
200  {
201  KRATOS_TRY
202 
203  //Initialize Local Matrices
204  if( rVector.size() != 3 )
205  rVector.resize(3,false);
206 
207  Matrix Identity = IdentityMatrix(3);
208  Matrix CayI = rCayleyTensor + Identity;
209  Matrix CayII = rCayleyTensor - Identity;
210 
211  Matrix InvertCayI;
212  double det;
213  MathUtilsType::InvertMatrix3(CayI, InvertCayI, det);
214 
215  Matrix SkewSymTensor = 2 * prod( InvertCayI, CayII );
216 
217  BeamMathUtilsType::SkewSymmetricTensorToVector( SkewSymTensor, rVector);
218 
219  KRATOS_CATCH( "" )
220  }
221 
222  //************************************************************************************
223  //************************************************************************************
224 
230  template<class TVector3, class TMatrix3>
231  static inline void VectorToSkewSymmetricTensor(const TVector3& rVector, TMatrix3& rSkewSymmetricTensor)
232  {
233  KRATOS_TRY
234 
235  //Initialize Local Matrices
236  if( rSkewSymmetricTensor.size1() != 3 )
237  rSkewSymmetricTensor.resize(3, 3, false);
238 
239  rSkewSymmetricTensor( 0, 0 ) = 0.0;
240  rSkewSymmetricTensor( 1, 1 ) = 0.0;
241  rSkewSymmetricTensor( 2, 2 ) = 0.0;
242 
243  rSkewSymmetricTensor( 0, 1 ) = -rVector[2];
244  rSkewSymmetricTensor( 0, 2 ) = rVector[1];
245  rSkewSymmetricTensor( 1, 2 ) = -rVector[0];
246 
247  rSkewSymmetricTensor( 1, 0 ) = rVector[2];
248  rSkewSymmetricTensor( 2, 0 ) = -rVector[1];
249  rSkewSymmetricTensor( 2, 1 ) = rVector[0];
250 
251  KRATOS_CATCH( "" )
252  }
253 
254  //************************************************************************************
255  //************************************************************************************
261  template<class TMatrix3, class TVector3>
262  static inline void SkewSymmetricTensorToVector(const TMatrix3& rSkewSymmetricTensor, TVector3& rVector)
263  {
264  KRATOS_TRY
265 
266  //Initialize Local Matrices
267  if( rVector.size() != 3 )
268  rVector.resize(3,false);
269 
270  rVector[0] = 0.5 * ( rSkewSymmetricTensor( 2, 1 ) - rSkewSymmetricTensor( 1, 2 ) );
271  rVector[1] = 0.5 * ( rSkewSymmetricTensor( 0, 2 ) - rSkewSymmetricTensor( 2, 0 ) );
272  rVector[2] = 0.5 * ( rSkewSymmetricTensor( 1, 0 ) - rSkewSymmetricTensor( 0, 1 ) );
273 
274 
275  KRATOS_CATCH( "" )
276  }
277 
278  //************************************************************************************
279  //************************************************************************************
286  static inline double KroneckerDelta(int i, int j)
287  {
288  KRATOS_TRY
289 
290  if( i==j )
291  return 1;
292  else
293  return 0;
294 
295  KRATOS_CATCH( "" )
296  }
297 
298 
299  //************************************************************************************
300  //************************************************************************************
308  static inline double LeviCivitaEpsilon(int i, int j, int k)
309  {
310  KRATOS_TRY
311 
312  if( i==j || j==k || k==i )
313  return 0;
314 
315  if( (i==1 && j==2 && k==3) || (i==2 && j==3 && k==1) || (i==3 && j==1 && k==2) )
316  return 1;
317 
318  if( (i==3 && j==2 && k==1) || (i==1 && j==3 && k==2) || (i==2 && j==1 && k==3) )
319  return -1;
320 
321  return 0;
322 
323  KRATOS_CATCH( "" )
324  }
325 
326  //************************************************************************************
327  //************************************************************************************
328 
336  static inline void AddVector(const VectorType& rInputVector,VectorType& rOutputVector,const unsigned int InitialRow)
337  {
338  KRATOS_TRY
339 
340  for(unsigned int i=0; i<rInputVector.size(); i++)
341  rOutputVector[InitialRow+i] += rInputVector[i];
342 
343  KRATOS_CATCH("")
344  }
345 
346  //************************************************************************************
347  //************************************************************************************
348 
356  static inline void SubstractVector(const VectorType& rInputVector,VectorType& rOutputVector,const unsigned int InitialRow)
357  {
358  KRATOS_TRY
359 
360  for(unsigned int i=0; i<rInputVector.size(); i++)
361  rOutputVector[InitialRow+i] -= rInputVector[i];
362 
363  KRATOS_CATCH("")
364  }
365 
366 
378  template<class TMatrix, class TInputMatrix>
379  static inline void AddMatrix(TMatrix& rDestination,const TInputMatrix& rInputMatrix,const unsigned int rInitialRow,const unsigned int rInitialCol)
380  {
381  KRATOS_TRY
382  for(unsigned int i = 0; i < rInputMatrix.size1(); i++)
383  {
384  for(unsigned int j = 0; j < rInputMatrix.size2(); j++)
385  {
386  rDestination(rInitialRow+i, rInitialCol+j) += rInputMatrix(i,j);
387  }
388  }
389  KRATOS_CATCH("")
390  }
391 
403  template<class TMatrix, class TInputMatrix>
404  static inline void SubtractMatrix(TMatrix& rDestination,const TInputMatrix& rInputMatrix,const unsigned int rInitialRow,const unsigned int rInitialCol)
405  {
406  KRATOS_TRY;
407 
408  for(unsigned int i = 0; i<rInputMatrix.size1(); i++)
409  {
410  for(unsigned int j = 0; j<rInputMatrix.size2(); j++)
411  {
412  rDestination(rInitialRow+i, rInitialCol+j) -= rInputMatrix(i,j);
413  }
414  }
415 
416  KRATOS_CATCH("");
417  }
418 
419  //*****************************************************************************
420  //*****************************************************************************
421 
429  static inline void MapLocalToGlobal2D(const QuaternionType& rLocalToGlobalQuaternion, MatrixType& rMatrix)
430  {
431 
432  KRATOS_TRY
433 
434  MatrixType LocalToGlobalMatrix;
435  rLocalToGlobalQuaternion.ToRotationMatrix(LocalToGlobalMatrix);
436 
437  MapLocalToGlobal2D(LocalToGlobalMatrix,rMatrix);
438 
439  KRATOS_CATCH( "" )
440 
441  }
442 
443  //*****************************************************************************
444  //*****************************************************************************
445 
452  static inline void MapLocalToGlobal2D(const QuaternionType& rLocalToGlobalQuaternion, VectorType& rVector)
453  {
454 
455  KRATOS_TRY
456 
457  MatrixType LocalToGlobalMatrix;
458  rLocalToGlobalQuaternion.ToRotationMatrix(LocalToGlobalMatrix);
459 
460  MapLocalToGlobal2D(LocalToGlobalMatrix,rVector);
461 
462  KRATOS_CATCH( "" )
463 
464  }
465 
466 
467  //*****************************************************************************
468  //*****************************************************************************
469 
477  static inline void MapLocalToGlobal2D(const MatrixType& rLocalToGlobalMatrix, MatrixType& rMatrix)
478  {
479 
480  KRATOS_TRY
481 
482  unsigned int MatSize = rMatrix.size1();
483 
484  Matrix AuxiliarRotationMatrix(MatSize,MatSize);
485  noalias(AuxiliarRotationMatrix) = ZeroMatrix(MatSize,MatSize);
486 
487  //Building the rotation matrix for the local element matrix
488  for (unsigned int kk=0; kk < MatSize; kk += 2)
489  {
490  for (unsigned int i=0; i<2; i++)
491  {
492  for(unsigned int j=0; j<2; j++)
493  {
494  AuxiliarRotationMatrix(i+kk,j+kk) = rLocalToGlobalMatrix(i,j);
495  }
496  }
497  }
498 
499  //Rotate Local Stiffness Matrix
500  Matrix aux_matrix(MatSize,MatSize);
501  noalias(aux_matrix) = prod(AuxiliarRotationMatrix, rMatrix);
502 
503  //Stiffness Matrix
504  noalias(rMatrix) = prod(aux_matrix,trans(AuxiliarRotationMatrix));
505 
506 
507  KRATOS_CATCH( "" )
508 
509  }
510 
511  //*****************************************************************************
512  //*****************************************************************************
513 
520  static inline void MapLocalToGlobal2D(const MatrixType& rLocalToGlobalMatrix, VectorType& rVector)
521  {
522 
523  KRATOS_TRY
524 
525  unsigned int MatSize = rVector.size();
526 
527  Matrix AuxiliarRotationMatrix(MatSize,MatSize);
528  noalias(AuxiliarRotationMatrix) = ZeroMatrix(MatSize,MatSize);
529 
530  //Building the rotation matrix for the local element matrix
531  for (unsigned int kk=0; kk < MatSize; kk += 2)
532  {
533  for (unsigned int i=0; i<2; i++)
534  {
535  for(unsigned int j=0; j<2; j++)
536  {
537  AuxiliarRotationMatrix(i+kk,j+kk) = rLocalToGlobalMatrix(i,j);
538  }
539  }
540  }
541 
542  rVector = prod(AuxiliarRotationMatrix, rVector);
543 
544  KRATOS_CATCH( "" )
545 
546  }
547 
548  //*****************************************************************************
549  //*****************************************************************************
550 
558  static inline void MapLocalToGlobal3D(const QuaternionType& rLocalToGlobalQuaternion, MatrixType& rMatrix)
559  {
560 
561  KRATOS_TRY
562 
563  MatrixType LocalToGlobalMatrix(3,3);
564  rLocalToGlobalQuaternion.ToRotationMatrix(LocalToGlobalMatrix);
565 
566  MapLocalToGlobal3D(LocalToGlobalMatrix,rMatrix);
567 
568  KRATOS_CATCH( "" )
569 
570  }
571 
572  //*****************************************************************************
573  //*****************************************************************************
574 
581  static inline void MapLocalToGlobal3D(const QuaternionType& rLocalToGlobalQuaternion, VectorType& rVector)
582  {
583 
584  KRATOS_TRY
585 
586  MatrixType LocalToGlobalMatrix(3,3);
587  rLocalToGlobalQuaternion.ToRotationMatrix(LocalToGlobalMatrix);
588 
589  MapLocalToGlobal3D(LocalToGlobalMatrix,rVector);
590 
591  KRATOS_CATCH( "" )
592 
593  }
594 
595  //*****************************************************************************
596  //*****************************************************************************
597 
605  static inline void MapLocalToGlobal3D(const MatrixType& rLocalToGlobalMatrix, MatrixType& rMatrix)
606  {
607 
608  KRATOS_TRY
609 
610  unsigned int MatSize = rMatrix.size1();
611 
612  Matrix AuxiliarRotationMatrix(MatSize,MatSize);
613  noalias(AuxiliarRotationMatrix) = ZeroMatrix(MatSize,MatSize);
614 
615  //Building the rotation matrix for the local element matrix
616  for (unsigned int kk=0; kk < MatSize; kk += 3)
617  {
618  for (unsigned int i=0; i<3; i++)
619  {
620  for(unsigned int j=0; j<3; j++)
621  {
622  AuxiliarRotationMatrix(i+kk,j+kk) = rLocalToGlobalMatrix(i,j);
623  }
624  }
625  }
626 
627  //Rotate Local Stiffness Matrix
628  Matrix aux_matrix(MatSize,MatSize);
629  noalias(aux_matrix) = prod(AuxiliarRotationMatrix, rMatrix);
630 
631  //Stiffness Matrix
632  noalias(rMatrix) = prod(aux_matrix,trans(AuxiliarRotationMatrix));
633 
634 
635  KRATOS_CATCH( "" )
636 
637  }
638 
639  //*****************************************************************************
640  //*****************************************************************************
641 
648  static inline void MapLocalToGlobal3D(const MatrixType& rLocalToGlobalMatrix, VectorType& rVector)
649  {
650 
651  KRATOS_TRY
652 
653  unsigned int MatSize = rVector.size();
654 
655  Matrix AuxiliarRotationMatrix(MatSize,MatSize);
656  noalias(AuxiliarRotationMatrix) = ZeroMatrix(MatSize,MatSize);
657 
658  //Building the rotation matrix for the local element matrix
659  for (unsigned int kk=0; kk < MatSize; kk += 3)
660  {
661  for (unsigned int i=0; i<3; i++)
662  {
663  for(unsigned int j=0; j<3; j++)
664  {
665  AuxiliarRotationMatrix(i+kk,j+kk) = rLocalToGlobalMatrix(i,j);
666  }
667  }
668  }
669 
670  rVector = prod(AuxiliarRotationMatrix, rVector);
671 
672  KRATOS_CATCH( "" )
673 
674  }
675 
676 
677  //****************GID DEFINITION OF THE AUTOMATIC LOCAL AXES******************
678  //*****************************************************************************
679 
685  template<class TVector3>
686  static inline void CalculateLocalAxesMatrix(const TVector3& rLocalX, MatrixType& rRotationMatrix)
687  {
688 
689  KRATOS_TRY
690 
691  TVector3 LocalX = rLocalX;
692  TVector3 LocalY = ZeroVector(3);
693  TVector3 LocalZ = ZeroVector(3);
694 
695  BeamMathUtilsType::CalculateLocalAxesVectors(LocalX,LocalY,LocalZ);
696 
697  //Transformation matrix T = [e1_local, e2_local, e3_local]
698  if( rRotationMatrix.size1() != 3 )
699  rRotationMatrix.resize(3, 3, false);
700 
701  //Building the rotation matrix
702  for (unsigned int i=0; i<3; i++)
703  {
704  rRotationMatrix(i,0) = LocalX[i]; // column distribution
705  rRotationMatrix(i,1) = LocalY[i];
706  rRotationMatrix(i,2) = LocalZ[i];
707  }
708 
709  KRATOS_CATCH( "" )
710 
711  }
712 
713  //*****************************************************************************
714  //*****************************************************************************
715 
722  template<class TVector3>
723  static inline void CalculateLocalAxesVectors(TVector3& rLocalX, TVector3& rLocalY, TVector3& rLocalZ)
724  {
725 
726  KRATOS_TRY
727 
728  TVector3 GlobalY = ZeroVector(3);
729  GlobalY[1]=1.0;
730 
731  TVector3 GlobalZ = ZeroVector(3);
732  GlobalZ[2]=1.0;
733 
734  // local x-axis (e1_local) is the beam axis
735  double VectorNorm = MathUtilsType::Norm(rLocalX);
736  if( VectorNorm != 0)
737  rLocalX /= VectorNorm;
738 
739  // local y-axis (e2_local)
740  double tolerance = 1.0/64.0;
741  if(fabs(rLocalX[0])< tolerance && fabs(rLocalX[1])< tolerance){
742  MathUtilsType::CrossProduct(rLocalY,GlobalY,rLocalX);
743  }
744  else{
745  MathUtilsType::CrossProduct(rLocalY,GlobalZ,rLocalX);
746  }
747 
748  VectorNorm = MathUtilsType::Norm(rLocalY);
749  if( VectorNorm != 0)
750  rLocalY /= VectorNorm;
751 
752  // local z-axis (e3_local)
753  MathUtilsType::CrossProduct(rLocalZ,rLocalX,rLocalY);
754 
755  VectorNorm = MathUtilsType::Norm(rLocalZ);
756  if( VectorNorm != 0 )
757  rLocalZ /= VectorNorm;
758 
759 
760  KRATOS_CATCH( "" )
761  }
762 
763 
764  //****************GID DEFINITION OF THE CUSTOM LOCAL AXES***********************
765  //*****************************************************************************
766 
773  template<class TVector3>
774  static inline void CalculateLocalAxesMatrix(const TVector3& rLocalX, const TVector3& rLocalY, MatrixType& rRotationMatrix)
775  {
776 
777  KRATOS_TRY
778 
779  TVector3 LocalX = rLocalX;
780  TVector3 LocalY = rLocalY;
781  TVector3 LocalZ = ZeroVector(3);
782 
783  BeamMathUtilsType::CalculateLocalAxisVector(LocalX,LocalY,LocalZ);
784 
785  //Transformation matrix T = [e1_local, e2_local, e3_local]
786  if( rRotationMatrix.size1() != 3 )
787  rRotationMatrix.resize(3, 3, false);
788 
789  //Building the rotation matrix
790  for (unsigned int i=0; i<3; i++)
791  {
792  rRotationMatrix(i,0) = LocalX[i]; // column distribution
793  rRotationMatrix(i,1) = LocalY[i];
794  rRotationMatrix(i,2) = LocalZ[i];
795  }
796 
797  KRATOS_CATCH( "" )
798 
799  }
800 
801  //*****************************************************************************
802  //*****************************************************************************
803 
810  template<class TVector3>
811  static inline void CalculateLocalAxisVector(TVector3& rLocalX, TVector3& rLocalY, TVector3& rLocalZ)
812  {
813  KRATOS_TRY
814 
815  // local x-axis (e1_local) is the beam axis
816  double VectorNorm = MathUtilsType::Norm(rLocalX);
817  if( VectorNorm != 0)
818  rLocalX /= VectorNorm;
819 
820  // local y-axis (e2_local) supplied
821  VectorNorm = MathUtilsType::Norm(rLocalY);
822  if( VectorNorm != 0)
823  rLocalY /= VectorNorm;
824 
825  // local z-axis (e3_local)
826  MathUtilsType::CrossProduct(rLocalZ,rLocalX,rLocalY);
827 
828  VectorNorm = MathUtilsType::Norm(rLocalZ);
829  if( VectorNorm != 0 )
830  rLocalZ /= VectorNorm;
831 
832  KRATOS_CATCH( "" )
833  }
834 
835  //*****************************************************************************
836  //*****************************************************************************
837 
844  static inline bool CheckOrthogonality( const Matrix& rTensor, const std::string& Name, bool Verbose )
845  {
846  KRATOS_TRY
847 
848  double Determinant = MathUtilsType::Det(rTensor);
849  Matrix IdentitySearch = prod( rTensor, trans(rTensor) );
850 
851  if( Determinant > 1.0001 || Determinant < 0.9999 ){
852 
853  if( Verbose ){
854  std::cout<<Name<<std::endl;
855  std::cout<<" Warning Matrix is not orthogonal "<<Determinant<<std::endl;
856  std::cout<<" Matrix: "<<rTensor<<std::endl;
857  std::cout<<" Identity not matches "<<IdentitySearch<<std::endl;
858  }
859 
860  return false;
861  }
862 
863  return true;
864 
865  KRATOS_CATCH( "" )
866  }
867 
868 
869 
870 private:
871 };// class BeamMathUtils
872 }
873 #endif /* KRATOS_BEAM_MATH_UTILITIESS defined */
Definition: beam_math_utilities.hpp:31
static void MapLocalToGlobal2D(const QuaternionType &rLocalToGlobalQuaternion, VectorType &rVector)
Definition: beam_math_utilities.hpp:452
Vector VectorType
Definition: beam_math_utilities.hpp:37
static void CalculateLocalAxesMatrix(const TVector3 &rLocalX, const TVector3 &rLocalY, MatrixType &rRotationMatrix)
Definition: beam_math_utilities.hpp:774
static void CalculateLocalAxisVector(TVector3 &rLocalX, TVector3 &rLocalY, TVector3 &rLocalZ)
Definition: beam_math_utilities.hpp:811
static void SubtractMatrix(TMatrix &rDestination, const TInputMatrix &rInputMatrix, const unsigned int rInitialRow, const unsigned int rInitialCol)
Definition: beam_math_utilities.hpp:404
static void CalculateLocalAxesMatrix(const TVector3 &rLocalX, MatrixType &rRotationMatrix)
Definition: beam_math_utilities.hpp:686
static void SkewSymmetricTensorToVector(const TMatrix3 &rSkewSymmetricTensor, TVector3 &rVector)
Definition: beam_math_utilities.hpp:262
MathUtils< TDataType > MathUtilsType
Definition: beam_math_utilities.hpp:40
static void MapLocalToGlobal2D(const MatrixType &rLocalToGlobalMatrix, MatrixType &rMatrix)
Definition: beam_math_utilities.hpp:477
static void MapLocalToGlobal3D(const MatrixType &rLocalToGlobalMatrix, VectorType &rVector)
Definition: beam_math_utilities.hpp:648
static double KroneckerDelta(int i, int j)
Definition: beam_math_utilities.hpp:286
Quaternion< double > QuaternionType
Definition: beam_math_utilities.hpp:39
static void CayleyTransform(const TVector3 &rVector, MatrixType &rCayleyTensor)
Definition: beam_math_utilities.hpp:165
static void CalculateLocalAxesVectors(TVector3 &rLocalX, TVector3 &rLocalY, TVector3 &rLocalZ)
Definition: beam_math_utilities.hpp:723
static TVector3 & MapToCurrentLocalFrame(QuaternionType &rQuaternion, TVector3 &rVector)
Definition: beam_math_utilities.hpp:57
static void InverseCayleyTransform(const MatrixType &rCayleyTensor, TVector3 &rVector)
Definition: beam_math_utilities.hpp:199
static void SubstractVector(const VectorType &rInputVector, VectorType &rOutputVector, const unsigned int InitialRow)
Definition: beam_math_utilities.hpp:356
static void AddVector(const VectorType &rInputVector, VectorType &rOutputVector, const unsigned int InitialRow)
Definition: beam_math_utilities.hpp:336
static void MapLocalToGlobal3D(const QuaternionType &rLocalToGlobalQuaternion, VectorType &rVector)
Definition: beam_math_utilities.hpp:581
static void MapLocalToGlobal3D(const QuaternionType &rLocalToGlobalQuaternion, MatrixType &rMatrix)
Definition: beam_math_utilities.hpp:558
static void VectorToSkewSymmetricTensor(const TVector3 &rVector, TMatrix3 &rSkewSymmetricTensor)
Definition: beam_math_utilities.hpp:231
static void MapLocalToGlobal3D(const MatrixType &rLocalToGlobalMatrix, MatrixType &rMatrix)
Definition: beam_math_utilities.hpp:605
static void InverseExponentialTransform(const MatrixType &rExponentialTensor, TVector3 &rVector)
Definition: beam_math_utilities.hpp:142
static double LeviCivitaEpsilon(int i, int j, int k)
Definition: beam_math_utilities.hpp:308
static void AddMatrix(TMatrix &rDestination, const TInputMatrix &rInputMatrix, const unsigned int rInitialRow, const unsigned int rInitialCol)
Definition: beam_math_utilities.hpp:379
static void MapLocalToGlobal2D(const MatrixType &rLocalToGlobalMatrix, VectorType &rVector)
Definition: beam_math_utilities.hpp:520
static bool CheckOrthogonality(const Matrix &rTensor, const std::string &Name, bool Verbose)
Definition: beam_math_utilities.hpp:844
static void ExponentialTransform(const TVector3 &rVector, MatrixType &rExponentialTensor)
Definition: beam_math_utilities.hpp:118
static TVector3 & MapToReferenceLocalFrame(QuaternionType &rQuaternion, TVector3 &rVector)
Definition: beam_math_utilities.hpp:88
Matrix MatrixType
Definition: beam_math_utilities.hpp:36
BeamMathUtils< TDataType > BeamMathUtilsType
Definition: beam_math_utilities.hpp:41
static void MapLocalToGlobal2D(const QuaternionType &rLocalToGlobalQuaternion, MatrixType &rMatrix)
Definition: beam_math_utilities.hpp:429
void resize(std::size_t NewSize1, std::size_t NewSize2, bool preserve=0)
Definition: amatrix_interface.h:224
Various mathematical utilitiy functions.
Definition: math_utils.h:62
static void InvertMatrix3(const TMatrix1 &rInputMatrix, TMatrix2 &rInvertedMatrix, double &rInputMatrixDet)
It inverts matrices of order 3.
Definition: math_utils.h:449
static T CrossProduct(const T &a, const T &b)
Performs the vector product of the two input vectors a,b.
Definition: math_utils.h:762
static double Det(const TMatrixType &rA)
Calculates the determinant of a matrix of a square matrix of any size (no check performed on release ...
Definition: math_utils.h:597
static double Norm(const Vector &a)
Calculates the norm of vector "a".
Definition: math_utils.h:703
static Quaternion FromRotationMatrix(const TMatrix3x3 &m)
Definition: quaternion.h:475
void ToRotationMatrix(TMatrix3x3 &R) const
Definition: quaternion.h:213
void ToRotationVector(T &rx, T &ry, T &rz) const
Definition: quaternion.h:262
static Quaternion FromRotationVector(double rx, double ry, double rz)
Definition: quaternion.h:427
Quaternion conjugate() const
Definition: quaternion.h:195
#define KRATOS_CATCH(MoreInfo)
Definition: define.h:110
#define KRATOS_TRY
Definition: define.h:109
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
KratosZeroVector< double > ZeroVector
Definition: amatrix_interface.h:561
AMatrix::IdentityMatrix< double > IdentityMatrix
Definition: amatrix_interface.h:564
KratosZeroMatrix< double > ZeroMatrix
Definition: amatrix_interface.h:559
AMatrix::MatrixProductExpression< TExpression1Type, TExpression2Type > prod(AMatrix::MatrixExpression< TExpression1Type, TCategory1 > const &First, AMatrix::MatrixExpression< TExpression2Type, TCategory2 > const &Second)
Definition: amatrix_interface.h:568
T & noalias(T &TheMatrix)
Definition: amatrix_interface.h:484
AMatrix::TransposeMatrix< const T > trans(const T &TheMatrix)
Definition: amatrix_interface.h:486
int k
Definition: quadrature.py:595
int j
Definition: quadrature.py:648
integer i
Definition: TensorModule.f:17