Alexandria  2.25.0
SDC-CH common library for the Euclid project
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Public Member Functions | Public Attributes | Private Attributes | List of all members
Euclid::MathUtils::InterpNAdapter< N, _index_sequence< Is...> > Struct Template Reference
Inheritance diagram for Euclid::MathUtils::InterpNAdapter< N, _index_sequence< Is...> >:
Inheritance graph
[legend]
Collaboration diagram for Euclid::MathUtils::InterpNAdapter< N, _index_sequence< Is...> >:
Collaboration graph
[legend]

Classes

struct  Doubles
 
struct  Vectors
 

Public Member Functions

 InterpNAdapter (const Coordinates< N > &grid, const NdArray::NdArray< double > &values, InterpolationType type, bool extrapolate)
 
- Public Member Functions inherited from Euclid::MathUtils::NAryFunction< N >
virtual std::unique_ptr
< NAryFunction
clone () const =0
 

Public Attributes

 values
 
 extrapolate
 

Private Attributes

InterpN< typename Doubles< Is >
::type...> 
m_interpn
 

Detailed Description

template<std::size_t N, std::size_t... Is>
struct Euclid::MathUtils::InterpNAdapter< N, _index_sequence< Is...> >

GridInterpolation expects the data to follow GridContainer memory layout, but originally interpn is expected to follow a numpy memory layout. We use template dirty tricks to re-use GridInterpolation, transposing the axis at creation time, and the arguments at interpolation time

Definition at line 22 of file interpolation.icpp.

Constructor & Destructor Documentation

template<std::size_t N, std::size_t... Is>
Euclid::MathUtils::InterpNAdapter< N, _index_sequence< Is...> >::InterpNAdapter ( const Coordinates< N > &  grid,
const NdArray::NdArray< double > &  values,
InterpolationType  type,
bool  extrapolate 
)
inline

Definition at line 34 of file interpolation.icpp.

Member Data Documentation

template<std::size_t N, std::size_t... Is>
Euclid::MathUtils::InterpNAdapter< N, _index_sequence< Is...> >::extrapolate
Initial value:
{
throw InterpolationException() << "Only linear interpolation is supported for N-dimensional grids";
}
}
double operator()(typename Doubles<Is>::type... xn) const override {
auto as_tuple = std::make_tuple(xn...);
return m_interpn(std::get<N - Is - 1>(as_tuple)...);
}
void operator()(const typename Vectors<Is>::type&..., std::vector<double>&) const override {
throw Elements::Exception() << "Not implemented";
}
return Euclid::make_unique<InterpNAdapter>(*this);
}
InterpNAdapter(const InterpNAdapter&) = default

Definition at line 36 of file interpolation.icpp.

template<std::size_t N, std::size_t... Is>
InterpN<typename Doubles<Is>::type...> Euclid::MathUtils::InterpNAdapter< N, _index_sequence< Is...> >::m_interpn
private

Definition at line 58 of file interpolation.icpp.

template<std::size_t N, std::size_t... Is>
Euclid::MathUtils::InterpNAdapter< N, _index_sequence< Is...> >::values

Definition at line 36 of file interpolation.icpp.


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