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.
quadrature.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: Pooyan Dadvand
11 //
12 //
13 
14 #if !defined(KRATOS_QUADRATURE_H_INCLUDED )
15 #define KRATOS_QUADRATURE_H_INCLUDED
16 
17 // System includes
18 
19 // External includes
20 
21 // Project includes
23 
24 
25 namespace Kratos
26 {
27 template<std::size_t TOrder>
28 struct Pow
29 {
30  static inline std::size_t Value(std::size_t X)
31  {
32  return X * Pow<TOrder - 1>::Value(X);
33  }
34 };
35 
36 template<>
37 struct Pow<1>
38 {
39  static inline std::size_t Value(std::size_t X)
40  {
41  return X;
42  }
43 };
44 
47 
51 
55 
59 
63 
65 
67 template<class TQuadraturePointsType, std::size_t TDimension = TQuadraturePointsType::Dimension, class TIntegrationPointType = IntegrationPoint<TDimension> >
69 {
70 public:
73 
76 
77  typedef TIntegrationPointType IntegrationPointType;
78 
79  typedef std::vector<IntegrationPointType> IntegrationPointsArrayType;
80 
82 
84 
85  typedef std::size_t SizeType;
86 
87  typedef std::size_t IndexType;
88 
92 
95 
97  Quadrature(Quadrature const& rOther) {}
98 
100  virtual ~Quadrature() {}
101 
102 
106 
108  Quadrature& operator=(Quadrature const& rOther) {}
109 
110 
114 
116  {
117  return Pow<TDimension - TQuadraturePointsType::Dimension + 1>::Value(TQuadraturePointsType::IntegrationPointsNumber());
118  }
119 
121  {
122  return msIntegrationPointsVector;
123  }
124 
126  {
129  return results;
130  }
131 
132  template<class TIntegrationPointsArrayType>
133  static void IntegrationPoints(TIntegrationPointsArrayType& Result,
135  {
136  typename Quadrature<TQuadraturePointsType, TDimension - 1, TIntegrationPointType>::IntegrationPointsArrayType points;
138 
139  const auto integration_points = TQuadraturePointsType::IntegrationPoints();
140  for(SizeType i = 0 ; i < TQuadraturePointsType::IntegrationPointsNumber() ; i++)
141  for(SizeType j = 0 ; j < points.size() ; j++)
142  {
143  IntegrationPointType temp(points[j]);
144  temp[TDimension -1] = integration_points[i].X();
145  temp.Weight() *= integration_points[i].Weight();
146  Result.push_back(temp);
147  }
148  }
149 
152  {
153  const auto integration_points = TQuadraturePointsType::IntegrationPoints();
154  for(SizeType i = 0 ; i < TQuadraturePointsType::IntegrationPointsNumber() ; i++)
155  {
156  Result.push_back(integration_points[i]);
157  }
158  }
159 
163 
164 
168 
169 
173 
175  virtual std::string Info() const
176  {
177  std::stringstream buffer;
178  buffer << TDimension << " dimensional quadrature with " << IntegrationPointsNumber() << " integration points";
179  return buffer.str();
180  }
181 
182 
184  virtual void PrintInfo(std::ostream& rOStream) const
185  {
186  rOStream << Info();
187  }
188 
190  virtual void PrintData(std::ostream& rOStream) const
191  {
192  IndexType i;
193  for(i = 0 ; i < msIntegrationPointsVector.size() - 1 ; i++)
194  rOStream << msIntegrationPointsVector[i] << " , " << std::endl;
195  rOStream << msIntegrationPointsVector[i];
196  }
197 
198 
202 
203  template<class TOtherQuadraturePointsType, std::size_t TOtherDimension, class TOtherIntegrationPointType> friend class Quadrature;
204 
205 
207 
208 protected:
211 
212 
216 
217 
221 
222 
226 
227 
231 
232 
236 
237 
241 
242 
244 
245 private:
248 
249 
250 
251  static const IntegrationPointsArrayType msIntegrationPointsVector;
252 
253 
257 
258 
262 
263 
267 
271 
272 
276 
277 
281 
282 
284 
285 }; // Class Quadrature
286 
288 #ifdef __SUNPRO_CC
289 template<class TQuadraturePointsType, std::size_t TDimension, class TIntegrationPointType>
293 #else
295 #endif
298 
299 
303 
304 
306 template<class TQuadraturePointsType, std::size_t TDimension, class TIntegrationPointType>
307 inline std::istream& operator >> (std::istream& rIStream,
309 
311 template<class TQuadraturePointsType, std::size_t TDimension, class TIntegrationPointType>
312 inline std::ostream& operator << (std::ostream& rOStream,
314 {
315  rThis.PrintInfo(rOStream);
316  rOStream << std::endl;
317  rThis.PrintData(rOStream);
318 
319  return rOStream;
320 }
322 
323 
324 } // namespace Kratos.
325 
326 #endif // KRATOS_QUADRATURE_H_INCLUDED defined
327 
328 
Point class.
Definition: point.h:59
Short class definition.
Definition: quadrature.h:69
Quadrature & operator=(Quadrature const &rOther)
Assignment operator.
Definition: quadrature.h:108
std::size_t IndexType
Definition: quadrature.h:87
static const IntegrationPointsArrayType & IntegrationPoints()
Definition: quadrature.h:120
static SizeType IntegrationPointsNumber()
Definition: quadrature.h:115
TQuadraturePointsType::IntegrationPointsArrayType InitialIntegrationPointsArrayType
Definition: quadrature.h:81
virtual ~Quadrature()
Destructor.
Definition: quadrature.h:100
static void IntegrationPoints(TIntegrationPointsArrayType &Result, Quadrature< TQuadraturePointsType, TDimension, TIntegrationPointType > const &Dummy)
Definition: quadrature.h:133
virtual void PrintInfo(std::ostream &rOStream) const
Print information about this object.
Definition: quadrature.h:184
KRATOS_CLASS_POINTER_DEFINITION(Quadrature)
Pointer definition of Quadrature.
Quadrature(Quadrature const &rOther)
Copy constructor.
Definition: quadrature.h:97
static const IntegrationPointsArrayType GenerateIntegrationPoints()
Definition: quadrature.h:125
std::vector< IntegrationPointType > IntegrationPointsArrayType
Definition: quadrature.h:79
virtual std::string Info() const
Turn back information as a string.
Definition: quadrature.h:175
std::size_t SizeType
Definition: quadrature.h:85
TIntegrationPointType IntegrationPointType
Definition: quadrature.h:77
static void IntegrationPoints(IntegrationPointsArrayType &Result, Quadrature< TQuadraturePointsType, TQuadraturePointsType::Dimension, TIntegrationPointType > const &Dummy)
Definition: quadrature.h:150
virtual void PrintData(std::ostream &rOStream) const
Print object's data.
Definition: quadrature.h:190
IntegrationPointType::PointType PointType
Definition: quadrature.h:83
Quadrature()
Default constructor.
Definition: quadrature.h:94
typename GeometryType::IntegrationPointsArrayType IntegrationPointsArrayType
Definition: add_geometries_to_python.cpp:61
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
int j
Definition: quadrature.py:648
float temp
Definition: rotating_cone.py:85
integer i
Definition: TensorModule.f:17
static std::size_t Value(std::size_t X)
Definition: quadrature.h:39
Definition: quadrature.h:29
static std::size_t Value(std::size_t X)
Definition: quadrature.h:30