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.
brute_force_point_locator.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: Philipp Bucher (based on work of Pablo Becker)
11 //
12 
13 #if !defined(KRATOS_BRUTE_FORCE_POINT_LOCATOR_H_INCLUDED)
14 #define KRATOS_BRUTE_FORCE_POINT_LOCATOR_H_INCLUDED
15 
16 // System includes
17 
18 // External includes
19 
20 // Project includes
21 #include "includes/define.h"
22 #include "includes/model_part.h"
24 
25 namespace Kratos
26 {
27 
30 
33 
42 class KRATOS_API(KRATOS_CORE) BruteForcePointLocator
43 {
44 public:
47 
50 
54 
56  explicit BruteForcePointLocator(ModelPart& rModelPart) : mrModelPart(rModelPart) {}
57 
59  virtual ~BruteForcePointLocator() = default;
60 
64 
72  int FindNode( const Point& rThePoint,
74  const double DistanceThreshold = 1e-6 ) const;
75 
84  int FindElement( const Point& rThePoint,
85  Vector& rShapeFunctionValues,
87  const double LocalCoordTol = 1e-6) const;
88 
97  int FindCondition( const Point& rThePoint,
98  Vector& rShapeFunctionValues,
100  const double LocalCoordTol = 1e-6) const;
101 
105 
107  virtual std::string Info() const
108  {
109  std::stringstream buffer;
110  buffer << "BruteForcePointLocator" ;
111  return buffer.str();
112  }
113 
115  virtual void PrintInfo(std::ostream& rOStream) const {rOStream << "BruteForcePointLocator";}
116 
118  virtual void PrintData(std::ostream& rOStream) const {}
119 
121 
122 private:
125 
126  ModelPart& mrModelPart;
127 
131 
142  template<typename TObjectType>
143  void FindObject(const TObjectType& rObjects, const std::string& rObjectType,
144  const Point& rThePoint, int& rObjectId, Vector& rShapeFunctionValues,
145  const Globals::Configuration configuration, const double LocalCoordTol) const;
146 
153  void CheckResults(const std::string& rObjectType,
154  const Point& rThePoint,
155  const int LocalObjectFound) const;
156 
165  bool NodeIsCloseEnough(const Node& rNode,
166  const Point& rThePoint,
167  const Globals::Configuration configuration,
168  const double DistanceThreshold) const;
169 
171 
172 }; // Class BruteForcePointLocator
173 
177 
179 inline std::ostream& operator << (std::ostream& rOStream,
180  const BruteForcePointLocator& rThis)
181 {
182  rThis.PrintInfo(rOStream);
183  rOStream << std::endl;
184  rThis.PrintData(rOStream);
185 
186  return rOStream;
187 }
189 
191 
192 } // namespace Kratos.
193 
194 #endif // KRATOS_BRUTE_FORCE_POINT_LOCATOR_H_INCLUDED defined
Utility class to find an entity of a mesh based on a location.
Definition: brute_force_point_locator.h:43
KRATOS_CLASS_POINTER_DEFINITION(BruteForcePointLocator)
Pointer definition of BruteForcePointLocator.
virtual ~BruteForcePointLocator()=default
Destructor.
virtual void PrintData(std::ostream &rOStream) const
Print object's data.
Definition: brute_force_point_locator.h:118
virtual void PrintInfo(std::ostream &rOStream) const
Print information about this object.
Definition: brute_force_point_locator.h:115
virtual std::string Info() const
Turn back information as a string.
Definition: brute_force_point_locator.h:107
BruteForcePointLocator(ModelPart &rModelPart)
Default constructor.
Definition: brute_force_point_locator.h:56
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
This class defines the node.
Definition: node.h:65
Point class.
Definition: point.h:59
Configuration
Enum for Initial and Current configurations.
Definition: global_variables.h:38
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
std::ostream & operator<<(std::ostream &rOStream, const LinearMasterSlaveConstraint &rThis)
output stream function
Definition: linear_master_slave_constraint.h:432
e
Definition: run_cpp_mpi_tests.py:31