[MOAB-dev] commit/MOAB: danwu: Revision d018f20 has caused some ParGAL tests for Eulerian Spectral grid to fail. To detect such kind of regressions, MOAB unit test read_nc.cpp is updated to check some values of tag T0 read from camEul26x48x96.t3.nc. This new test will pass on revisions before d018f20, fail on revision d018f20, and pass on revisions after f6aef30.

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Wed Jul 17 13:50:28 CDT 2013


1 new commit in MOAB:

https://bitbucket.org/fathomteam/moab/commits/cea389befaf8/
Changeset:   cea389befaf8
Branch:      master
User:        danwu
Date:        2013-07-17 20:49:57
Summary:     Revision d018f20 has caused some ParGAL tests for Eulerian Spectral grid to fail. To detect such kind of regressions, MOAB unit test read_nc.cpp is updated to check some values of tag T0 read from camEul26x48x96.t3.nc. This new test will pass on revisions before d018f20, fail on revision d018f20, and pass on revisions after f6aef30.

Affected #:  1 file

diff --git a/test/io/read_nc.cpp b/test/io/read_nc.cpp
index 558958c..caff6a4 100644
--- a/test/io/read_nc.cpp
+++ b/test/io/read_nc.cpp
@@ -13,6 +13,7 @@ static const char example_fv[] = "/io/fv26x46x72.t.3.nc";
 
 #ifdef USE_MPI
 #include "moab_mpi.h"
+#include "moab/ParallelComm.hpp"
 #endif
 
 // CAM-EUL
@@ -40,7 +41,7 @@ int main(int argc, char* argv[])
   if (fail)
     return 1;
 #else
-  argv[0] = argv[argc - argc]; // to remove the warnings in serial mode about unused variables
+  argv[0] = argv[argc - argc]; // To remove the warnings in serial mode about unused variables
 #endif
 
   result += RUN_TEST(test_read_eul_all);
@@ -58,7 +59,8 @@ int main(int argc, char* argv[])
 
 #ifdef USE_MPI
   fail = MPI_Finalize();
-  if (fail) return 1;
+  if (fail)
+    return 1;
 #endif
 
   return result;
@@ -76,7 +78,7 @@ void test_read_eul_all()
   rval = mb.load_file(example_eul, NULL, opts.c_str());
   CHECK_ERR(rval);
 
-    // check for proper tags
+  // Check for proper tags
   Tag Ttag0, Ttag1, coordTag;
   rval = mb.tag_get_handle("T0", 26, MB_TYPE_DOUBLE, Ttag0);
   CHECK_ERR(rval);
@@ -100,13 +102,58 @@ void test_read_eul_onevar()
   rval = mb.load_file(example_eul, NULL, opts.c_str());
   CHECK_ERR(rval);
 
-    // check for proper tags
+  // Check for proper tags
   Tag Ttag0, Ttag1;
   rval = mb.tag_get_handle("T0", 26, MB_TYPE_DOUBLE, Ttag0);
   CHECK_ERR(rval);
 
   rval = mb.tag_get_handle("T1", 26, MB_TYPE_DOUBLE, Ttag1);
   CHECK_ERR(rval);
+
+  // Check values of tag T0 (first level) at some strategically chosen places below
+  int rank = 0;
+  int procs = 1;
+#ifdef USE_MPI
+  ParallelComm* pcomm = ParallelComm::get_pcomm(&mb, 0);
+  rank = pcomm->proc_config().proc_rank();
+  procs = pcomm->proc_config().proc_size();
+#endif
+
+  const double eps = 0.0001;
+  double val[4 * 26];
+
+  if (1 == procs) {
+    Range global_quads;
+    rval = mb.get_entities_by_type(0, MBQUAD, global_quads);
+    CHECK_ERR(rval);
+    CHECK_EQUAL((size_t)4608, global_quads.size());
+
+    EntityHandle gloabl_quad_ents[] = {global_quads[0], global_quads[4559], global_quads[48], global_quads[4607]};
+    rval = mb.tag_get_data(Ttag0, &gloabl_quad_ents[0], 4, val);
+
+    CHECK_REAL_EQUAL(252.8529, val[0], eps); // First global quad
+    CHECK_REAL_EQUAL(205.3905, val[26], eps); // 4660th global quad
+    CHECK_REAL_EQUAL(252.7116, val[52], eps); // 49th global quad
+    CHECK_REAL_EQUAL(200.6828, val[78], eps); // Last global quad
+  }
+  else if (2 == procs) {
+    Range local_quads;
+    rval = mb.get_entities_by_type(0, MBQUAD, local_quads);
+    CHECK_ERR(rval);
+    CHECK_EQUAL((size_t)2304, local_quads.size());
+
+    EntityHandle local_quad_ents[] = {local_quads[0], local_quads[2303]};
+    rval = mb.tag_get_data(Ttag0, &local_quad_ents[0], 2, val);
+
+    if (0 == rank) {
+      CHECK_REAL_EQUAL(252.8529, val[0], eps); // First local quad, first global quad
+      CHECK_REAL_EQUAL(205.3905, val[26], eps); // Last local quad, 4660th global quad
+    }
+    else if (1 == rank) {
+      CHECK_REAL_EQUAL(252.7116, val[0], eps); // First local quad, 49th global quad
+      CHECK_REAL_EQUAL(200.6828, val[26], eps); // Last local quad, last global quad
+    }
+  }
 }
 
 void test_read_eul_onetimestep()
@@ -121,7 +168,7 @@ void test_read_eul_onetimestep()
   rval = mb.load_file(example_eul, NULL, opts.c_str());
   CHECK_ERR(rval);
 
-    // check for proper tags
+  // Check for proper tags
   Tag Ttag0, Ttag1;
   rval = mb.tag_get_handle("T0", 26, MB_TYPE_DOUBLE, Ttag0);
   CHECK_EQUAL(rval, MB_TAG_NOT_FOUND);
@@ -135,7 +182,7 @@ void test_read_eul_nomesh()
   Core moab;
   Interface& mb = moab;
 
-    // need a set for nomesh to work right
+  // Need a set for nomesh to work right
   EntityHandle set;
   ErrorCode rval = mb.create_meshset(MESHSET_SET, set);
   CHECK_ERR(rval);
@@ -148,7 +195,7 @@ void test_read_eul_nomesh()
   rval = mb.load_file(example_eul, &set, opts.c_str());
   CHECK_ERR(rval);
 
-    // check for proper tag
+  // Check for proper tag
   Tag Ttag0, Ttag1;
   rval = mb.tag_get_handle("T0", 26, MB_TYPE_DOUBLE, Ttag0);
   CHECK_ERR(rval);
@@ -156,12 +203,12 @@ void test_read_eul_nomesh()
   rval = mb.tag_get_handle("T1", 26, MB_TYPE_DOUBLE, Ttag1);
   CHECK_EQUAL(rval, MB_TAG_NOT_FOUND);
 
-    // now read 2nd timestep with nomesh option
+  // Now read 2nd timestep with nomesh option
   opts = orig + std::string(";VARIABLE=T;TIMESTEP=1;NOMESH");
   rval = mb.load_file(example_eul, &set, opts.c_str());
   CHECK_ERR(rval);
 
-    // check for proper tag
+  // Check for proper tag
   rval = mb.tag_get_handle("T1", 26, MB_TYPE_DOUBLE, Ttag1);
   CHECK_ERR(rval);
 }
@@ -171,7 +218,7 @@ void test_read_eul_novars()
   Core moab;
   Interface& mb = moab;
 
-    // need a set for nomesh to work right
+  // Need a set for nomesh to work right
   EntityHandle set;
   ErrorCode rval = mb.create_meshset(MESHSET_SET, set);
   CHECK_ERR(rval);
@@ -188,7 +235,7 @@ void test_read_eul_novars()
   rval = mb.load_file(example_eul, &set, opts.c_str());
   CHECK_ERR(rval);
 
-    // check for proper tag
+  // Check for proper tag
   Tag Ttag0, Ttag1;
   rval = mb.tag_get_handle("T0", 26, MB_TYPE_DOUBLE, Ttag0);
   CHECK_EQUAL(rval, MB_TAG_NOT_FOUND);
@@ -203,12 +250,12 @@ void test_read_eul_novars()
   rval = mb.tag_get_handle("T1", 26, MB_TYPE_DOUBLE, Ttag1);
   CHECK_EQUAL(rval, MB_TAG_NOT_FOUND);
 
-    // now read 2nd timestep with nomesh option
+  // Now read 2nd timestep with nomesh option
   opts = orig + std::string(";VARIABLE=T;TIMESTEP=1;NOMESH");
   rval = mb.load_file(example_eul, &set, opts.c_str());
   CHECK_ERR(rval);
 
-    // check for proper tag
+  // Check for proper tag
   rval = mb.tag_get_handle("T1", 26, MB_TYPE_DOUBLE, Ttag1);
   CHECK_ERR(rval);
 }
@@ -225,7 +272,7 @@ void test_read_fv_all()
   rval = mb.load_file(example_fv, NULL, opts.c_str());
   CHECK_ERR(rval);
 
-    // check for proper tags
+  // Check for proper tags
   Tag Ttag0, Ttag1, coordTag;
   rval = mb.tag_get_handle("T0", 26, MB_TYPE_DOUBLE, Ttag0);
   CHECK_ERR(rval);
@@ -233,7 +280,7 @@ void test_read_fv_all()
   rval = mb.tag_get_handle("T1", 26, MB_TYPE_DOUBLE, Ttag1);
   CHECK_ERR(rval);
 
-  rval=mb.tag_get_handle("COORDS", 3, MB_TYPE_DOUBLE, coordTag);
+  rval = mb.tag_get_handle("COORDS", 3, MB_TYPE_DOUBLE, coordTag);
   CHECK_ERR(rval);
 }
 
@@ -249,7 +296,7 @@ void test_read_fv_onevar()
   rval = mb.load_file(example_fv, NULL, opts.c_str());
   CHECK_ERR(rval);
 
-    // check for proper tags
+  // Check for proper tags
   Tag Ttag0, Ttag1;
   rval = mb.tag_get_handle("T0", 26, MB_TYPE_DOUBLE, Ttag0);
   CHECK_ERR(rval);
@@ -270,7 +317,7 @@ void test_read_fv_onetimestep()
   rval = mb.load_file(example_fv, NULL, opts.c_str());
   CHECK_ERR(rval);
 
-    // check for proper tags
+  // Check for proper tags
   Tag Ttag0, Ttag1;
   rval = mb.tag_get_handle("T0", 26, MB_TYPE_DOUBLE, Ttag0);
   CHECK_EQUAL(rval, MB_TAG_NOT_FOUND);
@@ -284,7 +331,7 @@ void test_read_fv_nomesh()
   Core moab;
   Interface& mb = moab;
 
-    // need a set for nomesh to work right
+  // Need a set for nomesh to work right
   EntityHandle set;
   ErrorCode rval = mb.create_meshset(MESHSET_SET, set);
   CHECK_ERR(rval);
@@ -297,7 +344,7 @@ void test_read_fv_nomesh()
   rval = mb.load_file(example_fv, &set, opts.c_str());
   CHECK_ERR(rval);
 
-    // check for proper tag
+  // Check for proper tag
   Tag Ttag0, Ttag1;
   rval = mb.tag_get_handle("T0", 26, MB_TYPE_DOUBLE, Ttag0);
   CHECK_ERR(rval);
@@ -305,12 +352,12 @@ void test_read_fv_nomesh()
   rval = mb.tag_get_handle("T1", 26, MB_TYPE_DOUBLE, Ttag1);
   CHECK_EQUAL(rval, MB_TAG_NOT_FOUND);
 
-    // now read 2nd timestep with nomesh option
+  // Now read 2nd timestep with nomesh option
   opts = orig + std::string(";VARIABLE=T;TIMESTEP=1;NOMESH");
   rval = mb.load_file(example_fv, &set, opts.c_str());
   CHECK_ERR(rval);
 
-    // check for proper tag
+  // Check for proper tag
   rval = mb.tag_get_handle("T1", 26, MB_TYPE_DOUBLE, Ttag1);
   CHECK_ERR(rval);
 }
@@ -320,7 +367,7 @@ void test_read_fv_novars()
   Core moab;
   Interface& mb = moab;
 
-    // need a set for nomesh to work right
+  // Need a set for nomesh to work right
   EntityHandle set;
   ErrorCode rval = mb.create_meshset(MESHSET_SET, set);
   CHECK_ERR(rval);
@@ -337,7 +384,7 @@ void test_read_fv_novars()
   rval = mb.load_file(example_fv, &set, opts.c_str());
   CHECK_ERR(rval);
 
-    // check for proper tag
+  // Check for proper tag
   Tag Ttag0, Ttag1;
   rval = mb.tag_get_handle("T0", 26, MB_TYPE_DOUBLE, Ttag0);
   CHECK_EQUAL(rval, MB_TAG_NOT_FOUND);
@@ -352,12 +399,12 @@ void test_read_fv_novars()
   rval = mb.tag_get_handle("T1", 26, MB_TYPE_DOUBLE, Ttag1);
   CHECK_EQUAL(rval, MB_TAG_NOT_FOUND);
 
-    // now read 2nd timestep with nomesh option
+  // Now read 2nd timestep with nomesh option
   opts = orig + std::string(";VARIABLE=T;TIMESTEP=1;NOMESH");
   rval = mb.load_file(example_fv, &set, opts.c_str());
   CHECK_ERR(rval);
 
-    // check for proper tag
+  // Check for proper tag
   rval = mb.tag_get_handle("T1", 26, MB_TYPE_DOUBLE, Ttag1);
   CHECK_ERR(rval);
 }
@@ -365,7 +412,7 @@ void test_read_fv_novars()
 ErrorCode get_options(std::string& opts) 
 {
 #ifdef USE_MPI
-    // use parallel options
+  // Use parallel options
   opts = std::string(";;PARALLEL=READ_PART;PARTITION_METHOD=SQIJ");
   return MB_SUCCESS;
 #else

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