49 :
MapperInterfaceInfo(rCoordinates, SourceLocalSystemIndex, SourceRank), mOptions(Options) {}
51 MapperInterfaceInfo::Pointer
Create()
const override
53 return Kratos::make_shared<NearestElementInterfaceInfo>(mOptions);
58 const IndexType SourceRank)
const override
60 return Kratos::make_shared<NearestElementInterfaceInfo>(
62 SourceLocalSystemIndex,
72 void ProcessSearchResult(
const InterfaceObject& rInterfaceObject)
override;
74 void ProcessSearchResultForApproximation(
const InterfaceObject& rInterfaceObject)
override;
77 const InfoType ValueType)
const override
83 const InfoType ValueType)
const override
85 rValue = mShapeFunctionValues;
89 const InfoType ValueType)
const override
91 rValue = mClosestProjectionDistance;
95 const InfoType ValueType)
const override
97 rValue = (
int)mPairingIndex;
104 std::vector<int> mNodeIds;
105 std::vector<double> mShapeFunctionValues;
109 std::size_t mNumSearchResults = 0;
112 const bool ComputeApproximation);
116 void save(
Serializer& rSerializer)
const override
119 rSerializer.
save(
"NodeIds", mNodeIds);
120 rSerializer.
save(
"SFValues", mShapeFunctionValues);
121 rSerializer.
save(
"ClosestProjectionDistance", mClosestProjectionDistance);
122 rSerializer.
save(
"PairingIndex", (
int)mPairingIndex);
123 rSerializer.
save(
"NumSearchResults", mNumSearchResults);
129 rSerializer.
load(
"NodeIds", mNodeIds);
130 rSerializer.
load(
"SFValues", mShapeFunctionValues);
131 rSerializer.
load(
"ClosestProjectionDistance", mClosestProjectionDistance);
133 rSerializer.
load(
"PairingIndex",
temp);
135 rSerializer.
load(
"NumSearchResults", mNumSearchResults);
146 void CalculateAll(
MatrixType& rLocalMappingMatrix,
147 EquationIdVectorType& rOriginIds,
148 EquationIdVectorType& rDestinationIds,
154 return mpNode->Coordinates();
159 return Kratos::make_unique<NearestElementLocalSystem>(pNode);
162 void PairingInfo(std::ostream& rOStream,
const int EchoLevel)
const override;
164 void SetPairingStatusForPrinting()
override;
166 bool IsDoneSearching()
const override;
183 template<
class TSparseSpace,
class TDenseSpace,
class TMapperBackend>
205 :
BaseType(rModelPartOrigin,rModelPartDestination) {}
211 rModelPartDestination,
216 this->ValidateInput();
218 const bool use_approximation = JsonParameters[
"use_approximation"].
GetBool();
219 const double local_coord_tol = JsonParameters[
"local_coord_tolerance"].
GetDouble();
220 KRATOS_ERROR_IF(local_coord_tol < 0.0) <<
"The local-coord-tolerance cannot be negative" << std::endl;
242 return Kratos::make_unique<NearestElementMapper<TSparseSpace, TDenseSpace, TMapperBackend>>(
244 rModelPartDestination,
259 std::string
Info()
const override
261 return "NearestElementMapper";
267 rOStream <<
"NearestElementMapper";
273 BaseType::PrintData(rOStream);
287 void CreateMapperLocalSystems(
293 rModelPartCommunicator,
299 return Kratos::make_unique<NearestElementInterfaceInfo>(mOptions);
302 Parameters GetMapperDefaultSettings()
const override
304 return Parameters( R
"({
305 "search_settings" : {},
306 "local_coord_tolerance" : 0.25,
307 "use_approximation" : true,
308 "use_initial_configuration" : false,
310 "print_pairing_status_to_file" : false,
311 "pairing_status_file_path" : ""
The Commmunicator class manages communication for distributed ModelPart instances.
Definition: communicator.h:67
Object used by the bin-search.
Definition: interface_object.h:40
ConstructionType
Definition: interface_object.h:63
Definition: interpolative_mapper_base.h:81
Base Class for all Mappers.
Definition: mapper.h:43
Kratos::unique_ptr< Mapper > MapperUniquePointerType
Definition: mapper.h:53
Object for storing data that is needed to construct the local-mapping-system.
Definition: mapper_interface_info.h:42
InfoType
Definition: mapper_interface_info.h:62
std::size_t IndexType
Definition: mapper_interface_info.h:50
InterfaceObject::CoordinatesArrayType CoordinatesArrayType
Definition: mapper_interface_info.h:52
This is the "Condition" of the mappers.
Definition: mapper_local_system.h:39
PairingStatus
Definition: mapper_local_system.h:63
MapperInterfaceInfo::CoordinatesArrayType CoordinatesArrayType
Definition: mapper_local_system.h:50
Kratos::unique_ptr< MapperLocalSystem > MapperLocalSystemUniquePointer
Definition: mapper_local_system.h:48
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
Definition: nearest_element_mapper.h:39
NearestElementInterfaceInfo(const CoordinatesArrayType &rCoordinates, const IndexType SourceLocalSystemIndex, const IndexType SourceRank, const NearestElementOptions Options={})
Definition: nearest_element_mapper.h:45
void GetValue(int &rValue, const InfoType ValueType) const override
Definition: nearest_element_mapper.h:94
std::size_t GetNumSearchResults() const
Definition: nearest_element_mapper.h:100
InterfaceObject::ConstructionType GetInterfaceObjectType() const override
returning the type of construction for the InterfaceObject The returned type is used to create the ob...
Definition: nearest_element_mapper.h:67
void GetValue(double &rValue, const InfoType ValueType) const override
Definition: nearest_element_mapper.h:88
MapperInterfaceInfo::Pointer Create(const CoordinatesArrayType &rCoordinates, const IndexType SourceLocalSystemIndex, const IndexType SourceRank) const override
Definition: nearest_element_mapper.h:56
NearestElementInterfaceInfo(const NearestElementOptions Options={})
Default constructor.
Definition: nearest_element_mapper.h:43
void GetValue(std::vector< int > &rValue, const InfoType ValueType) const override
Definition: nearest_element_mapper.h:76
void GetValue(std::vector< double > &rValue, const InfoType ValueType) const override
Definition: nearest_element_mapper.h:82
MapperInterfaceInfo::Pointer Create() const override
Definition: nearest_element_mapper.h:51
Definition: nearest_element_mapper.h:141
NearestElementLocalSystem(NodePointerType pNode)
Definition: nearest_element_mapper.h:144
CoordinatesArrayType & Coordinates() const override
Definition: nearest_element_mapper.h:151
MapperLocalSystemUniquePointer Create(NodePointerType pNode) const override
Definition: nearest_element_mapper.h:157
Interpolative Mapper.
Definition: nearest_element_mapper.h:186
NearestElementMapper(ModelPart &rModelPartOrigin, ModelPart &rModelPartDestination)
Definition: nearest_element_mapper.h:203
BaseType::MapperInterfaceInfoUniquePointerType MapperInterfaceInfoUniquePointerType
Definition: nearest_element_mapper.h:196
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: nearest_element_mapper.h:271
~NearestElementMapper() override=default
Destructor.
MapperUniquePointerType Clone(ModelPart &rModelPartOrigin, ModelPart &rModelPartDestination, Parameters JsonParameters) const override
Cloning the Mapper returns a clone of the current Mapper pure virtual, has to be implemented in every...
Definition: nearest_element_mapper.h:236
KRATOS_CLASS_POINTER_DEFINITION(NearestElementMapper)
Pointer definition of NearestElementMapper.
BaseType::MapperUniquePointerType MapperUniquePointerType
Definition: nearest_element_mapper.h:195
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: nearest_element_mapper.h:265
InterpolativeMapperBase< TSparseSpace, TDenseSpace, TMapperBackend > BaseType
Definition: nearest_element_mapper.h:194
NearestElementMapper(ModelPart &rModelPartOrigin, ModelPart &rModelPartDestination, Parameters JsonParameters)
Definition: nearest_element_mapper.h:207
std::string Info() const override
Turn back information as a string.
Definition: nearest_element_mapper.h:259
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
double GetDouble() const
This method returns the double contained in the current Parameter.
Definition: kratos_parameters.cpp:657
bool GetBool() const
This method returns the boolean contained in the current Parameter.
Definition: kratos_parameters.cpp:675
The serialization consists in storing the state of an object into a storage format like data file or ...
Definition: serializer.h:123
void load(std::string const &rTag, TDataType &rObject)
Definition: serializer.h:207
void save(std::string const &rTag, std::array< TDataType, TDataSize > const &rObject)
Definition: serializer.h:545
#define KRATOS_SERIALIZE_SAVE_BASE_CLASS(Serializer, BaseType)
Definition: define.h:812
#define KRATOS_CATCH(MoreInfo)
Definition: define.h:110
#define KRATOS_TRY
Definition: define.h:109
#define KRATOS_SERIALIZE_LOAD_BASE_CLASS(Serializer, BaseType)
Definition: define.h:815
#define KRATOS_ERROR_IF(conditional)
Definition: exception.h:162
#define KRATOS_DEBUG_ERROR_IF_NOT(conditional)
Definition: exception.h:172
static int EchoLevel
Definition: co_sim_EMPIRE_API.h:42
static double max(double a, double b)
Definition: GeometryFunctions.h:79
void CreateMapperLocalSystemsFromNodes(const MapperLocalSystem &rMapperLocalSystemPrototype, const Communicator &rModelPartCommunicator, std::vector< Kratos::unique_ptr< MapperLocalSystem >> &rLocalSystems)
Definition: mapper_utilities.cpp:236
Kratos::unique_ptr< MapperInterfaceInfo > MapperInterfaceInfoUniquePointerType
Definition: mapper_utilities.h:40
NodeType::Pointer NodePointerType
Definition: mapping_intersection_utilities.h:36
PairingIndex
Definition: projection_utilities.h:32
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
REACTION_CHECK_STIFFNESS_FACTOR int
Definition: contact_structural_mechanics_application_variables.h:75
def load(f)
Definition: ode_solve.py:307
float temp
Definition: rotating_cone.py:85
Options for configuring the behavior of the Mapper.
Definition: nearest_element_mapper.h:33
bool UseApproximation
Definition: nearest_element_mapper.h:34
double LocalCoordTol
Definition: nearest_element_mapper.h:35