BioDynaMo  v1.05.120-25dc9790
adaptor.h
Go to the documentation of this file.
1 // -----------------------------------------------------------------------------
2 //
3 // Copyright (C) 2021 CERN & University of Surrey for the benefit of the
4 // BioDynaMo collaboration. All Rights Reserved.
5 //
6 // Licensed under the Apache License, Version 2.0 (the "License");
7 // you may not use this file except in compliance with the License.
8 //
9 // See the LICENSE file distributed with this work for details.
10 // See the NOTICE file distributed with this work for additional information
11 // regarding copyright ownership.
12 //
13 // -----------------------------------------------------------------------------
14 
15 #ifndef CORE_VISUALIZATION_PARAVIEW_ADAPTOR_H_
16 #define CORE_VISUALIZATION_PARAVIEW_ADAPTOR_H_
17 
18 #include <algorithm>
19 #include <cstdlib>
20 #include <fstream>
21 #include <memory>
22 #include <sstream>
23 #include <string>
24 #include <type_traits>
25 #include <unordered_map>
26 #include <vector>
27 
28 #include "core/param/param.h"
29 #include "core/resource_manager.h"
30 #include "core/scheduler.h"
31 #include "core/shape.h"
32 #include "core/simulation.h"
33 #include "core/util/log.h"
35 
36 namespace bdm {
37 
40  public:
44 
45  ~ParaviewAdaptor() override;
46 
48  void Visualize() override;
49 
50  struct ParaviewImpl;
51 
52  private:
53  std::unique_ptr<ParaviewImpl> impl_;
54  static std::atomic<uint64_t> counter_;
55 
57  bool initialized_ = false;
59 
64 
68  void Initialize();
69 
71  void InsituVisualization();
72 
75  void ExportVisualization();
76 
78  void CreateVtkObjects();
79 
82 
85 
86  // ---------------------------------------------------------------------------
87  // generate files
88 
90 
94  static void GenerateParaviewState();
95 
98  static std::string BuildPythonScriptString(const std::string& python_script);
99 
101 };
102 
103 } // namespace bdm
104 
105 #endif // CORE_VISUALIZATION_PARAVIEW_ADAPTOR_H_
shape.h
bdm::ParaviewAdaptor::ExportVisualization
void ExportVisualization()
Definition: adaptor.cc:184
bdm::ParaviewAdaptor::initialized_
bool initialized_
only needed for insitu visualization
Definition: adaptor.h:57
bdm::ParaviewAdaptor::DISABLED_DiffusionTest_ModelInitializer_Test
friend class DISABLED_DiffusionTest_ModelInitializer_Test
Definition: adaptor.h:63
bdm
Definition: agent.cc:39
bdm::VisualizationAdaptor
Definition: visualization_adaptor.h:22
bdm::ParaviewAdaptor::Visualize
void Visualize() override
Visualize one timestep based on the configuration in Param
Definition: adaptor.cc:98
bdm::ParaviewAdaptor::Initialize
void Initialize()
Definition: adaptor.cc:125
bdm::ParaviewAdaptor::counter_
static std::atomic< uint64_t > counter_
Definition: adaptor.h:54
scheduler.h
bdm::ParaviewAdaptor::ParaviewImpl
Definition: adaptor.cc:50
bdm::ParaviewAdaptor::~ParaviewAdaptor
~ParaviewAdaptor() override
Definition: adaptor.cc:68
bdm::ParaviewAdaptor::ParaviewAdaptorTest_GenerateSimulationInfoJson_Test
friend class ParaviewAdaptorTest_GenerateSimulationInfoJson_Test
Definition: adaptor.h:60
bdm::ParaviewAdaptor::ParaviewAdaptorTest_GenerateParaviewState_Test
friend class ParaviewAdaptorTest_GenerateParaviewState_Test
Definition: adaptor.h:61
bdm::ParaviewAdaptor::BuildDiffusionGridVTKStructures
void BuildDiffusionGridVTKStructures()
Create the required vtk objects to visualize diffusion grids.
Definition: adaptor.cc:223
bdm::ParaviewAdaptor::BuildAgentsVTKStructures
void BuildAgentsVTKStructures()
Create the required vtk objects to visualize agents.
Definition: adaptor.cc:214
log.h
bdm::ParaviewAdaptor::ClassDefNV
ClassDefNV(ParaviewAdaptor, 1)
bdm::ParaviewAdaptor::GenerateParaviewState
static void GenerateParaviewState()
Definition: adaptor.cc:251
bdm::ParaviewAdaptor::impl_
std::unique_ptr< ParaviewImpl > impl_
Definition: adaptor.h:50
bdm::ParaviewAdaptor::InsituVisualization
void InsituVisualization()
Execute the insitu pipelines that were defined in Initialize
Definition: adaptor.cc:173
bdm::ParaviewAdaptor::ParaviewAdaptorTest_DISABLED_CheckVisualizationSelection_Test
friend class ParaviewAdaptorTest_DISABLED_CheckVisualizationSelection_Test
Definition: adaptor.h:62
bdm::ParaviewAdaptor
The class that bridges the simulation code with ParaView.
Definition: adaptor.h:39
bdm::ParaviewAdaptor::BuildPythonScriptString
static std::string BuildPythonScriptString(const std::string &python_script)
Definition: adaptor.cc:269
bdm::ParaviewAdaptor::WriteSimulationInfoJsonFile
void WriteSimulationInfoJsonFile()
Definition: adaptor.cc:235
simulation.h
bdm::ParaviewAdaptor::simulation_info_json_generated_
bool simulation_info_json_generated_
Definition: adaptor.h:58
resource_manager.h
param.h
bdm::ParaviewAdaptor::CreateVtkObjects
void CreateVtkObjects()
Creates the VTK objects that represent the agents in ParaView.
Definition: adaptor.cc:199
bdm::ParaviewAdaptor::ParaviewAdaptor
ParaviewAdaptor()
Definition: adaptor.cc:61
visualization_adaptor.h