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.
postprocess_utilities.h
Go to the documentation of this file.
1 #ifndef POSTPROCESS_UTILITIES_H
2 #define POSTPROCESS_UTILITIES_H
3 
4 #include "utilities/timer.h"
5 #include "includes/define.h"
6 #include "includes/variables.h"
7 
8 #ifdef _OPENMP
9 #include <omp.h>
10 #endif
11 
12 namespace Kratos
13 {
14 
15 class PostProcessUtilities
16 {
17 
18 public:
21 
23 
25 
27 
29 
30  virtual ~PostProcessUtilities(){};
31 
32  void RebuildPostProcessModelPart(ModelPart &r_post_model_part, ModelPart &r_main_model_part) {
33 
34  // Cleaning the Output Model Part
35  r_post_model_part.Elements().clear();
36  r_post_model_part.Nodes().clear();
37 
38  // Adding nodes
39  for (size_t i = 0; i < r_main_model_part.NumberOfNodes(); i++) {
40  auto node = r_main_model_part.NodesBegin() + i;
41  r_post_model_part.AddNode(*(node.base()));
42  }
43 
44  // Adding elements
45  PointerVector<Element> elements_to_be_added;
47  i_smp != r_main_model_part.SubModelPartsEnd(); ++i_smp) {
48 
49  // Skipping the Computing Model Part
50  if (!((i_smp->Is(ACTIVE) && i_smp->Is(SOLID)) || (i_smp->Is(ACTIVE) && i_smp->Is(FLUID)))) {
51  if (i_smp->NumberOfElements()) {
52  ModelPart &sub_model_part = *i_smp;
53  for (size_t i = 0; i < sub_model_part.NumberOfElements(); i++) {
54 
55  auto elem = sub_model_part.ElementsBegin() + i;
56  elements_to_be_added.push_back(*(elem.base()));
57  }
58  }
59  }
60  }
61 
62  for (auto &elem : elements_to_be_added) {
63  elem.Set(ACTIVE, true);
64  }
65  r_post_model_part.AddElements(elements_to_be_added.begin(), elements_to_be_added.end());
66  }
67 
68 protected:
69 }; // Class PostProcessUtilities
70 
71 } // namespace Kratos.
72 
73 #endif // POSTPROCESS_UTILITIES_H
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
ElementIterator ElementsBegin(IndexType ThisIndex=0)
Definition: model_part.h:1169
SubModelPartIterator SubModelPartsEnd()
Definition: model_part.h:1708
SubModelPartIterator SubModelPartsBegin()
Definition: model_part.h:1698
void AddNode(NodeType::Pointer pNewNode, IndexType ThisIndex=0)
Definition: model_part.cpp:211
MeshType::ElementsContainerType ElementsContainerType
Element container. A vector set of Elements with their Id's as key.
Definition: model_part.h:168
NodeIterator NodesBegin(IndexType ThisIndex=0)
Definition: model_part.h:487
SizeType NumberOfElements(IndexType ThisIndex=0) const
Definition: model_part.h:1027
ElementsContainerType & Elements(IndexType ThisIndex=0)
Definition: model_part.h:1189
MeshType::NodesContainerType NodesContainerType
Nodes container. Which is a vector set of nodes with their Id's as key.
Definition: model_part.h:128
void AddElements(std::vector< IndexType > const &ElementIds, IndexType ThisIndex=0)
Definition: model_part.cpp:941
SizeType NumberOfNodes(IndexType ThisIndex=0) const
Definition: model_part.h:341
NodesContainerType & Nodes(IndexType ThisIndex=0)
Definition: model_part.h:507
PointerVector is a container like stl vector but using a vector to store pointers to its data.
Definition: pointer_vector.h:72
iterator end()
Definition: pointer_vector.h:177
iterator begin()
Definition: pointer_vector.h:169
void push_back(const TPointerType &x)
Definition: pointer_vector.h:270
Definition: post_process_utilities.hpp:35
void RebuildPostProcessModelPart(ModelPart &r_post_model_part, ModelPart &r_main_model_part)
Definition: postprocess_utilities.h:32
PostProcessUtilities()
Default constructor.
Definition: postprocess_utilities.h:26
ModelPart::ElementsContainerType ElementsArrayType
Definition: postprocess_utilities.h:19
virtual ~PostProcessUtilities()
Destructor.
Definition: postprocess_utilities.h:30
ModelPart::NodesContainerType NodesContainerType
Definition: postprocess_utilities.h:20
KRATOS_CLASS_POINTER_DEFINITION(PostProcessUtilities)
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
integer i
Definition: TensorModule.f:17
Definition: mesh_converter.cpp:38