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.
initial_state.h
Go to the documentation of this file.
1 // | / |
2 // ' / __| _` | __| _ \ __|
3 // . \ | ( | | ( |\__ `
4 // _|\_\_| \__,_|\__|\___/ ____/
5 // Multi-Physics
6 //
7 // License: BSD License
8 // Kratos default license: kratos/license.txt
9 //
10 // Main authors: Alejandro Cornejo
11 //
12 //
13 
14 # pragma once
15 
16 // System includes
17 #include <atomic>
18 
19 // External includes
20 
21 // Project includes
22 #include "includes/define.h"
23 #include "includes/variables.h"
24 
25 namespace Kratos
26 {
29 
32 
40 class KRATOS_API(KRATOS_CORE) InitialState
41 {
42  public:
45 
46  // Size type definition
47  using SizeType = std::size_t;
48 
51 
55 
57  {
58  STRAIN_ONLY = 0,
59  STRESS_ONLY = 1,
60  DEFORMATION_GRADIENT_ONLY = 2,
61  STRAIN_AND_STRESS = 3,
62  DEFORMATION_GRADIENT_AND_STRESS = 4
63  };
64 
68 
71  {}
72 
74  InitialState(const SizeType Dimension);
75 
76  // Full constructor
77  InitialState(const Vector& rInitialStrainVector,
78  const Vector& rInitialStressVector,
79  const Matrix& rInitialDeformationGradientMatrix);
80 
81  // Selective constructor for vectors
82  InitialState(const Vector& rImposingEntity,
83  const InitialImposingType InitialImposition = InitialImposingType::STRAIN_ONLY);
84 
85  // Selective constructor for vectors (E, S)
86  InitialState(const Vector& rInitialStrainVector,
87  const Vector& rInitialStressVector);
88 
89  // Selective constructor for Deformation Gradient only
90  InitialState(const Matrix& rInitialDeformationGradientMatrix);
91 
93  virtual ~InitialState() {}
94 
95 
99 
100  //*********************************************
101  //public API of intrusive_ptr
102  unsigned int use_count() const noexcept
103  {
104  return mReferenceCounter;
105  }
106  //*********************************************
107 
112  void SetInitialStrainVector(const Vector& rInitialStrainVector);
113 
118  void SetInitialStressVector(const Vector& rInitialStressVector);
119 
124  void SetInitialDeformationGradientMatrix(const Matrix& rInitialDeformationGradientMatrix);
125 
129  const Vector& GetInitialStrainVector() const;
130 
134  const Vector& GetInitialStressVector() const;
135 
139  const Matrix& GetInitialDeformationGradientMatrix() const;
140 
141 
145 
147  virtual std::string Info() const
148  {
149  std::stringstream buffer;
150  buffer << "InitialState" ;
151 
152  return buffer.str();
153  }
154 
156  virtual void PrintInfo(std::ostream& rOStream) const {rOStream << "InitialState";}
157 
159  virtual void PrintData(std::ostream& rOStream) const {}
160 
162 
163  private:
164 
167  Vector mInitialStrainVector;
168  Vector mInitialStressVector;
169  Matrix mInitialDeformationGradientMatrix;
170 
171 
172  //*********************************************
173  //this block is needed for refcounting
174  mutable std::atomic<int> mReferenceCounter{0};
176  {
177  x->mReferenceCounter.fetch_add(1, std::memory_order_relaxed);
178  }
179 
181  {
182  if (x->mReferenceCounter.fetch_sub(1, std::memory_order_release) == 1) {
183  std::atomic_thread_fence(std::memory_order_acquire);
184  delete x;
185  }
186  }
187  //*********************************************
188 
189 
190  friend class Serializer;
191 
192  void save(Serializer& rSerializer) const
193  {
194  rSerializer.save("InitialStrainVector",mInitialStrainVector);
195  rSerializer.save("InitialStressVector",mInitialStressVector);
196  rSerializer.save("InitialDeformationGradientMatrix",mInitialDeformationGradientMatrix);
197  }
198 
199  void load(Serializer& rSerializer)
200  {
201  rSerializer.load("InitialStrainVector",mInitialStrainVector);
202  rSerializer.load("InitialStressVector",mInitialStressVector);
203  rSerializer.load("InitialDeformationGradientMatrix",mInitialDeformationGradientMatrix);
204  }
205 
206 
207 }; // class
209 
211 
212 } // namespace Kratos
Define the initial state of the material in terms of initial stress/strain/F.
Definition: initial_state.h:41
friend void intrusive_ptr_release(const InitialState *x)
Definition: initial_state.h:180
friend void intrusive_ptr_add_ref(const InitialState *x)
Definition: initial_state.h:175
virtual std::string Info() const
Turn back information as a string.
Definition: initial_state.h:147
virtual void PrintData(std::ostream &rOStream) const
Print object's data.
Definition: initial_state.h:159
virtual ~InitialState()
Destructor.
Definition: initial_state.h:93
InitialImposingType
Definition: initial_state.h:57
InitialState()
Default constructor.
Definition: initial_state.h:70
std::size_t SizeType
Definition: initial_state.h:47
KRATOS_CLASS_INTRUSIVE_POINTER_DEFINITION(InitialState)
Pointer definition of NodeSearchUtility.
virtual void PrintInfo(std::ostream &rOStream) const
Print information about this object.
Definition: initial_state.h:156
unsigned int use_count() const noexcept
Definition: initial_state.h:102
The serialization consists in storing the state of an object into a storage format like data file or ...
Definition: serializer.h:123
void load(std::string const &rTag, TDataType &rObject)
Definition: serializer.h:207
void save(std::string const &rTag, std::array< TDataType, TDataSize > const &rObject)
Definition: serializer.h:545
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
std::size_t SizeType
The definition of the size type.
Definition: mortar_classes.h:43
def load(f)
Definition: ode_solve.py:307
tuple const
Definition: ode_solve.py:403
x
Definition: sensitivityMatrix.py:49