SpECTRE  v2025.08.19
ray_tracing::BackgroundSpacetime Class Referenceabstract

Abstract base class for background spacetimes in the ray tracer. More...

#include <BackgroundSpacetime.hpp>

Public Types

using tags = tmpl::list< gr::Tags::Lapse< DataType >, DerivLapse, gr::Tags::Shift< DataType, Dim, Frame >, DerivShift, gr::Tags::InverseSpatialMetric< DataType, Dim, Frame >, DerivInvSpatialMetric, gr::Tags::ExtrinsicCurvature< DataType, Dim, Frame > >
 These tags can be retrieved from the background spacetime. They are required to evaluate the gr::geodesic_equation.
 

Public Member Functions

virtual auto get_clone () const -> std::unique_ptr< BackgroundSpacetime >=0
 Copies the background spacetime. Must call initialize on the clone before using it. More...
 
virtual void initialize (const std::array< double, 2 > time_bounds)
 Initialize the background spacetime, e.g. by reading data from a file. More...
 
virtual std::array< double, 2 > time_bounds () const
 Time bounds for which the background spacetime is valid. The variables function can be called for any time in this range (inclusive). More...
 
virtual tuples::tagged_tuple_from_typelist< tagsvariables (const tnsr::I< DataType, Dim, Frame > &x, double t, std::optional< gsl::not_null< std::vector< size_t > * > > block_order=std::nullopt) const =0
 Returns all spacetime variables at a given point in space and time. More...
 

Protected Types

using DataType = double
 
using Frame = ::Frame::Inertial
 
using DerivLapse = ::Tags::deriv< gr::Tags::Lapse< DataType >, tmpl::size_t< Dim >, Frame >
 
using DerivShift = ::Tags::deriv< gr::Tags::Shift< DataType, Dim >, tmpl::size_t< Dim >, Frame >
 
using DerivInvSpatialMetric = ::Tags::deriv< gr::Tags::InverseSpatialMetric< DataType, Dim, Frame >, tmpl::size_t< Dim >, Frame >
 
using DerivSpatialMetric = ::Tags::deriv< gr::Tags::SpatialMetric< DataType, Dim, Frame >, tmpl::size_t< Dim >, Frame >
 

Static Protected Attributes

static constexpr size_t Dim = 3
 

Detailed Description

Abstract base class for background spacetimes in the ray tracer.

Derived classes have to provide spacetime quantities at a given point on request, e.g. by evaluating an analytic spacetime or by interpolating numeric data from a file. The initialize function can be used to set up the background spacetime, e.g. by reading data from a file. Then, the background spacetime should be valid within the bounds returned by the time_bounds function.

Member Function Documentation

◆ get_clone()

virtual auto ray_tracing::BackgroundSpacetime::get_clone ( ) const -> std::unique_ptr< BackgroundSpacetime >
pure virtual

Copies the background spacetime. Must call initialize on the clone before using it.

Implemented in ray_tracing::NumericData, and ray_tracing::WrappedGr< SolutionType >.

◆ initialize()

virtual void ray_tracing::BackgroundSpacetime::initialize ( const std::array< double, 2 >  time_bounds)
inlinevirtual

Initialize the background spacetime, e.g. by reading data from a file.

This function is called before the first call to variables(). It is valid to call initialize again with new time bounds. Derived classes must guarantee that the variables function can be called from other threads while initialize is running (e.g. loading new data from files), but only with times within the overlap of the previous and the new time bounds.

Parameters
time_boundsThe time bounds for which to initialize the background spacetime. The spacetime should be valid for all times in this range.

Reimplemented in ray_tracing::NumericData.

◆ time_bounds()

virtual std::array< double, 2 > ray_tracing::BackgroundSpacetime::time_bounds ( ) const
inlinevirtual

Time bounds for which the background spacetime is valid. The variables function can be called for any time in this range (inclusive).

Reimplemented in ray_tracing::NumericData.

◆ variables()

virtual tuples::tagged_tuple_from_typelist< tags > ray_tracing::BackgroundSpacetime::variables ( const tnsr::I< DataType, Dim, Frame > &  x,
double  t,
std::optional< gsl::not_null< std::vector< size_t > * > >  block_order = std::nullopt 
) const
pure virtual

Returns all spacetime variables at a given point in space and time.

This function must be thread-safe.

Parameters
xSpatial coordinates
tTime
block_orderOptional priority order for processing blocks during interpolation. If specified, it will be updated to push the block in which the point was found to the front. Can be empty, in which case it will be initially set to the default order. See block_logical_coordinates for more details.

Implemented in ray_tracing::NumericData.


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