Skip to content

Commit f74cb66

Browse files
committed
#24 less verbose boost shared pointer
1 parent 6b0201d commit f74cb66

File tree

3 files changed

+15
-20
lines changed

3 files changed

+15
-20
lines changed

test/visualization/TestVtkSceneWithCaBased.hpp

+3-4
Original file line numberDiff line numberDiff line change
@@ -130,16 +130,15 @@ class TestVtkSceneWithCaBasedPopulation : public AbstractCellBasedTestSuite
130130
cells_generator.GenerateBasic(cells, location_indices.size());
131131

132132
// Create cell population
133-
boost::shared_ptr<CaBasedCellPopulation<3> > p_cell_population =
134-
boost::make_shared<CaBasedCellPopulation<3> >(*p_mesh, cells, location_indices);
133+
auto p_cell_population = boost::make_shared<CaBasedCellPopulation<3> >(*p_mesh, cells, location_indices);
135134

136-
boost::shared_ptr<VtkScene<3> > p_scene = boost::make_shared<VtkScene<3> >();
135+
auto p_scene = boost::make_shared<VtkScene<3> >();
137136
p_scene->SetCellPopulation(p_cell_population);
138137
p_scene->SetSaveAsImages(true);
139138
p_scene->GetCellPopulationActorGenerator()->SetShowPottsMeshEdges(true);
140139
p_scene->SetOutputFilePath(file_handler1.GetOutputDirectoryFullPath()+"/cell_population");
141140

142-
boost::shared_ptr<VtkSceneModifier<3> > p_scene_modifier = boost::make_shared<VtkSceneModifier<3> >();
141+
auto p_scene_modifier = boost::make_shared<VtkSceneModifier<3> >();
143142
p_scene_modifier->SetVtkScene(p_scene);
144143

145144
p_scene->Start();

test/visualization/TestVtkSceneWithMeshBased.hpp

+6-8
Original file line numberDiff line numberDiff line change
@@ -87,16 +87,15 @@ class TestVtkSceneWithMeshBasedPopulation : public AbstractCellBasedTestSuite
8787
MAKE_PTR(TransitCellProliferativeType, p_transit_type);
8888
CellsGenerator<UniformCellCycleModel, 2> cells_generator;
8989
cells_generator.GenerateBasicRandom(cells, location_indices.size(), p_transit_type);
90-
boost::shared_ptr<MeshBasedCellPopulationWithGhostNodes<2> > p_cell_population =
91-
boost::shared_ptr<MeshBasedCellPopulationWithGhostNodes<2> >(new MeshBasedCellPopulationWithGhostNodes<2> (*p_mesh, cells, location_indices));
90+
auto p_cell_population = boost::make_shared<MeshBasedCellPopulationWithGhostNodes<2> >(*p_mesh, cells, location_indices);
9291
p_cell_population->AddPopulationWriter<VoronoiDataWriter>();
9392

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

99-
boost::shared_ptr<VtkSceneModifier<2> > p_scene_modifier = boost::shared_ptr<VtkSceneModifier<2> >(new VtkSceneModifier<2>);
98+
auto p_scene_modifier = boost::make_shared<VtkSceneModifier<2> >();
10099
p_scene_modifier->SetVtkScene(p_scene);
101100
p_scene->Start();
102101

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

131-
boost::shared_ptr<MeshBasedCellPopulation<3> > p_cell_population =
132-
boost::shared_ptr<MeshBasedCellPopulation<3> >(new MeshBasedCellPopulation<3> (mesh, cells));
130+
auto p_cell_population = boost::make_shared<MeshBasedCellPopulation<3> >(mesh, cells);
133131
p_cell_population->SetAbsoluteMovementThreshold(DBL_MAX);
134132
p_cell_population->AddPopulationWriter<VoronoiDataWriter>();
135133

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

141-
boost::shared_ptr<VtkSceneModifier<3> > p_scene_modifier = boost::shared_ptr<VtkSceneModifier<3> >(new VtkSceneModifier<3>);
139+
auto p_scene_modifier = boost::make_shared<VtkSceneModifier<3> >();
142140
p_scene_modifier->SetVtkScene(p_scene);
143141
p_scene->Start();
144142

test/visualization/TestVtkSceneWithPottsBased.hpp

+6-8
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,7 @@ class TestVtkScene : public AbstractCellBasedTestSuite
8787
CellsGenerator<UniformCellCycleModel, 2> cells_generator;
8888
cells_generator.GenerateBasicRandom(cells, p_mesh->GetNumElements(), p_transit_type);
8989

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

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

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

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

135-
boost::shared_ptr<PottsBasedCellPopulation<3> > p_cell_population =
136-
boost::shared_ptr<PottsBasedCellPopulation<3> >(new PottsBasedCellPopulation<3> (*p_mesh, cells));
134+
auto p_cell_population = boost::make_shared<PottsBasedCellPopulation<3> >(*p_mesh, cells);
137135
p_cell_population->SetTemperature(0.1);
138136
p_cell_population->SetNumSweepsPerTimestep(1);
139137

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

146-
boost::shared_ptr<VtkScene<3> > p_scene = boost::shared_ptr<VtkScene<3> >(new VtkScene<3>);
144+
auto p_scene = boost::make_shared<VtkScene<3> >();
147145
p_scene->SetCellPopulation(p_cell_population);
148146
p_scene->SetIsInteractive(true);
149147
p_scene->SetSaveAsImages(false);
150148
p_scene->GetCellPopulationActorGenerator()->SetShowCellCentres(true);
151149
p_scene->GetCellPopulationActorGenerator()->SetShowPottsMeshOutlines(true);
152150
p_scene->SetOutputFilePath(file_handler1.GetOutputDirectoryFullPath()+"/cell_population");
153151

154-
boost::shared_ptr<VtkSceneModifier<3> > p_scene_modifier = boost::shared_ptr<VtkSceneModifier<3> >(new VtkSceneModifier<3>);
152+
auto p_scene_modifier = boost::make_shared<VtkSceneModifier<3> >();
155153
p_scene_modifier->SetVtkScene(p_scene);
156154
p_scene->Start();
157155

0 commit comments

Comments
 (0)