OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
OPAL
Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
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:
Collaboration graph
[legend]

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 (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< int > derivIndexByPower_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

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 interpolation::Mesh::dual(), edgePoints_m, interpolation::Mesh::end(), getNearbyPointsSquares(), interpolation::Mesh::getPositionDimension(), polyDim_m, polyMesh_m, polyPatchOrder_m, smoothingPoints_m, and interpolation::Mesh::Iterator::toInteger().

Here is the call graph for this function:

interpolation::PPSolveFactory::~PPSolveFactory ( )
inline

Destructor deletes points_

Definition at line 91 of file PPSolveFactory.h.

Member Function Documentation

PolynomialCoefficient interpolation::PPSolveFactory::getDeltaIterator ( Mesh::Iterator  it1,
Mesh::Iterator  it2,
int  valueIndex 
)
private
void interpolation::PPSolveFactory::getDerivPoints ( )
private
void interpolation::PPSolveFactory::getDerivs ( Mesh::Iterator  it)
private
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:

void interpolation::PPSolveFactory::getPoints ( )
private

Definition at line 141 of file PPSolveFactory.cpp.

References getNearbyPointsSquares(), interpolation::Mesh::getPositionDimension(), points_m, polyPatchOrder_m, and thisPoints_m.

Referenced by solve().

Here is the call graph for this function:

void interpolation::PPSolveFactory::getValues ( Mesh::Iterator  it)
private
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.

Referenced by getNearbyPointsSquares().

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

Member Data Documentation

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

Definition at line 153 of file PPSolveFactory.h.

Referenced by getDerivPoints().

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

Definition at line 151 of file PPSolveFactory.h.

Referenced by getDerivPoints(), and solve().

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

Definition at line 150 of file PPSolveFactory.h.

Referenced by getDerivPoints(), and getDerivs().

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

Definition at line 148 of file PPSolveFactory.h.

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

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

Definition at line 152 of file PPSolveFactory.h.

Referenced by getDerivPoints(), and getDerivs().

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

Definition at line 149 of file PPSolveFactory.h.

Referenced by getDerivs(), and solve().

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

Definition at line 155 of file PPSolveFactory.h.

Referenced by getDerivPoints(), and PPSolveFactory().

Mesh* interpolation::PPSolveFactory::points_m
private

Definition at line 142 of file PPSolveFactory.h.

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

int interpolation::PPSolveFactory::polyDim_m
private

Definition at line 139 of file PPSolveFactory.h.

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

Mesh* interpolation::PPSolveFactory::polyMesh_m
private

Definition at line 141 of file PPSolveFactory.h.

Referenced by PPSolveFactory(), and solve().

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

Definition at line 144 of file PPSolveFactory.h.

Referenced by getDerivs(), and solve().

int interpolation::PPSolveFactory::polyPatchOrder_m
private

Definition at line 137 of file PPSolveFactory.h.

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

int interpolation::PPSolveFactory::smoothingOrder_m
private

Definition at line 138 of file PPSolveFactory.h.

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

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

Definition at line 156 of file PPSolveFactory.h.

Referenced by getDerivPoints(), and PPSolveFactory().

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

Definition at line 146 of file PPSolveFactory.h.

Referenced by getPoints(), and solve().

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

Definition at line 147 of file PPSolveFactory.h.

Referenced by getValues(), and solve().

int interpolation::PPSolveFactory::valueDim_m
private

Definition at line 140 of file PPSolveFactory.h.

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

Definition at line 143 of file PPSolveFactory.h.

Referenced by getValues().


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