[cig-commits] r13874 - in short/3D/PyLith/trunk: libsrc/faults unittests/libtests/faults unittests/libtests/faults/data
brad at geodynamics.org
brad at geodynamics.org
Thu Jan 15 17:05:52 PST 2009
Author: brad
Date: 2009-01-15 17:05:52 -0800 (Thu, 15 Jan 2009)
New Revision: 13874
Modified:
short/3D/PyLith/trunk/libsrc/faults/CohesiveTopology.cc
short/3D/PyLith/trunk/libsrc/faults/CohesiveTopology.hh
short/3D/PyLith/trunk/libsrc/faults/FaultCohesive.cc
short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesive.cc
short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesiveKinHex8.cc
short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesiveKinQuad4e.cc
short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesiveKinSrcsHex8.cc
short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesiveKinSrcsTri3.cc
short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesiveKinTri3d.cc
short/3D/PyLith/trunk/unittests/libtests/faults/data/CohesiveDataHex8i.cc
short/3D/PyLith/trunk/unittests/libtests/faults/data/CohesiveDataQuad4h.cc
short/3D/PyLith/trunk/unittests/libtests/faults/data/CohesiveDataTet4i.cc
short/3D/PyLith/trunk/unittests/libtests/faults/data/CohesiveDataTri3d.cc
Log:
Fixed implementation of flipFault switch. Flip orientation in createFaultSieveFromVertices by reversing order of traversal through support array.
Modified: short/3D/PyLith/trunk/libsrc/faults/CohesiveTopology.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/faults/CohesiveTopology.cc 2009-01-15 22:51:53 UTC (rev 13873)
+++ short/3D/PyLith/trunk/libsrc/faults/CohesiveTopology.cc 2009-01-16 01:05:52 UTC (rev 13874)
@@ -26,7 +26,8 @@
const PointSet& faultVertices,
const Obj<Mesh>& mesh,
const Obj<ALE::Mesh::arrow_section_type>& orientation,
- const Obj<ALE::Mesh::sieve_type>& faultSieve)
+ const Obj<ALE::Mesh::sieve_type>& faultSieve,
+ const bool flipFault)
{
typedef ALE::Selection<ALE::Mesh> selection;
const Obj<sieve_type>& sieve = mesh->getSieve();
@@ -71,7 +72,9 @@
const Mesh::point_type *support = sV.getPoints();
if (debug) std::cout << "Checking fault vertex " << *fv_iter << std::endl;
- for(int s = 0; s < sV.getSize(); ++s) {
+ const int sVsize = sV.getSize();
+ for (int i=0; i < sVsize; ++i) {
+ const int s = (!flipFault) ? i : sVsize - i - 1;
sieve->cone(support[s], cV);
const Mesh::point_type *cone = cV.getPoints();
@@ -412,7 +415,8 @@
pylith::faults::CohesiveTopology::createFault(Obj<SubMesh>& ifault,
Obj<ALE::Mesh>& faultBd,
const Obj<Mesh>& mesh,
- const Obj<Mesh::int_section_type>& groupField)
+ const Obj<Mesh::int_section_type>& groupField,
+ const bool flipFault)
{
const Obj<sieve_type>& sieve = mesh->getSieve();
const Obj<SubMesh::sieve_type> ifaultSieve = new Mesh::sieve_type(sieve->comm(), sieve->debug());
@@ -433,7 +437,10 @@
const bool vertexFault = true;
const int firstFaultCell = sieve->getBaseSize() + sieve->getCapSize();
- createFaultSieveFromVertices(fault->getDimension(), firstFaultCell, faultVertices, mesh, fault->getArrowSection("orientation"), faultSieve);
+ createFaultSieveFromVertices(fault->getDimension(), firstFaultCell,
+ faultVertices, mesh,
+ fault->getArrowSection("orientation"),
+ faultSieve, flipFault);
fault->setSieve(faultSieve);
fault->stratify();
if (debug) fault->view("Fault mesh");
@@ -458,8 +465,7 @@
const Obj<Mesh>& mesh,
const Obj<Mesh::int_section_type>& groupField,
const int materialId,
- const bool constraintCell,
- const bool flipFault)
+ const bool constraintCell)
{ // create
typedef ALE::SieveAlg<ALE::Mesh> sieveAlg;
typedef ALE::Selection<ALE::Mesh> selection;
@@ -613,11 +619,6 @@
}
}
- if (flipFault) {
- Mesh::point_type tmpCell = otherCell;
- otherCell = cell;
- cell = tmpCell;
- } // if
if (found) {
if (debug) std::cout << " Choosing other cell" << std::endl;
Mesh::point_type tmpCell = otherCell;
Modified: short/3D/PyLith/trunk/libsrc/faults/CohesiveTopology.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/faults/CohesiveTopology.hh 2009-01-15 22:51:53 UTC (rev 13873)
+++ short/3D/PyLith/trunk/libsrc/faults/CohesiveTopology.hh 2009-01-16 01:05:52 UTC (rev 13874)
@@ -35,6 +35,7 @@
typedef std::vector<sieve_type::point_type> PointArray;
typedef std::pair<sieve_type::point_type, int> oPoint_type;
typedef std::vector<oPoint_type> oPointArray;
+
protected:
template<typename Sieve, typename Renumbering>
class ReplaceVisitor {
@@ -170,7 +171,8 @@
void createFault(Obj<SubMesh>& ifault,
Obj<ALE::Mesh>& faultBd,
const Obj<Mesh>& mesh,
- const Obj<Mesh::int_section_type>& groupField);
+ const Obj<Mesh::int_section_type>& groupField,
+ const bool flipFault =false);
/** Create cohesive cells.
*
@@ -186,8 +188,7 @@
const Obj<Mesh>& mesh,
const Obj<Mesh::int_section_type>& groupField,
const int materialId,
- const bool constraintCell =false,
- const bool flipFault =false);
+ const bool constraintCell =false);
/** Create (distributed) fault mesh from cohesive cells.
*
@@ -266,35 +267,40 @@
const ALE::Obj<Mesh::sieve_type>& sieve,
const Mesh::point_type& firstCohesiveCell);
- static void classifyCells(const ALE::Obj<Mesh::sieve_type>& sieve,
- const Mesh::point_type& vertex,
- const int depth,
- const int faceSize,
- const Mesh::point_type& firstCohesiveCell,
- PointSet& replaceCells,
- PointSet& noReplaceCells,
- const int debug);
+ static
+ void classifyCells(const ALE::Obj<Mesh::sieve_type>& sieve,
+ const Mesh::point_type& vertex,
+ const int depth,
+ const int faceSize,
+ const Mesh::point_type& firstCohesiveCell,
+ PointSet& replaceCells,
+ PointSet& noReplaceCells,
+ const int debug);
- static void createFaultSieveFromVertices(const int dim,
- const int firstCell,
- const PointSet& faultVertices,
- const Obj<Mesh>& mesh,
- const Obj<ALE::Mesh::arrow_section_type>& orientation,
- const Obj<ALE::Mesh::sieve_type>& faultSieve);
+ static
+ void createFaultSieveFromVertices(const int dim,
+ const int firstCell,
+ const PointSet& faultVertices,
+ const Obj<Mesh>& mesh,
+ const Obj<ALE::Mesh::arrow_section_type>& orientation,
+ const Obj<ALE::Mesh::sieve_type>& faultSieve,
+ const bool flipFault);
- static void createFaultSieveFromFaces(const int dim,
- const int firstCell,
- const int numFaces,
- const int faultVertices[],
- const int faultCells[],
- const Obj<Mesh>& mesh,
- const Obj<ALE::Mesh::arrow_section_type>& orientation,
- const Obj<ALE::Mesh::sieve_type>& faultSieve);
+ static
+ void createFaultSieveFromFaces(const int dim,
+ const int firstCell,
+ const int numFaces,
+ const int faultVertices[],
+ const int faultCells[],
+ const Obj<Mesh>& mesh,
+ const Obj<ALE::Mesh::arrow_section_type>& orientation,
+ const Obj<ALE::Mesh::sieve_type>& faultSieve);
- static void orientFaultSieve(const int dim,
- const Obj<Mesh>& mesh,
- const Obj<ALE::Mesh::arrow_section_type>& orientation,
- const Obj<ALE::Mesh>& fault);
+ static
+ void orientFaultSieve(const int dim,
+ const Obj<Mesh>& mesh,
+ const Obj<ALE::Mesh::arrow_section_type>& orientation,
+ const Obj<ALE::Mesh>& fault);
}; // class CohesiveTopology
#endif // pylith_faults_cohesivetopology_hh
Modified: short/3D/PyLith/trunk/libsrc/faults/FaultCohesive.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/faults/FaultCohesive.cc 2009-01-15 22:51:53 UTC (rev 13873)
+++ short/3D/PyLith/trunk/libsrc/faults/FaultCohesive.cc 2009-01-16 01:05:52 UTC (rev 13874)
@@ -59,7 +59,8 @@
// ----------------------------------------------------------------------
// Adjust mesh topology for fault implementation.
void
-pylith::faults::FaultCohesive::adjustTopology(const ALE::Obj<Mesh>& mesh, const bool flipFault)
+pylith::faults::FaultCohesive::adjustTopology(const ALE::Obj<Mesh>& mesh,
+ const bool flipFault)
{ // adjustTopology
assert(std::string("") != label());
Obj<SubMesh> faultMesh = NULL;
@@ -70,14 +71,17 @@
//MPI_Bcast(&faultDim, 1, MPI_INT, 0, comm);
faultMesh = new SubMesh(mesh->comm(), faultDim, mesh->debug());
- pylith::meshio::MeshIOLagrit::readFault(_faultMeshFilename, mesh, faultMesh, faultBd);
+ pylith::meshio::MeshIOLagrit::readFault(_faultMeshFilename, mesh,
+ faultMesh, faultBd);
// Get group of vertices associated with fault
const ALE::Obj<int_section_type>& groupField =
mesh->getIntSection(label());
- faultMesh->setRealSection("coordinates", mesh->getRealSection("coordinates"));
+ faultMesh->setRealSection("coordinates",
+ mesh->getRealSection("coordinates"));
- CohesiveTopology::create(faultMesh, faultBd, mesh, groupField, id(), _useLagrangeConstraints(), flipFault);
+ CohesiveTopology::create(faultMesh, faultBd, mesh, groupField, id(),
+ _useLagrangeConstraints());
} else {
if (!mesh->hasIntSection(label())) {
std::ostringstream msg;
@@ -91,12 +95,15 @@
mesh->getIntSection(label());
assert(!groupField.isNull());
- faultMesh = new SubMesh(mesh->comm(), mesh->getDimension()-1, mesh->debug());
+ faultMesh =
+ new SubMesh(mesh->comm(), mesh->getDimension()-1, mesh->debug());
- CohesiveTopology::createFault(faultMesh, faultBd, mesh, groupField);
+ CohesiveTopology::createFault(faultMesh, faultBd, mesh, groupField,
+ flipFault);
- CohesiveTopology::create(faultMesh, faultBd, mesh, groupField, id(), _useLagrangeConstraints(), flipFault);
- }
+ CohesiveTopology::create(faultMesh, faultBd, mesh, groupField, id(),
+ _useLagrangeConstraints());
+ } // if/else
} // adjustTopology
Modified: short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesive.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesive.cc 2009-01-15 22:51:53 UTC (rev 13873)
+++ short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesive.cc 2009-01-16 01:05:52 UTC (rev 13874)
@@ -237,7 +237,7 @@
CohesiveDataQuad4h data;
FaultCohesiveDyn faultA;
FaultCohesiveDyn faultB;
- _testAdjustTopology(&faultA, &faultB, data, false, false);
+ _testAdjustTopology(&faultA, &faultB, data, true, true);
} // testAdjustTopologyQuad4h
// ----------------------------------------------------------------------
@@ -307,7 +307,7 @@
{ // testAdjustTopologyTet4h
CohesiveDataTet4h data;
FaultCohesiveDyn fault;
- _testAdjustTopology(&fault, data, false);
+ _testAdjustTopology(&fault, data, true);
} // testAdjustTopologyTet4h
// ----------------------------------------------------------------------
@@ -317,7 +317,7 @@
{ // testAdjustTopologyTet4i
CohesiveDataTet4i data;
FaultCohesiveDyn fault;
- _testAdjustTopology(&fault, data, false);
+ _testAdjustTopology(&fault, data, true);
} // testAdjustTopologyTet4i
// ----------------------------------------------------------------------
@@ -327,7 +327,7 @@
{ // testAdjustTopologyTet4j
CohesiveDataTet4j data;
FaultCohesiveDyn fault;
- _testAdjustTopology(&fault, data, false);
+ _testAdjustTopology(&fault, data, true);
} // testAdjustTopologyTet4j
// ----------------------------------------------------------------------
@@ -337,7 +337,7 @@
{ // testAdjustTopologyHex8
CohesiveDataHex8 data;
FaultCohesiveDyn fault;
- _testAdjustTopology(&fault, data, false);
+ _testAdjustTopology(&fault, data, true);
} // testAdjustTopologyHex8
// ----------------------------------------------------------------------
@@ -347,7 +347,7 @@
{ // testAdjustTopologyHex8b
CohesiveDataHex8b data;
FaultCohesiveDyn fault;
- _testAdjustTopology(&fault, data, false);
+ _testAdjustTopology(&fault, data, true);
} // testAdjustTopologyHex8b
// ----------------------------------------------------------------------
@@ -387,7 +387,7 @@
{ // testAdjustTopologyHex8f
CohesiveDataHex8f data;
FaultCohesiveDyn fault;
- _testAdjustTopology(&fault, data, false);
+ _testAdjustTopology(&fault, data, true);
} // testAdjustTopologyHex8f
// ----------------------------------------------------------------------
@@ -397,7 +397,7 @@
{ // testAdjustTopologyHex8g
CohesiveDataHex8g data;
FaultCohesiveDyn fault;
- _testAdjustTopology(&fault, data, false);
+ _testAdjustTopology(&fault, data, true);
} // testAdjustTopologyHex8g
// ----------------------------------------------------------------------
@@ -472,7 +472,7 @@
{ // testAdjustTopologyHex8Lagrange
CohesiveDataHex8Lagrange data;
FaultCohesiveKin fault;
- _testAdjustTopology(&fault, data, false);
+ _testAdjustTopology(&fault, data, true);
} // testAdjustTopologyHex8Lagrange
// ----------------------------------------------------------------------
@@ -492,8 +492,8 @@
CPPUNIT_ASSERT(0 != fault);
fault->id(1);
fault->label("fault");
- mesh->setDebug(true);
fault->adjustTopology(mesh, flipFault);
+ //mesh->view(data.filename);
CPPUNIT_ASSERT_EQUAL(data.cellDim, mesh->getDimension());
@@ -533,7 +533,6 @@
ALE::ISieveVisitor::PointRetriever<Mesh::sieve_type> pV(sieve->getMaxConeSize());
int iCell = 0;
i = 0;
- mesh->view(data.filename);
for(Mesh::label_sequence::iterator c_iter = cells->begin();
c_iter != cells->end();
++c_iter) {
@@ -616,10 +615,11 @@
faultA->adjustTopology(mesh, flipFaultA);
CPPUNIT_ASSERT(0 != faultB);
- faultB->id(1);
+ faultB->id(2);
faultB->label("faultB");
faultB->adjustTopology(mesh, flipFaultB);
+ //mesh->view(data.filename);
CPPUNIT_ASSERT_EQUAL(data.cellDim, mesh->getDimension());
// Check vertices
Modified: short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesiveKinHex8.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesiveKinHex8.cc 2009-01-15 22:51:53 UTC (rev 13873)
+++ short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesiveKinHex8.cc 2009-01-16 01:05:52 UTC (rev 13874)
@@ -33,6 +33,8 @@
CPPUNIT_ASSERT(0 != _quadrature);
feassemble::GeometryQuad3D geometry;
_quadrature->refGeometry(&geometry);
+
+ _flipFault = true;
} // setUp
Modified: short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesiveKinQuad4e.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesiveKinQuad4e.cc 2009-01-15 22:51:53 UTC (rev 13873)
+++ short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesiveKinQuad4e.cc 2009-01-16 01:05:52 UTC (rev 13874)
@@ -33,6 +33,8 @@
CPPUNIT_ASSERT(0 != _quadrature);
feassemble::GeometryLine2D geometry;
_quadrature->refGeometry(&geometry);
+
+ _flipFault = true;
} // setUp
Modified: short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesiveKinSrcsHex8.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesiveKinSrcsHex8.cc 2009-01-15 22:51:53 UTC (rev 13873)
+++ short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesiveKinSrcsHex8.cc 2009-01-16 01:05:52 UTC (rev 13874)
@@ -33,6 +33,8 @@
CPPUNIT_ASSERT(0 != _quadrature);
feassemble::GeometryQuad3D geometry;
_quadrature->refGeometry(&geometry);
+
+ _flipFault = true;
} // setUp
Modified: short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesiveKinSrcsTri3.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesiveKinSrcsTri3.cc 2009-01-15 22:51:53 UTC (rev 13873)
+++ short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesiveKinSrcsTri3.cc 2009-01-16 01:05:52 UTC (rev 13874)
@@ -33,6 +33,8 @@
CPPUNIT_ASSERT(0 != _quadrature);
feassemble::GeometryLine2D geometry;
_quadrature->refGeometry(&geometry);
+
+ _flipFault = true;
} // setUp
Modified: short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesiveKinTri3d.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesiveKinTri3d.cc 2009-01-15 22:51:53 UTC (rev 13873)
+++ short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesiveKinTri3d.cc 2009-01-16 01:05:52 UTC (rev 13874)
@@ -33,6 +33,8 @@
CPPUNIT_ASSERT(0 != _quadrature);
feassemble::GeometryLine2D geometry;
_quadrature->refGeometry(&geometry);
+
+ _flipFault = true;
} // setUp
Modified: short/3D/PyLith/trunk/unittests/libtests/faults/data/CohesiveDataHex8i.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/faults/data/CohesiveDataHex8i.cc 2009-01-15 22:51:53 UTC (rev 13873)
+++ short/3D/PyLith/trunk/unittests/libtests/faults/data/CohesiveDataHex8i.cc 2009-01-16 01:05:52 UTC (rev 13874)
@@ -85,7 +85,7 @@
27, 28, 38, 37, 32, 33, 41, 40,
15, 14, 13, 24, 19, 18, 17, 26,
24, 23, 20, 21, 41, 40, 37, 38,
- 25, 24, 21, 22, 42, 41, 38, 39
+ 21, 22, 25, 24, 38, 39, 42, 41,
};
const int pylith::faults::CohesiveDataHex8i::_materialIds[] = {
Modified: short/3D/PyLith/trunk/unittests/libtests/faults/data/CohesiveDataQuad4h.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/faults/data/CohesiveDataQuad4h.cc 2009-01-15 22:51:53 UTC (rev 13873)
+++ short/3D/PyLith/trunk/unittests/libtests/faults/data/CohesiveDataQuad4h.cc 2009-01-16 01:05:52 UTC (rev 13874)
@@ -46,7 +46,7 @@
* | | | | |
* | | | | |
*30 ----31-----27-19 ----20
- * | 32 | |/ |
+ * | 32 | | |
*17 ----18 | |
* | | 7 | 8 |
* | 6 | | |
@@ -113,8 +113,8 @@
14, 31, 27, 26,
15, 19, 20, 16,
17, 21, 22, 18,
- 18, 22, 23, 27,
- 19, 23, 24, 20,
+ 31, 22, 23, 27,
+ 27, 23, 24, 20,
11, 15, 25, 26,
15, 19, 26, 27,
18, 17, 31, 30,
@@ -122,7 +122,7 @@
const int pylith::faults::CohesiveDataQuad4h::_materialIds[] = {
10, 10, 11, 10, 10, 11, 12, 12, 11,
- 1, 1, 1, 2, 2,
+ 1, 1, 2,
};
const int pylith::faults::CohesiveDataQuad4h::_numGroups = 2;
Modified: short/3D/PyLith/trunk/unittests/libtests/faults/data/CohesiveDataTet4i.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/faults/data/CohesiveDataTet4i.cc 2009-01-15 22:51:53 UTC (rev 13873)
+++ short/3D/PyLith/trunk/unittests/libtests/faults/data/CohesiveDataTet4i.cc 2009-01-16 01:05:52 UTC (rev 13874)
@@ -64,8 +64,8 @@
10, 12, 11, 9,
13, 9, 12, 10,
4, 5, 8, 7,
- 6, 5, 7, 11, 10, 12,
- 8, 7, 5, 13, 12, 10
+ 8, 7, 5, 13, 12, 10,
+ 7, 6, 5, 12, 11, 10,
};
const int pylith::faults::CohesiveDataTet4i::_materialIds[] = {
Modified: short/3D/PyLith/trunk/unittests/libtests/faults/data/CohesiveDataTri3d.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/faults/data/CohesiveDataTri3d.cc 2009-01-15 22:51:53 UTC (rev 13873)
+++ short/3D/PyLith/trunk/unittests/libtests/faults/data/CohesiveDataTri3d.cc 2009-01-16 01:05:52 UTC (rev 13874)
@@ -93,8 +93,8 @@
5, 6, 7,
12, 4, 10,
8, 5, 9,
+ 8, 5, 12, 10,
5, 6, 10, 11,
- 8, 5, 12, 10,
};
const int pylith::faults::CohesiveDataTri3d::_materialIds[] = {
More information about the CIG-COMMITS
mailing list