BioDynaMo  v1.05.159-3be850bb
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_
void Dissect(uint64_t boxes_z, uint64_t num_pieces_target)
friend class ParaviewAdaptorTest_GenerateSimulationInfoJson_Test
void WriteToFile(uint64_t step) const
std::array< int, 6 > whole_extent_
void Update(const DiffusionGrid *grid)
std::vector< std::array< int, 6 > > piece_extents_
std::vector< vtkImageData * > data_
void CalcPieceExtents(const std::array< size_t, 3 > &num_boxes)
VtkDiffusionGrid(const std::string &name, vtkCPDataDescription *data_description)
Definition: agent.cc:39