Overture  Version 25
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Friends | List of all members
InterpolatePointsOnAGrid Class Reference

#include <InterpolatePointsOnAGrid.h>

Collaboration diagram for InterpolatePointsOnAGrid:
Collaboration graph
[legend]

Public Types

enum  InterpolationStatusEnum { notInterpolated =0, extrapolated =1, interpolated =2 }
 
enum  { defaultNumberOfValidGhostPoints =-123456, interpolateAllGhostPoints =-234567 }
 
enum  ExplicitInterpolationStorageOptionEnum { precomputeAllCoefficients, precomputeSomeCoefficients, precomputeNoCoefficients }
 
enum  InterpolationTypeEnum { implicitInterpolation =0, explicitInterpolation }
 

Public Member Functions

 InterpolatePointsOnAGrid ()
 
 ~InterpolatePointsOnAGrid ()
 
int getMaximumRefinementLevelToInterpolate () const
 return the maximum refinement level to interpolate
 
int getNumberBackupInterpolation () const
 : return the number of points that were interpolated with backup rules (i.e. using a lower than
 
int getNumberExtrapolated () const
 : return the number of points that were extrapolated.
 
int getNumberInterpolated () const
 : return the number of points that were interpolated with the full interpolation width.
 
int getNumberUnassigned () const
 : return the number of points that were not assigned.
 
int getTotalNumberOfPointsAssigned (int grid)
 : Return the total number of points that are interpolate from a grid (sum across all processors).
 
int interpolatePoints (const RealArray &positionToInterpolate, const realCompositeGridFunction &u, RealArray &uInterpolated, const Range &R0=nullRange, const Range &R1=nullRange, const Range &R2=nullRange, const Range &R3=nullRange, const Range &R4=nullRange)
 
int interpolationCoefficients (const CompositeGrid &cg, RealArray &uInterpolationCoeff)
 
int interpolateAllPoints (const realCompositeGridFunction &uFrom, realCompositeGridFunction &uTo, const Range &componentsFrom=nullRange, const Range &componentsTo=nullRange, const int numberOfGhostPointsToInterpolate=interpolateAllGhostPoints)
 
int interpolateAllPoints (const realCompositeGridFunction &uFrom, realMappedGridFunction &uTo, const Range &componentsFrom=nullRange, const Range &componentsTo=nullRange, const int numberOfGhostPointsToInterpolate=interpolateAllGhostPoints)
 
int buildInterpolationInfo (const RealArray &positionToInterpolate, CompositeGrid &cg, RealArray *projectedPoints=NULL, IntegerArray *checkTheseGrids=NULL)
 
int interpolatePoints (const realCompositeGridFunction &u, RealArray &uInterpolated, const Range &R0=nullRange, const Range &R1=nullRange, const Range &R2=nullRange, const Range &R3=nullRange, const Range &R4=nullRange)
 
const IntegerArraygetStatus () const
 
int getInterpolationInfo (CompositeGrid &cg, IntegerArray &indexValues, IntegerArray &interpoleeGrid) const
 
int setAssignAllPoints (bool trueOrFalse=true)
 : Specify whether all points should be assigned, using extrapolation if necessary.
 
real sizeOf (FILE *file=NULL) const
 
int setExplicitInterpolationStorageOption (ExplicitInterpolationStorageOptionEnum option)
 
int setInfoLevel (int info)
 
int setInterpolationWidth (int width)
 : Set the width the interpolation stencil.
 
int setInterpolationOffset (real widthInGridLines)
 
int setInterpolationType (InterpolationTypeEnum interpType)
 
int setMaximumRefinementLevelToInterpolate (int maxLevelToInterpolate)
 Only interpolate grids on refinement levels that are less than or equal to a given level.
 
int setNumberOfValidGhostPoints (int numValidGhost=defaultNumberOfValidGhostPoints)
 : Set the number of valid ghost points that can be used when interpolating from a grid function
 

Static Public Member Functions

static int findNearestValidGridPoint (CompositeGrid &cg, const RealArray &x, IntegerArray &il, RealArray &ci)
 Find the nearest valid grid point on a CompositeGrid to given points in space, x(i,.). A valid point is one with mask(i1,i2,i3)!=0 . NOTE: This function currently assumes that the points x(i,.) could NOT interpolate and so we are finding the best guess for points that are outside the grid.
 
static int getInterpolationStencil (MappedGrid &mg, const int width, const real *rv, int *iv)
 Return the lower left corner of the interpolation stencil. (input) : interpolation stencil width (input) : rv[axis] : unit cube coordinates of the point (output) : iv[axis] : lower left corner of the stencil.
 

Static Public Attributes

static int debug =0
 

Protected Member Functions

int parallelInterpolate (RealArray &ui, const realCompositeGridFunction &u, const Range &C0=nullRange, const Range &C1=nullRange, const Range &C2=nullRange)
 Interpolate points.
 
int parallelSetup (CompositeGrid &cg, const RealArray &xp, const IntegerArray &numberOfInterpolationPoints, const RealArray *interpolationCoordinates, const IntegerArray *indirection, const IntegerArray *interpolationLocation, const IntegerArray *variableInterpolationWidth)
 Setup routine for the parallel interpolation of a list of points.
 
int initializeExplicitInterpolation (CompositeGrid &cg)
 
int internalInterpolate (RealArray &ui, const realCompositeGridFunction &u, const Range &C0, const Range &C1, const Range &C2)
 
int parallelInternalInterpolate (RealArray &ui, const realCompositeGridFunction &u, const Range &C0, const Range &C1, const Range &C2)
 Interpolate points.
 
int destroy ()
 

Protected Attributes

int interpolationIsInitialized
 
int numberOfBackupInterpolation
 
int numberOfExtrapolated
 
int numberOfInterpolated
 
int numberOfUnassigned
 
IntegerArrayindirection
 
IntegerArrayinterpolationLocation
 
IntegerArrayvariableInterpolationWidth
 
RealArrayinterpolationCoordinates
 
IntegerArray numberOfInterpolationPoints
 
IntegerArray status
 
real interpolationOffset
 
int interpolationWidth
 
InterpolationTypeEnum interpolationType
 
int infoLevel
 
int numberOfValidGhostPoints
 
bool assignAllPoints
 
int totalNumToInterpolate
 
IntegerArraypInterpAllIndirection
 
int * numToInterpolatePerGrid
 
FILE * logFile
 
FILE * plogFile
 
FILE * debugFile
 
ExplicitInterpolationStorageOptionEnum explicitInterpolationStorageOption
 
int numberOfDimensions
 
int numberOfComponentGrids
 
int numberOfBaseGrids
 
int maxInterpolationWidth
 
int coeffWidthDimension
 
int maximumRefinementLevelToInterpolate
 
SparseArray< int > nila
 
SparseArray< int > nipa
 
SparseArray< int * > ila
 
SparseArray< int * > ipa
 
SparseArray< real * > cia
 
SparseArray< real * > coeffa
 
int npr
 
int nps
 
int * pMapr
 
int * pMaps
 
bool allGridsHaveLocalData
 
bool onlyAmrGridsHaveLocalData
 
bool noGridsHaveLocalData
 
int POGI_COMM
 

Friends

class InterfaceTransfer
 

Member Enumeration Documentation

anonymous enum
Enumerator
defaultNumberOfValidGhostPoints 
interpolateAllGhostPoints 
Enumerator
precomputeAllCoefficients 
precomputeSomeCoefficients 
precomputeNoCoefficients 
Enumerator
notInterpolated 
extrapolated 
interpolated 
Enumerator
implicitInterpolation 
explicitInterpolation 

Constructor & Destructor Documentation

InterpolatePointsOnAGrid::InterpolatePointsOnAGrid ( )
InterpolatePointsOnAGrid::~InterpolatePointsOnAGrid ( )

Member Function Documentation

int InterpolatePointsOnAGrid::buildInterpolationInfo ( const RealArray positionToInterpolate,
CompositeGrid cg,
RealArray projectedPoints = NULL,
IntegerArray checkTheseGrids = NULL 
)

References assert, assignAllPoints, bb, Mapping::bogus, MappedGrid::boundingBox(), boundingBox, CanInterpolate::canInterpolate(), CI, ci, D, debug, delta, destroy(), dimension, MappedGrid::dimension(), discretizationWidth, display(), explicitInterpolation, extendedGridIndexRange(), extrapolated, fabs(), findNearestValidGridPoint(), getCPU(), MappedGrid::getGridType(), MappingRC::getMapping(), ParallelUtility::getMaxValue(), MappingProjectionParameters::getRealArray(), ParallelUtility::getSum(), MappedGrid::gridIndexRange(), gridSpacing, MappedGrid::gridSpacing(), ia, IA, IA0, CanInterpolate::CanInterpolateQueryData::id, IL, il, indexRange, MappedGrid::indexRange(), indirection, infoLevel, initializeExplicitInterpolation(), interpolationCoordinates, interpolationIsInitialized, interpolationLocation, interpolationOffset, CompositeGrid::interpolationOverlap, interpolationType, interpolationWidth, CompositeGrid::interpolationWidth, Mapping::inverseMap(), Mapping::inverseMapS(), ip, IP, MappedGrid::isAllVertexCentered(), isPeriodic, MappedGrid::isPeriodic(), logFile, MappedGrid::mapping(), mask, MappedGrid::mask(), max(), maxInterpolationWidth, notInterpolated, npr, nps, NULL, Overture::nullRealDistributedArray(), numberOfBackupInterpolation, numberOfBaseGrids, GenericGridCollection::numberOfBaseGrids(), numberOfComponentGrids, GenericGridCollection::numberOfComponentGrids(), numberOfDimensions, GridCollection::numberOfDimensions(), numberOfExtrapolated, numberOfInterpolated, numberOfInterpolationPoints, NUMBEROFINTERPOLATIONPOINTS, numberOfUnassigned, numberOfValidGhostPoints, OV_ABORT, parallelSetup(), plogFile, printF(), Mapping::project(), Mapping::projectS(), MappingProjectionParameters::r, R, RA, ra, rbb, REAL_EPSILON, RPROJECT, sPrintF(), status, STATUS, MappedGrid::THEboundingBox, MappedGrid::THEcenter, MappedGrid::THEvertex, GenericGrid::unstructuredGrid, CompositeGrid::update(), variableInterpolationWidth, viw, X, x, and XA.

Referenced by displayValuesAtAPoint(), ExposedPoints::interpolate(), interpolateAllPoints(), and interpolatePoints().

int InterpolatePointsOnAGrid::destroy ( )
protected
int InterpolatePointsOnAGrid::findNearestValidGridPoint ( CompositeGrid cg,
const RealArray x,
IntegerArray il,
RealArray ci 
)
static

Find the nearest valid grid point on a CompositeGrid to given points in space, x(i,.). A valid point is one with mask(i1,i2,i3)!=0 . NOTE: This function currently assumes that the points x(i,.) could NOT interpolate and so we are finding the best guess for points that are outside the grid.

Parameters
cg(input) : CompositeGrid to check for closest valid point.
x(input) : x(i,0:r-1) (r=rangeDimension) list of points to check (in parallel, each processor provides its own set of points).
il(output) : il(i,0:r) = (donor,i1,i2,i3) donor grid and index location of the closest valid point.
ci(output) : ci(i,0:r-1) are the r-coordinates of the closest pt in the donor grid.
Returns
0 for success.

x.....

References bb, Mapping::bogus, MappedGrid::boundingBox(), boundingBox, CanInterpolate::canInterpolate(), CI, DA, debug, DISTA, Mapping::findNearestGridPoint(), getCPU(), MappingRC::getMapping(), ia, IA, IB, IL, CompositeGrid::interpolationOverlap, interpolationWidth, CompositeGrid::interpolationWidth, MappedGrid::mapping(), max(), NULL, numberOfComponentGrids, GenericGridCollection::numberOfComponentGrids(), numberOfDimensions, GridCollection::numberOfDimensions(), numberOfValidGhostPoints, plogFile, px, R, RA, ra, REAL_MAX, sPrintF(), SQR, X, XA, and XC.

Referenced by buildInterpolationInfo().

int InterpolatePointsOnAGrid::getInterpolationInfo ( CompositeGrid cg,
IntegerArray indexValues,
IntegerArray interpoleeGrid 
) const

References assert, ia, IA, interpoleeGrid, ip, IP, and NULL.

int InterpolatePointsOnAGrid::getInterpolationStencil ( MappedGrid mg,
const int  width,
const real rv,
int *  iv 
)
static

Return the lower left corner of the interpolation stencil. (input) : interpolation stencil width (input) : rv[axis] : unit cube coordinates of the point (output) : iv[axis] : lower left corner of the stencil.

References MappedGrid::boundaryCondition(), End, MappedGrid::extendedIndexRange(), MappedGrid::gridSpacing(), MappedGrid::indexRange(), MappedGrid::isCellCentered(), MappedGrid::isPeriodic(), MappedGrid::numberOfDimensions(), and Start.

int InterpolatePointsOnAGrid::getMaximumRefinementLevelToInterpolate ( ) const

return the maximum refinement level to interpolate

References maximumRefinementLevelToInterpolate.

int InterpolatePointsOnAGrid::getNumberBackupInterpolation ( ) const

: return the number of points that were interpolated with backup rules (i.e. using a lower than

: The function returns info about the last interpolation operation such as interpolateAllPoints. In parallel this value corresponds to the current processor (not the sum over all processors)

References numberOfBackupInterpolation.

int InterpolatePointsOnAGrid::getNumberExtrapolated ( ) const

: return the number of points that were extrapolated.

: The function returns info about the last interpolation operation such as interpolateAllPoints. In parallel this value corresponds to the current processor (not the sum over all processors)

References numberOfExtrapolated.

int InterpolatePointsOnAGrid::getNumberInterpolated ( ) const

: return the number of points that were interpolated with the full interpolation width.

: The function returns info about the last interpolation operation such as interpolateAllPoints. In parallel this value corresponds to the current processor (not the sum over all processors)

References numberOfInterpolated.

int InterpolatePointsOnAGrid::getNumberUnassigned ( ) const

: return the number of points that were not assigned.

: The function returns info about the last interpolation operation such as interpolateAllPoints. In parallel this value corresponds to the current processor (not the sum over all processors)

References numberOfUnassigned.

const IntegerArray & InterpolatePointsOnAGrid::getStatus ( ) const
int InterpolatePointsOnAGrid::getTotalNumberOfPointsAssigned ( int  grid)

: Return the total number of points that are interpolate from a grid (sum across all processors).

Parameters
(grid): donor grid
Returns
value : the number of points assigned or -1 means an error occured, invalid value for grid.

References ParallelUtility::getSum(), numberOfInterpolationPoints, and printF().

Referenced by ExposedPoints::interpolate().

int InterpolatePointsOnAGrid::initializeExplicitInterpolation ( CompositeGrid cg)
protected
int InterpolatePointsOnAGrid::internalInterpolate ( RealArray ui,
const realCompositeGridFunction u,
const Range &  C0,
const Range &  C1,
const Range &  C2 
)
protected
int InterpolatePointsOnAGrid::interpolateAllPoints ( const realCompositeGridFunction uFrom,
realCompositeGridFunction uTo,
const Range &  componentsFrom = nullRange,
const Range &  componentsTo = nullRange,
const int  numberOfGhostPointsToInterpolate = interpolateAllGhostPoints 
)
int InterpolatePointsOnAGrid::interpolateAllPoints ( const realCompositeGridFunction uFrom,
realMappedGridFunction uTo,
const Range &  componentsFrom = nullRange,
const Range &  componentsTo = nullRange,
const int  numberOfGhostPointsToInterpolate = interpolateAllGhostPoints 
)

References OV_ABORT.

int InterpolatePointsOnAGrid::interpolatePoints ( const RealArray positionToInterpolate,
const realCompositeGridFunction u,
RealArray uInterpolated,
const Range &  R0 = nullRange,
const Range &  R1 = nullRange,
const Range &  R2 = nullRange,
const Range &  R3 = nullRange,
const Range &  R4 = nullRange 
)
int InterpolatePointsOnAGrid::interpolatePoints ( const realCompositeGridFunction u,
RealArray uInterpolated,
const Range &  R0 = nullRange,
const Range &  R1 = nullRange,
const Range &  R2 = nullRange,
const Range &  R3 = nullRange,
const Range &  R4 = nullRange 
)
int InterpolatePointsOnAGrid::interpolationCoefficients ( const CompositeGrid cg,
RealArray uInterpolationCoeff 
)

References OV_ABORT.

int InterpolatePointsOnAGrid::parallelInternalInterpolate ( RealArray ui,
const realCompositeGridFunction u,
const Range &  C0,
const Range &  C1,
const Range &  C2 
)
protected

Interpolate points.

This routine does the actual interpolation assuming the setup has already been done.

/u (input) : grid function to interpolate /C0,C1,C2 (input) : components to interpolate are u[grid](all,all,all,C0,C1,C2) /gridsToInterpolate_(input) : only interpolate points on grids with *gridsToInterpolate_(grid)!=0 (if non-NULL) /gridsToInterpolateFrom_(input) : only interpolate points FROM donor grids with *gridsToInterpolateFrom_(grid)!=0 (if non-NULL)

References Overture::abort(), assert, axis1, axis2, axis3, c, cf, cfs, cia, ciLocal, coeffa, debug, debugFile, explicitInterpolationStorageOption, doubleGridCollectionFunction::getComponentBase(), doubleGridCollectionFunction::getComponentBound(), doubleCompositeGridFunction::getCompositeGrid(), getLocalArrayWithGhostBoundaries(), ParallelUtility::getMaxValue(), ParallelUtility::getSum(), i2, IL1, il1, IL2, IL3, ila, ip0, ipa, IW5, mask, MASK, MappedGrid::mask(), max(), maxInterpolationWidth, MPI_Real, MPI_Wtime, nila, nipa, npr, nps, NULL, nullRange, GenericGridCollectionData::numberOfBaseGrids, numberOfComponentGrids, numberOfDimensions, OV_ABORT, pMapr, POGI_COMM, precomputeAllCoefficients, printF(), q20, q21, q30, q31, q32, q40, q41, q42, q43, q50, q51, q52, q53, q54, UI, VIW, and VS.

Referenced by parallelInterpolate().

int InterpolatePointsOnAGrid::parallelInterpolate ( RealArray ui,
const realCompositeGridFunction u,
const Range &  C0 = nullRange,
const Range &  C1 = nullRange,
const Range &  C2 = nullRange 
)
protected
int InterpolatePointsOnAGrid::parallelSetup ( CompositeGrid cg,
const RealArray xp,
const IntegerArray numberOfInterpolationPoints,
const RealArray interpolationCoordinates,
const IntegerArray indirection,
const IntegerArray interpolationLocation,
const IntegerArray variableInterpolationWidth 
)
protected
int InterpolatePointsOnAGrid::setAssignAllPoints ( bool  trueOrFalse = true)

: Specify whether all points should be assigned, using extrapolation if necessary.

Parameters
trueOrFalse(input) : if true assign all points, using extrapolation if necessary. If false, there may be points left assigned that are outside the domain. : It may be more expensive to find a way to assign all points.

References assignAllPoints.

Referenced by displayValuesAtAPoint(), ExposedPoints::interpolate(), and main().

int InterpolatePointsOnAGrid::setExplicitInterpolationStorageOption ( ExplicitInterpolationStorageOptionEnum  option)
int InterpolatePointsOnAGrid::setInfoLevel ( int  info)
int InterpolatePointsOnAGrid::setInterpolationOffset ( real  widthInGridLines)

References interpolationOffset.

int InterpolatePointsOnAGrid::setInterpolationType ( InterpolationTypeEnum  interpType)

References interpolationType.

int InterpolatePointsOnAGrid::setInterpolationWidth ( int  width)

: Set the width the interpolation stencil.

References interpolationWidth.

Referenced by displayValuesAtAPoint(), ExposedPoints::interpolate(), and main().

int InterpolatePointsOnAGrid::setMaximumRefinementLevelToInterpolate ( int  maxLevelToInterpolate)

Only interpolate grids on refinement levels that are less than or equal to a given level.

This option is used by the error estimator.

References maximumRefinementLevelToInterpolate.

int InterpolatePointsOnAGrid::setNumberOfValidGhostPoints ( int  numValidGhost = defaultNumberOfValidGhostPoints)

: Set the number of valid ghost points that can be used when interpolating from a grid function

References numberOfValidGhostPoints.

Referenced by displayValuesAtAPoint(), ExposedPoints::interpolate(), and main().

real InterpolatePointsOnAGrid::sizeOf ( FILE *  file = NULL) const

Friends And Related Function Documentation

friend class InterfaceTransfer
friend

Member Data Documentation

bool InterpolatePointsOnAGrid::allGridsHaveLocalData
protected
bool InterpolatePointsOnAGrid::assignAllPoints
protected
SparseArray<real*> InterpolatePointsOnAGrid::cia
protected
SparseArray<real*> InterpolatePointsOnAGrid::coeffa
protected
int InterpolatePointsOnAGrid::coeffWidthDimension
protected
int InterpolatePointsOnAGrid::debug =0
static
FILE* InterpolatePointsOnAGrid::debugFile
protected
ExplicitInterpolationStorageOptionEnum InterpolatePointsOnAGrid::explicitInterpolationStorageOption
protected
SparseArray<int*> InterpolatePointsOnAGrid::ila
protected
IntegerArray* InterpolatePointsOnAGrid::indirection
protected
int InterpolatePointsOnAGrid::infoLevel
protected
RealArray* InterpolatePointsOnAGrid::interpolationCoordinates
protected
int InterpolatePointsOnAGrid::interpolationIsInitialized
protected
IntegerArray* InterpolatePointsOnAGrid::interpolationLocation
protected
real InterpolatePointsOnAGrid::interpolationOffset
protected
InterpolationTypeEnum InterpolatePointsOnAGrid::interpolationType
protected
int InterpolatePointsOnAGrid::interpolationWidth
protected
SparseArray<int*> InterpolatePointsOnAGrid::ipa
protected
FILE* InterpolatePointsOnAGrid::logFile
protected
int InterpolatePointsOnAGrid::maximumRefinementLevelToInterpolate
protected
int InterpolatePointsOnAGrid::maxInterpolationWidth
protected
SparseArray<int> InterpolatePointsOnAGrid::nila
protected
SparseArray<int> InterpolatePointsOnAGrid::nipa
protected
bool InterpolatePointsOnAGrid::noGridsHaveLocalData
protected
int InterpolatePointsOnAGrid::npr
protected
int InterpolatePointsOnAGrid::nps
protected
int InterpolatePointsOnAGrid::numberOfBackupInterpolation
protected
int InterpolatePointsOnAGrid::numberOfBaseGrids
protected
int InterpolatePointsOnAGrid::numberOfComponentGrids
protected
int InterpolatePointsOnAGrid::numberOfDimensions
protected
int InterpolatePointsOnAGrid::numberOfExtrapolated
protected
int InterpolatePointsOnAGrid::numberOfInterpolated
protected
IntegerArray InterpolatePointsOnAGrid::numberOfInterpolationPoints
protected
int InterpolatePointsOnAGrid::numberOfUnassigned
protected
int InterpolatePointsOnAGrid::numberOfValidGhostPoints
protected
int* InterpolatePointsOnAGrid::numToInterpolatePerGrid
protected
bool InterpolatePointsOnAGrid::onlyAmrGridsHaveLocalData
protected
IntegerArray* InterpolatePointsOnAGrid::pInterpAllIndirection
protected
FILE * InterpolatePointsOnAGrid::plogFile
protected
int* InterpolatePointsOnAGrid::pMapr
protected
int * InterpolatePointsOnAGrid::pMaps
protected
int InterpolatePointsOnAGrid::POGI_COMM
protected
IntegerArray InterpolatePointsOnAGrid::status
protected
int InterpolatePointsOnAGrid::totalNumToInterpolate
protected
IntegerArray* InterpolatePointsOnAGrid::variableInterpolationWidth
protected

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