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.
model_part_utils.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: Máté Kelemen
11 //
12 
13 // Project includes
15 #include "includes/model_part.h"
17 
18 namespace Kratos {
19 
20 
23 {
24 public:
26  template <Globals::DataLocation TLocation>
27  static const auto& GetContainer(const ModelPart& rModelPart)
28  {
29  if constexpr (TLocation == Globals::DataLocation::NodeHistorical || TLocation == Globals::DataLocation::NodeNonHistorical) {
30  return rModelPart.Nodes();
31  } else if constexpr (TLocation == Globals::DataLocation::Element) {
32  return rModelPart.Elements();
33  } else if constexpr (TLocation == Globals::DataLocation::Condition) {
34  return rModelPart.Conditions();
35  } else if constexpr (TLocation == Globals::DataLocation::ProcessInfo) {
36  return rModelPart.GetProcessInfo();
37  } else if constexpr (TLocation == Globals::DataLocation::ModelPart) {
38  return rModelPart;
39  }
40  }
41 
43  template <Globals::DataLocation TLocation>
44  static auto& GetContainer(ModelPart& rModelPart)
45  {
46  if constexpr (TLocation == Globals::DataLocation::NodeHistorical || TLocation == Globals::DataLocation::NodeNonHistorical) {
47  return rModelPart.Nodes();
48  } else if constexpr (TLocation == Globals::DataLocation::Element) {
49  return rModelPart.Elements();
50  } else if constexpr (TLocation == Globals::DataLocation::Condition) {
51  return rModelPart.Conditions();
52  } else if constexpr (TLocation == Globals::DataLocation::ProcessInfo) {
53  return rModelPart.GetProcessInfo();
54  } else if constexpr (TLocation == Globals::DataLocation::ModelPart) {
55  return rModelPart;
56  }
57  }
58 }; // class ModelPartUtils
59 
60 
61 } // namespace Kratos
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
ConditionsContainerType & Conditions(IndexType ThisIndex=0)
Definition: model_part.h:1381
ProcessInfo & GetProcessInfo()
Definition: model_part.h:1746
ElementsContainerType & Elements(IndexType ThisIndex=0)
Definition: model_part.h:1189
NodesContainerType & Nodes(IndexType ThisIndex=0)
Definition: model_part.h:507
Class collecting a set of free-floating utility functions for querying and mutating ModelPart s.
Definition: model_part_utils.h:23
static const auto & GetContainer(const ModelPart &rModelPart)
Templated interface for getting nodes, elements, conditions or ProcessInfo from a ModelPart.
Definition: model_part_utils.h:27
static auto & GetContainer(ModelPart &rModelPart)
Templated interface for getting nodes, elements, conditions or ProcessInfo from a ModelPart.
Definition: model_part_utils.h:44
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21