17int main(
int argc,
char* argv[]) {
19 if (MPI_Init(&argc, &argv) != MPI_SUCCESS) {
24 MPI_Comm comm = MPI_COMM_WORLD;
26 int rank = 0, comm_size = 0;
27 MPI_Comm_rank(comm, &rank);
28 MPI_Comm_size(comm, &comm_size);
30 dccrg::Dccrg<grid_data> grid;
35 const std::array<uint64_t, 3> grid_size = {{xDim,yDim,zDim}};
37 grid.initialize(grid_size, comm,
"RANDOM", 1);
42 const std::array<uint,4> refinementIds = {{4,22,29,4104}};
44 for(uint
i = 0;
i < refinementIds.size();
i++) {
45 if(refinementIds[
i] > 0) {
46 grid.refine_completely(refinementIds[
i]);
56 auto cells = grid.cells;
57 sort(cells.begin(), cells.end());
59 std::cout <<
"Grid size at 0 refinement is " << xDim <<
" x " << yDim <<
" x " << zDim << std::endl;
60 for (
const auto& cell: cells) {
61 std::cout <<
"Data of cell " << cell.id <<
" is stored at " << cell.data << std::endl;
64 std::ofstream outfile;
66 grid.write_vtk_file(
"test.vtk");
68 outfile.open(
"test.vtk", std::ofstream::app);
70 outfile <<
"CELL_DATA " << cells.size() << std::endl;
71 outfile <<
"SCALARS id int 1" << std::endl;
72 outfile <<
"LOOKUP_TABLE default" << std::endl;
73 for (
const auto& cell: cells) {
74 outfile << cell.id << std::endl;