Skip to content

Commit

Permalink
#62 Add numerical method classes
Browse files Browse the repository at this point in the history
  • Loading branch information
kwabenantim committed Mar 25, 2024
1 parent eca7431 commit c1461d8
Show file tree
Hide file tree
Showing 10 changed files with 292 additions and 0 deletions.
80 changes: 80 additions & 0 deletions dynamic/wrappers/cell_based/AbstractNumericalMethod2_2.cppwg.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
#include <pybind11/pybind11.h>
#include <pybind11/stl.h>
#include <set>
#include <vector>
#include <string>
#include <map>
#include "SmartPointers.hpp"
#include "UblasIncludes.hpp"
#include "AbstractNumericalMethod.hpp"

#include "AbstractNumericalMethod2_2.cppwg.hpp"

namespace py = pybind11;
typedef AbstractNumericalMethod<2, 2 > AbstractNumericalMethod2_2;
PYBIND11_DECLARE_HOLDER_TYPE(T, boost::shared_ptr<T>);

class AbstractNumericalMethod2_Overrides : public AbstractNumericalMethod2_2{
public:
using AbstractNumericalMethod2_2::AbstractNumericalMethod;
void UpdateAllNodePositions(double dt) override {
PYBIND11_OVERRIDE_PURE(
void,
AbstractNumericalMethod2_2,
UpdateAllNodePositions,
dt);
}
void OutputNumericalMethodParameters(::out_stream & rParamsFile) override {
PYBIND11_OVERRIDE(
void,
AbstractNumericalMethod2_2,
OutputNumericalMethodParameters,
rParamsFile);
}

};
void register_AbstractNumericalMethod2_class(py::module &m){
py::class_<AbstractNumericalMethod2_2 , AbstractNumericalMethod2_Overrides , boost::shared_ptr<AbstractNumericalMethod2_2 > >(m, "AbstractNumericalMethod2_2")
.def(py::init< >())
.def(
"SetCellPopulation",
(void(AbstractNumericalMethod2_2::*)(::AbstractOffLatticeCellPopulation<2> *)) &AbstractNumericalMethod2_2::SetCellPopulation,
" " , py::arg("pPopulation") )
.def(
"SetForceCollection",
(void(AbstractNumericalMethod2_2::*)(::std::vector<boost::shared_ptr<AbstractForce<2>>> *)) &AbstractNumericalMethod2_2::SetForceCollection,
" " , py::arg("pForces") )
.def(
"SetBoundaryConditions",
(void(AbstractNumericalMethod2_2::*)(::std::vector<boost::shared_ptr<AbstractCellPopulationBoundaryCondition<2>>> *)) &AbstractNumericalMethod2_2::SetBoundaryConditions,
" " , py::arg("pBoundaryConditions") )
.def(
"SetUseAdaptiveTimestep",
(void(AbstractNumericalMethod2_2::*)(bool)) &AbstractNumericalMethod2_2::SetUseAdaptiveTimestep,
" " , py::arg("useAdaptiveTimestep") )
.def(
"SetUseUpdateNodeLocation",
(void(AbstractNumericalMethod2_2::*)(bool)) &AbstractNumericalMethod2_2::SetUseUpdateNodeLocation,
" " , py::arg("useUpdateNodeLocation") )
.def(
"GetUseUpdateNodeLocation",
(bool(AbstractNumericalMethod2_2::*)()) &AbstractNumericalMethod2_2::GetUseUpdateNodeLocation,
" " )
.def(
"HasAdaptiveTimestep",
(bool(AbstractNumericalMethod2_2::*)()) &AbstractNumericalMethod2_2::HasAdaptiveTimestep,
" " )
.def(
"UpdateAllNodePositions",
(void(AbstractNumericalMethod2_2::*)(double)) &AbstractNumericalMethod2_2::UpdateAllNodePositions,
" " , py::arg("dt") )
.def(
"OutputNumericalMethodInfo",
(void(AbstractNumericalMethod2_2::*)(::out_stream &)) &AbstractNumericalMethod2_2::OutputNumericalMethodInfo,
" " , py::arg("rParamsFile") )
.def(
"OutputNumericalMethodParameters",
(void(AbstractNumericalMethod2_2::*)(::out_stream &)) &AbstractNumericalMethod2_2::OutputNumericalMethodParameters,
" " , py::arg("rParamsFile") )
;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#ifndef AbstractNumericalMethod2_hpp__cppwg_wrapper
#define AbstractNumericalMethod2_hpp__cppwg_wrapper

#include <pybind11/pybind11.h>

void register_AbstractNumericalMethod2_class(pybind11::module &m);
#endif // AbstractNumericalMethod2_hpp__cppwg_wrapper
80 changes: 80 additions & 0 deletions dynamic/wrappers/cell_based/AbstractNumericalMethod3_3.cppwg.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
#include <pybind11/pybind11.h>
#include <pybind11/stl.h>
#include <set>
#include <vector>
#include <string>
#include <map>
#include "SmartPointers.hpp"
#include "UblasIncludes.hpp"
#include "AbstractNumericalMethod.hpp"

#include "AbstractNumericalMethod3_3.cppwg.hpp"

namespace py = pybind11;
typedef AbstractNumericalMethod<3, 3 > AbstractNumericalMethod3_3;
PYBIND11_DECLARE_HOLDER_TYPE(T, boost::shared_ptr<T>);

class AbstractNumericalMethod3_Overrides : public AbstractNumericalMethod3_3{
public:
using AbstractNumericalMethod3_3::AbstractNumericalMethod;
void UpdateAllNodePositions(double dt) override {
PYBIND11_OVERRIDE_PURE(
void,
AbstractNumericalMethod3_3,
UpdateAllNodePositions,
dt);
}
void OutputNumericalMethodParameters(::out_stream & rParamsFile) override {
PYBIND11_OVERRIDE(
void,
AbstractNumericalMethod3_3,
OutputNumericalMethodParameters,
rParamsFile);
}

};
void register_AbstractNumericalMethod3_class(py::module &m){
py::class_<AbstractNumericalMethod3_3 , AbstractNumericalMethod3_Overrides , boost::shared_ptr<AbstractNumericalMethod3_3 > >(m, "AbstractNumericalMethod3_3")
.def(py::init< >())
.def(
"SetCellPopulation",
(void(AbstractNumericalMethod3_3::*)(::AbstractOffLatticeCellPopulation<3> *)) &AbstractNumericalMethod3_3::SetCellPopulation,
" " , py::arg("pPopulation") )
.def(
"SetForceCollection",
(void(AbstractNumericalMethod3_3::*)(::std::vector<boost::shared_ptr<AbstractForce<3>>> *)) &AbstractNumericalMethod3_3::SetForceCollection,
" " , py::arg("pForces") )
.def(
"SetBoundaryConditions",
(void(AbstractNumericalMethod3_3::*)(::std::vector<boost::shared_ptr<AbstractCellPopulationBoundaryCondition<3>>> *)) &AbstractNumericalMethod3_3::SetBoundaryConditions,
" " , py::arg("pBoundaryConditions") )
.def(
"SetUseAdaptiveTimestep",
(void(AbstractNumericalMethod3_3::*)(bool)) &AbstractNumericalMethod3_3::SetUseAdaptiveTimestep,
" " , py::arg("useAdaptiveTimestep") )
.def(
"SetUseUpdateNodeLocation",
(void(AbstractNumericalMethod3_3::*)(bool)) &AbstractNumericalMethod3_3::SetUseUpdateNodeLocation,
" " , py::arg("useUpdateNodeLocation") )
.def(
"GetUseUpdateNodeLocation",
(bool(AbstractNumericalMethod3_3::*)()) &AbstractNumericalMethod3_3::GetUseUpdateNodeLocation,
" " )
.def(
"HasAdaptiveTimestep",
(bool(AbstractNumericalMethod3_3::*)()) &AbstractNumericalMethod3_3::HasAdaptiveTimestep,
" " )
.def(
"UpdateAllNodePositions",
(void(AbstractNumericalMethod3_3::*)(double)) &AbstractNumericalMethod3_3::UpdateAllNodePositions,
" " , py::arg("dt") )
.def(
"OutputNumericalMethodInfo",
(void(AbstractNumericalMethod3_3::*)(::out_stream &)) &AbstractNumericalMethod3_3::OutputNumericalMethodInfo,
" " , py::arg("rParamsFile") )
.def(
"OutputNumericalMethodParameters",
(void(AbstractNumericalMethod3_3::*)(::out_stream &)) &AbstractNumericalMethod3_3::OutputNumericalMethodParameters,
" " , py::arg("rParamsFile") )
;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#ifndef AbstractNumericalMethod3_hpp__cppwg_wrapper
#define AbstractNumericalMethod3_hpp__cppwg_wrapper

#include <pybind11/pybind11.h>

void register_AbstractNumericalMethod3_class(pybind11::module &m);
#endif // AbstractNumericalMethod3_hpp__cppwg_wrapper
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#include <pybind11/pybind11.h>
#include <pybind11/stl.h>
#include <set>
#include <vector>
#include <string>
#include <map>
#include "SmartPointers.hpp"
#include "UblasIncludes.hpp"
#include "ForwardEulerNumericalMethod.hpp"

#include "ForwardEulerNumericalMethod2_2.cppwg.hpp"

namespace py = pybind11;
typedef ForwardEulerNumericalMethod<2, 2 > ForwardEulerNumericalMethod2_2;
PYBIND11_DECLARE_HOLDER_TYPE(T, boost::shared_ptr<T>);

class ForwardEulerNumericalMethod2_Overrides : public ForwardEulerNumericalMethod2_2{
public:
using ForwardEulerNumericalMethod2_2::ForwardEulerNumericalMethod;
void UpdateAllNodePositions(double dt) override {
PYBIND11_OVERRIDE(
void,
ForwardEulerNumericalMethod2_2,
UpdateAllNodePositions,
dt);
}
void OutputNumericalMethodParameters(::out_stream & rParamsFile) override {
PYBIND11_OVERRIDE(
void,
ForwardEulerNumericalMethod2_2,
OutputNumericalMethodParameters,
rParamsFile);
}

};
void register_ForwardEulerNumericalMethod2_class(py::module &m){
py::class_<ForwardEulerNumericalMethod2_2 , ForwardEulerNumericalMethod2_Overrides , boost::shared_ptr<ForwardEulerNumericalMethod2_2 > , AbstractNumericalMethod<2> >(m, "ForwardEulerNumericalMethod2_2")
.def(py::init< >())
.def(
"UpdateAllNodePositions",
(void(ForwardEulerNumericalMethod2_2::*)(double)) &ForwardEulerNumericalMethod2_2::UpdateAllNodePositions,
" " , py::arg("dt") )
.def(
"OutputNumericalMethodParameters",
(void(ForwardEulerNumericalMethod2_2::*)(::out_stream &)) &ForwardEulerNumericalMethod2_2::OutputNumericalMethodParameters,
" " , py::arg("rParamsFile") )
;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#ifndef ForwardEulerNumericalMethod2_hpp__cppwg_wrapper
#define ForwardEulerNumericalMethod2_hpp__cppwg_wrapper

#include <pybind11/pybind11.h>

void register_ForwardEulerNumericalMethod2_class(pybind11::module &m);
#endif // ForwardEulerNumericalMethod2_hpp__cppwg_wrapper
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#include <pybind11/pybind11.h>
#include <pybind11/stl.h>
#include <set>
#include <vector>
#include <string>
#include <map>
#include "SmartPointers.hpp"
#include "UblasIncludes.hpp"
#include "ForwardEulerNumericalMethod.hpp"

#include "ForwardEulerNumericalMethod3_3.cppwg.hpp"

namespace py = pybind11;
typedef ForwardEulerNumericalMethod<3, 3 > ForwardEulerNumericalMethod3_3;
PYBIND11_DECLARE_HOLDER_TYPE(T, boost::shared_ptr<T>);

class ForwardEulerNumericalMethod3_Overrides : public ForwardEulerNumericalMethod3_3{
public:
using ForwardEulerNumericalMethod3_3::ForwardEulerNumericalMethod;
void UpdateAllNodePositions(double dt) override {
PYBIND11_OVERRIDE(
void,
ForwardEulerNumericalMethod3_3,
UpdateAllNodePositions,
dt);
}
void OutputNumericalMethodParameters(::out_stream & rParamsFile) override {
PYBIND11_OVERRIDE(
void,
ForwardEulerNumericalMethod3_3,
OutputNumericalMethodParameters,
rParamsFile);
}

};
void register_ForwardEulerNumericalMethod3_class(py::module &m){
py::class_<ForwardEulerNumericalMethod3_3 , ForwardEulerNumericalMethod3_Overrides , boost::shared_ptr<ForwardEulerNumericalMethod3_3 > , AbstractNumericalMethod<3> >(m, "ForwardEulerNumericalMethod3_3")
.def(py::init< >())
.def(
"UpdateAllNodePositions",
(void(ForwardEulerNumericalMethod3_3::*)(double)) &ForwardEulerNumericalMethod3_3::UpdateAllNodePositions,
" " , py::arg("dt") )
.def(
"OutputNumericalMethodParameters",
(void(ForwardEulerNumericalMethod3_3::*)(::out_stream &)) &ForwardEulerNumericalMethod3_3::OutputNumericalMethodParameters,
" " , py::arg("rParamsFile") )
;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#ifndef ForwardEulerNumericalMethod3_hpp__cppwg_wrapper
#define ForwardEulerNumericalMethod3_hpp__cppwg_wrapper

#include <pybind11/pybind11.h>

void register_ForwardEulerNumericalMethod3_class(pybind11::module &m);
#endif // ForwardEulerNumericalMethod3_hpp__cppwg_wrapper
4 changes: 4 additions & 0 deletions dynamic/wrappers/cell_based/cell_based.main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -753,6 +753,10 @@ PYBIND11_MODULE(_chaste_project_PyChaste_cell_based, m)
register_ImmersedBoundarySvgWriter3_class(m);
register_NormallyDistributedTargetAreaModifier2_class(m);
register_NormallyDistributedTargetAreaModifier3_class(m);
register_AbstractNumericalMethod2_2_class(m);
register_AbstractNumericalMethod3_3_class(m);
register_ForwardEulerNumericalMethod2_2_class(m);
register_ForwardEulerNumericalMethod3_3_class(m);
register_AbstractCellBasedSimulation2_2_class(m);
register_AbstractCellBasedSimulation3_3_class(m);
register_SimulationTime_class(m);
Expand Down
4 changes: 4 additions & 0 deletions dynamic/wrappers/wrapper_header_collection.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -662,6 +662,10 @@ template class ImmersedBoundarySvgWriter<2>;
template class ImmersedBoundarySvgWriter<3>;
template class NormallyDistributedTargetAreaModifier<2>;
template class NormallyDistributedTargetAreaModifier<3>;
template class AbstractNumericalMethod<2,2>;
template class AbstractNumericalMethod<3,3>;
template class ForwardEulerNumericalMethod<2,2>;
template class ForwardEulerNumericalMethod<3,3>;
template class AbstractCellBasedSimulation<2,2>;
template class AbstractCellBasedSimulation<3,3>;
template class OnLatticeSimulation<2>;
Expand Down

0 comments on commit c1461d8

Please sign in to comment.