SpECTRE  v2024.09.29
domain::CoordinateMap< SourceFrame, TargetFrame, Maps > Class Template Reference

A coordinate map or composition of coordinate maps. More...

#include <CoordinateMap.hpp>

Public Types

using source_frame = SourceFrame
 
using target_frame = TargetFrame
 
using maps_list = tmpl::list< Maps... >
 
- Public Types inherited from domain::CoordinateMapBase< SourceFrame, TargetFrame, CoordinateMaps::map_dim< Maps... > >
using source_frame = SourceFrame
 
using target_frame = TargetFrame
 

Public Member Functions

 CoordinateMap ()=default
 Used for Charm++ serialization.
 
 CoordinateMap (const CoordinateMap &)=default
 
CoordinateMapoperator= (const CoordinateMap &)=default
 
 CoordinateMap (CoordinateMap &&)=default
 
CoordinateMapoperator= (CoordinateMap &&)=default
 
 CoordinateMap (Maps... maps)
 
std::unique_ptr< CoordinateMapBase< SourceFrame, TargetFrame, dim > > get_clone () const override
 
std::unique_ptr< CoordinateMapBase< SourceFrame, Frame::Grid, dim > > get_to_grid_frame () const override
 Retrieve the same map but going from SourceFrame to Frame::Grid. More...
 
bool is_identity () const override
 Returns true if the map is the identity. More...
 
bool inv_jacobian_is_time_dependent () const override
 Returns true if the inverse Jacobian depends on time. More...
 
bool jacobian_is_time_dependent () const override
 Returns true if the Jacobian depends on time. More...
 
const std::unordered_set< std::string > & function_of_time_names () const override
 Get a set of all FunctionOfTime names from Maps More...
 
 WRAPPED_PUPable_decl_base_template (SINGLE_ARG(CoordinateMapBase< SourceFrame, TargetFrame, dim >), CoordinateMap)
 
 CoordinateMap (CkMigrateMessage *)
 
void pup (PUP::er &p) override
 
tnsr::I< double, dim, TargetFrame > operator() (tnsr::I< double, dim, SourceFrame > source_point, const double time=std::numeric_limits< double >::signaling_NaN(), const FunctionsOfTimeMap &functions_of_time={}) const override
 Apply the Maps... to the point(s) source_point
 
tnsr::I< DataVector, dim, TargetFrame > operator() (tnsr::I< DataVector, dim, SourceFrame > source_point, const double time=std::numeric_limits< double >::signaling_NaN(), const FunctionsOfTimeMap &functions_of_time={}) const override
 Apply the Maps... to the point(s) source_point
 
std::optional< tnsr::I< double, dim, SourceFrame > > inverse (tnsr::I< double, dim, TargetFrame > target_point, const double time=std::numeric_limits< double >::signaling_NaN(), const FunctionsOfTimeMap &functions_of_time={}) const override
 Apply the inverse Maps... to the point(s) target_point
 
InverseJacobian< double, dim, SourceFrame, TargetFrame > inv_jacobian (tnsr::I< double, dim, SourceFrame > source_point, const double time=std::numeric_limits< double >::signaling_NaN(), const FunctionsOfTimeMap &functions_of_time={}) const override
 Compute the inverse Jacobian of the Maps... at the point(s) source_point
 
InverseJacobian< DataVector, dim, SourceFrame, TargetFrame > inv_jacobian (tnsr::I< DataVector, dim, SourceFrame > source_point, const double time=std::numeric_limits< double >::signaling_NaN(), const FunctionsOfTimeMap &functions_of_time={}) const override
 Compute the inverse Jacobian of the Maps... at the point(s) source_point
 
Jacobian< double, dim, SourceFrame, TargetFrame > jacobian (tnsr::I< double, dim, SourceFrame > source_point, const double time=std::numeric_limits< double >::signaling_NaN(), const FunctionsOfTimeMap &functions_of_time={}) const override
 Compute the Jacobian of the Maps... at the point(s) source_point
 
Jacobian< DataVector, dim, SourceFrame, TargetFrame > jacobian (tnsr::I< DataVector, dim, SourceFrame > source_point, const double time=std::numeric_limits< double >::signaling_NaN(), const FunctionsOfTimeMap &functions_of_time={}) const override
 Compute the Jacobian of the Maps... at the point(s) source_point
 
std::tuple< tnsr::I< double, dim, TargetFrame >, InverseJacobian< double, dim, SourceFrame, TargetFrame >, Jacobian< double, dim, SourceFrame, TargetFrame >, tnsr::I< double, dim, TargetFrame > > coords_frame_velocity_jacobians (tnsr::I< double, dim, SourceFrame > source_point, const double time=std::numeric_limits< double >::signaling_NaN(), const FunctionsOfTimeMap &functions_of_time={}) const override
 Compute the mapped coordinates, frame velocity, Jacobian, and inverse Jacobian. The inverse Jacobian is computed by numerically inverting the Jacobian as this was measured to be quicker than computing it directly for more complex map concatenations.
 
std::tuple< tnsr::I< DataVector, dim, TargetFrame >, InverseJacobian< DataVector, dim, SourceFrame, TargetFrame >, Jacobian< DataVector, dim, SourceFrame, TargetFrame >, tnsr::I< DataVector, dim, TargetFrame > > coords_frame_velocity_jacobians (tnsr::I< DataVector, dim, SourceFrame > source_point, const double time=std::numeric_limits< double >::signaling_NaN(), const FunctionsOfTimeMap &functions_of_time={}) const override
 Compute the mapped coordinates, frame velocity, Jacobian, and inverse Jacobian. The inverse Jacobian is computed by numerically inverting the Jacobian as this was measured to be quicker than computing it directly for more complex map concatenations.
 
- Public Member Functions inherited from domain::CoordinateMapBase< SourceFrame, TargetFrame, CoordinateMaps::map_dim< Maps... > >
 WRAPPED_PUPable_abstract (CoordinateMapBase)
 
 CoordinateMapBase (const CoordinateMapBase &)=default
 
 CoordinateMapBase (CoordinateMapBase &&)=default
 
CoordinateMapBaseoperator= (const CoordinateMapBase &)=default
 
CoordinateMapBaseoperator= (CoordinateMapBase &&)=default
 
virtual std::unique_ptr< CoordinateMapBase< SourceFrame, TargetFrame, Dim > > get_clone () const=0
 
virtual std::unique_ptr< CoordinateMapBase< SourceFrame, Frame::Grid, Dim > > get_to_grid_frame () const=0
 Retrieve the same map but going from SourceFrame to Frame::Grid. More...
 
virtual bool is_identity () const=0
 Returns true if the map is the identity. More...
 
virtual bool inv_jacobian_is_time_dependent () const=0
 Returns true if the inverse Jacobian depends on time. More...
 
virtual bool jacobian_is_time_dependent () const=0
 Returns true if the Jacobian depends on time. More...
 
virtual const std::unordered_set< std::string > & function_of_time_names () const=0
 Get a set of all FunctionOfTime names used in this mapping. More...
 
virtual tnsr::I< double, Dim, TargetFrame > operator() (tnsr::I< double, Dim, SourceFrame > source_point, double time=std::numeric_limits< double >::signaling_NaN(), const FunctionsOfTimeMap &functions_of_time={}) const=0
 Apply the Maps to the point(s) source_point
 
virtual tnsr::I< DataVector, Dim, TargetFrame > operator() (tnsr::I< DataVector, Dim, SourceFrame > source_point, double time=std::numeric_limits< double >::signaling_NaN(), const FunctionsOfTimeMap &functions_of_time={}) const=0
 Apply the Maps to the point(s) source_point
 
virtual std::optional< tnsr::I< double, Dim, SourceFrame > > inverse (tnsr::I< double, Dim, TargetFrame > target_point, double time=std::numeric_limits< double >::signaling_NaN(), const FunctionsOfTimeMap &functions_of_time={}) const=0
 Apply the inverse Maps to the point(s) target_point. The returned std::optional is invalid if the map is not invertible at target_point, or if target_point can be easily determined to not make sense for the map. An example of the latter is passing a point with a negative value of z into a positive-z Wedge<3> inverse map. The inverse function is only callable with doubles because the inverse might fail if called for a point out of range, and it is unclear what should happen if the inverse were to succeed for some points in a DataVector but fail for other points.
 
virtual InverseJacobian< double, Dim, SourceFrame, TargetFrame > inv_jacobian (tnsr::I< double, Dim, SourceFrame > source_point, double time=std::numeric_limits< double >::signaling_NaN(), const FunctionsOfTimeMap &functions_of_time={}) const=0
 Compute the inverse Jacobian of the Maps at the point(s) source_point
 
virtual InverseJacobian< DataVector, Dim, SourceFrame, TargetFrame > inv_jacobian (tnsr::I< DataVector, Dim, SourceFrame > source_point, double time=std::numeric_limits< double >::signaling_NaN(), const FunctionsOfTimeMap &functions_of_time={}) const=0
 Compute the inverse Jacobian of the Maps at the point(s) source_point
 
virtual Jacobian< double, Dim, SourceFrame, TargetFrame > jacobian (tnsr::I< double, Dim, SourceFrame > source_point, double time=std::numeric_limits< double >::signaling_NaN(), const FunctionsOfTimeMap &functions_of_time={}) const=0
 Compute the Jacobian of the Maps at the point(s) source_point
 
virtual Jacobian< DataVector, Dim, SourceFrame, TargetFrame > jacobian (tnsr::I< DataVector, Dim, SourceFrame > source_point, double time=std::numeric_limits< double >::signaling_NaN(), const FunctionsOfTimeMap &functions_of_time={}) const=0
 Compute the Jacobian of the Maps at the point(s) source_point
 
virtual std::tuple< tnsr::I< double, Dim, TargetFrame >, InverseJacobian< double, Dim, SourceFrame, TargetFrame >, Jacobian< double, Dim, SourceFrame, TargetFrame >, tnsr::I< double, Dim, TargetFrame > > coords_frame_velocity_jacobians (tnsr::I< double, Dim, SourceFrame > source_point, double time=std::numeric_limits< double >::signaling_NaN(), const FunctionsOfTimeMap &functions_of_time={}) const=0
 Compute the mapped coordinates, frame velocity, Jacobian, and inverse Jacobian.
 
virtual std::tuple< tnsr::I< DataVector, Dim, TargetFrame >, InverseJacobian< DataVector, Dim, SourceFrame, TargetFrame >, Jacobian< DataVector, Dim, SourceFrame, TargetFrame >, tnsr::I< DataVector, Dim, TargetFrame > > coords_frame_velocity_jacobians (tnsr::I< DataVector, Dim, SourceFrame > source_point, double time=std::numeric_limits< double >::signaling_NaN(), const FunctionsOfTimeMap &functions_of_time={}) const=0
 Compute the mapped coordinates, frame velocity, Jacobian, and inverse Jacobian.
 

Static Public Attributes

static constexpr size_t dim = CoordinateMaps::map_dim<Maps...>
 
- Static Public Attributes inherited from domain::CoordinateMapBase< SourceFrame, TargetFrame, CoordinateMaps::map_dim< Maps... > >
static constexpr size_t dim
 

Friends

bool operator== (const CoordinateMap &lhs, const CoordinateMap &rhs)
 
template<typename NewMap , typename LocalSourceFrame , typename LocalTargetFrame , typename... LocalMaps, size_t... Is>
CoordinateMap< LocalSourceFrame, LocalTargetFrame, LocalMaps..., NewMap > push_back_impl (CoordinateMap< LocalSourceFrame, LocalTargetFrame, LocalMaps... > &&old_map, NewMap new_map, std::index_sequence< Is... >)
 
template<typename... NewMaps, typename LocalSourceFrame , typename LocalTargetFrame , typename... LocalMaps, size_t... Is, size_t... Js>
CoordinateMap< LocalSourceFrame, LocalTargetFrame, LocalMaps..., NewMaps... > push_back_impl (CoordinateMap< LocalSourceFrame, LocalTargetFrame, LocalMaps... > &&old_map, CoordinateMap< LocalSourceFrame, LocalTargetFrame, NewMaps... > new_map, std::index_sequence< Is... >, std::index_sequence< Js... >)
 
template<typename NewMap , typename LocalSourceFrame , typename LocalTargetFrame , typename... LocalMaps, size_t... Is>
CoordinateMap< LocalSourceFrame, LocalTargetFrame, NewMap, LocalMaps... > push_front_impl (CoordinateMap< LocalSourceFrame, LocalTargetFrame, LocalMaps... > &&old_map, NewMap new_map, std::index_sequence< Is... >)
 

Detailed Description

template<typename SourceFrame, typename TargetFrame, typename... Maps>
class domain::CoordinateMap< SourceFrame, TargetFrame, Maps >

A coordinate map or composition of coordinate maps.

Maps coordinates from the SourceFrame to the TargetFrame using the coordinate maps Maps.... The individual maps are applied left to right from the source to the target Frame. The inverse map, as well as Jacobian and inverse Jacobian are also provided. The CoordinateMap class must be used even if just wrapping a single coordinate map. It is designed to be an extremely minimal interface to the underlying coordinate maps. For a list of all coordinate maps see the CoordinateMaps group or namespace.

Each coordinate map must contain a static constexpr size_t dim variable that is equal to the dimensionality of the map. The Coordinatemap class contains a member static constexpr size_t dim, a type alias source_frame, a type alias target_frame and typelist of theMaps...`.

Member Function Documentation

◆ function_of_time_names()

template<typename SourceFrame , typename TargetFrame , typename... Maps>
const std::unordered_set< std::string > & domain::CoordinateMap< SourceFrame, TargetFrame, Maps >::function_of_time_names ( ) const
inlineoverridevirtual

Get a set of all FunctionOfTime names from Maps

Implements domain::CoordinateMapBase< SourceFrame, TargetFrame, CoordinateMaps::map_dim< Maps... > >.

◆ get_clone()

template<typename SourceFrame , typename TargetFrame , typename... Maps>
std::unique_ptr< CoordinateMapBase< SourceFrame, TargetFrame, dim > > domain::CoordinateMap< SourceFrame, TargetFrame, Maps >::get_clone ( ) const
inlineoverridevirtual

◆ get_to_grid_frame()

template<typename SourceFrame , typename TargetFrame , typename... Maps>
std::unique_ptr< CoordinateMapBase< SourceFrame, Frame::Grid, dim > > domain::CoordinateMap< SourceFrame, TargetFrame, Maps >::get_to_grid_frame ( ) const
inlineoverridevirtual

Retrieve the same map but going from SourceFrame to Frame::Grid.

This functionality is needed when composing time-dependent maps with time-independent maps, where the target frame of the time-independent map is Frame::Grid.

Implements domain::CoordinateMapBase< SourceFrame, TargetFrame, CoordinateMaps::map_dim< Maps... > >.

◆ inv_jacobian_is_time_dependent()

template<typename SourceFrame , typename TargetFrame , typename... Maps>
bool domain::CoordinateMap< SourceFrame, TargetFrame, Maps >::inv_jacobian_is_time_dependent ( ) const
overridevirtual

Returns true if the inverse Jacobian depends on time.

Implements domain::CoordinateMapBase< SourceFrame, TargetFrame, CoordinateMaps::map_dim< Maps... > >.

◆ is_identity()

template<typename SourceFrame , typename TargetFrame , typename... Maps>
bool domain::CoordinateMap< SourceFrame, TargetFrame, Maps >::is_identity ( ) const
overridevirtual

◆ jacobian_is_time_dependent()

template<typename SourceFrame , typename TargetFrame , typename... Maps>
bool domain::CoordinateMap< SourceFrame, TargetFrame, Maps >::jacobian_is_time_dependent ( ) const
overridevirtual

Returns true if the Jacobian depends on time.

Implements domain::CoordinateMapBase< SourceFrame, TargetFrame, CoordinateMaps::map_dim< Maps... > >.


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