[cig-commits] r21178 - in short/3D/PyLith/trunk: libsrc/pylith/meshio unittests/libtests/meshio/data

knepley at geodynamics.org knepley at geodynamics.org
Wed Dec 19 06:28:58 PST 2012


Author: knepley
Date: 2012-12-19 06:28:58 -0800 (Wed, 19 Dec 2012)
New Revision: 21178

Modified:
   short/3D/PyLith/trunk/libsrc/pylith/meshio/DataWriterHDF5.cc
   short/3D/PyLith/trunk/unittests/libtests/meshio/data/DataWriterHDF5DataSubMeshHex8.cc
   short/3D/PyLith/trunk/unittests/libtests/meshio/data/DataWriterHDF5DataSubMeshLine2.cc
   short/3D/PyLith/trunk/unittests/libtests/meshio/data/DataWriterHDF5DataSubMeshQuad4.cc
   short/3D/PyLith/trunk/unittests/libtests/meshio/data/DataWriterHDF5DataSubMeshTet4.cc
   short/3D/PyLith/trunk/unittests/libtests/meshio/data/DataWriterHDF5DataSubMeshTri3.cc
Log:
Changed data for Submesh tests

Modified: short/3D/PyLith/trunk/libsrc/pylith/meshio/DataWriterHDF5.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/meshio/DataWriterHDF5.cc	2012-12-19 05:25:07 UTC (rev 21177)
+++ short/3D/PyLith/trunk/libsrc/pylith/meshio/DataWriterHDF5.cc	2012-12-19 14:28:58 UTC (rev 21178)
@@ -191,22 +191,27 @@
     err = PetscViewerHDF5PopGroup(_viewer); CHECK_PETSC_ERROR(err);
 #endif
 
-    PetscInt    *cones;
-    PetscSection coneSection;
-    PetscInt     cStart, cEnd, cMax, dof, conesSize, numCorners, numCornersLocal = 0;
+    PetscInt cStart, cEnd, cMax, dof, conesSize, numCorners, numCornersLocal = 0;
 
-    err = DMComplexGetConeSection(dmMesh, &coneSection);CHECK_PETSC_ERROR(err);
-    err = DMComplexGetCones(dmMesh, &cones);CHECK_PETSC_ERROR(err);
     err = DMComplexGetDepthStratum(dmMesh, 0, &vStart, &vEnd);CHECK_PETSC_ERROR(err);
     err = DMComplexGetHeightStratum(dmMesh, 0, &cStart, &cEnd);CHECK_PETSC_ERROR(err);
     err = DMComplexGetVTKBounds(dmMesh, &cMax, PETSC_NULL);CHECK_PETSC_ERROR(err);
     if (cMax >= 0) {cEnd = PetscMin(cEnd, cMax);}
     for(PetscInt cell = cStart; cell < cEnd; ++cell) {
-      err = DMComplexGetConeSize(dmMesh, cell, &numCornersLocal);CHECK_PETSC_ERROR(err);
+      PetscInt *closure = PETSC_NULL;
+      PetscInt  closureSize, v;
+
+      err = DMComplexGetTransitiveClosure(dmMesh, cell, PETSC_TRUE, &closureSize, &closure);CHECK_PETSC_ERROR(err);
+      numCornersLocal = 0;
+      for (v = 0; v < closureSize*2; v += 2) {
+        if ((closure[v] >= vStart) && (closure[v] < vEnd)) {
+          ++numCornersLocal;
+        }
+      }
+      err = DMComplexRestoreTransitiveClosure(dmMesh, cell, PETSC_TRUE, &closureSize, &closure);CHECK_PETSC_ERROR(err);
       if (numCornersLocal) break;
     }
     err = MPI_Allreduce(&numCornersLocal, &numCorners, 1, MPIU_INT, MPI_MAX, mesh.comm());CHECK_PETSC_ERROR(err);
-    err = PetscSectionGetOffset(coneSection, cEnd, &conesSize);CHECK_PETSC_ERROR(err);
     if (label) {
       conesSize = 0;
       for(PetscInt cell = cStart; cell < cEnd; ++cell) {
@@ -216,11 +221,20 @@
         if (value == labelId) ++conesSize;
       }
       conesSize *= numCorners;
+    } else {
+      conesSize = (cEnd - cStart)*numCorners;
     }
+    CHKMEMA;
 
-    PetscVec     cellVec;
-    PetscScalar *vertices;
+    IS              subpointMap, globalVertexNumbers;
+    const PetscInt *gvertex = PETSC_NULL, *gpoints = PETSC_NULL;
+    PetscVec        cellVec;
+    PetscScalar    *vertices;
 
+    err = DMComplexGetSubpointMap(dmMesh, &subpointMap);CHECK_PETSC_ERROR(err);
+    err = DMComplexGetVertexNumbering(dmMesh, &globalVertexNumbers);CHECK_PETSC_ERROR(err);
+    if (subpointMap) {err = ISGetIndices(subpointMap, &gpoints);CHECK_PETSC_ERROR(err);}
+    err = ISGetIndices(globalVertexNumbers, &gvertex);CHECK_PETSC_ERROR(err);
     err = VecCreate(mesh.comm(), &cellVec);CHECK_PETSC_ERROR(err);
     err = VecSetSizes(cellVec, conesSize, PETSC_DETERMINE);CHECK_PETSC_ERROR(err);
     err = VecSetBlockSize(cellVec, numCorners);CHECK_PETSC_ERROR(err);
@@ -228,16 +242,27 @@
     err = PetscObjectSetName((PetscObject) cellVec, "cells");CHECK_PETSC_ERROR(err);
     err = VecGetArray(cellVec, &vertices);CHECK_PETSC_ERROR(err);
     for(PetscInt cell = cStart, v = 0; cell < cEnd; ++cell) {
+      PetscInt *closure = PETSC_NULL;
+      PetscInt  closureSize, p;
+
       if (label) {
         PetscInt value;
 
         err = DMComplexGetLabelValue(dmMesh, label, cell, &value);CHECK_PETSC_ERROR(err);
         if (value != labelId) continue;
       }
-      for(PetscInt corner = 0; corner < numCorners; ++corner, ++v) {
-        vertices[v] = cones[cell*numCorners+corner] - vStart;
+      err = DMComplexGetTransitiveClosure(dmMesh, cell, PETSC_TRUE, &closureSize, &closure);CHECK_PETSC_ERROR(err);
+      for(p = 0; p < closureSize*2; p += 2) {
+        if ((closure[p] >= vStart) && (closure[p] < vEnd)) {
+          //const PetscInt gv = gpoints ? gpoints[closure[p]] : gvertex[closure[p] - vStart];
+          const PetscInt gv = gvertex[closure[p] - vStart];
+          vertices[v++] = gv < 0 ? -(gv+1) : gv;
+        }
       }
+      err = DMComplexRestoreTransitiveClosure(dmMesh, cell, PETSC_TRUE, &closureSize, &closure);CHECK_PETSC_ERROR(err);
+      //assert(v == (cell-cStart+1)*numCorners);
     }
+    CHKMEMA;
     err = VecRestoreArray(cellVec, &vertices);CHECK_PETSC_ERROR(err);
     err = PetscViewerHDF5PushGroup(_viewer, "/topology");CHECK_PETSC_ERROR(err);
     err = VecView(cellVec, _viewer);CHECK_PETSC_ERROR(err);
@@ -376,7 +401,7 @@
   try {
     const char* context = DataWriter<mesh_type, field_type>::_context.c_str();
 
-    field.createScatterWithBC(mesh, "", 0, context);
+    field.createScatterWithBC(field.mesh(), "", 0, context);
     field.scatterSectionToVector(context);
     PetscVec vector = field.vector(context);
     assert(vector);

Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/data/DataWriterHDF5DataSubMeshHex8.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/meshio/data/DataWriterHDF5DataSubMeshHex8.cc	2012-12-19 05:25:07 UTC (rev 21177)
+++ short/3D/PyLith/trunk/unittests/libtests/meshio/data/DataWriterHDF5DataSubMeshHex8.cc	2012-12-19 14:28:58 UTC (rev 21178)
@@ -43,7 +43,7 @@
 const char* pylith::meshio::DataWriterHDF5DataSubMeshHex8::_timeFormat = 
   "%3.1f";
 
-const int pylith::meshio::DataWriterHDF5DataSubMeshHex8::_numVertices = 12;
+const int pylith::meshio::DataWriterHDF5DataSubMeshHex8::_numVertices = 6;
 
 const pylith::meshio::DataWriterData::FieldStruct
 pylith::meshio::DataWriterHDF5DataSubMeshHex8::_vertexFields[4] = {
@@ -53,15 +53,16 @@
   { "other", topology::FieldBase::OTHER, 2 },
 };
 const PylithScalar pylith::meshio::DataWriterHDF5DataSubMeshHex8::_vertexFieldScalar[12*1] = {
-  2.1, 3.2, 4.3, 5.4, 6.5, 7.6, 8.7, 9.8, 10.9, 11.8, 12.7, 13.6
+  //2.1, 3.2, 4.3, 5.4, 6.5, 7.6, 8.7, 9.8, 10.9, 11.8, 12.7, 13.6
+  8.7, 9.8, 10.9, 11.8, 12.7, 13.6
 };
 const PylithScalar pylith::meshio::DataWriterHDF5DataSubMeshHex8::_vertexFieldVector[12*3] = {
-  1.1, 2.2, 3.3,
-  4.4, 5.5, 6.6,
-  7.7, 8.8, 9.9,
-  10.1, 11.2, 12.3,
-  1.2, 2.3, 3.4,
-  4.5, 5.6, 6.7,
+  //1.1, 2.2, 3.3,
+  //4.4, 5.5, 6.6,
+  //7.7, 8.8, 9.9,
+  //10.1, 11.2, 12.3,
+  //1.2, 2.3, 3.4,
+  //4.5, 5.6, 6.7,
   7.8, 8.9, 9.0,
   10.2, 11.3, 12.4,
   1.3, 2.4, 3.5,
@@ -70,12 +71,12 @@
   10.3, 11.4, 12.5,
 };
 const PylithScalar pylith::meshio::DataWriterHDF5DataSubMeshHex8::_vertexFieldTensor[12*6] = {
-  1.1, 1.2, 1.3, 1.4, 1.5, 1.6,
-  2.1, 2.2, 2.3, 2.4, 2.5, 2.6,
-  3.1, 3.2, 3.3, 3.4, 3.5, 3.6,
-  4.1, 4.2, 4.3, 4.4, 4.5, 4.6,
-  5.1, 5.2, 5.3, 5.4, 5.5, 5.6,
-  6.1, 6.2, 6.3, 6.4, 6.5, 6.6,
+  //1.1, 1.2, 1.3, 1.4, 1.5, 1.6,
+  //2.1, 2.2, 2.3, 2.4, 2.5, 2.6,
+  //3.1, 3.2, 3.3, 3.4, 3.5, 3.6,
+  //4.1, 4.2, 4.3, 4.4, 4.5, 4.6,
+  //5.1, 5.2, 5.3, 5.4, 5.5, 5.6,
+  //6.1, 6.2, 6.3, 6.4, 6.5, 6.6,
   7.1, 7.2, 7.3, 7.4, 7.5, 7.6,
   8.1, 8.2, 8.3, 8.4, 8.5, 8.6,
   9.1, 9.2, 9.3, 9.4, 9.5, 9.6,
@@ -84,12 +85,12 @@
   12.1, 12.2, 12.3, 12.4, 12.5, 12.6,
 };
 const PylithScalar pylith::meshio::DataWriterHDF5DataSubMeshHex8::_vertexFieldOther[12*2] = {
-  1.2, 2.3,
-  3.4, 4.5,
-  5.6, 6.7,
-  7.8, 8.9,
-  1.3, 2.4,
-  3.5, 4.6,
+  //1.2, 2.3,
+  //3.4, 4.5,
+  //5.6, 6.7,
+  //7.8, 8.9,
+  //1.3, 2.4,
+  //3.5, 4.6,
   5.7, 6.8,
   7.9, 8.0,
   8.1, 8.2,

Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/data/DataWriterHDF5DataSubMeshLine2.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/meshio/data/DataWriterHDF5DataSubMeshLine2.cc	2012-12-19 05:25:07 UTC (rev 21177)
+++ short/3D/PyLith/trunk/unittests/libtests/meshio/data/DataWriterHDF5DataSubMeshLine2.cc	2012-12-19 14:28:58 UTC (rev 21178)
@@ -44,7 +44,7 @@
 const char* pylith::meshio::DataWriterHDF5DataSubMeshLine2::_timeFormat = 
   "%3.1f";
 
-const int pylith::meshio::DataWriterHDF5DataSubMeshLine2::_numVertices = 5;
+const int pylith::meshio::DataWriterHDF5DataSubMeshLine2::_numVertices = 1;
 
 const pylith::meshio::DataWriterData::FieldStruct
 pylith::meshio::DataWriterHDF5DataSubMeshLine2::_vertexFields[4] = {

Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/data/DataWriterHDF5DataSubMeshQuad4.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/meshio/data/DataWriterHDF5DataSubMeshQuad4.cc	2012-12-19 05:25:07 UTC (rev 21177)
+++ short/3D/PyLith/trunk/unittests/libtests/meshio/data/DataWriterHDF5DataSubMeshQuad4.cc	2012-12-19 14:28:58 UTC (rev 21178)
@@ -40,7 +40,7 @@
 const char* pylith::meshio::DataWriterHDF5DataSubMeshQuad4::_timeFormat = 
   "%3.1f";
 
-const int pylith::meshio::DataWriterHDF5DataSubMeshQuad4::_numVertices = 6;
+const int pylith::meshio::DataWriterHDF5DataSubMeshQuad4::_numVertices = 3;
 
 const pylith::meshio::DataWriterData::FieldStruct
 pylith::meshio::DataWriterHDF5DataSubMeshQuad4::_vertexFields[4] = {
@@ -50,31 +50,32 @@
   { "other", topology::FieldBase::OTHER, 2 },
 };
 const PylithScalar pylith::meshio::DataWriterHDF5DataSubMeshQuad4::_vertexFieldScalar[6*1] = {
-  2.1, 3.2, 4.3, 5.4, 6.5, 7.6,
+  //2.1, 3.2, 4.3, 5.4, 6.5, 7.6,
+  2.1, 3.2, 6.5,
 };
 const PylithScalar pylith::meshio::DataWriterHDF5DataSubMeshQuad4::_vertexFieldVector[6*2] = {
   1.1, 2.2,
   3.3, 4.4,
-  5.5, 6.6,
-  7.7, 8.8,
+  //5.5, 6.6,
+  //7.7, 8.8,
   9.9, 10.0,
-  11.1, 12.2,
+  //11.1, 12.2,
 };
 const PylithScalar pylith::meshio::DataWriterHDF5DataSubMeshQuad4::_vertexFieldTensor[6*3] = {
   1.1, 1.2, 1.3,
   2.1, 2.2, 2.3,
-  3.1, 3.2, 3.3,
-  4.1, 4.2, 4.3,
+  //3.1, 3.2, 3.3,
+  //4.1, 4.2, 4.3,
   5.1, 5.2, 5.3,
-  6.1, 6.2, 6.3,
+  //6.1, 6.2, 6.3,
 };
 const PylithScalar pylith::meshio::DataWriterHDF5DataSubMeshQuad4::_vertexFieldOther[6*3] = {
   1.2, 2.3,
   3.4, 4.5,
-  5.6, 6.7,
-  7.8, 8.9,
+  //5.6, 6.7,
+  //7.8, 8.9,
   9.1, 10.2,
-  11.3, 12.4,
+  //11.3, 12.4,
 };
 
 const int pylith::meshio::DataWriterHDF5DataSubMeshQuad4::_numCells = 2;

Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/data/DataWriterHDF5DataSubMeshTet4.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/meshio/data/DataWriterHDF5DataSubMeshTet4.cc	2012-12-19 05:25:07 UTC (rev 21177)
+++ short/3D/PyLith/trunk/unittests/libtests/meshio/data/DataWriterHDF5DataSubMeshTet4.cc	2012-12-19 14:28:58 UTC (rev 21178)
@@ -43,7 +43,7 @@
 const char* pylith::meshio::DataWriterHDF5DataSubMeshTet4::_timeFormat = 
   "%3.1f";
 
-const int pylith::meshio::DataWriterHDF5DataSubMeshTet4::_numVertices = 5;
+const int pylith::meshio::DataWriterHDF5DataSubMeshTet4::_numVertices = 4;
 
 const pylith::meshio::DataWriterData::FieldStruct
 pylith::meshio::DataWriterHDF5DataSubMeshTet4::_vertexFields[4] = {
@@ -53,26 +53,27 @@
   { "other", topology::FieldBase::OTHER, 2 },
 };
 const PylithScalar pylith::meshio::DataWriterHDF5DataSubMeshTet4::_vertexFieldScalar[5*1] = {
-  2.1, 3.2, 4.3, 5.4, 6.5,
+  //2.1, 3.2, 4.3, 5.4, 6.5,
+  2.1, 3.2, 5.4, 6.5,
 };
 const PylithScalar pylith::meshio::DataWriterHDF5DataSubMeshTet4::_vertexFieldVector[5*3] = {
   1.1, 2.2, 3.3,
   4.4, 5.5, 6.6,
-  7.7, 8.8, 9.9,
+  //7.7, 8.8, 9.9,
   10.0, 11.1, 12.2,
   13.3, 14.4, 15.5,
 };
 const PylithScalar pylith::meshio::DataWriterHDF5DataSubMeshTet4::_vertexFieldTensor[5*6] = {
   1.1, 1.2, 1.3, 1.4, 1.5, 1.6,
   2.1, 2.2, 2.3, 2.4, 2.5, 2.6,
-  3.1, 3.2, 3.3, 3.4, 3.5, 3.6,
+  //3.1, 3.2, 3.3, 3.4, 3.5, 3.6,
   4.1, 4.2, 4.3, 4.4, 4.5, 4.6,
   5.1, 5.2, 5.3, 5.4, 5.5, 5.6,
 };
 const PylithScalar pylith::meshio::DataWriterHDF5DataSubMeshTet4::_vertexFieldOther[5*2] = {
   1.2, 2.3,
   3.4, 4.5,
-  5.6, 6.7,
+  //5.6, 6.7,
   7.8, 8.9,
   9.0, 10.1,
 };

Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/data/DataWriterHDF5DataSubMeshTri3.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/meshio/data/DataWriterHDF5DataSubMeshTri3.cc	2012-12-19 05:25:07 UTC (rev 21177)
+++ short/3D/PyLith/trunk/unittests/libtests/meshio/data/DataWriterHDF5DataSubMeshTri3.cc	2012-12-19 14:28:58 UTC (rev 21178)
@@ -44,7 +44,7 @@
 const char* pylith::meshio::DataWriterHDF5DataSubMeshTri3::_timeFormat = 
   "%3.1f";
 
-const int pylith::meshio::DataWriterHDF5DataSubMeshTri3::_numVertices = 8;
+const int pylith::meshio::DataWriterHDF5DataSubMeshTri3::_numVertices = 2;
 
 const pylith::meshio::DataWriterData::FieldStruct
 pylith::meshio::DataWriterHDF5DataSubMeshTri3::_vertexFields[] = {
@@ -54,37 +54,38 @@
   { "other", topology::FieldBase::OTHER, 2 },
 };
 const PylithScalar pylith::meshio::DataWriterHDF5DataSubMeshTri3::_vertexFieldScalar[8*1] = {
-  2.1, 3.2, 4.3, 5.4, 6.5, 7.6, 8.7, 9.8,
+  // 2.1, 3.2, 4.3, 5.4, 6.5, 7.6, 8.7, 9.8,
+  3.2, 5.4,
 };
 const PylithScalar pylith::meshio::DataWriterHDF5DataSubMeshTri3::_vertexFieldVector[8*2] = {
-  1.1, 2.2,
+  //1.1, 2.2,
   3.3, 4.4,
-  5.5, 6.6,
+  //5.5, 6.6,
   7.7, 8.8,
-  9.9, 10.0,
-  11.1, 12.2,
-  13.3, 14.4,
-  15.5, 16.6,
+  //9.9, 10.0,
+  //11.1, 12.2,
+  //13.3, 14.4,
+  //15.5, 16.6,
 };
 const PylithScalar pylith::meshio::DataWriterHDF5DataSubMeshTri3::_vertexFieldTensor[8*3] = {
-  1.1, 1.2, 1.3,
+  //1.1, 1.2, 1.3,
   2.1, 2.2, 2.3,
-  3.1, 3.2, 3.3,
+  //3.1, 3.2, 3.3,
   4.1, 4.2, 4.3,
-  5.1, 5.2, 5.3,
-  6.1, 6.2, 6.3,
-  7.1, 7.2, 7.3,
-  8.1, 8.2, 8.3,
+  //5.1, 5.2, 5.3,
+  //6.1, 6.2, 6.3,
+  //7.1, 7.2, 7.3,
+  //8.1, 8.2, 8.3,
 };
 const PylithScalar pylith::meshio::DataWriterHDF5DataSubMeshTri3::_vertexFieldOther[8*2] = {
-  1.2, 2.3,
+  //1.2, 2.3,
   3.4, 4.5,
-  5.6, 6.7,
+  //5.6, 6.7,
   7.8, 8.9,
-  9.0, 10.1,
-  11.2, 12.3,
-  13.4, 14.5,
-  15.6, 16.7,
+  //9.0, 10.1,
+  //11.2, 12.3,
+  //13.4, 14.5,
+  //15.6, 16.7,
 };
 
 const int pylith::meshio::DataWriterHDF5DataSubMeshTri3::_numCells = 1;



More information about the CIG-COMMITS mailing list