CoastalME (Coastal Modelling Environment)
Simulates the long-term behaviour of complex coastlines
Loading...
Searching...
No Matches
DualSpatialInterpolator Class Reference

#include <spatial_interpolation.h>

Public Member Functions

 DualSpatialInterpolator (std::vector< Point2D > const &points, std::vector< double > const &values_x, std::vector< double > const &values_y, int k_neighbors=12, double power=2.0)
 
 ~DualSpatialInterpolator ()
 
void Interpolate (std::vector< Point2D > const &query_points, std::vector< double > &results_x, std::vector< double > &results_y) const
 

Private Member Functions

void InterpolatePoint (double x, double y, double &result_x, double &result_y, std::vector< unsigned int > &indices, std::vector< double > &sq_dists) const
 

Private Attributes

PointCloud m_cloud
 
std::vector< double > m_values_x
 
std::vector< double > m_values_y
 
KDTreem_kdtree
 
int m_k_neighbors
 
double m_power
 

Static Private Attributes

static constexpr double EPSILON = 1e-10
 

Detailed Description

Definition at line 129 of file spatial_interpolation.h.

Constructor & Destructor Documentation

◆ DualSpatialInterpolator()

DualSpatialInterpolator::DualSpatialInterpolator ( std::vector< Point2D > const & points,
std::vector< double > const & values_x,
std::vector< double > const & values_y,
int k_neighbors = 12,
double power = 2.0 )

DualSpatialInterpolator: Optimized interpolation for paired X/Y values

This class is optimized for interpolating wave properties that have both X and Y components (e.g., wave height X and wave height Y). It's more efficient than using two separate interpolators because:

  1. Builds only ONE k-d tree (shared for both X and Y)
  2. Does ONE nearest neighbor search per query point (not two)
  3. Interpolates both components simultaneously

USAGE:

DualSpatialInterpolator interp(points, values_x, values_y, 12, 2.0); interp.Interpolate(query_points, results_x, results_y); Constructor: Build dual interpolator for X and Y values

Parameters
pointsInput point coordinates (x, y)
values_xX-component values at those points
values_yY-component values at those points
k_neighborsNumber of nearest neighbors to use (default: 12)
powerIDW power parameter (default: 2.0)

Definition at line 267 of file spatial_interpolation.cpp.

◆ ~DualSpatialInterpolator()

DualSpatialInterpolator::~DualSpatialInterpolator ( )

Definition at line 288 of file spatial_interpolation.cpp.

Member Function Documentation

◆ Interpolate()

void DualSpatialInterpolator::Interpolate ( std::vector< Point2D > const & query_points,
std::vector< double > & results_x,
std::vector< double > & results_y ) const

◆ InterpolatePoint()

void DualSpatialInterpolator::InterpolatePoint ( double x,
double y,
double & result_x,
double & result_y,
std::vector< unsigned int > & indices,
std::vector< double > & sq_dists ) const
private

Definition at line 293 of file spatial_interpolation.cpp.

Referenced by Interpolate().

Field Documentation

◆ EPSILON

double DualSpatialInterpolator::EPSILON = 1e-10
staticconstexprprivate

Definition at line 153 of file spatial_interpolation.h.

Referenced by InterpolatePoint().

◆ m_cloud

PointCloud DualSpatialInterpolator::m_cloud
private

Definition at line 146 of file spatial_interpolation.h.

Referenced by DualSpatialInterpolator(), Interpolate(), and InterpolatePoint().

◆ m_k_neighbors

int DualSpatialInterpolator::m_k_neighbors
private

Definition at line 150 of file spatial_interpolation.h.

Referenced by DualSpatialInterpolator(), Interpolate(), and InterpolatePoint().

◆ m_kdtree

KDTree* DualSpatialInterpolator::m_kdtree
private

◆ m_power

double DualSpatialInterpolator::m_power
private

Definition at line 151 of file spatial_interpolation.h.

Referenced by DualSpatialInterpolator(), and InterpolatePoint().

◆ m_values_x

std::vector<double> DualSpatialInterpolator::m_values_x
private

Definition at line 147 of file spatial_interpolation.h.

Referenced by DualSpatialInterpolator(), and InterpolatePoint().

◆ m_values_y

std::vector<double> DualSpatialInterpolator::m_values_y
private

Definition at line 148 of file spatial_interpolation.h.

Referenced by DualSpatialInterpolator(), and InterpolatePoint().


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