[MOAB-dev] commit/MOAB: 3 new changesets
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Tue Jun 3 20:41:03 CDT 2014
3 new commits in MOAB:
https://bitbucket.org/fathomteam/moab/commits/d529ee8ee20d/
Changeset: d529ee8ee20d
Branch: None
User: iulian07
Date: 2014-06-04 02:07:53
Summary: bug in shifting the padded vertices
noted only when run in parallel, by Danqing
Affected #: 1 file
diff --git a/src/io/NCHelperGCRM.cpp b/src/io/NCHelperGCRM.cpp
index f61cca5..1a2a48b 100644
--- a/src/io/NCHelperGCRM.cpp
+++ b/src/io/NCHelperGCRM.cpp
@@ -1308,7 +1308,7 @@ ErrorCode NCHelperGCRM::create_local_cells(const std::vector<int>& vertices_on_l
if( *(pvertex+k) == *(pvertex+k+1) )
{
// shift the connectivity
- for (int kk=k+1; kk<num_edges_per_cell-2; kk++)
+ for (int kk=k+1; kk<num_edges_per_cell-1; kk++)
{
*(pvertex+kk)=*(pvertex+kk+1);
}
https://bitbucket.org/fathomteam/moab/commits/f53d444f9a62/
Changeset: f53d444f9a62
Branch: None
User: iulian07
Date: 2014-06-04 03:13:30
Summary: Merge branch 'master' of https://bitbucket.org/fathomteam/moab
Affected #: 7 files
diff --git a/src/io/NCHelperGCRM.cpp b/src/io/NCHelperGCRM.cpp
index 1a2a48b..f0cc7aa 100644
--- a/src/io/NCHelperGCRM.cpp
+++ b/src/io/NCHelperGCRM.cpp
@@ -103,10 +103,10 @@ ErrorCode NCHelperGCRM::init_mesh_vals()
levDim = idx;
nLevels = dimLens[idx];
- // Dimension numbers for other optional levels
+ // Dimension indices for other optional levels
std::vector<unsigned int> opt_lev_dims;
- // Get number of interface levels
+ // Get index of interface levels
if ((vit = std::find(dimNames.begin(), dimNames.end(), "interfaces")) != dimNames.end()) {
idx = vit - dimNames.begin();
opt_lev_dims.push_back(idx);
diff --git a/src/io/NCHelperMPAS.cpp b/src/io/NCHelperMPAS.cpp
index 5c964b9..a02e4ce 100644
--- a/src/io/NCHelperMPAS.cpp
+++ b/src/io/NCHelperMPAS.cpp
@@ -122,22 +122,22 @@ ErrorCode NCHelperMPAS::init_mesh_vals()
levDim = idx;
nLevels = dimLens[idx];
- // Dimension numbers for other optional levels
+ // Dimension indices for other optional levels
std::vector<unsigned int> opt_lev_dims;
- // Get number of vertex levels P1
+ // Get index of vertex levels P1
if ((vit = std::find(dimNames.begin(), dimNames.end(), "nVertLevelsP1")) != dimNames.end()) {
idx = vit - dimNames.begin();
opt_lev_dims.push_back(idx);
}
- // Get number of vertex levels P2
+ // Get index of vertex levels P2
if ((vit = std::find(dimNames.begin(), dimNames.end(), "nVertLevelsP2")) != dimNames.end()) {
idx = vit - dimNames.begin();
opt_lev_dims.push_back(idx);
}
- // Get number of soil levels
+ // Get index of soil levels
if ((vit = std::find(dimNames.begin(), dimNames.end(), "nSoilLevels")) != dimNames.end()) {
idx = vit - dimNames.begin();
opt_lev_dims.push_back(idx);
diff --git a/src/io/NCWriteGCRM.cpp b/src/io/NCWriteGCRM.cpp
index 1f9bb97..b80d90a 100644
--- a/src/io/NCWriteGCRM.cpp
+++ b/src/io/NCWriteGCRM.cpp
@@ -123,6 +123,21 @@ ErrorCode NCWriteGCRM::collect_variable_data(std::vector<std::string>& var_names
{
NCWriteHelper::collect_variable_data(var_names, tstep_nums);
+ std::vector<std::string>& dimNames = _writeNC->dimNames;
+ std::vector<int>& dimLens = _writeNC->dimLens;
+
+ // Dimension indices for other optional levels
+ std::vector<unsigned int> opt_lev_dims;
+
+ unsigned int lev_idx;
+ std::vector<std::string>::iterator vecIt;
+
+ // Get index of interface levels
+ if ((vecIt = std::find(dimNames.begin(), dimNames.end(), "interfaces")) != dimNames.end()) {
+ lev_idx = vecIt - dimNames.begin();
+ opt_lev_dims.push_back(lev_idx);
+ }
+
std::map<std::string, WriteNC::VarData>& varInfo = _writeNC->varInfo;
for (size_t i = 0; i < var_names.size(); i++) {
@@ -132,14 +147,22 @@ ErrorCode NCWriteGCRM::collect_variable_data(std::vector<std::string>& var_names
ERRORR(MB_FAILURE, "Can't find one variable.");
WriteNC::VarData& currentVarData = vit->second;
-#ifndef NDEBUG
std::vector<int>& varDims = currentVarData.varDims;
-#endif
// Skip edge variables, if there are no edges
if (localEdgesOwned.empty() && currentVarData.entLoc == WriteNC::ENTLOCEDGE)
continue;
+ // If layers dimension is not found, try other optional levels such as interfaces
+ if (std::find(varDims.begin(), varDims.end(), levDim) == varDims.end()) {
+ for (unsigned int j = 0; j < opt_lev_dims.size(); j++) {
+ if (std::find(varDims.begin(), varDims.end(), opt_lev_dims[j]) != varDims.end()) {
+ currentVarData.numLev = dimLens[opt_lev_dims[j]];
+ break;
+ }
+ }
+ }
+
// Skip set variables, which were already processed in NCWriteHelper::collect_variable_data()
if (WriteNC::ENTLOCSET == currentVarData.entLoc)
continue;
diff --git a/src/io/NCWriteMPAS.cpp b/src/io/NCWriteMPAS.cpp
index 0ece324..512c1d5 100644
--- a/src/io/NCWriteMPAS.cpp
+++ b/src/io/NCWriteMPAS.cpp
@@ -126,25 +126,25 @@ ErrorCode NCWriteMPAS::collect_variable_data(std::vector<std::string>& var_names
std::vector<std::string>& dimNames = _writeNC->dimNames;
std::vector<int>& dimLens = _writeNC->dimLens;
- // Dimension numbers for other optional levels
+ // Dimension indices for other optional levels
std::vector<unsigned int> opt_lev_dims;
unsigned int lev_idx;
std::vector<std::string>::iterator vecIt;
- // Get number of vertex levels P1
+ // Get index of vertex levels P1
if ((vecIt = std::find(dimNames.begin(), dimNames.end(), "nVertLevelsP1")) != dimNames.end()) {
lev_idx = vecIt - dimNames.begin();
opt_lev_dims.push_back(lev_idx);
}
- // Get number of vertex levels P2
+ // Get index of vertex levels P2
if ((vecIt = std::find(dimNames.begin(), dimNames.end(), "nVertLevelsP2")) != dimNames.end()) {
lev_idx = vecIt - dimNames.begin();
opt_lev_dims.push_back(lev_idx);
}
- // Get number of soil levels
+ // Get index of soil levels
if ((vecIt = std::find(dimNames.begin(), dimNames.end(), "nSoilLevels")) != dimNames.end()) {
lev_idx = vecIt - dimNames.begin();
opt_lev_dims.push_back(lev_idx);
diff --git a/test/io/read_gcrm_nc.cpp b/test/io/read_gcrm_nc.cpp
index 91608f2..35d6bcb 100644
--- a/test/io/read_gcrm_nc.cpp
+++ b/test/io/read_gcrm_nc.cpp
@@ -28,6 +28,7 @@ void get_options(std::string& opts);
const double eps = 1e-6;
const int layers = 3;
+const int interfaces = 3;
int main(int argc, char* argv[])
{
@@ -80,8 +81,7 @@ void test_read_all()
// Make check runs this test on one processor
if (1 == procs) {
- // For each tag, check values on two entities
- // There are 256 layers, only check on first two
+ // For u, wind and vorticity, check tag values on two entities
double val[2 * layers];
// Check tags for vertex variable u
@@ -91,7 +91,7 @@ void test_read_all()
rval = mb.tag_get_handle("u1", layers, MB_TYPE_DOUBLE, u_tag1);
CHECK_ERR(rval);
- // Get vertices (1280 edges)
+ // Get vertices (1280 vertices)
Range verts;
rval = mb.get_entities_by_type(0, MBVERTEX, verts);
CHECK_ERR(rval);
@@ -101,6 +101,7 @@ void test_read_all()
// Check u tag values on first and last vertices
EntityHandle vert_ents[] = {verts[0], verts[1279]};
+ // Only check first two layers
// Timestep 0
rval = mb.tag_get_data(u_tag0, vert_ents, 2, val);
CHECK_ERR(rval);
@@ -138,6 +139,7 @@ void test_read_all()
// Check wind tag values on first and last edges
EntityHandle edge_ents[] = {edges[0], edges[1919]};
+ // Only check first two layers
// Timestep 0
rval = mb.tag_get_data(wind_tag0, edge_ents, 2, val);
CHECK_ERR(rval);
@@ -177,6 +179,7 @@ void test_read_all()
// Check vorticity tag values on first and last cells
EntityHandle cell_ents[] = {cells[0], cells[641]};
+ // Only check first two layers
// Timestep 0
rval = mb.tag_get_data(vorticity_tag0, cell_ents, 2, val);
CHECK_ERR(rval);
@@ -196,6 +199,38 @@ void test_read_all()
// Layer 1
CHECK_REAL_EQUAL(3.534306, val[0 * layers + 1], eps);
CHECK_REAL_EQUAL(-0.540262, val[1 * layers + 1], eps);
+
+ // Check tags for cell variable pressure
+ Tag pressure_tag0, pressure_tag1;
+ rval = mb.tag_get_handle("pressure0", interfaces, MB_TYPE_DOUBLE, pressure_tag0);
+ CHECK_ERR(rval);
+ rval = mb.tag_get_handle("pressure1", interfaces, MB_TYPE_DOUBLE, pressure_tag1);
+ CHECK_ERR(rval);
+
+ // For pressure, check tag values on two cells
+ double pressure_val[2 * interfaces];
+
+ // Check pressure tag values on first and last cells
+ // Only check first two interfaces
+ // Timestep 0
+ rval = mb.tag_get_data(pressure_tag0, cell_ents, 2, pressure_val);
+ CHECK_ERR(rval);
+ // Interface 0
+ CHECK_REAL_EQUAL(4.44234e-06, pressure_val[0 * interfaces], 1e-11);
+ CHECK_REAL_EQUAL(0.2486804, pressure_val[1 * interfaces], 1e-7);
+ // Interface 1
+ CHECK_REAL_EQUAL(4.44234e-06, pressure_val[0 * interfaces + 1], 1e-11);
+ CHECK_REAL_EQUAL(0.2486804, pressure_val[1 * interfaces + 1], 1e-7);
+
+ // Timestep 1
+ rval = mb.tag_get_data(pressure_tag1, cell_ents, 2, pressure_val);
+ CHECK_ERR(rval);
+ // Interface 0
+ CHECK_REAL_EQUAL(2.365176e-07, pressure_val[0 * interfaces], 1e-13);
+ CHECK_REAL_EQUAL(0.02234409, pressure_val[1 * interfaces], 1e-8);
+ // Interface 1
+ CHECK_REAL_EQUAL(2.365176e-07, pressure_val[0 * interfaces + 1], 1e-13);
+ CHECK_REAL_EQUAL(0.02234409, pressure_val[1 * interfaces + 1], 1e-8);
}
}
@@ -238,9 +273,9 @@ void test_read_onevar()
// Check vorticity tag values on 4 cells: first cell, two median cells, and last cell
EntityHandle cell_ents[] = {cells[0], cells[320], cells[321], cells[641]};
- // There are 256 layers, only check on first two
double vorticity_val[4 * layers];
+ // Only check first two layers
// Timestep 0
rval = mb.tag_get_data(vorticity_tag0, cell_ents, 4, vorticity_val);
CHECK_ERR(rval);
@@ -405,9 +440,9 @@ void test_read_novars()
// Check vorticity tag values on 4 cells: first cell, two median cells, and last cell
EntityHandle cell_ents[] = {cells[0], cells[320], cells[321], cells[641]};
- // There are 256 layers, only check on first two
double vorticity_val[4 * layers];
+ // Only check first two layers
// Timestep 0
rval = mb.tag_get_data(vorticity_tag0, cell_ents, 4, vorticity_val);
CHECK_ERR(rval);
diff --git a/test/io/write_nc.cpp b/test/io/write_nc.cpp
index d59829d..bd7a9e9 100644
--- a/test/io/write_nc.cpp
+++ b/test/io/write_nc.cpp
@@ -56,7 +56,7 @@ void test_mpas_check_vars();
// GCRM
void test_gcrm_read_write_vars();
-//void test_gcrm_check_vars();
+void test_gcrm_check_vars();
// Test timestep option
void test_eul_read_write_timestep();
@@ -106,7 +106,7 @@ int main(int argc, char* argv[])
result += RUN_TEST(test_mpas_check_vars);
result += RUN_TEST(test_gcrm_read_write_vars);
- //result += RUN_TEST(test_gcrm_check_vars);
+ result += RUN_TEST(test_gcrm_check_vars);
result += RUN_TEST(test_eul_read_write_timestep);
result += RUN_TEST(test_eul_check_timestep);
@@ -588,7 +588,7 @@ void test_homme_check_T()
}
}
-// Write vertex variable vorticity, edge variable u and cell veriable ke
+// Write vertex variable vorticity, edge variable u and cell variable ke
void test_mpas_read_write_vars()
{
int procs = 1;
@@ -632,7 +632,7 @@ void test_mpas_read_write_vars()
CHECK_ERR(rval);
}
-// Check vertex variable vorticity, edge variable u and cell veriable ke
+// Check vertex variable vorticity, edge variable u and cell variable ke
void test_mpas_check_vars()
{
int rank = 0;
@@ -747,7 +747,8 @@ void test_mpas_check_vars()
}
}
-// Write vertex variable vorticity, edge variable u and cell veriable ke
+// Write vertex variable u, edge variable wind, cell variable vorticity (on layers),
+// and cell variable pressure (on interfaces)
void test_gcrm_read_write_vars()
{
int procs = 1;
@@ -772,15 +773,15 @@ void test_gcrm_read_write_vars()
ErrorCode rval = mb.create_meshset(MESHSET_SET, set);
CHECK_ERR(rval);
- // Read non-set variables vorticity (cells) and u (corners)
- read_opts += ";VARIABLE=vorticity,u;DEBUG_IO=0";
+ // Read non-set variables u, wind, vorticity and pressure
+ read_opts += ";VARIABLE=u,wind,vorticity,pressure;DEBUG_IO=0";
if (procs > 1)
read_opts += ";PARALLEL_RESOLVE_SHARED_ENTS";
rval = mb.load_file(example_gcrm, &set, read_opts.c_str());
CHECK_ERR(rval);
- // Write variables vorticity, u
- std::string write_opts = ";;VARIABLE=vorticity,u;DEBUG_IO=0";
+ // Write variables u, wind, vorticity and pressure
+ std::string write_opts = ";;VARIABLE=u,wind,vorticity,pressure;DEBUG_IO=0";
#ifdef USE_MPI
// Use parallel options
write_opts += ";PARALLEL=WRITE_PART";
@@ -792,6 +793,169 @@ void test_gcrm_read_write_vars()
CHECK_ERR(rval);
}
+// Check vertex variable u, edge variable wind, cell variable vorticity (on layers),
+// and cell variable pressure (on interfaces)
+void test_gcrm_check_vars()
+{
+ int rank = 0;
+ int procs = 1;
+#ifdef USE_MPI
+ MPI_Comm_rank(MPI_COMM_WORLD, &rank);
+ MPI_Comm_size(MPI_COMM_WORLD, &procs);
+#endif
+
+// We will not test NC writer in parallel without pnetcdf support
+#ifndef PNETCDF_FILE
+ if (procs > 1)
+ return;
+#endif
+
+ if (0 == rank) {
+ int ncid;
+ int success;
+
+ std::string filename;
+ if (procs > 1)
+ filename = "test_par_gcrm_vars.nc";
+ else
+ filename = "test_gcrm_vars.nc";
+
+#ifdef PNETCDF_FILE
+ success = NCFUNC(open)(MPI_COMM_SELF, filename.c_str(), NC_NOWRITE, MPI_INFO_NULL, &ncid);
+#else
+ success = NCFUNC(open)(filename.c_str(), NC_NOWRITE, &ncid);
+#endif
+ CHECK_EQUAL(0, success);
+
+ int u_id;
+ success = NCFUNC(inq_varid)(ncid, "u", &u_id);
+ CHECK_EQUAL(0, success);
+
+ int wind_id;
+ success = NCFUNC(inq_varid)(ncid, "wind", &wind_id);
+ CHECK_EQUAL(0, success);
+
+ int vorticity_id;
+ success = NCFUNC(inq_varid)(ncid, "vorticity", &vorticity_id);
+ CHECK_EQUAL(0, success);
+
+ int pressure_id;
+ success = NCFUNC(inq_varid)(ncid, "pressure", &pressure_id);
+ CHECK_EQUAL(0, success);
+
+#ifdef PNETCDF_FILE
+ // Enter independent I/O mode
+ success = NCFUNC(begin_indep_data)(ncid);
+ CHECK_EQUAL(0, success);
+#endif
+
+ NCDF_SIZE start[] = {0, 0, 0};
+ NCDF_SIZE count[] = {2, 1, 2}; // Read two timesteps and two levels
+
+ // Read variable u on all 1280 vertices
+ count[1] = 1280;
+ double u_vals[1280 * 4];
+ success = NCFUNC(get_vara_double)(ncid, u_id, start, count, u_vals);
+ CHECK_EQUAL(0, success);
+
+ // Read variable wind on all 1920 edges
+ count[1] = 1920;
+ double wind_vals[1920 * 4];
+ success = NCFUNC(get_vara_double)(ncid, wind_id, start, count, wind_vals);
+ CHECK_EQUAL(0, success);
+
+ // Read variable vorticity on all 642 cells
+ count[1] = 642;
+ double vorticity_vals[642 * 4];
+ success = NCFUNC(get_vara_double)(ncid, vorticity_id, start, count, vorticity_vals);
+ CHECK_EQUAL(0, success);
+
+ // Read variable pressure on all 642 cells
+ double pressure_vals[642 * 4];
+ success = NCFUNC(get_vara_double)(ncid, pressure_id, start, count, pressure_vals);
+ CHECK_EQUAL(0, success);
+
+#ifdef PNETCDF_FILE
+ // End independent I/O mode
+ success = NCFUNC(end_indep_data)(ncid);
+ CHECK_EQUAL(0, success);
+#endif
+
+ const double eps = 1e-6;
+
+ // Check u values on first and last vertices
+ // Timestep 0
+ // Layer 0
+ CHECK_REAL_EQUAL(-4.839992, u_vals[0], eps);
+ CHECK_REAL_EQUAL(-3.699257, u_vals[1279 * 2], eps);
+ // Layer 1
+ CHECK_REAL_EQUAL(-4.839925, u_vals[0 + 1], eps);
+ CHECK_REAL_EQUAL(-3.699206, u_vals[1279 * 2 + 1], eps);
+
+ // Timestep 1
+ // Layer 0
+ CHECK_REAL_EQUAL(-4.712473, u_vals[0 + 1280 * 2], eps);
+ CHECK_REAL_EQUAL(-3.601793, u_vals[1279 * 2 + 1280 * 2], eps);
+ // Layer 1
+ CHECK_REAL_EQUAL(-4.712409, u_vals[0 + 1 + 1280 * 2], eps);
+ CHECK_REAL_EQUAL(-3.601743, u_vals[1279 * 2 + 1 + 1280 * 2], eps);
+
+ // Check wind values on first and last edges
+ // Timestep 0
+ // Layer 0
+ CHECK_REAL_EQUAL(-5.081991, wind_vals[0], eps);
+ CHECK_REAL_EQUAL(-6.420274, wind_vals[1919 * 2], eps);
+ // Layer 1
+ CHECK_REAL_EQUAL(-5.081781, wind_vals[0 + 1], eps);
+ CHECK_REAL_EQUAL(-6.419831, wind_vals[1919 * 2 + 1], eps);
+
+ // Timestep 1
+ // Layer 0
+ CHECK_REAL_EQUAL(-4.948097, wind_vals[0 + 1920 * 2], eps);
+ CHECK_REAL_EQUAL(-6.251121, wind_vals[1919 * 2 + 1920 * 2], eps);
+ // Layer 1
+ CHECK_REAL_EQUAL(-4.947892, wind_vals[0 + 1 + 1920 * 2], eps);
+ CHECK_REAL_EQUAL(-6.250690, wind_vals[1919 * 2 + 1 + 1920 * 2], eps);
+
+ // Check vorticity values on first and last cells
+ // Timestep 0
+ // Layer 0
+ CHECK_REAL_EQUAL(3.629994, vorticity_vals[0], eps);
+ CHECK_REAL_EQUAL(-0.554888, vorticity_vals[641 * 2], eps);
+ // Layer 1
+ CHECK_REAL_EQUAL(3.629944, vorticity_vals[0 + 1], eps);
+ CHECK_REAL_EQUAL(-0.554881, vorticity_vals[641 * 2 + 1], eps);
+
+ // Timestep 1
+ // Layer 0
+ CHECK_REAL_EQUAL(3.534355, vorticity_vals[0 + 642 * 2], eps);
+ CHECK_REAL_EQUAL(-0.540269, vorticity_vals[641 * 2 + 642 * 2], eps);
+ // Layer 1
+ CHECK_REAL_EQUAL(3.534306, vorticity_vals[0 + 1 + 642 * 2], eps);
+ CHECK_REAL_EQUAL(-0.540262, vorticity_vals[641 * 2 + 1 + 642 * 2], eps);
+
+ // Check pressure values on first and last cells
+ // Timestep 0
+ // Interface 0
+ CHECK_REAL_EQUAL(4.44234e-06, pressure_vals[0], 1e-11);
+ CHECK_REAL_EQUAL(0.2486804, pressure_vals[641 * 2], 1e-7);
+ // Interface 1
+ CHECK_REAL_EQUAL(4.44234e-06, pressure_vals[0 + 1], 1e-11);
+ CHECK_REAL_EQUAL(0.2486804, pressure_vals[641 * 2 + 1], 1e-7);
+
+ // Timestep 1
+ // Interface 0
+ CHECK_REAL_EQUAL(2.365176e-07, pressure_vals[0 + 642 * 2], 1e-13);
+ CHECK_REAL_EQUAL(0.02234409, pressure_vals[641 * 2 + 642 * 2], 1e-8);
+ // Interface 1
+ CHECK_REAL_EQUAL(2.365176e-07, pressure_vals[0 + 1 + 642 * 2], 1e-13);
+ CHECK_REAL_EQUAL(0.02234409, pressure_vals[641 * 2 + 1 + 642 * 2], 1e-8);
+
+ success = NCFUNC(close)(ncid);
+ CHECK_EQUAL(0, success);
+ }
+}
+
// Read non-set variable T on all 3 timesteps, and write only timestep 2
void test_eul_read_write_timestep()
{
diff --git a/test/parallel/gcrm_par.cpp b/test/parallel/gcrm_par.cpp
index 83e89a6..49ed809 100644
--- a/test/parallel/gcrm_par.cpp
+++ b/test/parallel/gcrm_par.cpp
@@ -15,58 +15,49 @@ static const char example[] = STRINGIFY(MESHDIR) "/io/gcrm_r3.nc";
#endif
void test_read_onevar_trivial();
-void test_read_onevar_trivial_no_mixed_elements();
#if defined(USE_MPI) && defined(HAVE_ZOLTAN)
void test_read_onevar_rcbzoltan();
-void test_read_onevar_rcbzoltan_no_mixed_elements();
#endif
void test_read_mesh_parallel_trivial();
-void test_read_mesh_parallel_trivial_no_mixed_elements();
#if defined(USE_MPI) && defined(HAVE_ZOLTAN)
void test_read_mesh_parallel_rcbzoltan();
-void test_read_mesh_parallel_rcbzoltan_no_mixed_elements();
#endif
void test_gather_onevar_on_rank0();
void test_gather_onevar_on_rank1();
void test_multiple_loads_of_same_file();
-void test_multiple_loads_of_same_file_no_mixed_elements();
// Helper functions
-void read_one_cell_var(bool rcbzoltan, bool no_mixed_elements);
-void read_mesh_parallel(bool rcbzoltan, bool no_mixed_elements);
+void read_one_cell_var(bool rcbzoltan);
+void read_mesh_parallel(bool rcbzoltan);
void gather_one_cell_var(int gather_set_rank);
-void multiple_loads_of_same_file(bool no_mixed_elements);
+void multiple_loads_of_same_file();
std::string read_options;
-const double eps = 1e-20;
+const double eps = 1e-6;
+const int layers = 3;
int main(int argc, char* argv[])
{
MPI_Init(&argc, &argv);
int result = 0;
- //result += RUN_TEST(test_read_onevar_trivial);
- //result += RUN_TEST(test_read_onevar_trivial_no_mixed_elements);
+ result += RUN_TEST(test_read_onevar_trivial);
#if defined(USE_MPI) && defined(HAVE_ZOLTAN)
- //result += RUN_TEST(test_read_onevar_rcbzoltan);
- //result += RUN_TEST(test_read_onevar_rcbzoltan_no_mixed_elements);
+ result += RUN_TEST(test_read_onevar_rcbzoltan);
#endif
result += RUN_TEST(test_read_mesh_parallel_trivial);
- //result += RUN_TEST(test_read_mesh_parallel_trivial_no_mixed_elements);
#if defined(USE_MPI) && defined(HAVE_ZOLTAN)
result += RUN_TEST(test_read_mesh_parallel_rcbzoltan);
- //result += RUN_TEST(test_read_mesh_parallel_rcbzoltan_no_mixed_elements);
#endif
//result += RUN_TEST(test_gather_onevar_on_rank0);
//result += RUN_TEST(test_gather_onevar_on_rank1);
- //result += RUN_TEST(test_multiple_loads_of_same_file);
- //result += RUN_TEST(test_multiple_loads_of_same_file_no_mixed_elements);
+ result += RUN_TEST(test_multiple_loads_of_same_file);
MPI_Finalize();
return result;
@@ -74,42 +65,22 @@ int main(int argc, char* argv[])
void test_read_onevar_trivial()
{
- read_one_cell_var(false, false);
-}
-
-void test_read_onevar_trivial_no_mixed_elements()
-{
- read_one_cell_var(false, true);
+ read_one_cell_var(false);
}
void test_read_onevar_rcbzoltan()
{
- read_one_cell_var(true, false);
-}
-
-void test_read_onevar_rcbzoltan_no_mixed_elements()
-{
- read_one_cell_var(true, true);
+ read_one_cell_var(true);
}
void test_read_mesh_parallel_trivial()
{
- read_mesh_parallel(false, false);
-}
-
-void test_read_mesh_parallel_trivial_no_mixed_elements()
-{
- read_mesh_parallel(false, true);
+ read_mesh_parallel(false);
}
void test_read_mesh_parallel_rcbzoltan()
{
- read_mesh_parallel(true, false);
-}
-
-void test_read_mesh_parallel_rcbzoltan_no_mixed_elements()
-{
- read_mesh_parallel(true, true);
+ read_mesh_parallel(true);
}
void test_gather_onevar_on_rank0()
@@ -124,26 +95,18 @@ void test_gather_onevar_on_rank1()
void test_multiple_loads_of_same_file()
{
- multiple_loads_of_same_file(false);
-}
-
-void test_multiple_loads_of_same_file_no_mixed_elements()
-{
- multiple_loads_of_same_file(true);
+ multiple_loads_of_same_file();
}
// Helper functions
-void read_one_cell_var(bool rcbzoltan, bool no_mixed_elements)
+void read_one_cell_var(bool rcbzoltan)
{
Core moab;
Interface& mb = moab;
- read_options = "PARALLEL=READ_PART;PARTITION_METHOD=TRIVIAL;NO_EDGES;VARIABLE=ke";
+ read_options = "PARALLEL=READ_PART;PARTITION_METHOD=TRIVIAL;NO_EDGES;VARIABLE=vorticity";
if (rcbzoltan)
- read_options = "PARALLEL=READ_PART;PARTITION_METHOD=RCBZOLTAN;NO_EDGES;VARIABLE=ke";
-
- if (no_mixed_elements)
- read_options += ";NO_MIXED_ELEMENTS";
+ read_options = "PARALLEL=READ_PART;PARTITION_METHOD=RCBZOLTAN;NO_EDGES;VARIABLE=vorticity;DEBUG_IO=1";
ErrorCode rval = mb.load_file(example, NULL, read_options.c_str());
CHECK_ERR(rval);
@@ -158,6 +121,8 @@ void read_one_cell_var(bool rcbzoltan, bool no_mixed_elements)
Range local_cells;
rval = mb.get_entities_by_type(0, MBPOLYGON, local_cells);
CHECK_ERR(rval);
+ // No mixed elements
+ CHECK_EQUAL((size_t)1, local_cells.psize());
Tag gid_tag;
rval = mb.tag_get_handle(GLOBAL_ID_TAG_NAME, 1, MB_TYPE_INTEGER, gid_tag, MB_TAG_DENSE);
@@ -174,98 +139,161 @@ void read_one_cell_var(bool rcbzoltan, bool no_mixed_elements)
// Make check runs this test on two processors
if (2 == procs) {
- CHECK_EQUAL((size_t)321, local_cells.size());
- CHECK_EQUAL((size_t)321, local_cell_gids.size());
-
- // Check tag for cell variable ke at timestep 0
- Tag ke_tag0;
- rval = mb.tag_get_handle("ke0", 1, MB_TYPE_DOUBLE, ke_tag0);
+ // Check tag for cell variable vorticity at timestep 0
+ Tag vorticity_tag0;
+ rval = mb.tag_get_handle("vorticity0", layers, MB_TYPE_DOUBLE, vorticity_tag0);
CHECK_ERR(rval);
- // Check tag for cell variable ke at timestep 1
- Tag ke_tag1;
- rval = mb.tag_get_handle("ke1", 1, MB_TYPE_DOUBLE, ke_tag1);
+ // Check tag for cell variable vorticity at timestep 1
+ Tag vorticity_tag1;
+ rval = mb.tag_get_handle("vorticity1", layers, MB_TYPE_DOUBLE, vorticity_tag1);
CHECK_ERR(rval);
- // Get ke0 and ke1 tag values on 3 local cells
- EntityHandle cell_ents[] = {local_cells[0], local_cells[160], local_cells[320]};
- double ke0_val[3];
- rval = mb.tag_get_data(ke_tag0, cell_ents, 3, ke0_val);
- CHECK_ERR(rval);
- double ke1_val[3];
- rval = mb.tag_get_data(ke_tag1, cell_ents, 3, ke1_val);
- CHECK_ERR(rval);
+ // Get vorticity0 and vorticity1 tag values on 3 local cells
+ double vorticity0_val[3 * layers];
+ double vorticity1_val[3 * layers];
if (rcbzoltan) {
- if (no_mixed_elements)
- CHECK_EQUAL((size_t)1, local_cells.psize());
- else
- CHECK_EQUAL((size_t)2, local_cells.psize());
-
- CHECK_EQUAL((size_t)37, local_cell_gids.psize());
+ CHECK_EQUAL((size_t)14, local_cell_gids.psize());
if (0 == rank) {
- CHECK_EQUAL(1, (int)local_cell_gids[0]);
- CHECK_EQUAL(284, (int)local_cell_gids[160]);
- CHECK_EQUAL(630, (int)local_cell_gids[320]);
-
- CHECK_REAL_EQUAL(15.001, ke0_val[0], eps);
- CHECK_REAL_EQUAL(16.284, ke0_val[1], eps);
- CHECK_REAL_EQUAL(16.630, ke0_val[2], eps);
- CHECK_REAL_EQUAL(25.001, ke1_val[0], eps);
- CHECK_REAL_EQUAL(26.284, ke1_val[1], eps);
- CHECK_REAL_EQUAL(26.630, ke1_val[2], eps);
+ CHECK_EQUAL((size_t)319, local_cells.size());
+ CHECK_EQUAL((size_t)319, local_cell_gids.size());
+
+ CHECK_EQUAL(3, (int)local_cell_gids[0]);
+ CHECK_EQUAL(162, (int)local_cell_gids[159]);
+ CHECK_EQUAL(642, (int)local_cell_gids[318]);
+
+ EntityHandle cell_ents[] = {local_cells[0], local_cells[159], local_cells[318]};
+ rval = mb.tag_get_data(vorticity_tag0, cell_ents, 3, vorticity0_val);
+ CHECK_ERR(rval);
+
+ // Timestep 0
+ // Layer 0
+ CHECK_REAL_EQUAL(-0.725999, vorticity0_val[0 * layers], eps);
+ CHECK_REAL_EQUAL(-1.814997, vorticity0_val[1 * layers], eps);
+ CHECK_REAL_EQUAL(-0.554888, vorticity0_val[2 * layers], eps);
+ // Layer 1
+ CHECK_REAL_EQUAL(-0.725989, vorticity0_val[0 * layers + 1], eps);
+ CHECK_REAL_EQUAL(-1.814972, vorticity0_val[1 * layers + 1], eps);
+ CHECK_REAL_EQUAL(-0.554881, vorticity0_val[2 * layers + 1], eps);
+
+ rval = mb.tag_get_data(vorticity_tag1, cell_ents, 3, vorticity1_val);
+ CHECK_ERR(rval);
+
+ // Timestep 1
+ // Layer 0
+ CHECK_REAL_EQUAL(-0.706871, vorticity1_val[0 * layers], eps);
+ CHECK_REAL_EQUAL(-1.767178, vorticity1_val[1 * layers], eps);
+ CHECK_REAL_EQUAL(-0.540269, vorticity1_val[2 * layers], eps);
+ // Layer 1
+ CHECK_REAL_EQUAL(-0.706861, vorticity1_val[0 * layers + 1], eps);
+ CHECK_REAL_EQUAL(-1.767153, vorticity1_val[1 * layers + 1], eps);
+ CHECK_REAL_EQUAL(-0.540262, vorticity1_val[2 * layers + 1], eps);
}
else if (1 == rank) {
- CHECK_EQUAL(4, (int)local_cell_gids[0]);
- CHECK_EQUAL(341, (int)local_cell_gids[160]);
- CHECK_EQUAL(642, (int)local_cell_gids[320]);
+ CHECK_EQUAL((size_t)323, local_cells.size());
+ CHECK_EQUAL((size_t)323, local_cell_gids.size());
- CHECK_REAL_EQUAL(15.004, ke0_val[0], eps);
- CHECK_REAL_EQUAL(16.341, ke0_val[1], eps);
- CHECK_REAL_EQUAL(16.642, ke0_val[2], eps);
- CHECK_REAL_EQUAL(25.004, ke1_val[0], eps);
- CHECK_REAL_EQUAL(26.341, ke1_val[1], eps);
- CHECK_REAL_EQUAL(26.642, ke1_val[2], eps);
+ CHECK_EQUAL(1, (int)local_cell_gids[0]);
+ CHECK_EQUAL(365, (int)local_cell_gids[161]);
+ CHECK_EQUAL(557, (int)local_cell_gids[322]);
+
+ EntityHandle cell_ents[] = {local_cells[0], local_cells[161], local_cells[322]};
+ rval = mb.tag_get_data(vorticity_tag0, cell_ents, 3, vorticity0_val);
+ CHECK_ERR(rval);
+
+ // Timestep 0
+ // Layer 0
+ CHECK_REAL_EQUAL(3.629994, vorticity0_val[0 * layers], eps);
+ CHECK_REAL_EQUAL(-1.173971, vorticity0_val[1 * layers], eps);
+ CHECK_REAL_EQUAL(3.526371, vorticity0_val[2 * layers], eps);
+ // Layer 1
+ CHECK_REAL_EQUAL(3.629944, vorticity0_val[0 * layers + 1], eps);
+ CHECK_REAL_EQUAL(-1.173955, vorticity0_val[1 * layers + 1], eps);
+ CHECK_REAL_EQUAL(3.526322, vorticity0_val[2 * layers + 1], eps);
+
+ rval = mb.tag_get_data(vorticity_tag1, cell_ents, 3, vorticity1_val);
+ CHECK_ERR(rval);
+
+ // Timestep 1
+ // Layer 0
+ CHECK_REAL_EQUAL(3.534355, vorticity1_val[0 * layers], eps);
+ CHECK_REAL_EQUAL(-1.143041, vorticity1_val[1 * layers], eps);
+ CHECK_REAL_EQUAL(3.433463, vorticity1_val[2 * layers], eps);
+ // Layer 1
+ CHECK_REAL_EQUAL(3.534306, vorticity1_val[0 * layers + 1], eps);
+ CHECK_REAL_EQUAL(-1.143025, vorticity1_val[1 * layers + 1], eps);
+ CHECK_REAL_EQUAL(3.433415, vorticity1_val[2 * layers + 1], eps);
}
}
else {
+ CHECK_EQUAL((size_t)321, local_cells.size());
+ CHECK_EQUAL((size_t)321, local_cell_gids.size());
CHECK_EQUAL((size_t)1, local_cell_gids.psize());
+ EntityHandle cell_ents[] = {local_cells[0], local_cells[160], local_cells[320]};
+ rval = mb.tag_get_data(vorticity_tag0, cell_ents, 3, vorticity0_val);
+ CHECK_ERR(rval);
+
+ rval = mb.tag_get_data(vorticity_tag1, cell_ents, 3, vorticity1_val);
+ CHECK_ERR(rval);
+
if (0 == rank) {
- if (no_mixed_elements)
- CHECK_EQUAL((size_t)1, local_cells.psize());
- else
- CHECK_EQUAL((size_t)2, local_cells.psize());
CHECK_EQUAL(1, (int)local_cell_gids[0]);
CHECK_EQUAL(161, (int)local_cell_gids[160]);
CHECK_EQUAL(321, (int)local_cell_gids[320]);
- CHECK_REAL_EQUAL(15.001, ke0_val[0], eps);
- CHECK_REAL_EQUAL(16.161, ke0_val[1], eps);
- CHECK_REAL_EQUAL(16.321, ke0_val[2], eps);
- CHECK_REAL_EQUAL(25.001, ke1_val[0], eps);
- CHECK_REAL_EQUAL(26.161, ke1_val[1], eps);
- CHECK_REAL_EQUAL(26.321, ke1_val[2], eps);
+ // Timestep 0
+ // Layer 0
+ CHECK_REAL_EQUAL(3.629994, vorticity0_val[0 * layers], eps);
+ CHECK_REAL_EQUAL(-1.708188, vorticity0_val[1 * layers], eps);
+ CHECK_REAL_EQUAL(0.131688, vorticity0_val[2 * layers], eps);
+ // Layer 1
+ CHECK_REAL_EQUAL(3.629944, vorticity0_val[0 * layers + 1], eps);
+ CHECK_REAL_EQUAL(-1.708164, vorticity0_val[1 * layers + 1], eps);
+ CHECK_REAL_EQUAL(0.131686, vorticity0_val[2 * layers + 1], eps);
+
+ // Timestep 1
+ // Layer 0
+ CHECK_REAL_EQUAL(3.534355, vorticity1_val[0 * layers], eps);
+ CHECK_REAL_EQUAL(-1.663182, vorticity1_val[1 * layers], eps);
+ CHECK_REAL_EQUAL(0.128218, vorticity1_val[2 * layers], eps);
+ // Layer 1
+ CHECK_REAL_EQUAL(3.534306, vorticity1_val[0 * layers + 1], eps);
+ CHECK_REAL_EQUAL(-1.663160, vorticity1_val[1 * layers + 1], eps);
+ CHECK_REAL_EQUAL(0.128216, vorticity1_val[2 * layers + 1], eps);
}
else if (1 == rank) {
- CHECK_EQUAL((size_t)1, local_cells.psize());
CHECK_EQUAL(322, (int)local_cell_gids[0]);
CHECK_EQUAL(482, (int)local_cell_gids[160]);
CHECK_EQUAL(642, (int)local_cell_gids[320]);
- CHECK_REAL_EQUAL(16.322, ke0_val[0], eps);
- CHECK_REAL_EQUAL(16.482, ke0_val[1], eps);
- CHECK_REAL_EQUAL(16.642, ke0_val[2], eps);
- CHECK_REAL_EQUAL(26.322, ke1_val[0], eps);
- CHECK_REAL_EQUAL(26.482, ke1_val[1], eps);
- CHECK_REAL_EQUAL(26.642, ke1_val[2], eps);
+ // Timestep 0
+ // Layer 0
+ CHECK_REAL_EQUAL(-0.554888, vorticity0_val[0 * layers], eps);
+ CHECK_REAL_EQUAL(2.434397, vorticity0_val[1 * layers], eps);
+ CHECK_REAL_EQUAL(-0.554888, vorticity0_val[2 * layers], eps);
+ // Layer 1
+ CHECK_REAL_EQUAL(-0.554881, vorticity0_val[0 * layers + 1], eps);
+ CHECK_REAL_EQUAL(2.434363, vorticity0_val[1 * layers + 1], eps);
+ CHECK_REAL_EQUAL(-0.554881, vorticity0_val[2 * layers + 1], eps);
+
+ // Timestep 1
+ // Layer 0
+ CHECK_REAL_EQUAL(-0.540269, vorticity1_val[0 * layers], eps);
+ CHECK_REAL_EQUAL(2.370258, vorticity1_val[1 * layers], eps);
+ CHECK_REAL_EQUAL(-0.540269, vorticity1_val[2 * layers], eps);
+ // Layer 1
+ CHECK_REAL_EQUAL(-0.540262, vorticity1_val[0 * layers + 1], eps);
+ CHECK_REAL_EQUAL(2.370226, vorticity1_val[1 * layers + 1], eps);
+ CHECK_REAL_EQUAL(-0.540262, vorticity1_val[2 * layers + 1], eps);
}
}
}
}
-void read_mesh_parallel(bool rcbzoltan, bool no_mixed_elements)
+void read_mesh_parallel(bool rcbzoltan)
{
Core moab;
Interface& mb = moab;
@@ -274,17 +302,12 @@ void read_mesh_parallel(bool rcbzoltan, bool no_mixed_elements)
if (rcbzoltan)
read_options = "PARALLEL=READ_PART;PARTITION_METHOD=RCBZOLTAN;PARALLEL_RESOLVE_SHARED_ENTS;VARIABLE=";
- if (no_mixed_elements)
- read_options += ";NO_MIXED_ELEMENTS";
-
ErrorCode rval = mb.load_file(example, NULL, read_options.c_str());
CHECK_ERR(rval);
ParallelComm* pcomm = ParallelComm::get_pcomm(&mb, 0);
-#if 0
int procs = pcomm->proc_config().proc_size();
int rank = pcomm->proc_config().proc_rank();
-#endif
rval = pcomm->check_all_shared_handles();
CHECK_ERR(rval);
@@ -294,21 +317,19 @@ void read_mesh_parallel(bool rcbzoltan, bool no_mixed_elements)
rval = mb.get_entities_by_type(0, MBVERTEX, local_verts);
CHECK_ERR(rval);
-#if 0
int verts_num = local_verts.size();
-
if (2 == procs) {
if (rcbzoltan) {
if (0 == rank)
- CHECK_EQUAL(685, verts_num);
+ CHECK_EQUAL(684, verts_num);
else if (1 == rank)
- CHECK_EQUAL(685, verts_num); // Not owned vertices included
+ CHECK_EQUAL(691, verts_num); // Not owned vertices included
}
else {
if (0 == rank)
- CHECK_EQUAL(1120, verts_num);
+ CHECK_EQUAL(687, verts_num);
else if (1 == rank)
- CHECK_EQUAL(1122, verts_num); // Not owned vertices included
+ CHECK_EQUAL(688, verts_num); // Not owned vertices included
}
}
@@ -319,15 +340,15 @@ void read_mesh_parallel(bool rcbzoltan, bool no_mixed_elements)
if (2 == procs) {
if (rcbzoltan) {
if (0 == rank)
- CHECK_EQUAL(685, verts_num);
+ CHECK_EQUAL(684, verts_num);
else if (1 == rank)
- CHECK_EQUAL(595, verts_num); // Not owned vertices excluded
+ CHECK_EQUAL(596, verts_num); // Not owned vertices excluded
}
else {
if (0 == rank)
- CHECK_EQUAL(1120, verts_num);
+ CHECK_EQUAL(687, verts_num);
else if (1 == rank)
- CHECK_EQUAL(160, verts_num); // Not owned vertices excluded
+ CHECK_EQUAL(593, verts_num); // Not owned vertices excluded
}
}
@@ -340,15 +361,15 @@ void read_mesh_parallel(bool rcbzoltan, bool no_mixed_elements)
if (2 == procs) {
if (rcbzoltan) {
if (0 == rank)
- CHECK_EQUAL(1005, edges_num);
+ CHECK_EQUAL(1004, edges_num);
else if (1 == rank)
- CHECK_EQUAL(1005, edges_num); // Not owned edges included
+ CHECK_EQUAL(1016, edges_num); // Not owned edges included
}
else {
if (0 == rank)
- CHECK_EQUAL(1438, edges_num);
+ CHECK_EQUAL(1010, edges_num);
else if (1 == rank)
- CHECK_EQUAL(1444, edges_num); // Not owned edges included
+ CHECK_EQUAL(1010, edges_num); // Not owned edges included
}
}
@@ -359,15 +380,15 @@ void read_mesh_parallel(bool rcbzoltan, bool no_mixed_elements)
if (2 == procs) {
if (rcbzoltan) {
if (0 == rank)
- CHECK_EQUAL(1005, edges_num);
+ CHECK_EQUAL(1004, edges_num);
else if (1 == rank)
- CHECK_EQUAL(915, edges_num); // Not owned edges excluded
+ CHECK_EQUAL(921, edges_num); // Not owned edges excluded
}
else {
if (0 == rank)
- CHECK_EQUAL(1438, edges_num);
+ CHECK_EQUAL(1010, edges_num);
else if (1 == rank)
- CHECK_EQUAL(482, edges_num); // Not owned edges excluded
+ CHECK_EQUAL(915, edges_num); // Not owned edges excluded
}
}
@@ -375,27 +396,19 @@ void read_mesh_parallel(bool rcbzoltan, bool no_mixed_elements)
Range local_cells;
rval = mb.get_entities_by_type(0, MBPOLYGON, local_cells);
CHECK_ERR(rval);
+ // No mixed elements
+ CHECK_EQUAL((size_t)1, local_cells.psize());
int cells_num = local_cells.size();
if (2 == procs) {
- CHECK_EQUAL(321, cells_num);
-
if (rcbzoltan) {
- if (no_mixed_elements)
- CHECK_EQUAL((size_t)1, local_cells.psize());
+ if (0 == rank)
+ CHECK_EQUAL(319, cells_num);
else
- CHECK_EQUAL((size_t)2, local_cells.psize());
- }
- else {
- if (0 == rank) {
- if (no_mixed_elements)
- CHECK_EQUAL((size_t)1, local_cells.psize());
- else
- CHECK_EQUAL((size_t)2, local_cells.psize());
- }
- else if (1 == rank)
- CHECK_EQUAL((size_t)1, local_cells.psize());
+ CHECK_EQUAL(323, cells_num);
}
+ else
+ CHECK_EQUAL(321, cells_num);
}
rval = pcomm->filter_pstatus(local_cells, PSTATUS_NOT_OWNED, PSTATUS_NOT);
@@ -403,24 +416,14 @@ void read_mesh_parallel(bool rcbzoltan, bool no_mixed_elements)
cells_num = local_cells.size();
if (2 == procs) {
- CHECK_EQUAL(321, cells_num);
-
if (rcbzoltan) {
- if (no_mixed_elements)
- CHECK_EQUAL((size_t)1, local_cells.psize());
+ if (0 == rank)
+ CHECK_EQUAL(319, cells_num);
else
- CHECK_EQUAL((size_t)2, local_cells.psize());
- }
- else {
- if (0 == rank) {
- if (no_mixed_elements)
- CHECK_EQUAL((size_t)1, local_cells.psize());
- else
- CHECK_EQUAL((size_t)2, local_cells.psize());
- }
- else if (1 == rank)
- CHECK_EQUAL((size_t)1, local_cells.psize());
+ CHECK_EQUAL(323, cells_num);
}
+ else
+ CHECK_EQUAL(321, cells_num);
}
std::cout << "proc: " << rank << " verts:" << verts_num << "\n";
@@ -438,7 +441,8 @@ void read_mesh_parallel(bool rcbzoltan, bool no_mixed_elements)
MPI_Reduce(&edges_num, &total_edges_num, 1, MPI_INTEGER, MPI_SUM, 0, pcomm->proc_config().proc_comm());
if (0 == rank) {
std::cout << "total edges: " << total_edges_num << "\n";
- CHECK_EQUAL(1920, total_edges_num);
+ // FIXME: Current result is 1925
+ //CHECK_EQUAL(1920, total_edges_num);
}
std::cout << "proc: " << rank << " cells:" << cells_num << "\n";
@@ -449,15 +453,13 @@ void read_mesh_parallel(bool rcbzoltan, bool no_mixed_elements)
std::cout << "total cells: " << total_cells_num << "\n";
CHECK_EQUAL(642, total_cells_num);
}
-#endif
+
#ifdef HDF5_PARALLEL
std::string write_options("PARALLEL=WRITE_PART;");
std::string output_file = "test_gcrm";
if (rcbzoltan)
output_file += "_rcbzoltan";
- if (no_mixed_elements)
- output_file += "_no_mixed_elements";
output_file += ".h5m";
mb.write_file(output_file.c_str(), NULL, write_options.c_str());
@@ -537,7 +539,7 @@ void gather_one_cell_var(int gather_set_rank)
}
}
-void multiple_loads_of_same_file(bool no_mixed_elements)
+void multiple_loads_of_same_file()
{
Core moab;
Interface& mb = moab;
@@ -550,24 +552,18 @@ void multiple_loads_of_same_file(bool no_mixed_elements)
// Read first only header information, no mesh, no variable
read_options = "PARALLEL=READ_PART;PARTITION;NOMESH;VARIABLE=;PARTITION_METHOD=TRIVIAL";
- if (no_mixed_elements)
- read_options += ";NO_MIXED_ELEMENTS";
rval = mb.load_file(example, &file_set, read_options.c_str());
CHECK_ERR(rval);
// Create mesh, no variable
read_options = "PARALLEL=READ_PART;PARTITION;PARALLEL_RESOLVE_SHARED_ENTS;PARTITION_METHOD=TRIVIAL;VARIABLE=";
- if (no_mixed_elements)
- read_options += ";NO_MIXED_ELEMENTS";
rval = mb.load_file(example, &file_set, read_options.c_str());
CHECK_ERR(rval);
- // Read variable ke at timestep 0, no mesh
- read_options = "PARALLEL=READ_PART;PARTITION;PARTITION_METHOD=TRIVIAL;NOMESH;VARIABLE=ke;TIMESTEP=0";
- if (no_mixed_elements)
- read_options += ";NO_MIXED_ELEMENTS";
+ // Read variable vorticity at timestep 0, no mesh
+ read_options = "PARALLEL=READ_PART;PARTITION;PARTITION_METHOD=TRIVIAL;NOMESH;VARIABLE=vorticity;TIMESTEP=0";
rval = mb.load_file(example, &file_set, read_options.c_str());
CHECK_ERR(rval);
@@ -583,6 +579,8 @@ void multiple_loads_of_same_file(bool no_mixed_elements)
Range local_cells;
rval = mb.get_entities_by_type(file_set, MBPOLYGON, local_cells);
CHECK_ERR(rval);
+ // No mixed elements
+ CHECK_EQUAL((size_t)1, local_cells.psize());
ParallelComm* pcomm = ParallelComm::get_pcomm(&mb, 0);
int procs = pcomm->proc_config().proc_size();
@@ -592,37 +590,44 @@ void multiple_loads_of_same_file(bool no_mixed_elements)
if (2 == procs) {
CHECK_EQUAL((size_t)321, local_cells.size());
- // Check tag for cell variable ke at timestep 0
- Tag ke_tag0;
- rval = mb.tag_get_handle("ke0", 1, MB_TYPE_DOUBLE, ke_tag0);
+ // Check tag for cell variable vorticity at timestep 0
+ Tag vorticity_tag0;
+ rval = mb.tag_get_handle("vorticity0", layers, MB_TYPE_DOUBLE, vorticity_tag0);
CHECK_ERR(rval);
- // Get ke0 tag values on 3 local cells
+ // Get vorticity0 tag values on 3 local cells
+ double vorticity0_val[3 * layers];
EntityHandle cell_ents[] = {local_cells[0], local_cells[160], local_cells[320]};
- double ke0_val[3];
- rval = mb.tag_get_data(ke_tag0, cell_ents, 3, ke0_val);
+ rval = mb.tag_get_data(vorticity_tag0, cell_ents, 3, vorticity0_val);
CHECK_ERR(rval);
if (0 == rank) {
- CHECK_EQUAL((size_t)1120, local_verts.size());
- CHECK_EQUAL((size_t)1438, local_edges.size());
- if (no_mixed_elements)
- CHECK_EQUAL((size_t)1, local_cells.psize());
- else
- CHECK_EQUAL((size_t)2, local_cells.psize());
-
- CHECK_REAL_EQUAL(15.001, ke0_val[0], eps);
- CHECK_REAL_EQUAL(16.161, ke0_val[1], eps);
- CHECK_REAL_EQUAL(16.321, ke0_val[2], eps);
+ CHECK_EQUAL((size_t)687, local_verts.size());
+ // FIXME: Previous result is 1010
+ //CHECK_EQUAL((size_t)1007, local_edges.size());
+
+ // Layer 0
+ CHECK_REAL_EQUAL(3.629994, vorticity0_val[0 * layers], eps);
+ CHECK_REAL_EQUAL(-1.708188, vorticity0_val[1 * layers], eps);
+ CHECK_REAL_EQUAL(0.131688, vorticity0_val[2 * layers], eps);
+ // Layer 1
+ CHECK_REAL_EQUAL(3.629944, vorticity0_val[0 * layers + 1], eps);
+ CHECK_REAL_EQUAL(-1.708164, vorticity0_val[1 * layers + 1], eps);
+ CHECK_REAL_EQUAL(0.131686, vorticity0_val[2 * layers + 1], eps);
}
else if (1 == rank) {
- CHECK_EQUAL((size_t)1122, local_verts.size());
- CHECK_EQUAL((size_t)1444, local_edges.size());
- CHECK_EQUAL((size_t)1, local_cells.psize());
-
- CHECK_REAL_EQUAL(16.322, ke0_val[0], eps);
- CHECK_REAL_EQUAL(16.482, ke0_val[1], eps);
- CHECK_REAL_EQUAL(16.642, ke0_val[2], eps);
+ CHECK_EQUAL((size_t)688, local_verts.size());
+ // FIXME: Previous result is 1010
+ //CHECK_EQUAL((size_t)1008, local_edges.size());
+
+ // Layer 0
+ CHECK_REAL_EQUAL(-0.554888, vorticity0_val[0 * layers], eps);
+ CHECK_REAL_EQUAL(2.434397, vorticity0_val[1 * layers], eps);
+ CHECK_REAL_EQUAL(-0.554888, vorticity0_val[2 * layers], eps);
+ // Layer 1
+ CHECK_REAL_EQUAL(-0.554881, vorticity0_val[0 * layers + 1], eps);
+ CHECK_REAL_EQUAL(2.434363, vorticity0_val[1 * layers + 1], eps);
+ CHECK_REAL_EQUAL(-0.554881, vorticity0_val[2 * layers + 1], eps);
}
}
}
https://bitbucket.org/fathomteam/moab/commits/d70bf0779294/
Changeset: d70bf0779294
Branch: master
User: iulian07
Date: 2014-06-04 03:39:58
Summary: correct the gcrm test
after fixing the bug with padded polygons, the number of edges is changed
Affected #: 1 file
diff --git a/test/parallel/gcrm_par.cpp b/test/parallel/gcrm_par.cpp
index 49ed809..1defb0e 100644
--- a/test/parallel/gcrm_par.cpp
+++ b/test/parallel/gcrm_par.cpp
@@ -361,15 +361,15 @@ void read_mesh_parallel(bool rcbzoltan)
if (2 == procs) {
if (rcbzoltan) {
if (0 == rank)
- CHECK_EQUAL(1004, edges_num);
+ CHECK_EQUAL(1002, edges_num);
else if (1 == rank)
- CHECK_EQUAL(1016, edges_num); // Not owned edges included
+ CHECK_EQUAL(1013, edges_num); // Not owned edges included
}
else {
if (0 == rank)
- CHECK_EQUAL(1010, edges_num);
+ CHECK_EQUAL(1007, edges_num);
else if (1 == rank)
- CHECK_EQUAL(1010, edges_num); // Not owned edges included
+ CHECK_EQUAL(1008, edges_num); // Not owned edges included
}
}
@@ -380,15 +380,15 @@ void read_mesh_parallel(bool rcbzoltan)
if (2 == procs) {
if (rcbzoltan) {
if (0 == rank)
- CHECK_EQUAL(1004, edges_num);
+ CHECK_EQUAL(1002, edges_num);
else if (1 == rank)
- CHECK_EQUAL(921, edges_num); // Not owned edges excluded
+ CHECK_EQUAL(918, edges_num); // Not owned edges excluded
}
else {
if (0 == rank)
- CHECK_EQUAL(1010, edges_num);
+ CHECK_EQUAL(1007, edges_num);
else if (1 == rank)
- CHECK_EQUAL(915, edges_num); // Not owned edges excluded
+ CHECK_EQUAL(913, edges_num); // Not owned edges excluded
}
}
@@ -441,8 +441,7 @@ void read_mesh_parallel(bool rcbzoltan)
MPI_Reduce(&edges_num, &total_edges_num, 1, MPI_INTEGER, MPI_SUM, 0, pcomm->proc_config().proc_comm());
if (0 == rank) {
std::cout << "total edges: " << total_edges_num << "\n";
- // FIXME: Current result is 1925
- //CHECK_EQUAL(1920, total_edges_num);
+ CHECK_EQUAL(1920, total_edges_num);
}
std::cout << "proc: " << rank << " cells:" << cells_num << "\n";
Repository URL: https://bitbucket.org/fathomteam/moab/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
More information about the moab-dev
mailing list