[cig-commits] r22062 - in short/3D/PyLith/trunk: libsrc/pylith/faults libsrc/pylith/feassemble libsrc/pylith/meshio libsrc/pylith/topology modulesrc/faults modulesrc/topology pylith/materials pylith/perf
knepley at geodynamics.org
knepley at geodynamics.org
Tue May 14 13:07:27 PDT 2013
Author: knepley
Date: 2013-05-14 13:07:26 -0700 (Tue, 14 May 2013)
New Revision: 22062
Modified:
short/3D/PyLith/trunk/libsrc/pylith/faults/Fault.cc
short/3D/PyLith/trunk/libsrc/pylith/faults/Fault.hh
short/3D/PyLith/trunk/libsrc/pylith/feassemble/IntegratorElasticity.cc
short/3D/PyLith/trunk/libsrc/pylith/meshio/MeshIO.cc
short/3D/PyLith/trunk/libsrc/pylith/topology/Mesh.hh
short/3D/PyLith/trunk/libsrc/pylith/topology/Mesh.icc
short/3D/PyLith/trunk/modulesrc/faults/Fault.i
short/3D/PyLith/trunk/modulesrc/topology/Mesh.i
short/3D/PyLith/trunk/pylith/materials/Material.py
short/3D/PyLith/trunk/pylith/perf/MemoryLogger.py
Log:
Changed coneSize() to numCorners() which is the precise meaning, needed for interpolated meshes
Modified: short/3D/PyLith/trunk/libsrc/pylith/faults/Fault.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/faults/Fault.cc 2013-05-14 19:55:48 UTC (rev 22061)
+++ short/3D/PyLith/trunk/libsrc/pylith/faults/Fault.cc 2013-05-14 20:07:26 UTC (rev 22062)
@@ -65,11 +65,11 @@
// ----------------------------------------------------------------------
-// Get representative cone size for mesh.
+// Get number of vertices per cell for mesh.
int
-pylith::faults::Fault::coneSize(void) const
+pylith::faults::Fault::numCorners(void) const
{ // coneSize
- return (_faultMesh) ? _faultMesh->coneSize() : 0;
+ return (_faultMesh) ? _faultMesh->numCorners() : 0;
} // coneSize
Modified: short/3D/PyLith/trunk/libsrc/pylith/faults/Fault.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/faults/Fault.hh 2013-05-14 19:55:48 UTC (rev 22061)
+++ short/3D/PyLith/trunk/libsrc/pylith/faults/Fault.hh 2013-05-14 20:07:26 UTC (rev 22062)
@@ -91,11 +91,11 @@
*/
int dimension(void) const;
- /** Get representative cone size for mesh.
+ /** Get number of vertices per cell for mesh.
*
- * @returns Representative cone size for mesh.
+ * @returns Number of vertices per cell for mesh.
*/
- int coneSize(void) const;
+ int numCorners(void) const;
/** Get number of vertices in mesh.
*
Modified: short/3D/PyLith/trunk/libsrc/pylith/feassemble/IntegratorElasticity.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/feassemble/IntegratorElasticity.cc 2013-05-14 19:55:48 UTC (rev 22061)
+++ short/3D/PyLith/trunk/libsrc/pylith/feassemble/IntegratorElasticity.cc 2013-05-14 20:07:26 UTC (rev 22062)
@@ -260,12 +260,19 @@
topology::StratumIS materialIS(dmMesh, "material-id", _material->id());
const PetscInt* cells = materialIS.points();
const PetscInt numCells = materialIS.size();
+ PetscInt vStart, vEnd;
+ PetscErrorCode err;
+ err = DMPlexGetDepthStratum(dmMesh, 0, &vStart, &vEnd);PYLITH_CHECK_ERROR(err);
for(PetscInt c = 0; c < numCells; ++c) {
const PetscInt cell = cells[c];
- PetscInt cellNumCorners;
+ PetscInt cellNumCorners = 0, closureSize, *closure = NULL;
- PetscErrorCode err = DMPlexGetConeSize(dmMesh, cell, &cellNumCorners);PYLITH_CHECK_ERROR(err);
+ err = DMPlexGetTransitiveClosure(dmMesh, cell, PETSC_TRUE, &closureSize, &closure);PYLITH_CHECK_ERROR(err);
+ for (PetscInt cl = 0; cl < closureSize*2; cl += 2) {
+ if ((closure[cl] >= vStart) && (closure[cl] < vEnd)) ++cellNumCorners;
+ }
+ err = DMPlexRestoreTransitiveClosure(dmMesh, cell, PETSC_TRUE, &closureSize, &closure);PYLITH_CHECK_ERROR(err);
if (numCorners != cellNumCorners) {
std::ostringstream msg;
msg << "Quadrature is incompatible with cell in material '"
Modified: short/3D/PyLith/trunk/libsrc/pylith/meshio/MeshIO.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/meshio/MeshIO.cc 2013-05-14 19:55:48 UTC (rev 22061)
+++ short/3D/PyLith/trunk/libsrc/pylith/meshio/MeshIO.cc 2013-05-14 20:07:26 UTC (rev 22062)
@@ -167,7 +167,7 @@
const PetscInt vEnd = verticesStratum.end();
*numCells = _mesh->numCells();
- *numCorners = _mesh->coneSize();
+ *numCorners = _mesh->numCorners();
*meshDim = _mesh->dimension();
assert(cellsStratum.size() == *numCells);
Modified: short/3D/PyLith/trunk/libsrc/pylith/topology/Mesh.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/topology/Mesh.hh 2013-05-14 19:55:48 UTC (rev 22061)
+++ short/3D/PyLith/trunk/libsrc/pylith/topology/Mesh.hh 2013-05-14 20:07:26 UTC (rev 22062)
@@ -143,6 +143,12 @@
* @returns Dimension of mesh.
*/
int dimension(void) const;
+
+ /** Get the number of vertices per cell
+ *
+ * @returns Number of vertices per cell.
+ */
+ int numCorners(void) const;
/** Get number of vertices in mesh.
*
@@ -150,12 +156,6 @@
*/
int numVertices(void) const;
- /** Get representative cone size for mesh.
- *
- * @returns Representative cone size for mesh.
- */
- int coneSize(void) const;
-
/** Get number of cells in mesh.
*
* @returns Number of cells in mesh.
Modified: short/3D/PyLith/trunk/libsrc/pylith/topology/Mesh.icc
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/topology/Mesh.icc 2013-05-14 19:55:48 UTC (rev 22061)
+++ short/3D/PyLith/trunk/libsrc/pylith/topology/Mesh.icc 2013-05-14 20:07:26 UTC (rev 22062)
@@ -118,39 +118,43 @@
}
// ----------------------------------------------------------------------
-// Get number of vertices in mesh.
+// Get number of vertices per cell
inline
int
-pylith::topology::Mesh::numVertices(void) const {
+pylith::topology::Mesh::numCorners(void) const {
PYLITH_METHOD_BEGIN;
- PetscInt nvertices = 0;
+ PetscInt numCorners = 0;
if (_dmMesh) {
- PetscInt begin=0, end=0;
- PetscErrorCode err = DMPlexGetDepthStratum(_dmMesh, 0, &begin, &end);PYLITH_CHECK_ERROR(err);
- nvertices = end-begin;
+ PetscInt cStart, vStart, vEnd, closureSize, *closure = NULL;
+ PetscErrorCode err;
+ err = DMPlexGetHeightStratum(_dmMesh, 0, &cStart, NULL);PYLITH_CHECK_ERROR(err);
+ err = DMPlexGetDepthStratum(_dmMesh, 0, &vStart, &vEnd);PYLITH_CHECK_ERROR(err);
+ err = DMPlexGetTransitiveClosure(_dmMesh, cStart, PETSC_TRUE, &closureSize, &closure);PYLITH_CHECK_ERROR(err);
+ for (PetscInt c = 0; c < closureSize*2; c += 2) {
+ if ((closure[c] >= vStart) && (closure[c] < vEnd)) ++numCorners;
+ }
+ err = DMPlexRestoreTransitiveClosure(_dmMesh, cStart, PETSC_TRUE, &closureSize, &closure);PYLITH_CHECK_ERROR(err);
} // if
- PYLITH_METHOD_RETURN(nvertices);
+ PYLITH_METHOD_RETURN(numCorners);
}
// ----------------------------------------------------------------------
-// Get representative cone size for mesh.
+// Get number of vertices in mesh.
inline
int
-pylith::topology::Mesh::coneSize(void) const {
+pylith::topology::Mesh::numVertices(void) const {
PYLITH_METHOD_BEGIN;
- PetscInt coneSize = 0;
+ PetscInt nvertices = 0;
if (_dmMesh) {
- PetscInt cStart;
- PetscErrorCode err;
- const int cellHeight = _isSubMesh ? 1 : 0;
- err = DMPlexGetHeightStratum(_dmMesh, cellHeight, &cStart, NULL);PYLITH_CHECK_ERROR(err);
- err = DMPlexGetConeSize(_dmMesh, cStart, &coneSize);PYLITH_CHECK_ERROR(err);
+ PetscInt begin=0, end=0;
+ PetscErrorCode err = DMPlexGetDepthStratum(_dmMesh, 0, &begin, &end);PYLITH_CHECK_ERROR(err);
+ nvertices = end-begin;
} // if
- PYLITH_METHOD_RETURN(coneSize);
+ PYLITH_METHOD_RETURN(nvertices);
}
// ----------------------------------------------------------------------
Modified: short/3D/PyLith/trunk/modulesrc/faults/Fault.i
===================================================================
--- short/3D/PyLith/trunk/modulesrc/faults/Fault.i 2013-05-14 19:55:48 UTC (rev 22061)
+++ short/3D/PyLith/trunk/modulesrc/faults/Fault.i 2013-05-14 20:07:26 UTC (rev 22062)
@@ -71,11 +71,11 @@
*/
int dimension(void) const;
- /** Get representative cone size for mesh.
+ /** Get number of vertices per cell for mesh.
*
- * @returns Representative cone size for mesh.
+ * @returns Number of vertices per cell for mesh.
*/
- int coneSize(void) const;
+ int numCorners(void) const;
/** Get number of vertices in mesh.
*
Modified: short/3D/PyLith/trunk/modulesrc/topology/Mesh.i
===================================================================
--- short/3D/PyLith/trunk/modulesrc/topology/Mesh.i 2013-05-14 19:55:48 UTC (rev 22061)
+++ short/3D/PyLith/trunk/modulesrc/topology/Mesh.i 2013-05-14 20:07:26 UTC (rev 22062)
@@ -88,11 +88,11 @@
*/
int dimension(void) const;
- /** Get representative cone size of mesh.
+ /** Get the number of vertices per cell
*
- * @returns Representative cone size of mesh.
+ * @returns Number of vertices per cell.
*/
- int coneSize(void) const;
+ int numCorners(void) const;
/** Get number of vertices in mesh.
*
Modified: short/3D/PyLith/trunk/pylith/materials/Material.py
===================================================================
--- short/3D/PyLith/trunk/pylith/materials/Material.py 2013-05-14 19:55:48 UTC (rev 22061)
+++ short/3D/PyLith/trunk/pylith/materials/Material.py 2013-05-14 20:07:26 UTC (rev 22062)
@@ -138,7 +138,7 @@
if self.quadrature.cellDim() != self.mesh().dimension() or \
self.quadrature.spaceDim() != self.mesh().coordsys().spaceDim() or \
- self.quadrature.cell.numCorners != self.mesh().coneSize():
+ self.quadrature.cell.numCorners != self.mesh().numCorners():
raise ValueError, \
"Quadrature scheme for material '%s' and mesh are incompatible.\n" \
" Quadrature reference cell:\n" \
@@ -153,7 +153,7 @@
self.quadrature.cellDim(), self.quadrature.spaceDim(),
self.quadrature.cell.numCorners,
self.mesh().dimension(), self.mesh().coordsys().spaceDim(),
- self.mesh().coneSize())
+ self.mesh().numCorners())
self._eventLogger.eventEnd(logEvent)
return
Modified: short/3D/PyLith/trunk/pylith/perf/MemoryLogger.py
===================================================================
--- short/3D/PyLith/trunk/pylith/perf/MemoryLogger.py 2013-05-14 19:55:48 UTC (rev 22061)
+++ short/3D/PyLith/trunk/pylith/perf/MemoryLogger.py 2013-05-14 20:07:26 UTC (rev 22062)
@@ -72,7 +72,7 @@
if not stage in self.memory or reset:
self.memory[stage] = {}
- meshModel = pylith.perf.Mesh.Mesh(mesh.dimension(), mesh.coneSize(),
+ meshModel = pylith.perf.Mesh.Mesh(mesh.dimension(), mesh.numCorners(),
mesh.numVertices(), mesh.numCells())
meshModel.tabulate(self.memory[stage])
for group, nvertices in mesh.groupSizes():
@@ -185,7 +185,7 @@
import pylith.perf.Fault
if not stage in self.memory: self.memory[stage] = {}
- faultModel = pylith.perf.Fault.Fault(mesh.dimension(), mesh.coneSize(),
+ faultModel = pylith.perf.Fault.Fault(mesh.dimension(), mesh.numCorners(),
mesh.numVertices(), mesh.numCells())
faultModel.tabulate(self.memory[stage])
return
More information about the CIG-COMMITS
mailing list