[cig-commits] r11653 - short/3D/PyLith/trunk/libsrc/faults

brad at geodynamics.org brad at geodynamics.org
Sun Mar 30 23:39:25 PDT 2008


Author: brad
Date: 2008-03-30 23:39:25 -0700 (Sun, 30 Mar 2008)
New Revision: 11653

Modified:
   short/3D/PyLith/trunk/libsrc/faults/BruneSlipFn.cc
   short/3D/PyLith/trunk/libsrc/faults/BruneSlipFn.icc
   short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveKin.cc
   short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveKin.hh
Log:
Fixed bug in output of sections. Use temporary handle for fibrations and other objects. Use buffer for objects not managed elsewhere.

Modified: short/3D/PyLith/trunk/libsrc/faults/BruneSlipFn.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/faults/BruneSlipFn.cc	2008-03-31 06:38:16 UTC (rev 11652)
+++ short/3D/PyLith/trunk/libsrc/faults/BruneSlipFn.cc	2008-03-31 06:39:25 UTC (rev 11653)
@@ -203,11 +203,11 @@
   // Get vertices in fault mesh
   const ALE::Obj<Mesh::label_sequence>& vertices = faultMesh->depthStratum(0);
   const Mesh::label_sequence::iterator verticesEnd = vertices->end();
+  const int numVertices = vertices->size();
 
-  int count = 0;
   for (Mesh::label_sequence::iterator v_iter=vertices->begin();
        v_iter != verticesEnd;
-       ++v_iter, ++count) {
+       ++v_iter) {
     const real_section_type::value_type* paramsVertex = 
       _parameters->restrictPoint(*v_iter);
     assert(0 != paramsVertex);
@@ -230,7 +230,7 @@
     _slip->updatePoint(*v_iter, &slipValues[0]);
   } // for
 
-  PetscLogFlopsNoCheck(count * (2+8 + 3*spaceDim));
+  PetscLogFlopsNoCheck(numVertices * (2+8 + 3*spaceDim));
 
   return _slip;
 } // slip

Modified: short/3D/PyLith/trunk/libsrc/faults/BruneSlipFn.icc
===================================================================
--- short/3D/PyLith/trunk/libsrc/faults/BruneSlipFn.icc	2008-03-31 06:38:16 UTC (rev 11652)
+++ short/3D/PyLith/trunk/libsrc/faults/BruneSlipFn.icc	2008-03-31 06:39:25 UTC (rev 11653)
@@ -45,7 +45,7 @@
 				     const double finalSlip,
 				     const double peakRate) {
   double slip = 0.0;
-  if (t > 0) {
+  if (t > 0.0) {
     assert(peakRate > 0.0);
     const double tau = 
       // prevent 0 == tau when 0 == finalSlip 

Modified: short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveKin.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveKin.cc	2008-03-31 06:38:16 UTC (rev 11652)
+++ short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveKin.cc	2008-03-31 06:39:25 UTC (rev 11653)
@@ -434,30 +434,30 @@
     return _slip;
 
   } else if (cohesiveDim > 0 && 0 == strcasecmp("strike_dir", name)) {
-    _bufferVertexVector = _orientation->getFibration(0);
+    _bufferTmp = _orientation->getFibration(0);
     *fieldType = VECTOR_FIELD;
-    return _bufferVertexVector;
+    return _bufferTmp;
 
   } else if (2 == cohesiveDim && 0 == strcasecmp("dip_dir", name)) {
-    _bufferVertexVector = _orientation->getFibration(1);
+    _bufferTmp = _orientation->getFibration(1);
     *fieldType = VECTOR_FIELD;
-    return _bufferVertexVector;
+    return _bufferTmp;
 
   } else if (0 == strcasecmp("normal_dir", name)) {
     const int space = 
       (0 == cohesiveDim) ? 0 : (1 == cohesiveDim) ? 1 : 2;
-    _bufferVertexVector = _orientation->getFibration(space);
+    _bufferTmp = _orientation->getFibration(space);
     *fieldType = VECTOR_FIELD;
-    return _bufferVertexVector;
+    return _bufferTmp;
 
   } else if (0 == strcasecmp("final_slip", name)) {
-    _bufferVertexVector = _eqsrc->finalSlip();
+    _bufferTmp = _eqsrc->finalSlip();
     *fieldType = VECTOR_FIELD;
-    return _bufferVertexVector;
+    return _bufferTmp;
   } else if (0 == strcasecmp("slip_time", name)) {
-    _bufferVertexScalar = _eqsrc->slipTime();
+    _bufferTmp = _eqsrc->slipTime();
     *fieldType = SCALAR_FIELD;
-    return _bufferVertexScalar;
+    return _bufferTmp;
   } else if (0 == strcasecmp("traction_change", name)) {
     *fieldType = VECTOR_FIELD;
     const ALE::Obj<real_section_type>& solution = fields->getSolution();
@@ -858,7 +858,6 @@
 				 const ALE::Obj<real_section_type>& solution)
 { // _calcTractionsChange
   assert(0 != tractions);
-  assert(!tractions->isNull());
   assert(!solution.isNull());
   assert(!_faultMesh.isNull());
   assert(!_pseudoStiffness.isNull());
@@ -873,6 +872,14 @@
   const int fiberDim = solution->getFiberDimension(*vertices->begin());
   double_array tractionValues(fiberDim);
 
+  // Allocate buffer for tractions field (if nec.).
+  if (tractions->isNull() ||
+      fiberDim != (*tractions)->getFiberDimension(*vertices->begin())) {
+    *tractions = new real_section_type(_faultMesh->comm(), _faultMesh->debug());
+    (*tractions)->setFiberDimension(vertices, fiberDim);
+    _faultMesh->allocate(*tractions);
+  } // if
+  
   for (Mesh::label_sequence::iterator v_iter=vertices->begin();
        v_iter != verticesEnd;
        ++v_iter) {

Modified: short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveKin.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveKin.hh	2008-03-31 06:38:16 UTC (rev 11652)
+++ short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveKin.hh	2008-03-31 06:39:25 UTC (rev 11653)
@@ -253,6 +253,9 @@
   /// Vector field for vertex information over fault mesh.
   ALE::Obj<real_section_type> _bufferVertexVector;
 
+  /// Handle to field managed elsewhere for data over fault mesh.
+  ALE::Obj<real_section_type> _bufferTmp;
+
 }; // class FaultCohesiveKin
 
 #include "FaultCohesiveKin.icc" // inline methods



More information about the cig-commits mailing list