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.
interpolative_mapper_base.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
26 
27 #include "mappers/mapper.h"
31 #include "mappers/mapper_flags.h"
37 
38 namespace Kratos
39 {
42 
44 template<class TMapperBackend>
46 {
47 public:
50 
52  typedef typename TMapperBackend::InterfaceCommunicatorType InterfaceCommunicatorType;
54 
58 
59  template<class TMapper>
61  TMapper& rMapper,
62  const Communicator& rModelPartCommunicator,
63  std::vector<Kratos::unique_ptr<MapperLocalSystem>>& rLocalSystems
64  )
65  {
66  rMapper.CreateMapperLocalSystems(rModelPartCommunicator, rLocalSystems);
67  }
68 
69  template<class TMapper>
71  {
72  return rMapper.GetMapperInterfaceInfo();
73  }
74 
76 
77 }; // Class AccessorInterpolativeMapperBase
78 
79 template<class TSparseSpace, class TDenseSpace, class TMapperBackend>
80 class KRATOS_API(MAPPING_APPLICATION) InterpolativeMapperBase : public Mapper<TSparseSpace, TDenseSpace>
81 {
82 public:
85 
88 
90 
91  typedef typename TMapperBackend::InterfaceCommunicatorType InterfaceCommunicatorType;
94 
96  typedef std::vector<MapperLocalSystemPointer> MapperLocalSystemPointerVector;
97 
100 
101  typedef std::size_t IndexType;
102 
106 
108 
112 
113  // Default constructor, needed for registration
115  ModelPart& rModelPartDestination)
116  : mrModelPartOrigin(rModelPartOrigin),
117  mrModelPartDestination(rModelPartDestination) {}
118 
120  ModelPart& rModelPartDestination,
121  Parameters JsonParameters)
122  : mrModelPartOrigin(rModelPartOrigin),
123  mrModelPartDestination(rModelPartDestination),
124  mMapperSettings(JsonParameters)
125  {
126  mpInterfaceVectorContainerOrigin = Kratos::make_unique<InterfaceVectorContainerType>(rModelPartOrigin);
127  mpInterfaceVectorContainerDestination = Kratos::make_unique<InterfaceVectorContainerType>(rModelPartDestination);
128  }
129 
131  ~InterpolativeMapperBase() override = default;
132 
136 
138  Kratos::Flags MappingOptions,
139  double SearchRadius) override
140  {
141  KRATOS_TRY;
142 
143  KRATOS_WARNING_IF("Mapper", mMapperSettings["use_initial_configuration"].GetBool()) << "Updating the interface while using the initial configuration for mapping!" << std::endl;
144 
145  Initialize();
146 
147  if (mpInverseMapper) {
148  mpInverseMapper->UpdateInterface(MappingOptions,
149  SearchRadius);
150  }
151 
152  KRATOS_CATCH("");
153  }
154 
155  void Map(
156  const Variable<double>& rOriginVariable,
157  const Variable<double>& rDestinationVariable,
158  Kratos::Flags MappingOptions) override
159  {
160  KRATOS_TRY;
161 
162  if (MappingOptions.Is(MapperFlags::USE_TRANSPOSE)) {
163  GetInverseMapper().MapInternalTranspose(rDestinationVariable, rOriginVariable, MappingOptions);
164  } else {
165  MapInternal(rOriginVariable, rDestinationVariable, MappingOptions);
166  }
167 
168  KRATOS_CATCH("");
169  }
170 
171  void Map(
172  const Variable< array_1d<double, 3> >& rOriginVariable,
173  const Variable< array_1d<double, 3> >& rDestinationVariable,
174  Kratos::Flags MappingOptions) override
175  {
176  KRATOS_TRY;
177 
178  if (MappingOptions.Is(MapperFlags::USE_TRANSPOSE)) {
179  GetInverseMapper().MapInternalTranspose(rDestinationVariable, rOriginVariable, MappingOptions);
180  } else {
181  MapInternal(rOriginVariable, rDestinationVariable, MappingOptions);
182  }
183 
184  KRATOS_CATCH("");
185  }
186 
188  const Variable<double>& rOriginVariable,
189  const Variable<double>& rDestinationVariable,
190  Kratos::Flags MappingOptions) override
191  {
192  KRATOS_TRY;
193 
194  if (MappingOptions.Is(MapperFlags::USE_TRANSPOSE)) {
195  MapInternalTranspose(rOriginVariable, rDestinationVariable, MappingOptions);
196  } else {
197  GetInverseMapper().Map(rDestinationVariable, rOriginVariable, MappingOptions);
198  }
199 
200  KRATOS_CATCH("");
201  }
202 
204  const Variable< array_1d<double, 3> >& rOriginVariable,
205  const Variable< array_1d<double, 3> >& rDestinationVariable,
206  Kratos::Flags MappingOptions) override
207  {
208  KRATOS_TRY;
209 
210  if (MappingOptions.Is(MapperFlags::USE_TRANSPOSE)) {
211  MapInternalTranspose(rOriginVariable, rDestinationVariable, MappingOptions);
212  } else {
213  GetInverseMapper().Map(rDestinationVariable, rOriginVariable, MappingOptions);
214  }
215 
216  KRATOS_CATCH("");
217  }
218 
222 
224  {
225  return *mpMappingMatrix;
226  }
227 
231 
233  std::string Info() const override
234  {
235  return "InterpolativeMapperBase";
236  }
237 
239  void PrintInfo(std::ostream& rOStream) const override
240  {
241  rOStream << "InterpolativeMapperBase";
242  }
243 
245  void PrintData(std::ostream& rOStream) const override
246  {
247  BaseType::PrintData(rOStream);
248  }
249 
250 protected:
251 
252  int mMeshesAreConforming = false;
253 
255 
262  void Initialize()
263  {
264  KRATOS_TRY;
265 
266  BuildMappingMatrix();
267 
268  KRATOS_CATCH("");
269  }
270 
272  {
273  // backward compatibility
274  if (mMapperSettings.Has("search_radius")) {
275  KRATOS_WARNING("Mapper") << "DEPRECATION-WARNING: \"search_radius\" should be specified under \"search_settings\"!" << std::endl;
276  const double search_radius = mMapperSettings["search_radius"].GetDouble();
277 
278  if (mMapperSettings.Has("search_settings")) {
279  KRATOS_ERROR_IF(mMapperSettings["search_settings"].Has("search_radius")) << "\"search_radius\" specified twice, please only speficy it in \"search_settings\"!" << std::endl;
280  } else {
281  mMapperSettings.AddValue("search_settings", Parameters());
282  }
283 
284  mMapperSettings["search_settings"].AddEmptyValue("search_radius").SetDouble(search_radius);
285  mMapperSettings.RemoveValue("search_radius");
286  }
287 
288  if (mMapperSettings.Has("search_iterations")) {
289  KRATOS_WARNING("Mapper") << "DEPRECATION-WARNING: \"search_iterations\" should be specified as \"max_num_search_iterations\" under \"search_settings\"!" << std::endl;
290  const int search_iterations = mMapperSettings["search_iterations"].GetInt();
291 
292  if (mMapperSettings.Has("search_settings")) {
293  KRATOS_ERROR_IF(mMapperSettings["search_settings"].Has("max_num_search_iterations")) << "\"search_iterations\" specified twice, please only speficy it in \"search_settings\" (as \"max_num_search_iterations\")!" << std::endl;
294  } else {
295  mMapperSettings.AddValue("search_settings", Parameters());
296  }
297 
298  mMapperSettings["search_settings"].AddEmptyValue("max_num_search_iterations").SetInt(search_iterations);
299  mMapperSettings.RemoveValue("search_iterations");
300  }
301 
303 
304  const Parameters mapper_default_settings(GetMapperDefaultSettings());
305 
306  mMapperSettings.ValidateAndAssignDefaults(mapper_default_settings);
307 
308  if (!mMapperSettings["search_settings"].Has("echo_level")) {
309  // use the echo level of the mapper in case none was specified for the search
310  mMapperSettings["search_settings"].AddEmptyValue("echo_level").SetInt(mMapperSettings["echo_level"].GetInt());
311  }
312  }
313 
317 
323  {
324  return mrModelPartOrigin;
325  }
326 
332  {
333  return mrModelPartDestination;
334  }
335 
337 
338 private:
341 
342  ModelPart& mrModelPartOrigin;
343  ModelPart& mrModelPartDestination;
344 
345  Parameters mMapperSettings;
346 
347  MapperUniquePointerType mpInverseMapper = nullptr;
348 
349  MapperLocalSystemPointerVector mMapperLocalSystems;
350 
351  InterfaceVectorContainerPointerType mpInterfaceVectorContainerOrigin;
352  InterfaceVectorContainerPointerType mpInterfaceVectorContainerDestination;
353 
357 
358  void BuildMappingMatrix()
359  {
360  KRATOS_TRY;
361 
362  CreateMapperLocalSystems(mrModelPartDestination.GetCommunicator(),
363  mMapperLocalSystems);
364 
365  const bool use_initial_configuration = mMapperSettings["use_initial_configuration"].GetBool();
366 
367  if (use_initial_configuration) {
369  MapperUtilities::SaveCurrentConfiguration(mrModelPartDestination);
370 
372  VariableUtils().UpdateCurrentToInitialConfiguration(mrModelPartDestination.Nodes());
373  }
374 
375  AssignInterfaceEquationIds(); // Has to be done ever time in case of overlapping interfaces!
376 
377  auto p_interface_comm = Kratos::make_unique<InterfaceCommunicatorType>(
378  mrModelPartOrigin,
379  mMapperLocalSystems,
380  mMapperSettings["search_settings"]);
381 
382  const MapperInterfaceInfoUniquePointerType p_ref_interface_info = GetMapperInterfaceInfo();
383 
384  p_interface_comm->ExchangeInterfaceData(mrModelPartDestination.GetCommunicator(),
385  p_ref_interface_info);
386 
387  // ugly hack until this function can be removed
388  mMeshesAreConforming = p_interface_comm->AreMeshesConforming();
389 
390  const int echo_level = mMapperSettings["echo_level"].GetInt();
391 
393  mpMappingMatrix,
394  mpInterfaceVectorContainerOrigin->pGetVector(),
395  mpInterfaceVectorContainerDestination->pGetVector(),
396  mpInterfaceVectorContainerOrigin->GetModelPart(),
397  mpInterfaceVectorContainerDestination->GetModelPart(),
398  mMapperLocalSystems,
399  echo_level);
400 
401  if (use_initial_configuration) {
403  MapperUtilities::RestoreCurrentConfiguration(mrModelPartDestination);
404  }
405 
406  PrintPairingInfo(echo_level);
407 
408  // free memory
409  mMapperLocalSystems.clear();
410  mMapperLocalSystems.shrink_to_fit();
411 
412  KRATOS_CATCH("");
413  }
414 
416  {
419  }
420 
421  void MapInternal(const Variable<double>& rOriginVariable,
422  const Variable<double>& rDestinationVariable,
423  Kratos::Flags MappingOptions)
424  {
425  KRATOS_TRY;
426 
427  mpInterfaceVectorContainerOrigin->UpdateSystemVectorFromModelPart(rOriginVariable, MappingOptions);
428 
430  *mpMappingMatrix,
431  mpInterfaceVectorContainerOrigin->GetVector(),
432  mpInterfaceVectorContainerDestination->GetVector()); // rQd = rMdo * rQo
433 
434  mpInterfaceVectorContainerDestination->UpdateModelPartFromSystemVector(rDestinationVariable, MappingOptions);
435 
436  KRATOS_CATCH("");
437  }
438 
439  void MapInternalTranspose(const Variable<double>& rOriginVariable,
440  const Variable<double>& rDestinationVariable,
441  Kratos::Flags MappingOptions)
442  {
443  KRATOS_TRY;
444 
445  mpInterfaceVectorContainerDestination->UpdateSystemVectorFromModelPart(rDestinationVariable, MappingOptions);
446 
448  *mpMappingMatrix,
449  mpInterfaceVectorContainerDestination->GetVector(),
450  mpInterfaceVectorContainerOrigin->GetVector()); // rQo = rMdo^T * rQd
451 
452  mpInterfaceVectorContainerOrigin->UpdateModelPartFromSystemVector(rOriginVariable, MappingOptions);
453 
454  KRATOS_CATCH("");
455  }
456 
457  void MapInternal(const Variable<array_1d<double, 3>>& rOriginVariable,
458  const Variable<array_1d<double, 3>>& rDestinationVariable,
459  Kratos::Flags MappingOptions)
460  {
461  KRATOS_TRY;
462 
463  for (const auto var_ext : {"_X", "_Y", "_Z"}) {
464  const auto& var_origin = KratosComponents<ComponentVariableType>::Get(rOriginVariable.Name() + var_ext);
465  const auto& var_destination = KratosComponents<ComponentVariableType>::Get(rDestinationVariable.Name() + var_ext);
466 
467  MapInternal(var_origin, var_destination, MappingOptions);
468  }
469 
470  KRATOS_CATCH("");
471  }
472 
473  void MapInternalTranspose(const Variable<array_1d<double, 3>>& rOriginVariable,
474  const Variable<array_1d<double, 3>>& rDestinationVariable,
475  Kratos::Flags MappingOptions)
476  {
477  KRATOS_TRY;
478 
479  for (const auto var_ext : {"_X", "_Y", "_Z"}) {
480  const auto& var_origin = KratosComponents<ComponentVariableType>::Get(rOriginVariable.Name() + var_ext);
481  const auto& var_destination = KratosComponents<ComponentVariableType>::Get(rDestinationVariable.Name() + var_ext);
482 
483  MapInternalTranspose(var_origin, var_destination, MappingOptions);
484  }
485 
486  KRATOS_CATCH("");
487  }
488 
489  void PrintPairingInfo(const int EchoLevel)
490  {
491  KRATOS_TRY;
492 
493  const auto& r_data_comm = mrModelPartDestination.GetCommunicator().GetDataCommunicator();
494 
495  if (r_data_comm.IsNullOnThisRank()) {return;}
496 
497  if (EchoLevel > 2) {
498  for (const auto& rp_local_sys : mMapperLocalSystems) {
499  const auto pairing_status = rp_local_sys->GetPairingStatus();
500 
502  std::stringstream warning_msg;
503  rp_local_sys->PairingInfo(warning_msg, EchoLevel);
504 
505  if (pairing_status == MapperLocalSystem::PairingStatus::Approximation) {
506  warning_msg << " is using an approximation";
507  } else if (pairing_status == MapperLocalSystem::PairingStatus::NoInterfaceInfo) {
508  warning_msg << " has not found a neighbor";
509  }
510 
511  KRATOS_WARNING_ALL_RANKS("Mapper") << warning_msg.str() << std::endl; // TODO use data-comm of the destination-MP
512  }
513  }
514  }
515 
516  if (EchoLevel > 0) {
518  int approximations, no_neighbor;
519  std::tie(approximations, no_neighbor) = block_for_each<TwoReduction>(mMapperLocalSystems,
520  [](const MapperLocalSystemPointer& rpLocalSys){
521  const auto pairing_status = rpLocalSys->GetPairingStatus();
522  if (pairing_status == MapperLocalSystem::PairingStatus::Approximation) {
523  return std::make_tuple(1,0);
524  } else if (pairing_status == MapperLocalSystem::PairingStatus::NoInterfaceInfo) {
525  return std::make_tuple(0,1);
526  }
527  return std::make_tuple(0,0);
528  });
529  approximations = r_data_comm.SumAll(approximations);
530  no_neighbor = r_data_comm.SumAll(no_neighbor);
531  const int global_num_nodes = mrModelPartDestination.GetCommunicator().GlobalNumberOfNodes();
532 
533  KRATOS_WARNING_IF("Mapper", approximations > 0) << approximations << " / " << global_num_nodes << " (" << std::round((approximations/static_cast<double>(global_num_nodes))*100) << " %) local systems are using an approximation" << std::endl;
534 
535  KRATOS_WARNING_IF("Mapper", no_neighbor > 0) << no_neighbor << " / " << global_num_nodes << " (" << std::round((no_neighbor/static_cast<double>(global_num_nodes))*100) << " %) local systems did not find a neighbor!" << std::endl;
536  }
537 
538  if (mMapperSettings["print_pairing_status_to_file"].GetBool()) {
539  // print a debug ModelPart to check the pairing
540 
541  // initialize data
542  VariableUtils().SetNonHistoricalVariable(PAIRING_STATUS, 1, mrModelPartDestination.Nodes());
543 
544  block_for_each(mMapperLocalSystems, [](const MapperLocalSystemPointer& rpLocalSys){
545  rpLocalSys->SetPairingStatusForPrinting();
546  });
547 
548  const std::string file_name = Info() + "_PairingStatus_O_" + mrModelPartOrigin.FullName() + "_D_" + mrModelPartDestination.FullName();
549 
550  KRATOS_INFO("Mapper") << "Printing file with PAIRING_STATUS: " << file_name << ".vtk" << std::endl;
551 
552  Parameters vtk_params( R"({
553  "file_format" : "binary",
554  "save_output_files_in_folder" : true,
555  "nodal_data_value_variables" : ["PAIRING_STATUS"]
556  })");
557 
558  vtk_params.AddValue("output_path", mMapperSettings["pairing_status_file_path"]);
559 
560  VtkOutput(mrModelPartDestination, vtk_params).PrintOutput(file_name);
561 
562  block_for_each(mrModelPartDestination.Nodes(), [&](Node& rNode){
563  rNode.GetData().Erase(PAIRING_STATUS);
564  });
565  }
566 
567  KRATOS_CATCH("");
568  }
569 
570  friend class AccessorInterpolativeMapperBase<TMapperBackend>;
571 
572  // functions for customizing the behavior of this Mapper
573  virtual void CreateMapperLocalSystems(
574  const Communicator& rModelPartCommunicator,
575  std::vector<Kratos::unique_ptr<MapperLocalSystem>>& rLocalSystems) = 0;
576 
577  virtual MapperInterfaceInfoUniquePointerType GetMapperInterfaceInfo() const = 0;
578 
579  virtual Parameters GetMapperDefaultSettings() const = 0;
580 
584 
585  InterpolativeMapperBase& GetInverseMapper()
586  {
587  KRATOS_TRY;
588 
589  if (!mpInverseMapper) {
590  InitializeInverseMapper();
591  }
592  return *(static_cast<InterpolativeMapperBase*>(mpInverseMapper.get()));
593 
594  KRATOS_CATCH("");
595  }
596 
597  void InitializeInverseMapper()
598  {
599  KRATOS_TRY;
600 
601  mpInverseMapper = this->Clone(mrModelPartDestination,
602  mrModelPartOrigin,
603  mMapperSettings);
604 
605  KRATOS_CATCH("");
606  }
607 
608 }; // Class InterpolativeMapperBase
609 
610 } // namespace Kratos.
std::string Info() const override
Turn back information as a string.
Definition: periodic_interface_process.hpp:93
Definition of an accessor auxiliary class.
Definition: interpolative_mapper_base.h:46
static MapperInterfaceInfoUniquePointerType GetMapperInterfaceInfo(const TMapper &rMapper)
Definition: interpolative_mapper_base.h:70
static void CreateMapperLocalSystems(TMapper &rMapper, const Communicator &rModelPartCommunicator, std::vector< Kratos::unique_ptr< MapperLocalSystem >> &rLocalSystems)
Definition: interpolative_mapper_base.h:60
InterfaceCommunicator::MapperInterfaceInfoUniquePointerType MapperInterfaceInfoUniquePointerType
Definition: interpolative_mapper_base.h:53
TMapperBackend::InterfaceCommunicatorType InterfaceCommunicatorType
Interface definitions.
Definition: interpolative_mapper_base.h:52
The Commmunicator class manages communication for distributed ModelPart instances.
Definition: communicator.h:67
virtual const DataCommunicator & GetDataCommunicator() const
Definition: communicator.cpp:340
SizeType GlobalNumberOfNodes() const
Definition: communicator.cpp:101
Definition: flags.h:58
bool Is(Flags const &rOther) const
Definition: flags.h:274
Kratos::unique_ptr< MapperInterfaceInfo > MapperInterfaceInfoUniquePointerType
Definition: interface_communicator.h:53
Short class definition.
Definition: interface_vector_container.h:40
Definition: interpolative_mapper_base.h:81
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: interpolative_mapper_base.h:239
BaseType::TMappingMatrixType TMappingMatrixType
Definition: interpolative_mapper_base.h:104
std::size_t IndexType
Definition: interpolative_mapper_base.h:101
void InverseMap(const Variable< array_1d< double, 3 > > &rOriginVariable, const Variable< array_1d< double, 3 > > &rDestinationVariable, Kratos::Flags MappingOptions) override
Mapping from Destination to Origin, Vector Variable Same as InveseMap, but maps an array3-variable.
Definition: interpolative_mapper_base.h:203
ModelPart & GetDestinationModelPart()
This function destination model part.
Definition: interpolative_mapper_base.h:331
KRATOS_CLASS_POINTER_DEFINITION(InterpolativeMapperBase)
Pointer definition of InterpolativeMapperBase.
void Map(const Variable< array_1d< double, 3 > > &rOriginVariable, const Variable< array_1d< double, 3 > > &rDestinationVariable, Kratos::Flags MappingOptions) override
Mapping from Origin to Destination, Vector Variable Same as Map, but maps an array3-variable.
Definition: interpolative_mapper_base.h:171
TMapperBackend::InterfaceCommunicatorType InterfaceCommunicatorType
Definition: interpolative_mapper_base.h:91
ModelPart & GetOriginModelPart()
This function origin model part.
Definition: interpolative_mapper_base.h:322
void Map(const Variable< double > &rOriginVariable, const Variable< double > &rDestinationVariable, Kratos::Flags MappingOptions) override
Mapping from Origin to Destination, Scalar Variable Data is exchanged on the Interface,...
Definition: interpolative_mapper_base.h:155
void InverseMap(const Variable< double > &rOriginVariable, const Variable< double > &rDestinationVariable, Kratos::Flags MappingOptions) override
Mapping from Destination to Origin, Scalar Variable Data is exchanged on the Interface,...
Definition: interpolative_mapper_base.h:187
void Initialize()
Initializing the Mapper This has to be called in the constructor of the derived classes,...
Definition: interpolative_mapper_base.h:262
Kratos::unique_ptr< TMappingMatrixType > TMappingMatrixUniquePointerType
Definition: interpolative_mapper_base.h:105
BaseType::MapperUniquePointerType MapperUniquePointerType
Definition: interpolative_mapper_base.h:103
Kratos::unique_ptr< InterfaceVectorContainerType > InterfaceVectorContainerPointerType
Definition: interpolative_mapper_base.h:99
void ValidateInput()
Definition: interpolative_mapper_base.h:271
InterpolativeMapperBase(ModelPart &rModelPartOrigin, ModelPart &rModelPartDestination, Parameters JsonParameters)
Definition: interpolative_mapper_base.h:119
Kratos::unique_ptr< InterfaceCommunicator > InterfaceCommunicatorPointerType
Definition: interpolative_mapper_base.h:92
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: interpolative_mapper_base.h:245
Kratos::unique_ptr< MapperLocalSystem > MapperLocalSystemPointer
Definition: interpolative_mapper_base.h:95
Variable< double > ComponentVariableType
Definition: interpolative_mapper_base.h:107
TMappingMatrixUniquePointerType mpMappingMatrix
Definition: interpolative_mapper_base.h:254
std::string Info() const override
Turn back information as a string.
Definition: interpolative_mapper_base.h:233
InterpolativeMapperBase(ModelPart &rModelPartOrigin, ModelPart &rModelPartDestination)
Definition: interpolative_mapper_base.h:114
TMappingMatrixType & GetMappingMatrix() override
This method returns the mapping-matrix.
Definition: interpolative_mapper_base.h:223
~InterpolativeMapperBase() override=default
Destructor.
Mapper< TSparseSpace, TDenseSpace > BaseType
Definition: interpolative_mapper_base.h:89
InterfaceCommunicator::MapperInterfaceInfoUniquePointerType MapperInterfaceInfoUniquePointerType
Definition: interpolative_mapper_base.h:93
std::vector< MapperLocalSystemPointer > MapperLocalSystemPointerVector
Definition: interpolative_mapper_base.h:96
InterfaceVectorContainer< TSparseSpace, TDenseSpace > InterfaceVectorContainerType
Definition: interpolative_mapper_base.h:98
void UpdateInterface(Kratos::Flags MappingOptions, double SearchRadius) override
Updates the mapping-system after the geometry/mesh has changed After changes in the topology (e....
Definition: interpolative_mapper_base.h:137
static const TComponentType & Get(const std::string &rName)
Retrieves a component with the specified name.
Definition: kratos_components.h:114
Base Class for all Mappers.
Definition: mapper.h:43
TSparseSpace::MatrixType TMappingMatrixType
Definition: mapper.h:55
Kratos::unique_ptr< Mapper > MapperUniquePointerType
Definition: mapper.h:53
static void BuildMappingMatrix(Kratos::unique_ptr< typename TSparseSpace::MatrixType > &rpMappingMatrix, Kratos::unique_ptr< typename TSparseSpace::VectorType > &rpInterfaceVectorOrigin, Kratos::unique_ptr< typename TSparseSpace::VectorType > &rpInterfaceVectorDestination, const ModelPart &rModelPartOrigin, const ModelPart &rModelPartDestination, std::vector< Kratos::unique_ptr< MapperLocalSystem >> &rMapperLocalSystems, const int EchoLevel)
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
std::string FullName() const
This method returns the full name of the model part (including the parents model parts)
Definition: model_part.h:1850
Communicator & GetCommunicator()
Definition: model_part.h:1821
NodesContainerType & Nodes(IndexType ThisIndex=0)
Definition: model_part.h:507
This class defines the node.
Definition: node.h:65
This class provides to Kratos a data structure for I/O based on the standard of JSON.
Definition: kratos_parameters.h:59
int GetInt() const
This method returns the integer contained in the current Parameter.
Definition: kratos_parameters.cpp:666
void AddValue(const std::string &rEntry, const Parameters &rOtherValue)
This method sets a non-existing parameter with a given parameter.
Definition: kratos_parameters.cpp:455
bool GetBool() const
This method returns the boolean contained in the current Parameter.
Definition: kratos_parameters.cpp:675
utility function to do a sum reduction
Definition: reduction_utilities.h:68
This class implements a set of auxiliar, already parallelized, methods to perform some common tasks r...
Definition: variable_utils.h:63
void SetNonHistoricalVariable(const TVarType &rVariable, const TType &Value, TContainerType &rContainer)
Sets the container value of any type of non historical variable.
Definition: variable_utils.h:790
void UpdateCurrentToInitialConfiguration(const ModelPart::NodesContainerType &rNodes)
This method updates the current nodal coordinates back to the initial coordinates.
Definition: variable_utils.cpp:245
VtkOutput A simple class that has functionality to write vtk output.
Definition: vtk_output.h:35
void PrintOutput(const std::string &rOutputFilename="")
Prints mrModelPart in VTK format together with the results.
Definition: vtk_output.cpp:167
#define KRATOS_CATCH(MoreInfo)
Definition: define.h:110
#define KRATOS_TRY
Definition: define.h:109
#define KRATOS_ERROR_IF(conditional)
Definition: exception.h:162
#define KRATOS_INFO(label)
Definition: logger.h:250
#define KRATOS_WARNING_ALL_RANKS(label)
Definition: logger.h:275
#define KRATOS_WARNING_IF(label, conditional)
Definition: logger.h:266
#define KRATOS_WARNING(label)
Definition: logger.h:265
static int EchoLevel
Definition: co_sim_EMPIRE_API.h:42
void SaveCurrentConfiguration(ModelPart &rModelPart)
Definition: mapper_utilities.cpp:280
std::vector< MapperLocalSystemPointer > MapperLocalSystemPointerVector
Definition: mapper_utilities.h:46
void AssignInterfaceEquationIds(Communicator &rModelPartCommunicator)
Assigning INTERFACE_EQUATION_IDs to the nodes, with and without MPI This function assigns the INTERFA...
Definition: mapper_utilities.cpp:34
void RestoreCurrentConfiguration(ModelPart &rModelPart)
Definition: mapper_utilities.cpp:291
Kratos::unique_ptr< MapperInterfaceInfo > MapperInterfaceInfoUniquePointerType
Definition: mapper_utilities.h:40
void CheckInterfaceModelParts(const int CommRank)
Definition: mapper_utilities.cpp:120
bool Has(const std::string &ModelerName)
Checks if the modeler is registered.
Definition: modeler_factory.cpp:24
void TransposeMult(SparseSpaceType &dummy, SparseSpaceType::MatrixType &rA, SparseSpaceType::VectorType &rX, SparseSpaceType::VectorType &rY)
Definition: add_strategies_to_python.cpp:104
void Mult(TSpaceType &dummy, typename TSpaceType::MatrixType &rA, typename TSpaceType::VectorType &rX, typename TSpaceType::VectorType &rY)
Definition: add_strategies_to_python.cpp:98
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
void block_for_each(TIterator itBegin, TIterator itEnd, TFunction &&rFunction)
Execute a functor on all items of a range in parallel.
Definition: parallel_utilities.h:299
std::unique_ptr< T > unique_ptr
Definition: smart_pointers.h:33
echo_level
Definition: script.py:68
string file_name
Definition: sp_statistics.py:6
Definition: reduction_utilities.h:310