10#include "basketUnit.h"
12#include "../compute.h"
13#include "../defines.h"
19#define BSKNF typename BasketType::NeighborFilter
20#define BSKP typename BasketType::DataPoint
21#define BSKS typename BasketType::Scalar
22#define BSKV typename BasketType::VectorType
24#ifndef PARSED_WITH_DOXYGEN
37 template <
class P,
class NF,
typename Aggregate,
template <
class,
class,
typename>
class Ext,
38 template <
class,
class,
typename>
class... Exts>
39 struct BasketAggregateImpl
41 using type =
typename BasketAggregateImpl<P, NF, Ext<P, NF, Aggregate>, Exts...>::type;
52 template <
class P,
class NF,
typename Aggregate,
template <
class,
class,
typename>
class Ext>
53 struct BasketAggregateImpl<P, NF, Aggregate, Ext>
55 using type = Ext<P, NF, Aggregate>;
66 template <
class P,
class NF,
template <
class,
class,
typename>
class... Exts>
67 struct BasketAggregate : BasketAggregateImpl<P, NF, BasketUnitBase<P, NF>, Exts...>
80 template <
int Type,
typename BasketType,
template <
class,
class,
int,
typename>
class Ext,
81 template <
class,
class,
int,
typename>
class... Exts>
82 struct BasketDiffAggregateImpl
84 using type =
typename BasketDiffAggregateImpl<Type, Ext<BSKP, BSKNF, Type, BasketType>, Exts...>::type;
94 template <
int Type,
typename BasketType,
template <
class,
class,
int,
typename>
class Ext>
95 struct BasketDiffAggregateImpl<Type, BasketType, Ext>
97 using type = Ext<BSKP, BSKNF, Type, BasketType>;
108 template <
typename BasketType,
int Type,
template <
class,
class,
int,
typename>
class... Exts>
109 struct BasketDiffAggregate : BasketDiffAggregateImpl<Type, BasketType, BasketDiffUnitBase, Exts...>
136 template <
typename _Derived,
typename _Base>
156 template <
typename IteratorBegin,
typename IteratorEnd>
165 for (
auto it = begin;
it != end; ++
it)
169 res = Base::finalize();
182 template <
typename IndexRange,
typename Po
intContainer>
191 for (
const auto&
i :
ids)
195 res = Base::finalize();
213#define WRITE_COMPUTE_FUNCTIONS \
214 using BasketComputeObject<Self, Base>::compute; \
215 using BasketComputeObject<Self, Base>::computeWithIds;
225 template <
typename BasketType,
int Type,
template <
class,
class,
int,
typename>
class Ext0,
226 template <
class,
class,
int,
typename>
class... Exts>
229 typename internal::BasketDiffAggregate<BasketType, Type, Ext0, Exts...>::type>
244 WRITE_COMPUTE_FUNCTIONS
247 PONCA_MULTIARCH
void init();
278 typename Base::ScalarArray&
_dw);
289 template <
class P,
class NF,
template <
class,
class,
typename>
class Ext0,
290 template <
class,
class,
typename>
class...
Exts>
293 typename internal::BasketAggregate<P, NF, Ext0, Exts...>::type>
303 using VectorType =
typename P::VectorType;
309 WRITE_COMPUTE_FUNCTIONS
312 PONCA_MULTIARCH
void init();
345#undef WRITE_COMPUTE_FUNCTIONS
Aggregator class used to declare specialized structures with derivatives computations,...
void init()
Initialize the fit.
typename BasketType::DataPoint DataPoint
Point type used for computation.
bool addNeighbor(const DataPoint &_nei)
Add a neighbor to perform the fit.
typename BasketType::NeighborFilter NeighborFilter
Neighbor Filter.
typename BasketType::VectorType VectorType
Vector type used for computation, as defined from Basket.
typename BasketType::Scalar Scalar
Scalar type used for computation, as defined from Basket.
void addLocalNeighbor(Scalar _w, const VectorType &_localQ, const DataPoint &_nei, typename Base::ScalarArray &_dw)
Add a local neighbor to perform the fit.
void startNewPass()
Start a new iteration over neighbor.
void finalize()
Finalize the fitting procedure.
Aggregator class used to declare specialized structures using CRTP.
typename internal::BasketAggregate< P, NF, Ext0, Exts... >::type Base
Base type, which aggregates all the computational objects using the CRTP.
void addLocalNeighbor(typename P::Scalar _w, const typename P::VectorType &_localQ, const P &_nei)
Add a local neighbor to perform the fit.
P DataPoint
Point type used for computation.
void startNewPass()
Start a new iteration over neighbor.
bool addNeighbor(const DataPoint &_nei)
Add a neighbor to perform the fit.
typename P::Scalar Scalar
Scalar type used for computation, as defined from template parameter P
FIT_RESULT finalize()
Finalize the fitting procedure.
void init()
Initialize the fit.
This Source Code Form is subject to the terms of the Mozilla Public License, v.
FIT_RESULT
Enum corresponding to the state of a fitting method (and what the finalize function returns)
@ UNDEFINED
The fitting is undefined, you can't use it for valid results.
@ NEED_OTHER_PASS
The fitting procedure needs to analyse the neighborhood another time.
Base ComputeObject for the Basket classes.
FIT_RESULT computeWithIds(IndexRange ids, const PointContainer &points)
Convenience function to iterate over a subset of samples in a PointContainer Add neighbors stored in ...
FIT_RESULT compute(const IteratorBegin &begin, const IteratorEnd &end)
Convenience function for STL-like iterators Add neighbors stored in a container using STL-like iterat...
typename Base::Scalar Scalar
Alias to the Derived type.
ComputeObject is a virtual object that represents an algorithm which can be used with the compute fun...
_Derived & derived()
Retrieve the top layer object Returns a reference to the derived class so that we can use its overwri...