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.
adjoint_diffusion_element.h
Go to the documentation of this file.
1 // KRATOS ___ ___ _ ___ __ ___ ___ ___ ___
2 // / __/ _ \| \| \ \ / /__| \_ _| __| __|
3 // | (_| (_) | .` |\ V /___| |) | || _|| _|
4 // \___\___/|_|\_| \_/ |___/___|_| |_| APPLICATION
5 //
6 // License: BSD License
7 // Kratos default license: kratos/license.txt
8 //
9 // Main authors: Jordi Cotela
10 //
11 
12 #if !defined(KRATOS_ADJOINT_DIFFUSION_ELEMENT )
13 #define KRATOS_ADJOINT_DIFFUSION_ELEMENT
14 
15 // System includes
16 
17 // External includes
18 
19 // Project includes
20 #include "includes/element.h"
21 
22 namespace Kratos
23 {
24 
27 
30 
34 
38 
42 
46 
48 
51 template< class PrimalElement >
52 class AdjointDiffusionElement: public PrimalElement
53 {
54 public:
57 
60 
66  using EquationIdVectorType = typename PrimalElement::EquationIdVectorType;
67  using DofsVectorType = typename PrimalElement::DofsVectorType;
68 
72 
73  AdjointDiffusionElement(IndexType NewId, typename GeometryType::Pointer pGeometry);
74 
75  AdjointDiffusionElement(IndexType NewId, typename GeometryType::Pointer pGeometry, Properties::Pointer pProperties);
76 
78  ~AdjointDiffusionElement() override;
79 
83 
84  Element::Pointer Create(IndexType NewId, NodesArrayType const& ThisNodes, Properties::Pointer pProperties) const override;
85 
86  Element::Pointer Create(IndexType NewId, typename GeometryType::Pointer pGeom, Properties::Pointer pProperties) const override;
87 
88  void CalculateLocalSystem(MatrixType& rLeftHandSideMatrix, VectorType& rRightHandSideVector, const ProcessInfo& rCurrentProcessInfo) override;
89 
90  void CalculateRightHandSide(VectorType& rRightHandSideVector, const ProcessInfo& rCurrentProcessInfo) override;
91 
92  void GetValuesVector(Vector& rValues, int Step) const override;
93 
95  const ProcessInfo& rCurrentProcessInfo) const override;
96 
97  void GetDofList(DofsVectorType& rElementalDofList, const ProcessInfo& rCurrentProcessInfo) const override;
98 
99  void CalculateSensitivityMatrix(const Variable<array_1d<double, 3>>& rDesignVariable,
100  Matrix& rOutput,
101  const ProcessInfo& rCurrentProcessInfo) override;
102 
106 
107  int Check(const ProcessInfo &rCurrentProcessInfo) const override;
108 
112 
114  std::string Info() const override;
115 
117  void PrintInfo(std::ostream& rOStream) const override;
118 
120 
121 protected:
124 
125 
129 
130 
134 
135 
139 
140 
144 
145 
149 
150 
154 
155 
157 
158 private:
161 
162 
166 
167 
171 
172  friend class Serializer;
173 
174  // A private default constructor necessary for serialization
175  AdjointDiffusionElement() : PrimalElement()
176  {
177  }
178 
179  void save(Serializer& rSerializer) const override
180  {
181  using BaseType = PrimalElement;
182  KRATOS_SERIALIZE_SAVE_BASE_CLASS(rSerializer, BaseType);
183  }
184 
185  void load(Serializer& rSerializer) override
186  {
187  using BaseType = PrimalElement;
188  KRATOS_SERIALIZE_LOAD_BASE_CLASS(rSerializer, BaseType);
189  }
190 
194 
195 
199 
200 
204 
205 
209 
210 
214 
216  AdjointDiffusionElement& operator=(const AdjointDiffusionElement& rOther) = delete;
217 
219  AdjointDiffusionElement(const AdjointDiffusionElement& rOther) = delete;
220 
222 
223 }; // Class AdjointDiffusionElement
224 
226 
229 
230 
234 
235 
237 template< class PrimalElement >
238 inline std::istream& operator >> (std::istream& rIStream, AdjointDiffusionElement<PrimalElement>& rThis)
239 {
240  return rIStream;
241 }
242 
244 template< class PrimalElement >
245 inline std::ostream& operator << (std::ostream& rOStream, const AdjointDiffusionElement<PrimalElement>& rThis)
246 {
247  rThis.PrintInfo(rOStream);
248  rOStream << std::endl;
249  rThis.PrintData(rOStream);
250 
251  return rOStream;
252 }
253 
255 
257 
258 } // namespace Kratos.
259 
260 #endif // KRATOS_ADJOINT_DIFFUSION_ELEMENT defined
261 
262 
PeriodicInterfaceProcess & operator=(const PeriodicInterfaceProcess &)=delete
Basic element for the ajdoint diffusion problem.
Definition: adjoint_diffusion_element.h:53
typename PrimalElement::EquationIdVectorType EquationIdVectorType
Definition: adjoint_diffusion_element.h:66
void GetValuesVector(Vector &rValues, int Step) const override
Definition: adjoint_diffusion_element.cpp:87
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: adjoint_diffusion_element.cpp:185
KRATOS_CLASS_INTRUSIVE_POINTER_DEFINITION(AdjointDiffusionElement)
Counted pointer of AdjointDiffusionElement.
void CalculateSensitivityMatrix(const Variable< array_1d< double, 3 >> &rDesignVariable, Matrix &rOutput, const ProcessInfo &rCurrentProcessInfo) override
Definition: adjoint_diffusion_element.cpp:194
typename PrimalElement::IndexType IndexType
Definition: adjoint_diffusion_element.h:61
typename PrimalElement::MatrixType MatrixType
Definition: adjoint_diffusion_element.h:64
~AdjointDiffusionElement() override
Destructor.
Definition: adjoint_diffusion_element.cpp:37
void GetDofList(DofsVectorType &rElementalDofList, const ProcessInfo &rCurrentProcessInfo) const override
Definition: adjoint_diffusion_element.cpp:123
typename PrimalElement::DofsVectorType DofsVectorType
Definition: adjoint_diffusion_element.h:67
int Check(const ProcessInfo &rCurrentProcessInfo) const override
Definition: adjoint_diffusion_element.cpp:141
std::string Info() const override
Turn back information as a string.
Definition: adjoint_diffusion_element.cpp:177
typename PrimalElement::VectorType VectorType
Definition: adjoint_diffusion_element.h:65
Element::Pointer Create(IndexType NewId, NodesArrayType const &ThisNodes, Properties::Pointer pProperties) const override
Definition: adjoint_diffusion_element.cpp:40
typename PrimalElement::NodesArrayType NodesArrayType
Definition: adjoint_diffusion_element.h:63
void EquationIdVector(EquationIdVectorType &rResult, const ProcessInfo &rCurrentProcessInfo) const override
Definition: adjoint_diffusion_element.cpp:104
AdjointDiffusionElement(IndexType NewId, typename GeometryType::Pointer pGeometry)
Definition: adjoint_diffusion_element.cpp:26
friend class Serializer
Definition: adjoint_diffusion_element.h:172
typename PrimalElement::GeometryType GeometryType
Definition: adjoint_diffusion_element.h:62
void CalculateRightHandSide(VectorType &rRightHandSideVector, const ProcessInfo &rCurrentProcessInfo) override
Definition: adjoint_diffusion_element.cpp:71
void CalculateLocalSystem(MatrixType &rLeftHandSideMatrix, VectorType &rRightHandSideVector, const ProcessInfo &rCurrentProcessInfo) override
Definition: adjoint_diffusion_element.cpp:58
ProcessInfo holds the current value of different solution parameters.
Definition: process_info.h:59
The serialization consists in storing the state of an object into a storage format like data file or ...
Definition: serializer.h:123
Variable class contains all information needed to store and retrive data from a data container.
Definition: variable.h:63
#define KRATOS_SERIALIZE_SAVE_BASE_CLASS(Serializer, BaseType)
Definition: define.h:812
#define KRATOS_SERIALIZE_LOAD_BASE_CLASS(Serializer, BaseType)
Definition: define.h:815
std::size_t IndexType
Definition: binary_expression.cpp:25
Vector VectorType
Definition: geometrical_transformation_utilities.h:56
Matrix MatrixType
Definition: geometrical_transformation_utilities.h:55
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
Geometry< Node > GeometryType
The definition of the geometry.
Definition: mortar_classes.h:37
ModelPart::NodesContainerType NodesArrayType
Definition: gid_gauss_point_container.h:42
std::istream & operator>>(std::istream &rIStream, LinearMasterSlaveConstraint &rThis)
input stream function
std::ostream & operator<<(std::ostream &rOStream, const LinearMasterSlaveConstraint &rThis)
output stream function
Definition: linear_master_slave_constraint.h:432
def load(f)
Definition: ode_solve.py:307