2#include <AMReX_Utility.H>
10 moab::Interface * mbi =
new( std::nothrow ) moab::Core;
12 std::vector<int> n_cells;
15 int which_subdomain = 0;
16 int nblocks = grids[lev].size();
23 subdomain = geom[lev].Domain();
28 int nx = subdomain.length(0);
29 int ny = subdomain.length(1);
30 int nz = subdomain.length(2);
32 n_cells.push_back(nx);
33 n_cells.push_back(ny);
34 n_cells.push_back(nz);
36 int num_vertices = (nx+1)*(ny+1)*(nz+1);
37 int num_cells = nx * ny * nz;
39 std::vector<double> coords(3*num_cells);
40 long unsigned goffset = 0;
41 long unsigned glen = 0;
43 for (
int i = 0; i < grids[lev].size(); ++i) {
44 auto box = grids[lev][i];
45 if (subdomain.contains(box)) {
46 RealBox gridloc = RealBox(grids[lev][i], geom[lev].CellSize(), geom[lev].ProbLo());
48 for (
auto k1 = 0; k1 < grids[lev][i].length(0); ++k1) {
49 for (
auto k2 = 0; k2 < grids[lev][i].length(1); ++k2) {
50 for (
auto k3 = 0; k3 < grids[lev][i].length(2); ++k3) {
51 coords[3*icell] = gridloc.lo(0)+geom[lev].CellSize(0)*
static_cast<Real
>(k1);
52 coords[3*icell+1] = gridloc.lo(1)+geom[lev].CellSize(1)*
static_cast<Real
>(k2);
53 coords[3*icell+2] = gridloc.lo(2)+geom[lev].CellSize(2)*
static_cast<Real
>(k3);
60 moab::Range cell_centers;
61 moab::ErrorCode rval = mbi->create_vertices( &coords[0], num_cells, cell_centers );
62 moab::EntityHandle file_set;
63 rval = mbi->create_meshset( moab::MESHSET_SET, file_set );
64 rval = mbi->add_entities(file_set, cell_centers);
65 rval = mbi->write_file(
"cell_centers.h5m",0,
"PARALLEL=WRITE_PART", &file_set, 1);
amrex::Vector< amrex::Vector< amrex::Box > > boxes_at_level
the boxes specified at each level by tagging criteria