33 namespace MapperUtilities {
68 if (rMappingOptions.
Is(MapperFlags::FROM_NON_HISTORICAL))
94 rNode.
GetValue(rVariable) = Value * Factor;
102 rNode.
GetValue(rVariable) += Value * Factor;
108 if (rMappingOptions.
Is(MapperFlags::ADD_VALUES) && rMappingOptions.
Is(MapperFlags::TO_NON_HISTORICAL))
110 if (rMappingOptions.
Is(MapperFlags::ADD_VALUES))
112 if (rMappingOptions.
Is(MapperFlags::TO_NON_HISTORICAL))
117 template<
class TVectorType,
bool TParallel=true>
119 TVectorType& rVector,
123 const bool InParallel=
true)
141 fill_fct(*(nodes_begin +
i), rVariable, rVector[
i]);
147 template<
class TVectorType>
149 const TVectorType& rVector,
153 const bool InParallel=
true)
159 const double factor = rMappingOptions.
Is(MapperFlags::SWAP_SIGN) ? -1.0 : 1.0;
163 std::placeholders::_1,
164 std::placeholders::_2,
165 std::placeholders::_3,
176 update_fct(*(nodes_begin +
i), rVariable, rVector[
i]);
179 if (rMappingOptions.
Is(MapperFlags::TO_NON_HISTORICAL)) {
206 template <
class T1,
class T2>
210 return std::sqrt( std::pow(rCoords1[0] - rCoords2[0] , 2) +
211 std::pow(rCoords1[1] - rCoords2[1] , 2) +
212 std::pow(rCoords1[2] - rCoords2[2] , 2) );
215 template <
class T1,
class T2,
class T3>
226 const double s = (
a+
b+
c) / 2.0;
228 return (std::sqrt(s*(s-
a)*(s-
b)*(s-
c))) < 1
e-12;
231 template <
typename TContainer>
249 template<
class TDataType>
255 rNode.GetData().Erase(rVariable);
262 const std::vector<double>& rBoundingBoxes,
264 std::vector<std::vector<double>>& rSendBuffer,
265 std::vector<int>& rSendSizes);
275 std::vector<std::vector<char>>& rSendBuffer,
276 std::vector<int>& rSendSizes);
282 const std::vector<std::vector<char>>& rSendBuffer,
304 : mrInterfaceInfos(rMapperInterfaceInfosContainer)
305 , mrpRefInterfaceInfo(rpRefInterfaceInfo->
Create())
310 std::vector<MapperInterfaceInfoPointerType>& mrInterfaceInfos;
The Commmunicator class manages communication for distributed ModelPart instances.
Definition: communicator.h:67
virtual bool SynchronizeNonHistoricalVariable(Variable< int > const &rThisVariable)
Definition: communicator.cpp:407
virtual bool SynchronizeVariable(Variable< int > const &rThisVariable)
Definition: communicator.cpp:357
virtual const DataCommunicator & GetDataCommunicator() const
Definition: communicator.cpp:340
MeshType & LocalMesh()
Returns the reference to the mesh storing all local entities.
Definition: communicator.cpp:245
virtual bool IsDefinedOnThisRank() const
Check whether this DataCommunicator involves the current rank.
Definition: data_communicator.h:616
bool Is(Flags const &rOther) const
Definition: flags.h:274
This class is useful for index iteration over containers.
Definition: parallel_utilities.h:451
void for_each(TUnaryFunction &&f)
Definition: parallel_utilities.h:514
This is the "Condition" of the mappers.
Definition: mapper_local_system.h:39
Helper class to serialize/deserialize a vector containing MapperInterfaceInfos.
Definition: mapper_utilities.h:299
MapperInterfaceInfoSerializer(std::vector< MapperInterfaceInfoPointerType > &rMapperInterfaceInfosContainer, const MapperInterfaceInfoUniquePointerType &rpRefInterfaceInfo)
Definition: mapper_utilities.h:302
static double Norm3(const TVectorType &a)
Calculates the norm of vector "a" which is assumed to be of size 3.
Definition: math_utils.h:691
SizeType NumberOfNodes() const
Definition: mesh.h:259
NodeIterator NodesBegin()
Definition: mesh.h:326
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
bool HasNodalSolutionStepVariable(VariableData const &ThisVariable) const
Definition: model_part.h:544
NodesContainerType & Nodes(IndexType ThisIndex=0)
Definition: model_part.h:507
This class defines the node.
Definition: node.h:65
TVariableType::Type & FastGetSolutionStepValue(const TVariableType &rThisVariable)
Definition: node.h:435
TVariableType::Type & GetValue(const TVariableType &rThisVariable)
Definition: node.h:466
static int GetNumThreads()
Returns the current number of threads.
Definition: parallel_utilities.cpp:34
The serialization consists in storing the state of an object into a storage format like data file or ...
Definition: serializer.h:123
void save(std::string const &rTag, std::array< TDataType, TDataSize > const &rObject)
Definition: serializer.h:545
const std::string & Name() const
Definition: variable_data.h:201
#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_API(...)
Definition: kratos_export_api.h:40
static int EchoLevel
Definition: co_sim_EMPIRE_API.h:42
void DeserializeMapperInterfaceInfosFromBuffer(const std::vector< std::vector< char >> &rRecvBuffer, const MapperInterfaceInfoUniquePointerType &rpRefInterfaceInfo, const int CommRank, MapperInterfaceInfoPointerVectorType &rMapperInterfaceInfosContainer)
Definition: mapper_utilities.cpp:437
void SaveCurrentConfiguration(ModelPart &rModelPart)
Definition: mapper_utilities.cpp:280
static std::function< void(NodeType &, const Variable< double > &, const double, const double)> GetUpdateFunction(const Kratos::Flags &rMappingOptions)
Definition: mapper_utilities.h:106
std::vector< std::vector< MapperInterfaceInfoPointerType > > MapperInterfaceInfoPointerVectorType
Definition: mapper_utilities.h:43
bool PointsAreCollinear(const T1 &rP1, const T2 &rP2, const T3 &rP3)
Definition: mapper_utilities.h:216
void AssignInterfaceInfosAfterRemoteSearch(const MapperInterfaceInfoPointerVectorType &rMapperInterfaceInfosContainer, MapperLocalSystemPointerVectorPointer &rpMapperLocalSystems)
void UpdateModelPartFromSystemVector(const TVectorType &rVector, ModelPart &rModelPart, const Variable< double > &rVariable, const Kratos::Flags &rMappingOptions, const bool InParallel=true)
Definition: mapper_utilities.h:148
static void FillFunction(const NodeType &rNode, const Variable< double > &rVariable, double &rValue)
Definition: mapper_utilities.h:51
static void UpdateFunctionNonHist(NodeType &rNode, const Variable< double > &rVariable, const double Value, const double Factor)
Definition: mapper_utilities.h:89
std::vector< MapperLocalSystemPointer > MapperLocalSystemPointerVector
Definition: mapper_utilities.h:46
Kratos::shared_ptr< MapperInterfaceInfo > MapperInterfaceInfoPointerType
Definition: mapper_utilities.h:42
Kratos::shared_ptr< MapperLocalSystemPointerVector > MapperLocalSystemPointerVectorPointer
Definition: mapper_utilities.h:47
double ComputeMaxEdgeLengthLocal(const TContainer &rEntityContainer)
Definition: mapper_utilities.cpp:55
void FillBufferBeforeLocalSearch(const MapperLocalSystemPointerVector &rMapperLocalSystems, const std::vector< double > &rBoundingBoxes, const SizeType BufferSizeEstimate, std::vector< std::vector< double >> &rSendBuffer, std::vector< int > &rSendSizes)
Definition: mapper_utilities.cpp:308
static void UpdateFunctionWithAdd(NodeType &rNode, const Variable< double > &rVariable, const double Value, const double Factor)
Definition: mapper_utilities.h:81
std::array< double, 6 > BoundingBoxType
Definition: mapper_utilities.h:49
static void UpdateFunctionNonHistWithAdd(NodeType &rNode, const Variable< double > &rVariable, const double Value, const double Factor)
Definition: mapper_utilities.h:97
void CreateMapperLocalSystemsFromGeometries(const MapperLocalSystem &rMapperLocalSystemPrototype, const Communicator &rModelPartCommunicator, std::vector< Kratos::unique_ptr< MapperLocalSystem >> &rLocalSystems)
Definition: mapper_utilities.cpp:259
BoundingBoxType ComputeGlobalBoundingBox(const ModelPart &rModelPart)
Definition: mapper_utilities.cpp:193
static std::function< void(const NodeType &, const Variable< double > &, double &)> GetFillFunction(const Kratos::Flags &rMappingOptions)
Definition: mapper_utilities.h:66
Kratos::unique_ptr< MapperLocalSystem > MapperLocalSystemPointer
Definition: mapper_utilities.h:45
void FillBufferAfterLocalSearch(MapperInterfaceInfoPointerVectorType &rMapperInterfaceInfosContainer, const MapperInterfaceInfoUniquePointerType &rpRefInterfaceInfo, const int CommRank, std::vector< std::vector< char >> &rSendBuffer, std::vector< int > &rSendSizes)
Definition: mapper_utilities.cpp:399
BoundingBoxType ComputeLocalBoundingBox(const ModelPart &rModelPart)
Definition: mapper_utilities.cpp:176
void CreateMapperLocalSystemsFromNodes(const MapperLocalSystem &rMapperLocalSystemPrototype, const Communicator &rModelPartCommunicator, std::vector< Kratos::unique_ptr< MapperLocalSystem >> &rLocalSystems)
Definition: mapper_utilities.cpp:236
double ComputeDistance(const T1 &rCoords1, const T2 &rCoords2)
Definition: mapper_utilities.h:207
static void UpdateFunction(NodeType &rNode, const Variable< double > &rVariable, const double Value, const double Factor)
Definition: mapper_utilities.h:73
void UpdateSystemVectorFromModelPart(TVectorType &rVector, const ModelPart &rModelPart, const Variable< double > &rVariable, const Kratos::Flags &rMappingOptions, const bool InParallel=true)
Definition: mapper_utilities.h:118
std::size_t SizeType
Definition: mapper_utilities.cpp:31
static void FillFunctionNonHist(const NodeType &rNode, const Variable< double > &rVariable, double &rValue)
Definition: mapper_utilities.h:58
Node NodeType
Definition: mapper_utilities.h:38
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
std::string BoundingBoxStringStream(const BoundingBoxType &rBoundingBox)
Definition: mapper_utilities.cpp:223
void CreateMapperInterfaceInfosFromBuffer(const std::vector< std::vector< double >> &rRecvBuffer, const MapperInterfaceInfoUniquePointerType &rpRefInterfaceInfo, const int CommRank, MapperInterfaceInfoPointerVectorType &rMapperInterfaceInfosContainer)
Definition: mapper_utilities.cpp:349
void CheckInterfaceModelParts(const int CommRank)
Definition: mapper_utilities.cpp:120
void EraseNodalVariable(ModelPart &rModelPart, const Variable< TDataType > &rVariable)
Definition: mapper_utilities.h:250
std::size_t IndexType
Definition: mapper_utilities.cpp:32
double ComputeSearchRadius(const ModelPart &rModelPart, const int EchoLevel)
Definition: mapper_utilities.cpp:69
Modeler::Pointer Create(const std::string &ModelerName, Model &rModel, const Parameters ModelParameters)
Checks if the modeler is registered.
Definition: modeler_factory.cpp:30
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::shared_ptr< T > shared_ptr
Definition: smart_pointers.h:27
std::unique_ptr< T > unique_ptr
Definition: smart_pointers.h:33
std::size_t SizeType
The definition of the size type.
Definition: mortar_classes.h:43
a
Definition: generate_stokes_twofluid_element.py:77
b
Definition: generate_total_lagrangian_mixed_volumetric_strain_element.py:31
c
Definition: generate_weakly_compressible_navier_stokes_element.py:108
def load(f)
Definition: ode_solve.py:307
def num_threads
Definition: script.py:75
integer i
Definition: TensorModule.f:17
e
Definition: run_cpp_mpi_tests.py:31
float factor
for node in (self.combined_model_part).Nodes: pold = node.GetSolutionStepValue(PRESSURE,...
Definition: ulf_PGLASS.py:254