diff --git a/C++/nonLin/libNonLin.cc b/C++/nonLin/libNonLin.cc index 3e93a2634ede2863661d2f4aaa0709494cf1f57f..ae18de51d8487dc397c797ebf006f02efa1115df 100644 --- a/C++/nonLin/libNonLin.cc +++ b/C++/nonLin/libNonLin.cc @@ -91,8 +91,11 @@ void declare_nonLinCF_harmonicBalance(py::module &m){ .def("Update", overload_cast_<>()(&nonLinCF_harmonicBalance<T, DIM>::Update), "Updates the output CF according to the current input CF") .def("Update", overload_cast_<const vector<shared_ptr<CoefficientFunction>> >()(&nonLinCF_harmonicBalance<T, DIM>::Update), "Updates the output CF according to the given input CF") .def("getParts", &nonLinCF_harmonicBalance<T, DIM>::getParts) + .def("getParts", &nonLinCF_harmonicBalance<T, DIM>::getParts) .def("getTi", &nonLinCF_harmonicBalance<T, DIM>::getTi) - .def_property("omega", &nonLinCF_harmonicBalance<T, DIM>::getOmegas, &nonLinCF_harmonicBalance<T, DIM>::setOmegas) + .def("copy", &nonLinCF_harmonicBalance<T, DIM>::copy) + .def("__get_item__", &nonLinCF_harmonicBalance<T, DIM>::operator[]) + .def_property("omegas", &nonLinCF_harmonicBalance<T, DIM>::getOmegas, &nonLinCF_harmonicBalance<T, DIM>::setOmegas) ; } diff --git a/C++/nonLin/nonLinCF.cc b/C++/nonLin/nonLinCF.cc index e75e42c314a0262acc4c2fb96e27c5b630ab8e80..7b1e0e87c617d5175910e3c59ea0078088dfa853 100644 --- a/C++/nonLin/nonLinCF.cc +++ b/C++/nonLin/nonLinCF.cc @@ -427,6 +427,14 @@ nonLinCF_harmonicBalance<T, DIM>::nonLinCF_harmonicBalance(shared_ptr<MeshAccess Update(); } +template <typename T, unsigned int DIM> +nonLinCF_harmonicBalance<T, DIM>::nonLinCF_harmonicBalance(const nonLinCF_harmonicBalance& o ): +nonLinCF<T, DIM>{o}, + ptrInput_i{o.ptrInput_i}, omega_i{o.omega_i}, ti{o.ti}, nonLin_parts{o.nonLin_parts}{ + Update(); +} + + template <typename T, unsigned int DIM> void nonLinCF_harmonicBalance<T, DIM>::Update(){ Update(ptrInput_i); diff --git a/C++/nonLin/nonLinCF.h b/C++/nonLin/nonLinCF.h index 8e6668cec5ebfedd5e37a313f7911732c2c1a230..b85a6e8b2308e33eec3dc537b93f9af2f99b0dcd 100644 --- a/C++/nonLin/nonLinCF.h +++ b/C++/nonLin/nonLinCF.h @@ -151,6 +151,13 @@ class nonLinCF_harmonicBalance : public nonLinCF<T, DIM>{ const std::string cFieldIn="H", const std::string cFieldOut="B", const shared_ptr<CoefficientFunction>& ptrMask=nullptr, unsigned int order=1, bool usePreisBiro=false); + nonLinCF_harmonicBalance(const nonLinCF_harmonicBalance&); + + + nonLinCF_harmonicBalance copy(){ + return nonLinCF_harmonicBalance(*this); + } + virtual void Update(); virtual void Update(const vector<shared_ptr<CoefficientFunction>> ptrInput); @@ -172,6 +179,10 @@ class nonLinCF_harmonicBalance : public nonLinCF<T, DIM>{ return nonLin_parts; } + std::shared_ptr<nonLinCF<T, DIM>> operator [] (const unsigned int o) const{ + return nonLin_parts[o]; + } + private: vector<shared_ptr<CoefficientFunction>> ptrInput_i;