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.
interface_communicator.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
24 #include "includes/model_part.h"
25 #include "mappers/mapper_flags.h"
30 
31 
32 namespace Kratos
33 {
36 
39 
41 
44 class KRATOS_API(MAPPING_APPLICATION) InterfaceCommunicator
45 {
46 public:
49 
52 
54 
56  typedef std::vector<std::vector<MapperInterfaceInfoPointerType>> MapperInterfaceInfoPointerVectorType;
57 
59  typedef std::vector<MapperLocalSystemPointer> MapperLocalSystemPointerVector;
60 
62 
65 
69 
70  InterfaceCommunicator(ModelPart& rModelPartOrigin,
71  MapperLocalSystemPointerVector& rMapperLocalSystems,
72  Parameters SearchSettings);
73 
75  virtual ~InterfaceCommunicator() = default;
76 
80 
81  void ExchangeInterfaceData(const Communicator& rComm,
82  const MapperInterfaceInfoUniquePointerType& rpRefInterfaceInfo);
83 
87 
89  return mMeshesAreConforming;
90  }
91 
95 
97  virtual std::string Info() const
98  {
99  std::stringstream buffer;
100  buffer << "InterfaceCommunicator" ;
101  return buffer.str();
102  }
103 
105  virtual void PrintInfo(std::ostream& rOStream) const
106  {
107  rOStream << "InterfaceCommunicator";
108  }
109 
111  virtual void PrintData(std::ostream& rOStream) const {}
112 
114 
115 protected:
118 
121  MapperInterfaceInfoPointerVectorType mMapperInterfaceInfosContainer; // this contains the InterfaceInfos for all ranks! => needed to do the async communication
122 
124 
126 
128  double mSearchRadius = -1.0;
129 
130  int mEchoLevel = 0;
131  int mMeshesAreConforming = 0;
132 
136 
137  virtual void InitializeSearch(const MapperInterfaceInfoUniquePointerType& rpRefInterfaceInfo);
138 
139  virtual void FinalizeSearch();
140 
141  virtual void InitializeSearchIteration(const MapperInterfaceInfoUniquePointerType& rpRefInterfaceInfo);
142 
143  virtual void FinalizeSearchIteration(const MapperInterfaceInfoUniquePointerType& rpInterfaceInfo);
144 
145  void FilterInterfaceInfosSuccessfulSearch();
146 
147  void AssignInterfaceInfos();
148 
150 
151 private:
154 
155  void ConductLocalSearch();
156 
157  void CreateInterfaceObjectsOrigin(const MapperInterfaceInfoUniquePointerType& rpRefInterfaceInfo);
158 
159  void UpdateInterfaceObjectsOrigin();
160 
161  void InitializeBinsSearchStructure();
162 
163  // this function performs the search and the exchange of the data on the interface
164  void ConductSearchIteration(const MapperInterfaceInfoUniquePointerType& rpRefInterfaceInfo);
165 
166  bool AllNeighborsFound(const Communicator& rComm) const;
167 
168  void PrintInfoAboutCurrentSearchSuccess(
169  const Communicator& rComm,
170  const BuiltinTimer& rTimer) const;
171 
173 
174 }; // Class InterfaceCommunicator
175 
177 
179 
181 
182 } // namespace Kratos.
Definition: builtin_timer.h:26
The Commmunicator class manages communication for distributed ModelPart instances.
Definition: communicator.h:67
Object for exchanging data on the Interface.
Definition: interface_communicator.h:45
virtual ~InterfaceCommunicator()=default
Destructor.
ModelPart & mrModelPartOrigin
Definition: interface_communicator.h:119
virtual void PrintData(std::ostream &rOStream) const
Print object's data.
Definition: interface_communicator.h:111
Parameters mSearchSettings
Definition: interface_communicator.h:127
Kratos::unique_ptr< InterfaceObjectContainerType > InterfaceObjectContainerUniquePointerType
Definition: interface_communicator.h:64
Kratos::unique_ptr< MapperLocalSystem > MapperLocalSystemPointer
Definition: interface_communicator.h:58
MapperInterfaceInfoPointerVectorType mMapperInterfaceInfosContainer
Definition: interface_communicator.h:121
Kratos::unique_ptr< BinsObjectDynamic< InterfaceObjectConfigure > > BinsUniquePointerType
Definition: interface_communicator.h:61
std::vector< std::vector< MapperInterfaceInfoPointerType > > MapperInterfaceInfoPointerVectorType
Definition: interface_communicator.h:56
int AreMeshesConforming()
Definition: interface_communicator.h:88
virtual void PrintInfo(std::ostream &rOStream) const
Print information about this object.
Definition: interface_communicator.h:105
Kratos::unique_ptr< MapperInterfaceInfo > MapperInterfaceInfoUniquePointerType
Definition: interface_communicator.h:53
std::vector< MapperLocalSystemPointer > MapperLocalSystemPointerVector
Definition: interface_communicator.h:59
InterfaceObjectConfigure::ContainerType InterfaceObjectContainerType
Definition: interface_communicator.h:63
Kratos::shared_ptr< MapperInterfaceInfo > MapperInterfaceInfoPointerType
Definition: interface_communicator.h:55
virtual std::string Info() const
Turn back information as a string.
Definition: interface_communicator.h:97
const MapperLocalSystemPointerVector & mrMapperLocalSystems
Definition: interface_communicator.h:120
BinsUniquePointerType mpLocalBinStructure
Definition: interface_communicator.h:123
InterfaceObjectContainerUniquePointerType mpInterfaceObjectsOrigin
Definition: interface_communicator.h:125
KRATOS_CLASS_POINTER_DEFINITION(InterfaceCommunicator)
Pointer definition of InterfaceCommunicator.
ObjectContainerType::ContainerType ContainerType
Definition: interface_object_configure.h:70
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
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
std::shared_ptr< T > shared_ptr
Definition: smart_pointers.h:27
std::unique_ptr< T > unique_ptr
Definition: smart_pointers.h:33