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

Returns interpolated value at x from parallel arrays. More...

#include <assert.h>
#include <cfloat>
#include <iostream>
#include <iomanip>
#include <vector>
#include "cme.h"

Go to the source code of this file.

Functions

double dGetInterpolatedValue (vector< double > const *pVdXdata, vector< double > const *pVdYdata, double dX, bool bExtrapolate)
 
double dGetInterpolatedValue (vector< int > const *pVnXdata, vector< double > const *pVdYdata, int nX, bool bExtrapolate)
 
int nFindIndex (vector< double > const *pVdX, double const dValueIn)
 This is used by VdInterpolateCShoreProfileOutput, it returns the index of the value in pVdX which is less than or equal to the absolute difference between dValueIn and the pVdX value.
 
vector< double > VdInterpolateCShoreProfileOutput (vector< double > const *pVdX, vector< double > const *pVdY, vector< double > const *pVdXNew)
 Returns a linearly interpolated vector of doubles, to make CShore profile output compatible with CME. The array pVdY has been output by CShore and so always has length CSHOREARRAYOUTSIZE, whereas all other arrays have sizes which depend on CME at runtime.
 

Detailed Description

Returns interpolated value at x from parallel arrays.

TODO 001 A more detailed description of these routines.

Author
Modified by David Favis-Mortlock and Andres Payo
Date
2025

Definition in file interpolate.cpp.

Function Documentation

◆ dGetInterpolatedValue() [1/2]

double dGetInterpolatedValue ( vector< double > const * pVdXdata,
vector< double > const * pVdYdata,
double dX,
bool bExtrapolate )

From https://cplusplus.com/forum/general/216928/ Returns interpolated value at x from parallel arrays (VdXdata, VdYdata). Assumes that VdXdata has at least two elements, is sorted and is strictly monotonically increasing. The boolean argument extrapolate determines behaviour beyond ends of array (if needed). For this version, both lots of data are doubles

Definition at line 36 of file interpolate.cpp.

Referenced by CSimulation::dLookUpErosionPotential(), CSimulation::InterpolateWaveHeightToCoastPoints(), and CSimulation::WriteLookUpData().

◆ dGetInterpolatedValue() [2/2]

double dGetInterpolatedValue ( vector< int > const * pVnXdata,
vector< double > const * pVdYdata,
int nX,
bool bExtrapolate )

From https://cplusplus.com/forum/general/216928/ Returns interpolated value at x from parallel arrays (VdXdata, VdYdata). Assumes that VdXdata has at least two elements, is sorted and is strictly monotonically increasing. The boolean argument extrapolate determines behaviour beyond ends of array (if needed). For this version, one lot of data is integer and the other is double

Definition at line 73 of file interpolate.cpp.

◆ nFindIndex()

int nFindIndex ( vector< double > const * pVdX,
double const dValueIn )

This is used by VdInterpolateCShoreProfileOutput, it returns the index of the value in pVdX which is less than or equal to the absolute difference between dValueIn and the pVdX value.

Definition at line 107 of file interpolate.cpp.

Referenced by VdInterpolateCShoreProfileOutput().

◆ VdInterpolateCShoreProfileOutput()

vector< double > VdInterpolateCShoreProfileOutput ( vector< double > const * pVdX,
vector< double > const * pVdY,
vector< double > const * pVdXNew )

Returns a linearly interpolated vector of doubles, to make CShore profile output compatible with CME. The array pVdY has been output by CShore and so always has length CSHOREARRAYOUTSIZE, whereas all other arrays have sizes which depend on CME at runtime.

Definition at line 129 of file interpolate.cpp.