|
SpECTRE
v2025.08.19
|
Interpolates data in volume files to target points by reading the volume data into memory. More...
#include <PointwiseInterpolator.hpp>
Public Member Functions | |
| PointwiseInterpolator (const std::variant< std::vector< std::string >, std::string > &volume_files_or_glob, const std::string &subfile_name, const ObservationVariant &observation, const std::vector< std::string > &tensor_components) | |
| void | interpolate_to_points (gsl::not_null< std::vector< DataVector > * > result, const tnsr::I< DataVector, Dim, Frame > &target_points, bool extrapolate_into_excisions=false, bool error_on_missing_points=false, std::optional< size_t > num_threads=std::nullopt) const |
| Interpolate to many points. More... | |
| void | interpolate_to_point (gsl::not_null< std::vector< double > * > result, const tnsr::I< double, Dim, Frame > &target_point, std::optional< gsl::not_null< std::vector< size_t > * > > block_order=std::nullopt) const |
| Interpolate to a single point. More... | |
| void | interpolate_to_point (gsl::not_null< std::vector< double > * > result, const IdPair< domain::BlockId, tnsr::I< double, Dim, ::Frame::BlockLogical > > &target_point) const |
| Interpolate to a single point in block-logical coordinates. More... | |
| size_t | obs_id () const |
| double | time () const |
| const Domain< Dim > & | domain () const |
| const domain::FunctionsOfTimeMap & | functions_of_time () const |
Interpolates data in volume files to target points by reading the volume data into memory.
This class reads the volume data at the requested time into memory and can then interpolate it to any number of target points.
PointwiseInterpolator on multiple threads at once is not thread safe (unless HDF5 was built with thread-safety support) because the constructor opens the H5 files and reads in the data. However, once the data is loaded, the interpolate_to_points and interpolate_to_point functions are thread safe. This means the volume data can be loaded once in a single thread and then used by multiple threads to interpolate to different points in parallel. | void spectre::Exporter::PointwiseInterpolator< Dim, Frame >::interpolate_to_point | ( | gsl::not_null< std::vector< double > * > | result, |
| const IdPair< domain::BlockId, tnsr::I< double, Dim, ::Frame::BlockLogical > > & | target_point | ||
| ) | const |
Interpolate to a single point in block-logical coordinates.
| result | the interpolated data at the target point. The vector is over the number of components. Will be resized automatically. |
| target_point | the point to interpolate to in block-logical coordinates. |
| void spectre::Exporter::PointwiseInterpolator< Dim, Frame >::interpolate_to_point | ( | gsl::not_null< std::vector< double > * > | result, |
| const tnsr::I< double, Dim, Frame > & | target_point, | ||
| std::optional< gsl::not_null< std::vector< size_t > * > > | block_order = std::nullopt |
||
| ) | const |
Interpolate to a single point.
This function is thread safe, so the interpolator can be constructed to load the volume data once and then used by multiple threads to interpolate to different points in parallel. Note that updating the block_order (if provided) is not thread safe, so each thread should manage a separate block_order.
| result | the interpolated data at the target point. The vector is over the number of components. Will be resized automatically. |
| target_point | the point to interpolate to |
| block_order | an optional priority order to search for the block containing the target point. Will be updated when the point is found. See block_logical_coordinates_single_point for more details. |
| void spectre::Exporter::PointwiseInterpolator< Dim, Frame >::interpolate_to_points | ( | gsl::not_null< std::vector< DataVector > * > | result, |
| const tnsr::I< DataVector, Dim, Frame > & | target_points, | ||
| bool | extrapolate_into_excisions = false, |
||
| bool | error_on_missing_points = false, |
||
| std::optional< size_t > | num_threads = std::nullopt |
||
| ) | const |
Interpolate to many points.
| result | the interpolated data at the target points. The outer vector is the number of components and the inner vector is the number of target points. Will be resized automatically. |
| target_points | the points to interpolate to |
| extrapolate_into_excisions | whether to extrapolate into excised regions |
| error_on_missing_points | whether to throw an error if any of the target points are outside the domain |
| num_threads | the number of OpenMP threads to use to parallelize the interpolation over the target points. If not provided, the default number of threads will be used. |