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.
pmmg_process.h
Go to the documentation of this file.
1 // KRATOS __ __ _____ ____ _ _ ___ _ _ ____
2 // | \/ | ____/ ___|| | | |_ _| \ | |/ ___|
3 // | |\/| | _| \___ \| |_| || || \| | | _
4 // | | | | |___ ___) | _ || || |\ | |_| |
5 // |_| |_|_____|____/|_| |_|___|_| \_|\____| APPLICATION
6 //
7 // License: BSD License
8 // license: MeshingApplication/license.txt
9 //
10 // Main authors: Marc Nunez
11 // Carlos Roig
12 // Vicente Mataix Ferrandizz
13 //
14 
15 #if !defined(KRATOS_PMMG_PROCESS)
16 #define KRATOS_PMMG_PROCESS
17 
18 // System includes
19 #include <unordered_set>
20 #include <unordered_map>
21 
22 // External includes
23 
24 // Project includes
27 
28 // NOTE: The following contains the license of the PMMG library
29 /* =============================================================================
30 ** Copyright (c) Bx INP/Inria/UBordeaux, 2017- .
31 **
32 ** parmmg is free software: you can redistribute it and/or modify it
33 ** under the terms of the GNU Lesser General Public License as published
34 ** by the Free Software Foundation, either version 3 of the License, or
35 ** (at your option) any later version.
36 **
37 ** parmmg is distributed in the hope that it will be useful, but WITHOUT
38 ** ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
39 ** FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
40 ** License for more details.
41 **
42 ** You should have received a copy of the GNU Lesser General Public
43 ** License and of the GNU General Public License along with mmg (in
44 ** files COPYING.LESSER and COPYING). If not, see
45 ** <http://www.gnu.org/licenses/>. Please read their terms carefully and
46 ** use this copy of the mmg distribution only if you accept them.
47 ** =============================================================================
48 */
49 
50 namespace Kratos
51 {
54 
58 
60  typedef std::size_t IndexType;
61 
63  typedef std::size_t SizeType;
64 
66  typedef std::vector<IndexType> IndexVectorType;
67 
71 
75 
79 
90 template<PMMGLibrary TPMMGLibrary>
91 class KRATOS_API(MESHING_APPLICATION) ParMmgProcess
92  : public MmgProcess<MMGLibrary::MMG3D>
93 {
94 public:
95 
98 
101 
103 
105  typedef Node NodeType;
106  // Geometry definition
108 
110  static constexpr SizeType Dimension = 3;
111 
113  typedef typename std::conditional<Dimension == 2, array_1d<double, 3>, array_1d<double, 6>>::type TensorArrayType;
114 
116  typedef std::unordered_map<IndexType,IndexType> ColorsMapType;
117 
119  typedef std::pair<IndexType,IndexType> IndexPairType;
120 
121 
125 
129 
130  // Constructor
131 
138  ModelPart& rThisModelPart,
139  Parameters ThisParameters = Parameters(R"({})")
140  );
141 
143  ~ParMmgProcess() override = default;
144 
148 
152 
156 
160 
164 
165  void operator()();
166 
170 
174  void Execute() override;
175 
179  void ExecuteInitialize() override;
180 
184  void ExecuteBeforeSolutionLoop() override;
185 
189  void ExecuteInitializeSolutionStep() override;
190 
194  void ExecuteFinalizeSolutionStep() override;
195 
199  void ExecuteBeforeOutputStep() override;
200 
204  void ExecuteAfterOutputStep() override;
205 
209  void ExecuteFinalize() override;
210 
214  void OutputMdpa() override;
215 
219  const Parameters GetDefaultParameters() const override;
220 
224 
225 
229 
230 
234 
236  std::string Info() const override
237  {
238  return "ParMmgProcess";
239  }
240 
242  void PrintInfo(std::ostream& rOStream) const override
243  {
244  rOStream << "ParMmgProcess";
245  }
246 
248  void PrintData(std::ostream& rOStream) const override
249  {
250  }
251 
252 protected:
253 
256 
260 
264 
268  void InitializeMeshData() override;
269 
273  void InitializeSolDataMetric() override;
274 
278  void ExecuteRemeshing() override;
279 
283  void InitializeElementsAndConditions() override;
284 
289  void SaveSolutionToFile(const bool PostOutput) override;
290 
294  void FreeMemory() override;
295 
299  void ClearConditionsDuplicatedGeometries() override;
300 
305  void CreateDebugPrePostRemeshOutput(ModelPart& rOldModelPart) override;
306 
307  template<typename TPointerType>
308  void SyncMapAcrossRanks(std::unordered_map<IndexType, TPointerType>& rInputMap);
309 
310 
314 
318 
322 
326 
328 
329 private:
332 
333 
337 
338  ParMmgUtilities<TPMMGLibrary> mPMmgUtilities;
339 
343 
347 
351 
352 
356 
357 
361 
363  ParMmgProcess& operator=(ParMmgProcess const& rOther);
364 
366  ParMmgProcess(ParMmgProcess const& rOther);
367 
369 
370 };// class ParMmgProcess
372 
375 
376 
380 
382 template<PMMGLibrary TPMMGLibrary>
383 inline std::istream& operator >> (std::istream& rIStream,
385 
387 template<PMMGLibrary TPMMGLibrary>
388 inline std::ostream& operator << (std::ostream& rOStream,
389  const ParMmgProcess<TPMMGLibrary>& rThis)
390 {
391  rThis.PrintInfo(rOStream);
392  rOStream << std::endl;
393  rThis.PrintData(rOStream);
394 
395  return rOStream;
396 }
397 
398 }// namespace Kratos.
399 #endif /* KRATOS_PMMG_PROCESS defined */
PeriodicInterfaceProcess & operator=(const PeriodicInterfaceProcess &)=delete
void ExecuteFinalizeSolutionStep() override
this function will be executed at every time step AFTER performing the solve phase
Definition: periodic_interface_process.hpp:55
void ExecuteInitialize() override
Definition: periodic_interface_process.hpp:37
Geometry base class.
Definition: geometry.h:71
This class is a remesher which uses the MMG library.
Definition: mmg_process.h:95
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
This class defines the node.
Definition: node.h:65
This class is a remesher which uses the PMMG library.
Definition: pmmg_process.h:93
KRATOS_CLASS_POINTER_DEFINITION(ParMmgProcess)
Pointer definition of ParMmgProcess.
std::conditional< Dimension==2, array_1d< double, 3 >, array_1d< double, 6 > >::type TensorArrayType
The type of array considered for the tensor.
Definition: pmmg_process.h:113
~ParMmgProcess() override=default
Destructor.
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: pmmg_process.h:242
std::unordered_map< IndexType, IndexType > ColorsMapType
Colors map.
Definition: pmmg_process.h:116
Geometry< NodeType > GeometryType
Definition: pmmg_process.h:107
Node NodeType
Node definition.
Definition: pmmg_process.h:105
std::pair< IndexType, IndexType > IndexPairType
Index pair.
Definition: pmmg_process.h:119
std::string Info() const override
Turn back information as a string.
Definition: pmmg_process.h:236
MmgProcess< MMGLibrary::MMG3D > BaseType
Definition: pmmg_process.h:102
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: pmmg_process.h:248
Provides the Kratos interface to the PMMG library API.
Definition: pmmg_utilities.h:99
This class provides to Kratos a data structure for I/O based on the standard of JSON.
Definition: kratos_parameters.h:59
std::size_t IndexType
The definition of the index type.
Definition: key_hash.h:35
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
std::size_t SizeType
The definition of the size type.
Definition: mortar_classes.h:43
std::istream & operator>>(std::istream &rIStream, LinearMasterSlaveConstraint &rThis)
input stream function
std::vector< IndexType > IndexVectorType
Index vector.
Definition: mmg_io.h:63
std::ostream & operator<<(std::ostream &rOStream, const LinearMasterSlaveConstraint &rThis)
output stream function
Definition: linear_master_slave_constraint.h:432
type
Definition: generate_gid_list_file.py:35