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.
laplace_element.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: Suneth Warnakulasuriya
11 //
12 
13 #if !defined(KRATOS_LAPLACE_ELEMENT_H_INCLUDED)
14 #define KRATOS_LAPLACE_ELEMENT_H_INCLUDED
15 
16 // System includes
17 
18 // External includes
19 
20 // Project includes
21 #include "includes/define.h"
22 #include "includes/element.h"
23 
24 // Application includes
25 
26 namespace Kratos
27 {
30 
31 template <unsigned int TDim, unsigned int TNumNodes>
32 class LaplaceElement : public Element
33 {
34 public:
37 
38  using BaseType = Element;
39 
42 
45 
47 
50 
53 
56 
58 
60 
61  using IndexType = std::size_t;
62 
65 
70 
74 
78  explicit LaplaceElement(
79  IndexType NewId = 0)
80  : Element(NewId)
81  {
82  }
83 
88  IndexType NewId,
89  const NodesArrayType& ThisNodes)
90  : Element(NewId, ThisNodes)
91  {
92  }
93 
98  IndexType NewId,
99  GeometryType::Pointer pGeometry)
100  : Element(NewId, pGeometry)
101  {
102  }
103 
108  IndexType NewId,
109  GeometryType::Pointer pGeometry,
110  PropertiesType::Pointer pProperties)
111  : Element(NewId, pGeometry, pProperties)
112  {
113  }
114 
119  LaplaceElement const& rOther)
120  : Element(rOther)
121  {
122  }
123 
127  ~LaplaceElement() override = default;
128 
132 
145  Element::Pointer Create(
146  IndexType NewId,
147  NodesArrayType const& ThisNodes,
148  PropertiesType::Pointer pProperties) const override
149  {
150  KRATOS_TRY;
151  KRATOS_ERROR << "Attempting to Create base "
152  "LaplaceElement instances."
153  << std::endl;
154  KRATOS_CATCH("");
155  }
156 
164  Element::Pointer Create(
165  IndexType NewId,
166  GeometryType::Pointer pGeom,
167  PropertiesType::Pointer pProperties) const override
168  {
169  KRATOS_TRY;
170  KRATOS_ERROR << "Attempting to Create base "
171  "LaplaceElement instances."
172  << std::endl;
173  KRATOS_CATCH("");
174  }
175 
183  Element::Pointer Clone(
184  IndexType NewId,
185  NodesArrayType const& ThisNodes) const override
186  {
187  KRATOS_TRY;
188  KRATOS_ERROR << "Attempting to Clone base "
189  "LaplaceElement instances."
190  << std::endl;
191  KRATOS_CATCH("");
192  }
193 
194  virtual const Variable<double>& GetVariable() const
195  {
196  KRATOS_TRY;
197  KRATOS_ERROR << "Attempting to call base "
198  "LaplaceElement "
199  "GetVariable method. Please implement it in the "
200  "derrived class."
201  << std::endl;
202  KRATOS_CATCH("");
203  }
204 
211  void EquationIdVector(
212  EquationIdVectorType& rResult,
213  const ProcessInfo& CurrentProcessInfo) const override;
214 
220  void GetDofList(
221  DofsVectorType& rElementalDofList,
222  const ProcessInfo& CurrentProcessInfo) const override;
223 
224  void GetValuesVector(
225  VectorType& rValues,
226  int Step = 0) const override;
227 
228  void GetValuesArray(
230  int Step = 0) const;
231 
233 
249  virtual void CalculateLocalSystem(
250  MatrixType& rLeftHandSideMatrix,
251  VectorType& rRightHandSideVector,
252  const ProcessInfo& rCurrentProcessInfo) override;
253 
261  MatrixType& rLeftHandSideMatrix,
262  const ProcessInfo& rCurrentProcessInfo) override;
263 
265  BoundedMatrix<double, TNumNodes, TNumNodes>& rLeftHandSideMatrix,
266  const ProcessInfo& rCurrentProcessInfo
267  ) const;
268 
275  virtual void CalculateRightHandSide(
276  VectorType& rRightHandSideVector,
277  const ProcessInfo& rCurrentProcessInfo) override;
278 
288  int Check(const ProcessInfo& rCurrentProcessInfo) const override;
289 
293 
295  std::string Info() const override
296  {
297  std::stringstream buffer;
298  buffer << "LaplaceElement #" << this->Id();
299  return buffer.str();
300  }
302  void PrintInfo(std::ostream& rOStream) const override
303  {
304  rOStream << "LaplaceElement #" << this->Id();
305  }
306 
308 
309 protected:
312 
319  virtual void CalculateGeometryData(
320  Vector& rGaussWeights,
321  Matrix& rNContainer,
322  ShapeFunctionDerivativesArrayType& rDN_DX) const;
323 
325 
326 private:
329 
330  friend class Serializer;
331 
332  void save(Serializer& rSerializer) const override
333  {
334  KRATOS_TRY
335 
337 
338  KRATOS_CATCH("");
339  }
340  void load(Serializer& rSerializer) override
341  {
342  KRATOS_TRY
343 
345 
346  KRATOS_CATCH("");
347  }
348 
350 }; // Class LaplaceElement
351 
353 
356 
357 template <unsigned int TDim, unsigned int TNumNodes>
358 inline std::istream& operator>>(std::istream& rIStream,
360 
362 template <unsigned int TDim, unsigned int TNumNodes>
363 inline std::ostream& operator<<(std::ostream& rOStream,
364  const LaplaceElement<TDim, TNumNodes>& rThis)
365 {
366  rThis.PrintInfo(rOStream);
367  rOStream << " : " << std::endl;
368  rThis.PrintData(rOStream);
369  return rOStream;
370 }
371 
373 
374 } // namespace Kratos.
375 
376 #endif // KRATOS_LAPLACE_ELEMENT_H_INCLUDED defined
Base class for all Elements.
Definition: element.h:60
Vector VectorType
Definition: element.h:88
Element(IndexType NewId=0)
Definition: element.h:121
std::vector< DofType::Pointer > DofsVectorType
Definition: element.h:100
Node NodeType
definition of node type (default is: Node)
Definition: element.h:74
Matrix MatrixType
Definition: element.h:90
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: element.h:1135
std::vector< std::size_t > EquationIdVectorType
Definition: element.h:98
std::size_t IndexType
Definition: flags.h:74
This defines the geometrical object, base definition of the element and condition entities.
Definition: geometrical_object.h:58
IntegrationMethod
Definition: geometry_data.h:76
Geometry base class.
Definition: geometry.h:71
PointerVector< TPointType > PointsArrayType
Definition: geometry.h:118
GeometryData::ShapeFunctionsGradientsType ShapeFunctionsGradientsType
Definition: geometry.h:189
IndexType Id() const
Definition: indexed_object.h:107
Definition: laplace_element.h:33
BaseType::MatrixType MatrixType
Matrix type for local contributions to the linear system.
Definition: laplace_element.h:55
LaplaceElement(IndexType NewId, GeometryType::Pointer pGeometry)
Definition: laplace_element.h:97
virtual void CalculateGeometryData(Vector &rGaussWeights, Matrix &rNContainer, ShapeFunctionDerivativesArrayType &rDN_DX) const
Calculates shape function data for this element.
Definition: laplace_element.cpp:218
LaplaceElement(IndexType NewId=0)
Definition: laplace_element.h:78
GeometryType::ShapeFunctionsGradientsType ShapeFunctionDerivativesArrayType
Type for an array of shape function gradient matrices.
Definition: laplace_element.h:64
LaplaceElement(IndexType NewId, GeometryType::Pointer pGeometry, PropertiesType::Pointer pProperties)
Definition: laplace_element.h:107
Element::Pointer Create(IndexType NewId, NodesArrayType const &ThisNodes, PropertiesType::Pointer pProperties) const override
Definition: laplace_element.h:145
std::string Info() const override
Turn back information as a string.
Definition: laplace_element.h:295
virtual void CalculateLocalSystem(MatrixType &rLeftHandSideMatrix, VectorType &rRightHandSideVector, const ProcessInfo &rCurrentProcessInfo) override
Definition: laplace_element.cpp:99
virtual const Variable< double > & GetVariable() const
Definition: laplace_element.h:194
LaplaceElement(LaplaceElement const &rOther)
Definition: laplace_element.h:118
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: laplace_element.h:302
void CalculateBoundedLeftHandSide(BoundedMatrix< double, TNumNodes, TNumNodes > &rLeftHandSideMatrix, const ProcessInfo &rCurrentProcessInfo) const
Definition: laplace_element.cpp:121
virtual void CalculateRightHandSide(VectorType &rRightHandSideVector, const ProcessInfo &rCurrentProcessInfo) override
Definition: laplace_element.cpp:174
void EquationIdVector(EquationIdVectorType &rResult, const ProcessInfo &CurrentProcessInfo) const override
Definition: laplace_element.cpp:31
Element::Pointer Clone(IndexType NewId, NodesArrayType const &ThisNodes) const override
Definition: laplace_element.h:183
KRATOS_CLASS_INTRUSIVE_POINTER_DEFINITION(LaplaceElement)
BaseType::DofsVectorType DofsVectorType
Definition: laplace_element.h:59
void GetValuesVector(VectorType &rValues, int Step=0) const override
Definition: laplace_element.cpp:63
Element::Pointer Create(IndexType NewId, GeometryType::Pointer pGeom, PropertiesType::Pointer pProperties) const override
Definition: laplace_element.h:164
void CalculateLeftHandSide(MatrixType &rLeftHandSideMatrix, const ProcessInfo &rCurrentProcessInfo) override
Definition: laplace_element.cpp:155
void GetValuesArray(BoundedVector< double, TNumNodes > &rValues, int Step=0) const
Definition: laplace_element.cpp:78
void GetDofList(DofsVectorType &rElementalDofList, const ProcessInfo &CurrentProcessInfo) const override
Definition: laplace_element.cpp:47
BaseType::EquationIdVectorType EquationIdVectorType
Definition: laplace_element.h:57
GeometryData::IntegrationMethod GetIntegrationMethod() const override
Definition: laplace_element.cpp:93
LaplaceElement(IndexType NewId, const NodesArrayType &ThisNodes)
Definition: laplace_element.h:87
int Check(const ProcessInfo &rCurrentProcessInfo) const override
Definition: laplace_element.cpp:197
~LaplaceElement() override=default
This class defines the node.
Definition: node.h:65
PointerVector is a container like stl vector but using a vector to store pointers to its data.
Definition: pointer_vector.h:72
ProcessInfo holds the current value of different solution parameters.
Definition: process_info.h:59
Properties encapsulates data shared by different Elements or Conditions. It can store any type of dat...
Definition: properties.h:69
The serialization consists in storing the state of an object into a storage format like data file or ...
Definition: serializer.h:123
#define KRATOS_SERIALIZE_SAVE_BASE_CLASS(Serializer, BaseType)
Definition: define.h:812
#define KRATOS_CATCH(MoreInfo)
Definition: define.h:110
#define KRATOS_TRY
Definition: define.h:109
#define KRATOS_SERIALIZE_LOAD_BASE_CLASS(Serializer, BaseType)
Definition: define.h:815
#define KRATOS_ERROR
Definition: exception.h:161
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
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