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.
rigid_body_element_creation_utility.hpp
Go to the documentation of this file.
1 //
2 // Project Name: KratosContactMechanicsApplication $
3 // Created by: $Author: JMCarbonell $
4 // Last modified by: $Co-Author: $
5 // Date: $Date: July 2016 $
6 // Revision: $Revision: 0.0 $
7 //
8 //
9 
10 #if !defined(KRATOS_RIGID_BODY_ELEMENT_CREATION_UTILITY_H_INCLUDED )
11 #define KRATOS_RIGID_BODY_ELEMENT_CREATION_UTILITY_H_INCLUDED
12 
13 
14 // External includes
15 
16 // System includes
17 
18 // Project includes
19 #include "includes/model_part.h"
20 #include "geometries/point_2d.h"
21 #include "geometries/point_3d.h"
22 
25 
29 
31 
32 namespace Kratos
33 {
34 
37 
39 
45 {
46 public:
47 
50 
53 
61 
66 
69 
70 
73 
74 
78 
82 
83  //************************************************************************************
84  //************************************************************************************
85 
86  void CreateRigidBody(ModelPart& rModelPart,
87  SpatialBoundingBox::Pointer pRigidBodyBox,
88  Parameters CustomParameters)
89  {
91 
92  Parameters DefaultParameters( R"(
93  {
94  "element_type": "TranslatoryRigidElement3D1N",
95  "constrained": true,
96  "compute_parameters": false,
97  "body_parameters":{
98  "center_of_gravity": [0.0 ,0.0, 0.0],
99  "mass": 0.0,
100  "main_inertias": [0.0, 0.0, 0.0],
101  "main_axes": [ [1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0] ]
102  }
103  } )" );
104 
105 
106  //validate against defaults -- this also ensures no type mismatch
107  CustomParameters.ValidateAndAssignDefaults(DefaultParameters);
108 
109  bool BodyIsFixed = CustomParameters["constrained"].GetBool();
110 
111  ModelPart& rMainModelPart = rModelPart.GetParentModelPart();
112 
113  //std::cout<<rMainModelPart<<std::endl;
114 
115  //create properties for the rigid body
116  unsigned int NumberOfProperties = rMainModelPart.NumberOfProperties();
117 
118  PropertiesType::Pointer pProperties = Kratos::make_shared<PropertiesType>(NumberOfProperties);
119 
120  double Mass = 0;
121  Vector CenterOfGravity = ZeroVector(3);
122  Matrix InertiaTensor = ZeroMatrix(3);
123  Matrix LocalAxesMatrix = IdentityMatrix(3);
124 
125  bool ComputeBodyParameters = CustomParameters["compute_parameters"].GetBool();
126 
127 
128  if( ComputeBodyParameters ){
129 
130  this->CalculateRigidBodyParameters( rModelPart, CenterOfGravity, InertiaTensor, LocalAxesMatrix, Mass );
131  }
132  else{
133 
134  Parameters BodyParameters = CustomParameters["body_parameters"];
135 
136  Mass = BodyParameters["mass"].GetDouble();
137 
138  unsigned int size = BodyParameters["main_inertias"].size();
139 
140  for( unsigned int i=0; i<size; i++ )
141  {
142  Parameters LocalAxesRow = BodyParameters["main_axes"][i];
143 
144  CenterOfGravity[i] = BodyParameters["center_of_gravity"][i].GetDouble();
145  InertiaTensor(i,i) = BodyParameters["main_inertias"][i].GetDouble();
146 
147  LocalAxesMatrix(0,i) = LocalAxesRow[0].GetDouble(); //column disposition
148  LocalAxesMatrix(1,i) = LocalAxesRow[1].GetDouble();
149  LocalAxesMatrix(2,i) = LocalAxesRow[2].GetDouble();
150  }
151 
152  std::cout<<" [ Mass "<<Mass<<" ]"<<std::endl;
153  std::cout<<" [ CenterOfGravity "<<CenterOfGravity<<" ]"<<std::endl;
154  std::cout<<" [ InertiaTensor "<<InertiaTensor<<" ]"<<std::endl;
155 
156  }
157 
158  pProperties->SetValue(NODAL_MASS, Mass);
159  pProperties->SetValue(LOCAL_INERTIA_TENSOR, InertiaTensor);
160  pProperties->SetValue(LOCAL_AXES_MATRIX, LocalAxesMatrix);
161 
162  //add properties to model part
163  rMainModelPart.AddProperties(pProperties);
164 
165  // create node for the rigid body center of gravity:
166  unsigned int LastNodeId = rMainModelPart.Nodes().back().Id() + 1;
167 
168  //std::cout<<" Node Id "<<LastNodeId<<std::endl;
169 
170  NodeType::Pointer NodeCenterOfGravity;
171  this->CreateNode( NodeCenterOfGravity, rMainModelPart, CenterOfGravity, LastNodeId, BodyIsFixed);
172 
173  //Set this node to the boundary model_part where it belongs to
174  unsigned int RigidBodyNodeId = rModelPart.Nodes().back().Id();
175 
176  // set node variables
177  NodeCenterOfGravity->GetSolutionStepValue(VOLUME_ACCELERATION) = rModelPart.Nodes().back().GetSolutionStepValue(VOLUME_ACCELERATION);
178 
179  // set node flags
180  NodeCenterOfGravity->Set(MASTER,true);
181  NodeCenterOfGravity->Set(RIGID,true);
182 
183  // set node to the spatial bounding box
184  pRigidBodyBox->SetRigidBodyCenter(NodeCenterOfGravity);
185 
186  // create rigid body element:
187  unsigned int LastElementId = rMainModelPart.Elements().back().Id() + 1;
188 
189  std::string ElementName = CustomParameters["element_type"].GetString();
190 
191  // geometry point 2D or 3D type
192  GeometryType::Pointer pGeometry;
193  if(rModelPart.GetProcessInfo()[SPACE_DIMENSION] == 3)
194  pGeometry = Kratos::make_shared<Point3DType>(NodeCenterOfGravity);
195  else if(rModelPart.GetProcessInfo()[SPACE_DIMENSION] == 2)
196  pGeometry = Kratos::make_shared<Point2DType>(NodeCenterOfGravity);
197 
198  ModelPart::NodesContainerType::Pointer pNodes = rModelPart.pNodes();
199 
200  ElementType::Pointer pRigidBodyElement = this->CreateRigidBodyElement(ElementName, LastElementId, pGeometry, pProperties, pNodes);
201 
202  // set rigid body element constraint and add to solving model part
203  rModelPart.AddElement(pRigidBodyElement);
204  rModelPart.AddNode(NodeCenterOfGravity);
205 
206 
207  //add rigid body element node to boundary model part where there is an imposition:
208  for(ModelPart::SubModelPartIterator i_mp= rMainModelPart.SubModelPartsBegin(); i_mp!=rMainModelPart.SubModelPartsEnd(); i_mp++)
209  {
210  bool set = false;
211  if(i_mp->Is(BOUNDARY)){
212  for(ModelPart::NodesContainerType::iterator i_node = i_mp->NodesBegin(); i_node != i_mp->NodesEnd(); ++i_node)
213  {
214  for(ModelPart::NodesContainerType::iterator j_node = rModelPart.NodesBegin(); j_node != rModelPart.NodesEnd(); ++j_node)
215  {
216  if(i_node->Id() == j_node->Id() || i_node->Id() == RigidBodyNodeId){
217  i_mp->AddNode(NodeCenterOfGravity);
218  std::cout<<" [ Add CenterOfGravity (node:"<<RigidBodyNodeId<<") to "<<i_mp->Name()<<" ]"<<std::endl;
219  set = true;
220  break;
221  }
222  }
223  if(set)
224  break;
225  }
226  }
227  //set interval end time to apply fixity
228  if(set)
229  rModelPart.GetProcessInfo()[INTERVAL_END_TIME] = rModelPart.GetProcessInfo()[TIME];
230  }
231 
232 
233 
234 
235  //add rigid body element to solving model part:
236  for(ModelPart::SubModelPartIterator i_mp= rMainModelPart.SubModelPartsBegin() ; i_mp!=rMainModelPart.SubModelPartsEnd(); i_mp++)
237  {
238  if( (i_mp->Is(ACTIVE)) ){ //computing_domain
239  std::cout<<" [ Add Rigid Body to Solving model part ]"<<std::endl;
240  pRigidBodyElement->Set(ACTIVE,true);
241  rMainModelPart.GetSubModelPart(i_mp->Name()).AddElement(pRigidBodyElement);
242  rMainModelPart.GetSubModelPart(i_mp->Name()).AddNode(NodeCenterOfGravity);
243  //std::cout<<rMainModelPart<<std::endl;
244  }
245  }
246 
247  if(BodyIsFixed){
248  pRigidBodyElement->Set(RIGID,true);
249  //pRigidBodyElement->Set(ACTIVE,false); //if parametric body in dynamics -> check element build matrices
250  }
251 
252  ElementWeakPtrVectorType MasterElements;
253  MasterElements.push_back(pRigidBodyElement);
254 
255  for(ModelPart::NodesContainerType::iterator j_node = rModelPart.NodesBegin(); j_node != rModelPart.NodesEnd(); ++j_node)
256  {
257  j_node->SetValue(MASTER_ELEMENTS,MasterElements);
258  }
259 
260  std::cout<<" [ "<<ElementName<<" Created : [NodeId:"<<LastNodeId<<"] [ElementId:"<<LastElementId<<"] CG("<<NodeCenterOfGravity->X()<<","<<NodeCenterOfGravity->Y()<<","<<NodeCenterOfGravity->Z()<<") ]"<<std::endl;
261 
262  KRATOS_CATCH( "" )
263  }
264 
265  //************************************************************************************
266  //************************************************************************************
267 
268  void CreateLinks(ModelPart& rModelPart,
269  Parameters CustomParameters)
270  {
271  KRATOS_TRY
272 
273  Parameters DefaultParameters( R"(
274  {
275  "condition_type": "RigidBodyPointLinkCondition3D1N",
276  "flags_list": []
277  } )" );
278 
279  //loop on model part nodes to create rigid body link conditions
280  const int nnodes = rModelPart.Nodes().size();
281 
282  std::vector<Flags> TransferFlags;
283  for(unsigned int i=0; i<CustomParameters["flags_list"].size(); ++i)
284  {
285  TransferFlags.push_back(KratosComponents<Flags>::Get( CustomParameters["flags_list"][i].GetString() ));
286  }
287 
288  ModelPart& rMainModelPart = rModelPart.GetParentModelPart();
289 
290  unsigned int LastConditionId = 1;
291  if( rMainModelPart.Conditions().size() != 0 )
292  LastConditionId = rMainModelPart.Conditions().back().Id() + 1;
293 
294  std::string ConditionName = CustomParameters["condition_type"].GetString();
295 
296  PropertiesType::Pointer pProperties = rModelPart.pGetProperties(0);
297 
298  ModelPart::ConditionsContainerType LinkConditions;
299 
300  unsigned int Id = LastConditionId;
301  if(nnodes != 0)
302  {
303  ModelPart::NodesContainerType::iterator it_begin = rModelPart.NodesBegin();
304 
305  for(int i = 0; i<nnodes; i++)
306  {
307  ModelPart::NodesContainerType::iterator it = it_begin + i;
308  if( it->IsNot(MASTER) ){
309  //std::cout<<" Rigid Link "<<it->Id()<<std::endl;
310  it->Set(SLAVE,false);
311  if (this->MatchTransferFlags(*(it.base()), TransferFlags))
312  {
313  // geometry point 2D or 3D type
314  GeometryType::Pointer pGeometry;
315  if(rModelPart.GetProcessInfo()[SPACE_DIMENSION] == 3)
316  pGeometry = Kratos::make_shared<Point3DType>(*(it.base()));
317  else if(rModelPart.GetProcessInfo()[SPACE_DIMENSION] == 2)
318  pGeometry = Kratos::make_shared<Point2DType>(*(it.base()));
319 
320  it->Set(SLAVE,true); //Flag to set MASTER_ELEMENTS in that nodes (if is SLAVE, a MASTER is required)
321  LinkConditions.push_back(this->CreateRigidBodyLinkCondition(ConditionName, Id, pGeometry, pProperties));
322  LinkConditions.back().Set(INTERACTION);
323  ++Id;
324  }
325  }
326  }
327  }
328 
329  //First remove conditions identified as INTERACTION
330  rModelPart.RemoveConditions(INTERACTION);
331 
332  // add links to rigid body model part:
333  rModelPart.AddConditions(LinkConditions.begin(),LinkConditions.end());
334 
335  std::cout<<" Created Link Conditions "<<LinkConditions.size()<<std::endl;
336 
337  // add links to solving model part:
338  for(ModelPart::SubModelPartIterator i_mp= rMainModelPart.SubModelPartsBegin() ; i_mp!=rMainModelPart.SubModelPartsEnd(); i_mp++)
339  {
340  if( (i_mp->Is(ACTIVE)) ){ //computing_domain
341  //First remove conditions identified as INTERACTION
342  rMainModelPart.GetSubModelPart(i_mp->Name()).RemoveConditions(INTERACTION);
343  rMainModelPart.GetSubModelPart(i_mp->Name()).AddConditions(LinkConditions.begin(),LinkConditions.end());
344  }
345  }
346 
347  KRATOS_CATCH( "" )
348  }
349 
353 
357 
361 
363  virtual std::string Info() const
364  {
365  return "RigidBodyElementCreationUtility";
366  }
367 
369  virtual void PrintInfo(std::ostream& rOStream) const
370  {
371  rOStream << "RigidBodyElementCreationUtility";
372  }
373 
375  virtual void PrintData(std::ostream& rOStream) const
376  {
377  }
378 
379 
383 
384 
386 
387 protected:
390 
391 
395 
396 
400 
401 
405 
406 
410 
411 
415 
416 
420 
421 
423 
424 private:
427 
428 
432 
433 
437 
440 
444 
445  //************************************************************************************
446  //************************************************************************************
447 
448  ElementType::Pointer CreateRigidBodyElement(std::string ElementName, unsigned int& rElementId, GeometryType::Pointer pGeometry, PropertiesType::Pointer pProperties, ModelPart::NodesContainerType::Pointer pNodes)
449  {
450  KRATOS_TRY
451 
452  ElementType::Pointer pRigidBodyElement;
453 
454  //Rigid Body Element:
455  if( ElementName == "RigidBodyElement3D1N" || ElementName == "RigidBodyElement2D1N" ){
456  //std::cout<<" RigidBodyElement "<<rElementId<<std::endl;
457  pRigidBodyElement = Kratos::make_intrusive<RigidBodyElement>(rElementId, pGeometry, pProperties, pNodes);
458  }
459  else if( ElementName == "TranslatoryRigidBodyElement3D1N" || ElementName == "TranslatoryRigidBodyElement2D1N"){
460  //std::cout<<" TranslatoryRigidBodyElement "<<rElementId<<std::endl;
461  // return KratosComponents<Element>::Get("TranslatoryRigidBodyElement")
462  pRigidBodyElement = Kratos::make_intrusive<TranslatoryRigidBodyElement>(rElementId, pGeometry, pProperties, pNodes);
463  }
464  else if( ElementName == "RigidBodySegregatedVElement3D1N" || ElementName == "RigidBodySegregatedVElement2D1N" ){
465  //std::cout<<" RigidBodyElement "<<rElementId<<std::endl;
466  pRigidBodyElement = Kratos::make_intrusive<RigidBodySegregatedVElement>(rElementId, pGeometry, pProperties, pNodes);
467  }
468  else if( ElementName == "TranslatoryRigidBodySegregatedVElement3D1N" || ElementName == "TranslatoryRigidBodySegregatedVElement2D1N"){
469  //std::cout<<" TranslatoryRigidBodyElement "<<rElementId<<std::endl;
470  // return KratosComponents<Element>::Get("TranslatoryRigidBodyElement")
471  pRigidBodyElement = Kratos::make_intrusive<TranslatoryRigidBodySegregatedVElement>(rElementId, pGeometry, pProperties, pNodes);
472  }
473  else if( ElementName == "RigidBodyEMCElement3D1N" || ElementName == "RigidBodyEMCElement2D1N" ){
474  //std::cout<<" RigidBodyEMCElement "<<std::endl;
475  //return Kratos::make_intrusive<RigidBodyEMCElement>(rElementId, pGeometry, pProperties, pNodes);
476  KRATOS_ERROR<<" There is no rigid body element of the type "<<ElementName<<std::endl;
477  }
478  else{
479  KRATOS_ERROR<<" There is no rigid body element of the type "<<ElementName<<std::endl;
480  }
481 
482  // once conventional constructor and registered
483  // ElementType::NodesArrayType ElementNodes;
484  // ElementNodes.push_back(NodeCenterOfGravity);
485  // ElementType const& rCloneElement = KratosComponents<ElementType>::Get(ElementName);
486  // ElementType::Pointer pRigidBodyElement = rCloneElement.Create(LastElementId, ElementNodes, pProperties);
487  // rModelPart.AddElement(pRigidBodyElement);
488 
489  // other posibility
490  // std::vector<int> NodeIds;
491  // NodeIds.push_back(LastNodeId);
492  // rModelPart.CreateNewElement(ElementName,LastElementId, NodeIds, pProperties);
493 
494  return pRigidBodyElement;
495 
496  KRATOS_CATCH("")
497  }
498 
499  //************************************************************************************
500  //************************************************************************************
501 
502  ConditionType::Pointer CreateRigidBodyLinkCondition(std::string ConditionName, unsigned int& rConditionId, GeometryType::Pointer pGeometry, PropertiesType::Pointer pProperties)
503  {
504  KRATOS_TRY
505 
506  ConditionType::Pointer pLinkCondition;
507 
508  //Rigid Body Point Ling Condition:
509  if( ConditionName == "RigidBodyPointLinkCondition3D1N" || ConditionName == "RigidBodyPointLinkCondition2D1N" ){
510  //std::cout<<" Create RigidBodyPointLinkCondition "<<rConditionId<<std::endl;
511  pLinkCondition = Kratos::make_intrusive<RigidBodyPointLinkCondition>(rConditionId, pGeometry, pProperties);
512  }
513  else if( ConditionName == "RigidBodyPointLinkSegregatedVCondition3D1N" || ConditionName == "RigidBodyPointLinkSegregatedVCondition2D1N" ){
514  //std::cout<<" Create RigidBodyPointLinkSegregatedVCondition "<<rConditionId<<std::endl;
515  pLinkCondition = Kratos::make_intrusive<RigidBodyPointLinkSegregatedVCondition>(rConditionId, pGeometry, pProperties);
516  }
517  else{
518  KRATOS_ERROR<<" There is no link condition of the type "<<ConditionName<<std::endl;
519  }
520  return pLinkCondition;
521 
522  KRATOS_CATCH("")
523  }
524 
525  //************************************************************************************
526  //************************************************************************************
527 
528  bool MatchTransferFlags(const Node::Pointer& pNode, const std::vector<Flags>& rTransferFlags)
529  {
530 
531  for(unsigned int i = 0; i<rTransferFlags.size(); i++)
532  {
533  if( pNode->IsNot(rTransferFlags[i]) )
534  return false;
535  }
536 
537  return true;
538  }
539 
540  //************************************************************************************
541  //************************************************************************************
542 
543  void CalculateRigidBodyParameters(ModelPart& rModelPart, Vector& rCenterOfGravity, Matrix& rInertiaTensor, Matrix& rLocalAxesMatrix, double& rMass)
544  {
545 
546  KRATOS_TRY
547 
548  RigidBodyUtilities RigidBodyUtils;
549 
550  rMass = RigidBodyUtils.MassCalculation(rModelPart);
551  rCenterOfGravity = RigidBodyUtils.CalculateCenterOfMass(rModelPart);
552  rInertiaTensor = RigidBodyUtils.CalculateInertiaTensor(rModelPart);
553 
554 
555  //set inertia tensor in main axes (local inertia tensor means main axes)
556  Matrix MainAxes = ZeroMatrix(3,3);
557  Matrix MainInertia = rInertiaTensor;
558  RigidBodyUtils.InertiaTensorToMainAxes(MainInertia, MainAxes);
559 
560  // std::cout<<" Main Axes "<<MainAxes<<std::endl;
561  // std::cout<<" Main Inertia "<<MainInertia<<std::endl;
562  // std::cout<<" Inertia Tensor "<<InertiaTensor<<std::endl;
563 
564  rLocalAxesMatrix = IdentityMatrix(3);
565 
566  // main axes given in rows
567  for(unsigned int i=0; i<3; i++)
568  {
569  Vector Axis = ZeroVector(3);
570  for(unsigned int j=0; j<3; j++)
571  {
572  Axis[j] = MainAxes(i,j);
573  }
574 
575  double norm = norm_2(Axis);
576  if( norm != 0)
577  Axis/=norm;
578 
579  for(unsigned int j=0; j<3; j++)
580  {
581  rLocalAxesMatrix(j,i) = Axis[j]; //column disposition
582  }
583  }
584 
585  rInertiaTensor = MainInertia;
586 
587  // rVolumeAcceleration = RigidBodyUtils.GetVolumeAcceleration(rModelPart);
588  // rElasticModulus = RigidBodyUtils.GetElasticModulus(rModelPart);
589 
590  std::cout<<" [ Mass "<<rMass<<" ]"<<std::endl;
591  std::cout<<" [ CenterOfGravity "<<rCenterOfGravity<<" ]"<<std::endl;
592  std::cout<<" [ InertiaTensor "<<rInertiaTensor<<" ]"<<std::endl;
593 
594  KRATOS_CATCH("")
595 
596  }
597 
598 
599  //************************************************************************************
600  //************************************************************************************
601 
602  void CreateNode (NodeType::Pointer& Node, ModelPart& rModelPart, const Vector& rPoint, unsigned int& nodeId, bool& rBodyIsFixed)
603  {
604  KRATOS_TRY
605 
606  Node = rModelPart.CreateNewNode( nodeId, rPoint[0], rPoint[1], rPoint[2]);
607 
608  rModelPart.AddNode( Node );
609 
610  //generating the dofs
611  NodeType::DofsContainerType& reference_dofs = (rModelPart.NodesBegin())->GetDofs();
612 
613 
614  for(NodeType::DofsContainerType::iterator iii = reference_dofs.begin(); iii != reference_dofs.end(); iii++)
615  {
616  NodeType::DofType& rDof = **iii;
617  Node->pAddDof( rDof );
618  }
619 
620 
621  if( rBodyIsFixed ){
622 
623  //fix dofs:
624  NodeType::DofsContainerType& new_dofs = Node->GetDofs();
625 
626  for(NodeType::DofsContainerType::iterator iii = new_dofs.begin(); iii != new_dofs.end(); iii++)
627  {
628  NodeType::DofType& rDof = **iii;
629  rDof.FixDof(); // dofs fixed
630  }
631 
632  }
633  else{
634 
635  //free dofs:
636  NodeType::DofsContainerType& new_dofs = Node->GetDofs();
637 
638  for(NodeType::DofsContainerType::iterator iii = new_dofs.begin(); iii != new_dofs.end(); iii++)
639  {
640  NodeType::DofType& rDof = **iii;
641  rDof.FreeDof(); // dofs free
642  }
643 
644  }
645 
646  //generating step data
647  // unsigned int buffer_size = (rModelPart.NodesBegin())->GetBufferSize();
648  // unsigned int step_data_size = rModelPart.GetNodalSolutionStepDataSize();
649  // for(unsigned int step = 0; step<buffer_size; step++)
650  // {
651  // double* NodeData = Node->SolutionStepData().Data(step);
652  // double* ReferenceData = (rModelPart.NodesBegin())->SolutionStepData().Data(step);
653 
654  // //copying this data in the position of the vector we are interested in
655  // for(unsigned int j= 0; j<step_data_size; j++)
656  // {
657  // NodeData[j] = ReferenceData[j];
658  // }
659  // }
660 
661  KRATOS_CATCH("")
662  }
663 
667 
668 
672 
673 
677 
679 
681 
682 }; // Class Process
683 
685 
688 
689 
693 
694 
696 inline std::istream& operator >> (std::istream& rIStream,
698 
700 inline std::ostream& operator << (std::ostream& rOStream,
701  const RigidBodyElementCreationUtility& rThis)
702 {
703  rThis.PrintInfo(rOStream);
704  rOStream << std::endl;
705  rThis.PrintData(rOStream);
706 
707  return rOStream;
708 }
710 
711 
712 } // namespace Kratos.
713 
714 #endif // KRATOS_RIGID_BODY_ELEMENT_CREATION_UTILITY_H_INCLUDED defined
Base class for all Conditions.
Definition: condition.h:59
Dof represents a degree of freedom (DoF).
Definition: dof.h:86
void FixDof()
Definition: dof.h:338
void FreeDof()
Definition: dof.h:345
Base class for all Elements.
Definition: element.h:60
void Set(const Flags ThisFlag)
Definition: flags.cpp:33
Geometry base class.
Definition: geometry.h:71
void push_back(TPointerType x)
Definition: global_pointers_vector.h:322
KratosComponents class encapsulates a lookup table for a family of classes in a generic way.
Definition: kratos_components.h:49
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
MeshType::ConditionsContainerType ConditionsContainerType
Condintions container. A vector set of Conditions with their Id's as key.
Definition: model_part.h:183
SubModelPartIterator SubModelPartsEnd()
Definition: model_part.h:1708
PropertiesType::Pointer pGetProperties(IndexType PropertiesId, IndexType MeshIndex=0)
Returns the Properties::Pointer corresponding to it's identifier.
Definition: model_part.cpp:664
SubModelPartIterator SubModelPartsBegin()
Definition: model_part.h:1698
void AddNode(NodeType::Pointer pNewNode, IndexType ThisIndex=0)
Definition: model_part.cpp:211
SizeType NumberOfProperties(IndexType ThisIndex=0) const
Returns the number of properties of the mesh.
Definition: model_part.cpp:575
NodesContainerType::Pointer pNodes(IndexType ThisIndex=0)
Definition: model_part.h:517
NodeIterator NodesBegin(IndexType ThisIndex=0)
Definition: model_part.h:487
SubModelPartsContainerType::iterator SubModelPartIterator
Iterator over the sub model parts of this model part.
Definition: model_part.h:258
ConditionsContainerType & Conditions(IndexType ThisIndex=0)
Definition: model_part.h:1381
void AddProperties(PropertiesType::Pointer pNewProperties, IndexType ThisIndex=0)
Inserts a properties in the current mesh.
Definition: model_part.cpp:582
void RemoveConditions(Flags IdentifierFlag=TO_ERASE)
Definition: model_part.cpp:1637
ProcessInfo & GetProcessInfo()
Definition: model_part.h:1746
ElementsContainerType & Elements(IndexType ThisIndex=0)
Definition: model_part.h:1189
ModelPart & GetSubModelPart(std::string const &SubModelPartName)
Definition: model_part.cpp:2029
void AddElement(ElementType::Pointer pNewElement, IndexType ThisIndex=0)
Definition: model_part.cpp:917
void AddConditions(std::vector< IndexType > const &ConditionIds, IndexType ThisIndex=0)
Definition: model_part.cpp:1460
NodeIterator NodesEnd(IndexType ThisIndex=0)
Definition: model_part.h:497
ModelPart & GetParentModelPart()
Definition: model_part.cpp:2124
NodesContainerType & Nodes(IndexType ThisIndex=0)
Definition: model_part.h:507
This class defines the node.
Definition: node.h:65
std::vector< std::unique_ptr< Dof< double > >> DofsContainerType
The DoF container type definition.
Definition: node.h:92
This class provides to Kratos a data structure for I/O based on the standard of JSON.
Definition: kratos_parameters.h:59
double GetDouble() const
This method returns the double contained in the current Parameter.
Definition: kratos_parameters.cpp:657
void ValidateAndAssignDefaults(const Parameters &rDefaultParameters)
This function is designed to verify that the parameters under testing match the form prescribed by th...
Definition: kratos_parameters.cpp:1306
SizeType size() const
This method returns the total size of the current array parameter.
Definition: kratos_parameters.cpp:993
std::string GetString() const
This method returns the string contained in the current Parameter.
Definition: kratos_parameters.cpp:684
bool GetBool() const
This method returns the boolean contained in the current Parameter.
Definition: kratos_parameters.cpp:675
Definition: point_2d.h:53
Definition: point_3d.h:53
Properties encapsulates data shared by different Elements or Conditions. It can store any type of dat...
Definition: properties.h:69
Rigid body element build processes in Kratos.
Definition: rigid_body_element_creation_utility.hpp:45
virtual std::string Info() const
Turn back information as a string.
Definition: rigid_body_element_creation_utility.hpp:363
void CreateLinks(ModelPart &rModelPart, Parameters CustomParameters)
Definition: rigid_body_element_creation_utility.hpp:268
GlobalPointersVector< Element > ElementWeakPtrVectorType
Definition: rigid_body_element_creation_utility.hpp:62
virtual ~RigidBodyElementCreationUtility()
Destructor.
Definition: rigid_body_element_creation_utility.hpp:72
ModelPart::PropertiesType PropertiesType
Definition: rigid_body_element_creation_utility.hpp:57
virtual void PrintData(std::ostream &rOStream) const
Print object's data.
Definition: rigid_body_element_creation_utility.hpp:375
ElementType::GeometryType GeometryType
Definition: rigid_body_element_creation_utility.hpp:58
KRATOS_CLASS_POINTER_DEFINITION(RigidBodyElementCreationUtility)
Pointer definition of Process.
RigidBodyElementCreationUtility()
Default constructor.
Definition: rigid_body_element_creation_utility.hpp:68
ModelPart::ConditionType ConditionType
Definition: rigid_body_element_creation_utility.hpp:56
Point2D< ModelPart::NodeType > Point2DType
Definition: rigid_body_element_creation_utility.hpp:59
ModelPart::NodeType NodeType
Definition: rigid_body_element_creation_utility.hpp:54
ModelPart::ElementType ElementType
Definition: rigid_body_element_creation_utility.hpp:55
void CreateRigidBody(ModelPart &rModelPart, SpatialBoundingBox::Pointer pRigidBodyBox, Parameters CustomParameters)
Definition: rigid_body_element_creation_utility.hpp:86
Point3D< ModelPart::NodeType > Point3DType
Definition: rigid_body_element_creation_utility.hpp:60
virtual void PrintInfo(std::ostream &rOStream) const
Print information about this object.
Definition: rigid_body_element_creation_utility.hpp:369
#define KRATOS_CATCH(MoreInfo)
Definition: define.h:110
#define KRATOS_TRY
Definition: define.h:109
#define KRATOS_ERROR
Definition: exception.h:161
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
KratosZeroVector< double > ZeroVector
Definition: amatrix_interface.h:561
TExpressionType::data_type norm_2(AMatrix::MatrixExpression< TExpressionType, TCategory > const &TheExpression)
Definition: amatrix_interface.h:625
AMatrix::IdentityMatrix< double > IdentityMatrix
Definition: amatrix_interface.h:564
Internals::Matrix< double, AMatrix::dynamic, 1 > Vector
Definition: amatrix_interface.h:472
KratosZeroMatrix< double > ZeroMatrix
Definition: amatrix_interface.h:559
Internals::Matrix< double, AMatrix::dynamic, AMatrix::dynamic > Matrix
Definition: amatrix_interface.h:470
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
int nnodes
Definition: sensitivityMatrix.py:24
integer i
Definition: TensorModule.f:17