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.
composite_condition.hpp
Go to the documentation of this file.
1 //
2 // Project Name: KratosDelaunayMeshingApplication $
3 // Created by: $Author: JMCarbonell $
4 // Last modified by: $Co-Author: $
5 // Date: $Date: April 2018 $
6 // Revision: $Revision: 0.0 $
7 //
8 //
9 
10 #if !defined(KRATOS_COMPOSITE_CONDITION_H_INCLUDED )
11 #define KRATOS_COMPOSITE_CONDITION_H_INCLUDED
12 
13 // System includes
14 
15 // External includes
16 
17 // Project includes
18 #include "includes/condition.h"
19 #include "includes/kratos_flags.h"
20 
21 namespace Kratos
22 {
31 
35 
39 
41 
47 class KRATOS_API(DELAUNAY_MESHING_APPLICATION) CompositeCondition
48  : public Condition
49 {
50 public:
51 
52 
60 
63 
67 
69  CompositeCondition(IndexType NewId, GeometryType::Pointer pGeometry);
70 
71  CompositeCondition(IndexType NewId, GeometryType::Pointer pGeometry, PropertiesType::Pointer pProperties);
72 
75 
77  virtual ~CompositeCondition();
78 
82 
85 
89 
90 
92  {
93  return mChildConditions.size();
94  }
95 
98  void AddChild(ConditionType::Pointer pNewChildCondition);
99 
101  ConditionType::Pointer pGetChild(IndexType ChildConditionId)
102  {
103  return (mChildConditions)(ChildConditionId);
104  }
105 
107  ConditionType& GetChild(IndexType ChildConditionId)
108  {
109  return (mChildConditions)[ChildConditionId];
110  }
111 
114  void RemoveChild(IndexType ChildConditionId)
115  {
116  mChildConditions.erase(ChildConditionId);
117  }
118 
121  void RemoveChild(ConditionType& ThisChildCondition)
122  {
123  mChildConditions.erase(ThisChildCondition.Id());
124  }
125 
128  void RemoveChild(ConditionType::Pointer pThisChildCondition)
129  {
130  mChildConditions.erase(pThisChildCondition->Id());
131  }
132 
134  {
135  return mChildConditions.begin();
136  }
137 
139  {
140  return mChildConditions.begin();
141  }
142 
144  {
145  return mChildConditions.end();
146  }
147 
149  {
150  return mChildConditions.end();
151  }
152 
154  {
155  return mChildConditions;
156  }
157 
158  ConditionsContainerType::Pointer pChildConditions()
159  {
160  return ConditionsContainerType::Pointer(&mChildConditions);
161  }
162 
163  void SetChildConditions(ConditionsContainerType::Pointer pOtherChildConditions)
164  {
165  mChildConditions = (*pOtherChildConditions);
166  }
167 
169  {
170  return mChildConditions.GetContainer();
171  }
172 
173 
181  Condition::Pointer Create(IndexType NewId, NodesArrayType const& ThisNodes,
182  PropertiesType::Pointer pProperties) const override;
183 
191  Condition::Pointer Create(IndexType NewId,
192  GeometryType::Pointer pGeom,
193  PropertiesType::Pointer pProperties) const override;
194 
202  Condition::Pointer Clone(IndexType NewId, NodesArrayType const& ThisNodes) const override;
203 
204 
205  //************* GETTING METHODS
206 
211  IntegrationMethod GetIntegrationMethod() const override;
212 
216  void GetDofList(DofsVectorType& rConditionalDofList, const ProcessInfo& rCurrentProcessInfo) const override;
217 
221  void EquationIdVector(EquationIdVectorType& rResult, const ProcessInfo& rCurrentProcessInfo) const override;
222 
226  void GetValuesVector(Vector& rValues, int Step = 0) const override;
227 
231  void GetFirstDerivativesVector(Vector& rValues, int Step = 0) const override;
232 
236  void GetSecondDerivativesVector(Vector& rValues, int Step = 0) const override;
237 
238 
239 
240  //on integration points:
252  //SET
256  void SetValuesOnIntegrationPoints(const Variable<Vector>& rVariable, const std::vector<Vector>& rValues, const ProcessInfo& rCurrentProcessInfo) override;
257 
261  void SetValuesOnIntegrationPoints(const Variable<Matrix>& rVariable, const std::vector<Matrix>& rValues, const ProcessInfo& rCurrentProcessInfo) override;
262 
263 
264  //************* STARTING - ENDING METHODS
265 
270  void Initialize(const ProcessInfo& rCurrentProcessInfo) override;
271 
272 
276  void InitializeSolutionStep(const ProcessInfo& CurrentProcessInfo) override;
277 
281  void InitializeNonLinearIteration(const ProcessInfo& CurrentProcessInfo) override;
282 
286  void FinalizeSolutionStep(const ProcessInfo& CurrentProcessInfo) override;
287 
288 
289  //************* COMPUTING METHODS
290 
300  void CalculateLocalSystem(MatrixType& rLeftHandSideMatrix, VectorType& rRightHandSideVector, const ProcessInfo& rCurrentProcessInfo) override;
301 
308  void CalculateRightHandSide(VectorType& rRightHandSideVector, const ProcessInfo& rCurrentProcessInfo) override;
309 
316  void CalculateLeftHandSide (MatrixType& rLeftHandSideMatrix, const ProcessInfo& rCurrentProcessInfo) override;
317 
324  void CalculateMassMatrix(MatrixType& rMassMatrix, const ProcessInfo& rCurrentProcessInfo) override;
325 
332  void CalculateDampingMatrix(MatrixType& rDampingMatrix, const ProcessInfo& rCurrentProcessInfo) override;
333 
334 
344  void AddExplicitContribution(const VectorType& rRHS, const Variable<VectorType>& rRHSVariable,
345  const Variable<array_1d<double,3> >& rDestinationVariable,
346  const ProcessInfo& rCurrentProcessInfo) override;
347 
348 
349  //on integration points:
353  void CalculateOnIntegrationPoints(const Variable<double>& rVariable, std::vector<double>& rOutput, const ProcessInfo& rCurrentProcessInfo) override;
354 
358  void CalculateOnIntegrationPoints(const Variable<Vector>& rVariable, std::vector<Vector>& rOutput, const ProcessInfo& rCurrentProcessInfo) override;
359 
363  void CalculateOnIntegrationPoints(const Variable<Matrix >& rVariable, std::vector< Matrix >& rOutput, const ProcessInfo& rCurrentProcessInfo) override;
364 
365 
366  void Calculate(const Variable<double>& rVariable, double& rOutput, const ProcessInfo& rCurrentProcessInfo) override;
367 
368  //************************************************************************************
369  //************************************************************************************
377  int Check(const ProcessInfo& rCurrentProcessInfo) const override;
378 
379  //std::string Info() const;
380 
384 
391 
393 
394  std::string Info() const override
395  {
396  std::stringstream buffer;
397  buffer << "Condition CompositeCondition #" << Id();
398  return buffer.str();
399  }
400 
402 
403  void PrintInfo(std::ostream& rOStream) const override
404  {
405  rOStream << "Condition CompositeCondition #" << Id();
406  }
407 
412 
413 protected:
435 
436 private:
437 
442  ConditionsContainerType mChildConditions;
443 
444  bool mInitializedChildren;
445 
449 
453 
454  //initialize children from set value CHILDREN_CONDITIONS
455  void InitializeChildren();
456 
457  //check problem type definition and if coincides return active true
458  bool IsActive(const Condition& rChildCondition, const ProcessInfo& rCurrentProcessInfo) const;
459 
460  //set specific data value to condition children
461  template<class TVariableType> void SetValueToChildren(const TVariableType& rThisVariable){
462 
463  for (ConditionIterator cn = mChildConditions.begin() ; cn != mChildConditions.end(); ++cn)
464  {
465  typename TVariableType::Type const& rValue = this->GetValue(rThisVariable);
466  cn->SetValue(rThisVariable,rValue);
467  }
468 
469  }
470 
474  virtual SizeType GetDofsSize(const ProcessInfo& rCurrentProcessInfo);
475 
480 
484  friend class Serializer;
485 
486  // A private default constructor necessary for serialization
487 
489  {
490  }
491 
492  void save(Serializer& rSerializer) const override;
493 
494  void load(Serializer& rSerializer) override;
495 
496 
497 
504 
505 }; // Class CompositeCondition
506 
514 /* inline std::istream& operator >> (std::istream& rIStream,
515  CompositeCondition& rThis);
516 */
518 /* inline std::ostream& operator << (std::ostream& rOStream,
519  const CompositeCondition& rThis)
520  {
521  rThis.PrintInfo(rOStream);
522  rOStream << std::endl;
523  rThis.PrintData(rOStream);
524 
525  return rOStream;
526  }*/
528 
529 } // namespace Kratos.
530 #endif // KRATOS_COMPOSITE_CONDITION_H_INCLUDED defined
PeriodicInterfaceProcess & operator=(const PeriodicInterfaceProcess &)=delete
Updated Total Lagrangian element for 2D and 3D geometries.
Definition: composite_condition.hpp:49
ConditionType & GetChild(IndexType ChildConditionId)
Definition: composite_condition.hpp:107
ConditionsContainerType::iterator ConditionIterator
Definition: composite_condition.hpp:57
ConditionsContainerType::Pointer pChildConditions()
Definition: composite_condition.hpp:158
SizeType NumberOfChildren() const
Definition: composite_condition.hpp:91
void RemoveChild(ConditionType &ThisChildCondition)
Definition: composite_condition.hpp:121
std::string Info() const override
Turn back information as a string.
Definition: composite_condition.hpp:394
ConditionConstantIterator ChildConditionsBegin() const
Definition: composite_condition.hpp:138
void RemoveChild(ConditionType::Pointer pThisChildCondition)
Definition: composite_condition.hpp:128
void RemoveChild(IndexType ChildConditionId)
Definition: composite_condition.hpp:114
ConditionConstantIterator ChildConditionsEnd() const
Definition: composite_condition.hpp:148
ConditionType::Pointer pGetChild(IndexType ChildConditionId)
Definition: composite_condition.hpp:101
ConditionIterator ChildConditionsEnd()
Definition: composite_condition.hpp:143
PointerVectorSet< ConditionType, IndexedObject > ConditionsContainerType
Definition: composite_condition.hpp:56
ConditionIterator ChildConditionsBegin()
Definition: composite_condition.hpp:133
Condition ConditionType
Definition: composite_condition.hpp:55
ConditionsContainerType::const_iterator ConditionConstantIterator
Definition: composite_condition.hpp:58
void SetChildConditions(ConditionsContainerType::Pointer pOtherChildConditions)
Definition: composite_condition.hpp:163
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: composite_condition.hpp:403
ConditionsContainerType::ContainerType & ChildConditionsArray()
Definition: composite_condition.hpp:168
ConditionsContainerType & ChildConditions()
Definition: composite_condition.hpp:153
KRATOS_CLASS_INTRUSIVE_POINTER_DEFINITION(CompositeCondition)
Counted pointer of CompositeCondition.
GeometryData::SizeType SizeType
Definition: composite_condition.hpp:59
Base class for all Conditions.
Definition: condition.h:59
std::size_t SizeType
Definition: condition.h:94
std::size_t IndexType
Definition: flags.h:74
IntegrationMethod
Definition: geometry_data.h:76
std::size_t SizeType
Definition: geometry_data.h:173
IndexType Id() const
Definition: indexed_object.h:107
boost::indirect_iterator< typename TContainerType::iterator > iterator
Definition: pointer_vector_set.h:95
std::vector< typename TDataType::Pointer > ContainerType
Definition: pointer_vector_set.h:90
boost::indirect_iterator< typename TContainerType::const_iterator > const_iterator
Definition: pointer_vector_set.h:96
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
std::size_t IndexType
The definition of the index type.
Definition: key_hash.h:35
Matrix MatrixType
Definition: geometrical_transformation_utilities.h:55
Modeler::Pointer Create(const std::string &ModelerName, Model &rModel, const Parameters ModelParameters)
Checks if the modeler is registered.
Definition: modeler_factory.cpp:30
void SetValuesOnIntegrationPoints(TObject &dummy, const Variable< TDataType > &rVariable, const std::vector< TDataType > &values, const ProcessInfo &rCurrentProcessInfo)
Definition: add_mesh_to_python.cpp:185
pybind11::list CalculateOnIntegrationPoints(TObject &dummy, const Variable< TDataType > &rVariable, const ProcessInfo &rProcessInfo)
Definition: add_mesh_to_python.cpp:142
void InitializeSolutionStep(ConstructionUtility &rThisUtil, std::string ThermalSubModelPartName, std::string MechanicalSubModelPartName, std::string HeatFluxSubModelPartName, std::string HydraulicPressureSubModelPartName, bool thermal_conditions, bool mechanical_conditions, int phase)
Definition: add_custom_utilities_to_python.cpp:45
TDataType Calculate(GeometryType &dummy, const Variable< TDataType > &rVariable)
Definition: add_geometries_to_python.cpp:103
Parameters GetValue(Parameters &rParameters, const std::string &rEntry)
Definition: add_kratos_parameters_to_python.cpp:53
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
ConditionsContainerType::iterator ConditionIterator
Definition: settle_model_structure_process.hpp:51
ModelPart::ConditionsContainerType ConditionsContainerType
Definition: find_conditions_neighbours_process.h:45
std::size_t SizeType
The definition of the size type.
Definition: mortar_classes.h:43
ModelPart::NodesContainerType NodesArrayType
Definition: gid_gauss_point_container.h:42
def load(f)
Definition: ode_solve.py:307