@@ -27,8 +27,9 @@ struct ODE_system {
2727 const std::map<std::string, DiffusionGrid*>& mdg;
2828 const std::vector<real_t > param;
2929
30- ODE_system (std::map<std::string, DiffusionGrid*>& m, const std::vector<real_t >& p)
31- : mdg(m), param(p) {}
30+ ODE_system (std::map<std::string, DiffusionGrid*>& m,
31+ const std::vector<real_t >& p)
32+ : mdg(m), param(p) {}
3233
3334 void operator ()(const b_vector_t & x, b_vector_t & dxdt, real_t t,
3435 Agent* agent) const {
@@ -46,11 +47,12 @@ struct ODE_jacobian {
4647 const std::map<std::string, DiffusionGrid*>& mdg;
4748 const std::vector<real_t > param;
4849
49- ODE_jacobian (std::map<std::string, DiffusionGrid*>& m, const std::vector<real_t >& p)
50- : mdg(m), param(p) {}
50+ ODE_jacobian (std::map<std::string, DiffusionGrid*>& m,
51+ const std::vector<real_t >& p)
52+ : mdg(m), param(p) {}
5153
52- void operator ()(const b_vector_t & x, b_matrix_t & jac, real_t t, b_vector_t & dfdt,
53- Agent* agent) const {
54+ void operator ()(const b_vector_t & x, b_matrix_t & jac, real_t t,
55+ b_vector_t & dfdt, Agent* agent) const {
5456 // auto& xyz = agent->GetPosition();
5557 // auto dg = mdg.find("protein")->second;
5658 // const real_t protein = dg->GetValue(xyz);
@@ -70,8 +72,7 @@ struct ODE_jacobian {
7072};
7173
7274struct ODE_output {
73- void operator ()(const b_vector_t & x, real_t t,
74- const Agent* agent) {
75+ void operator ()(const b_vector_t & x, real_t t, const Agent* agent) {
7576 auto & xyz = agent->GetPosition ();
7677 std::clog << agent->GetUid ()
7778 << ' ,' << xyz[0 ] << ' ,' << xyz[1 ] << ' ,' << xyz[2 ]
@@ -95,14 +96,14 @@ inline int Simulate(int argc, const char** argv) {
9596 param->output_dir = " ex1" ;
9697 param->use_progress_bar = false ;
9798 param->bound_space = Param::BoundSpaceMode::kOpen ;
98- param->min_bound = 0.0 ;
99- param->max_bound = + 100.0 ;
99+ param->min_bound = 0.0 ;
100+ param->max_bound = 100.0 ;
100101 param->export_visualization = false ;
101102 param->visualization_interval = 1 ;
102- param->visualize_agents [" Cell" ] = { " diameter_" , " volume_" };
103+ param->visualize_agents [" Cell" ] = {" diameter_" , " volume_" };
103104 param->statistics = false ;
104105 param->simulation_time_step = 1.0 ;
105- param->visualize_diffusion = { Param::VisualizeDiffusion{" cytokine" , true , true } };
106+ param->visualize_diffusion = {Param::VisualizeDiffusion{" cytokine" , true , true }};
106107 param->calculate_gradients = false ;
107108 param->diffusion_method = " euler" ;
108109 };
@@ -118,7 +119,7 @@ inline int Simulate(int argc, const char** argv) {
118119 // BioDynaMo's diffusion grid sample points in each dimension
119120 int n_DG = 51 ;
120121
121- ModelInitializer::DefineSubstance (kProtein , " protein" , 0.0 /dt_BDM , 0.0 /dt_BDM , n_DG);
122+ ModelInitializer::DefineSubstance (kProtein , " protein" , 0.0 , 0.0 , n_DG);
122123 ModelInitializer::AddBoundaryConditions (
123124 kProtein , BoundaryConditionType::kNeumann ,
124125 std::make_unique<ConstantBoundaryCondition>(0 ));
@@ -133,21 +134,22 @@ inline int Simulate(int argc, const char** argv) {
133134 c->SetMass (1.0 );
134135 c->SetPosition (xyz);
135136#ifndef __ROOTCLING__
136- c->AddBehavior (new RegulatoryNetwork (dt_RN, 1000 , {1 ., 5 ., 7 .},
137- // ODE_solver::Euler,
138- // ODE_solver::Rosenbrock,
139- ODE_solver::RungeKutta,
140- ODE_system (dg_map,{0.2 ,0.1 ,3.0 }),
141- ODE_jacobian (dg_map,{0.2 ,0.1 ,3.0 }),
142- ODE_output ()));
137+ c->AddBehavior (new RegulatoryNetwork (
138+ dt_RN, 1000 , {1 ., 5 ., 7 .},
139+ // ODE_solver::Euler,
140+ // ODE_solver::Rosenbrock,
141+ ODE_solver::RungeKutta,
142+ ODE_system (dg_map,{0.2 ,0.1 ,3.0 }),
143+ ODE_jacobian (dg_map,{0.2 ,0.1 ,3.0 }),
144+ ODE_output ()));
143145#endif
144146 return c;
145147 };
146148
147149 int n_cells = 1 ;
148150 ModelInitializer::CreateAgentsRandom (0.0 , 0.0001 , n_cells, generate_cells);
149151
150- for (int s= 0 ; s< 10 ; s++)
152+ for (int s = 0 ; s < 10 ; s++)
151153 sim.GetScheduler ()->Simulate (1 );
152154
153155 // restore the original buffer of std::clog
@@ -156,8 +158,8 @@ inline int Simulate(int argc, const char** argv) {
156158 return 0 ;
157159}
158160
159- } // namespace ex1
161+ } // namespace ex1
160162
161- } // namespace bdm
163+ } // namespace bdm
162164
163- #endif // BDM_EX1_H_
165+ #endif // BDM_EX1_H_
0 commit comments