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.
mapper_interface_info.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, Jordi Cotela
11 //
12 // See Master-Thesis P.Bucher
13 // "Development and Implementation of a Parallel
14 // Framework for Non-Matching Grid Mapping"
15 
16 #pragma once
17 
18 // System includes
19 
20 // External includes
21 
22 // Project includes
23 #include "includes/define.h"
25 
26 namespace Kratos
27 {
30 
33 
35 
42 {
43 public:
46 
49 
50  typedef std::size_t IndexType;
51 
53 
56 
60 
61  enum class InfoType
62  {
63  Dummy
64  };
65 
69 
71  MapperInterfaceInfo() = default;
72 
73  explicit MapperInterfaceInfo(const CoordinatesArrayType& rCoordinates,
74  const IndexType SourceLocalSystemIndex,
75  const IndexType SourceRank)
76  : mSourceLocalSystemIndex(SourceLocalSystemIndex),
77  mCoordinates(rCoordinates),
78  mSourceRank(SourceRank)
79  {}
80 
82  virtual ~MapperInterfaceInfo() = default;
83 
87 
97  virtual void ProcessSearchResult(const InterfaceObject& rInterfaceObject) = 0;
98 
113  virtual void ProcessSearchResultForApproximation(const InterfaceObject& rInterfaceObject) {}
114 
115  virtual MapperInterfaceInfo::Pointer Create(const CoordinatesArrayType& rCoordinates,
116  const IndexType SourceLocalSystemIndex,
117  const IndexType SourceRank) const = 0;
118 
119  // needed for serialization
120  virtual MapperInterfaceInfo::Pointer Create() const = 0;
121 
130 
132 
133  IndexType GetSourceRank() const { return mSourceRank; }
134 
135  bool GetLocalSearchWasSuccessful() const { return mLocalSearchWasSuccessful; }
136 
137  bool GetIsApproximation() const { return mIsApproximation; }
138 
140  {
141  return mCoordinates;
142  }
143 
147 
148  virtual void GetValue(int& rValue, const InfoType ValueType) const { KRATOS_ERROR << "Base class function called!" << std::endl; }
149  virtual void GetValue(std::size_t& rValue, const InfoType ValueType) const { KRATOS_ERROR << "Base class function called!" << std::endl; }
150  virtual void GetValue(double& rValue, const InfoType ValueType) const { KRATOS_ERROR << "Base class function called!" << std::endl; }
151  virtual void GetValue(bool& rValue, const InfoType ValueType) const { KRATOS_ERROR << "Base class function called!" << std::endl; }
152  virtual void GetValue(GeometryType& rValue, const InfoType ValueType) const { KRATOS_ERROR << "Base class function called!" << std::endl; }
153 
154  virtual void GetValue(std::vector<int>& rValue, const InfoType ValueType) const { KRATOS_ERROR << "Base class function called!" << std::endl; }
155  virtual void GetValue(std::vector<std::size_t>& rValue, const InfoType ValueType) const { KRATOS_ERROR << "Base class function called!" << std::endl; }
156  virtual void GetValue(std::vector<double>& rValue, const InfoType ValueType) const { KRATOS_ERROR << "Base class function called!" << std::endl; }
157  virtual void GetValue(std::vector<bool>& rValue, const InfoType ValueType) const { KRATOS_ERROR << "Base class function called!" << std::endl; }
158  virtual void GetValue(std::vector<GeometryType>& rValue, const InfoType ValueType) const { KRATOS_ERROR << "Base class function called!" << std::endl; }
159 
163 
165  virtual std::string Info() const
166  {
167  return "MapperInterfaceInfo";
168  }
169 
171  virtual void PrintInfo(std::ostream& rOStream) const {}
172 
174  virtual void PrintData(std::ostream& rOStream) const {}
175 
177 
178 protected:
181 
182  // These variables need serialization
184 
185  // These variables are NOT being serialized bcs they are not needed after searching!
188 
192 
194  {
195  mLocalSearchWasSuccessful = true;
196  mIsApproximation = false;
197  }
198 
200  {
201  // If an approximation is found also means that the local search has been successful!
202  // this is needed otherwise it won't be properly processes by the search
203  // the MapperLocalSystem has to take care of this!
204  mLocalSearchWasSuccessful = true;
205 
206  mIsApproximation = true;
207  }
208 
210 
211 private:
214 
215  bool mIsApproximation = false;
216 
217  bool mLocalSearchWasSuccessful = false; // this is not being serialized since it is not needed after mpi-data-exchange!
218 
222 
223  friend class Serializer;
224 
225  virtual void save(Serializer& rSerializer) const
226  {
227  rSerializer.save("LocalSysIdx", mSourceLocalSystemIndex);
228  rSerializer.save("IsApproximation", mIsApproximation);
229  }
230 
231  virtual void load(Serializer& rSerializer)
232  {
233  rSerializer.load("LocalSysIdx", mSourceLocalSystemIndex);
234  rSerializer.load("IsApproximation", mIsApproximation);
235  }
236 
238 
239 }; // Class MapperInterfaceInfo
240 
242 
245 
247 
249 
250 } // namespace Kratos.
Geometry base class.
Definition: geometry.h:71
Object used by the bin-search.
Definition: interface_object.h:40
BaseType::CoordinatesArrayType CoordinatesArrayType
Definition: interface_object.h:50
ConstructionType
Definition: interface_object.h:63
Object for storing data that is needed to construct the local-mapping-system.
Definition: mapper_interface_info.h:42
void SetLocalSearchWasSuccessful()
Definition: mapper_interface_info.h:193
virtual void GetValue(std::vector< GeometryType > &rValue, const InfoType ValueType) const
Definition: mapper_interface_info.h:158
InfoType
Definition: mapper_interface_info.h:62
IndexType mSourceRank
Definition: mapper_interface_info.h:187
virtual InterfaceObject::ConstructionType GetInterfaceObjectType() const =0
returning the type of construction for the InterfaceObject The returned type is used to create the ob...
virtual void GetValue(GeometryType &rValue, const InfoType ValueType) const
Definition: mapper_interface_info.h:152
virtual void GetValue(std::vector< std::size_t > &rValue, const InfoType ValueType) const
Definition: mapper_interface_info.h:155
InterfaceObject::NodeType NodeType
Definition: mapper_interface_info.h:54
virtual MapperInterfaceInfo::Pointer Create(const CoordinatesArrayType &rCoordinates, const IndexType SourceLocalSystemIndex, const IndexType SourceRank) const =0
virtual void GetValue(std::vector< double > &rValue, const InfoType ValueType) const
Definition: mapper_interface_info.h:156
virtual void GetValue(std::vector< int > &rValue, const InfoType ValueType) const
Definition: mapper_interface_info.h:154
virtual void GetValue(int &rValue, const InfoType ValueType) const
Definition: mapper_interface_info.h:148
virtual void ProcessSearchResult(const InterfaceObject &rInterfaceObject)=0
Processing the result of the search This function processes the results of the search,...
virtual void GetValue(std::vector< bool > &rValue, const InfoType ValueType) const
Definition: mapper_interface_info.h:157
virtual void PrintData(std::ostream &rOStream) const
Print object's data.
Definition: mapper_interface_info.h:174
IndexType GetLocalSystemIndex() const
Definition: mapper_interface_info.h:131
CoordinatesArrayType mCoordinates
Definition: mapper_interface_info.h:186
bool GetLocalSearchWasSuccessful() const
Definition: mapper_interface_info.h:135
virtual void GetValue(double &rValue, const InfoType ValueType) const
Definition: mapper_interface_info.h:150
std::size_t IndexType
Definition: mapper_interface_info.h:50
virtual void GetValue(std::size_t &rValue, const InfoType ValueType) const
Definition: mapper_interface_info.h:149
InterfaceObject::GeometryType GeometryType
Definition: mapper_interface_info.h:55
IndexType GetSourceRank() const
Definition: mapper_interface_info.h:133
KRATOS_CLASS_POINTER_DEFINITION(MapperInterfaceInfo)
Pointer definition of MapperInterfaceInfo.
virtual void GetValue(bool &rValue, const InfoType ValueType) const
Definition: mapper_interface_info.h:151
void SetIsApproximation()
Definition: mapper_interface_info.h:199
MapperInterfaceInfo(const CoordinatesArrayType &rCoordinates, const IndexType SourceLocalSystemIndex, const IndexType SourceRank)
Definition: mapper_interface_info.h:73
virtual void PrintInfo(std::ostream &rOStream) const
Print information about this object.
Definition: mapper_interface_info.h:171
IndexType mSourceLocalSystemIndex
Definition: mapper_interface_info.h:183
MapperInterfaceInfo()=default
Default constructor.
virtual std::string Info() const
Turn back information as a string.
Definition: mapper_interface_info.h:165
bool GetIsApproximation() const
Definition: mapper_interface_info.h:137
InterfaceObject::CoordinatesArrayType CoordinatesArrayType
Definition: mapper_interface_info.h:52
virtual void ProcessSearchResultForApproximation(const InterfaceObject &rInterfaceObject)
Processing the result of the search for computing an approximation This function processes the result...
Definition: mapper_interface_info.h:113
CoordinatesArrayType & Coordinates()
Definition: mapper_interface_info.h:139
virtual ~MapperInterfaceInfo()=default
Destructor.
virtual MapperInterfaceInfo::Pointer Create() const =0
This class defines the node.
Definition: node.h:65
The serialization consists in storing the state of an object into a storage format like data file or ...
Definition: serializer.h:123
void load(std::string const &rTag, TDataType &rObject)
Definition: serializer.h:207
void save(std::string const &rTag, std::array< TDataType, TDataSize > const &rObject)
Definition: serializer.h:545
#define KRATOS_ERROR
Definition: exception.h:161
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
def load(f)
Definition: ode_solve.py:307