Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update wrappers to current Chaste develop branch #7

Closed
6 tasks done
kwabenantim opened this issue Jun 7, 2023 · 9 comments · Fixed by #12
Closed
6 tasks done

Update wrappers to current Chaste develop branch #7

kwabenantim opened this issue Jun 7, 2023 · 9 comments · Fixed by #12
Assignees
Labels
enhancement New feature or request

Comments

@kwabenantim
Copy link
Member

kwabenantim commented Jun 7, 2023

  • Add wrappers for new functionality introduced into Chaste trunk by Jack & Alex
  • List what needs wrapping
  • Update wrapper generation yml
  • Generate new wrappers with CPPWG
  • Manually add wrappers that cannot be autogenerated
  • Fix issues with automatically generated wrappers if necessary
  • Rebuild conda package
@kwabenantim kwabenantim self-assigned this Jun 7, 2023
@kwabenantim
Copy link
Member Author

kwabenantim commented Jun 8, 2023

New classes to wrap

See Chaste/Chaste#104:

  • BiasedBernoulliTrialCellCycleModel
  • SlidingBoundaryCondition
  • VonMisesVertexBasedDivisionRule
  • ConstantTargetAreaModifier
  • DivisionBiasTrackingModifier
  • LabelDependentBernoulliTrialCellCycleModel
  • PlanarPolarisedFarhadifarForce
  • ExtrinsicPullModifier

See Chaste/Chaste#56:

  • AlwaysDivideCellCycleModel
  • CellEdgeData
  • CellSrnModel
  • DeltaNotchEdgeSrnModel
  • DeltaNotchInteriorSrnModel
  • DeltaNotchEdgeOdeSystem
  • DeltaNotchInteriorOdeSystem
  • VertexBasedPopulationSrn
  • DeltaNotchEdgeInteriorTrackingModifier
  • Edge
  • EdgeHelper
  • EdgeOperation

@kwabenantim kwabenantim linked a pull request Jun 10, 2023 that will close this issue
@kwabenantim kwabenantim added the enhancement New feature or request label Jun 10, 2023
@kwabenantim
Copy link
Member Author

kwabenantim commented Jun 13, 2023

CPPWG Error Description

Unable to find declaration Clazz< 2, 2 >

Error Message

Traceback (most recent call last):
  File "~/Chaste/projects/PyChaste/dynamic/wrapper_generators/generate.py", line 55, in <module>
    generator.generate_wrapper()
  File "~/cppwg/cppwg/generators.py", line 200, in generate_wrapper
    module_writer.write()
  File "~/cppwg/cppwg/writers/module_writer.py", line 112, in write
    class_decl = self.source_ns.class_(fullName.replace(" ",""))
  File "~/.local/lib/python3.10/site-packages/pygccxml/declarations/scopedef.py", line 546, in class_
    self._find_single(
  File "~/.local/lib/python3.10/site-packages/pygccxml/declarations/scopedef.py", line 464, in _find_single
    found = matcher.get_single(decl_matcher, decls, False)
  File "~/.local/lib/python3.10/site-packages/pygccxml/declarations/scopedef.py", line 90, in get_single
    raise runtime_errors.declaration_not_found_t(decl_matcher)
pygccxml.declarations.runtime_errors.declaration_not_found_t: Unable to find declaration. Matcher: [(decl type==class_t) and (name==AbstractCellBasedSimulationModifier< 2, 2 >)]
make[3]: *** [projects/PyChaste/CMakeFiles/project_PyChaste_Python_Bindings.dir/build.make:70: project_PyChaste_Python_Bindings] Error 1
make[2]: *** [CMakeFiles/Makefile2:21607: projects/PyChaste/CMakeFiles/project_PyChaste_Python_Bindings.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:21614: projects/PyChaste/CMakeFiles/project_PyChaste_Python_Bindings.dir/rule] Error 2
make: *** [Makefile:8103: project_PyChaste_Python_Bindings] Error 2

Affected Classes

AbstractLinearPde
AbstractLinearParabolicPde
RandomDirectionCentreBasedDivisionRule
FixedCentreBasedDivisionRule
AbstractCentreBasedDivisionRule
GeneralisedLinearSpringForce
DifferentialAdhesionGeneralisedLinearSpringForce
AbstractCellPopulationBoundaryCondition
PlaneBoundaryCondition
AttractingPlaneBoundaryCondition
AbstractCellPopulation
AbstractOffLatticeCellPopulation
AbstractCentreBasedCellPopulation
MeshBasedCellPopulation
OffLatticeSimulation
AbstractForce
AbstractTwoBodyInteractionForce
AbstractCellBasedSimulationModifier

Fix
The investigation continues on cppwg/issues/1

@kwabenantim
Copy link
Member Author

kwabenantim commented Jun 13, 2023

CPPWG Error Description

Unable to find declaration Clazz

Error Message

Traceback (most recent call last):
  File "~/Chaste/projects/PyChaste/dynamic/wrapper_generators/generate.py", line 55, in <module>
    generator.generate_wrapper()
  File "~/cppwg/cppwg/generators.py", line 200, in generate_wrapper
    module_writer.write()
  File "~/cppwg/cppwg/writers/module_writer.py", line 112, in write
    class_decl = self.source_ns.class_(fullName.replace(" ",""))
  File "~/.local/lib/python3.10/site-packages/pygccxml/declarations/scopedef.py", line 546, in class_
    self._find_single(
  File "~/.local/lib/python3.10/site-packages/pygccxml/declarations/scopedef.py", line 464, in _find_single
    found = matcher.get_single(decl_matcher, decls, False)
  File "~/.local/lib/python3.10/site-packages/pygccxml/declarations/scopedef.py", line 90, in get_single
    raise runtime_errors.declaration_not_found_t(decl_matcher)
pygccxml.declarations.runtime_errors.declaration_not_found_t: Unable to find declaration. Matcher: [(decl type==class_t) and (name==EdgeHelper)]
make[3]: *** [projects/PyChaste/CMakeFiles/project_PyChaste_Python_Bindings.dir/build.make:70: project_PyChaste_Python_Bindings] Error 1
make[2]: *** [CMakeFiles/Makefile2:21607: projects/PyChaste/CMakeFiles/project_PyChaste_Python_Bindings.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:21614: projects/PyChaste/CMakeFiles/project_PyChaste_Python_Bindings.dir/rule] Error 2
make: *** [Makefile:8103: project_PyChaste_Python_Bindings] Error 2

Affected Classes

CellwiseOdeSystemInformation
CellCycleModelOdeSolver
EdgeHelper

Fix
The investigation continues on cppwg/issues/1

@kwabenantim
Copy link
Member Author

Continuing Wrapper Creation Strategy

  • Generate wrappers that can be generated with CPPWG
  • Manually add remaining wrappers
  • Fix Unable to find declaration errors (cppwg/issues/1) later.

@kwabenantim
Copy link
Member Author

kwabenantim commented Jun 15, 2023

Error: "Already Registered"

import chaste.mesh
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
/tmp/ipykernel_49991/3595748004.py in <module>
----> 1 import chaste.mesh

~/Chaste/build/projects/PyChaste/python/chaste/mesh/__init__.py in <module>
     41 warnings.filterwarnings("ignore")
     42 
---> 43 from chaste.mesh._chaste_project_PyChaste_mesh import *

ImportError: generic_type: type "ChastePoint2" is already registered!

Fix

  • It's not clear why we have this error. ChastePoint2 is registered only once in the codebase. However, this fixes it:
py::class_<ChastePoint2  ...  >(m, "ChastePoint2", py::module_local())
  • Root cause was order of registrations. Resolved by correcting order and removing duplicate registrations by other modules. py::module_local() not necessary.

@kwabenantim
Copy link
Member Author

kwabenantim commented Jun 15, 2023

Error: "could not convert default argument"

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "~/Chaste/build/projects/PyChaste/python/chaste/cell_based/__init__.py", line 40, in <module>
    from chaste.cell_based._chaste_project_PyChaste_cell_based import *
ImportError: arg(): could not convert default argument 'pMeshCuboid: boost::shared_ptr<ChasteCuboid<2u> >' in method '<class 'chaste.cell_based._chaste_project_PyChaste_cell_based.EllipticBoxDomainPdeModifier2'>.__init__' into a Python object (type not registered yet?)

Fix

  • Wrap ChasteCuboid

@kwabenantim
Copy link
Member Author

kwabenantim commented Jun 15, 2023

Excluded Classes (All Now Included)

  • Alarcon2004OxygenBasedCellCycleModel
  • EllipticBoxDomainPdeModifier
  • ParabolicBoxDomainPdeModifier
  • RandomCaSwitchingUpdateRule
  • TysonNovakCellCycleModel

Excluded Methods

  • Cylindrical2dNodesOnlyMesh::SetUpBoxCollection (unit_vector argument)
  • PeriodicNodesOnlyMesh::SetUpBoxCollection (zero_vector argument)
  • TysonNovak2001OdeSystem::AnalyticJacobian (double ** argument)
  • VertexMesh::GetEdgeHelper (EdgeHelper is not constructible)

To Add Manually

  • CylindricalHoneycombMeshGenerator
  • ToroidalHoneycombMeshGenerator
  • ToroidalHoneycombVertexMeshGenerator
  • VoronoiVertexMeshGenerator
  • ChasteCuboid

@kwabenantim
Copy link
Member Author

kwabenantim commented Jun 16, 2023

Missing Parent Classes is some wrappers
See cppwg/5

Fix
Add parent classes in all wrappers where they are missing.

@kwabenantim
Copy link
Member Author

kwabenantim commented Jun 16, 2023

Conda Build Issues
gcc 11.4.0 from conda has trouble with:

mEdges.push_back(std::make_unique<Edge<SPACE_DIM>> (mEdges.size(), nodeA, nodeB));

Error

Edge<SPACE_DIM>* EdgeHelper<SPACE_DIM>::GetEdgeFromNodes(Node<SPACE_DIM>*, Node<SPACE_DIM>*)':
/home/conda/feedstock_root/build_artifacts/chaste_1686921952219/work/mesh/src/common/EdgeHelper.cpp:49:31: error: 'make_unique' is not a member of 'std'
   49 |         mEdges.push_back(std::make_unique<Edge<SPACE_DIM>> (mEdges.size(), nodeA, nodeB));
      |                               ^~~~~~~~~~~
/home/conda/feedstock_root/build_artifacts/chaste_1686921952219/work/mesh/src/common/EdgeHelper.cpp:49:31: note: 'std::make_unique' is only available from C++14 onwards
/home/conda/feedstock_root/build_artifacts/chaste_1686921952219/work/mesh/src/common/EdgeHelper.cpp:49:57: error: expected primary-expression before '>' token
   49 |         mEdges.push_back(std::make_unique<Edge<SPACE_DIM>> (mEdges.size(), nodeA, nodeB));

However, this compiles fine with gcc 11.3.0 on Ubuntu 22.04

Temporary Workaround

mEdges.push_back(std::unique_ptr<Edge<SPACE_DIM>> (new Edge<SPACE_DIM>{mEdges.size(), nodeA, nodeB}));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant