25 const std::unordered_map<std::string, VtkAgents*>& vtk_agents,
26 const std::unordered_map<std::string, VtkDiffusionGrid*>& vtk_dgrids) {
28 auto* param = sim->GetParam();
30 std::stringstream agents;
31 uint64_t num_agents = param->visualize_agents.size();
33 for (
const auto& entry : param->visualize_agents) {
34 std::string agent_name = entry.first;
36 auto search = vtk_agents.find(agent_name);
37 if (search == vtk_agents.end()) {
40 auto* agent_grid = search->second;
42 agents <<
" {" << std::endl
43 <<
" \"name\":\"" << agent_name <<
"\"," << std::endl;
45 agents <<
" \"glyph\":\"Glyph\"," << std::endl
46 <<
" \"shape\":\"Sphere\"," << std::endl
47 <<
" \"scaling_attribute\":\"diameter_\"" << std::endl;
48 }
else if (agent_grid->GetShape() ==
kCylinder) {
49 agents <<
" \"glyph\":\"BDMGlyph\"," << std::endl
50 <<
" \"shape\":\"Cylinder\"," << std::endl
51 <<
" \"x_scaling_attribute\":\"diameter_\"," << std::endl
52 <<
" \"y_scaling_attribute\":\"actual_length_\"," << std::endl
53 <<
" \"z_scaling_attribute\":\"diameter_\"," << std::endl
54 <<
" \"Vectors\":\"spring_axis_\"," << std::endl
55 <<
" \"MassLocation\":\"mass_location_\"" << std::endl;
58 if (counter != num_agents - 1) {
66 std::stringstream substances;
67 uint64_t num_substances = param->visualize_diffusion.size();
68 bool write_comma =
false;
69 for (uint64_t i = 0; i < num_substances; i++) {
70 auto& name = param->visualize_diffusion[i].name;
72 auto search = vtk_dgrids.find(name);
73 if (search == vtk_dgrids.end()) {
76 auto* dgrid = search->second;
79 if (!dgrid->IsUsed()) {
81 "Visualize Diffusion Grids",
82 "You are trying to visualize diffusion grid ", name,
83 ", but it has not been created during the entire simulation. "
84 "Please make sure the names in the "
85 "configuration file match the ones in the simulation.");
92 substances <<
" { \"name\":\"" << name <<
"\", ";
93 std::string has_gradient =
94 param->visualize_diffusion[i].gradient ?
"true" :
"false";
95 substances <<
"\"has_gradient\":\"" << has_gradient <<
"\" }";
99 std::stringstream str;
100 str <<
"{" << std::endl
101 <<
" \"simulation\": {" << std::endl
102 <<
" \"name\":\"" << sim->GetUniqueName() <<
"\"," << std::endl
103 <<
" \"result_dir\":\"" << sim->GetOutputDir() <<
"\"" << std::endl
104 <<
" }," << std::endl
105 <<
" \"agents\": [" << std::endl
106 << agents.str() <<
" ]," << std::endl
107 <<
" \"extracellular_substances\": [" << std::endl
108 << substances.str() << std::endl
109 <<
" ]," << std::endl
110 <<
" \"insitu_script_arguments\": \""
111 << param->pv_insitu_pipelinearguments <<
"\"" << std::endl