42 MapperInterfaceInfo::Pointer
Create()
const override
44 return Kratos::make_shared<NearestNeighborInterfaceInfo>();
49 const IndexType SourceRank)
const override
51 return Kratos::make_shared<NearestNeighborInterfaceInfo>(
53 SourceLocalSystemIndex,
62 void ProcessSearchResult(
const InterfaceObject& rInterfaceObject)
override;
65 const InfoType ValueType)
const override
67 rValue = mNearestNeighborId;
71 const InfoType ValueType)
const override
73 rValue = mNearestNeighborDistance;
78 std::vector<int> mNearestNeighborId = {};
83 void save(
Serializer& rSerializer)
const override
86 rSerializer.
save(
"NearestNeighborId", mNearestNeighborId);
87 rSerializer.
save(
"NearestNeighborDistance", mNearestNeighborDistance);
93 rSerializer.
load(
"NearestNeighborId", mNearestNeighborId);
94 rSerializer.
load(
"NearestNeighborDistance", mNearestNeighborDistance);
104 void CalculateAll(
MatrixType& rLocalMappingMatrix,
105 EquationIdVectorType& rOriginIds,
106 EquationIdVectorType& rDestinationIds,
112 return mpNode->Coordinates();
117 return Kratos::make_unique<NearestNeighborLocalSystem>(pNode);
120 void PairingInfo(std::ostream& rOStream,
const int EchoLevel)
const override;
122 void SetPairingStatusForPrinting()
override;
136 template<
class TSparseSpace,
class TDenseSpace,
class TMapperBackend>
161 :
BaseType(rModelPartOrigin, rModelPartDestination) {}
167 rModelPartDestination,
172 auto check_has_nodes = [](
const ModelPart& rModelPart){
173 if (rModelPart.GetCommunicator().GetDataCommunicator().IsDefinedOnThisRank()) {
174 KRATOS_ERROR_IF(rModelPart.GetCommunicator().GlobalNumberOfNodes() == 0) <<
"No nodes exist in ModelPart \"" << rModelPart.FullName() <<
"\"" << std::endl;
177 check_has_nodes(rModelPartOrigin);
178 check_has_nodes(rModelPartDestination);
180 this->ValidateInput();
199 return Kratos::make_unique<NearestNeighborMapper<TSparseSpace, TDenseSpace, TMapperBackend>>(
201 rModelPartDestination,
213 KRATOS_WARNING_ONCE(
"Mapper") <<
"Developer-warning: \"AreMeshesConforming\" is deprecated and will be removed in the future" << std::endl;
214 return BaseType::mMeshesAreConforming;
222 std::string
Info()
const override
224 return "NearestNeighborMapper";
230 rOStream <<
"NearestNeighborMapper";
236 BaseType::PrintData(rOStream);
244 void CreateMapperLocalSystems(
250 rModelPartCommunicator,
256 return Kratos::make_unique<NearestNeighborInterfaceInfo>();
259 Parameters GetMapperDefaultSettings()
const override
261 return Parameters( R
"({
262 "search_settings" : {},
263 "use_initial_configuration" : false,
265 "print_pairing_status_to_file" : false,
266 "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_neighbor_mapper.h:31
InterfaceObject::ConstructionType GetInterfaceObjectType() const override
returning the type of construction for the InterfaceObject The returned type is used to create the ob...
Definition: nearest_neighbor_mapper.h:57
MapperInterfaceInfo::Pointer Create() const override
Definition: nearest_neighbor_mapper.h:42
NearestNeighborInterfaceInfo(const CoordinatesArrayType &rCoordinates, const IndexType SourceLocalSystemIndex, const IndexType SourceRank)
Definition: nearest_neighbor_mapper.h:37
void GetValue(std::vector< int > &rValue, const InfoType ValueType) const override
Definition: nearest_neighbor_mapper.h:64
MapperInterfaceInfo::Pointer Create(const CoordinatesArrayType &rCoordinates, const IndexType SourceLocalSystemIndex, const IndexType SourceRank) const override
Definition: nearest_neighbor_mapper.h:47
void GetValue(double &rValue, const InfoType ValueType) const override
Definition: nearest_neighbor_mapper.h:70
NearestNeighborInterfaceInfo()
Default constructor.
Definition: nearest_neighbor_mapper.h:35
Definition: nearest_neighbor_mapper.h:99
NearestNeighborLocalSystem(NodePointerType pNode)
Definition: nearest_neighbor_mapper.h:102
CoordinatesArrayType & Coordinates() const override
Definition: nearest_neighbor_mapper.h:109
MapperLocalSystemUniquePointer Create(NodePointerType pNode) const override
Definition: nearest_neighbor_mapper.h:115
Nearest Neighbor Mapper.
Definition: nearest_neighbor_mapper.h:139
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_neighbor_mapper.h:193
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: nearest_neighbor_mapper.h:228
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: nearest_neighbor_mapper.h:234
InterpolativeMapperBase< TSparseSpace, TDenseSpace, TMapperBackend > BaseType
Definition: nearest_neighbor_mapper.h:150
BaseType::MapperInterfaceInfoUniquePointerType MapperInterfaceInfoUniquePointerType
Definition: nearest_neighbor_mapper.h:152
std::string Info() const override
Turn back information as a string.
Definition: nearest_neighbor_mapper.h:222
int AreMeshesConforming() const override
Quering for mesh conformity This function is deprecated and will eventually be removed,...
Definition: nearest_neighbor_mapper.h:211
BaseType::MapperUniquePointerType MapperUniquePointerType
Definition: nearest_neighbor_mapper.h:151
NearestNeighborMapper(ModelPart &rModelPartOrigin, ModelPart &rModelPartDestination)
Definition: nearest_neighbor_mapper.h:159
NearestNeighborMapper(ModelPart &rModelPartOrigin, ModelPart &rModelPartDestination, Parameters JsonParameters)
Definition: nearest_neighbor_mapper.h:163
~NearestNeighborMapper() override=default
Destructor.
KRATOS_CLASS_POINTER_DEFINITION(NearestNeighborMapper)
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
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
#define KRATOS_WARNING_ONCE(label)
Definition: logger.h:271
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
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
def load(f)
Definition: ode_solve.py:307