Skip to content

Commit

Permalink
#24 less verbose boost shared pointer
Browse files Browse the repository at this point in the history
  • Loading branch information
kwabenantim committed May 17, 2024
1 parent 6b0201d commit f74cb66
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 20 deletions.
7 changes: 3 additions & 4 deletions test/visualization/TestVtkSceneWithCaBased.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,16 +130,15 @@ class TestVtkSceneWithCaBasedPopulation : public AbstractCellBasedTestSuite
cells_generator.GenerateBasic(cells, location_indices.size());

// Create cell population
boost::shared_ptr<CaBasedCellPopulation<3> > p_cell_population =
boost::make_shared<CaBasedCellPopulation<3> >(*p_mesh, cells, location_indices);
auto p_cell_population = boost::make_shared<CaBasedCellPopulation<3> >(*p_mesh, cells, location_indices);

boost::shared_ptr<VtkScene<3> > p_scene = boost::make_shared<VtkScene<3> >();
auto p_scene = boost::make_shared<VtkScene<3> >();
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<VtkSceneModifier<3> > p_scene_modifier = boost::make_shared<VtkSceneModifier<3> >();
auto p_scene_modifier = boost::make_shared<VtkSceneModifier<3> >();
p_scene_modifier->SetVtkScene(p_scene);

p_scene->Start();
Expand Down
14 changes: 6 additions & 8 deletions test/visualization/TestVtkSceneWithMeshBased.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,16 +87,15 @@ class TestVtkSceneWithMeshBasedPopulation : public AbstractCellBasedTestSuite
MAKE_PTR(TransitCellProliferativeType, p_transit_type);
CellsGenerator<UniformCellCycleModel, 2> cells_generator;
cells_generator.GenerateBasicRandom(cells, location_indices.size(), p_transit_type);
boost::shared_ptr<MeshBasedCellPopulationWithGhostNodes<2> > p_cell_population =
boost::shared_ptr<MeshBasedCellPopulationWithGhostNodes<2> >(new MeshBasedCellPopulationWithGhostNodes<2> (*p_mesh, cells, location_indices));
auto p_cell_population = boost::make_shared<MeshBasedCellPopulationWithGhostNodes<2> >(*p_mesh, cells, location_indices);
p_cell_population->AddPopulationWriter<VoronoiDataWriter>();

boost::shared_ptr<VtkScene<2> > p_scene = boost::shared_ptr<VtkScene<2> >(new VtkScene<2>);
auto p_scene = boost::make_shared<VtkScene<2> >();
p_scene->SetCellPopulation(p_cell_population);
p_scene->SetSaveAsImages(true);
p_scene->SetOutputFilePath(file_handler1.GetOutputDirectoryFullPath()+"/cell_population");

boost::shared_ptr<VtkSceneModifier<2> > p_scene_modifier = boost::shared_ptr<VtkSceneModifier<2> >(new VtkSceneModifier<2>);
auto p_scene_modifier = boost::make_shared<VtkSceneModifier<2> >();
p_scene_modifier->SetVtkScene(p_scene);
p_scene->Start();

Expand Down Expand Up @@ -128,17 +127,16 @@ class TestVtkSceneWithMeshBasedPopulation : public AbstractCellBasedTestSuite
CellsGenerator<UniformCellCycleModel, 3> cells_generator;
cells_generator.GenerateBasicRandom(cells, mesh.GetNumNodes(), p_transit_type);

boost::shared_ptr<MeshBasedCellPopulation<3> > p_cell_population =
boost::shared_ptr<MeshBasedCellPopulation<3> >(new MeshBasedCellPopulation<3> (mesh, cells));
auto p_cell_population = boost::make_shared<MeshBasedCellPopulation<3> >(mesh, cells);
p_cell_population->SetAbsoluteMovementThreshold(DBL_MAX);
p_cell_population->AddPopulationWriter<VoronoiDataWriter>();

boost::shared_ptr<VtkScene<3> > p_scene = boost::shared_ptr<VtkScene<3> >(new VtkScene<3>);
auto p_scene = boost::make_shared<VtkScene<3> >();
p_scene->SetCellPopulation(p_cell_population);
p_scene->SetSaveAsImages(true);
p_scene->SetOutputFilePath(file_handler1.GetOutputDirectoryFullPath()+"/cell_population");

boost::shared_ptr<VtkSceneModifier<3> > p_scene_modifier = boost::shared_ptr<VtkSceneModifier<3> >(new VtkSceneModifier<3>);
auto p_scene_modifier = boost::make_shared<VtkSceneModifier<3> >();
p_scene_modifier->SetVtkScene(p_scene);
p_scene->Start();

Expand Down
14 changes: 6 additions & 8 deletions test/visualization/TestVtkSceneWithPottsBased.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,7 @@ class TestVtkScene : public AbstractCellBasedTestSuite
CellsGenerator<UniformCellCycleModel, 2> cells_generator;
cells_generator.GenerateBasicRandom(cells, p_mesh->GetNumElements(), p_transit_type);

boost::shared_ptr<PottsBasedCellPopulation<2> > p_cell_population =
boost::shared_ptr<PottsBasedCellPopulation<2> >(new PottsBasedCellPopulation<2> (*p_mesh, cells));
auto p_cell_population = boost::make_shared<PottsBasedCellPopulation<2> >(*p_mesh, cells);
p_cell_population->SetTemperature(0.1);
p_cell_population->SetNumSweepsPerTimestep(1);

Expand All @@ -98,14 +97,14 @@ class TestVtkScene : public AbstractCellBasedTestSuite
simulator.SetDt(0.1);
simulator.SetSamplingTimestepMultiple(10);

boost::shared_ptr<VtkScene<2> > p_scene = boost::shared_ptr<VtkScene<2> >(new VtkScene<2>);
auto p_scene = boost::make_shared<VtkScene<2> >();
p_scene->SetCellPopulation(p_cell_population);
p_scene->SetIsInteractive(true);
p_scene->SetSaveAsImages(false);
p_scene->GetCellPopulationActorGenerator()->SetShowPottsMeshEdges(true);
p_scene->SetOutputFilePath(file_handler1.GetOutputDirectoryFullPath()+"/cell_population");

boost::shared_ptr<VtkSceneModifier<2> > p_scene_modifier = boost::shared_ptr<VtkSceneModifier<2> >(new VtkSceneModifier<2>);
auto p_scene_modifier = boost::make_shared<VtkSceneModifier<2> >();
p_scene_modifier->SetVtkScene(p_scene);
p_scene_modifier->SetUpdateFrequency(10);
p_scene->Start();
Expand All @@ -132,8 +131,7 @@ class TestVtkScene : public AbstractCellBasedTestSuite
CellsGenerator<UniformCellCycleModel, 3> cells_generator;
cells_generator.GenerateBasicRandom(cells, p_mesh->GetNumElements(), p_transit_type);

boost::shared_ptr<PottsBasedCellPopulation<3> > p_cell_population =
boost::shared_ptr<PottsBasedCellPopulation<3> >(new PottsBasedCellPopulation<3> (*p_mesh, cells));
auto p_cell_population = boost::make_shared<PottsBasedCellPopulation<3> >(*p_mesh, cells);
p_cell_population->SetTemperature(0.1);
p_cell_population->SetNumSweepsPerTimestep(1);

Expand All @@ -143,15 +141,15 @@ class TestVtkScene : public AbstractCellBasedTestSuite
simulator.SetDt(0.1);
simulator.SetSamplingTimestepMultiple(100);

boost::shared_ptr<VtkScene<3> > p_scene = boost::shared_ptr<VtkScene<3> >(new VtkScene<3>);
auto p_scene = boost::make_shared<VtkScene<3> >();
p_scene->SetCellPopulation(p_cell_population);
p_scene->SetIsInteractive(true);
p_scene->SetSaveAsImages(false);
p_scene->GetCellPopulationActorGenerator()->SetShowCellCentres(true);
p_scene->GetCellPopulationActorGenerator()->SetShowPottsMeshOutlines(true);
p_scene->SetOutputFilePath(file_handler1.GetOutputDirectoryFullPath()+"/cell_population");

boost::shared_ptr<VtkSceneModifier<3> > p_scene_modifier = boost::shared_ptr<VtkSceneModifier<3> >(new VtkSceneModifier<3>);
auto p_scene_modifier = boost::make_shared<VtkSceneModifier<3> >();
p_scene_modifier->SetVtkScene(p_scene);
p_scene->Start();

Expand Down

0 comments on commit f74cb66

Please sign in to comment.