ACF $AcfVersion:0$
TISampledFunction.h
Go to the documentation of this file.
1// SPDX-License-Identifier: LGPL-2.1-or-later OR GPL-2.0-or-later OR GPL-3.0-or-later OR LicenseRef-ACF-Commercial
2#pragma once
3
4
5// STL includes
6#include <vector>
7
8// ACF includes
9#include <istd/IChangeable.h>
10#include <istd/TIndex.h>
11#include <istd/TRange.h>
13#include <imath/TVector.h>
14
15
16namespace imath
17{
18
19
23template <int ArgumentDimensions, int ResultDimensions>
25 virtual public imath::TIMathFunction<
26 istd::TIndex<ArgumentDimensions>,
27 TVector<ResultDimensions> >,
28 virtual public istd::IChangeable
29{
30public:
37
41 virtual bool CreateFunction(double* dataPtr, const ArgumentType& sizes) = 0;
42
46 virtual int GetTotalSamplesCount() const = 0;
47
51 virtual int GetGridSize(int dimensionIndex) const = 0;
52
56 virtual double GetSampleAt(const SampleIndex& index) const = 0;
57
62 virtual istd::CRange GetLogicalRange(int dimensionIndex) const = 0;
63
71 virtual istd::CRange GetResultValueRange(int dimensionIndex, int resultDimension = -1) const = 0;
72
77 virtual std::vector<double> GetSamples() const = 0;
78
82 virtual int GetArgumentDimensionality() const;
83
87 virtual int GetResultDimensionality() const;
88};
89
90
91template <int ArgumentDimensions, int ResultDimensions>
93{
94 return ArgumentDimensions;
95}
96
97
98template <int ArgumentDimensions, int ResultDimensions>
100{
101 return ResultDimensions;
102}
103
104
105// standard templatization
106
108{
109public:
110 double operator[](int index) const
111 {
112 return GetSampleAt(istd::TIndex<1>(index));
113 }
114};
115
117
118
119} // namespace imath
120
121
double operator[](int index) const
Template interface for any mathematical function.
Interface for a resampled function with a regular grid design.
virtual bool CreateFunction(double *dataPtr, const ArgumentType &sizes)=0
Create function from input data.
virtual istd::CRange GetLogicalRange(int dimensionIndex) const =0
Get logical range for the specified dimension.
BaseClass::ResultType ResultType
BaseClass::ArgumentType ArgumentType
virtual istd::CRange GetResultValueRange(int dimensionIndex, int resultDimension=-1) const =0
Get the range (boundary) of possible result values for the given axis.
virtual int GetGridSize(int dimensionIndex) const =0
Get number of samples for specified dimension.
virtual int GetArgumentDimensionality() const
Get the number of argument components.
virtual std::vector< double > GetSamples() const =0
Get all samples as a vector.
virtual double GetSampleAt(const SampleIndex &index) const =0
Get sample value at the given index.
virtual int GetTotalSamplesCount() const =0
Get number of samples stored in this container.
virtual int GetResultDimensionality() const
Get the number of result components.
istd::TIndex< ArgumentDimensions > SampleIndex
imath::TIMathFunction< istd::TIndex< ArgumentDimensions >, imath::TVector< ResultDimensions > > BaseClass
Implementation of fixed-size mathematical vector with specified type of elements.
Definition TVector.h:95
Common interface for data model objects, which can be changed.
Definition IChangeable.h:28
Multidimensional index used to addressing fixed-size array.
Definition TIndex.h:18
Package with mathematical functions and algebraical primitives.
TISampledFunction< 2, 1 > ISampledFunction2d