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.
prism_neighbours_process.h
Go to the documentation of this file.
1 // KRATOS ___| | | |
2 // \___ \ __| __| | | __| __| | | __| _` | |
3 // | | | | | ( | | | | ( | |
4 // _____/ \__|_| \__,_|\___|\__|\__,_|_| \__,_|_| MECHANICS
5 //
6 // License: BSD License
7 // license: StructuralMechanicsApplication/license.txt
8 //
9 // Main authors: Vicente Mataix Ferrandiz
10 //
11 
12 #pragma once
13 
14 // System includes
15 
16 // External includes
17 #include <unordered_map>
18 
19 // Project includes
20 #include "processes/process.h"
21 #include "includes/key_hash.h"
22 #include "includes/model_part.h"
23 
24 namespace Kratos
25 {
26 
29 
33 
37 
41 
45 
53 class KRATOS_API(STRUCTURAL_MECHANICS_APPLICATION) PrismNeighboursProcess
54  : public Process
55 {
56 public:
59 
62 
63  // General geometry type definitions
64  typedef Node NodeType;
66 
67  // Containers definition
71 
72  // Containers iterators definition
73  typedef NodesArrayType::iterator NodesIterarorType;
74  typedef ConditionsArrayType::iterator ConditionsIteratorType;
75  typedef ElementsArrayType::iterator ElementsIteratorType;
76 
77  // Weak pointers vectors types
80 
82  typedef std::size_t IndexType;
83 
85  typedef std::size_t SizeType;
86 
88  typedef vector<IndexType> VectorIndexType;
89 
92 
95 
97  typedef std::unordered_map<VectorIndexType, IndexType, VectorIndexHasherType, VectorIndexComparorType > HashMapVectorIntIntType;
98 
100  typedef HashMapVectorIntIntType::iterator HashMapVectorIntIntIteratorType;
101 
103  typedef std::unordered_map<VectorIndexType, Element::Pointer, VectorIndexHasherType, VectorIndexComparorType > HashMapVectorIntElementPointerType;
104 
106  typedef HashMapVectorIntElementPointerType::iterator HashMapVectorIntElementPointerIteratorType;
107 
111 
118  ModelPart& rModelPart,
119  const bool ComputeOnNodes = false
120  ) : mrModelPart(rModelPart),
121  mComputeOnNodes(ComputeOnNodes)
122  {
123  }
124 
127 
131 
132  void operator()()
133  {
134  Execute();
135  }
136 
140 
144  void Execute() override;
145 
149  void ExecuteInitialize() override;
150 
154  void ExecuteFinalize() override;
155 
159 
160 
164 
165 
169 
171  virtual std::string Info() const override
172  {
173  return "PrismNeighboursProcess";
174  }
175 
177  virtual void PrintInfo(std::ostream& rOStream) const override
178  {
179  rOStream << "PrismNeighboursProcess";
180  }
181 
183  virtual void PrintData(std::ostream& rOStream) const override
184  {
185  }
186 
190 
192 
193 protected:
196 
200 
204 
208 
212 
216 
220 
222 
223 private:
226 
227 
231 
232  ModelPart& mrModelPart;
233  const bool mComputeOnNodes;
234 
238 
242  void ClearNeighbours();
243 
251  template< class TDataType >
252  void AddUniqueWeakPointer(
253  GlobalPointersVector< TDataType >& rPointerVector,
254  const typename TDataType::WeakPointer Candidate
255  )
256  {
257  typename GlobalPointersVector< TDataType >::iterator beginit = rPointerVector.begin();
258  typename GlobalPointersVector< TDataType >::iterator endit = rPointerVector.end();
259  while ( beginit != endit && beginit->Id() != (Candidate)->Id()) {
260  beginit++;
261  }
262  if( beginit == endit ) {
263  rPointerVector.push_back(Candidate);
264  }
265 
266  }
267 
271 
272 
276 
277 
281 
282 
286 
288  PrismNeighboursProcess& operator=(PrismNeighboursProcess const& rOther);
289 
291 
292 }; // Class PrismNeighboursProcess
293 
295 
298 
299 
303 
304 
306 inline std::istream& operator >> (std::istream& rIStream,
307  PrismNeighboursProcess& rThis);
308 
310 inline std::ostream& operator << (std::ostream& rOStream,
311  const PrismNeighboursProcess& rThis)
312 {
313  rThis.PrintInfo(rOStream);
314  rOStream << std::endl;
315  rThis.PrintData(rOStream);
316 
317  return rOStream;
318 }
320 
321 
322 } // namespace Kratos.
PeriodicInterfaceProcess & operator=(const PeriodicInterfaceProcess &)=delete
void ExecuteInitialize() override
Definition: periodic_interface_process.hpp:37
Geometry base class.
Definition: geometry.h:71
This class is a vector which stores global pointers.
Definition: global_pointers_vector.h:61
boost::indirect_iterator< typename TContainerType::iterator > iterator
Definition: global_pointers_vector.h:79
void push_back(TPointerType x)
Definition: global_pointers_vector.h:322
iterator begin()
Definition: global_pointers_vector.h:221
iterator end()
Definition: global_pointers_vector.h:229
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
MeshType::ElementsContainerType ElementsContainerType
Element container. A vector set of Elements with their Id's as key.
Definition: model_part.h:168
MeshType::NodesContainerType NodesContainerType
Nodes container. Which is a vector set of nodes with their Id's as key.
Definition: model_part.h:128
This class defines the node.
Definition: node.h:65
An algorithm that looks for neighbour nodes and elements in a mesh of prismatic elements.
Definition: prism_neighbours_process.h:55
std::size_t SizeType
The definition of the sizetype.
Definition: prism_neighbours_process.h:85
HashMapVectorIntElementPointerType::iterator HashMapVectorIntElementPointerIteratorType
Define the HashMapVectorIntElementPointerType iterator type.
Definition: prism_neighbours_process.h:106
void operator()()
Definition: prism_neighbours_process.h:132
virtual std::string Info() const override
Turn back information as a string.
Definition: prism_neighbours_process.h:171
Geometry< NodeType > GeometryType
Definition: prism_neighbours_process.h:65
Node NodeType
Definition: prism_neighbours_process.h:64
virtual ~PrismNeighboursProcess()
Destructor.
Definition: prism_neighbours_process.h:126
GlobalPointersVector< NodeType > NodePointerVector
Definition: prism_neighbours_process.h:78
vector< IndexType > VectorIndexType
Definition of the vector indexes considered.
Definition: prism_neighbours_process.h:88
std::unordered_map< VectorIndexType, Element::Pointer, VectorIndexHasherType, VectorIndexComparorType > HashMapVectorIntElementPointerType
Define the map considered for elemento pointers.
Definition: prism_neighbours_process.h:103
KRATOS_CLASS_POINTER_DEFINITION(PrismNeighboursProcess)
Pointer definition of PrismNeighboursProcess.
ModelPart::ConditionsContainerType ConditionsArrayType
Definition: prism_neighbours_process.h:69
std::size_t IndexType
The definition of the index type.
Definition: prism_neighbours_process.h:82
PrismNeighboursProcess(ModelPart &rModelPart, const bool ComputeOnNodes=false)
Default constructor.
Definition: prism_neighbours_process.h:117
HashMapVectorIntIntType::iterator HashMapVectorIntIntIteratorType
Define the HashMapVectorIntIntType iterator type.
Definition: prism_neighbours_process.h:100
NodesArrayType::iterator NodesIterarorType
Definition: prism_neighbours_process.h:73
GlobalPointersVector< Element > ElementPointerVector
Definition: prism_neighbours_process.h:79
ModelPart::NodesContainerType NodesArrayType
Definition: prism_neighbours_process.h:68
ConditionsArrayType::iterator ConditionsIteratorType
Definition: prism_neighbours_process.h:74
virtual void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: prism_neighbours_process.h:177
VectorIndexComparor< VectorIndexType > VectorIndexComparorType
Definition of the key comparor considered.
Definition: prism_neighbours_process.h:94
ModelPart::ElementsContainerType ElementsArrayType
Definition: prism_neighbours_process.h:70
VectorIndexHasher< VectorIndexType > VectorIndexHasherType
Definition of the hasher considered.
Definition: prism_neighbours_process.h:91
ElementsArrayType::iterator ElementsIteratorType
Definition: prism_neighbours_process.h:75
std::unordered_map< VectorIndexType, IndexType, VectorIndexHasherType, VectorIndexComparorType > HashMapVectorIntIntType
Define the map considered for indexes.
Definition: prism_neighbours_process.h:97
virtual void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: prism_neighbours_process.h:183
The base class for all processes in Kratos.
Definition: process.h:49
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
std::ostream & operator<<(std::ostream &rOStream, const LinearMasterSlaveConstraint &rThis)
output stream function
Definition: linear_master_slave_constraint.h:432
This is a key comparer between two vectors of indexes.
Definition: key_hash.h:351
This is a hasher between two vectors of indexes.
Definition: key_hash.h:333