[MOAB-dev] r5850 - MOAB/trunk/src/io

tautges at mcs.anl.gov tautges at mcs.anl.gov
Fri Nov 2 12:22:55 CDT 2012


Author: tautges
Date: 2012-11-02 12:22:55 -0500 (Fri, 02 Nov 2012)
New Revision: 5850

Modified:
   MOAB/trunk/src/io/ReadNC.cpp
Log:
Implement representation of spectral mesh with SPECTRAL_MESH option.  Tag
values not done correctly yet.

Passed make check, serial and parallel.



Modified: MOAB/trunk/src/io/ReadNC.cpp
===================================================================
--- MOAB/trunk/src/io/ReadNC.cpp	2012-11-02 03:55:37 UTC (rev 5849)
+++ MOAB/trunk/src/io/ReadNC.cpp	2012-11-02 17:22:55 UTC (rev 5850)
@@ -713,32 +713,54 @@
     // now create num_coarse_quads
   EntityHandle *conn_arr;
   EntityHandle start_vertex, start_quad;
-  int verts_per_quad = (spectral_mesh ? (spectralOrder+1)*(spectralOrder+1) : 4);
-  rval = readMeshIface->get_element_connect(num_coarse_quads, verts_per_quad,
+  rval = readMeshIface->get_element_connect(num_coarse_quads, 4,
                                             MBQUAD, 0, start_quad, conn_arr);
   ERRORR(rval, "Failed to create quads.");
+  
+  Range tmp_range;
+  tmp_range.insert(start_quad, start_quad + num_coarse_quads - 1);
 
     // read connectivity into that space
-  if (!spectral_mesh)
+  EntityHandle *sv_ptr = NULL;
+  if (!spectral_mesh) {
     std::copy(&tmp_conn[start_idx], &tmp_conn[start_idx+4*num_fine_quads], conn_arr);
+    std::copy(conn_arr, conn_arr+4*num_fine_quads, range_inserter(local_gid));
+  }
   else {
-    const unsigned int permute_array[] =
-        {0, 25, 34, 11, // corner nodes
-         1, 13, 26, 30, 22, 23, 8, 4, // edge nodes
-         15, 17, 18, 19 // interior nodes
-        };
-    int f = start_idx;
+      // permute_array takes a 36-long vector of integers, representing the connectivity of 3x3
+      // quads (fine quads in a coarse quad), and picks out the ids of the vertices necessary
+      // to get a lexicographically-ordered array of vertices in a 3rd-order spectral element
+    const unsigned int permute_array[] = 
+        {0, 1, 13, 25, 3, 2, 14, 26, 7, 6, 18, 30, 11, 10, 22, 34};
+      // lin_permute_array does the same to get the linear vertices of the coarse quad
+    const unsigned int lin_permute_array[] = {0, 25, 34, 11};
+    
+    int verts_per_quad = (spectralOrder+1)*(spectralOrder+1);
+    assert(verts_per_quad == (sizeof(permute_array)/sizeof(unsigned int)));
+    Tag sv_tag;
+      // create the SPECTRAL_VERTICES tag and get a ptr to the tag storage
+    rval = mbImpl->tag_get_handle("SPECTRAL_VERTICES", verts_per_quad, MB_TYPE_HANDLE, sv_tag,
+                                  MB_TAG_CREAT | MB_TAG_DENSE);
+    ERRORR(rval, "Failed to create SPECTRAL_VERTICES tag.");
+      // we're assuming here that quads was empty on input
+    int count;
+    rval = mbImpl->tag_iterate(sv_tag, tmp_range.begin(), tmp_range.end(), count, (void*&)sv_ptr);
+    ERRORR(rval, "Failed to get SPECTRAL_VERTICES ptr.");
+    assert(count == num_coarse_quads);


More information about the moab-dev mailing list