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_point.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_INTEGRATION_POINT_H_INCLUDED )
15 #define KRATOS_INTEGRATION_POINT_H_INCLUDED
16 
17 // System includes
18 
19 // External includes
20 
21 // Project includes
22 #include "includes/define.h"
23 #include "geometries/point.h"
24 
25 namespace Kratos
26 {
27 
30 
34 
38 
42 
46 
48 
50 template<std::size_t TDimension, class TDataType = double, class TWeightType = double>
51 class IntegrationPoint : public Point
52 {
53 public:
56 
59 
60  typedef Point BaseType;
61 
62  typedef Point PointType;
63 
65 
66  typedef typename Point::IndexType IndexType;
67 
71 
73  IntegrationPoint() : BaseType(), mWeight()
74  {
75  }
76 
78  explicit IntegrationPoint(TDataType const& NewX) : BaseType(NewX), mWeight()
79  {
80  }
81 
83  IntegrationPoint(TDataType const& NewX, TDataType const& NewW) : BaseType(NewX), mWeight(NewW)
84  {
85  }
86 
88  IntegrationPoint(TDataType const& NewX, TDataType const& NewY, TDataType const& NewW) : BaseType(NewX, NewY), mWeight(NewW)
89  {
90  }
91 
93  IntegrationPoint(TDataType const& NewX, TDataType const& NewY, TDataType const& NewZ, TDataType const& NewW) : BaseType(NewX, NewY, NewZ), mWeight(NewW)
94  {
95  }
96 
99  IntegrationPoint(IntegrationPoint const& rOtherIntegrationPoint)
100  : BaseType(rOtherIntegrationPoint), mWeight(rOtherIntegrationPoint.mWeight) {}
101 
105  template<std::size_t TOtherDimension>
107  : BaseType(rOtherIntegrationPoint), mWeight(rOtherIntegrationPoint.mWeight) {}
108 
111  explicit IntegrationPoint(PointType const& rOtherPoint)
112  : BaseType(rOtherPoint), mWeight() {}
113 
116  IntegrationPoint(PointType const& rOtherPoint, TWeightType NewWeight)
117  : BaseType(rOtherPoint), mWeight(NewWeight) {}
118 
121  explicit IntegrationPoint(CoordinatesArrayType const& rOtherCoordinates)
122  : BaseType(rOtherCoordinates), mWeight() {}
123 
126  IntegrationPoint(CoordinatesArrayType const& rOtherCoordinates, TWeightType NewWeight)
127  : BaseType(rOtherCoordinates), mWeight(NewWeight) {}
128 
131  template<class TVectorType>
132  explicit IntegrationPoint(vector_expression<TVectorType> const& rOtherCoordinates)
133  : BaseType(rOtherCoordinates), mWeight() {}
134 
137  template<class TVectorType>
138  IntegrationPoint(vector_expression<TVectorType> const& rOtherCoordinates, TWeightType NewWeight)
139  : BaseType(rOtherCoordinates), mWeight(NewWeight) {}
140 
143  explicit IntegrationPoint(std::vector<TDataType> const& rOtherCoordinates)
144  : BaseType(rOtherCoordinates), mWeight() {}
145 
148  IntegrationPoint(std::vector<TDataType> const& rOtherCoordinates, TWeightType NewWeight)
149  : BaseType(rOtherCoordinates), mWeight(NewWeight) {}
150 
152  ~IntegrationPoint() override {}
153 
154 
158 
161  {
162  BaseType::operator =(rOther);
163  mWeight = rOther.mWeight;
164 
165  return *this;
166  }
167 
170  {
171  BaseType::operator =(OtherPoint);
172 
173  return *this;
174  }
175 
176  bool operator==(const IntegrationPoint& rOther)
177  {
178  return (mWeight == rOther.mWeight) && (BaseType::operator ==(rOther));
179  }
180 
182  template<std::size_t TOtherDimension>
184  {
185  BaseType::operator =(rOther);
186  mWeight = rOther.Weight();
187 
188  return *this;
189  }
190 
194 
195 
199 
200  TWeightType Weight() const
201  {
202  return mWeight;
203  }
204 
205  TWeightType& Weight()
206  {
207  return mWeight;
208  }
209 
210  void SetWeight(TWeightType NewWeight)
211  {
212  mWeight = NewWeight;
213  }
214 
218 
219 
223 
225  std::string Info() const override
226  {
227  std::stringstream buffer;
228  buffer << TDimension << " dimensional integration point";
229  return buffer.str();
230  }
231 
233  void PrintInfo(std::ostream& rOStream) const override
234  {
235  rOStream << TDimension << " dimensional integration point";
236  }
237 
239  void PrintData(std::ostream& rOStream) const override
240  {
241  if(!TDimension)
242  return;
243 
244  rOStream << "(" << this->operator[](0);
245 
246  for(IndexType i = 1 ; i < TDimension ; i++)
247  rOStream << " , " << this->operator[](i);
248 
249  rOStream << "), weight = " << mWeight;
250  }
251 
252 
253 
257 
258  template<std::size_t TOtherDimension, class TOtherDataType, class TOtherWeightType> friend class IntegrationPoint;
259 
261 
262 protected:
265 
266 
270 
271 
275 
276 
280 
281 
285 
286 
290 
291 
295 
296 
298 
299 private:
302 
303 
307 
308  TWeightType mWeight;
309 
313 
314  friend class Serializer;
315 
316  void save( Serializer& rSerializer ) const override
317  {
319  rSerializer.save("Weight", mWeight);
320 
321  }
322 
323  void load( Serializer& rSerializer ) override
324  {
326  rSerializer.load("Weight", mWeight);
327  }
328 
332 
333 
337 
338 
342 
343 
347 
348 
352 
353 
355 
356 }; // Class IntegrationPoint
357 
361 
362 
366 
367 
369 template<std::size_t TDimension, class TDataType, class TWeightType>
370 inline std::istream& operator >> (std::istream& rIStream,
372 
374 template<std::size_t TDimension, class TDataType, class TWeightType>
375 inline std::ostream& operator << (std::ostream& rOStream,
377 {
378  rThis.PrintInfo(rOStream);
379  rThis.PrintData(rOStream);
380 
381  return rOStream;
382 }
384 
385 
386 } // namespace Kratos.
387 
388 #endif // KRATOS_INTEGRATION_POINT_H_INCLUDED defined
389 
390 
Short class definition.
Definition: integration_point.h:52
IntegrationPoint & operator=(const IntegrationPoint< TOtherDimension > &rOther)
Assignment operator with different dimension.
Definition: integration_point.h:183
IntegrationPoint(vector_expression< TVectorType > const &rOtherCoordinates, TWeightType NewWeight)
Definition: integration_point.h:138
IntegrationPoint(IntegrationPoint const &rOtherIntegrationPoint)
Definition: integration_point.h:99
IntegrationPoint(TDataType const &NewX, TDataType const &NewY, TDataType const &NewW)
2d constructor.
Definition: integration_point.h:88
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: integration_point.h:233
IntegrationPoint(TDataType const &NewX)
1d constructor.
Definition: integration_point.h:78
IntegrationPoint(TDataType const &NewX, TDataType const &NewY, TDataType const &NewZ, TDataType const &NewW)
3d constructor
Definition: integration_point.h:93
IntegrationPoint & operator=(const IntegrationPoint &rOther)
Assignment operator.
Definition: integration_point.h:160
std::string Info() const override
Turn back information as a string.
Definition: integration_point.h:225
void SetWeight(TWeightType NewWeight)
Definition: integration_point.h:210
IntegrationPoint(TDataType const &NewX, TDataType const &NewW)
1d constructor.
Definition: integration_point.h:83
IntegrationPoint & operator=(const PointType &OtherPoint)
Point assignment operator.
Definition: integration_point.h:169
Point PointType
Definition: integration_point.h:62
IntegrationPoint(vector_expression< TVectorType > const &rOtherCoordinates)
Definition: integration_point.h:132
bool operator==(const IntegrationPoint &rOther)
Definition: integration_point.h:176
IntegrationPoint(PointType const &rOtherPoint)
Definition: integration_point.h:111
KRATOS_CLASS_POINTER_DEFINITION(IntegrationPoint)
Pointer definition of IntegrationPoint.
TWeightType & Weight()
Definition: integration_point.h:205
IntegrationPoint(IntegrationPoint< TOtherDimension, TDataType, TWeightType > const &rOtherIntegrationPoint)
Definition: integration_point.h:106
IntegrationPoint(std::vector< TDataType > const &rOtherCoordinates, TWeightType NewWeight)
Definition: integration_point.h:148
IntegrationPoint()
Default constructor.
Definition: integration_point.h:73
Point::IndexType IndexType
Definition: integration_point.h:66
Point::CoordinatesArrayType CoordinatesArrayType
Definition: integration_point.h:64
IntegrationPoint(CoordinatesArrayType const &rOtherCoordinates)
Definition: integration_point.h:121
TWeightType Weight() const
Definition: integration_point.h:200
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: integration_point.h:239
Point BaseType
Definition: integration_point.h:60
IntegrationPoint(std::vector< TDataType > const &rOtherCoordinates)
Definition: integration_point.h:143
~IntegrationPoint() override
Destructor.
Definition: integration_point.h:152
IntegrationPoint(PointType const &rOtherPoint, TWeightType NewWeight)
Definition: integration_point.h:116
IntegrationPoint(CoordinatesArrayType const &rOtherCoordinates, TWeightType NewWeight)
Definition: integration_point.h:126
Point class.
Definition: point.h:59
std::size_t IndexType
Definition: point.h:79
bool operator==(const Point &rOther) const
Definition: point.h:139
Point & operator=(const Point &rOther)
Assignment operator.
Definition: point.h:133
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
Short class definition.
Definition: array_1d.h:61
BOOST_UBLAS_INLINE const_reference operator[](size_type i) const
Definition: array_1d.h:173
#define KRATOS_SERIALIZE_SAVE_BASE_CLASS(Serializer, BaseType)
Definition: define.h:812
#define KRATOS_SERIALIZE_LOAD_BASE_CLASS(Serializer, BaseType)
Definition: define.h:815
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
AMatrix::MatrixExpression< TExpressionType, AMatrix::row_major_access > vector_expression
Definition: amatrix_interface.h:490
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
integer i
Definition: TensorModule.f:17