BioDynaMo  v1.05.120-25dc9790
vtk_diffusion_grid.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_VTK_DIFFUSION_GRID_H_
16 #define CORE_VISUALIZATION_PARAVIEW_VTK_DIFFUSION_GRID_H_
17 
18 // std
19 #include <algorithm>
20 #include <array>
21 #include <string>
22 #include <vector>
23 // Paraview
24 #include <vtkCPDataDescription.h>
25 #include <vtkImageData.h>
26 // BioDynaMo
28 
29 namespace bdm {
30 
31 class ParaviewAdaptorTest_GenerateSimulationInfoJson_Test;
32 
36  public:
37  VtkDiffusionGrid(const std::string& name,
38  vtkCPDataDescription* data_description);
39 
41 
42  bool IsUsed() const;
43  void Update(const DiffusionGrid* grid);
44  void WriteToFile(uint64_t step) const;
45 
46  private:
47  std::vector<vtkImageData*> data_;
48  std::string name_;
49  bool used_ = false;
52 
53  // The following data members are needed to partition a diffusion grid into
54  // multiple
55  // vtkImageData objects for parallel processing.
56  // ParaView calls the partition pieces.
57 
58  uint64_t num_pieces_;
59  uint64_t piece_boxes_z_;
61  std::array<int, 6> whole_extent_;
62  std::vector<std::array<int, 6>> piece_extents_;
63 
66  void Dissect(uint64_t boxes_z, uint64_t num_pieces_target);
67 
68  void CalcPieceExtents(const std::array<size_t, 3>& num_boxes);
69 
71 };
72 
73 } // namespace bdm
74 
75 #endif // CORE_VISUALIZATION_PARAVIEW_VTK_DIFFUSION_GRID_H_
bdm::VtkDiffusionGrid
Definition: vtk_diffusion_grid.h:35
bdm::VtkDiffusionGrid::~VtkDiffusionGrid
~VtkDiffusionGrid()
Definition: vtk_diffusion_grid.cc:95
bdm::VtkDiffusionGrid::name_
std::string name_
Definition: vtk_diffusion_grid.h:48
bdm::VtkDiffusionGrid::used_
bool used_
Definition: vtk_diffusion_grid.h:49
bdm
Definition: agent.cc:39
bdm::VtkDiffusionGrid::piece_boxes_z_
uint64_t piece_boxes_z_
Definition: vtk_diffusion_grid.h:59
bdm::VtkDiffusionGrid::whole_extent_
std::array< int, 6 > whole_extent_
Definition: vtk_diffusion_grid.h:61
bdm::VtkDiffusionGrid::ParaviewAdaptorTest_GenerateSimulationInfoJson_Test
friend class ParaviewAdaptorTest_GenerateSimulationInfoJson_Test
Definition: vtk_diffusion_grid.h:70
bdm::DiffusionGrid
Definition: diffusion_grid.h:90
bdm::VtkDiffusionGrid::Update
void Update(const DiffusionGrid *grid)
Definition: vtk_diffusion_grid.cc:107
bdm::VtkDiffusionGrid::piece_boxes_z_last_
uint64_t piece_boxes_z_last_
Definition: vtk_diffusion_grid.h:60
bdm::VtkDiffusionGrid::IsUsed
bool IsUsed() const
Definition: vtk_diffusion_grid.cc:104
diffusion_grid.h
bdm::VtkDiffusionGrid::VtkDiffusionGrid
VtkDiffusionGrid(const std::string &name, vtkCPDataDescription *data_description)
Definition: vtk_diffusion_grid.cc:39
bdm::VtkDiffusionGrid::WriteToFile
void WriteToFile(uint64_t step) const
Definition: vtk_diffusion_grid.cc:194
bdm::VtkDiffusionGrid::Dissect
void Dissect(uint64_t boxes_z, uint64_t num_pieces_target)
Definition: vtk_diffusion_grid.cc:204
bdm::VtkDiffusionGrid::piece_extents_
std::vector< std::array< int, 6 > > piece_extents_
Definition: vtk_diffusion_grid.h:62
bdm::VtkDiffusionGrid::CalcPieceExtents
void CalcPieceExtents(const std::array< size_t, 3 > &num_boxes)
Definition: vtk_diffusion_grid.cc:225
bdm::VtkDiffusionGrid::concentration_array_idx_
int concentration_array_idx_
Definition: vtk_diffusion_grid.h:50
bdm::VtkDiffusionGrid::data_
std::vector< vtkImageData * > data_
Definition: vtk_diffusion_grid.h:47
bdm::VtkDiffusionGrid::gradient_array_idx_
int gradient_array_idx_
Definition: vtk_diffusion_grid.h:51
bdm::VtkDiffusionGrid::num_pieces_
uint64_t num_pieces_
Definition: vtk_diffusion_grid.h:58