xmsinterp  1.0
xms::NodalFuncImpl Class Reference

Implementation of NodalFunc. More...

Inheritance diagram for xms::NodalFuncImpl:
xms::NodalFunc

Classes

class  NfThread
 Threading class to compute nodal functions in parallel. More...
 

Public Types

enum  { NF_CONSTANT, NF_GRAD_PLANE, NF_QUADRATIC }
 Nodal function type enumeration.
 

Public Member Functions

 NodalFuncImpl (const std::vector< Pt3d > &a_pts, const std::vector< float > &a_scalar)
 this constructor is only used with testing More...
 
 NodalFuncImpl (int a_type, bool a_2d, BSHP< GmPtSearch > a_ptSearch, const std::vector< Pt3d > &a_pts, const std::vector< float > &a_scalar, int a_nNearest, bool a_quad_oct, double a_power, bool a_modifiedShepardWeights, BSHP< Observer > a_p, InterpNatNeigh *a_natNeigh)
 Constructor. More...
 
virtual double ScalarFromPtIdx (int a_ptIdx, const Pt3d &a_loc) const override
 Computes gradients at each point for use in the interpolation process. More...
 
virtual void GradientFromPtIdx (int a_ptIdx, Pt3d &a_grad) const override
 Fills in the gradient. More...
 
virtual void ComputeNodalFuncs () override
 Computes gradients at each point for use in the interpolation process.
 
virtual std::string ToString () const override
 Write the internals to a string. More...
 
virtual int GetType () const override
 get the nodal function type 1 = gradient plane, 2 = quadratic More...
 
virtual int GetNearestPointsOption () const override
 get the nearest points option 0 = nearest points, 1 = natural neighbors More...
 
virtual int GetNumNearestPoints () const override
 get the number of nearest points used in the nodal function calculation More...
 
virtual bool GetUseModifiedShepardWeights () const override
 get the option for using Modified Shepard Weights More...
 
virtual bool GetUseQuadrantSearch () const override
 get the option for using a quadrant (octant in 3d) search for the nearest points More...
 
void NfForPt (int a_ptIdx, BSHP< GmPtSearch > a_s, std::vector< int > &nearestPts, std::vector< InterpPtInfo > &matrixPts, std::vector< double > &d2, std::vector< double > &w)
 Computes the nodal function for this point. More...
 
void NodalFuncForPtFromMatrixPts (int a_ptIdx, const std::vector< InterpPtInfo > &a_pts)
 Computes the nodal function for this point. More...
 
void NodalFunc2d (int a_ptIdx, const std::vector< InterpPtInfo > &a_pts, double *a_A)
 Computes the matrix for the passed in point. More...
 
void NodalFunc3d (int a_ptIdx, const std::vector< InterpPtInfo > &a_pts, double *a_A)
 Computes the matrix for the passed in point. More...
 
Pt3d ComputeGradientForPoint (int a_ptIdx, const std::vector< InterpPtInfo > &a_pts)
 Computes the gradient for this point. More...
 
- Public Member Functions inherited from xms::NodalFunc
virtual ~NodalFunc ()
 Destructor.
 

Public Attributes

bool m_2d
 flag for computing distances in xy instead of xyz
 
int m_type
 1 gradient plane, 2 quadratic
 
int m_nNearest
 number of nearest points to consider in calculations
 
bool m_quadOct
 flag for performing quadrant(2d) or octant (3d) searching for nearest pts
 
const std::vector< Pt3d > & m_pts
 Points used to interpolate.
 
const std::vector< float > & m_scalar
 Scalars at the points used to interpolate.
 
BSHP< GmPtSearch > m_ptSearch
 Class used to find nearest points.
 
std::vector< Pt3dm_gradient
 Calculated gradient coefficients at each point.
 
VecDbl2d m_quadratic
 Calculated quadratic coefficients at each point.
 
double m_power
 exponent used with inverse distance (1/d^m_power)
 
bool m_modifiedShepardWeights
 
std::vector< int > m_nearestAll
 convenience variable when all points are used in calculation
 
BSHP< Observerm_prog
 Observer that reports status of interpolation process.
 
bool m_errorReport
 flag for reporting errors
 
bool m_debugTest
 
InterpNatNeighm_natNeigh
 

Additional Inherited Members

- Static Public Member Functions inherited from xms::NodalFunc
static BSHP< NodalFuncNew (int a_type, bool a_2d, boost::shared_ptr< GmPtSearch > a_ptSearch, const std::vector< Pt3d > &a_pts, const std::vector< float > &a_scalar, int a_nNearest, bool a_quad_oct, double a_power, bool a_modifiedShepardWeights, boost::shared_ptr< Observer > a_p, InterpNatNeigh *a_natNeigh)
 Creates a NodalFunc class. More...
 
- Protected Member Functions inherited from xms::NodalFunc
 NodalFunc ()
 Constructor.
 

Detailed Description

Implementation of NodalFunc.

Definition at line 48 of file NodalFunc.cpp.

Constructor & Destructor Documentation

◆ NodalFuncImpl() [1/2]

xms::NodalFuncImpl::NodalFuncImpl ( const std::vector< Pt3d > &  a_pts,
const std::vector< float > &  a_scalar 
)

this constructor is only used with testing

Parameters
[in]a_ptsThe points at which nodal functions are calculated
[in]a_scalarThe scalar at the points

Definition at line 226 of file NodalFunc.cpp.

◆ NodalFuncImpl() [2/2]

xms::NodalFuncImpl::NodalFuncImpl ( int  a_type,
bool  a_2d,
BSHP< GmPtSearch >  a_ptSearch,
const std::vector< Pt3d > &  a_pts,
const std::vector< float > &  a_scalar,
int  a_nNearest,
bool  a_quad_oct,
double  a_power,
bool  a_modifiedShepardWeights,
BSHP< Observer a_p,
InterpNatNeigh a_natNeigh 
)

Constructor.

Parameters
[in]a_typeThe type of nodal function (gradient/quadratic)
[in]a_2dFlag to indicate that only xy and not xyz is considered
[in]a_ptSearchSpatial index for searching points
[in]a_ptsThe points at which nodal functions are calculated
[in]a_scalarThe scalar at the points
[in]a_nNearestThe number of nearest points to consider when calculating nodal functions
[in]a_quad_octFlag to do searching for nearest points based on quadrants (2d) or octants (3d)
[in]a_powerExponent used when calculating weights for nearest points (1/d^a_power)
[in]a_modifiedShepardWeightsFlag for calculating weights using the modified shepard's approach
[in]a_pObserver that reports status of interpolation process
[in]a_natNeighPointer to a Natural neighbor interpolator. Used if nearest points are found using natural neighbors.

Definition at line 263 of file NodalFunc.cpp.

References ComputeNodalFuncs(), m_gradient, m_nearestAll, m_nNearest, m_pts, m_quadratic, m_scalar, and m_type.

Member Function Documentation

◆ ComputeGradientForPoint()

Pt3d xms::NodalFuncImpl::ComputeGradientForPoint ( int  a_ptIdx,
const std::vector< InterpPtInfo > &  a_pts 
)

Computes the gradient for this point.

Parameters
[in]a_ptIdxIndex of the point where calculation occurs
[in]a_ptsVector of information of the nearest n points to a_ptIdx
Returns
The gradient at this location.

Definition at line 458 of file NodalFunc.cpp.

References xmlog::error, m_2d, m_debugTest, m_errorReport, m_pts, m_scalar, NodalFunc2d(), xms::Pt3< T >::x, XM_LOG, xms::Pt3< T >::y, and xms::Pt3< T >::z.

Referenced by NodalFuncForPtFromMatrixPts(), and NodalFuncUnitTests::testComputeGradientForPoint().

◆ GetNearestPointsOption()

virtual int xms::NodalFuncImpl::GetNearestPointsOption ( ) const
inlineoverridevirtual

get the nearest points option 0 = nearest points, 1 = natural neighbors

Returns
the nearest points option

Definition at line 115 of file NodalFunc.cpp.

References m_natNeigh.

◆ GetNumNearestPoints()

virtual int xms::NodalFuncImpl::GetNumNearestPoints ( ) const
inlineoverridevirtual

get the number of nearest points used in the nodal function calculation

Returns
the number of nearest points

Definition at line 123 of file NodalFunc.cpp.

References m_nNearest.

◆ GetType()

virtual int xms::NodalFuncImpl::GetType ( ) const
inlineoverridevirtual

get the nodal function type 1 = gradient plane, 2 = quadratic

Returns
the nodal function type

Definition at line 112 of file NodalFunc.cpp.

References m_type.

◆ GetUseModifiedShepardWeights()

virtual bool xms::NodalFuncImpl::GetUseModifiedShepardWeights ( ) const
inlineoverridevirtual

get the option for using Modified Shepard Weights

Returns
the option for using Modified Shepard Weights

Definition at line 126 of file NodalFunc.cpp.

References m_modifiedShepardWeights.

◆ GetUseQuadrantSearch()

virtual bool xms::NodalFuncImpl::GetUseQuadrantSearch ( ) const
inlineoverridevirtual

get the option for using a quadrant (octant in 3d) search for the nearest points

Returns
the option for using a quadrant

Definition at line 129 of file NodalFunc.cpp.

References m_quadOct.

◆ GradientFromPtIdx()

void xms::NodalFuncImpl::GradientFromPtIdx ( int  a_ptIdx,
Pt3d a_grad 
) const
overridevirtual

Fills in the gradient.

Parameters
[in]a_ptIdxPoint index to find the calculated gradient
[out]a_gradGradient value filled by this method.

Definition at line 589 of file NodalFunc.cpp.

References m_gradient.

◆ NfForPt()

void xms::NodalFuncImpl::NfForPt ( int  a_ptIdx,
BSHP< GmPtSearch >  s,
std::vector< int > &  nearestPts,
std::vector< InterpPtInfo > &  matrixPts,
std::vector< double > &  d2,
std::vector< double > &  w 
)

Computes the nodal function for this point.

Parameters
[in]a_ptIdxIndex of the point where calculation occurs
[in]sSpatial index for searching points
[out]nearestPtsVector of point indexes nearest to a_ptIdx
[out]matrixPtsVector of information about the nearest points to a_ptIdx
[out]d2Vector of distance squared for each nearest point to a_ptIdx
[out]wVector of weights for each nearest point to a_ptIdx

Definition at line 344 of file NodalFunc.cpp.

References xms::inDistanceSquared(), xms::inIdwWeights(), m_2d, m_modifiedShepardWeights, m_natNeigh, m_nearestAll, m_nNearest, m_power, m_pts, m_quadOct, m_scalar, and NodalFuncForPtFromMatrixPts().

Referenced by ComputeNodalFuncs(), and xms::NodalFuncImpl::NfThread::Worker().

◆ NodalFunc2d()

void xms::NodalFuncImpl::NodalFunc2d ( int  a_ptIdx,
const std::vector< InterpPtInfo > &  a_pts,
double *  a_A 
)

Computes the matrix for the passed in point.

Parameters
[in]a_ptIdxIndex of the point where calculation occurs
[in]a_ptsVector of information of the nearest n points to a_ptIdx
[out]a_AMatrix that is calculated by this method

Definition at line 406 of file NodalFunc.cpp.

References xmlog::error, xms::inNodalFuncSetUpMatrixAndVector(), m_errorReport, m_pts, m_scalar, xms::Pt3< T >::x, XM_LOG, and xms::Pt3< T >::y.

Referenced by ComputeGradientForPoint(), and NodalFuncForPtFromMatrixPts().

◆ NodalFunc3d()

void xms::NodalFuncImpl::NodalFunc3d ( int  a_ptIdx,
const std::vector< InterpPtInfo > &  a_pts,
double *  a_A 
)

Computes the matrix for the passed in point.

Parameters
[in]a_ptIdxIndex of the point where calculation occurs
[in]a_ptsVector of information of the nearest n points to a_ptIdx
[out]a_AMatrix that is calculated by this method

Definition at line 432 of file NodalFunc.cpp.

References xmlog::error, xms::inNodalFuncSetUpMatrixAndVector3d(), m_errorReport, m_pts, m_scalar, xms::Pt3< T >::x, XM_LOG, xms::Pt3< T >::y, and xms::Pt3< T >::z.

Referenced by NodalFuncForPtFromMatrixPts().

◆ NodalFuncForPtFromMatrixPts()

void xms::NodalFuncImpl::NodalFuncForPtFromMatrixPts ( int  a_ptIdx,
const std::vector< InterpPtInfo > &  a_pts 
)

Computes the nodal function for this point.

Parameters
[in]a_ptIdxIndex of the point where calculation occurs
[in]a_ptsVector of information of the nearest n points to a_ptIdx

Definition at line 383 of file NodalFunc.cpp.

References ComputeGradientForPoint(), m_2d, m_gradient, m_quadratic, m_type, NodalFunc2d(), and NodalFunc3d().

Referenced by NfForPt().

◆ ScalarFromPtIdx()

double xms::NodalFuncImpl::ScalarFromPtIdx ( int  a_ptIdx,
const Pt3d a_loc 
) const
overridevirtual

Computes gradients at each point for use in the interpolation process.

Parameters
[in]a_ptIdxIndex of the point where nodal function coefficients and scalar is used to return a modified scalar based on nodal function.
[in]a_locThe location being interpolated to
Returns
Modified scalar value at a_ptIdx based on the nodal function.

Definition at line 542 of file NodalFunc.cpp.

References m_2d, m_gradient, m_pts, m_quadratic, m_scalar, m_type, xms::Pt3< T >::x, xms::Pt3< T >::y, and xms::Pt3< T >::z.

◆ ToString()

std::string xms::NodalFuncImpl::ToString ( ) const
overridevirtual

Write the internals to a string.

Returns
The string.

Definition at line 598 of file NodalFunc.cpp.

References m_2d, m_debugTest, m_errorReport, m_gradient, m_modifiedShepardWeights, m_nearestAll, m_nNearest, m_power, m_pts, m_quadOct, m_quadratic, m_scalar, m_type, and VecToStream().

Member Data Documentation

◆ m_debugTest

bool xms::NodalFuncImpl::m_debugTest

flag used for testing error reporting

Definition at line 158 of file NodalFunc.cpp.

Referenced by ComputeGradientForPoint(), and ToString().

◆ m_modifiedShepardWeights

bool xms::NodalFuncImpl::m_modifiedShepardWeights

flag for calculating weights using a the modified shepard's approach

Definition at line 153 of file NodalFunc.cpp.

Referenced by GetUseModifiedShepardWeights(), NfForPt(), and ToString().

◆ m_natNeigh

InterpNatNeigh* xms::NodalFuncImpl::m_natNeigh

Pointer to a Natural neighbor interpolator. Used if nearest points are found using natural neighbors.

Definition at line 161 of file NodalFunc.cpp.

Referenced by GetNearestPointsOption(), and NfForPt().


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