[MOAB-dev] commit/MOAB: 2 new changesets

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Tue Jul 23 13:49:18 CDT 2013


2 new commits in MOAB:

https://bitbucket.org/fathomteam/moab/commits/8b568e1ce64b/
Changeset:   8b568e1ce64b
Branch:      None
User:        danwu
Date:        2013-07-23 20:48:50
Summary:     Check some values of tag T0 in unit tests read_ucd_nc (serial) and ucdtrvpart (parallel) for HOMME. A bug inside NCHelper::convert_variable() (fixed by revision d018f20) would fail the parallel test ucdtrvpart.

Affected #:  2 files

diff --git a/test/io/read_ucd_nc.cpp b/test/io/read_ucd_nc.cpp
index 4678540..a468ad2 100644
--- a/test/io/read_ucd_nc.cpp
+++ b/test/io/read_ucd_nc.cpp
@@ -1,5 +1,6 @@
 #include "TestUtil.hpp"
 #include "moab/Core.hpp"
+#include "moab/Util.hpp"
 
 using namespace moab;
 
@@ -11,42 +12,44 @@ static const char example[] = "/io/homme26x3458.t.3.nc";
 
 #ifdef USE_MPI
 #include "moab_mpi.h"
+#include "moab/ParallelComm.hpp"
 #endif
 
-void read_file( Interface& moab, const char* input_file );
 void test_read_all();
 void test_read_onevar();
 void test_read_onetimestep();
 void test_read_nomesh();
 void test_read_novars();
-ErrorCode get_options(std::string &opts);
 
-int main(int argc, char *argv[])
+ErrorCode get_options(std::string& opts);
+
+int main(int argc, char* argv[])
 {
   int result = 0;
 
 #ifdef USE_MPI
   int fail = MPI_Init(&argc, &argv);
-  if (fail) return 1;
+  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_all);
   result += RUN_TEST(test_read_onevar);
   result += RUN_TEST(test_read_onetimestep);
   result += RUN_TEST(test_read_nomesh);
   result += RUN_TEST(test_read_novars);
-  
+
 #ifdef USE_MPI
   fail = MPI_Finalize();
-  if (fail) return 1;
+  if (fail)
+    return 1;
 #endif
-  
+
   return result;
 }
 
-
 void test_read_all()
 {
   Core moab;
@@ -55,15 +58,15 @@ void test_read_all()
   std::string opts;
   ErrorCode rval = get_options(opts);
   CHECK_ERR(rval);
-  
-  rval = mb.load_file( example, NULL, opts.c_str());
+
+  rval = mb.load_file(example, 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);
 }
@@ -77,16 +80,52 @@ void test_read_onevar()
   CHECK_ERR(rval);
 
   opts += std::string(";VARIABLE=T");
-  rval = mb.load_file( example, NULL, opts.c_str());
+  rval = mb.load_file(example, 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 procs = 1;
+#ifdef USE_MPI
+  ParallelComm* pcomm = ParallelComm::get_pcomm(&mb, 0);
+  procs = pcomm->proc_config().proc_size();
+#endif
+
+  // Make check runs this test in one processor
+  if (1 == procs) {
+    Range verts;
+    rval = mb.get_entities_by_type(0, MBVERTEX, verts);
+    CHECK_ERR(rval);
+    CHECK_EQUAL((size_t)6916, verts.size());
+
+    // Remove from vertices the gather set entities
+    EntityHandle gather_set;
+    Range gather_ents;
+    rval = Util::gather_set_entities(&mb, gather_set, gather_ents);
+    CHECK_ERR(rval);
+    verts = subtract(verts, gather_ents);
+    CHECK_EQUAL((size_t)3458, verts.size());
+
+    int count;
+    void* Tbuf;
+    rval = mb.tag_iterate(Ttag0, verts.begin(), verts.end(), count, Tbuf);
+    CHECK_ERR(rval);
+    CHECK_EQUAL((size_t)count, verts.size());
+
+    const double eps = 0.0001;
+    double* data = (double*) Tbuf;
+    CHECK_REAL_EQUAL(233.1136, data[0 * 26], eps); // First vert
+    CHECK_REAL_EQUAL(236.1505, data[1728 * 26], eps); // Median vert
+    CHECK_REAL_EQUAL(235.7722, data[1729 * 26], eps); // Median vert
+    CHECK_REAL_EQUAL(234.0416, data[3457 * 26], eps); // Last vert
+  }
 }
 
 void test_read_onetimestep()
@@ -98,14 +137,14 @@ void test_read_onetimestep()
   CHECK_ERR(rval);
 
   opts += std::string(";TIMESTEP=1");
-  rval = mb.load_file( example, NULL, opts.c_str() );
+  rval = mb.load_file(example, 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);
-  
+
   rval = mb.tag_get_handle("T1", 26, MB_TYPE_DOUBLE, Ttag1);
   CHECK_ERR(rval);
 }
@@ -115,33 +154,33 @@ void test_read_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);
-  
+
   std::string orig, opts;
   rval = get_options(orig);
   CHECK_ERR(rval);
 
   opts = orig + std::string(";TIMESTEP=0");
-  rval = mb.load_file( example, &set, opts.c_str() );
+  rval = mb.load_file(example, &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);
-  
+
   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(";TIMESTEP=1;NOMESH");
-  rval = mb.load_file( example, &set, opts.c_str() );
+  rval = mb.load_file(example, &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);
 }
@@ -151,7 +190,7 @@ void test_read_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);
@@ -161,20 +200,20 @@ void test_read_novars()
   CHECK_ERR(rval);
 
   opts = orig + std::string(";NOMESH;VARIABLE=");
-  rval = mb.load_file( example, &set, opts.c_str() );
+  rval = mb.load_file(example, &set, opts.c_str());
   CHECK_ERR(rval);
 
   opts = orig + std::string(";VARIABLE=;TIMESTEP=0");
-  rval = mb.load_file( example, &set, opts.c_str() );
+  rval = mb.load_file(example, &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);
 
   opts = orig + std::string(";VARIABLE=T;TIMESTEP=0;NOMESH");
-  rval = mb.load_file( example, &set, opts.c_str() );
+  rval = mb.load_file(example, &set, opts.c_str());
   CHECK_ERR(rval);
 
   rval = mb.tag_get_handle("T0", 26, MB_TYPE_DOUBLE, Ttag0);
@@ -183,20 +222,20 @@ void test_read_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(";TIMESTEP=1;NOMESH");
-  rval = mb.load_file( example, &set, opts.c_str() );
+  rval = mb.load_file(example, &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);
 }
 
-ErrorCode get_options(std::string &opts) 
+ErrorCode get_options(std::string& opts)
 {
 #ifdef USE_MPI
-    // use parallel options
+  // Use parallel options
   opts = std::string(";;PARALLEL=READ_PART;PARTITION_METHOD=TRIVIAL_PARTITION");
   return MB_SUCCESS;
 #else

diff --git a/test/parallel/ucdtrvpart.cpp b/test/parallel/ucdtrvpart.cpp
index 3f54e5f..abf52c5 100644
--- a/test/parallel/ucdtrvpart.cpp
+++ b/test/parallel/ucdtrvpart.cpp
@@ -19,7 +19,7 @@ void test_multiple_loads_of_same_file();
 
 std::string partition_method;
 
-int main(int argc, char **argv)
+int main(int argc, char* argv[])
 {
   MPI_Init(&argc, &argv);
   int result = 0;
@@ -32,12 +32,11 @@ int main(int argc, char **argv)
   return result;
 }
 
-
 void test_read_parallel_ucd_trivial()
 {
-  // disable spectral mesh for the time being, it is not ready yet
-  partition_method = std::string(";PARTITION_METHOD=TRIVIAL_PARTITION;PARALLEL_RESOLVE_SHARED_ENTS");
+  // Disable spectral mesh for the time being, it is not ready yet
   //partition_method = std::string(";PARTITION_METHOD=TRIVIAL_PARTITION;SPECTRAL_MESH;PARALLEL_RESOLVE_SHARED_ENTS");
+  partition_method = std::string(";PARTITION_METHOD=TRIVIAL_PARTITION;PARALLEL_RESOLVE_SHARED_ENTS");
   test_read_parallel(3458, true);
 }
   
@@ -56,8 +55,7 @@ void test_read_parallel(int num_verts, bool test_nb_nodes)
   rval = mb.create_meshset(MESHSET_SET, file_set);
   CHECK_ERR(rval);
 
-  std::string opt = std::string("PARALLEL=READ_PART") +
-      partition_method;
+  std::string opt = std::string("PARALLEL=READ_PART") + partition_method;
   rval = mb.load_file(example, &file_set, opt.c_str());
   CHECK_ERR(rval);
 
@@ -66,34 +64,35 @@ void test_read_parallel(int num_verts, bool test_nb_nodes)
   rval = pcomm->check_all_shared_handles();
   CHECK_ERR(rval);
 
-    // get the total # owned verts
+  // Get the total # owned verts
   Range verts;
   rval = mb.get_entities_by_type(0, MBVERTEX, verts);
   CHECK_ERR(rval);
   rval = pcomm->filter_pstatus(verts, PSTATUS_NOT_OWNED, PSTATUS_NOT);
   CHECK_ERR(rval);
-  int proc=pcomm->proc_config().proc_rank();
-  if (0==proc)
-  {
-    // remove from verts the gather set ents
+
+  int rank = pcomm->proc_config().proc_rank();
+  if (0 == rank) {
+    // Remove from verts the gather set ents
     EntityHandle gather_set;
     Range gth_ents;
     rval = Util::gather_set_entities(&mb, gather_set, gth_ents);
     CHECK_ERR(rval);
     verts = subtract(verts, gth_ents);
   }
+
   int my_num = verts.size(), total_verts;
-  std::cout<<"proc: " << pcomm->proc_config().proc_rank() << " verts:" << my_num << "\n";
+  std::cout << "proc: " << rank << " verts:" << my_num << "\n";
   MPI_Reduce(&my_num, &total_verts, 1, MPI_INTEGER, MPI_SUM, 0, pcomm->proc_config().proc_comm());
   
-  if (0 == pcomm->proc_config().proc_rank())
-  {
-    std::cout<<"total vertices: " << total_verts << "\n";
+  if (0 == rank) {
+    std::cout << "total vertices: " << total_verts << "\n";
     if (test_nb_nodes)
       CHECK_EQUAL(total_verts, num_verts);
   }
+
   std::string write_options("PARALLEL=WRITE_PART;");
-  mb.write_file( "test.h5m", NULL, write_options.c_str() );
+  mb.write_file("test.h5m", NULL, write_options.c_str());
 }
 
 void test_multiple_loads_of_same_file()
@@ -105,7 +104,7 @@ void test_multiple_loads_of_same_file()
   rval = mb.create_meshset(MESHSET_SET, file_set);
   CHECK_ERR(rval);
 
-  // read first only header information, no mesh, no variable
+  // Read first only header information, no mesh, no variable
   std::string opts("PARALLEL=READ_PART;PARTITION;NOMESH;VARIABLE=;PARTITION_METHOD=TRIVIAL_PARTITION");
   rval = mb.load_file(example, &file_set, opts.c_str());
   CHECK_ERR(rval);
@@ -114,8 +113,53 @@ void test_multiple_loads_of_same_file()
   rval = mb.load_file(example, &file_set, opts.c_str());
   CHECK_ERR(rval);
 
-
   opts = "PARALLEL=READ_PART;PARTITION;PARTITION_METHOD=TRIVIAL_PARTITION;NOMESH;VARIABLE=T;TIMESTEP=0";
   rval = mb.load_file(example, &file_set, opts.c_str());
   CHECK_ERR(rval);
+
+  // Check values of tag T0 (first level) at some strategically chosen places below
+  ParallelComm* pcomm = ParallelComm::get_pcomm(&mb, 0);
+  int procs = pcomm->proc_config().proc_size();
+
+  // Make check runs this test in two processors
+  if (2 == procs) {
+    Range verts;
+    rval = mb.get_entities_by_type(0, MBVERTEX, verts);
+    CHECK_ERR(rval);
+
+    int rank = pcomm->proc_config().proc_rank();
+    if (0 == rank) {
+      // Remove from verts the gather set ents
+      EntityHandle gather_set;
+      Range gth_ents;
+      rval = Util::gather_set_entities(&mb, gather_set, gth_ents);
+      CHECK_ERR(rval);
+      verts = subtract(verts, gth_ents);
+    }
+    CHECK_EQUAL((size_t)1825, verts.size());
+
+    Tag Ttag0;
+    rval = mb.tag_get_handle("T0", 26, MB_TYPE_DOUBLE, Ttag0, MB_TAG_DENSE);
+    CHECK_ERR(rval);
+
+    int count;
+    void* Tbuf;
+    rval = mb.tag_iterate(Ttag0, verts.begin(), verts.end(), count, Tbuf);
+    CHECK_ERR(rval);
+    CHECK_EQUAL((size_t)count, verts.size());
+
+    const double eps = 0.0001;
+    double* data = (double*) Tbuf;
+
+    if (0 == rank) {
+      CHECK_REAL_EQUAL(233.1136, data[0 * 26], eps); // First vert
+      CHECK_REAL_EQUAL(237.1977, data[912 * 26], eps); // Median vert
+      CHECK_REAL_EQUAL(234.9711, data[1824 * 26], eps); // Last vert
+    }
+    else if (1 == rank) {
+      CHECK_REAL_EQUAL(233.1136, data[0 * 26], eps); // First vert
+      CHECK_REAL_EQUAL(231.0446, data[912 * 26], eps); // Median vert
+      CHECK_REAL_EQUAL(234.0416, data[1824 * 26], eps); // Last vert
+    }
+  }
 }


https://bitbucket.org/fathomteam/moab/commits/6e69b9ab0187/
Changeset:   6e69b9ab0187
Branch:      master
User:        danwu
Date:        2013-07-23 20:49:01
Summary:     Merge branch 'master' of https://bitbucket.org/fathomteam/moab

Affected #:  6 files

diff --git a/src/io/ReadHDF5.cpp b/src/io/ReadHDF5.cpp
index 5e90822..916b69a 100644
--- a/src/io/ReadHDF5.cpp
+++ b/src/io/ReadHDF5.cpp
@@ -842,7 +842,7 @@ ErrorCode ReadHDF5::load_file_partial( const ReaderIface::IDTag* subset_list,
     dbgOut.printf( 2, "Partition with num_parts = %d and part_number = %d\n", 
                    num_parts, part_number );
   
-  dbgOut.tprint( 1, "RETREIVING TAGGED ENTITIES\n" );
+  dbgOut.tprint( 1, "RETRIEVING TAGGED ENTITIES\n" );
     
   Range file_ids;
   ErrorCode rval = get_subset_ids( subset_list, subset_list_length, file_ids );
@@ -964,7 +964,6 @@ ErrorCode ReadHDF5::load_file_partial( const ReaderIface::IDTag* subset_list,
     
     Range subset;
     intersect( fileInfo->elems[i].desc, file_ids, subset );
-  
     mpe_event.start( "reading connectivity for ", fileInfo->elems[i].handle );
     
       // If dimension is max_dim, then we can create the elements now
@@ -1544,7 +1543,8 @@ ErrorCode ReadHDF5::read_elems( const mhdf_ElemDesc& elems, const Range& file_id
 
   EntityHandle handle;
   EntityHandle* array = 0;
-  rval = readUtil->get_element_connect( count, nodes_per_elem, type,
+  if (count>0)
+    rval = readUtil->get_element_connect( count, nodes_per_elem, type,
                                         0, handle, array );
   if (MB_SUCCESS != rval)
     return error(rval);

diff --git a/test/parallel/par_intx_sph.cpp b/test/parallel/par_intx_sph.cpp
index dca936e..a6721a2 100644
--- a/test/parallel/par_intx_sph.cpp
+++ b/test/parallel/par_intx_sph.cpp
@@ -280,7 +280,7 @@ void test_intx_mpas()
   std::stringstream ss;
   ss<<"partial" << rank<<".vtk";
   mb.write_file(ss.str().c_str(), 0, 0, &covering_lagr_set, 1);
-  rval = enforce_convexity(&mb, covering_lagr_set);
+  rval = enforce_convexity(&mb, covering_lagr_set, rank);
   CHECK_ERR(rval);
   std::stringstream ss2;
   ss2<<"partialConvex" << rank<<".vtk";

diff --git a/tools/mbcslam/CslamUtils.cpp b/tools/mbcslam/CslamUtils.cpp
index 70d81ed..ad30c9d 100644
--- a/tools/mbcslam/CslamUtils.cpp
+++ b/tools/mbcslam/CslamUtils.cpp
@@ -864,7 +864,7 @@ void departure_point_case1(CartVect & arrival_point, double t, double delta_t, C
 // break the nonconvex quads into triangles; remove the quad from the set? yes.
 // maybe radius is not needed;
 //
-ErrorCode enforce_convexity(Interface * mb, EntityHandle lset)
+ErrorCode enforce_convexity(Interface * mb, EntityHandle lset, int my_rank)
 {
   // look at each quad; compute all 4 angles; if one is reflex, break along that diagonal
   // replace it with 2 triangles, and remove from set;
@@ -989,7 +989,7 @@ ErrorCode enforce_convexity(Interface * mb, EntityHandle lset)
       }
     }
   }
-  std::cout << brokenPolys << " concave polygons were decomposed in convex ones \n";
+  std::cout << "on rank " << my_rank << " " <<  brokenPolys << " concave polygons were decomposed in convex ones \n";
   return MB_SUCCESS;
 }
 ErrorCode create_span_quads(Interface * mb, EntityHandle euler_set, int rank)

diff --git a/tools/mbcslam/CslamUtils.hpp b/tools/mbcslam/CslamUtils.hpp
index 241fe84..e039d96 100644
--- a/tools/mbcslam/CslamUtils.hpp
+++ b/tools/mbcslam/CslamUtils.hpp
@@ -129,7 +129,7 @@ void departure_point_case1(CartVect & arrival_point, double t, double delta_t, C
 // break the nonconvex quads into triangles; remove the quad from the set? yes.
 // maybe radius is not needed;
 //
-ErrorCode enforce_convexity(Interface * mb, EntityHandle set);
+ErrorCode enforce_convexity(Interface * mb, EntityHandle set, int rank = 0);
 
 // looking at DP tag, create the spanning quads, write a file (with rank) and
 // then delete the new entities (vertices) and the set of quads

diff --git a/tools/mbcslam/Intx2Mesh.cpp b/tools/mbcslam/Intx2Mesh.cpp
index fadbaa3..6ddadfb 100644
--- a/tools/mbcslam/Intx2Mesh.cpp
+++ b/tools/mbcslam/Intx2Mesh.cpp
@@ -1268,8 +1268,10 @@ ErrorCode Intx2Mesh::create_departure_mesh_2nd_alg(EntityHandle & euler_set, Ent
       globalID_to_handle[globalId]= new_vert;
     }
   }
-      // now, all dep points should be at their place
-      // look in the local list of q for this proc, and create all those quads and vertices if needed
+
+  // now, all dep points should be at their place
+  // look in the local list of q for this proc, and create all those quads and vertices if needed
+  // it may be an overkill, but because it does not involve communication, we do it anyway
   Range & local=Rto[my_rank];
   Range local_q = local.subset_by_dimension(2);
   // the local should have all the vertices in local_verts

diff --git a/tools/mbcslam/intx_mpas.cpp b/tools/mbcslam/intx_mpas.cpp
index 827871b..679bd03 100644
--- a/tools/mbcslam/intx_mpas.cpp
+++ b/tools/mbcslam/intx_mpas.cpp
@@ -39,9 +39,9 @@ using namespace moab;
 // some input data
 double gtol = 1.e-9; // this is for geometry tolerance
 
-// radius is always 1?
-//double CubeSide = 6.; // the above file starts with cube side 6; radius depends on cube side
-double t = 0.1, delta_t = 0.1; // check the script
+double radius = 1.;// in m:  6371220.
+
+double t = 0.1, delta_t = 0.05; // check the script
 
 ErrorCode manufacture_lagrange_mesh_on_sphere(Interface * mb,
     EntityHandle euler_set)
@@ -50,10 +50,9 @@ ErrorCode manufacture_lagrange_mesh_on_sphere(Interface * mb,
 
   /*
    * get all plys first, then vertices, then move them on the surface of the sphere
-   *  radius is 1., always
+   *  radius is 1., most of the time
    *
    */
-  double radius = 1.;
   Range polygons;
   rval = mb->get_entities_by_dimension(euler_set, 2, polygons);
   if (MB_SUCCESS != rval)
@@ -82,8 +81,8 @@ ErrorCode manufacture_lagrange_mesh_on_sphere(Interface * mb,
 
   // now put the vertices in the right place....
   //int vix=0; // vertex index in new array
-  double t=0.1, T=5;// check the script
-  double time =0.05;
+  double T=5;// check the script
+
   double rot= M_PI/10;
   for (Range::iterator vit=connecVerts.begin();vit!=connecVerts.end(); vit++ )
   {
@@ -95,12 +94,12 @@ ErrorCode manufacture_lagrange_mesh_on_sphere(Interface * mb,
     SphereCoords sphCoord = cart_to_spherical(posi);
     double lat1 = sphCoord.lat-2*M_PI*t/T; // 0.1/5
     double uu = 3*radius/ T * pow(sin(lat1), 2)*sin(2*sphCoord.lon)*cos(M_PI*t/T);
-    uu+=2*M_PI*cos(sphCoord.lon)/T;
+    uu+=2*radius*M_PI*cos(sphCoord.lon)/T;
     double vv = 3*radius/T*(sin(2*lat1))*cos(sphCoord.lon)*cos(M_PI*t/T);
     double vx = -uu*sin(sphCoord.lon)-vv*sin(sphCoord.lat)*cos(sphCoord.lon);
     double vy = -uu*cos(sphCoord.lon)-vv*sin(sphCoord.lat)*sin(sphCoord.lon);
     double vz = vv*cos(sphCoord.lat);
-    posi = posi + time * CartVect(vx, vy, vz);
+    posi = posi + delta_t * CartVect(vx, vy, vz);
     double x2= posi[0]*cos(rot)-posi[1]*sin(rot);
     double y2= posi[0]*sin(rot) + posi[1]*cos(rot);
     CartVect newPos(x2, y2, posi[2]);
@@ -120,6 +119,7 @@ int main(int argc, char **argv)
 
   MPI_Init(&argc, &argv);
 
+  std::string extra_read_opts;
   std::string fileN= TestDir + "/mpas_p8.h5m";
   const char *filename_mesh1 = fileN.c_str();
   if (argc > 1)
@@ -139,12 +139,21 @@ int main(int argc, char **argv)
       {
         filename_mesh1 = argv[++index];
       }
+      if (!strcmp(argv[index], "-R"))
+      {
+        radius = atof(argv[++index]);
+      }
+      if (!strcmp(argv[index], "-O"))
+      {
+        extra_read_opts = std::string(argv[++index]);
+      }
+
       index++;
     }
   }
   // start copy
   std::string opts = std::string("PARALLEL=READ_PART;PARTITION=PARALLEL_PARTITION")+
-            std::string(";PARALLEL_RESOLVE_SHARED_ENTS");
+            std::string(";PARALLEL_RESOLVE_SHARED_ENTS")+extra_read_opts;
   Core moab;
   Interface & mb = moab;
   EntityHandle euler_set;
@@ -165,7 +174,7 @@ int main(int argc, char **argv)
 
   if (0==rank)
     std::cout << " case 1: use -gtol " << gtol << " -dt " << delta_t <<
-        " -input " << filename_mesh1 << "\n";
+        " -R " << radius << " -input " << filename_mesh1 << "\n";
 
   rval = manufacture_lagrange_mesh_on_sphere(&mb, euler_set);
   if (MB_SUCCESS != rval)
@@ -181,7 +190,7 @@ int main(int argc, char **argv)
   CHECK_ERR(rval);
   Intx2MeshOnSphere worker(&mb);
 
-  double radius = 1.; // input
+  //double radius = 1.; // input
 
   worker.SetRadius(radius);
 
@@ -189,7 +198,11 @@ int main(int argc, char **argv)
   rval = worker.create_departure_mesh_2nd_alg(euler_set, covering_lagr_set);
   CHECK_ERR(rval);
 
-  rval = enforce_convexity(&mb, covering_lagr_set);
+  std::stringstream lagrIni;
+  lagrIni<<"def0" << rank<<".h5m";
+  rval = mb.write_file(lagrIni.str().c_str(), 0, 0, &covering_lagr_set, 1);
+
+  rval = enforce_convexity(&mb, covering_lagr_set, rank);
   if (MB_SUCCESS != rval)
     return 1;

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