OPALX (Object Oriented Parallel Accelerator Library for Exascal) MINIorX
OPALX
interpolation::PPSolveFactory Class Reference

PPSolveFactory solves the system of linear equations to interpolate from a grid of points using higher order polynomials, creating a PolynomialPatch object. The order of the polynomial is user-defined. More...

#include <PPSolveFactory.h>

Collaboration diagram for interpolation::PPSolveFactory:

Public Member Functions

 PPSolveFactory (Mesh *points, std::vector< std::vector< double > > values, int polyPatchOrder, int smoothingOrder)
 ~PPSolveFactory ()
PolynomialPatchsolve ()

Static Public Member Functions

static std::vector< std::vector< int > > getNearbyPointsSquares (int pointDim, int polyOrderLower, int polyOrderUpper)

Private Member Functions

void getPoints ()
void getValues (Mesh::Iterator it)
void getDerivPoints ()
void getDerivs (const Mesh::Iterator &it)
std::vector< double > outOfBoundsPosition (Mesh::Iterator outOfBoundsIt)
PolynomialCoefficient getDeltaIterator (Mesh::Iterator it1, Mesh::Iterator it2, int valueIndex)

Static Private Member Functions

static void nearbyPointsRecursive (std::vector< int > check, size_t checkIndex, size_t polyPower, std::vector< std::vector< int > > &nearbyPoints)

Private Attributes

int polyPatchOrder_m
int smoothingOrder_m
int polyDim_m
int valueDim_m
MeshpolyMesh_m
Meshpoints_m
std::vector< std::vector< double > > values_m
std::vector< SquarePolynomialVector * > polynomials_m
std::vector< std::vector< double > > thisPoints_m
std::vector< std::vector< double > > thisValues_m
std::vector< std::vector< double > > derivPoints_m
std::vector< std::vector< double > > derivValues_m
std::vector< std::vector< int > > derivOrigins_m
std::vector< std::vector< int > > derivIndices_m
std::vector< MVector< double > > derivPolyVec_m
std::vector< std::vector< std::vector< int > > > edgePoints_m
std::vector< std::vector< int > > smoothingPoints_m

Detailed Description

PPSolveFactory solves the system of linear equations to interpolate from a grid of points using higher order polynomials, creating a PolynomialPatch object. The order of the polynomial is user-defined.

The PPSolveFactory can be used to match nearby points for smoothing or for straight fitting.

PPSolveFactory generates polynomials on a grid that is at the centre point of each of the mesh squares; PPSolveFactory picks nearby points in a square around the PPSolveFactory, picked by getNearbyPointsSquares. Two sets of points are chosen; the nearest points are used for fitting; smoothing is performed by choosing the points on the edge of the grid, and smoothing to derivatives on these points.

Because we work in a square grid, we have matching polynomials and derivatives; so e.g. 2D points are (0, 0), (1, 0), (0, 1), (1, 1) so corresponding polynomial coefficients that we solve for are x^0 y^0, x^1 y^0, x^0 y^1, x^1 y^1; note that hence we define "first order" to be all terms with no single x/y vector power > 1; i.e. "first order" in x OR first order in y, etc. We allow products so long as the maximum power in any one dimension <= 1

The PPSolveFactory sits on top of SolveFactory; PPSolveFactory has the job of picking values and derivatives for fitting, SolveFactory then does the actual solve for each individual polynomial.

Definition at line 65 of file PPSolveFactory.h.

Constructor & Destructor Documentation

◆ PPSolveFactory()

interpolation::PPSolveFactory::PPSolveFactory ( Mesh * points,
std::vector< std::vector< double > > values,
int polyPatchOrder,
int smoothingOrder )

Constructor

Parameters
pointsSet of points on which values are stored. Must be a rectangular grid. PPSolveFactory takes ownership of points (will delete on exit). The solve will return a wrong answer if the grid does not have regular spacing.
valuesSet of values to which we fit. Must be one value per mesh point and each value must have the same size.
polyPatchOrderThe order of the fitted part of the polynomial.
smoothingOrderThe total order of the fitted and the smoothed part of the polynomial. Smoothing order should always be >= polyPatchOrder. So for example if polyPatchOrder is 2 and smoothing order is 2, we get a 2nd order function with no derivative matching. If polyPatchOrder is 2 and smoothing order is 3, we get a 3rd order function with derivative matching in first order at two mesh points from the centre.

Definition at line 63 of file PPSolveFactory.cpp.

References derivIndices_m, derivPoints_m, derivValues_m, interpolation::Mesh::dual(), edgePoints_m, interpolation::Mesh::end(), getNearbyPointsSquares(), interpolation::Mesh::getPositionDimension(), points_m, polyDim_m, polyMesh_m, polynomials_m, polyPatchOrder_m, smoothingOrder_m, smoothingPoints_m, thisPoints_m, thisValues_m, interpolation::Mesh::Iterator::toInteger(), and values_m.

Here is the call graph for this function:

◆ ~PPSolveFactory()

interpolation::PPSolveFactory::~PPSolveFactory ( )
inline

Destructor deletes points_

Definition at line 91 of file PPSolveFactory.h.

Member Function Documentation

◆ getDeltaIterator()

PolynomialCoefficient interpolation::PPSolveFactory::getDeltaIterator ( Mesh::Iterator it1,
Mesh::Iterator it2,
int valueIndex )
private

◆ getDerivPoints()

void interpolation::PPSolveFactory::getDerivPoints ( )
private

Definition at line 185 of file PPSolveFactory.cpp.

References derivIndices_m, derivOrigins_m, derivPoints_m, derivPolyVec_m, edgePoints_m, interpolation::SquarePolynomialVector::IndexByPower(), interpolation::SquarePolynomialVector::NumberOfPolynomialCoefficients(), points_m, polyPatchOrder_m, smoothingOrder_m, and smoothingPoints_m.

Referenced by solve().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getDerivs()

void interpolation::PPSolveFactory::getDerivs ( const Mesh::Iterator & it)
private

Definition at line 242 of file PPSolveFactory.cpp.

References derivIndices_m, derivOrigins_m, derivPoints_m, derivPolyVec_m, derivValues_m, interpolation::Mesh::end(), interpolation::Mesh::Iterator::getMesh(), interpolation::Mesh::Iterator::getPosition(), interpolation::Mesh::Iterator::getState(), polyDim_m, polynomials_m, polyPatchOrder_m, smoothingOrder_m, and interpolation::Mesh::Iterator::toInteger().

Referenced by solve().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getNearbyPointsSquares()

std::vector< std::vector< int > > interpolation::PPSolveFactory::getNearbyPointsSquares ( int pointDim,
int polyOrderLower,
int polyOrderUpper )
static

Get nearby points in a square pattern

Get nearby points at least poly_order_lower distance away and less than poly_order_upper distance away; e.g. getNearbyPointsSquares(2, 4, 6) will get nearby points on a 2D grid at least 4 grid points and at most 6 grid points, like:

x x x o o x ... x x x o o x x x x o o x o o o o o x o o o o o x x x x x x x ...

Definition at line 347 of file PPSolveFactory.cpp.

References nearbyPointsRecursive().

Referenced by getPoints(), getValues(), PPSolveFactory(), and interpolation::SolveFactory::SolveFactory().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getPoints()

void interpolation::PPSolveFactory::getPoints ( )
private

Definition at line 141 of file PPSolveFactory.cpp.

References getNearbyPointsSquares(), points_m, polyPatchOrder_m, and thisPoints_m.

Referenced by solve().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getValues()

void interpolation::PPSolveFactory::getValues ( Mesh::Iterator it)
private

Definition at line 156 of file PPSolveFactory.cpp.

References end(), getNearbyPointsSquares(), interpolation::Mesh::Iterator::getState(), points_m, polyPatchOrder_m, thisValues_m, interpolation::Mesh::Iterator::toInteger(), and values_m.

Referenced by solve().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ nearbyPointsRecursive()

void interpolation::PPSolveFactory::nearbyPointsRecursive ( std::vector< int > check,
size_t checkIndex,
size_t polyPower,
std::vector< std::vector< int > > & nearbyPoints )
staticprivate

Definition at line 330 of file PPSolveFactory.cpp.

References nearbyPointsRecursive().

Referenced by getNearbyPointsSquares(), and nearbyPointsRecursive().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ outOfBoundsPosition()

std::vector< double > interpolation::PPSolveFactory::outOfBoundsPosition ( Mesh::Iterator outOfBoundsIt)
private

Definition at line 116 of file PPSolveFactory.cpp.

References interpolation::Mesh::begin(), end(), interpolation::Mesh::end(), interpolation::Mesh::Iterator::getMesh(), interpolation::Mesh::Iterator::getPosition(), and interpolation::Mesh::Iterator::getState().

Here is the call graph for this function:

◆ solve()

PolynomialPatch * interpolation::PPSolveFactory::solve ( )

Solve the system of equations to generate a PolynomialPatch object.

Returns a PolynomialPatch object, caller owns the returned memory.

Definition at line 296 of file PPSolveFactory.cpp.

References begin(), derivIndices_m, derivPoints_m, derivValues_m, end(), getDerivPoints(), getDerivs(), getPoints(), getValues(), gmsg, points_m, polyDim_m, polyMesh_m, polynomials_m, interpolation::SolveFactory::PolynomialSolve(), smoothingOrder_m, thisPoints_m, and thisValues_m.

Referenced by SectorMagneticFieldMap::IO::getInterpolatorPolyPatch().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ derivIndices_m

std::vector< std::vector<int> > interpolation::PPSolveFactory::derivIndices_m
private

Definition at line 151 of file PPSolveFactory.h.

Referenced by getDerivPoints(), getDerivs(), PPSolveFactory(), and solve().

◆ derivOrigins_m

std::vector< std::vector<int> > interpolation::PPSolveFactory::derivOrigins_m
private

Definition at line 150 of file PPSolveFactory.h.

Referenced by getDerivPoints(), and getDerivs().

◆ derivPoints_m

std::vector< std::vector<double> > interpolation::PPSolveFactory::derivPoints_m
private

Definition at line 148 of file PPSolveFactory.h.

Referenced by getDerivPoints(), getDerivs(), PPSolveFactory(), and solve().

◆ derivPolyVec_m

std::vector< MVector<double> > interpolation::PPSolveFactory::derivPolyVec_m
private

Definition at line 152 of file PPSolveFactory.h.

Referenced by getDerivPoints(), and getDerivs().

◆ derivValues_m

std::vector< std::vector<double> > interpolation::PPSolveFactory::derivValues_m
private

Definition at line 149 of file PPSolveFactory.h.

Referenced by getDerivs(), PPSolveFactory(), and solve().

◆ edgePoints_m

std::vector<std::vector<std::vector<int> > > interpolation::PPSolveFactory::edgePoints_m
private

Definition at line 154 of file PPSolveFactory.h.

Referenced by getDerivPoints(), and PPSolveFactory().

◆ points_m

Mesh* interpolation::PPSolveFactory::points_m
private

Definition at line 142 of file PPSolveFactory.h.

Referenced by getDerivPoints(), getPoints(), getValues(), PPSolveFactory(), and solve().

◆ polyDim_m

int interpolation::PPSolveFactory::polyDim_m
private

Definition at line 139 of file PPSolveFactory.h.

Referenced by getDerivs(), PPSolveFactory(), and solve().

◆ polyMesh_m

Mesh* interpolation::PPSolveFactory::polyMesh_m
private

Definition at line 141 of file PPSolveFactory.h.

Referenced by PPSolveFactory(), and solve().

◆ polynomials_m

std::vector<SquarePolynomialVector*> interpolation::PPSolveFactory::polynomials_m
private

Definition at line 144 of file PPSolveFactory.h.

Referenced by getDerivs(), PPSolveFactory(), and solve().

◆ polyPatchOrder_m

int interpolation::PPSolveFactory::polyPatchOrder_m
private

Definition at line 137 of file PPSolveFactory.h.

Referenced by getDerivPoints(), getDerivs(), getPoints(), getValues(), and PPSolveFactory().

◆ smoothingOrder_m

int interpolation::PPSolveFactory::smoothingOrder_m
private

Definition at line 138 of file PPSolveFactory.h.

Referenced by getDerivPoints(), getDerivs(), PPSolveFactory(), and solve().

◆ smoothingPoints_m

std::vector< std::vector<int> > interpolation::PPSolveFactory::smoothingPoints_m
private

Definition at line 155 of file PPSolveFactory.h.

Referenced by getDerivPoints(), and PPSolveFactory().

◆ thisPoints_m

std::vector< std::vector<double> > interpolation::PPSolveFactory::thisPoints_m
private

Definition at line 146 of file PPSolveFactory.h.

Referenced by getPoints(), PPSolveFactory(), and solve().

◆ thisValues_m

std::vector< std::vector<double> > interpolation::PPSolveFactory::thisValues_m
private

Definition at line 147 of file PPSolveFactory.h.

Referenced by getValues(), PPSolveFactory(), and solve().

◆ valueDim_m

int interpolation::PPSolveFactory::valueDim_m
private

Definition at line 140 of file PPSolveFactory.h.

◆ values_m

std::vector<std::vector<double> > interpolation::PPSolveFactory::values_m
private

Definition at line 143 of file PPSolveFactory.h.

Referenced by getValues(), and PPSolveFactory().


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