33 #ifndef PARAM_FUNC_HPP 34 #define PARAM_FUNC_HPP 83 std::size_t ctrlPtsArcRefIdx;
90 template <
typename TNumType>
93 FuncCtrlPt(
const TNumType& _val, TNumType& _arc) : val(_val), arc(_arc)
102 template <
class TDerived>
103 struct ParamFuncsBaseCRTPTraits;
106 template <
typename TDerived>
113 using NumType =
typename ParamFuncsBaseCRTPTraits<TDerived>::NumType;
156 template <
typename TParamFucsStructVecArr>
157 void init(
const TParamFucsStructVecArr& _paramFuncsStructure)
159 thisDerived().initImplCRTP(_paramFuncsStructure);
165 return thisDerived().funcsSizeImplCRTP();
171 return thisDerived().funcsArcSizeImplCRTP();
177 return thisDerived().funcsArcSizeImplCRTP(_i);
183 return thisDerived().funcCtrlPtSizeImplCRTP(_i);
189 return thisDerived().funcsArcBeginImplCRTP();
195 return thisDerived().funcsArcBeginImplCRTP();
201 return thisDerived().funcsArcEndImplCRTP();
207 return thisDerived().funcsArcEndImplCRTP();
213 return thisDerived().funcsArcEvalImplCRTP();
219 return thisDerived().funcsArcImplCRTP(_i, _j);
225 return thisDerived().funcsArcImplCRTP(_i, _j);
231 return thisDerived().ctrlPtImplCRTP(_funcIdx, _funcCtrlPtIdx);
237 return thisDerived().ctrlPtImplCRTP(_funcIdx, _funcCtrlPtIdx);
244 return thisDerived().ctrlPtValImplCRTP(_funcIdx, _funcCtrlPtIdx, _ctrlPtDim);
251 return thisDerived().ctrlPtValImplCRTP(_funcIdx, _funcCtrlPtIdx, _ctrlPtDim);
257 thisDerived().shiftStartCtrlPtImplCRTP(_dt);
264 thisDerived().precomputeImplCRTP();
270 thisDerived().setEvalArcImplCRTP(_arcEval, _eAG);
276 return thisDerived().computeFuncValImplCRTP(_funcIdx);
283 return thisDerived().computeFuncDiff1ImplCRTP(_funcIdx);
290 return thisDerived().computeFuncDiff2ImplCRTP(_funcIdx);
297 return thisDerived().computeFuncInt1ImplCRTP(_funcIdx);
304 return thisDerived().computeFuncInt2ImplCRTP(_funcIdx);
310 return static_cast<TDerived&
>(*this);
316 return static_cast<const TDerived&
>(*this);
319 template <
typename TNumType>
366 void init(
const std::vector<ParamFuncsStructure>& _paramFuncsStructure)
368 initImplVirt(_paramFuncsStructure);
374 return funcsSizeImplVirt();
380 return funcsArcSizeImplVirt();
386 return funcsArcSizeImplVirt(_i);
392 return funcCtrlPtSizeImplVirt(_i);
398 return funcsArcBeginImplVirt();
404 return funcsArcBeginImplVirt();
410 return funcsArcEndImplVirt();
416 return funcsArcEndImplVirt();
422 return funcsArcEvalImplVirt();
426 TNumType&
funcsArc(
const std::size_t& _i,
const std::size_t& _j)
428 return funcsArcImplVirt(_i, _j);
432 const TNumType&
funcsArc(
const std::size_t& _i,
const std::size_t& _j)
const 434 return funcsArcImplVirt(_i, _j);
440 return ctrlPtImplVirt(_funcIdx, _funcCtrlPtIdx);
446 return ctrlPtImplVirt(_funcIdx, _funcCtrlPtIdx);
450 TNumType&
ctrlPtVal(
const std::size_t& _funcIdx,
const std::size_t& _funcCtrlPtIdx,
453 return ctrlPtValImplVirt(_funcIdx, _funcCtrlPtIdx, _ctrlPtDim);
457 const TNumType&
ctrlPtVal(
const std::size_t& _funcIdx,
const std::size_t& _funcCtrlPtIdx,
460 return ctrlPtValImplVirt(_funcIdx, _funcCtrlPtIdx, _ctrlPtDim);
466 shiftStartCtrlPtImplVirt(_dt);
473 precomputeImplVirt();
479 setEvalArcImplVirt(_arcEval, _eAG);
485 return computeFuncValImplVirt(_funcIdx);
492 return computeFuncDiff1ImplVirt(_funcIdx);
499 return computeFuncDiff2ImplVirt(_funcIdx);
506 return computeFuncInt1ImplVirt(_funcIdx);
513 return computeFuncInt2ImplVirt(_funcIdx);
518 virtual void initImplVirt(
const std::vector<ParamFuncsStructure>& _paramFuncsStructure) = 0;
521 virtual std::size_t funcsSizeImplVirt()
const = 0;
524 virtual std::size_t funcsArcSizeImplVirt()
const = 0;
527 virtual std::size_t funcsArcSizeImplVirt(
const std::size_t& _i)
const = 0;
530 virtual std::size_t funcCtrlPtSizeImplVirt(
const std::size_t& _i)
const = 0;
533 virtual TNumType& funcsArcBeginImplVirt() = 0;
536 virtual const TNumType& funcsArcBeginImplVirt()
const = 0;
539 virtual TNumType& funcsArcEndImplVirt() = 0;
542 virtual const TNumType& funcsArcEndImplVirt()
const = 0;
545 virtual const TNumType& funcsArcEvalImplVirt()
const = 0;
548 virtual TNumType& funcsArcImplVirt(
const std::size_t& _i,
const std::size_t& _j) = 0;
551 virtual const TNumType& funcsArcImplVirt(
const std::size_t& _i,
const std::size_t& _j)
const = 0;
554 virtual FuncCtrlPtType& ctrlPtImplVirt(
const std::size_t& _funcIdx,
const std::size_t& _funcCtrlPtIdx) = 0;
557 virtual const FuncCtrlPtType& ctrlPtImplVirt(
const std::size_t& _funcIdx,
558 const std::size_t& _funcCtrlPtIdx)
const = 0;
561 virtual TNumType& ctrlPtValImplVirt(
const std::size_t& _funcIdx,
const std::size_t& _funcCtrlPtIdx,
565 virtual const TNumType& ctrlPtValImplVirt(
const std::size_t& _funcIdx,
const std::size_t& _funcCtrlPtIdx,
569 virtual void shiftStartCtrlPtImplVirt(
const TNumType& _dt) = 0;
572 virtual void precomputeImplVirt() = 0;
575 virtual void setEvalArcImplVirt(
const TNumType& _arcEval,
const eAG& _eAG) = 0;
578 virtual TNumType computeFuncValImplVirt(
const std::size_t& _funcIdx)
const = 0;
581 virtual TNumType computeFuncDiff1ImplVirt(
const std::size_t& _funcIdx)
const = 0;
584 virtual TNumType computeFuncDiff2ImplVirt(
const std::size_t& _funcIdx)
const = 0;
587 virtual TNumType computeFuncInt1ImplVirt(
const std::size_t& _funcIdx)
const = 0;
590 virtual TNumType computeFuncInt2ImplVirt(
const std::size_t& _funcIdx)
const = 0;
593 template <
typename TNumType>
600 template <
typename TNumType,
size_t TArcLatticeSize>
608 template <
typename TNumType>
624 template <
typename TNumType,
size_t TFuncSize>
632 std::array<std::vector<FuncCtrlPt<TNumType>>, TFuncSize>
funcCtrlPt_;
641 template <
typename TDerived,
typename TNumType,
int TFuncSize,
int TArcLatticeSize>
644 public std::conditional<TFuncSize == -1, ParamFuncsBaseFuncVarsDyn<TNumType>,
645 ParamFuncsBaseFuncVarsStatic<TNumType, TFuncSize>>::type,
646 public std::conditional<TArcLatticeSize == -1, ParamFuncsBaseArcVarsDyn<TNumType>,
647 ParamFuncsBaseArcVarsStatic<TNumType, TArcLatticeSize>>::type
656 static constexpr
const int FuncSize = TFuncSize;
659 static constexpr
const bool IsFuncDyn = TFuncSize == -1;
662 static constexpr
const bool IsArcDyn = TArcLatticeSize == -1;
680 initBase(_other.paramFuncsStructure_);
681 for (
size_t i = 0; i < funcsArcSize(); ++i)
683 for (
size_t j = 0; j < funcsArcSize(i); ++j)
685 funcsArc(i, j) = _other.
funcsArc(i, j);
688 for (
size_t i = 0; i < funcsSize(); ++i)
690 for (
size_t j = 0; j < funcCtrlPtSize(i); ++j)
706 init(_other.paramFuncsStructure_);
707 for (
size_t i = 0; i < funcsArcSize(); ++i)
709 for (
size_t j = 0; j < funcsArcSize(i); ++j)
711 funcsArc(i, j) = _other.
funcsArc(i, j);
714 for (
size_t i = 0; i < funcsSize(); ++i)
716 for (
size_t j = 0; j < funcCtrlPtSize(i); ++j)
752 thisDerived().initImplImpl();
758 thisDerived().precomputeImpl();
765 thisDerived().setEvalArcImpl(_arcEval, _eAG);
771 return thisDerived().computeFuncValImpl(_funcIdx);
777 return thisDerived().computeFuncDiff1Impl(_funcIdx);
783 return thisDerived().computeFuncDiff2Impl(_funcIdx);
789 return thisDerived().computeFuncInt1Impl(_funcIdx);
795 return thisDerived().computeFuncInt2Impl(_funcIdx);
801 thisDerived().precomputeImpl();
807 thisDerived().setEvalArcImpl(_arcEval, _eAG);
813 return thisDerived().computeFuncValImpl(_funcIdx);
819 return thisDerived().computeFuncDiff1Impl(_funcIdx);
825 return thisDerived().computeFuncDiff2Impl(_funcIdx);
831 return thisDerived().computeFuncInt1Impl(_funcIdx);
837 return thisDerived().computeFuncInt2Impl(_funcIdx);
841 template <bool FuncDyn = IsFuncDyn, typename std::enable_if<FuncDyn>::type* =
nullptr>
844 initImplCRTP(_paramFuncsStructure);
848 template <bool FuncDyn = IsFuncDyn, typename std::enable_if<!FuncDyn>::type* =
nullptr>
851 if (_paramFuncsStructure.size() != TFuncSize)
853 throw std::runtime_error(
"Error in ParamFuncs::init: number of functions in init structure does not match " 854 "(static) number of param funcs");
856 std::array<ParamFuncsStructure, TFuncSize> pfsStatic;
857 for (
size_t i = 0; i < pfsStatic.size(); ++i)
859 pfsStatic[i] = _paramFuncsStructure[i];
861 initImplCRTP(pfsStatic);
865 void initImplVirt(
const std::vector<ParamFuncsStructure>& _paramFuncsStructure)
override final 867 initImplVirtDispatch(_paramFuncsStructure);
873 return funcsSizeImplCRTP();
879 return funcsArcSizeImplCRTP();
885 return funcsArcSizeImplCRTP(_i);
891 return funcCtrlPtSizeImplCRTP(_i);
897 return funcsArcBeginImplCRTP();
903 return funcsArcBeginImplCRTP();
909 return funcsArcEndImplCRTP();
915 return funcsArcEndImplCRTP();
921 return funcsArcEvalImplCRTP();
927 return funcsArcImplCRTP(_i, _j);
931 const TNumType&
funcsArcImplVirt(
const std::size_t& _i,
const std::size_t& _j)
const override final 933 return funcsArcImplCRTP(_i, _j);
939 return ctrlPtImplCRTP(_funcIdx, _funcCtrlPtIdx);
944 const std::size_t& _funcCtrlPtIdx)
const override final 946 return ctrlPtImplCRTP(_funcIdx, _funcCtrlPtIdx);
951 const CtrlPtDim& _ctrlPtDim)
override final 953 return ctrlPtValImplCRTP(_funcIdx, _funcCtrlPtIdx, _ctrlPtDim);
957 const TNumType&
ctrlPtValImplVirt(
const std::size_t& _funcIdx,
const std::size_t& _funcCtrlPtIdx,
958 const CtrlPtDim& _ctrlPtDim)
const override final 960 return ctrlPtValImplCRTP(_funcIdx, _funcCtrlPtIdx, _ctrlPtDim);
966 shiftStartCtrlPtImplCRTP(_dt);
970 template <
bool FuncDyn = (IsFuncDyn),
bool ArcDyn = IsArcDyn,
971 typename std::enable_if<(FuncDyn) && (ArcDyn)>::type* =
nullptr>
972 void initBase(
const std::vector<ParamFuncsStructure>& _paramFuncsStructure)
974 this->paramFuncsStructure_ = _paramFuncsStructure;
975 const size_t funcsSize = _paramFuncsStructure.size();
978 throw std::runtime_error(
"Error in ParamFuncs::checkParamFuncsStructure: initialization with 0 number of " 981 this->funcCtrlPt_.resize(funcsSize);
982 for (
auto& funcCtrlPtrI : this->funcCtrlPt_)
984 funcCtrlPtrI.clear();
986 this->func2Arc_.resize(funcsSize);
987 this->funcEvalReq_.resize(funcsSize);
988 this->funcCtrlPtArc_.clear();
989 std::vector<size_t> funcSameArcCtrlPtSize;
990 for (
size_t i = 0; i < funcsSize; ++i)
992 const auto& paramFuncsStructureI = _paramFuncsStructure[i];
993 const size_t& funcCtrlPtsSize = paramFuncsStructureI.ctrlPtsSize;
994 if (funcCtrlPtsSize < 2)
996 throw std::runtime_error(
"Error in ParamFuncs::checkParamFuncsStructure: function has less than 2 control " 999 auto& func2ArcI = this->func2Arc_[i];
1000 func2ArcI = paramFuncsStructureI.ctrlPtsArcRefIdx;
1001 if (func2ArcI >= this->funcCtrlPtArc_.size())
1003 if (func2ArcI == this->funcCtrlPtArc_.size())
1005 this->funcCtrlPtArc_.emplace_back(std::vector<TNumType>(funcCtrlPtsSize - 2, 0));
1006 funcSameArcCtrlPtSize.emplace_back(funcCtrlPtsSize);
1010 throw std::runtime_error(
"Error in ParamFuncs::init: a ctrlPtsArcRefIdx is not consistent (new Idx not unit " 1014 if (funcCtrlPtsSize != funcSameArcCtrlPtSize[func2ArcI])
1016 throw "Error in ParamFuncs::init: inconsistent number of control points for functions with same arc " 1017 "parametrization reference";
1019 auto& funcCtrlPtI = this->funcCtrlPt_[i];
1020 funcCtrlPtI.reserve(funcCtrlPtsSize);
1022 for (
size_t j = 1; j < funcCtrlPtsSize - 1; ++j)
1024 funcCtrlPtI.emplace_back(
FuncCtrlPtType(0, this->funcCtrlPtArc_[func2ArcI][j - 1]));
1028 this->funcEvalReq_[i] = paramFuncsStructureI.evalReq;
1033 template <
bool FuncDyn = (IsFuncDyn),
bool ArcDyn = IsArcDyn,
1034 typename std::enable_if<(!FuncDyn) && (ArcDyn)>::type* =
nullptr>
1035 void initBase(
const std::array<ParamFuncsStructure, TFuncSize>& _paramFuncsStructure)
1037 this->paramFuncsStructure_ = _paramFuncsStructure;
1038 for (
auto& funcCtrlPtrI : this->funcCtrlPt_)
1040 funcCtrlPtrI.clear();
1042 this->funcCtrlPtArc_.clear();
1043 std::vector<size_t> funcSameArcCtrlPtSize;
1044 for (
size_t i = 0; i < (size_t)TFuncSize; ++i)
1046 const auto& paramFuncsStructureI = _paramFuncsStructure[i];
1047 const size_t& funcCtrlPtsSize = paramFuncsStructureI.ctrlPtsSize;
1048 if (funcCtrlPtsSize < 2)
1050 throw std::runtime_error(
"Error in ParamFuncs::checkParamFuncsStructure: function has less than 2 control " 1053 auto& func2ArcI = this->func2Arc_[i];
1054 func2ArcI = paramFuncsStructureI.ctrlPtsArcRefIdx;
1055 if (func2ArcI >= this->funcCtrlPtArc_.size())
1057 if (func2ArcI == this->funcCtrlPtArc_.size())
1059 this->funcCtrlPtArc_.emplace_back(std::vector<TNumType>(funcCtrlPtsSize - 2, 0));
1060 funcSameArcCtrlPtSize.emplace_back(funcCtrlPtsSize);
1064 throw std::runtime_error(
"Error in ParamFuncs::init: a ctrlPtsArcRefIdx is not consistent (new Idx not unit " 1068 if (funcCtrlPtsSize != funcSameArcCtrlPtSize[func2ArcI])
1070 throw "Error in ParamFuncs::init: inconsistent number of control points for functions with same arc " 1071 "parametrization reference";
1073 auto& funcCtrlPtI = this->funcCtrlPt_[i];
1074 funcCtrlPtI.reserve(funcCtrlPtsSize);
1076 for (
size_t j = 1; j < funcCtrlPtsSize - 1; ++j)
1078 funcCtrlPtI.emplace_back(
FuncCtrlPtType(0, this->funcCtrlPtArc_[func2ArcI][j - 1]));
1082 this->funcEvalReq_[i] = paramFuncsStructureI.evalReq;
1087 template <
bool FuncDyn = (IsFuncDyn),
bool ArcDyn = IsArcDyn,
1088 typename std::enable_if<(FuncDyn) && (!ArcDyn)>::type* =
nullptr>
1089 void initBase(
const std::vector<ParamFuncsStructure>& _paramFuncsStructure)
1091 this->paramFuncsStructure_ = _paramFuncsStructure;
1092 const size_t funcsSize = _paramFuncsStructure.size();
1095 throw std::runtime_error(
"Error in ParamFuncs::checkParamFuncsStructure: initialization with 0 number of " 1098 this->funcCtrlPt_.resize(funcsSize);
1099 for (
auto& funcCtrlPtrI : this->funcCtrlPt_)
1101 funcCtrlPtrI.clear();
1103 this->func2Arc_.resize(funcsSize);
1104 this->funcEvalReq_.resize(funcsSize);
1105 std::array<size_t, TFuncSize> funcSameArcCtrlPtSize;
1106 std::vector<bool> initFuncCtrlPtArc(this->funcCtrlPtArc_.size(),
false);
1107 for (
size_t i = 0; i < funcsSize; ++i)
1109 const auto& paramFuncsStructureI = _paramFuncsStructure[i];
1110 const size_t& funcCtrlPtsSize = paramFuncsStructureI.ctrlPtsSize;
1111 if (funcCtrlPtsSize < 2)
1113 throw std::runtime_error(
"Error in ParamFuncs::checkParamFuncsStructure: function has less than 2 control " 1116 auto& func2ArcI = this->func2Arc_[i];
1117 func2ArcI = paramFuncsStructureI.ctrlPtsArcRefIdx;
1118 if (func2ArcI < this->funcCtrlPtArc_.size())
1120 if (initFuncCtrlPtArc[func2ArcI] ==
false)
1122 this->funcCtrlPtArc_[func2ArcI] = std::vector<TNumType>(funcCtrlPtsSize - 2, 0);
1123 initFuncCtrlPtArc[func2ArcI] =
true;
1125 funcSameArcCtrlPtSize[func2ArcI] = funcCtrlPtsSize;
1129 throw std::runtime_error(
"Error in ParamFuncs::init: a ctrlPtsArcRefIdx is not consistent (>= than the static " 1130 "arc lattice size)");
1132 if (funcCtrlPtsSize != funcSameArcCtrlPtSize[func2ArcI])
1134 throw "Error in ParamFuncs::init: inconsistent number of control points for functions with same arc " 1135 "parametrization reference";
1137 auto& funcCtrlPtI = this->funcCtrlPt_[i];
1138 funcCtrlPtI.reserve(funcCtrlPtsSize);
1140 for (
size_t j = 1; j < funcCtrlPtsSize - 1; ++j)
1142 funcCtrlPtI.emplace_back(
FuncCtrlPtType(0, this->funcCtrlPtArc_[func2ArcI][j - 1]));
1146 this->funcEvalReq_[i] = paramFuncsStructureI.evalReq;
1151 template <
bool FuncDyn = (IsFuncDyn),
bool ArcDyn = IsArcDyn,
1152 typename std::enable_if<(!FuncDyn) && (!ArcDyn)>::type* =
nullptr>
1153 void initBase(
const std::array<ParamFuncsStructure, TFuncSize>& _paramFuncsStructure)
1155 this->paramFuncsStructure_ = _paramFuncsStructure;
1156 for (
auto& funcCtrlPtrI : this->funcCtrlPt_)
1158 funcCtrlPtrI.clear();
1160 std::array<size_t, TFuncSize> funcSameArcCtrlPtSize;
1161 std::vector<bool> initFuncCtrlPtArc(this->funcCtrlPtArc_.size(),
false);
1162 for (
size_t i = 0; i < (size_t)TFuncSize; ++i)
1164 const auto& paramFuncsStructureI = _paramFuncsStructure[i];
1165 const size_t& funcCtrlPtsSize = paramFuncsStructureI.ctrlPtsSize;
1166 if (funcCtrlPtsSize < 2)
1168 throw std::runtime_error(
"Error in ParamFuncs::checkParamFuncsStructure: function has less than 2 control " 1171 auto& func2ArcI = this->func2Arc_[i];
1172 func2ArcI = paramFuncsStructureI.ctrlPtsArcRefIdx;
1173 if (func2ArcI < this->funcCtrlPtArc_.size())
1175 if (initFuncCtrlPtArc[func2ArcI] ==
false)
1177 this->funcCtrlPtArc_[func2ArcI] = std::vector<TNumType>(funcCtrlPtsSize - 2, 0);
1178 initFuncCtrlPtArc[func2ArcI] =
true;
1180 funcSameArcCtrlPtSize[func2ArcI] = funcCtrlPtsSize;
1184 throw std::runtime_error(
"Error in ParamFuncs::init: a ctrlPtsArcRefIdx is not consistent (>= than the static " 1185 "arc lattice size)");
1187 if (funcCtrlPtsSize != funcSameArcCtrlPtSize[func2ArcI])
1189 throw std::runtime_error(
"Error in ParamFuncs::init: inconsistent number of control points for functions with " 1190 "same arc parametrization reference");
1192 auto& funcCtrlPtI = this->funcCtrlPt_[i];
1193 funcCtrlPtI.reserve(funcCtrlPtsSize);
1195 for (
size_t j = 1; j < funcCtrlPtsSize - 1; ++j)
1197 funcCtrlPtI.emplace_back(
FuncCtrlPtType(0, this->funcCtrlPtArc_[func2ArcI][j - 1]));
1201 this->funcEvalReq_[i] = paramFuncsStructureI.evalReq;
1206 template <
typename TParamFucsStructVecArr>
1209 initBase(_paramFuncsStructure);
1216 return this->funcCtrlPt_.size();
1222 return this->funcCtrlPtArc_.size();
1228 return this->funcCtrlPtArc_[_i].size() + 2;
1234 return this->funcCtrlPt_[_i].size();
1240 return funcsArcBegin_;
1246 return funcsArcBegin_;
1252 return funcsArcEnd_;
1258 return funcsArcEnd_;
1264 return funcsArcEval_;
1272 return funcsArcBegin_;
1274 if (_j > this->funcCtrlPtArc_[_i].size())
1276 return funcsArcEnd_;
1278 return this->funcCtrlPtArc_[_i][_j - 1];
1286 return funcsArcBegin_;
1288 if (_j > this->funcCtrlPtArc_[_i].size())
1290 return funcsArcEnd_;
1292 return this->funcCtrlPtArc_[_i][_j - 1];
1298 return this->funcCtrlPt_[_funcIdx][_funcCtrlPtIdx];
1304 return this->funcCtrlPt_[_funcIdx][_funcCtrlPtIdx];
1314 return this->funcCtrlPt_[_funcIdx][_funcCtrlPtIdx].val;
1317 return this->funcCtrlPt_[_funcIdx][_funcCtrlPtIdx].arc;
1320 throw "CtrlPtDim unrecognised in function ParamFuncs::ctrlPtVal !";
1332 return this->funcCtrlPt_[_funcIdx][_funcCtrlPtIdx].val;
1335 return this->funcCtrlPt_[_funcIdx][_funcCtrlPtIdx].arc;
1338 throw "CtrlPtDim unrecognised in function ParamFuncs::ctrlPtVal !";
1346 std::vector<TNumType> ctrlPtValPref(funcsSize(), 0);
1347 const TNumType dtBound = fmin(fmax(funcsArcBegin_, _dt), funcsArcEnd_ - funcsArcBegin_);
1348 const TNumType evalArc = funcsArcBegin_ + dtBound;
1349 setEvalArc(evalArc);
1350 for (
size_t i = 0; i < funcsSize(); ++i)
1352 ctrlPtValPref[i] = computeFuncVal(i);
1354 for (
size_t i = 0; i < funcsSize(); ++i)
1356 for (
size_t j = 0; j < funcCtrlPtSize(i); ++j)
1368 for (
size_t k = 0; k < funcsArcSize(); ++k)
1370 for (
size_t j = 0; j < this->funcCtrlPtArc_[k].size(); ++j)
1372 this->funcCtrlPtArc_[k][j] = fmax(funcsArcBegin_, this->funcCtrlPtArc_[k][j] - dtBound);
1375 funcsArcEnd_ -= dtBound;
1377 setEvalArc(funcsArcBegin_);
1383 return static_cast<TDerived&
>(*this);
1389 return static_cast<const TDerived&
>(*this);
1402 template <
typename TDerived2>
1404 template <
typename TNum2>
1407 template <
typename TDerived,
typename TNumType,
int TFuncSize,
int TArcLatticeSize>
1412 template <
typename TDerived,
typename TNumType,
int TFuncSize,
int TArcLatticeSize>
1413 struct ParamFuncsBaseCRTPTraits<ParamFuncsBase<TDerived, TNumType, TFuncSize, TArcLatticeSize>>
1421 #endif // PARAM_FUNC_HPP Containts parametric function initialization data.
TNumType & arc
control point arc parameter
TNumType & funcsArc(const std::size_t &_i, const std::size_t &_j)
Access to the arc parameter vector at index _i, control point _j.
FuncCtrlPtType & ctrlPtImplCRTP(const std::size_t &_funcIdx, const std::size_t &_funcCtrlPtIdx)
const TNumType & funcsArcEvalImplCRTP() const
std::size_t funcsSizeImplCRTP() const
std::size_t funcCtrlPtSizeImplCRTP(const std::size_t &_i) const
const NumType & funcsArc(const std::size_t &_i, const std::size_t &_j) const
Const access the arc parameter vector at index _i, control point _j.
std::size_t funcsArcSizeImplVirt(const std::size_t &_i) const overridefinal
void shiftStartCtrlPtImplVirt(const TNumType &_dt) overridefinal
TNumType & funcsArcBeginImplCRTP()
const TNumType & funcsArcEnd() const
Const access to the finall value of the arc parametrization.
void setEvalArc(const NumType &_arcEval, const eAG &_eAG=eAG::NONE)
Sets parametric function evaluation arc.
const NumType & ctrlPtVal(const std::size_t &_funcIdx, const std::size_t &_funcCtrlPtIdx, const CtrlPtDim &_ctrlPtDim=CtrlPtDim::VAL) const
Const of a parametric function control point dimension.
FuncCtrlPtType & ctrlPt(const std::size_t &_funcIdx, const std::size_t &_funcCtrlPtIdx)
Access of a parametric function control point.
std::vector< ParamFuncsStructure > paramFuncsStructure_
Initialization structure "store" variable.
TNumType computeFuncInt1ImplCRTP(const std::size_t &_funcIdx) const
void precomputeImplCRTP()
ParamFuncsBase(const ParamFuncsBase &_other)
control point arc parameter
std::size_t funcsArcSizeImplCRTP(const std::size_t &_i) const
std::vector< FuncEvalModesFlags > funcEvalReq_
Flags for required function computation modes.
TNumType funcsArcEnd_
Arc parametrization at the end of the functions domain definitions (common for all functions)...
const TNumType & ctrlPtValImplVirt(const std::size_t &_funcIdx, const std::size_t &_funcCtrlPtIdx, const CtrlPtDim &_ctrlPtDim) const overridefinal
std::size_t funcsArcSize() const
Number of arc parametrizations.
const TNumType & funcsArcImplCRTP(const std::size_t &_i, const std::size_t &_j) const
std::size_t funcCtrlPtSize(const std::size_t &_i) const
Number of control points for a parametric function.
NumType computeFuncInt2(const std::size_t &_funcIdx) const
Computes double integral of parametric function with index _funcIdx on interval [funcsArcBegin_, funcsArcEnd_].
void init(const std::vector< ParamFuncsStructure > &_paramFuncsStructure)
Initializes the control structure.
NumType computeFuncDiff2(const std::size_t &_funcIdx) const
Computes 2nd derivative of parametric function with index _funcIdx at parametric arc set by setEvalAr...
TNumType computeFuncValImplVirt(const std::size_t &_funcIdx) const overridefinal
function second derivative
constexpr auto asInt(Enumeration const value) -> typename std::underlying_type< Enumeration >::type
void initImplVirtDispatch(const std::vector< ParamFuncsStructure > &_paramFuncsStructure)
TNumType & funcsArcEndImplVirt() overridefinal
const TNumType & funcsArcBegin() const
Const access to the initial value of the arc parametrization.
function value (always assumed to have the highest integer value of the enum)
TNumType computeFuncDiff1(const std::size_t &_funcIdx) const
Computes 1st derivative of parametric function with index _funcIdx at parametric arc set by setEvalAr...
const FuncCtrlPtType & ctrlPtImplCRTP(const std::size_t &_funcIdx, const std::size_t &_funcCtrlPtIdx) const
void initImpl()
Called at end of init. To be used by extended classes.
friend class ParamFuncsBaseVirt
const TNumType & funcsArc(const std::size_t &_i, const std::size_t &_j) const
Const access the arc parameter vector at index _i, control point _j.
TNumType val
control point value
TNumType funcsArcBegin_
Arc parametrization at the beginning of the functions domain definitions (common for all functions)...
FuncCtrlPtType & ctrlPtImplVirt(const std::size_t &_funcIdx, const std::size_t &_funcCtrlPtIdx) overridefinal
const TDerived & thisDerived() const
TNumType computeFuncInt1(const std::size_t &_funcIdx) const
Computes integral of parametric function with index _funcIdx on interval [funcsArcBegin_, funcsArcEnd_].
void init(const TParamFucsStructVecArr &_paramFuncsStructure)
Initializes the control structure.
void shiftStartCtrlPt(const NumType &_dt)
NumType & funcsArc(const std::size_t &_i, const std::size_t &_j)
Access to the arc parameter vector at index _i, control point _j.
NumType computeFuncInt1(const std::size_t &_funcIdx) const
Computes integral of parametric function with index _funcIdx on interval [funcsArcBegin_, funcsArcEnd_].
TNumType & funcsArcEnd()
Access to the final value of the arc parametrization.
void precompute()
Precomputes cached data.
TNumType computeFuncVal(const std::size_t &_funcIdx) const
Computes value of parametric function with index _funcIdx at parametric arc set by setEvalArc...
std::size_t funcsSize() const
Number of parametric functions.
const FuncCtrlPtType & ctrlPt(const std::size_t &_funcIdx, const std::size_t &_funcCtrlPtIdx) const
Const access of a parametric function control point.
NumType & ctrlPtVal(const std::size_t &_funcIdx, const std::size_t &_funcCtrlPtIdx, const CtrlPtDim &_ctrlPtDim=CtrlPtDim::VAL)
Access of a parametric function control point dimension.
TNumType computeFuncDiff2ImplCRTP(const std::size_t &_funcIdx) const
TNumType computeFuncDiff1ImplCRTP(const std::size_t &_funcIdx) const
std::size_t funcsArcSize() const
Number of arc parametrizations.
const FuncCtrlPtType & ctrlPtImplVirt(const std::size_t &_funcIdx, const std::size_t &_funcCtrlPtIdx) const overridefinal
TNumType computeFuncDiff2(const std::size_t &_funcIdx) const
Computes 2nd derivative of parametric function with index _funcIdx at parametric arc set by setEvalAr...
void shiftStartCtrlPt(const TNumType &_dt)
std::size_t funcsSize() const
Number of parametric functions.
TNumType computeFuncInt2ImplVirt(const std::size_t &_funcIdx) const overridefinal
void precomputeImplVirt() overridefinal
typename ParamFuncsBaseCRTPTraits< ParamFuncsBase< ParamFuncsSpline0Dist< TNumType, TFuncSize, TArcLatticeSize >, TNumType, TFuncSize, TArcLatticeSize > >::NumType NumType
TNumType & funcsArcEndImplCRTP()
const TNumType & funcsArcEndImplVirt() const overridefinal
std::size_t funcsArcSizeImplVirt() const overridefinal
TNumType & ctrlPtVal(const std::size_t &_funcIdx, const std::size_t &_funcCtrlPtIdx, const CtrlPtDim &_ctrlPtDim=CtrlPtDim::VAL)
Access of a parametric function control point dimension.
std::size_t funcCtrlPtSize(const std::size_t &_i) const
Number of control points for a parametric function.
NumType & funcsArcBegin()
Access to the initial value of the arc parametrization.
NumType computeFuncDiff1(const std::size_t &_funcIdx) const
Computes 1st derivative of parametric function with index _funcIdx at parametric arc set by setEvalAr...
void shiftStartCtrlPtImplCRTP(const TNumType &_dt)
TNumType & ctrlPtValImplCRTP(const std::size_t &_funcIdx, const std::size_t &_funcCtrlPtIdx, const CtrlPtDim &_ctrlPtDim)
const TNumType & funcsArcBeginImplVirt() const overridefinal
std::vector< std::size_t > func2Arc_
Maps the parametrized functions to their afferent arc parametrizations.
TNumType computeFuncInt2(const std::size_t &_funcIdx) const
Computes double integral of parametric function with index _funcIdx on interval [funcsArcBegin_, funcsArcEnd_].
TNumType computeFuncInt2ImplCRTP(const std::size_t &_funcIdx) const
FuncCtrlPt(const TNumType &_val, TNumType &_arc)
void setEvalArcImplCRTP(const TNumType &_arcEval, const typename ParamFuncsBaseCRTP< ParamFuncsBaseType >::eAG &_eAG)
TNumType funcsArcEval_
Arc parametrization at the evaluation point (set by setEvalArc)/.
const TNumType & funcsArcImplVirt(const std::size_t &_i, const std::size_t &_j) const overridefinal
FuncCtrlPtType & ctrlPt(const std::size_t &_funcIdx, const std::size_t &_funcCtrlPtIdx)
Access of a parametric function control point.
EvalArcGuarantee
Flags if any guarantees about evaluation arc relative to last evaluation arc are present.
void initBase(const std::array< ParamFuncsStructure, TFuncSize > &_paramFuncsStructure)
TNumType computeFuncInt1ImplVirt(const std::size_t &_funcIdx) const overridefinal
std::size_t funcsSizeImplVirt() const overridefinal
void setEvalArc(const TNumType &_arcEval, const eAG &_eAG=eAG::NONE)
Sets parametric function evaluation arc.
NumType & funcsArcEnd()
Access to the final value of the arc parametrization.
const TNumType & ctrlPtValImplCRTP(const std::size_t &_funcIdx, const std::size_t &_funcCtrlPtIdx, const CtrlPtDim &_ctrlPtDim) const
std::size_t funcCtrlPtSizeImplVirt(const std::size_t &_i) const overridefinal
const FuncCtrlPtType & ctrlPt(const std::size_t &_funcIdx, const std::size_t &_funcCtrlPtIdx) const
Const access of a parametric function control point.
CtrlPtDim
Control point variable dimension.
TNumType & ctrlPtValImplVirt(const std::size_t &_funcIdx, const std::size_t &_funcCtrlPtIdx, const CtrlPtDim &_ctrlPtDim) overridefinal
void initBase(const std::vector< ParamFuncsStructure > &_paramFuncsStructure)
const TNumType & funcsArcBeginImplCRTP() const
const TNumType & ctrlPtVal(const std::size_t &_funcIdx, const std::size_t &_funcCtrlPtIdx, const CtrlPtDim &_ctrlPtDim=CtrlPtDim::VAL) const
Const of a parametric function control point dimension.
friend class ParamFuncsBaseCRTP
void precompute()
Precomputes cached data.
ParamFuncsBase & operator=(const ParamFuncsBase &_other)
close to previous evaluation arc
TNumType & funcsArcBeginImplVirt() overridefinal
NumType computeFuncVal(const std::size_t &_funcIdx) const
Computes value of parametric function with index _funcIdx at parametric arc set by setEvalArc...
std::size_t funcsArcSize(const std::size_t &_i) const
Number of control points of parametrization _i.
std::array< bool, nrModesMax_ > FuncEvalModesFlags
TNumType computeFuncDiff2ImplVirt(const std::size_t &_funcIdx) const overridefinal
void initImplCRTP(const TParamFucsStructVecArr &_paramFuncsStructure)
TNumType & funcsArcBegin()
Access to the initial value of the arc parametrization.
std::size_t funcsArcSizeImplCRTP() const
TNumType computeFuncDiff1ImplVirt(const std::size_t &_funcIdx) const overridefinal
FuncEvalMode
Required type of computation relative to the parametric function.
std::vector< std::vector< FuncCtrlPt< TNumType > > > funcCtrlPt_
Stores the control points for all the parametrized functions.
const TDerived & thisDerived() const
const TNumType & funcsArcEvalImplVirt() const overridefinal
void initImplVirt(const std::vector< ParamFuncsStructure > &_paramFuncsStructure) overridefinal
const TNumType & funcsArcEndImplCRTP() const
TNumType & funcsArcImplVirt(const std::size_t &_i, const std::size_t &_j) overridefinal
const TNumType & funcsArcEval() const
Const access to the active evaluation point arc parametrization.
void setEvalArcImplVirt(const TNumType &_arcEval, const typename ParamFuncsBaseCRTP< ParamFuncsBaseType >::eAG &_eAG) overridefinal
this evaluation arc is at the arc parametrization begin
const NumType & funcsArcEval() const
Const access to the active evaluation point arc parametrization.
this evaluation arc is at the arc parametrization end
std::vector< std::vector< TNumType > > funcCtrlPtArc_
Stores the control points arc parameters for all the parametrized functions.
TNumType & funcsArcImplCRTP(const std::size_t &_i, const std::size_t &_j)
function first derivative
TNumType computeFuncValImplCRTP(const std::size_t &_funcIdx) const
const NumType & funcsArcBegin() const
Const access to the initial value of the arc parametrization.
const NumType & funcsArcEnd() const
Const access to the finall value of the arc parametrization.
std::size_t funcsArcSize(const std::size_t &_i) const
Number of control points of parametrization _i.
static constexpr const std::size_t nrModesMax_
Maximum number of computation modes (except the parametric function itself FUNC). Currently 4 other c...