Chi-Tech
SplitFileMeshGenerator.h
Go to the documentation of this file.
1#ifndef CHITECH_SPLITFILEMESHGENERATOR_H
2#define CHITECH_SPLITFILEMESHGENERATOR_H
3
4#include "MeshGenerator.h"
5
6namespace chi_data_types
7{
8class ByteArray;
9}
10
11namespace chi_mesh
12{
13
14/**Generates the mesh only on location 0, thereafter partitions the mesh
15 * but instead of broadcasting the mesh to other locations it creates binary
16 * mesh files for each location.*/
18{
19public:
21 explicit SplitFileMeshGenerator(const chi::InputParameters& params);
22
23 void Execute() override;
24
25protected:
26 void WriteSplitMesh(const std::vector<int64_t>& cell_pids,
27 const UnpartitionedMesh& umesh,
28 int num_parts);
30 chi_data_types::ByteArray& serial_buffer);
31 typedef std::pair<int, uint64_t> CellPIDGID;
33 {
34 std::map<CellPIDGID, UnpartitionedMesh::LightWeightCell> cells_;
35 std::map<uint64_t, chi_mesh::Vector3> vertices_;
36 std::map<uint64_t, std::string> boundary_id_map_;
38 size_t ortho_Nx_;
39 size_t ortho_Ny_;
40 size_t ortho_Nz_;
42 };
44
45 static std::shared_ptr<MeshContinuum> SetupLocalMesh(SplitMeshInfo& mesh_info);
46
47 // void
48 const int num_parts_;
49 const std::string split_mesh_dir_path_;
50 const std::string split_file_prefix_;
51 const bool read_only_;
53};
54
55} // namespace chi_mesh
56
57#endif // CHITECH_SPLITFILEMESHGENERATOR_H
static std::shared_ptr< MeshContinuum > SetupLocalMesh(SplitMeshInfo &mesh_info)
static void SerializeCell(const UnpartitionedMesh::LightWeightCell &cell, chi_data_types::ByteArray &serial_buffer)
SplitFileMeshGenerator(const chi::InputParameters &params)
std::pair< int, uint64_t > CellPIDGID
static chi::InputParameters GetInputParameters()
void WriteSplitMesh(const std::vector< int64_t > &cell_pids, const UnpartitionedMesh &umesh, int num_parts)
std::map< CellPIDGID, UnpartitionedMesh::LightWeightCell > cells_
std::map< uint64_t, std::string > boundary_id_map_
std::map< uint64_t, chi_mesh::Vector3 > vertices_