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.
integration_info.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 
11 #if !defined(KRATOS_INTEGRATION_INFO_H_INCLUDED )
12 #define KRATOS_INTEGRATION_INFO_H_INCLUDED
13 
14 // System includes
15 
16 // External includes
17 
18 // Project includes
19 #include "includes/define.h"
22 #include "containers/flags.h"
23 
24 namespace Kratos
25 {
26 
29 
31 /* Within this class distinct information of integration can be
32  * stored and processed.
33  */
34 class KRATOS_API(KRATOS_CORE) IntegrationInfo : public Flags
35 {
36 public:
39 
42 
43  typedef typename Point::IndexType SizeType;
44  typedef typename Point::IndexType IndexType;
45 
48 
52 
53  KRATOS_DEFINE_LOCAL_FLAG(DO_NOT_CREATE_TESSELLATION_ON_SLAVE);
54 
58 
59  enum class QuadratureMethod
60  {
61  Default,
62  GAUSS,
63  EXTENDED_GAUSS,
64  GRID
65  };
66 
70 
71  IntegrationInfo(SizeType LocalSpaceDimension,
72  IntegrationMethod ThisIntegrationMethod);
73 
74  IntegrationInfo(SizeType LocalSpaceDimension,
75  SizeType NumberOfIntegrationPointsPerSpan,
76  QuadratureMethod ThisQuadratureMethod = QuadratureMethod::GAUSS);
77 
79  const std::vector<SizeType>& NumberOfIntegrationPointsPerSpanVector,
80  const std::vector<QuadratureMethod>& ThisQuadratureMethodVector);
81 
85 
87  {
88  return mNumberOfIntegrationPointsPerSpanVector.size();
89  }
90 
94 
95  void SetIntegrationMethod(
96  IndexType DimensionIndex,
97  IntegrationMethod ThisIntegrationMethod);
98 
99  SizeType GetNumberOfIntegrationPointsPerSpan(IndexType DimensionIndex) const;
100 
101  void SetNumberOfIntegrationPointsPerSpan(IndexType DimensionIndex,
102  SizeType NumberOfIntegrationPointsPerSpan);
103 
105  {
106  return mQuadratureMethodVector[DimensionIndex];
107  }
108 
109  void SetQuadratureMethod(IndexType DimensionIndex,
110  QuadratureMethod ThisQuadratureMethod);
111 
112  /* returns the IntegrationMethod to
113  * corresponding to the direction index.
114  */
115  IntegrationMethod GetIntegrationMethod(
116  IndexType DimensionIndex) const;
117 
118  /* Evaluates the corresponding IntegrationMethod to
119  * the number of points and the quadrature method.
120  */
122  SizeType NumberOfIntegrationPointsPerSpan,
123  QuadratureMethod ThisQuadratureMethod)
124  {
125  switch (NumberOfIntegrationPointsPerSpan) {
126  case 1:
127  if (ThisQuadratureMethod == QuadratureMethod::GAUSS) {
129  }
130  else {
132  }
133  break;
134  case 2:
135  if (ThisQuadratureMethod == QuadratureMethod::GAUSS) {
137  }
138  else {
140  }
141  break;
142  case 3:
143  if (ThisQuadratureMethod == QuadratureMethod::GAUSS) {
145  }
146  else {
148  }
149  break;
150  case 4:
151  if (ThisQuadratureMethod == QuadratureMethod::GAUSS) {
153  }
154  else {
156  }
157  break;
158  case 5:
159  if (ThisQuadratureMethod == QuadratureMethod::GAUSS) {
161  }
162  else {
164  }
165  break;
166  case 0:
168  break;
169  }
170  KRATOS_WARNING("Evaluation of Integration Method")
171  << "Chosen combination of number of points per span and quadrature method does not has a corresponding IntegrationMethod in the KRATOS core."
172  << "NumberOfIntegrationPointsPerSpan: " << NumberOfIntegrationPointsPerSpan << std::endl;
174  }
175 
179 
181  std::string Info() const override
182  {
183  std::stringstream buffer;
184  buffer << " Integration info with local space dimension: " << mNumberOfIntegrationPointsPerSpanVector.size()
185  << " and number of integration points per spans: " << mNumberOfIntegrationPointsPerSpanVector;
186  return buffer.str();
187  }
188 
190  void PrintInfo(std::ostream& rOStream) const override
191  {
192  rOStream << " Integration info with local space dimension: " << mNumberOfIntegrationPointsPerSpanVector.size()
193  << " and number of integration points per spans: " << mNumberOfIntegrationPointsPerSpanVector;
194  }
195 
197  void PrintData(std::ostream& rOStream) const override
198  {
199  rOStream << " Integration info with local space dimension: " << mNumberOfIntegrationPointsPerSpanVector.size()
200  << " and number of integration points per spans: " << mNumberOfIntegrationPointsPerSpanVector;
201  }
202 
204 
205 private:
208 
209  std::vector<SizeType> mNumberOfIntegrationPointsPerSpanVector;
210 
211  std::vector<QuadratureMethod> mQuadratureMethodVector;
212 
214 
215 }; // Class IntegrationPoint
216 
220 
221 
223 template<std::size_t TDimension, class TDataType, class TWeightType>
224 inline std::istream& operator >> (std::istream& rIStream, IntegrationInfo& rThis);
225 
227 template<std::size_t TDimension, class TDataType, class TWeightType>
228 inline std::ostream& operator << (std::ostream& rOStream, const IntegrationInfo& rThis)
229 {
230  rThis.PrintInfo(rOStream);
231  rThis.PrintData(rOStream);
232 
233  return rOStream;
234 }
236 
237 } // namespace Kratos.
238 
239 #endif // KRATOS_INTEGRATION_INFO_H_INCLUDED defined
Definition: flags.h:58
std::size_t IndexType
Definition: flags.h:74
IntegrationMethod
Definition: geometry_data.h:76
Integration information for the creation of integration points.
Definition: integration_info.h:35
std::string Info() const override
Turn back information as a string.
Definition: integration_info.h:181
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: integration_info.h:190
GeometryData::IntegrationMethod IntegrationMethod
Integration methods implemented specified within enum.
Definition: integration_info.h:47
SizeType LocalSpaceDimension()
Definition: integration_info.h:86
QuadratureMethod GetQuadratureMethod(IndexType DimensionIndex) const
Definition: integration_info.h:104
KRATOS_CLASS_POINTER_DEFINITION(IntegrationInfo)
Pointer definition of IntegrationPoint.
KRATOS_DEFINE_LOCAL_FLAG(DO_NOT_CREATE_TESSELLATION_ON_SLAVE)
Point::IndexType SizeType
Definition: integration_info.h:43
Point::IndexType IndexType
Definition: integration_info.h:44
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: integration_info.h:197
static IntegrationMethod GetIntegrationMethod(SizeType NumberOfIntegrationPointsPerSpan, QuadratureMethod ThisQuadratureMethod)
Definition: integration_info.h:121
QuadratureMethod
Definition: integration_info.h:60
std::size_t IndexType
Definition: point.h:79
std::size_t IndexType
The definition of the index type.
Definition: key_hash.h:35
#define KRATOS_WARNING(label)
Definition: logger.h:265
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
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