preCICE v3.1.1
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
precice::mapping::NearestNeighborBaseMapping Class Reference

#include <NearestNeighborBaseMapping.hpp>

Inheritance diagram for precice::mapping::NearestNeighborBaseMapping:
[legend]
Collaboration diagram for precice::mapping::NearestNeighborBaseMapping:
[legend]

Public Member Functions

 NearestNeighborBaseMapping (Constraint constraint, int dimensions, bool hasGradient, std::string mappingName, std::string mappingNameShort)
 Constructor.
 
void computeMapping () final override
 Computes the mapping coefficients from the in- and output mesh.
 
void clear () final override
 Removes a computed mapping.
 
virtual void onMappingComputed (mesh::PtrMesh origins, mesh::PtrMesh searchSpace)
 
void tagMeshFirstRound () final override
 Method used by partition. Tags vertices that could be owned by this rank.
 
void tagMeshSecondRound () final override
 Method used by partition. Tags vertices that can be filtered out.
 
- Public Member Functions inherited from precice::mapping::Mapping
 Mapping (Constraint constraint, int dimensions, bool requiresGradientData, InitialGuessRequirement initialGuessRequirement)
 Constructor, takes mapping constraint.
 
Mappingoperator= (Mapping &&)=delete
 
virtual ~Mapping ()=default
 Destructor, empty.
 
void setMeshes (const mesh::PtrMesh &input, const mesh::PtrMesh &output)
 Sets input and output meshes carrying data to be mapped.
 
const mesh::PtrMeshgetInputMesh () const
 
const mesh::PtrMeshgetOutputMesh () const
 
Constraint getConstraint () const
 Returns the constraint (consistent/conservative) of the mapping.
 
MeshRequirement getInputRequirement () const
 Returns the requirement on the input mesh.
 
MeshRequirement getOutputRequirement () const
 Returns the requirement on the output mesh.
 
bool hasComputedMapping () const
 Returns true, if the mapping has been computed.
 
virtual bool hasConstraint (const Constraint &constraint) const
 Checks whether the mapping has the given constraint or not.
 
bool isScaledConsistent () const
 Returns true if mapping is a form of scaled consistent mapping.
 
bool requiresInitialGuess () const
 Return true if the mapping requires an initial guess.
 
const Eigen::VectorXd & initialGuess () const
 Return the provided initial guess of a mapping using an initialGuess.
 
Eigen::VectorXd & initialGuess ()
 
bool hasInitialGuess () const
 True if initialGuess().size() == 0.
 
void map (int inputDataID, int outputDataID)
 
void map (int inputDataID, int outputDataID, Eigen::VectorXd &initialGuess)
 
void map (const time::Sample &input, Eigen::VectorXd &output)
 Maps an input Sample to output data from input mesh to output mesh.
 
void map (const time::Sample &input, Eigen::VectorXd &output, Eigen::VectorXd &initialGuess)
 Maps an input Sample to output data from input mesh to output mesh, given an initialGuess.
 
virtual void scaleConsistentMapping (const Eigen::VectorXd &input, Eigen::VectorXd &output, Constraint type) const
 Scales the consistently mapped output data such that the surface integral of the values on input mesh and output mesh are equal.
 
bool requiresGradientData () const
 Returns whether the mapping requires gradient data.
 
virtual std::string getName () const =0
 Returns the name of the mapping method for logging purpose.
 

Protected Attributes

std::string mappingName
 NearestNeighborMapping or NearestNeighborGradientMapping.
 
std::string mappingNameShort
 nn or nng
 
logging::Logger _log {"mapping::" + mappingName}
 
std::vector< Eigen::VectorXd > _offsetsMatched
 
std::vector< int > _vertexIndices
 Computed output vertex indices to map data from input vertices to.
 
- Protected Attributes inherited from precice::mapping::Mapping
bool _hasComputedMapping = false
 Flag to indicate whether computeMapping() has been called.
 
bool _requiresGradientData
 Flag if gradient data is required for the mapping.
 

Additional Inherited Members

- Public Types inherited from precice::mapping::Mapping
enum  Constraint { CONSISTENT , CONSERVATIVE , SCALED_CONSISTENT_SURFACE , SCALED_CONSISTENT_VOLUME }
 Specifies additional constraints for a mapping. More...
 
enum class  MeshRequirement { UNDEFINED = 0 , VERTEX = 1 , FULL = 2 }
 Specifies requirements for the input and output meshes of a mapping. More...
 
enum class  InitialGuessRequirement : bool { Required = true , None = false }
 Specifies whether the mapping requires an initial guess. More...
 
- Protected Member Functions inherited from precice::mapping::Mapping
mesh::PtrMesh input () const
 Returns pointer to input mesh.
 
mesh::PtrMesh output () const
 Returns pointer to output mesh.
 
void setInputRequirement (MeshRequirement requirement)
 Sets the mesh requirement for the input mesh.
 
void setOutputRequirement (MeshRequirement requirement)
 Sets the mesh requirement for the output mesh.
 
int getDimensions () const
 
virtual void mapConservative (const time::Sample &input, Eigen::VectorXd &output)=0
 Maps data using a conservative constraint.
 
virtual void mapConsistent (const time::Sample &input, Eigen::VectorXd &output)=0
 Maps data using a consistent constraint.
 

Detailed Description

Mapping using nearest neighboring vertices and (eventually) their local gradient values. Base class for Nearest Neighbor Mapping and Nearest Neighbor Gradient

Definition at line 13 of file NearestNeighborBaseMapping.hpp.

Constructor & Destructor Documentation

◆ NearestNeighborBaseMapping()

precice::mapping::NearestNeighborBaseMapping::NearestNeighborBaseMapping ( Constraint constraint,
int dimensions,
bool hasGradient,
std::string mappingName,
std::string mappingNameShort )

Constructor.

Parameters
[in]constraintSpecifies mapping to be consistent or conservative.
[in]dimensionsDimensionality of the meshes

Definition at line 18 of file NearestNeighborBaseMapping.cpp.

Member Function Documentation

◆ clear()

void precice::mapping::NearestNeighborBaseMapping::clear ( )
finaloverridevirtual

Removes a computed mapping.

Implements precice::mapping::Mapping.

Definition at line 86 of file NearestNeighborBaseMapping.cpp.

Here is the call graph for this function:

◆ computeMapping()

void precice::mapping::NearestNeighborBaseMapping::computeMapping ( )
finaloverridevirtual

Computes the mapping coefficients from the in- and output mesh.

Implements precice::mapping::Mapping.

Definition at line 30 of file NearestNeighborBaseMapping.cpp.

Here is the call graph for this function:

◆ onMappingComputed()

void precice::mapping::NearestNeighborBaseMapping::onMappingComputed ( mesh::PtrMesh origins,
mesh::PtrMesh searchSpace )
virtual

Matches the offsets needed for the gradient mapping Does nothing by default

Reimplemented in precice::mapping::NearestNeighborGradientMapping.

Definition at line 102 of file NearestNeighborBaseMapping.cpp.

◆ tagMeshFirstRound()

void precice::mapping::NearestNeighborBaseMapping::tagMeshFirstRound ( )
finaloverridevirtual

Method used by partition. Tags vertices that could be owned by this rank.

Implements precice::mapping::Mapping.

Definition at line 107 of file NearestNeighborBaseMapping.cpp.

Here is the call graph for this function:

◆ tagMeshSecondRound()

void precice::mapping::NearestNeighborBaseMapping::tagMeshSecondRound ( )
finaloverridevirtual

Method used by partition. Tags vertices that can be filtered out.

Implements precice::mapping::Mapping.

Definition at line 130 of file NearestNeighborBaseMapping.cpp.

Member Data Documentation

◆ _log

logging::Logger precice::mapping::NearestNeighborBaseMapping::_log {"mapping::" + mappingName}
mutableprotected

Definition at line 46 of file NearestNeighborBaseMapping.hpp.

◆ _offsetsMatched

std::vector<Eigen::VectorXd> precice::mapping::NearestNeighborBaseMapping::_offsetsMatched
protected

Compute the vector offset between the matched vector and the source vector (needed for gradient mapping) Optimization: save this as an std::vector<double> and use an Eigen::Map to create an interface that uses the correct dimensions.

Definition at line 50 of file NearestNeighborBaseMapping.hpp.

◆ _vertexIndices

std::vector<int> precice::mapping::NearestNeighborBaseMapping::_vertexIndices
protected

Computed output vertex indices to map data from input vertices to.

Definition at line 53 of file NearestNeighborBaseMapping.hpp.

◆ mappingName

std::string precice::mapping::NearestNeighborBaseMapping::mappingName
protected

◆ mappingNameShort

std::string precice::mapping::NearestNeighborBaseMapping::mappingNameShort
protected

nn or nng

Definition at line 44 of file NearestNeighborBaseMapping.hpp.


The documentation for this class was generated from the following files: