xmsinterp  1.0
xms::InterpLinearImpl Class Reference

Implementation of InterpLinear. More...

Inheritance diagram for xms::InterpLinearImpl:
xms::InterpLinear xms::InterpBase

Public Member Functions

virtual void SetPtsTris (BSHP< VecPt3d > a_, BSHP< VecInt > a_tris) override
 Adds the triangles to the class. More...
 
virtual void SetScalars (const float *a_scalar, size_t a_n) override
 Set the scalars that will be used to interpolate from. More...
 
virtual void SetScalars (BSHP< VecFlt > a_scalar) override
 Set the scalars that will be used to interpolate from. More...
 
virtual void SetPtActivity (DynBitset &a_activity) override
 Modifies the activity bitset of the class. More...
 
virtual void SetTriActivity (DynBitset &a_activity) override
 Modifies the activity bitset of the class. More...
 
virtual const BSHP< VecPt3dGetPts () const override
 Returns shared pointer to points vector. More...
 
virtual const BSHP< VecIntGetTris () const override
 Returns shared pointer to triangles vector. More...
 
virtual const BSHP< VecFltGetScalars () const override
 Returns shared pointer to scalars vector. More...
 
virtual DynBitset GetPtActivity () const override
 Returns bitset of point activity. More...
 
virtual DynBitset GetTriActivity () const override
 Returns bitset of triangle activity. More...
 
virtual VecInt GetExtrapolationPointIndexes () const override
 Returns vector of point indexes for points that were outside of all triangles. More...
 
virtual float InterpToPt (const Pt3d &a_pt) override
 Use the stored triangles to interpolate to a point. Returns extrapolation value if the point is outside the triangles. More...
 
float InterpToPtImpl (const Pt3d &a_pt, int a_ptIdx)
 Use the stored triangles to interpolate to a point. Returns extrapolation value if the point is outside the triangles. More...
 
virtual void InterpToPts (const VecPt3d &a_pts, VecFlt &a_scalars) override
 Calls InterpToPt in a loop. More...
 
virtual int TriContainingPt (const Pt3d &a_pt) override
 Find the triangle containing the point. More...
 
virtual void TriEnvelopsContainingPt (const Pt3d &a_pt, VecInt &a_tris) override
 Find all triangles whose envelop contains the point. More...
 
virtual bool InterpWeights (const Pt3d &a_pt, VecInt &a_idxs, VecDbl &a_wts) override
 Use the stored triangles to get interpolation weights for a point. Returns false if the point is outside the triangles. More...
 
float CloughTocherInterp (VecInt &a_idxs, const Pt3d &a_pt)
 uses Clough Tocher interpolation method to get the interpolated val More...
 
float NatNeighInterp (const Pt3d &a_pt)
 uses Natural Neighbor interpolation method to get the interpolated val More...
 
virtual void SetExtrapVal (double a_val) override
 Set the constant extrapolation value. More...
 
virtual void SetTrunc (double a_sMax, double a_sMin) override
 Set the truncation values for the interpolation and turn on truncation. More...
 
virtual void SetUseCloughTocher (bool a_, BSHP< Observer > a_prog) override
 Set the class to use the Clough Tocher interpolation method. This is a legacy feature from GMS. Compare to linear. More...
 
virtual void SetUseNatNeigh (bool a_, int a_nodalFunc, int a_ndFuncOpt, int a_ndFuncNumNearestPts, bool a_blendWeights, BSHP< Observer > a_prog) override
 Set the class to use natural neighbor (NN) interpolation. More...
 
virtual double GetExtrapVal () const override
 get extrapolation value More...
 
virtual bool GetTruncateInterpolatedValues () const override
 get the option to truncate interpolated values More...
 
virtual double GetTruncMin () const override
 get minimum truncation value More...
 
virtual double GetTruncMax () const override
 get the maximum truncation value More...
 
virtual bool GetUseCloughTocher () const override
 get the option for using Clough Tocher interpolation More...
 
virtual bool GetUseNatNeigh () const override
 get the option for using Natural Neighbor interpolation More...
 
virtual int GetNatNeighNodalFunc () const override
 get the value for the Natural Neighbor nodal function More...
 
virtual int GetNatNeighNodalFuncNearestPtsOption () const override
 get the option for the Natural Neighbor nodal function nearest points. Nearest points or nearest natural neighbors. More...
 
virtual int GetNatNeighNodalFuncNumNearestPts () const override
 get the value for the number of nearest points to use when calculating the nodal function More...
 
virtual bool GetNatNeighBlendWeights () const override
 get the option for blending weights when using Natural Neighbor More...
 
BSHP< GmPtSearch > CreatePtSearch ()
 Creates a GmPtSearch class to be used for nodal function generation. More...
 
void RecalcNodalFunc ()
 Resets some members of the class.
 
virtual std::string ToString () const override
 Write the internals to a string. More...
 

Protected Attributes

BSHP< GmTriSearch > m_triSearch
 spatial index for searching triangles
 
BSHP< VecPt3dm_pts
 pt locations that make up triangles
 
BSHP< VecIntm_tris
 triangles referencing indexes of pts
 
BSHP< VecFltm_scalar
 Scalars we're interpolating from.
 
double m_extrap
 Extrapolation value.
 
bool m_trunc
 flag to indicate if truncation is on
 
double m_truncMax
 Maximum truncation value. All interpolated values will be <=.
 
double m_truncMin
 Minimum truncation value. All interpolated values will be >=.
 
bool m_cloughTocher
 flag indicating clough tocher interpolation will be used
 
bool m_natNeigh
 flag indicating that natural neighbor interpolation will be used
 
BSHP< NodalFuncm_nodal
 Nodal function (constant, gradient plane, quadratic)
 
BSHP< InterpCtm_ct
 Clough Tocher interpolation class.
 
BSHP< InterpNatNeighm_nn
 Natural neighbor interpolation class.
 
VecInt m_extrapolationPointIndexes
 indexes of points that are outside of all triangles
 

Additional Inherited Members

- Static Public Member Functions inherited from xms::InterpLinear
static BSHP< InterpLinearNew ()
 Creates an TriSearch class. More...
 

Detailed Description

Implementation of InterpLinear.

Linear interpolation from a set of triangles Uses the boost RTree for queries.

Definition at line 50 of file InterpLinear.cpp.

Member Function Documentation

◆ CloughTocherInterp()

float xms::InterpLinearImpl::CloughTocherInterp ( VecInt a_idxs,
const Pt3d a_pt 
)

uses Clough Tocher interpolation method to get the interpolated val

Parameters
a_idxsIndices to the points that form the triangle that a_pt is inside of.
a_ptLocation that is interpolated to.
Returns
Interpolated value at a_pt.

Definition at line 436 of file InterpLinear.cpp.

References m_ct.

Referenced by InterpToPtImpl().

◆ CreatePtSearch()

BSHP< GmPtSearch > xms::InterpLinearImpl::CreatePtSearch ( )

Creates a GmPtSearch class to be used for nodal function generation.

Returns
GmPtSearch.

Definition at line 545 of file InterpLinear.cpp.

References m_pts, and m_triSearch.

Referenced by SetUseCloughTocher(), and SetUseNatNeigh().

◆ GetExtrapolationPointIndexes()

VecInt xms::InterpLinearImpl::GetExtrapolationPointIndexes ( ) const
overridevirtual

Returns vector of point indexes for points that were outside of all triangles.

Returns
Returns vector of points indexes

Definition at line 322 of file InterpLinear.cpp.

References m_extrapolationPointIndexes.

Referenced by InterpLinearUnitTests::testOneTriangle().

◆ GetExtrapVal()

virtual double xms::InterpLinearImpl::GetExtrapVal ( ) const
inlineoverridevirtual

get extrapolation value

Returns
the extrapolation value

Definition at line 95 of file InterpLinear.cpp.

References m_extrap.

◆ GetNatNeighBlendWeights()

virtual bool xms::InterpLinearImpl::GetNatNeighBlendWeights ( ) const
inlineoverridevirtual

get the option for blending weights when using Natural Neighbor

Returns
the option for blending weights when using Natural Neighbor

Definition at line 139 of file InterpLinear.cpp.

References m_nodal.

◆ GetNatNeighNodalFunc()

virtual int xms::InterpLinearImpl::GetNatNeighNodalFunc ( ) const
inlineoverridevirtual

get the value for the Natural Neighbor nodal function

Returns
the value for the Natural Neighbor nodal function

Definition at line 113 of file InterpLinear.cpp.

References m_nodal.

◆ GetNatNeighNodalFuncNearestPtsOption()

virtual int xms::InterpLinearImpl::GetNatNeighNodalFuncNearestPtsOption ( ) const
inlineoverridevirtual

get the option for the Natural Neighbor nodal function nearest points. Nearest points or nearest natural neighbors.

Returns
the option for the Natural Neighbor nodal function nearest points.

Definition at line 122 of file InterpLinear.cpp.

References m_nodal.

◆ GetNatNeighNodalFuncNumNearestPts()

virtual int xms::InterpLinearImpl::GetNatNeighNodalFuncNumNearestPts ( ) const
inlineoverridevirtual

get the value for the number of nearest points to use when calculating the nodal function

Returns
the value for the number of nearest points

Definition at line 131 of file InterpLinear.cpp.

References m_nodal.

◆ GetPtActivity()

DynBitset xms::InterpLinearImpl::GetPtActivity ( ) const
overridevirtual

Returns bitset of point activity.

Returns
Returns bitset of point activity

Definition at line 305 of file InterpLinear.cpp.

References m_triSearch.

◆ GetPts()

const BSHP< VecPt3d > xms::InterpLinearImpl::GetPts ( ) const
overridevirtual

Returns shared pointer to points vector.

Returns
Shared pointer to points vector.

Definition at line 281 of file InterpLinear.cpp.

References m_pts.

◆ GetScalars()

const BSHP< VecFlt > xms::InterpLinearImpl::GetScalars ( ) const
overridevirtual

Returns shared pointer to scalars vector.

Returns
Shared pointer to scalars vector.

Definition at line 297 of file InterpLinear.cpp.

References m_scalar.

◆ GetTriActivity()

DynBitset xms::InterpLinearImpl::GetTriActivity ( ) const
overridevirtual

Returns bitset of triangle activity.

Returns
Returns bitset of triangle activity

Definition at line 313 of file InterpLinear.cpp.

References m_triSearch.

◆ GetTris()

const BSHP< VecInt > xms::InterpLinearImpl::GetTris ( ) const
overridevirtual

Returns shared pointer to triangles vector.

Returns
Shared pointer to triangles vector.

Definition at line 289 of file InterpLinear.cpp.

References m_tris.

◆ GetTruncateInterpolatedValues()

virtual bool xms::InterpLinearImpl::GetTruncateInterpolatedValues ( ) const
inlineoverridevirtual

get the option to truncate interpolated values

Returns
the option to truncate interpolated values

Definition at line 98 of file InterpLinear.cpp.

References m_trunc.

◆ GetTruncMax()

virtual double xms::InterpLinearImpl::GetTruncMax ( ) const
inlineoverridevirtual

get the maximum truncation value

Returns
the maximum truncation value

Definition at line 104 of file InterpLinear.cpp.

References m_truncMax.

◆ GetTruncMin()

virtual double xms::InterpLinearImpl::GetTruncMin ( ) const
inlineoverridevirtual

get minimum truncation value

Returns
the minimum truncation value

Definition at line 101 of file InterpLinear.cpp.

References m_truncMin.

◆ GetUseCloughTocher()

virtual bool xms::InterpLinearImpl::GetUseCloughTocher ( ) const
inlineoverridevirtual

get the option for using Clough Tocher interpolation

Returns
the option for using Clough Tocher interpolation

Definition at line 107 of file InterpLinear.cpp.

References m_cloughTocher.

◆ GetUseNatNeigh()

virtual bool xms::InterpLinearImpl::GetUseNatNeigh ( ) const
inlineoverridevirtual

get the option for using Natural Neighbor interpolation

Returns
the option for using Natural Neighbor interpolation

Definition at line 110 of file InterpLinear.cpp.

References m_natNeigh.

◆ InterpToPt()

float xms::InterpLinearImpl::InterpToPt ( const Pt3d a_pt)
overridevirtual

Use the stored triangles to interpolate to a point. Returns extrapolation value if the point is outside the triangles.

Parameters
a_ptLocation that is interpolated to.
Returns
Interpolated value at a_pt.

Definition at line 332 of file InterpLinear.cpp.

References InterpToPtImpl().

Referenced by InterpLinearUnitTests::testCt(), InterpLinearUnitTests::testInterp(), and InterpLinearUnitTests::testOneTriangle().

◆ InterpToPtImpl()

float xms::InterpLinearImpl::InterpToPtImpl ( const Pt3d a_pt,
int  a_ptIdx 
)

Use the stored triangles to interpolate to a point. Returns extrapolation value if the point is outside the triangles.

Parameters
a_ptLocation that is interpolated to.
a_ptIdxpoint index
Returns
Interpolated value at a_pt.

Definition at line 343 of file InterpLinear.cpp.

References CloughTocherInterp(), EQ_TOL(), m_cloughTocher, m_extrap, m_extrapolationPointIndexes, m_natNeigh, m_triSearch, m_trunc, m_truncMax, m_truncMin, and NatNeighInterp().

Referenced by InterpToPt(), and InterpToPts().

◆ InterpToPts()

void xms::InterpLinearImpl::InterpToPts ( const VecPt3d a_pts,
VecFlt a_scalars 
)
overridevirtual

Calls InterpToPt in a loop.

Parameters
a_ptsLocations of points.
a_scalarsInterpolated scalar values at a_pts.

Definition at line 388 of file InterpLinear.cpp.

References InterpToPtImpl(), and m_extrapolationPointIndexes.

Referenced by InterpLinearUnitTests::testOneTriangle().

◆ InterpWeights()

bool xms::InterpLinearImpl::InterpWeights ( const Pt3d a_pt,
VecInt a_idxs,
VecDbl a_wts 
)
overridevirtual

Use the stored triangles to get interpolation weights for a point. Returns false if the point is outside the triangles.

Parameters
a_ptLocation that is interpolated to.
a_idxsVector of triangle point indices filled in by this method.
a_wtsVector of triangle point weights filled in by this method.
Returns
false if a_pt is not inside of any triangle

Definition at line 425 of file InterpLinear.cpp.

References m_triSearch.

◆ NatNeighInterp()

float xms::InterpLinearImpl::NatNeighInterp ( const Pt3d a_pt)

uses Natural Neighbor interpolation method to get the interpolated val

Parameters
a_ptLocation that is interpolated to.
Returns
Interpolated value at a_pt.

Definition at line 447 of file InterpLinear.cpp.

References m_nn.

Referenced by InterpToPtImpl().

◆ SetExtrapVal()

void xms::InterpLinearImpl::SetExtrapVal ( double  a_val)
overridevirtual

Set the constant extrapolation value.

Parameters
a_valThe value assigned to extrapolated points

Definition at line 455 of file InterpLinear.cpp.

References m_extrap.

Referenced by InterpLinearUnitTests::testOneTriangle().

◆ SetPtActivity()

void xms::InterpLinearImpl::SetPtActivity ( DynBitset a_activity)
overridevirtual

Modifies the activity bitset of the class.

Parameters
a_activitybitset of the activity of the points

Definition at line 263 of file InterpLinear.cpp.

References m_triSearch, and RecalcNodalFunc().

◆ SetPtsTris()

void xms::InterpLinearImpl::SetPtsTris ( BSHP< VecPt3d a_pts,
BSHP< VecInt a_tris 
)
overridevirtual

Adds the triangles to the class.

Parameters
a_ptsArray of point locations.
a_trisArray of triangles that references the a_pts array. This array will have a size that is a multiple of 3. The first 3 locations in array represent the first triangle and will have indices that correspond to locations in the a_pts array.

Definition at line 229 of file InterpLinear.cpp.

References m_pts, m_scalar, m_tris, and m_triSearch.

Referenced by InterpLinearUnitTests::testCt(), InterpLinearUnitTests::testInterp(), and InterpLinearUnitTests::testOneTriangle().

◆ SetScalars() [1/2]

void xms::InterpLinearImpl::SetScalars ( const float *  a_scalar,
size_t  a_n 
)
overridevirtual

Set the scalars that will be used to interpolate from.

Parameters
a_scalarArray of interpolation scalar values.
a_nSize of the array a_scalar.

Definition at line 243 of file InterpLinear.cpp.

References m_pts, m_scalar, RecalcNodalFunc(), and XM_ENSURE_TRUE.

◆ SetScalars() [2/2]

void xms::InterpLinearImpl::SetScalars ( BSHP< VecFlt a_scalar)
overridevirtual

Set the scalars that will be used to interpolate from.

Parameters
a_scalarArray of interpolation scalar values.

Definition at line 253 of file InterpLinear.cpp.

References m_pts, m_scalar, RecalcNodalFunc(), and XM_ENSURE_TRUE.

◆ SetTriActivity()

void xms::InterpLinearImpl::SetTriActivity ( DynBitset a_activity)
overridevirtual

Modifies the activity bitset of the class.

Parameters
a_activitybitset of the activity of the triangles

Definition at line 272 of file InterpLinear.cpp.

References m_triSearch, and RecalcNodalFunc().

◆ SetTrunc()

void xms::InterpLinearImpl::SetTrunc ( double  a_sMax,
double  a_sMin 
)
overridevirtual

Set the truncation values for the interpolation and turn on truncation.

Parameters
a_sMaxThe maximum value for truncation.
a_sMinThe minimum value for truncation.

Definition at line 465 of file InterpLinear.cpp.

References m_trunc, m_truncMax, and m_truncMin.

Referenced by InterpLinearUnitTests::testCt().

◆ SetUseCloughTocher()

void xms::InterpLinearImpl::SetUseCloughTocher ( bool  a_,
BSHP< Observer a_prog 
)
overridevirtual

Set the class to use the Clough Tocher interpolation method. This is a legacy feature from GMS. Compare to linear.

Parameters
a_True/False to indicate if CT should be used.
a_progProgress bar to give users feed back on the set up process of CT. If you have a really large set of triangles this may take some time.

Definition at line 478 of file InterpLinear.cpp.

References CreatePtSearch(), xms::inAllScalarsEqual(), m_cloughTocher, m_ct, m_nodal, m_pts, m_scalar, m_triSearch, and xms::NodalFunc::New().

Referenced by InterpLinearUnitTests::testCt().

◆ SetUseNatNeigh()

void xms::InterpLinearImpl::SetUseNatNeigh ( bool  a_,
int  a_nodalFunc,
int  a_ndFuncOpt,
int  a_ndFuncNumNearestPts,
bool  a_blendWeights,
BSHP< Observer a_prog 
)
overridevirtual

Set the class to use natural neighbor (NN) interpolation.

Parameters
a_True/False to indicate if NN should be used.
a_nodalFuncIndicates which nodal function to use.
a_ndFuncOptIndicates options for the nearest points when computing the nodal functions.
a_ndFuncNumNearestPtsThe number of nearest points for nodal function computation.
a_blendWeightsOption to use a blending function on the calculated weights.
a_progProgress bar to give user feedback for generation of the nodal functions.

Definition at line 510 of file InterpLinear.cpp.

References CreatePtSearch(), xms::inAllScalarsEqual(), m_natNeigh, m_nn, m_nodal, m_pts, m_scalar, m_tris, m_triSearch, xms::InterpNatNeigh::New(), and xms::NodalFunc::New().

◆ ToString()

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

Write the internals to a string.

Returns
The string.

Definition at line 567 of file InterpLinear.cpp.

References m_cloughTocher, m_ct, m_extrap, m_natNeigh, m_nn, m_nodal, m_pts, m_scalar, m_tris, m_triSearch, m_trunc, m_truncMax, m_truncMin, and VecToStream().

◆ TriContainingPt()

int xms::InterpLinearImpl::TriContainingPt ( const Pt3d a_pt)
overridevirtual

Find the triangle containing the point.

Parameters
a_ptLocation used to find a triangle.
Returns
Index of triangle containing a_pt. If XM_NONE is returned then no triangle contained the point.

Definition at line 404 of file InterpLinear.cpp.

References m_triSearch.

◆ TriEnvelopsContainingPt()

void xms::InterpLinearImpl::TriEnvelopsContainingPt ( const Pt3d a_pt,
VecInt a_tris 
)
overridevirtual

Find all triangles whose envelop contains the point.

Parameters
a_ptLocation used to find a triangle.
a_trisThe indices to triangles whose envelop contains the point

Definition at line 413 of file InterpLinear.cpp.

References m_triSearch.


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