[cig-commits] r21010 - in short/3D/PyLith/trunk: libsrc/pylith/faults unittests/libtests/faults/data
knepley at geodynamics.org
knepley at geodynamics.org
Sat Nov 10 07:56:41 PST 2012
Author: knepley
Date: 2012-11-10 07:56:40 -0800 (Sat, 10 Nov 2012)
New Revision: 21010
Modified:
short/3D/PyLith/trunk/libsrc/pylith/faults/CohesiveTopology.cc
short/3D/PyLith/trunk/unittests/libtests/faults/data/CohesiveKinDataTri3.cc
Log:
Fixed fault coordinates, Now CohesiveKinTri3 tests work (except splitting)
Modified: short/3D/PyLith/trunk/libsrc/pylith/faults/CohesiveTopology.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/faults/CohesiveTopology.cc 2012-11-10 14:41:39 UTC (rev 21009)
+++ short/3D/PyLith/trunk/libsrc/pylith/faults/CohesiveTopology.cc 2012-11-10 15:56:40 UTC (rev 21010)
@@ -883,6 +883,50 @@
mesh->setDMMesh(newMesh);
} // create
+PetscInt convertSieveToDMPointNumbering(PetscInt sievePoint, PetscInt numNormalCells, PetscInt numCohesiveCells, PetscInt numNormalVertices, PetscInt numShadowVertices, PetscInt numLagrangeVertices)
+{
+ PetscInt dmPoint = -1;
+
+ if ((sievePoint >= 0) && (sievePoint < numNormalCells)) {
+ dmPoint = sievePoint;
+ //std::cout << "normal cell sieve point "<<sievePoint<<" --> "<<" dm point"<<dmPoint<<std::endl;
+ } else if ((sievePoint >= numNormalCells) && (sievePoint < numNormalCells+numNormalVertices)) {
+ dmPoint = sievePoint+numCohesiveCells;
+ //std::cout << "normal vertex sieve point "<<sievePoint<<" --> "<<" dm point"<<dmPoint<<std::endl;
+ } else if ((sievePoint >= numNormalCells+numNormalVertices) && (sievePoint < numNormalCells+numNormalVertices+numShadowVertices+numLagrangeVertices)) {
+ dmPoint = sievePoint+numCohesiveCells;
+ //std::cout << "extra vertex sieve point "<<sievePoint<<" --> "<<" dm point"<<dmPoint<<std::endl;
+ } else if ((sievePoint >= numNormalCells+numNormalVertices+numShadowVertices+numLagrangeVertices) && (sievePoint < numNormalCells+numNormalVertices+numShadowVertices+numLagrangeVertices+numCohesiveCells)) {
+ dmPoint = sievePoint-(numNormalVertices+numShadowVertices+numLagrangeVertices);
+ //std::cout << "extra cell sieve point "<<sievePoint<<" --> "<<" dm point"<<dmPoint<<std::endl;
+ } else {
+ //std::cout << "face sieve point "<<sievePoint<<" --> "<<" dm point"<<dmPoint<<std::endl;
+ }
+ return dmPoint;
+}
+
+PetscInt convertDMToSievePointNumbering(PetscInt dmPoint, PetscInt numNormalCells, PetscInt numCohesiveCells, PetscInt numNormalVertices, PetscInt numShadowVertices, PetscInt numLagrangeVertices)
+{
+ PetscInt sievePoint = -1;
+
+ if ((dmPoint >= 0) && (dmPoint < numNormalCells)) {
+ sievePoint = dmPoint;
+ //std::cout << "normal cell sieve point "<<sievePoint<<" <-- "<<" dm point"<<dmPoint<<std::endl;
+ } else if ((dmPoint >= numNormalCells) && (dmPoint < numNormalCells+numCohesiveCells)) {
+ sievePoint = dmPoint+numNormalVertices+numShadowVertices+numLagrangeVertices;
+ //std::cout << "extra cell sieve point "<<sievePoint<<" <-- "<<" dm point"<<dmPoint<<std::endl;
+ } else if ((dmPoint >= numNormalCells+numCohesiveCells) && (dmPoint < numNormalCells+numCohesiveCells+numNormalVertices)) {
+ sievePoint = dmPoint-numCohesiveCells;
+ //std::cout << "normal vertex sieve point "<<sievePoint<<" <-- "<<" dm point"<<dmPoint<<std::endl;
+ } else if ((dmPoint >= numNormalCells+numCohesiveCells+numNormalVertices) && (dmPoint < numNormalCells+numCohesiveCells+numNormalVertices+numShadowVertices+numLagrangeVertices)) {
+ sievePoint = dmPoint-numCohesiveCells;
+ //std::cout << "extra vertex sieve point "<<sievePoint<<" <-- "<<" dm point"<<dmPoint<<std::endl;
+ } else {
+ //std::cout << "face sieve point "<<sievePoint<<" <-- "<<" dm point"<<dmPoint<<std::endl;
+ }
+ return sievePoint;
+}
+
// ----------------------------------------------------------------------
// Form a parallel fault mesh using the cohesive cell information
void
@@ -1049,6 +1093,9 @@
coordinates->restrictPoint(*v_iter));
}
//faultSieveMesh->view("Parallel fault mesh");
+ PetscInt numNormalCells, numCohesiveCells, numNormalVertices, numShadowVertices, numLagrangeVertices;
+ mesh.getPointTypeSizes(&numNormalCells, &numCohesiveCells, &numNormalVertices, &numShadowVertices, &numLagrangeVertices);
+
const SieveMesh::renumbering_type::const_iterator convertRenumberingEnd = convertRenumbering.end();
PetscSection coordSection, faultCoordSection;
Vec coordinateVec, faultCoordinateVec;
@@ -1062,11 +1109,12 @@
err = DMComplexGetCoordinateSection(dmFaultMesh, &faultCoordSection);CHECK_PETSC_ERROR(err);
err = PetscSectionSetChart(faultCoordSection, fvStart, fvEnd);CHECK_PETSC_ERROR(err);
for(PetscInt v = pvStart; v < pvEnd; ++v) {
+ PetscInt sievePoint = convertDMToSievePointNumbering(v, numNormalCells, numCohesiveCells, numNormalVertices, numShadowVertices, numLagrangeVertices);
PetscInt dof;
- if (convertRenumbering.find(v) == convertRenumberingEnd) continue;
+ if (convertRenumbering.find(sievePoint) == convertRenumberingEnd) continue;
err = PetscSectionGetDof(coordSection, v, &dof);CHECK_PETSC_ERROR(err);
- err = PetscSectionSetDof(faultCoordSection, convertRenumbering[v], dof);CHECK_PETSC_ERROR(err);
+ err = PetscSectionSetDof(faultCoordSection, convertRenumbering[sievePoint], dof);CHECK_PETSC_ERROR(err);
}
err = PetscSectionSetUp(faultCoordSection);CHECK_PETSC_ERROR(err);
err = PetscSectionGetStorageSize(faultCoordSection, &n);CHECK_PETSC_ERROR(err);
@@ -1077,12 +1125,13 @@
err = VecGetArray(coordinateVec, &a);CHECK_PETSC_ERROR(err);
err = VecGetArray(faultCoordinateVec, &fa);CHECK_PETSC_ERROR(err);
for(PetscInt v = pvStart; v < pvEnd; ++v) {
+ PetscInt sievePoint = convertDMToSievePointNumbering(v, numNormalCells, numCohesiveCells, numNormalVertices, numShadowVertices, numLagrangeVertices);
PetscInt dof, off, foff;
- if (convertRenumbering.find(v) == convertRenumberingEnd) continue;
+ if (convertRenumbering.find(sievePoint) == convertRenumberingEnd) continue;
err = PetscSectionGetDof(coordSection, v, &dof);CHECK_PETSC_ERROR(err);
err = PetscSectionGetOffset(coordSection, v, &off);CHECK_PETSC_ERROR(err);
- err = PetscSectionGetOffset(faultCoordSection, convertRenumbering[v], &foff);CHECK_PETSC_ERROR(err);
+ err = PetscSectionGetOffset(faultCoordSection, convertRenumbering[sievePoint], &foff);CHECK_PETSC_ERROR(err);
for(PetscInt d = 0; d < dof; ++d) {
fa[foff+d] = a[off+d];
}
@@ -1091,13 +1140,10 @@
err = VecRestoreArray(faultCoordinateVec, &fa);CHECK_PETSC_ERROR(err);
// Have to make subpointMap here: renumbering[original] = fault
- PetscInt numNormalCells, numCohesiveCells, numNormalVertices, numShadowVertices, numLagrangeVertices;
-
IS subpointMap;
PetscInt *renum;
PetscInt pStart, pEnd;
- mesh.getPointTypeSizes(&numNormalCells, &numCohesiveCells, &numNormalVertices, &numShadowVertices, &numLagrangeVertices);
err = DMComplexGetChart(dmFaultMesh, &pStart, &pEnd);CHECK_PETSC_ERROR(err);
err = DMComplexGetDepthStratum(dmFaultMesh, 0, &fvStart, &fvEnd);CHECK_PETSC_ERROR(err);
assert(convertRenumbering.size() == pEnd-pStart);
@@ -1112,23 +1158,7 @@
for(SieveMesh::renumbering_type::const_iterator p_iter = convertRenumbering.begin(); p_iter != convertRenumbering.end(); ++p_iter) {
const PetscInt sievePoint = p_iter->first;
const PetscInt faultPoint = p_iter->second;
- PetscInt dmPoint = -1;
-
- if ((sievePoint >= 0) && (sievePoint < numNormalCells)) {
- dmPoint = sievePoint;
- //std::cout << "normal cell sieve point "<<sievePoint<<" --> "<<" dm point"<<dmPoint<<std::endl;
- } else if ((sievePoint >= numNormalCells) && (sievePoint < numNormalCells+numNormalVertices)) {
- dmPoint = sievePoint+numCohesiveCells;
- //std::cout << "normal vertex sieve point "<<sievePoint<<" --> "<<" dm point"<<dmPoint<<std::endl;
- } else if ((sievePoint >= numNormalCells+numNormalVertices) && (sievePoint < numNormalCells+numNormalVertices+numShadowVertices+numLagrangeVertices)) {
- dmPoint = sievePoint+numCohesiveCells;
- //std::cout << "extra vertex sieve point "<<sievePoint<<" --> "<<" dm point"<<dmPoint<<std::endl;
- } else if ((sievePoint >= numNormalCells+numNormalVertices+numShadowVertices+numLagrangeVertices) && (sievePoint < numNormalCells+numNormalVertices+numShadowVertices+numLagrangeVertices+numCohesiveCells)) {
- dmPoint = sievePoint-numNormalVertices+numShadowVertices+numLagrangeVertices;
- //std::cout << "extra cell sieve point "<<sievePoint<<" --> "<<" dm point"<<dmPoint<<std::endl;
- } else {
- //std::cout << "face sieve point "<<sievePoint<<" --> "<<" dm point"<<dmPoint<<std::endl;
- }
+ PetscInt dmPoint = convertSieveToDMPointNumbering(sievePoint, numNormalCells, numCohesiveCells, numNormalVertices, numShadowVertices, numLagrangeVertices);
renum[faultPoint] = dmPoint;
std::cout << "renum["<<faultPoint<<"]: "<<dmPoint<<std::endl;
}
Modified: short/3D/PyLith/trunk/unittests/libtests/faults/data/CohesiveKinDataTri3.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/faults/data/CohesiveKinDataTri3.cc 2012-11-10 14:41:39 UTC (rev 21009)
+++ short/3D/PyLith/trunk/unittests/libtests/faults/data/CohesiveKinDataTri3.cc 2012-11-10 15:56:40 UTC (rev 21010)
@@ -35,19 +35,19 @@
*
* After adding cohesive elements
*
- * Cells are 0-1, 10, vertices are 2-7.
+ * Cells are 0-1, 2, vertices are 3-10.
*
- * 6 -8- 3
+ * 7 -9- 4
* /| |\
* / | | \
* / | | \
* / | | \
- * 2 | | 5
+ * 3 | 2 | 6
* \ | | /
* \ | | /
* \ | | /
* \| |/
- * 7 -9- 4
+ * 8-10- 5
*/
#include "CohesiveKinDataTri3.hh"
@@ -136,13 +136,13 @@
1, 2
};
const int pylith::faults::CohesiveKinDataTri3::_verticesLagrange[] = {
- 8, 9
+ 9, 10
};
const int pylith::faults::CohesiveKinDataTri3::_verticesNegative[] = {
- 3, 4
+ 4, 5
};
const int pylith::faults::CohesiveKinDataTri3::_verticesPositive[] = {
- 6, 7
+ 7, 8
};
const int pylith::faults::CohesiveKinDataTri3::_numCohesiveCells = 1;
@@ -150,7 +150,7 @@
0
};
const int pylith::faults::CohesiveKinDataTri3::_cellMappingCohesive[] = {
- 10
+ 2
};
More information about the CIG-COMMITS
mailing list