[MOAB-dev] r4892 - in MOAB/trunk: src src/moab src/parallel test tools

tautges at mcs.anl.gov tautges at mcs.anl.gov
Fri May 27 14:56:42 CDT 2011


Author: tautges
Date: 2011-05-27 14:56:42 -0500 (Fri, 27 May 2011)
New Revision: 4892

Modified:
   MOAB/trunk/src/ScdInterface.cpp
   MOAB/trunk/src/Skinner.cpp
   MOAB/trunk/src/moab/ScdInterface.hpp
   MOAB/trunk/src/moab/Skinner.hpp
   MOAB/trunk/src/parallel/ParallelComm.cpp
   MOAB/trunk/test/MBTest.cpp
   MOAB/trunk/test/scdseq_test.cpp
   MOAB/trunk/tools/skin.cpp
Log:
Enhance skinning to take advantage of structured mesh if there is any.  This will only be used
if the call to skinning requests it, it finds structured boxes that comprise all the elements whose
skin is being requested, and the caller does not pass in a reverse-oriented face range.

On one of the climate datasets I'm working with, for about 1.3M elements, this change takes skinning
from about 51 secs down to about 1.5 secs.  As with all structured mesh stuff in MOAB, this depends
heavily on compiling optimized.

Specific changes:
test/scdseq_test.cpp: testing ScdBox adjacency function
test/MBTest.cpp: testing structured mesh skinning
src/ScdInterface.cpp: added new get_adj_edge_or_face function to get edges/faces adjacent to hex/quad
   based on parametric value
src/Skinner.cpp: add functions for skinning based on structured mesh; doesn't work if you pass in
   a range ptr for reverse-oriented faces
src/parallel/ParallelComm.cpp: enable looking for scd mesh in call to skinner
tools/skin.cpp: add option to turn on using structured mesh in skinning; also fixed memory counter
   to use maxrss (idrss seems to always be zero...)

Passes make check in serial and parallel.



Modified: MOAB/trunk/src/ScdInterface.cpp
===================================================================
--- MOAB/trunk/src/ScdInterface.cpp	2011-05-27 18:00:18 UTC (rev 4891)
+++ MOAB/trunk/src/ScdInterface.cpp	2011-05-27 19:56:42 UTC (rev 4892)
@@ -366,4 +366,59 @@
   else return MB_NOT_IMPLEMENTED;
 }
     
+    //! Get the entity of specified dimension adjacent to parametric element
+    /**
+     * \param dim Dimension of adjacent entity being requested
+     * \param i Parametric coordinates of cell being evaluated
+     * \param j Parametric coordinates of cell being evaluated
+     * \param k Parametric coordinates of cell being evaluated
+     * \param dir Direction (0, 1, or 2), for getting adjacent edges (2d, 3d) or faces (3d) 
+     * \param ent EntityHandle of adjacent entity
+     * \param create_if_missing If true, creates the entity if it doesn't already exist
+     */
+ErrorCode ScdBox::get_adj_edge_or_face(int dim, int i, int j, int k, int dir, EntityHandle &ent,
+                                       bool create_if_missing) const 
+{
+    // describe connectivity of sub-element in static array
+    // subconnect[dim-1][dir][numv][ijk] where dimensions are:
+    // [dim-1]: dim=1 or 2, so this is 0 or 1
+    // [dir]: one of 0..2, for ijk directions in a hex
+    // [numv]: number of vertices describing sub entity = 2*dim <= 4
+    // [ijk]: 3 values for i, j, k
+  int subconnect[2][3][4][3] = {
+      {{{0, 0, 0}, {1, 0, 0}, {-1, -1, -1}, {-1, -1, -1}}, // i edge
+       {{0, 0, 0}, {0, 1, 0}, {-1, -1, -1}, {-1, -1, -1}}, // j edge
+       {{0, 0, 0}, {0, 0, 1}, {-1, -1, -1}, {-1, -1, -1}}}, // k edge
+
+      {{{0, 0, 0}, {0, 1, 0}, {0, 1, 1}, {0, 0, 1}}, // i face
+       {{0, 0, 0}, {1, 0, 0}, {1, 0, 1}, {0, 0, 1}}, // j face
+       {{0, 0, 0}, {1, 0, 0}, {1, 1, 0}, {0, 1, 0}}}}; // k face
+
+  if (i < boxDims[0] || i > boxDims[3] || j < boxDims[1] || j > boxDims[4] || k < boxDims[2] || k > boxDims[5])
+    return MB_FAILURE;
+  
+    // get the vertices making up this entity
+  EntityHandle verts[4];
+  for (int ind = 0; ind < 2*dim; ind++) {
+    verts[ind] = get_vertex(i+subconnect[dim-1][dir][ind][0],
+                            j+subconnect[dim-1][dir][ind][1],
+                            k+subconnect[dim-1][dir][ind][2]);
+    if (!verts[ind]) return MB_FAILURE;
+  }
+  
+  Range ents;
+  ErrorCode rval = scImpl->impl()->get_adjacencies(verts, 2*dim, dim, false, ents);
+  if (MB_SUCCESS != rval) return rval;


More information about the moab-dev mailing list