[cig-commits] r20524 - in short/3D/PyLith/trunk/libsrc/pylith: faults meshio topology

knepley at geodynamics.org knepley at geodynamics.org
Sun Jul 15 06:59:46 PDT 2012


Author: knepley
Date: 2012-07-15 06:59:46 -0700 (Sun, 15 Jul 2012)
New Revision: 20524

Modified:
   short/3D/PyLith/trunk/libsrc/pylith/faults/CohesiveTopology.cc
   short/3D/PyLith/trunk/libsrc/pylith/meshio/DataWriterVTK.cc
   short/3D/PyLith/trunk/libsrc/pylith/topology/Field.cc
   short/3D/PyLith/trunk/libsrc/pylith/topology/Mesh.cc
   short/3D/PyLith/trunk/libsrc/pylith/topology/Mesh.hh
   short/3D/PyLith/trunk/libsrc/pylith/topology/Mesh.icc
   short/3D/PyLith/trunk/libsrc/pylith/topology/SubMesh.cc
   short/3D/PyLith/trunk/libsrc/pylith/topology/SubMesh.hh
   short/3D/PyLith/trunk/libsrc/pylith/topology/SubMesh.icc
Log:
Passing most of the meshio tests with DMComplex

Modified: short/3D/PyLith/trunk/libsrc/pylith/faults/CohesiveTopology.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/faults/CohesiveTopology.cc	2012-07-15 00:50:49 UTC (rev 20523)
+++ short/3D/PyLith/trunk/libsrc/pylith/faults/CohesiveTopology.cc	2012-07-15 13:59:46 UTC (rev 20524)
@@ -229,11 +229,19 @@
   PetscInt firstFaultVertexDM, firstLagrangeVertexDM, firstFaultCellDM, extraVertices, extraCells;
 #ifdef USE_DMCOMPLEX_ON
   /* TODO This will have to change for multiple faults */
+  PetscInt numNormalCells, numCohesiveCells, numNormalVertices, numShadowVertices, numLagrangeVertices;
+
   extraVertices         = firstFaultCell; /* Total number of fault vertices (shadow + Lagrange) */
   extraCells            = numFaultFaces;  /* Total number of fault cells */
   firstFaultVertexDM    = vEnd + extraCells;
   firstLagrangeVertexDM = firstFaultVertexDM + firstLagrangeVertex;
   firstFaultCellDM      = cEnd;
+  mesh->getPointTypeSizes(&numNormalCells, &numCohesiveCells, &numNormalVertices, &numShadowVertices, &numLagrangeVertices);
+  if (!numNormalCells) {
+    mesh->setPointTypeSizes(cEnd-cStart, extraCells, vEnd-vStart, firstLagrangeVertex, firstLagrangeVertex);
+  } else {
+    mesh->setPointTypeSizes(numNormalCells, numCohesiveCells+extraCells, numNormalVertices, numShadowVertices+firstLagrangeVertex, numLagrangeVertices+firstLagrangeVertex);
+  }
 #endif
   if (firstFaultVertex == 0) {
     firstFaultVertex    += sieve->getBaseSize() + sieve->getCapSize();
@@ -280,6 +288,13 @@
     err = DMComplexSetCone(newMesh, c, newCone);CHECK_PETSC_ERROR(err);
   }
   err = PetscFree(newCone);CHECK_PETSC_ERROR(err);
+  PetscInt cMax, vMax;
+
+  err = DMComplexGetVTKBounds(newMesh, &cMax, &vMax);CHECK_PETSC_ERROR(err);
+  if (cMax < 0) {
+    err = DMComplexSetVTKBounds(newMesh, firstFaultCellDM, PETSC_DETERMINE);CHECK_PETSC_ERROR(err);
+  }
+  err = DMComplexSetVTKBounds(newMesh, PETSC_DETERMINE, firstLagrangeVertexDM);CHECK_PETSC_ERROR(err);
 #endif
 
   // Add fault vertices to groups and construct renumberings
@@ -537,33 +552,37 @@
       } // if/else
     } // for
     sV.clear();
+  }
 #ifdef USE_DMCOMPLEX_ON
-    /* DMComplex */
-    const PetscInt *supportDM;
-    PetscInt        supportSize;
-    err = DMComplexGetSupport(complexMesh, *v_iter, &supportDM);CHECK_PETSC_ERROR(err);
-    err = DMComplexGetSupportSize(complexMesh, *v_iter, &supportSize);CHECK_PETSC_ERROR(err);
+  for(PetscInt cell = cStart; cell < cEnd; ++cell) {
+    const PetscInt *cone;
+    PetscInt        coneSize;
 
-    for(PetscInt s = 0; s < supportSize; ++s) {
-      if (replaceCells.find(supportDM[s]) != replaceCells.end()) {
-        const PetscInt *cone;
-        PetscInt        coneSize;
+    err = DMComplexGetCone(complexMesh, cell, &cone);CHECK_PETSC_ERROR(err);
+    err = DMComplexGetConeSize(complexMesh, cell, &coneSize);CHECK_PETSC_ERROR(err);
+    if (replaceCells.find(cell) != replaceCells.end()) {
+      for(PetscInt c = 0; c < coneSize; ++c) {
+        PetscBool replaced = PETSC_FALSE;
 
-        err = DMComplexGetCone(complexMesh, support[s], &cone);CHECK_PETSC_ERROR(err);
-        err = DMComplexGetConeSize(complexMesh, support[s], &coneSize);CHECK_PETSC_ERROR(err);
-        for(PetscInt c = 0; c < coneSize; ++c) {
+        for(TopologyOps::PointSet::const_iterator v_iter = replaceVertices.begin(); v_iter != rVerticesEnd; ++v_iter) {
           if (cone[c] == *v_iter) {
             cohesiveCone[c] = vertexRenumberDM[cone[c]];
-          } else {
-            /* TODO This will have to change for multiple faults */
-            cohesiveCone[c] = cone[c] + extraCells;
+            replaced        = PETSC_TRUE;
+            break;
           }
         }
-        err = DMComplexSetCone(newMesh, support[s], cohesiveCone);CHECK_PETSC_ERROR(err);
+        if (!replaced) {
+          cohesiveCone[c] = cone[c] + extraCells;
+        }
       }
+    } else {
+      for(PetscInt c = 0; c < coneSize; ++c) {
+        cohesiveCone[c] = cone[c] + extraCells;
+      }
     }
+    err = DMComplexSetCone(newMesh, cell, cohesiveCone);CHECK_PETSC_ERROR(err);
+  }
 #endif
-  }
   err = PetscFree3(origVerticesDM, faceVerticesDM, cohesiveCone);CHECK_PETSC_ERROR(err);
   sieve->reallocate();
 #ifdef USE_DMCOMPLEX_ON
@@ -788,6 +807,9 @@
   if (debug) coordinates->view("Coordinates with shadow vertices");
 
   logger.stagePop();
+
+  err = DMDestroy(&complexMesh);CHECK_PETSC_ERROR(err);
+  mesh->setDMMesh(newMesh);
 } // create
 
 // ----------------------------------------------------------------------

Modified: short/3D/PyLith/trunk/libsrc/pylith/meshio/DataWriterVTK.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/meshio/DataWriterVTK.cc	2012-07-15 00:50:49 UTC (rev 20523)
+++ short/3D/PyLith/trunk/libsrc/pylith/meshio/DataWriterVTK.cc	2012-07-15 13:59:46 UTC (rev 20524)
@@ -119,7 +119,7 @@
     const std::string& filename = _vtkFilename(t);
     DM complexMesh = mesh.dmMesh();
 
-    if (complexMesh && 0) {
+    if (complexMesh) {
       /* DMComplex */
       err = PetscViewerCreate(mesh.comm(), &_viewer);CHECK_PETSC_ERROR(err);
       err = PetscViewerSetType(_viewer, PETSCVIEWERVTK);CHECK_PETSC_ERROR(err);
@@ -198,15 +198,15 @@
   try {
     DM complexMesh = mesh.dmMesh();
 
-    if (complexMesh && 0) {
+    if (complexMesh) {
       /* DMComplex */
       PetscContainer c;
-      PetscSection s;
-      Vec v;
+      PetscSection   s;
+      Vec            v;
 
       field.dmSection(&s, &v);
 
-      /* Will change to just VecView() once I setup the vectors correctly (use VecSetOperation() to change the view) */
+      /* Will change to just VecView() once I setup the vectors correctly (use VecSetOperation() to change the view method) */
       PetscViewerVTKFieldType ft = field.vectorFieldType() != topology::FieldBase::VECTOR ? PETSC_VTK_POINT_FIELD : PETSC_VTK_POINT_VECTOR_FIELD;
       PetscErrorCode err = PetscViewerVTKAddField(_viewer, (PetscObject) complexMesh, DMComplexVTKWriteAll, ft, (PetscObject) v);CHECK_PETSC_ERROR(err);
       err = PetscObjectReference((PetscObject) v);CHECK_PETSC_ERROR(err); /* Needed because viewer destroys the Vec */
@@ -286,7 +286,7 @@
   try {
     DM complexMesh = field.mesh().dmMesh();
 
-    if (complexMesh && 0) {
+    if (complexMesh) {
       /* DMComplex */
       PetscContainer c;
       PetscSection s;

Modified: short/3D/PyLith/trunk/libsrc/pylith/topology/Field.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/topology/Field.cc	2012-07-15 00:50:49 UTC (rev 20523)
+++ short/3D/PyLith/trunk/libsrc/pylith/topology/Field.cc	2012-07-15 13:59:46 UTC (rev 20524)
@@ -404,10 +404,125 @@
 template<typename mesh_type, typename section_type>
 void
 pylith::topology::Field<mesh_type, section_type>::dmSection(PetscSection *s, Vec *v) const {
+  PetscSection   section;
   PetscInt       size;
+  PetscInt       numNormalCells, numCohesiveCells, numNormalVertices, numShadowVertices, numLagrangeVertices;
   PetscErrorCode err;
 
-  err = DMMeshConvertSection(_mesh.sieveMesh(), _section, s);CHECK_PETSC_ERROR(err);
+  err = DMMeshConvertSection(_mesh.sieveMesh(), _section, &section);CHECK_PETSC_ERROR(err);
+  _mesh.getPointTypeSizes(&numNormalCells, &numCohesiveCells, &numNormalVertices, &numShadowVertices, &numLagrangeVertices);
+  if (numNormalCells+numCohesiveCells+numNormalVertices+numShadowVertices+numLagrangeVertices > 0) {
+    PetscInt numFields, numComp, pMax, pStart, pEnd, qStart, qEnd;
+
+    err = DMComplexGetChart(_mesh.dmMesh(), PETSC_NULL, &pMax);CHECK_PETSC_ERROR(err);
+    err = PetscSectionCreate(_mesh.sieveMesh()->comm(), s);CHECK_PETSC_ERROR(err);
+    err = PetscSectionGetNumFields(section, &numFields);CHECK_PETSC_ERROR(err);
+    if (numFields) {
+      err = PetscSectionSetNumFields(*s, numFields);CHECK_PETSC_ERROR(err);
+      for(PetscInt f = 0; f < numFields; ++f) {
+        err = PetscSectionGetFieldComponents(section, f, &numComp);CHECK_PETSC_ERROR(err);
+        err = PetscSectionSetFieldComponents(*s, f, numComp);CHECK_PETSC_ERROR(err);
+      }
+    }
+    err = PetscSectionGetChart(section, &pStart, &pEnd);CHECK_PETSC_ERROR(err);
+    if (pStart > 0) {
+      qStart = pStart + numCohesiveCells;
+    } else {
+      qStart = pStart;
+    }
+    qEnd = PetscMin(pEnd + numCohesiveCells, pMax);
+    err = PetscSectionSetChart(*s, qStart, qEnd);CHECK_PETSC_ERROR(err);
+#if 0
+    if (pEnd - pStart != (numNormalCells + numCohesiveCells + numNormalVertices + numShadowVertices + numLagrangeVertices)) {
+      PetscPrintf(PETSC_COMM_SELF, "numCells %d != totCells %d\n", pEnd - pStart, numNormalCells + numCohesiveCells + numNormalVertices + numShadowVertices + numLagrangeVertices);
+      CHECK_PETSC_ERROR(PETSC_ERR_ARG_SIZ);
+    }
+#endif
+    /* The old-style point numbering: [normalCells, normalVertices, shadowVertices, lagrangeVertices, cohesiveCells]
+       The new-style point numbering: [normalCells, cohesiveCells, normalVertices, shadowVertices, lagrangeVertices] */
+    for(PetscInt p = pStart; p < numNormalCells; ++p) {
+      PetscInt dof, fdof, cdof, cfdof, q = p;
+
+      err = PetscSectionGetDof(section, p, &dof);CHECK_PETSC_ERROR(err);
+      err = PetscSectionSetDof(*s, q, dof);CHECK_PETSC_ERROR(err);
+      for(PetscInt f = 0; f < numFields; ++f) {
+        err = PetscSectionGetFieldDof(section, p, f, &fdof);CHECK_PETSC_ERROR(err);
+        err = PetscSectionSetFieldDof(*s, q, f, fdof);CHECK_PETSC_ERROR(err);
+      }
+      err = PetscSectionGetConstraintDof(section, p, &cdof);CHECK_PETSC_ERROR(err);
+      err = PetscSectionSetConstraintDof(*s, q, cdof);CHECK_PETSC_ERROR(err);
+      for(PetscInt f = 0; f < numFields; ++f) {
+        err = PetscSectionGetFieldConstraintDof(section, p, f, &cfdof);CHECK_PETSC_ERROR(err);
+        err = PetscSectionSetFieldConstraintDof(*s, q, f, cfdof);CHECK_PETSC_ERROR(err);
+      }
+    }
+    for(PetscInt p = PetscMax(pStart, numNormalCells); p < PetscMin(pEnd, numNormalCells+numNormalVertices+numShadowVertices+numLagrangeVertices); ++p) {
+      PetscInt dof, fdof, cdof, cfdof, q = p + numCohesiveCells;
+
+      err = PetscSectionGetDof(section, p, &dof);CHECK_PETSC_ERROR(err);
+      err = PetscSectionSetDof(*s, q, dof);CHECK_PETSC_ERROR(err);
+      for(PetscInt f = 0; f < numFields; ++f) {
+        err = PetscSectionGetFieldDof(section, p, f, &fdof);CHECK_PETSC_ERROR(err);
+        err = PetscSectionSetFieldDof(*s, q, f, fdof);CHECK_PETSC_ERROR(err);
+      }
+      err = PetscSectionGetConstraintDof(section, p, &cdof);CHECK_PETSC_ERROR(err);
+      err = PetscSectionSetConstraintDof(*s, q, cdof);CHECK_PETSC_ERROR(err);
+      for(PetscInt f = 0; f < numFields; ++f) {
+        err = PetscSectionGetFieldConstraintDof(section, p, f, &cfdof);CHECK_PETSC_ERROR(err);
+        err = PetscSectionSetFieldConstraintDof(*s, q, f, cfdof);CHECK_PETSC_ERROR(err);
+      }
+    }
+    for(PetscInt p = PetscMax(pStart, numNormalCells+numNormalVertices+numShadowVertices+numLagrangeVertices); p < pEnd; ++p) {
+      PetscInt dof, fdof, cdof, cfdof, q = p - (numNormalVertices+numShadowVertices+numLagrangeVertices);
+
+      err = PetscSectionGetDof(section, p, &dof);CHECK_PETSC_ERROR(err);
+      err = PetscSectionSetDof(*s, q, dof);CHECK_PETSC_ERROR(err);
+      for(PetscInt f = 0; f < numFields; ++f) {
+        err = PetscSectionGetFieldDof(section, p, f, &fdof);CHECK_PETSC_ERROR(err);
+        err = PetscSectionSetFieldDof(*s, q, f, fdof);CHECK_PETSC_ERROR(err);
+      }
+      err = PetscSectionGetConstraintDof(section, p, &cdof);CHECK_PETSC_ERROR(err);
+      err = PetscSectionSetConstraintDof(*s, q, cdof);CHECK_PETSC_ERROR(err);
+      for(PetscInt f = 0; f < numFields; ++f) {
+        err = PetscSectionGetFieldConstraintDof(section, p, f, &cfdof);CHECK_PETSC_ERROR(err);
+        err = PetscSectionSetFieldConstraintDof(*s, q, f, cfdof);CHECK_PETSC_ERROR(err);
+      }
+    }
+    err = PetscSectionSetUp(*s);CHECK_PETSC_ERROR(err);
+    for(PetscInt p = pStart; p < pStart+numNormalCells; ++p) {
+      PetscInt *cind, *cfind, q = p;
+
+      err = PetscSectionGetConstraintIndices(section, p, &cind);CHECK_PETSC_ERROR(err);
+      err = PetscSectionSetConstraintIndices(*s, q, cind);CHECK_PETSC_ERROR(err);
+      for(PetscInt f = 0; f < numFields; ++f) {
+        err = PetscSectionGetFieldConstraintIndices(section, p, f, &cfind);CHECK_PETSC_ERROR(err);
+        err = PetscSectionSetFieldConstraintIndices(*s, q, f, cfind);CHECK_PETSC_ERROR(err);
+      }
+    }
+    for(PetscInt p = pStart+numNormalCells; p < pStart+numNormalCells+numNormalVertices+numShadowVertices+numLagrangeVertices; ++p) {
+      PetscInt *cind, *cfind, q = p + numCohesiveCells;
+
+      err = PetscSectionGetConstraintIndices(section, p, &cind);CHECK_PETSC_ERROR(err);
+      err = PetscSectionSetConstraintIndices(*s, q, cind);CHECK_PETSC_ERROR(err);
+      for(PetscInt f = 0; f < numFields; ++f) {
+        err = PetscSectionGetFieldConstraintIndices(section, p, f, &cfind);CHECK_PETSC_ERROR(err);
+        err = PetscSectionSetFieldConstraintIndices(*s, q, f, cfind);CHECK_PETSC_ERROR(err);
+      }
+    }
+    for(PetscInt p = pStart+numNormalCells+numNormalVertices+numShadowVertices+numLagrangeVertices; p < pEnd; ++p) {
+      PetscInt *cind, *cfind, q = p - (numNormalVertices+numShadowVertices+numLagrangeVertices);
+
+      err = PetscSectionGetConstraintIndices(section, p, &cind);CHECK_PETSC_ERROR(err);
+      err = PetscSectionSetConstraintIndices(*s, q, cind);CHECK_PETSC_ERROR(err);
+      for(PetscInt f = 0; f < numFields; ++f) {
+        err = PetscSectionGetFieldConstraintIndices(section, p, f, &cfind);CHECK_PETSC_ERROR(err);
+        err = PetscSectionSetFieldConstraintIndices(*s, q, f, cfind);CHECK_PETSC_ERROR(err);
+      }
+    }
+    err = PetscSectionDestroy(&section);CHECK_PETSC_ERROR(err);
+  } else {
+    *s = section;
+  }
   err = PetscSectionGetStorageSize(*s, &size);CHECK_PETSC_ERROR(err);
   err = VecCreateMPIWithArray(_section->comm(), 1, size, PETSC_DETERMINE, _section->restrictSpace(), v);CHECK_PETSC_ERROR(err);
   err = PetscObjectSetName((PetscObject) *v, _section->getName().c_str());CHECK_PETSC_ERROR(err);

Modified: short/3D/PyLith/trunk/libsrc/pylith/topology/Mesh.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/topology/Mesh.cc	2012-07-15 00:50:49 UTC (rev 20523)
+++ short/3D/PyLith/trunk/libsrc/pylith/topology/Mesh.cc	2012-07-15 13:59:46 UTC (rev 20524)
@@ -34,6 +34,7 @@
 // Default constructor
 pylith::topology::Mesh::Mesh(void) :
   _newMesh(PETSC_NULL),
+  _numNormalCells(0), _numCohesiveCells(0), _numNormalVertices(0), _numShadowVertices(0), _numLagrangeVertices(0),
   _coordsys(0),
   _comm(PETSC_COMM_WORLD),
   _debug(false)
@@ -46,6 +47,7 @@
 			     const MPI_Comm& comm) :
   _mesh(new SieveMesh(comm, dim)),
   _newMesh(PETSC_NULL),
+  _numNormalCells(0), _numCohesiveCells(0), _numNormalVertices(0), _numShadowVertices(0), _numLagrangeVertices(0),
   _coordsys(0),
   _comm(comm),
   _debug(false)

Modified: short/3D/PyLith/trunk/libsrc/pylith/topology/Mesh.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/topology/Mesh.hh	2012-07-15 00:50:49 UTC (rev 20523)
+++ short/3D/PyLith/trunk/libsrc/pylith/topology/Mesh.hh	2012-07-15 13:59:46 UTC (rev 20524)
@@ -125,6 +125,26 @@
    */
   void setDMMesh(DM dm);
 
+  /** Get sizes for all point types.
+   *
+   * @param numNormalCells
+   * @param numCohesiveCells
+   * @param numNormalVertices
+   * @param numShadowVertices
+   * @param numLagrangeVertices.
+   */
+  void getPointTypeSizes(PetscInt *numNormalCells, PetscInt *numCohesiveCells, PetscInt *numNormalVertices, PetscInt *numShadowVertices, PetscInt *numLagrangeVertices) const;
+
+  /** Set sizes for all point types.
+   *
+   * @param numNormalCells
+   * @param numCohesiveCells
+   * @param numNormalVertices
+   * @param numShadowVertices
+   * @param numLagrangeVertices.
+   */
+  void setPointTypeSizes(PetscInt numNormalCells, PetscInt numCohesiveCells, PetscInt numNormalVertices, PetscInt numShadowVertices, PetscInt numLagrangeVertices);
+
   /** Set coordinate system.
    *
    * @param cs Coordinate system.
@@ -222,6 +242,10 @@
 
   ALE::Obj<SieveMesh> _mesh; ///< Sieve mesh.
   DM _newMesh;
+  /* The old-style point numbering: [normalCells, normalVertices, shadowVertices, lagrangeVertices, cohesiveCells]
+     The new-style point numbering: [normalCells, cohesiveCells, normalVertices, shadowVertices, lagrangeVertices]
+  */
+  PetscInt _numNormalCells, _numCohesiveCells, _numNormalVertices, _numShadowVertices, _numLagrangeVertices;
   spatialdata::geocoords::CoordSys* _coordsys; ///< Coordinate system.
   MPI_Comm _comm; ///< MPI communicator for mesh.
   bool _debug; ///< Debugging flag for mesh.

Modified: short/3D/PyLith/trunk/libsrc/pylith/topology/Mesh.icc
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/topology/Mesh.icc	2012-07-15 00:50:49 UTC (rev 20523)
+++ short/3D/PyLith/trunk/libsrc/pylith/topology/Mesh.icc	2012-07-15 13:59:46 UTC (rev 20524)
@@ -48,6 +48,28 @@
   _newMesh = dm;
 }
 
+// Get point type sizes.
+inline
+void
+pylith::topology::Mesh::getPointTypeSizes(PetscInt *numNormalCells, PetscInt *numCohesiveCells, PetscInt *numNormalVertices, PetscInt *numShadowVertices, PetscInt *numLagrangeVertices) const {
+  *numNormalCells      = _numNormalCells;
+  *numCohesiveCells    = _numCohesiveCells;
+  *numNormalVertices   = _numNormalVertices;
+  *numShadowVertices   = _numShadowVertices;
+  *numLagrangeVertices = _numLagrangeVertices;
+}
+
+// Set point type sizes.
+inline
+void
+pylith::topology::Mesh::setPointTypeSizes(PetscInt numNormalCells, PetscInt numCohesiveCells, PetscInt numNormalVertices, PetscInt numShadowVertices, PetscInt numLagrangeVertices) {
+  _numNormalCells      = numNormalCells;
+  _numCohesiveCells    = numCohesiveCells;
+  _numNormalVertices   = numNormalVertices;
+  _numShadowVertices   = numShadowVertices;
+  _numLagrangeVertices = numLagrangeVertices;
+}
+
 // Get coordinate system.
 inline
 const spatialdata::geocoords::CoordSys*

Modified: short/3D/PyLith/trunk/libsrc/pylith/topology/SubMesh.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/topology/SubMesh.cc	2012-07-15 00:50:49 UTC (rev 20523)
+++ short/3D/PyLith/trunk/libsrc/pylith/topology/SubMesh.cc	2012-07-15 13:59:46 UTC (rev 20524)
@@ -33,6 +33,7 @@
 // ----------------------------------------------------------------------
 // Default constructor
 pylith::topology::SubMesh::SubMesh(void) :
+  _newMesh(PETSC_NULL),
   _coordsys(0),
   _debug(false)
 { // constructor
@@ -42,6 +43,7 @@
 // Constructor with mesh and label for vertices marking boundary.
 pylith::topology::SubMesh::SubMesh(const Mesh& mesh,
 				   const char* label) :
+  _newMesh(PETSC_NULL),
   _coordsys(0),
   _debug(false)
 { // constructor

Modified: short/3D/PyLith/trunk/libsrc/pylith/topology/SubMesh.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/topology/SubMesh.hh	2012-07-15 00:50:49 UTC (rev 20523)
+++ short/3D/PyLith/trunk/libsrc/pylith/topology/SubMesh.hh	2012-07-15 13:59:46 UTC (rev 20524)
@@ -102,6 +102,16 @@
    */
   DM dmMesh(void) const;
 
+  /** Get sizes for all point types.
+   *
+   * @param numNormalCells
+   * @param numCohesiveCells
+   * @param numNormalVertices
+   * @param numShadowVertices
+   * @param numLagrangeVertices.
+   */
+  void getPointTypeSizes(PetscInt *numNormalCells, PetscInt *numCohesiveCells, PetscInt *numNormalVertices, PetscInt *numShadowVertices, PetscInt *numLagrangeVertices) const;
+
   /** Set coordinate system using mesh.
    *
    * @param mesh Finite-element mesh over domain.

Modified: short/3D/PyLith/trunk/libsrc/pylith/topology/SubMesh.icc
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/topology/SubMesh.icc	2012-07-15 00:50:49 UTC (rev 20523)
+++ short/3D/PyLith/trunk/libsrc/pylith/topology/SubMesh.icc	2012-07-15 13:59:46 UTC (rev 20524)
@@ -41,6 +41,17 @@
   return _newMesh;
 }
 
+// Get point type sizes.
+inline
+void
+pylith::topology::SubMesh::getPointTypeSizes(PetscInt *numNormalCells, PetscInt *numCohesiveCells, PetscInt *numNormalVertices, PetscInt *numShadowVertices, PetscInt *numLagrangeVertices) const {
+  *numNormalCells      = 0;
+  *numCohesiveCells    = 0;
+  *numNormalVertices   = 0;
+  *numShadowVertices   = 0;
+  *numLagrangeVertices = 0;
+}
+
 // Get coordinate system.
 inline
 const spatialdata::geocoords::CoordSys*



More information about the CIG-COMMITS mailing list