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.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 #if !defined(KRATOS_MAPPER_H_INCLUDED)
17 #define KRATOS_MAPPER_H_INCLUDED
18 
19 // System includes
20 
21 // External includes
22 
23 // Project includes
24 #include "includes/define.h"
25 #include "includes/model_part.h"
27 #include "containers/flags.h"
28 
29 
30 namespace Kratos
31 {
32 
36 
38 
41 template<class TSparseSpace, class TDenseSpace>
42 class Mapper
43 {
44 public:
45 
52 
54 
56 
60 
62  Mapper() = default;
63 
65  virtual ~Mapper() = default;
66 
70 
74 
84  virtual void UpdateInterface(
85  Kratos::Flags MappingOptions,
86  double SearchRadius) = 0;
87 
98  virtual void Map(
99  const Variable<double>& rOriginVariable,
100  const Variable<double>& rDestinationVariable,
101  Kratos::Flags MappingOptions) = 0;
102 
108  virtual void Map(
109  const Variable< array_1d<double, 3> >& rOriginVariable,
110  const Variable< array_1d<double, 3> >& rDestinationVariable,
111  Kratos::Flags MappingOptions) = 0;
112 
124  virtual void InverseMap(
125  const Variable<double>& rOriginVariable,
126  const Variable<double>& rDestinationVariable,
127  Kratos::Flags MappingOptions) = 0;
128 
134  virtual void InverseMap(
135  const Variable< array_1d<double, 3> >& rOriginVariable,
136  const Variable< array_1d<double, 3> >& rDestinationVariable,
137  Kratos::Flags MappingOptions) = 0;
138 
147  ModelPart& rModelPartOrigin,
148  ModelPart& rModelPartDestination,
149  Parameters JsonParameters) const = 0;
150 
154 
160  {
161  KRATOS_ERROR << "This mapper doesn't implement \"GetMappingMatrix\"!" << std::endl;
162  }
163 
165  {
166  KRATOS_ERROR << "This mapper doesn't implement \"GetInterfaceModelPartOrigin\"!" << std::endl;
167  }
168 
170  {
171  KRATOS_ERROR << "This mapper doesn't implement \"GetInterfaceModelPartDestination\"!" << std::endl;
172  }
173 
177 
183  virtual int AreMeshesConforming() const
184  {
185  KRATOS_ERROR << "This mapper doesn't implement \"AreMeshesConforming\"!" << std::endl;
186  };
187 
191 
193  virtual std::string Info() const
194  {
195  return "Mapper";
196  }
197 
199  virtual void PrintInfo(std::ostream& rOStream) const
200  {
201  rOStream << "Mapper";
202  }
203 
205  virtual void PrintData(std::ostream& rOStream) const
206  {
207  rOStream << "Mapper working in: ";
208  if (TSparseSpace::IsDistributed()){
209  rOStream << "MPI";
210  } else {
211  rOStream << "OpenMP";
212  }
213  }
214 
215 }; // Class Mapper
216 
218 template<class TSparseSpace, class TDenseSpace>
219 inline std::ostream & operator << (
220  std::ostream& rOStream,
222 {
223  rThis.PrintInfo(rOStream);
224  rOStream << ":" << std::endl;
225  rThis.PrintData(rOStream);
226  return rOStream;
227 }
228 
229 } // namespace Kratos.
230 
231 #endif // KRATOS_MAPPER_H_INCLUDED defined
Definition: flags.h:58
Base Class for all Mappers.
Definition: mapper.h:43
virtual ModelPart & GetInterfaceModelPartDestination()
Definition: mapper.h:169
TSparseSpace::MatrixType TMappingMatrixType
Definition: mapper.h:55
virtual void UpdateInterface(Kratos::Flags MappingOptions, double SearchRadius)=0
Updates the mapping-system after the geometry/mesh has changed After changes in the topology (e....
virtual int AreMeshesConforming() const
Quering for mesh conformity This function is deprecated and will eventually be removed,...
Definition: mapper.h:183
Mapper()=default
Constructor.
virtual void Map(const Variable< double > &rOriginVariable, const Variable< double > &rDestinationVariable, Kratos::Flags MappingOptions)=0
Mapping from Origin to Destination, Scalar Variable Data is exchanged on the Interface,...
virtual void InverseMap(const Variable< double > &rOriginVariable, const Variable< double > &rDestinationVariable, Kratos::Flags MappingOptions)=0
Mapping from Destination to Origin, Scalar Variable Data is exchanged on the Interface,...
virtual void Map(const Variable< array_1d< double, 3 > > &rOriginVariable, const Variable< array_1d< double, 3 > > &rDestinationVariable, Kratos::Flags MappingOptions)=0
Mapping from Origin to Destination, Vector Variable Same as Map, but maps an array3-variable.
virtual void PrintData(std::ostream &rOStream) const
Print object's data.
Definition: mapper.h:205
virtual std::string Info() const
Turn back information as a string.
Definition: mapper.h:193
virtual void PrintInfo(std::ostream &rOStream) const
Print information about this object.
Definition: mapper.h:199
virtual TMappingMatrixType & GetMappingMatrix()
This method returns the mapping-matrix.
Definition: mapper.h:159
KRATOS_CLASS_POINTER_DEFINITION(Mapper)
Kratos::unique_ptr< Mapper > MapperUniquePointerType
Definition: mapper.h:53
virtual ModelPart & GetInterfaceModelPartOrigin()
Definition: mapper.h:164
virtual void InverseMap(const Variable< array_1d< double, 3 > > &rOriginVariable, const Variable< array_1d< double, 3 > > &rDestinationVariable, Kratos::Flags MappingOptions)=0
Mapping from Destination to Origin, Vector Variable Same as InveseMap, but maps an array3-variable.
virtual MapperUniquePointerType Clone(ModelPart &rModelPartOrigin, ModelPart &rModelPartDestination, Parameters JsonParameters) const =0
Cloning the Mapper returns a clone of the current Mapper pure virtual, has to be implemented in every...
virtual ~Mapper()=default
Destructor.
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
This class provides to Kratos a data structure for I/O based on the standard of JSON.
Definition: kratos_parameters.h:59
#define KRATOS_ERROR
Definition: exception.h:161
Matrix MatrixType
Definition: geometrical_transformation_utilities.h:55
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
std::unique_ptr< T > unique_ptr
Definition: smart_pointers.h:33
std::ostream & operator<<(std::ostream &rOStream, const LinearMasterSlaveConstraint &rThis)
output stream function
Definition: linear_master_slave_constraint.h:432