RFFGen
 All Classes Namespaces Files Functions Typedefs Enumerations Groups
strainTensor.hh
1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2 /* */
3 /* This file is part of the C++-library RFFGen. */
4 /* Copyright 2015 Lars Lubkoll */
5 /* */
6 /* RFFGen is free software: you can redistribute it and/or modify */
7 /* it under the terms of the GNU General Public License as published by */
8 /* the Free Software Foundation, either version 3 of the License, or */
9 /* (at your option) any later version. */
10 /* */
11 /* RFFGen is distributed in the hope that it will be useful, */
12 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
13 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
14 /* GNU General Public License for more details. */
15 /* */
16 /* You should have received a copy of the GNU General Public License */
17 /* along with RFFGen. If not, see <http://www.gnu.org/licenses/>. */
18 /* */
19 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
20 
21 #ifndef RFFGEN_LINEAR_ALGEBRA_STRAIN_TENSOR_HH
22 #define RFFGEN_LINEAR_ALGEBRA_STRAIN_TENSOR_HH
23 
24 #include "transpose.hh"
25 #include "../MathematicalOperations/sum.hh"
26 #include "../Util/base.hh"
27 #include "../Util/chainer.hh"
28 #include "../Util/addTransposedMatrix.hh"
29 
30 namespace RFFGen
31 {
35  namespace Concepts { template <class> struct SymmetricMatrixConceptCheck; }
40  namespace LinearAlgebra
41  {
49  template <class Matrix, class = Concepts::SymmetricMatrixConceptCheck<Matrix> >
51  public Base ,
52  public Chainer< LeftCauchyGreenStrainTensor<Matrix , Concepts::SymmetricMatrixConceptCheck<Matrix> > >
53  {
54  public:
55  LeftCauchyGreenStrainTensor() = default;
60  explicit LeftCauchyGreenStrainTensor(Matrix const& F) { update(F); }
61 
63  void update(Matrix const& F)
64  {
65  FT = transpose(F);
66  FTF = FT * F;
67  }
68 
70  Matrix const& d0() const noexcept
71  {
72  return FTF;
73  }
74 
76  template <int>
77  Matrix d1(Matrix const& dF1) const
78  {
79  Matrix FTdF1 = FT * dF1;
80  return addTransposed(FTdF1);
81  }
82 
84  template <int,int>
85  Matrix d2(Matrix const& dF1, Matrix const& dF2) const
86  {
87  Matrix dF2TdF1 = transpose(dF2) * dF1;
88  return addTransposed(dF2TdF1);
89  }
90 
91  private:
92  Matrix FT, FTF;
93  };
94 
102  template <class Matrix, class = Concepts::SymmetricMatrixConceptCheck<Matrix> >
104  public Base ,
105  public Chainer< LinearizedStrainTensor< Matrix , Concepts::SymmetricMatrixConceptCheck<Matrix> > >
106  {
107  public:
112  explicit LinearizedStrainTensor(const Matrix& F) { update(F); }
113 
115  void update(Matrix const& F)
116  {
117  d0Result = F + transpose(F);
118  d0Result *= 0.5;
119  }
120 
122  Matrix const& d0() const
123  {
124  return d0Result;
125  }
126 
128  template <int>
129  Matrix d1(const Matrix& dF) const
130  {
131  return 0.5*(dF + transpose(dF));
132  }
133 
134  private:
135  Matrix d0Result = Matrix{0.};
136  };
137 
144 
152  template <class Matrix>
153  class StrainTensor :
154  public MathematicalOperations::Sum< LinearizedStrainTensor<Matrix> , GeometricNonlinearity<Matrix> > ,
155  public Chainer< StrainTensor<Matrix> >
156  {
158  public:
163  explicit StrainTensor(const Matrix& F) : Base(F) {}
164  };
165  }
166 }
167 
168 #endif // RFFGEN_LINEAR_ALGEBRA_STRAIN_TENSOR_HH
Matrix const & d0() const
Function value .
Definition: strainTensor.hh:122
Matrix const & d0() const noexcept
Function value .
Definition: strainTensor.hh:70
void update(Matrix const &F)
Reset point of evaluation.
Definition: strainTensor.hh:115
Strain tensor .
Definition: strainTensor.hh:153
LeftCauchyGreenStrainTensor(Matrix const &F)
Constructor.
Definition: strainTensor.hh:60
TransposedMatrix transpose(Matrix A)
Compute transpose of square matrix.
Definition: transpose.hh:43
Matrix d1(Matrix const &dF1) const
First directional derivative .
Definition: strainTensor.hh:77
Base class for functions satisfying FunctionConcept. Required for enabling the operators in generate...
Definition: base.hh:27
Matrix addTransposed(Matrix &A)
Overwrites with .
Definition: addTransposedMatrix.hh:37
Matrix d2(Matrix const &dF1, Matrix const &dF2) const
Second directional derivative .
Definition: strainTensor.hh:85
Matrix d1(const Matrix &dF) const
First directional derivative .
Definition: strainTensor.hh:129
Left Cauchy-Green strain tensor for a symmetric matrix .
Definition: strainTensor.hh:50
StrainTensor(const Matrix &F)
Constructor.
Definition: strainTensor.hh:163
Sum of functions of type F and G (F and G must satisfy the requirements of Concepts::FunctionConcept)...
Definition: sum.hh:60
LinearizedStrainTensor(const Matrix &F)
Constructor.
Definition: strainTensor.hh:112
Linearized strain tensor .
Definition: strainTensor.hh:103
void update(Matrix const &F)
Reset point of evaluation.
Definition: strainTensor.hh:63