55 std::shared_ptr<EquationSystem> eqn)
65 for (
int i = 0; i < pFields.size(); ++i)
67 expLists.append(py::object(pFields[i]));
96 return this->get_override(
"IsTimeDependent")();
107 if (py::len(args) != 3)
109 throw NekError(
"Filter.Create() requires three arguments: "
110 "filter name, a SessionReader object and an "
111 "EquationSystem object.");
114 std::string filterName = py::extract<std::string>(args[0]);
116 if (!py::extract<LibUtilities::SessionReaderSharedPtr>(args[1]).check())
118 throw NekError(
"Second argument to Create() should be a SessionReader "
122 if (!py::extract<EquationSystemSharedPtr>(args[2]).check())
124 throw NekError(
"Second argument to Create() should be a EquationSystem "
129 py::extract<LibUtilities::SessionReaderSharedPtr>(args[1]);
133 py::list items = kwargs.items();
136 for (
int i = 0; i < py::len(items); ++i)
138 std::string arg = py::extract<std::string>(items[i][0]);
140 py::extract<std::string>(items[i][1].attr(
"__str__")());
144 std::shared_ptr<Filter> filter =
154 filter->Initialise(expLists, time);
161 filter->Update(expLists, time);
168 filter->Finalise(expLists, time);
173 return filter->IsTimeDependent();
182 py::implicitly_convertible<std::shared_ptr<FilterWrap>,
183 std::shared_ptr<Filter>>();
190 py::class_<FilterWrap, std::shared_ptr<FilterWrap>, boost::noncopyable>(
201 .staticmethod(
"Create")
202 .def(
"Register", [](std::string
const &filterName,
203 py::object &obj) { fac(filterName, obj); })
204 .staticmethod(
"Register");
Nektar::ErrorUtil::NekError NekError
FilterSharedPtr Filter_Create(py::tuple args, py::dict kwargs)
Lightweight wrapper for Filter factory creation function.
bool Filter_IsTimeDependent(std::shared_ptr< Filter > filter)
void Filter_Finalise(std::shared_ptr< Filter > filter, Array< OneD, MultiRegions::ExpListSharedPtr > expLists, NekDouble time)
void Filter_Initialise(std::shared_ptr< Filter > filter, Array< OneD, MultiRegions::ExpListSharedPtr > expLists, NekDouble time)
void Filter_Update(std::shared_ptr< Filter > filter, Array< OneD, MultiRegions::ExpListSharedPtr > expLists, NekDouble time)
tBaseSharedPtr CreateInstance(tKey idKey, tParam... args)
Create an instance of the class referred to by idKey.
std::map< std::string, std::string > ParamMap
std::shared_ptr< SessionReader > SessionReaderSharedPtr
std::shared_ptr< Filter > FilterSharedPtr
A shared pointer to a Driver object.
std::shared_ptr< EquationSystem > EquationSystemSharedPtr
A shared pointer to an EquationSystem object.
FilterFactory & GetFilterFactory()
Filter wrapper to handle virtual function calls in Filter and its subclasses.
FilterWrap(LibUtilities::SessionReaderSharedPtr session, std::shared_ptr< EquationSystem > eqn)
Constructor, which is identical to Filter.
void v_Update(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, const NekDouble &time) override
void v_Initialise(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, const NekDouble &time) override
py::list ArrayOneDToPyList(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields)
void v_Finalise(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, const NekDouble &time) override
bool v_IsTimeDependent() override
A helper class that for factory-based classes allows std::shared_ptr<T> as something that boost::pyth...