From 760aca89f4d7cbb426e70e4f77d292e4ff8ac451 Mon Sep 17 00:00:00 2001 From: Kwabena N Amponsah Date: Tue, 23 Apr 2024 22:17:48 +0000 Subject: [PATCH 01/20] #23 clarify pychaste vtk required components --- CMakeLists.txt | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e58e6191..fcb3459e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -34,12 +34,32 @@ find_package(Chaste COMPONENTS cell_based) # PyChaste needs some additional VTK libraries if(VTK_MAJOR_VERSION LESS_EQUAL 6) - find_package(VTK COMPONENTS vtkWrappingPythonCore vtkIOImage vtkIOMovie vtkRenderingAnnotation vtkRenderingFreeType - vtkRenderingFreeTypeOpenGL vtkRenderingCore - vtkRenderingOpenGL vtkInteractionStyle REQUIRED) + find_package(VTK REQUIRED COMPONENTS + vtkInteractionStyle + vtkIOImage + vtkIOMovie + vtkRenderingAnnotation + vtkRenderingCore + vtkRenderingFreeType + vtkRenderingFreeTypeOpenGL + vtkRenderingOpenGL + vtkWrappingPythonCore + ) else() - find_package(VTK COMPONENTS vtkWrappingPythonCore vtkParallelCore vtkParallelMPI vtkIOImage vtkIOMovie vtkRenderingAnnotation - vtkRenderingFreeType vtkRenderingOpenGL2 vtkRenderingCore vtkFiltersProgrammable vtkFiltersVerdict vtkInteractionStyle REQUIRED) + find_package(VTK REQUIRED COMPONENTS + vtkFiltersProgrammable + vtkFiltersVerdict + vtkInteractionStyle + vtkIOImage + vtkIOMovie + vtkParallelCore + vtkParallelMPI + vtkRenderingAnnotation + vtkRenderingCore + vtkRenderingFreeType + vtkRenderingOpenGL2 + vtkWrappingPythonCore + ) endif() list(APPEND Chaste_INCLUDES ${VTK_INCLUDE_DIRS}) From 00d2730a9c9b08f4546f0d4256de5c8edb9674ce Mon Sep 17 00:00:00 2001 From: Kwabena N Amponsah Date: Wed, 8 May 2024 10:01:34 +0000 Subject: [PATCH 02/20] #23 relax cmake vtk parallel mpi constraint --- CMakeLists.txt | 2 -- 1 file changed, 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fcb3459e..b2f10c02 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -52,8 +52,6 @@ else() vtkInteractionStyle vtkIOImage vtkIOMovie - vtkParallelCore - vtkParallelMPI vtkRenderingAnnotation vtkRenderingCore vtkRenderingFreeType From c1d03fbf79ce3b605a749103ed40048e7499adc8 Mon Sep 17 00:00:00 2001 From: Kwabena N Amponsah Date: Fri, 10 May 2024 14:23:45 +0000 Subject: [PATCH 03/20] #23 update vtk6 config --- CMakeLists.txt | 3 --- src/visualization/VtkScene.hpp | 11 +++++++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b2f10c02..29006ab8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,9 +41,7 @@ if(VTK_MAJOR_VERSION LESS_EQUAL 6) vtkRenderingAnnotation vtkRenderingCore vtkRenderingFreeType - vtkRenderingFreeTypeOpenGL vtkRenderingOpenGL - vtkWrappingPythonCore ) else() find_package(VTK REQUIRED COMPONENTS @@ -56,7 +54,6 @@ else() vtkRenderingCore vtkRenderingFreeType vtkRenderingOpenGL2 - vtkWrappingPythonCore ) endif() diff --git a/src/visualization/VtkScene.hpp b/src/visualization/VtkScene.hpp index 82d64eaa..bb71c9ab 100644 --- a/src/visualization/VtkScene.hpp +++ b/src/visualization/VtkScene.hpp @@ -41,8 +41,15 @@ OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include #include -VTK_MODULE_INIT(vtkRenderingOpenGL2); -VTK_MODULE_INIT(vtkRenderingFreeType); +#if VTK_MAJOR_VERSION >= 6 +# include +# if VTK_MAJOR_VERSION == 6 + VTK_MODULE_INIT(vtkRenderingOpenGL); +# else + VTK_MODULE_INIT(vtkRenderingOpenGL2); +# endif + VTK_MODULE_INIT(vtkRenderingFreeType); +#endif #include #include #include From 2b13b5f11a86697aba11c4729b716f2046864834 Mon Sep 17 00:00:00 2001 From: Kwabena N Amponsah Date: Tue, 14 May 2024 08:29:36 +0000 Subject: [PATCH 04/20] #23 update cmake find python vars --- CMakeLists.txt | 2 ++ WrapPython.cmake | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 29006ab8..5b58848c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -42,6 +42,7 @@ if(VTK_MAJOR_VERSION LESS_EQUAL 6) vtkRenderingCore vtkRenderingFreeType vtkRenderingOpenGL + vtkWrappingPythonCore ) else() find_package(VTK REQUIRED COMPONENTS @@ -54,6 +55,7 @@ else() vtkRenderingCore vtkRenderingFreeType vtkRenderingOpenGL2 + vtkWrappingPythonCore ) endif() diff --git a/WrapPython.cmake b/WrapPython.cmake index ae8c70ea..376976e6 100644 --- a/WrapPython.cmake +++ b/WrapPython.cmake @@ -60,7 +60,7 @@ endif() include_directories(${CMAKE_CURRENT_SOURCE_DIR}/dynamic/pybind11/include) add_subdirectory(dynamic/pybind11) -include_directories(${PYTHON_INCLUDE_DIRS}) +include_directories(${PYTHON3_INCLUDE_DIRS}) ######### Build the Python modules ###################### set (PYCHASTE_PYTHON_AUTO_MODULES "") @@ -124,7 +124,7 @@ foreach(val RANGE ${len2}) PREFIX "${PYTHON_MODULE_PREFIX}" SUFFIX ".so") target_compile_features(_chaste_project_PyChaste_${python_module} PRIVATE cxx_range_for) # order is important, pybind and python come first - target_link_libraries(_chaste_project_PyChaste_${python_module} pybind11::module ${PYTHON_LIBRARIES} ${Chaste_THIRD_PARTY_LIBRARIES} ${Chaste_LIBRARIES} ${PYCHASTE_SHARED_LIB}) + target_link_libraries(_chaste_project_PyChaste_${python_module} pybind11::module ${PYTHON3_LIBRARIES} ${Chaste_THIRD_PARTY_LIBRARIES} ${Chaste_LIBRARIES} ${PYCHASTE_SHARED_LIB}) add_dependencies(_chaste_project_PyChaste_${python_module} chaste_project_PyChaste) endforeach() From d6819e016e01b32b42de056eeddcb50be0d4c9e5 Mon Sep 17 00:00:00 2001 From: Kwabena N Amponsah Date: Tue, 14 May 2024 14:13:30 +0000 Subject: [PATCH 05/20] #23 switch vtk test workflow to micromamba --- .github/workflows/test-vtk.yml | 55 ++++++++++++++++++---------------- 1 file changed, 29 insertions(+), 26 deletions(-) diff --git a/.github/workflows/test-vtk.yml b/.github/workflows/test-vtk.yml index e710f092..9b7b36a4 100644 --- a/.github/workflows/test-vtk.yml +++ b/.github/workflows/test-vtk.yml @@ -39,34 +39,37 @@ jobs: sudo apt-get update sudo apt-get install -y cmake g++ xvfb - - name: setup conda - uses: conda-incubator/setup-miniconda@v3 + - name: setup conda environment + uses: mamba-org/setup-micromamba@v1 with: - auto-update-conda: true - use-mamba: true - miniforge-variant: Mambaforge - miniforge-version: latest - channels: pychaste,conda-forge - - - name: install pychaste conda dependencies - run: | - mamba install -n test \ - boost-cpp \ - hdf5="*=*mpi_mpich*" \ - metis \ - mpich \ - notebook \ - parmetis \ - petsc \ - petsc4py \ - six \ - sundials \ - vtk=${{ matrix.vtk-version }} \ - tbb-devel \ - xerces-c \ - xsd \ - xvfbwrapper \ + micromamba-version: latest + condarc: | + channels: + - conda-forge + - pychaste + create-args: >- + boost-cpp + hdf5="*=*mpi_mpich*" + metis + mpich + notebook + parmetis + petsc + petsc4py + pip + setuptools + six + sundials + tbb-devel + vtk=${{ matrix.vtk-version }} + wheel + xerces-c + xsd + xvfbwrapper xorg-libxext + init-shell: bash + cache-environment: true + post-cleanup: 'all' - name: make build directory run: | From 0d79111d28778b1ea2c86027d752b1174c4323b3 Mon Sep 17 00:00:00 2001 From: Kwabena N Amponsah Date: Tue, 14 May 2024 14:16:48 +0000 Subject: [PATCH 06/20] #23 cache mamba workflow downloads --- .github/workflows/test-vtk.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-vtk.yml b/.github/workflows/test-vtk.yml index 9b7b36a4..4efe5bfe 100644 --- a/.github/workflows/test-vtk.yml +++ b/.github/workflows/test-vtk.yml @@ -43,6 +43,7 @@ jobs: uses: mamba-org/setup-micromamba@v1 with: micromamba-version: latest + init-shell: bash condarc: | channels: - conda-forge @@ -67,8 +68,7 @@ jobs: xsd xvfbwrapper xorg-libxext - init-shell: bash - cache-environment: true + cache-downloads: true post-cleanup: 'all' - name: make build directory From 4589de309e457d278824190f2f8f5255153cbc34 Mon Sep 17 00:00:00 2001 From: Kwabena N Amponsah Date: Tue, 14 May 2024 14:19:57 +0000 Subject: [PATCH 07/20] #23 install conda packages to test-env --- .github/workflows/test-vtk.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test-vtk.yml b/.github/workflows/test-vtk.yml index 4efe5bfe..719256e8 100644 --- a/.github/workflows/test-vtk.yml +++ b/.github/workflows/test-vtk.yml @@ -48,6 +48,7 @@ jobs: channels: - conda-forge - pychaste + environment-name: test-env create-args: >- boost-cpp hdf5="*=*mpi_mpich*" From 99cc4b46941a44868c88e7cb7d23353f82fa60c3 Mon Sep 17 00:00:00 2001 From: Kwabena N Amponsah Date: Tue, 14 May 2024 14:22:55 +0000 Subject: [PATCH 08/20] #23 adding conda channels to vtk test --- .github/workflows/test-vtk.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test-vtk.yml b/.github/workflows/test-vtk.yml index 719256e8..55e49804 100644 --- a/.github/workflows/test-vtk.yml +++ b/.github/workflows/test-vtk.yml @@ -50,6 +50,8 @@ jobs: - pychaste environment-name: test-env create-args: >- + -c conda-forge + -c pychaste boost-cpp hdf5="*=*mpi_mpich*" metis From 2ba2a5286b22e99846a0ad1f066efce33ae70071 Mon Sep 17 00:00:00 2001 From: Kwabena N Amponsah Date: Tue, 14 May 2024 14:29:30 +0000 Subject: [PATCH 09/20] #23 update vtk workflow spec syntax --- .github/workflows/test-vtk.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-vtk.yml b/.github/workflows/test-vtk.yml index 55e49804..c06e39bb 100644 --- a/.github/workflows/test-vtk.yml +++ b/.github/workflows/test-vtk.yml @@ -53,7 +53,7 @@ jobs: -c conda-forge -c pychaste boost-cpp - hdf5="*=*mpi_mpich*" + 'hdf5=[build=*mpi_mpich*]' metis mpich notebook @@ -65,7 +65,7 @@ jobs: six sundials tbb-devel - vtk=${{ matrix.vtk-version }} + vtk="${{ matrix.vtk-version }}" wheel xerces-c xsd From 7af7c7a3454fa9af706fb98155b56ecbf94fa2be Mon Sep 17 00:00:00 2001 From: Kwabena N Amponsah Date: Tue, 14 May 2024 17:06:06 +0100 Subject: [PATCH 10/20] #23 cache vtk conda test env --- .github/workflows/test-vtk.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-vtk.yml b/.github/workflows/test-vtk.yml index c06e39bb..131ff525 100644 --- a/.github/workflows/test-vtk.yml +++ b/.github/workflows/test-vtk.yml @@ -71,7 +71,7 @@ jobs: xsd xvfbwrapper xorg-libxext - cache-downloads: true + cache-environment: true post-cleanup: 'all' - name: make build directory From da0ccce44f82858c0e5c20cf820a802a7bf987c5 Mon Sep 17 00:00:00 2001 From: Kwabena N Amponsah Date: Tue, 14 May 2024 17:20:21 +0100 Subject: [PATCH 11/20] #23 disable micromamba run shell --- .github/workflows/test-vtk.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/test-vtk.yml b/.github/workflows/test-vtk.yml index 131ff525..36e1cd63 100644 --- a/.github/workflows/test-vtk.yml +++ b/.github/workflows/test-vtk.yml @@ -15,10 +15,6 @@ jobs: matrix: vtk-version: ["8.2", "9.2"] - defaults: - run: - shell: bash -el {0} - steps: - name: checkout chaste uses: actions/checkout@v4 @@ -43,6 +39,7 @@ jobs: uses: mamba-org/setup-micromamba@v1 with: micromamba-version: latest + generate-run-shell: false init-shell: bash condarc: | channels: @@ -50,10 +47,8 @@ jobs: - pychaste environment-name: test-env create-args: >- - -c conda-forge - -c pychaste boost-cpp - 'hdf5=[build=*mpi_mpich*]' + hdf5=[build=*mpi_mpich*] metis mpich notebook @@ -65,7 +60,7 @@ jobs: six sundials tbb-devel - vtk="${{ matrix.vtk-version }}" + vtk=${{ matrix.vtk-version }} wheel xerces-c xsd @@ -98,21 +93,25 @@ jobs: -DXSD_EXECUTABLE="${CONDA_PREFIX}/bin/xsd" \ ../Chaste/ working-directory: build + shell: bash -el {0} - name: build pychaste run: | cmake --build . --parallel $(nproc) --target project_PyChaste working-directory: build + shell: bash -el {0} - name: build pychaste python module run: | cmake --build . --parallel $(nproc) --target project_PyChaste_Python working-directory: build + shell: bash -el {0} - name: install pychaste run: | pip install . working-directory: build/projects/PyChaste/python + shell: bash -el {0} - name: run tests run: | @@ -120,3 +119,4 @@ jobs: --server-args="-screen 0 1024x768x24" \ ctest -j $(nproc) -L PyChaste --output-on-failure working-directory: build + shell: bash -el {0} From c15d8ff85847b030331f8eaac615e4465a1d25c0 Mon Sep 17 00:00:00 2001 From: Kwabena N Amponsah Date: Tue, 14 May 2024 17:54:22 +0100 Subject: [PATCH 12/20] #23 add fftw to vtk test dependencies --- .github/workflows/test-vtk.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test-vtk.yml b/.github/workflows/test-vtk.yml index 36e1cd63..8fd2eafa 100644 --- a/.github/workflows/test-vtk.yml +++ b/.github/workflows/test-vtk.yml @@ -48,6 +48,7 @@ jobs: environment-name: test-env create-args: >- boost-cpp + fftw hdf5=[build=*mpi_mpich*] metis mpich From 0c1d5f3ca14e9498fd43190c1d94081b26de1dfe Mon Sep 17 00:00:00 2001 From: Kwabena N Amponsah Date: Tue, 14 May 2024 20:09:10 +0100 Subject: [PATCH 13/20] #23 fix conda cmake paths --- .github/workflows/test-vtk.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/test-vtk.yml b/.github/workflows/test-vtk.yml index 8fd2eafa..514c4165 100644 --- a/.github/workflows/test-vtk.yml +++ b/.github/workflows/test-vtk.yml @@ -70,6 +70,14 @@ jobs: cache-environment: true post-cleanup: 'all' + - name: fix cmake paths + run: | + find $CONDA_PREFIX \ + -type f \ + -name '*.cmake' \ + -exec sed -i.bak 's|/usr/lib64/libXext.so|libXext.so|g' {} \; + shell: bash -el {0} + - name: make build directory run: | mkdir -p build From 4fe667d1f2d182253dacee57a70a0e3e922bd485 Mon Sep 17 00:00:00 2001 From: Kwabena N Amponsah Date: Tue, 14 May 2024 20:12:26 +0100 Subject: [PATCH 14/20] #23 find python3 executable --- .github/workflows/test-vtk.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-vtk.yml b/.github/workflows/test-vtk.yml index 514c4165..02ac4598 100644 --- a/.github/workflows/test-vtk.yml +++ b/.github/workflows/test-vtk.yml @@ -76,7 +76,7 @@ jobs: -type f \ -name '*.cmake' \ -exec sed -i.bak 's|/usr/lib64/libXext.so|libXext.so|g' {} \; - shell: bash -el {0} + shell: bash -el {0} - name: make build directory run: | @@ -89,7 +89,7 @@ jobs: cmake \ -DCMAKE_BUILD_TYPE=Release \ - -DPython3_EXECUTABLE=$(which python) \ + -DPython3_EXECUTABLE=$(which python3) \ -DCMAKE_LIBRARY_PATH="${CONDA_PREFIX}/lib" \ -DCMAKE_PREFIX_PATH="${CONDA_PREFIX}" \ -DCMAKE_INSTALL_PREFIX="${CONDA_PREFIX}" \ From 6ec3ab440df01f6a5931bbb97e8ce3c653a01b02 Mon Sep 17 00:00:00 2001 From: Kwabena N Amponsah Date: Wed, 15 May 2024 19:36:10 +0000 Subject: [PATCH 15/20] #23 add matplotlib and numpy to tests --- .github/workflows/test-vtk.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test-vtk.yml b/.github/workflows/test-vtk.yml index 02ac4598..6b6e0b40 100644 --- a/.github/workflows/test-vtk.yml +++ b/.github/workflows/test-vtk.yml @@ -50,9 +50,11 @@ jobs: boost-cpp fftw hdf5=[build=*mpi_mpich*] + matplotlib metis mpich notebook + numpy parmetis petsc petsc4py From 206820d037caf7b0727f0c6672567ffc7051dd96 Mon Sep 17 00:00:00 2001 From: Kwabena N Amponsah Date: Wed, 15 May 2024 19:37:44 +0000 Subject: [PATCH 16/20] #23 render window before image filter --- src/visualization/VtkScene.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/visualization/VtkScene.cpp b/src/visualization/VtkScene.cpp index 478a9c52..2208930a 100644 --- a/src/visualization/VtkScene.cpp +++ b/src/visualization/VtkScene.cpp @@ -34,6 +34,7 @@ OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include +#include #include #include #include @@ -115,14 +116,14 @@ VtkScene::VtkScene() mHasStarted(false), mAddAnnotations(false), mOutputFrequency(1), - mpCellPopulationGenerator(boost::shared_ptr >(new CellPopulationPyChasteActorGenerator())) + mpCellPopulationGenerator(boost::make_shared >()) { mpRenderer->SetBackground(1.0, 1.0, 1.0); mpRenderWindow->AddRenderer(mpRenderer); mpRenderWindow->SetSize(800.0, 600.0); mpRenderWindowInteractor->SetRenderWindow(mpRenderWindow); - vtkSmartPointer style = vtkSmartPointer::New(); + auto style = vtkSmartPointer::New(); mpRenderWindowInteractor->SetInteractorStyle( style ); } @@ -269,9 +270,10 @@ void VtkScene::Start() mpRenderWindow->SetOffScreenRendering(1); } - if(mSaveAsImages or mSaveAsAnimation) + if(mSaveAsImages || mSaveAsAnimation) { mpRenderWindow->SetOffScreenRendering(1); + mpRenderWindow->Render(); mWindowToImageFilter->SetInput(mpRenderWindow); mWindowToImageFilter->Update(); } From d4ebca63987b97cc2e33c165f65349da87983992 Mon Sep 17 00:00:00 2001 From: Kwabena N Amponsah Date: Wed, 15 May 2024 19:38:35 +0000 Subject: [PATCH 17/20] #23 remove redundant header text --- .../CellPopulationPyChasteActorGenerator.cpp | 37 +------------------ 1 file changed, 1 insertion(+), 36 deletions(-) diff --git a/src/visualization/CellPopulationPyChasteActorGenerator.cpp b/src/visualization/CellPopulationPyChasteActorGenerator.cpp index acebae1c..94d8cd0b 100644 --- a/src/visualization/CellPopulationPyChasteActorGenerator.cpp +++ b/src/visualization/CellPopulationPyChasteActorGenerator.cpp @@ -33,41 +33,6 @@ OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* - -Copyright (c) 2005-2024, University of Oxford. - All rights reserved. - - University of Oxford means the Chancellor, Masters and Scholars of the - University of Oxford, having an administrative office at Wellington - Square, Oxford OX1 2JD, UK. - - This file is CellPopulation of Chaste. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the University of Oxford nor the names of its - contributors may be used to endorse or promote products derived from this - software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A CellPopulationICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - */ - #include #include #include @@ -145,7 +110,7 @@ void CellPopulationPyChasteActorGenerator::AddCaBasedCellPopulationActor(vt vtkSmartPointer p_geom_filter = vtkSmartPointer::New(); boost::shared_ptr > p_ca_population = - boost::dynamic_pointer_cast >(mpCellPopulation); + boost::dynamic_pointer_cast >(mpCellPopulation); if(p_ca_population && mShowPottsMeshEdges) { From eb3de86d4b2050868bbf87e12326ae044d70454a Mon Sep 17 00:00:00 2001 From: Kwabena N Amponsah Date: Wed, 15 May 2024 19:39:17 +0000 Subject: [PATCH 18/20] #23 update TestVtkSceneWithCaBased --- .../visualization/TestVtkSceneWithCaBased.hpp | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/test/visualization/TestVtkSceneWithCaBased.hpp b/test/visualization/TestVtkSceneWithCaBased.hpp index c10b79dc..31ee878c 100644 --- a/test/visualization/TestVtkSceneWithCaBased.hpp +++ b/test/visualization/TestVtkSceneWithCaBased.hpp @@ -33,8 +33,8 @@ OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef TESTVTKSCENEWITHCABASEDPOPULATION_HPP_ -#define TESTVTKSCENEWITHCABASEDPOPULATION_HPP_ +#ifndef TEST_VTK_SCENE_WITH_CA_BASED_HPP_ +#define TEST_VTK_SCENE_WITH_CA_BASED_HPP_ #include #include "CheckpointArchiveTypes.hpp" @@ -77,7 +77,7 @@ class TestVtkSceneWithCaBasedPopulation : public AbstractCellBasedTestSuite void Test2dCaBasedPopulation() { - OutputFileHandler file_handler1 = OutputFileHandler("TestVtkSceneWithCaBasedPopulation/2d"); + OutputFileHandler file_handler = OutputFileHandler("TestVtkSceneWithCaBasedPopulation/2d"); PottsMeshGenerator<2> generator(10, 0, 0, 10, 0, 0); boost::shared_ptr > p_mesh = generator.GetMesh(); @@ -94,16 +94,15 @@ class TestVtkSceneWithCaBasedPopulation : public AbstractCellBasedTestSuite cells_generator.GenerateBasic(cells, location_indices.size()); // Create cell population - boost::shared_ptr > p_cell_population = - boost::shared_ptr >(new CaBasedCellPopulation<2> (*p_mesh, cells, location_indices)); + auto p_cell_population = boost::make_shared >(*p_mesh, cells, location_indices); - boost::shared_ptr > p_scene = boost::shared_ptr >(new VtkScene<2>); + auto p_scene = boost::make_shared >(); p_scene->SetCellPopulation(p_cell_population); p_scene->SetSaveAsImages(true); - p_scene->SetOutputFilePath(file_handler1.GetOutputDirectoryFullPath()+"/cell_population"); + p_scene->SetOutputFilePath(file_handler.GetOutputDirectoryFullPath()+"/cell_population"); p_scene->GetCellPopulationActorGenerator()->SetShowPottsMeshEdges(true); - boost::shared_ptr > p_scene_modifier = boost::shared_ptr >(new VtkSceneModifier<2>); + auto p_scene_modifier = boost::make_shared >(); p_scene_modifier->SetVtkScene(p_scene); p_scene->Start(); @@ -132,15 +131,15 @@ class TestVtkSceneWithCaBasedPopulation : public AbstractCellBasedTestSuite // Create cell population boost::shared_ptr > p_cell_population = - boost::shared_ptr >(new CaBasedCellPopulation<3> (*p_mesh, cells, location_indices)); + boost::make_shared >(*p_mesh, cells, location_indices); - boost::shared_ptr > p_scene = boost::shared_ptr >(new VtkScene<3>); + boost::shared_ptr > p_scene = boost::make_shared >(); p_scene->SetCellPopulation(p_cell_population); p_scene->SetSaveAsImages(true); p_scene->GetCellPopulationActorGenerator()->SetShowPottsMeshEdges(true); p_scene->SetOutputFilePath(file_handler1.GetOutputDirectoryFullPath()+"/cell_population"); - boost::shared_ptr > p_scene_modifier = boost::shared_ptr >(new VtkSceneModifier<3>); + boost::shared_ptr > p_scene_modifier = boost::make_shared >(); p_scene_modifier->SetVtkScene(p_scene); p_scene->Start(); @@ -153,4 +152,5 @@ class TestVtkSceneWithCaBasedPopulation : public AbstractCellBasedTestSuite } }; -#endif + +#endif //TEST_VTK_SCENE_WITH_CA_BASED_HPP_ From d5fc9e76c5f031c59c65d69d1455de13ab11103e Mon Sep 17 00:00:00 2001 From: Kwabena N Amponsah Date: Thu, 16 May 2024 13:33:57 +0000 Subject: [PATCH 19/20] #23 no renderer clear --- src/visualization/VtkScene.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/visualization/VtkScene.cpp b/src/visualization/VtkScene.cpp index 2208930a..2ea30cb7 100644 --- a/src/visualization/VtkScene.cpp +++ b/src/visualization/VtkScene.cpp @@ -187,7 +187,6 @@ void VtkScene::ResetRenderer(unsigned time_step) { mpRenderer->RemoveActor(p_actor); } - mpRenderer->Clear(); if(mpCellPopulationGenerator) { From 579aea9d3e00fcc9a0d8bca3da071fe2ef2ad056 Mon Sep 17 00:00:00 2001 From: Kwabena N Amponsah Date: Thu, 16 May 2024 13:34:40 +0000 Subject: [PATCH 20/20] #23 update immersed boundary tutorial --- .../tutorials/TestImmersedBoundaryTutorial.py | 25 +++++-------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/test/python/cell_based/tutorials/TestImmersedBoundaryTutorial.py b/test/python/cell_based/tutorials/TestImmersedBoundaryTutorial.py index 0469e81a..3a29b05b 100644 --- a/test/python/cell_based/tutorials/TestImmersedBoundaryTutorial.py +++ b/test/python/cell_based/tutorials/TestImmersedBoundaryTutorial.py @@ -99,11 +99,7 @@ def test_simple_immersed_boundary_simulation(self): ## Setup the simulation environment in the notebook - SetupNotebookTest() - - ## Set the start time for the simulation - - SimulationTime.Instance().SetStartTime(0.0) + # JUPYTER_SETUP ## Next, we define the necessary geometry by generating a mesh to ## contain a single cell. @@ -212,7 +208,7 @@ def test_simple_immersed_boundary_simulation(self): ## Reset the simulation environment in the notebook - TearDownNotebookTest() + # JUPYTER_TEARDOWN ## ### 2. Adding More Cells @@ -222,11 +218,7 @@ def test_multicell_immersed_boundary_simulation(self): ## Setup the simulation environment in the notebook - SetupNotebookTest() - - ## Set the start time for the simulation - - SimulationTime.Instance().SetStartTime(0.0) + # JUPYTER_SETUP ## We can use the mesh generator to generate multiple cells. The first ## parameter of the mesh generator constructor controls the number of @@ -335,7 +327,7 @@ def test_multicell_immersed_boundary_simulation(self): ## Reset the simulation environment in the notebook - TearDownNotebookTest() + # JUPYTER_TEARDOWN ## ### 3. Adding Fluid Sources ## Now that we are familiar with how to generate the cells, we will @@ -347,11 +339,7 @@ def test_fluid_source_immersed_boundary_simulation(self): ## Setup the simulation environment in the notebook - SetupNotebookTest() - - ## Set the start time for the simulation - - SimulationTime.Instance().SetStartTime(0.0) + # JUPYTER_SETUP ## We begin by constructing a fluid source object: @@ -457,8 +445,7 @@ def test_fluid_source_immersed_boundary_simulation(self): nb_manager.vtk_show(scene, height=300) ## Reset the simulation environment in the notebook - - TearDownNotebookTest() + # JUPYTER_TEARDOWN ## #### Further Exercises ## * Try integrating a different cell cycle model to introduce cell