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.
specialized_spatial_search.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: Vicente Mataix Ferrandiz
11 //
12 
13 #pragma once
14 
15 // System includes
16 
17 // External includes
18 
19 // Project includes
23 
24 namespace Kratos
25 {
28 
32 
36 
45 enum class SpatialContainer
46 {
47  KDTree,
48  Octree,
49  BinsStatic,
51 };
52 
56 
60 
69 template<SpatialContainer TSearchBackend>
70 class KRATOS_API(KRATOS_CORE) SpecializedSpatialSearch
71  : public SpatialSearch
72 {
73 public:
76 
79 
82 
87 
92 
97 
102 
106 
111  {
112  // We asssign default parameters
113  mParameters = GetDefaultParameters();
114  }
115 
121  : mParameters(ThisParameters)
122  {
123  // We asssign default parameters
124  const Parameters default_parameters = GetDefaultParameters();
125 
126  // We update the parameters
127  mParameters.RecursivelyValidateAndAssignDefaults(default_parameters);
128  }
129 
131  ~SpecializedSpatialSearch() override = default;
132 
136 
140 
144  void SearchElementsInRadiusExclusive(
145  const ElementsContainerType& rStructureElements,
146  const ElementsContainerType& rInputElements,
147  const RadiusArrayType& rRadius,
149  VectorDistanceType& rResultsDistance
150  ) override;
151 
155  void SearchElementsInRadiusExclusive(
156  const ElementsContainerType& rStructureElements,
157  const ElementsContainerType& rInputElements,
158  const RadiusArrayType& rRadius,
160  ) override;
161 
165  void SearchNodesInRadiusExclusive(
166  const NodesContainerType& rStructureNodes,
167  const NodesContainerType& rInputNodes,
168  const RadiusArrayType& rRadius,
170  VectorDistanceType& rResultsDistance
171  ) override;
172 
176  void SearchNodesInRadiusExclusive(
177  const NodesContainerType& rStructureNodes,
178  const NodesContainerType& rInputNodes,
179  const RadiusArrayType& rRadius,
181  ) override;
182 
186  void SearchConditionsInRadiusExclusive(
187  const ConditionsContainerType& rStructureConditions,
188  const ConditionsContainerType& rInputConditions,
189  const RadiusArrayType& rRadius,
191  VectorDistanceType& rResultsDistance
192  ) override;
193 
197  void SearchConditionsInRadiusExclusive(
198  const ConditionsContainerType& rStructureConditions,
199  const ConditionsContainerType& rInputConditions,
200  const RadiusArrayType& rRadius,
202  ) override;
203 
207 
209  std::string Info() const override
210  {
211  std::stringstream buffer;
212  buffer << "SpecializedSpatialSearch" ;
213 
214  return buffer.str();
215  }
216 
218  void PrintInfo(std::ostream& rOStream) const override
219  {
220  rOStream << "SpecializedSpatialSearch";
221  }
222 
224  void PrintData(std::ostream& rOStream) const override
225  {
226 
227  }
228 
232 
234 protected:
237 
241 
243 
247 
252  Parameters GetDefaultParameters() const;
253 
255 private:
258 
262 
266 
270 
273  {
274  return *this;
275  }
276 
279  {
280  *this = rOther;
281  }
282 
284 }; // Class SpecializedSpatialSearch
285 
289 
293 
295 template<SpatialContainer TSearchBackend>
296 inline std::ostream& operator << (std::ostream& rOStream,
298 {
299  rThis.PrintInfo(rOStream);
300  rOStream << std::endl;
301  rThis.PrintData(rOStream);
302 
303  return rOStream;
304 }
305 
307 
309 
310 } // namespace Kratos.
PeriodicInterfaceProcess & operator=(const PeriodicInterfaceProcess &)=delete
A dynamic binning data structure template for organizing and querying points in multi-dimensional spa...
Definition: bins_dynamic.h:57
This class provides to Kratos a data structure for I/O based on the standard of JSON.
Definition: kratos_parameters.h:59
A sorted associative container similar to an STL set, but uses a vector to store pointers to its data...
Definition: pointer_vector_set.h:72
This class is used to search for elements, conditions and nodes in a given model part.
Definition: spatial_search.h:50
std::vector< ResultConditionsContainerType > VectorResultConditionsContainerType
Definition: spatial_search.h:92
std::vector< double > RadiusArrayType
Input/output types.
Definition: spatial_search.h:95
ConditionsContainerType::ContainerType ResultConditionsContainerType
Definition: spatial_search.h:91
std::vector< DistanceType > VectorDistanceType
Definition: spatial_search.h:97
std::vector< ResultNodesContainerType > VectorResultNodesContainerType
Definition: spatial_search.h:82
NodesContainerType::ContainerType ResultNodesContainerType
Definition: spatial_search.h:81
std::vector< ResultElementsContainerType > VectorResultElementsContainerType
Definition: spatial_search.h:87
ElementsContainerType::ContainerType ResultElementsContainerType
Definition: spatial_search.h:86
std::vector< double > DistanceType
Definition: spatial_search.h:96
This class is used to search for elements, conditions and nodes in a given model part.
Definition: specialized_spatial_search.h:72
std::string Info() const override
Turn back information as a string.
Definition: specialized_spatial_search.h:209
SpecializedSpatialSearch()
Default constructor.
Definition: specialized_spatial_search.h:110
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: specialized_spatial_search.h:224
Parameters mParameters
Definition: specialized_spatial_search.h:242
SpecializedSpatialSearch(Parameters ThisParameters)
Constructor with parameters.
Definition: specialized_spatial_search.h:120
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: specialized_spatial_search.h:218
KRATOS_CLASS_POINTER_DEFINITION(SpecializedSpatialSearch)
Pointer definition of SpecializedSpatialSearch.
~SpecializedSpatialSearch() override=default
Destructor.
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
ModelPart::NodesContainerType NodesContainerType
Definition: find_conditions_neighbours_process.h:44
SpatialContainer
This enum defines the different spatial containers available.
Definition: specialized_spatial_search.h:46
ModelPart::ConditionsContainerType ConditionsContainerType
Definition: find_conditions_neighbours_process.h:45
ModelPart::ElementsContainerType ElementsContainerType
Definition: clear_contact_conditions_mesher_process.hpp:43
std::ostream & operator<<(std::ostream &rOStream, const LinearMasterSlaveConstraint &rThis)
output stream function
Definition: linear_master_slave_constraint.h:432