OPALX (Object Oriented Parallel Accelerator Library for Exascale) MINIorX
OPALX
interpolation::Interpolator3dGridTo3d Class Referenceabstract

Interpolator3dGridTo3d interpolates from 3d grid to a 3d vector. More...

#include <Interpolator3dGridTo3d.h>

Inheritance diagram for interpolation::Interpolator3dGridTo3d:
Inheritance graph
Collaboration diagram for interpolation::Interpolator3dGridTo3d:
Collaboration graph

Public Types

enum  interpolationAlgorithm { TRILINEAR }
 Enumerator encoding possible interpolation routines. More...
 

Public Member Functions

 Interpolator3dGridTo3d (ThreeDGrid *grid, double ***Bx, double ***By, double ***Bz, interpolationAlgorithm algo=TRILINEAR)
 Constructor for grids with constant spacing. More...
 
 Interpolator3dGridTo3d (const Interpolator3dGridTo3d &interpolator)
 Copy constructor deep copies 1d interpolators and mesh. More...
 
 ~Interpolator3dGridTo3d ()
 Delete member interpolators and remove *this from the mesh smart pointer. More...
 
Interpolator3dGridTo3dclone () const
 Copy function (can be called on parent class) More...
 
void function (const double Point[3], double Value[3]) const
 Return the interpolated data. More...
 
virtual void function (const Mesh::Iterator &point, double *value) const
 Call function at a particular point in the mesh. More...
 
void functionPrime (const double Point[3], double Value[3], int axis) const
 Do not use (just raises exception) - der. More...
 
int getNumberOfXCoords () const
 Number of x coordinates in the grid. More...
 
int getNumberOfYCoords () const
 Number of y coordinates in the grid. More...
 
int getNumberOfZCoords () const
 Number of z coordinates in the grid. More...
 
unsigned int getPointDimension () const
 Dimension of input points. More...
 
unsigned int getValueDimension () const
 Dimension of output values. More...
 
ThreeDGridgetMesh () const
 Return a pointer to the mesh. More...
 
void setGrid (ThreeDGrid *grid)
 Reset the mesh. More...
 
void setX (int nCoords, double *x)
 Set x coordinates in the mesh to an arbitrary set of points. More...
 
void setY (int nCoords, double *y)
 Set y coordinates in the mesh to an arbitrary set of points. More...
 
void setZ (int nCoords, double *z)
 Set z coordinates in the mesh to an arbitrary set of points. More...
 
void setAll (ThreeDGrid *grid, double ***Bx, double ***By, double ***Bz, interpolationAlgorithm algo=TRILINEAR)
 Set function and mesh data. More...
 
void clear ()
 Clear all private data. More...
 
virtual void function (const double *point, double *value) const =0
 Pure virtual function to fill the array value with data evaluated at point. More...
 
virtual void functionAppend (const std::vector< std::vector< double > > &point_vec, std::vector< std::vector< double > > &value_vec) const
 Calculate F, appending output values to value_vec. More...
 
virtual bool checkPoint (const std::vector< double > &point) const
 Return true if point.size() is the same as this->PointDimension() More...
 
virtual bool checkValue (const std::vector< double > &value) const
 Return true if value.size() is the same as this->ValueDimension() More...
 

Protected Attributes

ThreeDGridcoordinates_m
 
Interpolator3dGridTo1dinterpolator_m [3]
 

Detailed Description

Interpolator3dGridTo3d interpolates from 3d grid to a 3d vector.

Wraps three Interpolator3dGridTo1d, one for each variable in the output vector B. At the moment the wrapped Interpolator3dGridTo1d is encoded by means of an enumeration, with the only possible value trilinear interpolator

Function data for each of the 3d output data on the mesh is written as 3d arrays Bx, By, Bz and we make a TriLinear interpolator for each array

Could be that we make Interpolator3dGridTo3d an interface class and then make specific implementations for different interpolation routines (of which three trilinear interpolators is an implementation of the interface).

Definition at line 53 of file Interpolator3dGridTo3d.h.

Member Enumeration Documentation

◆ interpolationAlgorithm

Enumerator encoding possible interpolation routines.

Enumerator
TRILINEAR 

Definition at line 56 of file Interpolator3dGridTo3d.h.

Constructor & Destructor Documentation

◆ Interpolator3dGridTo3d() [1/2]

interpolation::Interpolator3dGridTo3d::Interpolator3dGridTo3d ( ThreeDGrid grid,
double ***  Bx,
double ***  By,
double ***  Bz,
interpolationAlgorithm  algo = TRILINEAR 
)
inline

Constructor for grids with constant spacing.

Parameters
grid3d grid that indexes the data. *this is added to the smart pointer in the mesh
Bxvalue[0] data. 3D arrays go like [index_x][index_y][index_z], and Interpolator3dGridTo3d now owns this memory
Byvalue[1] data. 3D arrays go like [index_x][index_y][index_z], and Interpolator3dGridTo3d now owns this memory
Bzvalue[2] data. 3D arrays go like [index_x][index_y][index_z], and Interpolator3dGridTo3d now owns this memory
algointerpolation algorithm (defaults to TRILINEAR)

Definition at line 209 of file Interpolator3dGridTo3d.h.

References interpolator_m, and setAll().

Referenced by clone().

Here is the call graph for this function:

◆ Interpolator3dGridTo3d() [2/2]

interpolation::Interpolator3dGridTo3d::Interpolator3dGridTo3d ( const Interpolator3dGridTo3d interpolator)

Copy constructor deep copies 1d interpolators and mesh.

Note this makes a whole bunch of extra meshes because each interpolator deep copy makes a new mesh - that's a bit of a mess

Definition at line 33 of file Interpolator3dGridTo3d.cpp.

References interpolation::Interpolator3dGridTo1d::clone(), coordinates_m, and interpolator_m.

Here is the call graph for this function:

◆ ~Interpolator3dGridTo3d()

interpolation::Interpolator3dGridTo3d::~Interpolator3dGridTo3d ( )
inline

Delete member interpolators and remove *this from the mesh smart pointer.

Definition at line 83 of file Interpolator3dGridTo3d.h.

References clear().

Here is the call graph for this function:

Member Function Documentation

◆ checkPoint()

bool interpolation::VectorMap::checkPoint ( const std::vector< double > &  point) const
inlinevirtualinherited

Return true if point.size() is the same as this->PointDimension()

Definition at line 95 of file VectorMap.h.

◆ checkValue()

bool interpolation::VectorMap::checkValue ( const std::vector< double > &  value) const
inlinevirtualinherited

Return true if value.size() is the same as this->ValueDimension()

Definition at line 99 of file VectorMap.h.

◆ clear()

void interpolation::Interpolator3dGridTo3d::clear ( )
inline

Clear all private data.

Definition at line 218 of file Interpolator3dGridTo3d.h.

References coordinates_m, interpolator_m, and interpolation::ThreeDGrid::remove().

Referenced by ~Interpolator3dGridTo3d().

Here is the call graph for this function:

◆ clone()

Interpolator3dGridTo3d * interpolation::Interpolator3dGridTo3d::clone ( ) const
inlinevirtual

Copy function (can be called on parent class)

Implements interpolation::VectorMap.

Definition at line 86 of file Interpolator3dGridTo3d.h.

References Interpolator3dGridTo3d().

Here is the call graph for this function:

◆ function() [1/3]

virtual void interpolation::VectorMap::function ( const double *  point,
double *  value 
) const
pure virtualinherited

◆ function() [2/3]

void interpolation::Interpolator3dGridTo3d::function ( const double  Point[3],
double  Value[3] 
) const

Return the interpolated data.

Calls each child interpolator in turn and sets the value. Note that this means we get 3 sets of bound checks plus bound checking on the parent which is a bit unpleasant. I think that the actual interpolation however does have to be done independently for each variable.

Definition at line 40 of file Interpolator3dGridTo3d.cpp.

References coordinates_m, interpolation::Interpolator3dGridTo1d::function(), interpolator_m, interpolation::ThreeDGrid::maxX(), interpolation::ThreeDGrid::maxY(), interpolation::ThreeDGrid::maxZ(), interpolation::ThreeDGrid::minX(), interpolation::ThreeDGrid::minY(), and interpolation::ThreeDGrid::minZ().

Here is the call graph for this function:

◆ function() [3/3]

virtual void interpolation::Interpolator3dGridTo3d::function ( const Mesh::Iterator point,
double *  value 
) const
inlinevirtual

Call function at a particular point in the mesh.

Reimplemented from interpolation::VectorMap.

Definition at line 99 of file Interpolator3dGridTo3d.h.

References interpolation::VectorMap::function().

Here is the call graph for this function:

◆ functionAppend()

void interpolation::VectorMap::functionAppend ( const std::vector< std::vector< double > > &  point_vec,
std::vector< std::vector< double > > &  value_vec 
) const
inlinevirtualinherited

Calculate F, appending output values to value_vec.

For each item in point_vec not in value_vec, calculate value_vec (urgh)

Definition at line 109 of file VectorMap.h.

References interpolation::VectorMap::function(), and interpolation::VectorMap::getValueDimension().

Here is the call graph for this function:

◆ functionPrime()

void interpolation::Interpolator3dGridTo3d::functionPrime ( const double  Point[3],
double  Value[3],
int  axis 
) const

Do not use (just raises exception) - der.

◆ getMesh()

ThreeDGrid * interpolation::Interpolator3dGridTo3d::getMesh ( ) const
inlinevirtual

Return a pointer to the mesh.

Reimplemented from interpolation::VectorMap.

Definition at line 183 of file Interpolator3dGridTo3d.h.

References coordinates_m.

◆ getNumberOfXCoords()

int interpolation::Interpolator3dGridTo3d::getNumberOfXCoords ( ) const
inline

Number of x coordinates in the grid.

Definition at line 163 of file Interpolator3dGridTo3d.h.

References coordinates_m, and interpolation::ThreeDGrid::xSize().

Here is the call graph for this function:

◆ getNumberOfYCoords()

int interpolation::Interpolator3dGridTo3d::getNumberOfYCoords ( ) const
inline

Number of y coordinates in the grid.

Definition at line 167 of file Interpolator3dGridTo3d.h.

References coordinates_m, and interpolation::ThreeDGrid::ySize().

Here is the call graph for this function:

◆ getNumberOfZCoords()

int interpolation::Interpolator3dGridTo3d::getNumberOfZCoords ( ) const
inline

Number of z coordinates in the grid.

Definition at line 171 of file Interpolator3dGridTo3d.h.

References coordinates_m, and interpolation::ThreeDGrid::zSize().

Here is the call graph for this function:

◆ getPointDimension()

unsigned int interpolation::Interpolator3dGridTo3d::getPointDimension ( ) const
inlinevirtual

Dimension of input points.

Implements interpolation::VectorMap.

Definition at line 175 of file Interpolator3dGridTo3d.h.

◆ getValueDimension()

unsigned int interpolation::Interpolator3dGridTo3d::getValueDimension ( ) const
inlinevirtual

Dimension of output values.

Implements interpolation::VectorMap.

Definition at line 179 of file Interpolator3dGridTo3d.h.

◆ setAll()

void interpolation::Interpolator3dGridTo3d::setAll ( ThreeDGrid grid,
double ***  Bx,
double ***  By,
double ***  Bz,
interpolationAlgorithm  algo = TRILINEAR 
)

Set function and mesh data.

Definition at line 56 of file Interpolator3dGridTo3d.cpp.

References interpolation::ThreeDGrid::add(), coordinates_m, interpolator_m, interpolation::ThreeDGrid::remove(), and TRILINEAR.

Referenced by Interpolator3dGridTo3d().

Here is the call graph for this function:

◆ setGrid()

void interpolation::Interpolator3dGridTo3d::setGrid ( ThreeDGrid grid)
inline

Reset the mesh.

Removes reference to this from mesh smart pointer if appropriate

Definition at line 187 of file Interpolator3dGridTo3d.h.

References interpolation::ThreeDGrid::add(), coordinates_m, and interpolation::ThreeDGrid::remove().

Here is the call graph for this function:

◆ setX()

void interpolation::Interpolator3dGridTo3d::setX ( int  nCoords,
double *  x 
)
inline

Set x coordinates in the mesh to an arbitrary set of points.

If mesh is nullptr, does nothing

Definition at line 194 of file Interpolator3dGridTo3d.h.

References coordinates_m, and interpolation::ThreeDGrid::setX().

Here is the call graph for this function:

◆ setY()

void interpolation::Interpolator3dGridTo3d::setY ( int  nCoords,
double *  y 
)
inline

Set y coordinates in the mesh to an arbitrary set of points.

If mesh is nullptr, does nothing

Definition at line 199 of file Interpolator3dGridTo3d.h.

References coordinates_m, and interpolation::ThreeDGrid::setY().

Here is the call graph for this function:

◆ setZ()

void interpolation::Interpolator3dGridTo3d::setZ ( int  nCoords,
double *  z 
)
inline

Set z coordinates in the mesh to an arbitrary set of points.

If mesh is nullptr, does nothing

Definition at line 204 of file Interpolator3dGridTo3d.h.

References coordinates_m, and interpolation::ThreeDGrid::setZ().

Here is the call graph for this function:

Member Data Documentation

◆ coordinates_m

ThreeDGrid* interpolation::Interpolator3dGridTo3d::coordinates_m
protected

◆ interpolator_m

Interpolator3dGridTo1d* interpolation::Interpolator3dGridTo3d::interpolator_m[3]
protected

Definition at line 160 of file Interpolator3dGridTo3d.h.

Referenced by clear(), function(), Interpolator3dGridTo3d(), and setAll().


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