[cig-commits] r21673 - short/3D/PyLith/trunk/libsrc/pylith/faults
brad at geodynamics.org
brad at geodynamics.org
Thu Mar 28 13:22:04 PDT 2013
Author: brad
Date: 2013-03-28 13:22:04 -0700 (Thu, 28 Mar 2013)
New Revision: 21673
Modified:
short/3D/PyLith/trunk/libsrc/pylith/faults/FaultCohesiveImpulses.cc
Log:
Implemented potential fix for removing duplicate impulses for parallel Green's functions.
Modified: short/3D/PyLith/trunk/libsrc/pylith/faults/FaultCohesiveImpulses.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/faults/FaultCohesiveImpulses.cc 2013-03-28 19:08:06 UTC (rev 21672)
+++ short/3D/PyLith/trunk/libsrc/pylith/faults/FaultCohesiveImpulses.cc 2013-03-28 20:22:04 UTC (rev 21673)
@@ -154,10 +154,9 @@
// Integrate contribution of cohesive cells to residual term that do
// not require assembly across cells, vertices, or processors.
void
-pylith::faults::FaultCohesiveImpulses::integrateResidual(
- const topology::Field<topology::Mesh>& residual,
- const PylithScalar t,
- topology::SolutionFields* const fields)
+pylith::faults::FaultCohesiveImpulses::integrateResidual(const topology::Field<topology::Mesh>& residual,
+ const PylithScalar t,
+ topology::SolutionFields* const fields)
{ // integrateResidual
PYLITH_METHOD_BEGIN;
@@ -310,15 +309,15 @@
PetscScalar *amplitudeArray = amplitudeVisitor.localArray();
PetscErrorCode err;
- PetscDM faultDMMesh = _faultMesh->dmMesh();assert(faultDMMesh);
- PetscIS vertexNumbering = NULL;
- err = DMPlexGetVertexNumbering(faultDMMesh, &vertexNumbering);CHECK_PETSC_ERROR(err);
- const PetscInt* points = NULL;
- PetscInt npoints = 0;
- err = ISGetIndices(vertexNumbering, &points);CHECK_PETSC_ERROR(err);
- err = ISGetLocalSize(vertexNumbering, &npoints);CHECK_PETSC_ERROR(err);
+ PetscDM amplitudeDM = amplitude.mesh().dmMesh();assert(amplitudeDM);
+ PetscSection amplitudeSection = amplitude.petscSection();assert(amplitudeSection);
+ PetscSection amplitudeGlobalSection = NULL;
+ PetscSF sf = NULL;
+ err = DMGetPointSF(amplitudeDM, &sf);CHECK_PETSC_ERROR(err);
+ err = PetscSectionCreateGlobalSection(amplitudeSection, sf, PETSC_TRUE, &litudeGlobalSection);CHECK_PETSC_ERROR(err);
scalar_array coordsVertex(spaceDim);
+ PetscDM faultDMMesh = _faultMesh->dmMesh();assert(faultDMMesh);
topology::CoordsVisitor coordsVisitor(faultDMMesh);
PetscScalar *coordsArray = coordsVisitor.localArray();
@@ -333,13 +332,11 @@
for (int iVertex=0; iVertex < numVertices; ++iVertex) {
const int v_fault = _cohesiveVertices[iVertex].fault;
- std::cerr << ":TODO: MATT Update FaultCohesiveImpulses::_setupImpulses() for PETSc DM." << std::endl;
-#if 0
- // Only create impulses on local vertices
- if (!globalNumbering->isLocal(v_fault)) {
+ PetscInt goff;
+ err = PetscSectionGetOffset(amplitudeGlobalSection, v_fault, &goff);CHECK_PETSC_ERROR(err);
+ if (goff < 0) {
continue;
} // if
-#endif
const PetscInt coff = coordsVisitor.sectionOffset(v_fault);
assert(spaceDim == coordsVisitor.sectionDof(v_fault));
@@ -373,6 +370,7 @@
++count;
} // if
} // for
+ err = PetscSectionDestroy(&litudeGlobalSection);CHECK_PETSC_ERROR(err);
// Close properties database
_dbImpulseAmp->close();
More information about the CIG-COMMITS
mailing list