[MOAB-dev] commit/MOAB: danwu: Updated some NC reader/writer unit tests to use smaller mesh files with reduced levels.

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Wed Jun 25 10:54:06 CDT 2014


1 new commit in MOAB:

https://bitbucket.org/fathomteam/moab/commits/25e9f52bfb2e/
Changeset:   25e9f52bfb2e
Branch:      danwu/shrink_unit_test_nc_files
User:        danwu
Date:        2014-06-25 17:53:17
Summary:     Updated some NC reader/writer unit tests to use smaller mesh files with reduced levels.

Affected #:  5 files

diff --git a/test/io/read_nc.cpp b/test/io/read_nc.cpp
index 4d503de..f509c40 100644
--- a/test/io/read_nc.cpp
+++ b/test/io/read_nc.cpp
@@ -4,11 +4,11 @@
 using namespace moab;
 
 #ifdef MESHDIR
-static const char example_eul[] = STRINGIFY(MESHDIR) "/io/eul26x48x96.t.3.nc";
-static const char example_fv[] = STRINGIFY(MESHDIR) "/io/fv26x46x72.t.3.nc";
+static const char example_eul[] = STRINGIFY(MESHDIR) "/io/eul3x48x96.t.3.nc";
+static const char example_fv[] = STRINGIFY(MESHDIR) "/io/fv3x46x72.t.3.nc";
 #else
-static const char example_eul[] = "/io/eul26x48x96.t.3.nc";
-static const char example_fv[] = "/io/fv26x46x72.t.3.nc";
+static const char example_eul[] = "/io/eul3x48x96.t.3.nc";
+static const char example_fv[] = "/io/fv3x46x72.t.3.nc";
 #endif
 
 #ifdef USE_MPI
@@ -35,7 +35,7 @@ void test_read_fv_ghosting();
 
 ErrorCode get_options(std::string& opts);
 
-const int levels = 26;
+const int levels = 3;
 
 int main(int argc, char* argv[])
 {

diff --git a/test/io/read_ucd_nc.cpp b/test/io/read_ucd_nc.cpp
index 0d2d045..56d9606 100644
--- a/test/io/read_ucd_nc.cpp
+++ b/test/io/read_ucd_nc.cpp
@@ -7,10 +7,10 @@
 using namespace moab;
 
 #ifdef MESHDIR
-static const char example[] = STRINGIFY(MESHDIR) "/io/homme26x3458.t.3.nc";
+static const char example[] = STRINGIFY(MESHDIR) "/io/homme3x3458.t.3.nc";
 static const char conn_fname[] = STRINGIFY(MESHDIR) "/io/HommeMapping.nc";
 #else
-static const char example[] = "/io/homme26x3458.t.3.nc";
+static const char example[] = "/io/homme3x3458.t.3.nc";
 static const char conn_fname[] = "io/HommeMapping.nc";
 #endif
 
@@ -30,7 +30,7 @@ void test_read_conn(); // Test reading connectivity file only
 
 void get_options(std::string& opts);
 
-const int levels = 26;
+const int levels = 3;
 
 int main(int argc, char* argv[])
 {
@@ -272,7 +272,7 @@ void test_read_coord_vars()
   double* lev_val = (double*)var_data;
   const double eps = 1e-10;
   CHECK_REAL_EQUAL(3.54463800000002, lev_val[0], eps);
-  CHECK_REAL_EQUAL(992.556100000005, lev_val[25], eps);
+  CHECK_REAL_EQUAL(13.9672100000001, lev_val[levels - 1], eps);
 
   // Check tag for dummy coordinate variable ncol
   tag_name = "ncol";
@@ -312,7 +312,7 @@ void test_read_coord_vars()
   CHECK_EQUAL(levels, var_len);
   lev_val = (double*)var_data;
   CHECK_REAL_EQUAL(3.54463800000002, lev_val[0], eps);
-  CHECK_REAL_EQUAL(992.556100000005, lev_val[25], eps);
+  CHECK_REAL_EQUAL(13.9672100000001, lev_val[levels - 1], eps);
 
   // Check tag for dummy coordinate variable ncol
   tag_name = "ncol";

diff --git a/test/io/write_nc.cpp b/test/io/write_nc.cpp
index d0ee024..99ccff5 100644
--- a/test/io/write_nc.cpp
+++ b/test/io/write_nc.cpp
@@ -4,21 +4,21 @@
 using namespace moab;
 
 #ifdef MESHDIR
-static const char example_eul[] = STRINGIFY(MESHDIR) "/io/eul26x48x96.t.3.nc";
-static const char example_eul_t0[] = STRINGIFY(MESHDIR) "/io/eul26x48x96.t0.nc";
-static const char example_eul_t1[] = STRINGIFY(MESHDIR) "/io/eul26x48x96.t1.nc";
-static const char example_eul_t2[] = STRINGIFY(MESHDIR) "/io/eul26x48x96.t2.nc";
-static const char example_fv[] = STRINGIFY(MESHDIR) "/io/fv26x46x72.t.3.nc";
-static const char example_homme[] = STRINGIFY(MESHDIR) "/io/homme26x3458.t.3.nc";
+static const char example_eul[] = STRINGIFY(MESHDIR) "/io/eul3x48x96.t.3.nc";
+static const char example_eul_t0[] = STRINGIFY(MESHDIR) "/io/eul3x48x96.t0.nc";
+static const char example_eul_t1[] = STRINGIFY(MESHDIR) "/io/eul3x48x96.t1.nc";
+static const char example_eul_t2[] = STRINGIFY(MESHDIR) "/io/eul3x48x96.t2.nc";
+static const char example_fv[] = STRINGIFY(MESHDIR) "/io/fv3x46x72.t.3.nc";
+static const char example_homme[] = STRINGIFY(MESHDIR) "/io/homme3x3458.t.3.nc";
 static const char example_mpas[] = STRINGIFY(MESHDIR) "/io/mpasx1.642.t.2.nc";
 static const char example_gcrm[] = STRINGIFY(MESHDIR) "/io/gcrm_r3.nc";
 #else
-static const char example_eul[] = "/io/eul26x48x96.t.3.nc";
-static const char example_eul_t0[] = "/io/eul26x48x96.t0.nc";
-static const char example_eul_t1[] = "/io/eul26x48x96.t1.nc";
-static const char example_eul_t2[] = "/io/eul26x48x96.t2.nc";
-static const char example_fv[] = "/io/fv26x46x72.t.3.nc";
-static const char example_homme[] = "/io/homme26x3458.t.3.nc";
+static const char example_eul[] = "/io/eul3x48x96.t.3.nc";
+static const char example_eul_t0[] = "/io/eul3x48x96.t0.nc";
+static const char example_eul_t1[] = "/io/eul3x48x96.t1.nc";
+static const char example_eul_t2[] = "/io/eul3x48x96.t2.nc";
+static const char example_fv[] = "/io/fv3x46x72.t.3.nc";
+static const char example_homme[] = "/io/homme3x3458.t.3.nc";
 static const char example_mpas[] = "/io/mpasx1.642.t.2.nc";
 static const char example_gcrm[] = "/io/gcrm_r3.nc";
 #endif
@@ -82,7 +82,8 @@ void get_homme_read_options(std::string& opts);
 void get_mpas_read_options(std::string& opts);
 
 const double eps = 1e-10;
-const int levels = 3; // Number of levels to be checked (e.g. 3 out of 26)
+const int levels = 3;
+const int mpas_levels = 1;
 
 int main(int argc, char* argv[])
 {
@@ -730,10 +731,10 @@ void test_mpas_check_vars()
 #endif
 
     NCDF_SIZE start[] = {0, 0, 0};
-    NCDF_SIZE count[] = {2, 1, 1};
-    const int size1 = 2 * 1280;
-    const int size2 = 2 * 1920;
-    const int size3 = 2 * 642;
+    NCDF_SIZE count[] = {2, 1, mpas_levels};
+    const int size1 = 2 * 1280 * mpas_levels;
+    const int size2 = 2 * 1920 * mpas_levels;
+    const int size3 = 2 * 642 * mpas_levels;
 
     // Read vertex variable vorticity from output file
     count[1] = 1280;
@@ -933,10 +934,10 @@ void test_gcrm_check_vars()
 #endif
 
     NCDF_SIZE start[] = {0, 0, 0};
-    NCDF_SIZE count[] = {2, 1, 3};
-    const int size1 = 2 * 1280 * 3;
-    const int size2 = 2 * 1920 * 3;
-    const int size3 = 2 * 642 * 3;
+    NCDF_SIZE count[] = {2, 1, levels};
+    const int size1 = 2 * 1280 * levels;
+    const int size2 = 2 * 1920 * levels;
+    const int size3 = 2 * 642 * levels;
 
     // Read vertex variable u from output file
     count[1] = 1280;
@@ -971,12 +972,12 @@ void test_gcrm_check_vars()
     success = NCFUNC(get_vara_double)(ncid_ref, vorticity_id_ref, start, count, vorticity_vals_ref);
     CHECK_EQUAL(0, success);
 
-    // Read variable pressure from output file
+    // Read cell variable pressure from output file
     double pressure_vals[size3];
     success = NCFUNC(get_vara_double)(ncid, pressure_id, start, count, pressure_vals);
     CHECK_EQUAL(0, success);
 
-    // Read variable pressure from reference file
+    // Read cell variable pressure from reference file
     double pressure_vals_ref[size3];
     success = NCFUNC(get_vara_double)(ncid_ref, pressure_id_ref, start, count, pressure_vals_ref);
     CHECK_EQUAL(0, success);
@@ -1007,7 +1008,7 @@ void test_gcrm_check_vars()
     for (int i = 0; i < size2; i++)
       CHECK_REAL_EQUAL(wind_vals_ref[i], wind_vals[i], eps);
 
-    // Check vorticity and pressuer values
+    // Check vorticity and pressure values
     for (int i = 0; i < size3; i++) {
       CHECK_REAL_EQUAL(vorticity_vals_ref[i], vorticity_vals[i], eps);
       CHECK_REAL_EQUAL(pressure_vals_ref[i], pressure_vals[i], eps);

diff --git a/test/parallel/scdpart.cpp b/test/parallel/scdpart.cpp
index 87bdab5..b673d8f 100644
--- a/test/parallel/scdpart.cpp
+++ b/test/parallel/scdpart.cpp
@@ -8,9 +8,9 @@
 using namespace moab;
 
 #ifdef MESHDIR
-static const char example[] = STRINGIFY(MESHDIR) "/io/eul26x48x96.t.3.nc";
+static const char example[] = STRINGIFY(MESHDIR) "/io/eul3x48x96.t.3.nc";
 #else
-static const char example[] = "/io/eul26x48x96.t.3.nc";
+static const char example[] = "/io/eul3x48x96.t.3.nc";
 #endif
 
 void test_read_parallel(int nverts);
@@ -18,6 +18,7 @@ void test_read_parallel_alljorkori();
 void test_read_parallel_alljkbal();
 void test_read_parallel_sqij();
 void test_read_parallel_sqjk();
+
 std::string partition_method;
 
 int main(int argc, char **argv)
@@ -34,7 +35,6 @@ int main(int argc, char **argv)
   return result;
 }
 
-
 void test_read_parallel_alljorkori() 
 {
   partition_method = std::string(";PARTITION_METHOD=alljorkori");
@@ -89,4 +89,3 @@ void test_read_parallel(int num_verts)
   
   if (0 == pcomm->proc_config().proc_rank()) CHECK_EQUAL(total_verts, num_verts);
 }
-

diff --git a/test/parallel/ucdtrvpart.cpp b/test/parallel/ucdtrvpart.cpp
index a67c519..cdd5e70 100644
--- a/test/parallel/ucdtrvpart.cpp
+++ b/test/parallel/ucdtrvpart.cpp
@@ -8,7 +8,7 @@
 using namespace moab;
 
 #ifdef MESHDIR
-static const char example[] = STRINGIFY(MESHDIR) "/io/homme26x3458.t.3.nc";
+static const char example[] = STRINGIFY(MESHDIR) "/io/homme3x3458.t.3.nc";
 #endif
 
 void test_read_parallel_ucd_trivial();
@@ -18,7 +18,7 @@ void test_read_parallel(int num_verts, bool test_nb_nodes);
 void test_multiple_loads_of_same_file();
 
 std::string partition_method;
-const int levels = 26;
+const int levels = 3;
 
 int main(int argc, char* argv[])
 {

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