preCICE v3.1.2
|
Abstract base class for mapping of data from one mesh to another. More...
#include <Mapping.hpp>
Public Types | |
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... | |
Public Member Functions | |
Mapping (Constraint constraint, int dimensions, bool requiresGradientData, InitialGuessRequirement initialGuessRequirement) | |
Constructor, takes mapping constraint. | |
Mapping & | operator= (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::PtrMesh & | getInputMesh () const |
const mesh::PtrMesh & | getOutputMesh () 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. | |
virtual void | computeMapping ()=0 |
Computes the mapping coefficients from the in- and 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. | |
virtual void | clear ()=0 |
Removes a computed mapping. | |
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 | tagMeshFirstRound ()=0 |
Method used by partition. Tags vertices that could be owned by this rank. | |
virtual void | tagMeshSecondRound ()=0 |
Method used by partition. Tags vertices that can be filtered out. | |
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 Member Functions | |
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. | |
Protected Attributes | |
bool | _hasComputedMapping = false |
Flag to indicate whether computeMapping() has been called. | |
bool | _requiresGradientData |
Flag if gradient data is required for the mapping. | |
Private Attributes | |
Constraint | _constraint |
Determines whether mapping is consistent or conservative. | |
MeshRequirement | _inputRequirement |
Requirement on input mesh. | |
MeshRequirement | _outputRequirement |
Requirement on output mesh. | |
mesh::PtrMesh | _input |
Pointer to input mesh. | |
mesh::PtrMesh | _output |
Pointer to output mesh. | |
int | _dimensions |
InitialGuessRequirement | _initialGuessRequirement |
The InitialGuessRequirement of the Mapping. | |
Eigen::VectorXd * | _initialGuess = nullptr |
Pointer to the initialGuess set and unset by map. | |
Abstract base class for mapping of data from one mesh to another.
Definition at line 15 of file Mapping.hpp.
Specifies additional constraints for a mapping.
A consistent mapping retains mean values. When mapping displacements, e.g. rigid body motions are retained. A conservative mapping retains the sum of the values. The scaled-consistent-surface/volume mappings first map the values consistently, then scales the mapped such that the integrals on both meshes are equal. Integrals are either done on surfaces or volumes depending on the mode.
Enumerator | |
---|---|
CONSISTENT | |
CONSERVATIVE | |
SCALED_CONSISTENT_SURFACE | |
SCALED_CONSISTENT_VOLUME |
Definition at line 29 of file Mapping.hpp.
|
strong |
Specifies whether the mapping requires an initial guess.
Iterative mappings use an additional initial guess to perform the mapping. When calling the version of map with the initialGuess, derived classes of Mapping can access and update this initial guess using initialGuess(). Note that the size of the initial guess is controlled by the Mapping.
The first initial guess is expected to be an empty VectorXd.
Enumerator | |
---|---|
Required | |
None |
Definition at line 63 of file Mapping.hpp.
|
strong |
Specifies requirements for the input and output meshes of a mapping.
Different mapping types have different requirements on the meshes involved in the mapping, while the input and output mesh holding the data to map can have different requirements. FULL requires a mesh consisting of vertices connected by edges and faces. VERTEX requires a mesh consisting of vertices only.
Enumerator | |
---|---|
UNDEFINED | |
VERTEX | Vertices only. |
FULL | Full mesh. |
Definition at line 45 of file Mapping.hpp.
precice::mapping::Mapping::Mapping | ( | Constraint | constraint, |
int | dimensions, | ||
bool | requiresGradientData, | ||
InitialGuessRequirement | initialGuessRequirement ) |
Constructor, takes mapping constraint.
Definition at line 11 of file Mapping.cpp.
|
virtualdefault |
Destructor, empty.
|
pure virtual |
Removes a computed mapping.
Implemented in precice::mapping::BarycentricBaseMapping, precice::mapping::NearestNeighborBaseMapping, precice::mapping::PartitionOfUnityMapping< RADIAL_BASIS_FUNCTION_T >, precice::mapping::PetRadialBasisFctMapping< RADIAL_BASIS_FUNCTION_T >, precice::mapping::RadialBasisFctMapping< SOLVER_T, Args >, precice::mapping::AxialGeoMultiscaleMapping, precice::mapping::RadialGeoMultiscaleMapping, precice::mapping::RadialBasisFctBaseMapping< RADIAL_BASIS_FUNCTION_T >, and precice::mapping::RadialBasisFctBaseMapping< SOLVER_T::BASIS_FUNCTION_T >.
|
pure virtual |
Computes the mapping coefficients from the in- and output mesh.
Implemented in precice::mapping::LinearCellInterpolationMapping, precice::mapping::NearestNeighborBaseMapping, precice::mapping::NearestProjectionMapping, precice::mapping::PartitionOfUnityMapping< RADIAL_BASIS_FUNCTION_T >, precice::mapping::PetRadialBasisFctMapping< RADIAL_BASIS_FUNCTION_T >, precice::mapping::RadialBasisFctMapping< SOLVER_T, Args >, precice::mapping::AxialGeoMultiscaleMapping, precice::mapping::RadialGeoMultiscaleMapping, precice::mapping::RadialBasisFctBaseMapping< RADIAL_BASIS_FUNCTION_T >, and precice::mapping::RadialBasisFctBaseMapping< SOLVER_T::BASIS_FUNCTION_T >.
Mapping::Constraint precice::mapping::Mapping::getConstraint | ( | ) | const |
Returns the constraint (consistent/conservative) of the mapping.
Definition at line 45 of file Mapping.cpp.
|
protected |
Definition at line 108 of file Mapping.cpp.
const mesh::PtrMesh & precice::mapping::Mapping::getInputMesh | ( | ) | const |
Definition at line 35 of file Mapping.cpp.
Mapping::MeshRequirement precice::mapping::Mapping::getInputRequirement | ( | ) | const |
Returns the requirement on the input mesh.
Definition at line 76 of file Mapping.cpp.
|
pure virtual |
Returns the name of the mapping method for logging purpose.
Implemented in precice::mapping::AxialGeoMultiscaleMapping, precice::mapping::LinearCellInterpolationMapping, precice::mapping::NearestNeighborGradientMapping, precice::mapping::NearestNeighborMapping, precice::mapping::NearestProjectionMapping, precice::mapping::PartitionOfUnityMapping< RADIAL_BASIS_FUNCTION_T >, precice::mapping::PetRadialBasisFctMapping< RADIAL_BASIS_FUNCTION_T >, precice::mapping::RadialBasisFctMapping< SOLVER_T, Args >, and precice::mapping::RadialGeoMultiscaleMapping.
const mesh::PtrMesh & precice::mapping::Mapping::getOutputMesh | ( | ) | const |
Definition at line 40 of file Mapping.cpp.
Mapping::MeshRequirement precice::mapping::Mapping::getOutputRequirement | ( | ) | const |
Returns the requirement on the output mesh.
Definition at line 81 of file Mapping.cpp.
bool precice::mapping::Mapping::hasComputedMapping | ( | ) | const |
Returns true, if the mapping has been computed.
After a call to clear(), a computed mapping is removed and false returned.
Definition at line 252 of file Mapping.cpp.
|
virtual |
Checks whether the mapping has the given constraint or not.
Definition at line 247 of file Mapping.cpp.
bool precice::mapping::Mapping::hasInitialGuess | ( | ) | const |
True if initialGuess().size() == 0.
Definition at line 55 of file Mapping.cpp.
Eigen::VectorXd & precice::mapping::Mapping::initialGuess | ( | ) |
const Eigen::VectorXd & precice::mapping::Mapping::initialGuess | ( | ) | const |
Return the provided initial guess of a mapping using an initialGuess.
Definition at line 62 of file Mapping.cpp.
|
protected |
Returns pointer to input mesh.
Definition at line 86 of file Mapping.cpp.
bool precice::mapping::Mapping::isScaledConsistent | ( | ) | const |
Returns true if mapping is a form of scaled consistent mapping.
Definition at line 257 of file Mapping.cpp.
void precice::mapping::Mapping::map | ( | const time::Sample & | input, |
Eigen::VectorXd & | output ) |
Maps an input Sample to output data from input mesh to output mesh.
Derived classed must implement the mapping functionality using mapConsistent() and mapConservative()
[in] | input | sample to map |
[out] | output | result data |
Definition at line 157 of file Mapping.cpp.
void precice::mapping::Mapping::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.
The initialGuess must be either an empty VectorXd, or the result of a previous invocation of map.
Derived classed must implement the mapping functionality using mapConsistent() and mapConservative()
[in] | input | sample to map |
[out] | output | result data |
[in,out] | initialGuess | guess to use during map, may be an empty VectorXd |
Definition at line 149 of file Mapping.cpp.
void precice::mapping::Mapping::map | ( | int | inputDataID, |
int | outputDataID ) |
void precice::mapping::Mapping::map | ( | int | inputDataID, |
int | outputDataID, | ||
Eigen::VectorXd & | initialGuess ) |
|
protectedpure virtual |
Maps data using a conservative constraint.
[in] | input | Sample to map data from |
[in] | output | Values to map to |
If requiresInitialGuess(), then the initial guess is available via initialGuess(). Provide a new initial guess by overwriting it. The mapping has full control over its size.
Implemented in precice::mapping::NearestNeighborGradientMapping, precice::mapping::NearestNeighborMapping, precice::mapping::PetRadialBasisFctMapping< RADIAL_BASIS_FUNCTION_T >, precice::mapping::RadialBasisFctMapping< SOLVER_T, Args >, precice::mapping::AxialGeoMultiscaleMapping, precice::mapping::BarycentricBaseMapping, precice::mapping::PartitionOfUnityMapping< RADIAL_BASIS_FUNCTION_T >, and precice::mapping::RadialGeoMultiscaleMapping.
|
protectedpure virtual |
Maps data using a consistent constraint.
[in] | input | Sample to map data from |
[in] | output | Values to map to |
If requiresInitialGuess(), then the initial guess is available via initialGuess(). Provide a new initial guess by overwriting it. The mapping has full control over its size.
Implemented in precice::mapping::NearestNeighborGradientMapping, precice::mapping::NearestNeighborMapping, precice::mapping::PetRadialBasisFctMapping< RADIAL_BASIS_FUNCTION_T >, precice::mapping::RadialBasisFctMapping< SOLVER_T, Args >, precice::mapping::AxialGeoMultiscaleMapping, precice::mapping::BarycentricBaseMapping, precice::mapping::PartitionOfUnityMapping< RADIAL_BASIS_FUNCTION_T >, and precice::mapping::RadialGeoMultiscaleMapping.
|
protected |
Returns pointer to output mesh.
Definition at line 91 of file Mapping.cpp.
bool precice::mapping::Mapping::requiresGradientData | ( | ) | const |
Returns whether the mapping requires gradient data.
Definition at line 113 of file Mapping.cpp.
bool precice::mapping::Mapping::requiresInitialGuess | ( | ) | const |
Return true if the mapping requires an initial guess.
Definition at line 50 of file Mapping.cpp.
|
virtual |
Scales the consistently mapped output data such that the surface integral of the values on input mesh and output mesh are equal.
Definition at line 174 of file Mapping.cpp.
|
protected |
Sets the mesh requirement for the input mesh.
Definition at line 96 of file Mapping.cpp.
void precice::mapping::Mapping::setMeshes | ( | const mesh::PtrMesh & | input, |
const mesh::PtrMesh & | output ) |
Sets input and output meshes carrying data to be mapped.
[in] | input | Mesh with known data values to be mapped. |
[in] | output | Mesh with unknown data values to be computed from input. |
Definition at line 27 of file Mapping.cpp.
|
protected |
Sets the mesh requirement for the output mesh.
Definition at line 102 of file Mapping.cpp.
|
pure virtual |
Method used by partition. Tags vertices that could be owned by this rank.
Implemented in precice::mapping::RadialBasisFctBaseMapping< RADIAL_BASIS_FUNCTION_T >, precice::mapping::RadialBasisFctBaseMapping< SOLVER_T::BASIS_FUNCTION_T >, precice::mapping::BarycentricBaseMapping, precice::mapping::NearestNeighborBaseMapping, precice::mapping::PartitionOfUnityMapping< RADIAL_BASIS_FUNCTION_T >, precice::mapping::AxialGeoMultiscaleMapping, and precice::mapping::RadialGeoMultiscaleMapping.
|
pure virtual |
Method used by partition. Tags vertices that can be filtered out.
Implemented in precice::mapping::RadialBasisFctBaseMapping< RADIAL_BASIS_FUNCTION_T >, precice::mapping::RadialBasisFctBaseMapping< SOLVER_T::BASIS_FUNCTION_T >, precice::mapping::BarycentricBaseMapping, precice::mapping::NearestNeighborBaseMapping, precice::mapping::PartitionOfUnityMapping< RADIAL_BASIS_FUNCTION_T >, precice::mapping::AxialGeoMultiscaleMapping, and precice::mapping::RadialGeoMultiscaleMapping.
|
private |
Determines whether mapping is consistent or conservative.
Definition at line 242 of file Mapping.hpp.
|
private |
Definition at line 256 of file Mapping.hpp.
|
protected |
Flag to indicate whether computeMapping() has been called.
Definition at line 208 of file Mapping.hpp.
|
private |
Pointer to the initialGuess set and unset by map.
Definition at line 262 of file Mapping.hpp.
|
private |
The InitialGuessRequirement of the Mapping.
Definition at line 259 of file Mapping.hpp.
|
private |
Pointer to input mesh.
Definition at line 251 of file Mapping.hpp.
|
private |
Requirement on input mesh.
Definition at line 245 of file Mapping.hpp.
|
private |
Pointer to output mesh.
Definition at line 254 of file Mapping.hpp.
|
private |
Requirement on output mesh.
Definition at line 248 of file Mapping.hpp.
|
protected |
Flag if gradient data is required for the mapping.
Definition at line 211 of file Mapping.hpp.