xmsinterp
1.0
|
Implementation of NodalFunc. More...
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< Pt3d > | m_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< Observer > | m_prog |
Observer that reports status of interpolation process. | |
bool | m_errorReport |
flag for reporting errors | |
bool | m_debugTest |
InterpNatNeigh * | m_natNeigh |
Additional Inherited Members | |
Static Public Member Functions inherited from xms::NodalFunc | |
static BSHP< NodalFunc > | New (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. | |
Implementation of NodalFunc.
Definition at line 48 of file NodalFunc.cpp.
xms::NodalFuncImpl::NodalFuncImpl | ( | const std::vector< Pt3d > & | a_pts, |
const std::vector< float > & | a_scalar | ||
) |
this constructor is only used with testing
[in] | a_pts | The points at which nodal functions are calculated |
[in] | a_scalar | The scalar at the points |
Definition at line 226 of file NodalFunc.cpp.
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.
[in] | a_type | The type of nodal function (gradient/quadratic) |
[in] | a_2d | Flag to indicate that only xy and not xyz is considered |
[in] | a_ptSearch | Spatial index for searching points |
[in] | a_pts | The points at which nodal functions are calculated |
[in] | a_scalar | The scalar at the points |
[in] | a_nNearest | The number of nearest points to consider when calculating nodal functions |
[in] | a_quad_oct | Flag to do searching for nearest points based on quadrants (2d) or octants (3d) |
[in] | a_power | Exponent used when calculating weights for nearest points (1/d^a_power) |
[in] | a_modifiedShepardWeights | Flag for calculating weights using the modified shepard's approach |
[in] | a_p | Observer that reports status of interpolation process |
[in] | a_natNeigh | Pointer 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.
Pt3d xms::NodalFuncImpl::ComputeGradientForPoint | ( | int | a_ptIdx, |
const std::vector< InterpPtInfo > & | a_pts | ||
) |
Computes the gradient for this point.
[in] | a_ptIdx | Index of the point where calculation occurs |
[in] | a_pts | Vector of information of the nearest n points to a_ptIdx |
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().
|
inlineoverridevirtual |
get the nearest points option 0 = nearest points, 1 = natural neighbors
Definition at line 115 of file NodalFunc.cpp.
References m_natNeigh.
|
inlineoverridevirtual |
get the number of nearest points used in the nodal function calculation
Definition at line 123 of file NodalFunc.cpp.
References m_nNearest.
|
inlineoverridevirtual |
get the nodal function type 1 = gradient plane, 2 = quadratic
Definition at line 112 of file NodalFunc.cpp.
References m_type.
|
inlineoverridevirtual |
get the option for using Modified Shepard Weights
Definition at line 126 of file NodalFunc.cpp.
References m_modifiedShepardWeights.
|
inlineoverridevirtual |
get the option for using a quadrant (octant in 3d) search for the nearest points
Definition at line 129 of file NodalFunc.cpp.
References m_quadOct.
|
overridevirtual |
Fills in the gradient.
[in] | a_ptIdx | Point index to find the calculated gradient |
[out] | a_grad | Gradient value filled by this method. |
Definition at line 589 of file NodalFunc.cpp.
References m_gradient.
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.
[in] | a_ptIdx | Index of the point where calculation occurs |
[in] | s | Spatial index for searching points |
[out] | nearestPts | Vector of point indexes nearest to a_ptIdx |
[out] | matrixPts | Vector of information about the nearest points to a_ptIdx |
[out] | d2 | Vector of distance squared for each nearest point to a_ptIdx |
[out] | w | Vector 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().
void xms::NodalFuncImpl::NodalFunc2d | ( | int | a_ptIdx, |
const std::vector< InterpPtInfo > & | a_pts, | ||
double * | a_A | ||
) |
Computes the matrix for the passed in point.
[in] | a_ptIdx | Index of the point where calculation occurs |
[in] | a_pts | Vector of information of the nearest n points to a_ptIdx |
[out] | a_A | Matrix 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().
void xms::NodalFuncImpl::NodalFunc3d | ( | int | a_ptIdx, |
const std::vector< InterpPtInfo > & | a_pts, | ||
double * | a_A | ||
) |
Computes the matrix for the passed in point.
[in] | a_ptIdx | Index of the point where calculation occurs |
[in] | a_pts | Vector of information of the nearest n points to a_ptIdx |
[out] | a_A | Matrix 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().
void xms::NodalFuncImpl::NodalFuncForPtFromMatrixPts | ( | int | a_ptIdx, |
const std::vector< InterpPtInfo > & | a_pts | ||
) |
Computes the nodal function for this point.
[in] | a_ptIdx | Index of the point where calculation occurs |
[in] | a_pts | Vector 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().
|
overridevirtual |
Computes gradients at each point for use in the interpolation process.
[in] | a_ptIdx | Index of the point where nodal function coefficients and scalar is used to return a modified scalar based on nodal function. |
[in] | a_loc | The location being interpolated to |
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.
|
overridevirtual |
Write the internals to a 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().
bool xms::NodalFuncImpl::m_debugTest |
flag used for testing error reporting
Definition at line 158 of file NodalFunc.cpp.
Referenced by ComputeGradientForPoint(), and ToString().
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().
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().