[cig-commits] r6571 - short/3D/PyLith/trunk/libsrc/faults
brad at geodynamics.org
brad at geodynamics.org
Fri Apr 13 21:14:58 PDT 2007
Author: brad
Date: 2007-04-13 21:14:57 -0700 (Fri, 13 Apr 2007)
New Revision: 6571
Modified:
short/3D/PyLith/trunk/libsrc/faults/FaultCohesive.cc
short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveKin.hh
short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveKin.icc
Log:
Implemented FaultCohesive::adjustTopology. Need to create basic unit tests for Fault stuff and add a fault to twotri3 example.
Modified: short/3D/PyLith/trunk/libsrc/faults/FaultCohesive.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/faults/FaultCohesive.cc 2007-04-14 02:02:55 UTC (rev 6570)
+++ short/3D/PyLith/trunk/libsrc/faults/FaultCohesive.cc 2007-04-14 04:14:57 UTC (rev 6571)
@@ -14,6 +14,13 @@
#include "FaultCohesive.hh" // implementation of object methods
+#include "pylith/utils/sievetypes.hh" // USES PETSc Mesh
+#include "src/dm/mesh/meshpylith.h" // USES ALE::PyLith::Builder
+
+#include <assert.h> // USES assert()
+#include <sstream> // USES std::ostringstream
+#include <stdexcept> // USES std::runtime_error
+
// ----------------------------------------------------------------------
// Default constructor.
pylith::faults::FaultCohesive::FaultCohesive(void)
@@ -38,6 +45,34 @@
void
pylith::faults::FaultCohesive::adjustTopology(ALE::Obj<ALE::Mesh>* mesh) const
{ // adjustTopology
+ assert(0 != mesh);
+ assert("" != label());
+
+ // Get group of vertices associated with fault
+ const ALE::Obj<int_section_type>& groupField =
+ (*mesh)->getIntSection(label());
+ assert(!groupField.isNull());
+ const int_section_type::chart_type& chart = groupField->getChart();
+ const Mesh::point_type firstPoint = *chart.begin();
+ ALE::Obj<Mesh::numbering_type> numbering;
+ if ((*mesh)->height(firstPoint) == 0) {
+ std::ostringstream msg;
+ msg << "Group associated with fault '" << label() << "' must contain "
+ << "vertices, not cells.";
+ throw std::runtime_error(msg.str());
+ } else
+ numbering = (*mesh)->getFactory()->getNumbering(*mesh, 0);
+
+ // Create set with vertices on fault
+ std::set<Mesh::point_type> points; // Vertices on fault
+ const int numCells = (*mesh)->heightStratum(0)->size();
+ for(int_section_type::chart_type::iterator c_iter = chart.begin();
+ c_iter != chart.end();
+ ++c_iter) {
+ assert(!numbering.isNull());
+ points.insert(numbering->getIndex(*c_iter)+numCells);
+ } // for
+ ALE::PyLith::Builder::createCohesiveElements(*mesh, points);
} // adjustTopology
Modified: short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveKin.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveKin.hh 2007-04-14 02:02:55 UTC (rev 6570)
+++ short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveKin.hh 2007-04-14 04:14:57 UTC (rev 6571)
@@ -16,8 +16,8 @@
* cohesive elements.
*/
-#if !defined(pylith_faults_faultcphesivekin_hh)
-#define pylith_faults_faultchesivekin_hh
+#if !defined(pylith_faults_faultcohesivekin_hh)
+#define pylith_faults_faultcohesivekin_hh
#include "FaultCohesive.hh"
@@ -71,6 +71,8 @@
}; // class FaultCohesiveKin
+#include "FaultCohesiveKin.icc" // inline methods
+
#endif // pylith_faults_faultcohesivekin_hh
Modified: short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveKin.icc
===================================================================
--- short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveKin.icc 2007-04-14 02:02:55 UTC (rev 6570)
+++ short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveKin.icc 2007-04-14 04:14:57 UTC (rev 6571)
@@ -11,7 +11,7 @@
//
#if !defined(pylith_faults_faultcohesivekin_hh)
-#error "Fault.icc can only be included from FaultCohesiveKin.hh"
+#error "FaultCohesiveKin.icc can only be included from FaultCohesiveKin.hh"
#endif
// Create copy of fault.
More information about the cig-commits
mailing list