[cig-commits] [commit] knepley/upgrade-petsc-interface: BC: Only allow vertices in BC points (9f8e24d)

cig_noreply at geodynamics.org cig_noreply at geodynamics.org
Thu Oct 17 16:15:26 PDT 2013


Repository : ssh://geoshell/pylith

On branch  : knepley/upgrade-petsc-interface
Link       : https://github.com/geodynamics/pylith/compare/8e347a9f5d96fe4c665278ebea3720639379892b...3a1c2fe5ae5b5e0c987791aa2b8eeca011b22468

>---------------------------------------------------------------

commit 9f8e24d4d709c9cea7783e2c17dea86528ec90b3
Author: Matthew G. Knepley <knepley at gmail.com>
Date:   Thu Oct 17 13:24:04 2013 -0500

    BC: Only allow vertices in BC points


>---------------------------------------------------------------

9f8e24d4d709c9cea7783e2c17dea86528ec90b3
 libsrc/pylith/bc/BoundaryConditionPoints.cc | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/libsrc/pylith/bc/BoundaryConditionPoints.cc b/libsrc/pylith/bc/BoundaryConditionPoints.cc
index e530589..dd9518d 100644
--- a/libsrc/pylith/bc/BoundaryConditionPoints.cc
+++ b/libsrc/pylith/bc/BoundaryConditionPoints.cc
@@ -72,7 +72,7 @@ pylith::bc::BoundaryConditionPoints::_getPoints(const topology::Mesh& mesh)
   PetscDMLabel label = NULL;
   PetscIS pointIS = NULL;
   const PetscInt *points;
-  PetscInt numPoints;
+  PetscInt numPoints, vStart, vEnd, numVertices = 0;
   PetscBool hasLabel;
   PetscErrorCode err;
   err = DMPlexHasLabel(dmMesh, _label.c_str(), &hasLabel);PYLITH_CHECK_ERROR(err);
@@ -82,12 +82,15 @@ pylith::bc::BoundaryConditionPoints::_getPoints(const topology::Mesh& mesh)
     throw std::runtime_error(msg.str());
   } // if
 
+  err = DMPlexGetDepthStratum(dmMesh, 0, &vStart, &vEnd);PYLITH_CHECK_ERROR(err);
   err = DMPlexGetLabel(dmMesh, _label.c_str(), &label);PYLITH_CHECK_ERROR(err);
   err = DMLabelGetStratumIS(label, 1, &pointIS);PYLITH_CHECK_ERROR(err);
   err = ISGetLocalSize(pointIS, &numPoints);PYLITH_CHECK_ERROR(err);
   err = ISGetIndices(pointIS, &points);PYLITH_CHECK_ERROR(err);
-  _points.resize(numPoints);
-  for(PetscInt p = 0; p < numPoints; ++p) {_points[p] = points[p];}
+  // For now, only use vertices
+  for (PetscInt p = 0; p < numPoints; ++p) if ((points[p] >= vStart) && (points[p] < vEnd)) ++numVertices;
+  _points.resize(numVertices);
+  for (PetscInt p = 0, v = 0; p < numPoints; ++p) if ((points[p] >= vStart) && (points[p] < vEnd)) _points[v++] = points[p];
   err = ISRestoreIndices(pointIS, &points);PYLITH_CHECK_ERROR(err);
   err = ISDestroy(&pointIS);PYLITH_CHECK_ERROR(err);
 



More information about the CIG-COMMITS mailing list