[cig-commits] r14848 - in short/3D/PyLith/branches/pylith-swig: . examples/3d/hex8 libsrc/faults libsrc/problems modulesrc/problems pylith/faults unittests/pytests/faults

brad at geodynamics.org brad at geodynamics.org
Sat May 2 13:18:43 PDT 2009


Author: brad
Date: 2009-05-02 13:18:42 -0700 (Sat, 02 May 2009)
New Revision: 14848

Modified:
   short/3D/PyLith/branches/pylith-swig/TODO
   short/3D/PyLith/branches/pylith-swig/examples/3d/hex8/dislocation.cfg
   short/3D/PyLith/branches/pylith-swig/libsrc/faults/BruneSlipFn.cc
   short/3D/PyLith/branches/pylith-swig/libsrc/faults/ConstRateSlipFn.cc
   short/3D/PyLith/branches/pylith-swig/libsrc/faults/FaultCohesiveKin.cc
   short/3D/PyLith/branches/pylith-swig/libsrc/faults/LiuCosSlipFn.cc
   short/3D/PyLith/branches/pylith-swig/libsrc/faults/StepSlipFn.cc
   short/3D/PyLith/branches/pylith-swig/libsrc/problems/Formulation.cc
   short/3D/PyLith/branches/pylith-swig/libsrc/problems/Formulation.hh
   short/3D/PyLith/branches/pylith-swig/libsrc/problems/SolverNonlinear.cc
   short/3D/PyLith/branches/pylith-swig/modulesrc/problems/Formulation.i
   short/3D/PyLith/branches/pylith-swig/pylith/faults/Fault.py
   short/3D/PyLith/branches/pylith-swig/pylith/faults/FaultCohesiveKin.py
   short/3D/PyLith/branches/pylith-swig/unittests/pytests/faults/TestFaultCohesiveKin.py
Log:
Fixed bugs in field names for fault output.

Modified: short/3D/PyLith/branches/pylith-swig/TODO
===================================================================
--- short/3D/PyLith/branches/pylith-swig/TODO	2009-05-02 16:48:01 UTC (rev 14847)
+++ short/3D/PyLith/branches/pylith-swig/TODO	2009-05-02 20:18:42 UTC (rev 14848)
@@ -141,6 +141,7 @@
     material
      db -> properties_db
     no need to set Quadrature type
+    CellFilterAvg Mesh/SubMesh
 
 -- Release (v1.4) --
 

Modified: short/3D/PyLith/branches/pylith-swig/examples/3d/hex8/dislocation.cfg
===================================================================
--- short/3D/PyLith/branches/pylith-swig/examples/3d/hex8/dislocation.cfg	2009-05-02 16:48:01 UTC (rev 14847)
+++ short/3D/PyLith/branches/pylith-swig/examples/3d/hex8/dislocation.cfg	2009-05-02 20:18:42 UTC (rev 14848)
@@ -69,7 +69,6 @@
 
 [pylithapp.timedependent.interfaces.fault]
 label = 10
-quadrature = pylith.feassemble.quadrature.Quadrature2Din3D
 quadrature.cell = pylith.feassemble.FIATLagrange
 quadrature.cell.dimension = 2
 mat_db.iohandler.filename = mat_elastic.spatialdb
@@ -97,11 +96,11 @@
 
 # Give basename for VTK output of state variables.
 [pylithapp.timedependent.materials.elastic.output]
-cell_filter = pylith.meshio.CellFilterAvg
+cell_filter = pylith.meshio.CellFilterAvgMesh
 writer.filename = dislocation-statevars-elastic.vtk
 
 [pylithapp.timedependent.materials.viscoelastic.output]
 cell_info_fields = [density,mu,lambda,maxwell_time]
-cell_filter = pylith.meshio.CellFilterAvg
+cell_filter = pylith.meshio.CellFilterAvgMesh
 writer.filename = dislocation-statevars-viscoelastic.vtk
 

Modified: short/3D/PyLith/branches/pylith-swig/libsrc/faults/BruneSlipFn.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/faults/BruneSlipFn.cc	2009-05-02 16:48:01 UTC (rev 14847)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/faults/BruneSlipFn.cc	2009-05-02 20:18:42 UTC (rev 14848)
@@ -81,7 +81,7 @@
 
   delete _parameters; _parameters = new topology::Fields<topology::Field<topology::SubMesh> >(faultMesh);
   assert(0 != _parameters);
-  _parameters->add("final slip", "final slip");
+  _parameters->add("final slip", "final_slip");
   topology::Field<topology::SubMesh>& finalSlip =
     _parameters->get("final slip");
   finalSlip.newSection(vertices, spaceDim);
@@ -91,7 +91,7 @@
   const ALE::Obj<RealSection>& finalSlipSection = finalSlip.section();
   assert(!finalSlipSection.isNull());  
 
-  _parameters->add("slip time", "slip time");
+  _parameters->add("slip time", "slip_time");
   topology::Field<topology::SubMesh>& slipTime = _parameters->get("slip time");
   slipTime.newSection(finalSlipSection->getChart(), 1);
   slipTime.allocate();
@@ -100,7 +100,7 @@
   const ALE::Obj<RealSection>& slipTimeSection = slipTime.section();
   assert(!slipTimeSection.isNull());
 
-  _parameters->add("rise time", "rise time");
+  _parameters->add("rise time", "rise_time");
   topology::Field<topology::SubMesh>& riseTime = _parameters->get("rise time");
   riseTime.newSection(slipTime);
   riseTime.allocate();

Modified: short/3D/PyLith/branches/pylith-swig/libsrc/faults/ConstRateSlipFn.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/faults/ConstRateSlipFn.cc	2009-05-02 16:48:01 UTC (rev 14847)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/faults/ConstRateSlipFn.cc	2009-05-02 20:18:42 UTC (rev 14848)
@@ -79,7 +79,7 @@
 
   delete _parameters; _parameters = new topology::Fields<topology::Field<topology::SubMesh> >(faultMesh);
   assert(0 != _parameters);
-  _parameters->add("slip rate", "slip rate");
+  _parameters->add("slip rate", "slip_rate");
   topology::Field<topology::SubMesh>& slipRate = _parameters->get("slip rate");
   slipRate.newSection(vertices, spaceDim);
   slipRate.allocate();
@@ -88,7 +88,7 @@
   const ALE::Obj<RealSection>& slipRateSection = slipRate.section();
   assert(!slipRateSection.isNull());  
 
-  _parameters->add("slip time", "slip time");
+  _parameters->add("slip time", "slip_time");
   topology::Field<topology::SubMesh>& slipTime = _parameters->get("slip time");
   slipTime.newSection(slipRateSection->getChart(), 1);
   slipTime.allocate();

Modified: short/3D/PyLith/branches/pylith-swig/libsrc/faults/FaultCohesiveKin.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/faults/FaultCohesiveKin.cc	2009-05-02 16:48:01 UTC (rev 14847)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/faults/FaultCohesiveKin.cc	2009-05-02 20:18:42 UTC (rev 14848)
@@ -681,6 +681,7 @@
     _allocateBufferVectorField();
     assert(0 != _bufferVectorField);
     _bufferVectorField->copy(dirSection);
+    _bufferVectorField->label("strike_dir");
     return *_bufferVectorField;
 
   } else if (2 == cohesiveDim && 0 == strcasecmp("dip_dir", name)) {
@@ -692,6 +693,7 @@
     _allocateBufferVectorField();
     assert(0 != _bufferVectorField);
     _bufferVectorField->copy(dirSection);
+    _bufferVectorField->label("dip_dir");
     return *_bufferVectorField;
 
   } else if (0 == strcasecmp("normal_dir", name)) {
@@ -706,6 +708,7 @@
     _allocateBufferVectorField();
     assert(0 != _bufferVectorField);
     _bufferVectorField->copy(dirSection);
+    _bufferVectorField->label("normal_dir");
     return *_bufferVectorField;
 
   } else if (0 == strncasecmp("final_slip_X", name, slipStrLen)) {
@@ -726,7 +729,9 @@
     const topology::Field<topology::Mesh>& solution = fields->solution();
     _allocateBufferVectorField();
     _calcTractionsChange(_bufferVectorField, solution);
-    
+    _bufferVectorField->label("traction_change");
+    return *_bufferVectorField;
+
   } else {
     std::ostringstream msg;
     msg << "Request for unknown vertex field '" << name

Modified: short/3D/PyLith/branches/pylith-swig/libsrc/faults/LiuCosSlipFn.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/faults/LiuCosSlipFn.cc	2009-05-02 16:48:01 UTC (rev 14847)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/faults/LiuCosSlipFn.cc	2009-05-02 20:18:42 UTC (rev 14848)
@@ -81,7 +81,7 @@
 
   delete _parameters; _parameters = new topology::Fields<topology::Field<topology::SubMesh> >(faultMesh);
   assert(0 != _parameters);
-  _parameters->add("final slip", "final slip");
+  _parameters->add("final slip", "final_slip");
   topology::Field<topology::SubMesh>& finalSlip =
     _parameters->get("final slip");
   finalSlip.newSection(vertices, spaceDim);
@@ -91,7 +91,7 @@
   const ALE::Obj<RealSection>& finalSlipSection = finalSlip.section();
   assert(!finalSlipSection.isNull());  
 
-  _parameters->add("slip time", "slip time");
+  _parameters->add("slip time", "slip_time");
   topology::Field<topology::SubMesh>& slipTime = _parameters->get("slip time");
   slipTime.newSection(finalSlipSection->getChart(), 1);
   slipTime.allocate();
@@ -100,7 +100,7 @@
   const ALE::Obj<RealSection>& slipTimeSection = slipTime.section();
   assert(!slipTimeSection.isNull());
 
-  _parameters->add("rise time", "rise time");
+  _parameters->add("rise time", "rise_time");
   topology::Field<topology::SubMesh>& riseTime = _parameters->get("rise time");
   riseTime.newSection(slipTime);
   riseTime.allocate();

Modified: short/3D/PyLith/branches/pylith-swig/libsrc/faults/StepSlipFn.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/faults/StepSlipFn.cc	2009-05-02 16:48:01 UTC (rev 14847)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/faults/StepSlipFn.cc	2009-05-02 20:18:42 UTC (rev 14848)
@@ -77,7 +77,7 @@
 
   delete _parameters; _parameters = new topology::Fields<topology::Field<topology::SubMesh> >(faultMesh);
   assert(0 != _parameters);
-  _parameters->add("final slip", "final slip");
+  _parameters->add("final slip", "final_slip");
   topology::Field<topology::SubMesh>& finalSlip = _parameters->get("final slip");
   finalSlip.newSection(vertices, spaceDim);
   finalSlip.allocate();
@@ -86,7 +86,7 @@
   const ALE::Obj<RealSection>& finalSlipSection = finalSlip.section();
   assert(!finalSlipSection.isNull());  
 
-  _parameters->add("slip time", "slip time");
+  _parameters->add("slip time", "slip_time");
   topology::Field<topology::SubMesh>& slipTime = _parameters->get("slip time");
   slipTime.newSection(finalSlipSection->getChart(), 1);
   slipTime.allocate();

Modified: short/3D/PyLith/branches/pylith-swig/libsrc/problems/Formulation.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/problems/Formulation.cc	2009-05-02 16:48:01 UTC (rev 14847)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/problems/Formulation.cc	2009-05-02 20:18:42 UTC (rev 14848)
@@ -90,15 +90,15 @@
 // ----------------------------------------------------------------------
 // Reform system residual.
 void
-pylith::problems::Formulation::reformResidual(const PetscVec tmpResidualVec,
-					      const PetscVec tmpSolveSolnVec)
+pylith::problems::Formulation::reformResidual(const PetscVec* tmpResidualVec,
+					      const PetscVec* tmpSolveSolnVec)
 { // reformResidual
   assert(0 != _fields);
 
   // Update section view of field.
   if (0 != tmpSolveSolnVec) {
     topology::Field<topology::Mesh>& solveSoln = _fields->solveSoln();
-    solveSoln.scatterVectorToSection(tmpSolveSolnVec);
+    solveSoln.scatterVectorToSection(*tmpSolveSolnVec);
   } // if
 
   // Set residual to zero.
@@ -131,20 +131,20 @@
 
   // Update PETSc view of residual
   if (0 != tmpResidualVec)
-    residual.scatterSectionToVector(tmpResidualVec);
+    residual.scatterSectionToVector(*tmpResidualVec);
   else
     residual.scatterSectionToVector();
 
   // TODO: Move this to SolverLinear 
   //residual *= -1.0;
   if (0 != tmpResidualVec)
-    VecScale(tmpResidualVec, -1.0);
+    VecScale(*tmpResidualVec, -1.0);
 } // reformResidual
 
 // ----------------------------------------------------------------------
 // Reform system Jacobian.
 void
-pylith::problems::Formulation::reformJacobian(const PetscVec tmpSolveSolnVec)
+pylith::problems::Formulation::reformJacobian(const PetscVec* tmpSolveSolnVec)
 { // reformJacobian
   assert(0 != _jacobian);
   assert(0 != _fields);
@@ -152,7 +152,7 @@
   // Update section view of field.
   if (0 != tmpSolveSolnVec) {
     topology::Field<topology::Mesh>& solveSoln = _fields->solveSoln();
-    solveSoln.scatterVectorToSection(tmpSolveSolnVec);
+    solveSoln.scatterVectorToSection(*tmpSolveSolnVec);
   } // if
 
   // Set residual to zero.

Modified: short/3D/PyLith/branches/pylith-swig/libsrc/problems/Formulation.hh
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/problems/Formulation.hh	2009-05-02 16:48:01 UTC (rev 14847)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/problems/Formulation.hh	2009-05-02 20:18:42 UTC (rev 14848)
@@ -85,14 +85,14 @@
    * @param tmpResidualVec Temporary PETSc vector for residual.
    * @param tmpSolveSolnVec Temporary PETSc vector for solution.
    */
-  void reformResidual(const PetscVec tmpResidualVec =0,
-		      const PetscVec tmpSolveSolnVec =0);
+  void reformResidual(const PetscVec* tmpResidualVec =0,
+		      const PetscVec* tmpSolveSolnVec =0);
   
   /* Reform system Jacobian.
    *
    * @param tmpSolveSolnVec Temporary PETSc vector for solution.
    */
-  void reformJacobian(const PetscVec tmpSolveSolnVec =0);
+  void reformJacobian(const PetscVec* tmpSolveSolnVec =0);
 
 // PRIVATE MEMBERS //////////////////////////////////////////////////////
 private :

Modified: short/3D/PyLith/branches/pylith-swig/libsrc/problems/SolverNonlinear.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/problems/SolverNonlinear.cc	2009-05-02 16:48:01 UTC (rev 14847)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/problems/SolverNonlinear.cc	2009-05-02 20:18:42 UTC (rev 14848)
@@ -112,7 +112,7 @@
   assert(0 != formulation);
 
   // Reform residual
-  formulation->reformResidual(tmpResidualVec, tmpSolutionVec);
+  formulation->reformResidual(&tmpResidualVec, &tmpSolutionVec);
 
   return 0;
 } // reformResidual
@@ -132,7 +132,7 @@
   Formulation* formulation = (Formulation*) context;
   assert(0 != formulation);
 
-  formulation->reformJacobian(tmpSolutionVec);
+  formulation->reformJacobian(&tmpSolutionVec);
 
   return 0;
 } // reformJacobian

Modified: short/3D/PyLith/branches/pylith-swig/modulesrc/problems/Formulation.i
===================================================================
--- short/3D/PyLith/branches/pylith-swig/modulesrc/problems/Formulation.i	2009-05-02 16:48:01 UTC (rev 14847)
+++ short/3D/PyLith/branches/pylith-swig/modulesrc/problems/Formulation.i	2009-05-02 20:18:42 UTC (rev 14848)
@@ -65,14 +65,14 @@
        * @param tmpResidualVec Temporary PETSc vector for residual.
        * @param tmpSolveSolnVec Temporary PETSc vector for solution.
        */
-      void reformResidual(const PetscVec tmpResidualVec =0,
-			  const PetscVec tmpSolveSolnVec =0);
+      void reformResidual(const PetscVec* tmpResidualVec =0,
+			  const PetscVec* tmpSolveSolnVec =0);
       
       /* Reform system Jacobian.
        *
        * @param tmpSolveSolnVec Temporary PETSc vector for solution.
        */
-      void reformJacobian(const PetscVec tmpSolveSolnVec =0);
+      void reformJacobian(const PetscVec* tmpSolveSolnVec =0);
       
     }; // Formulation
 

Modified: short/3D/PyLith/branches/pylith-swig/pylith/faults/Fault.py
===================================================================
--- short/3D/PyLith/branches/pylith-swig/pylith/faults/Fault.py	2009-05-02 16:48:01 UTC (rev 14847)
+++ short/3D/PyLith/branches/pylith-swig/pylith/faults/Fault.py	2009-05-02 20:18:42 UTC (rev 14848)
@@ -72,12 +72,12 @@
 
   import pyre.inventory
   
-  id = pyre.inventory.int("id", default=100)
-  id.meta['tip'] = "Fault identifier (must be unique across all faults " \
+  matId = pyre.inventory.int("id", default=100)
+  matId.meta['tip'] = "Fault identifier (must be unique across all faults " \
       "and materials)."
   
-  label = pyre.inventory.str("label", default="")
-  label.meta['tip'] = "Name of fault."
+  faultLabel = pyre.inventory.str("label", default="")
+  faultLabel.meta['tip'] = "Name of fault."
   
   upDir = pyre.inventory.list("up_dir", default=[0, 0, 1],
                               validator=validateDir)
@@ -178,7 +178,7 @@
     self._logger.eventBegin(logEvent)
 
     self._info.log("Writing fault data.")
-    #self.output.writeData(t+dt, fields)
+    self.output.writeData(t+dt, fields)
 
     self._logger.eventEnd(logEvent)
     return
@@ -218,8 +218,8 @@
     self.upDir = map(float, self.inventory.upDir)
     self.normalDir = map(float, self.inventory.normalDir)
     self.matDB = self.inventory.matDB
-    ModuleFault.id(self, self.inventory.id)
-    ModuleFault.label(self, self.inventory.label)
+    ModuleFault.id(self, self.inventory.matId)
+    ModuleFault.label(self, self.inventory.faultLabel)
     return
 
   

Modified: short/3D/PyLith/branches/pylith-swig/pylith/faults/FaultCohesiveKin.py
===================================================================
--- short/3D/PyLith/branches/pylith-swig/pylith/faults/FaultCohesiveKin.py	2009-05-02 16:48:01 UTC (rev 14847)
+++ short/3D/PyLith/branches/pylith-swig/pylith/faults/FaultCohesiveKin.py	2009-05-02 20:18:42 UTC (rev 14848)
@@ -96,7 +96,7 @@
     """
     Do pre-initialization setup.
     """
-    self._info.log("Pre-initializing fault '%s'." % self.label)
+    self._info.log("Pre-initializing fault '%s'." % self.label())
     FaultCohesive.preinitialize(self, mesh)
     Integrator.preinitialize(self, mesh)
 
@@ -143,7 +143,7 @@
     """
     logEvent = "%sinit" % self._loggingPrefix
     self._logger.eventBegin(logEvent)
-    self._info.log("Initializing fault '%s'." % self.label)
+    self._info.log("Initializing fault '%s'." % self.label())
 
     Integrator.initialize(self, totalTime, numTimeSteps, normalizer)
     

Modified: short/3D/PyLith/branches/pylith-swig/unittests/pytests/faults/TestFaultCohesiveKin.py
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/pytests/faults/TestFaultCohesiveKin.py	2009-05-02 16:48:01 UTC (rev 14847)
+++ short/3D/PyLith/branches/pylith-swig/unittests/pytests/faults/TestFaultCohesiveKin.py	2009-05-02 20:18:42 UTC (rev 14848)
@@ -104,8 +104,8 @@
     mesh = importer.read(normalizer, debug=False, interpolate=False)
 
     fault = FaultCohesiveKin()
-    fault.inventory.id = 10
-    fault.inventory.label = "fault"
+    fault.inventory.matId = 10
+    fault.inventory.faultLabel = "fault"
     fault._configure()
 
     fault.adjustTopology(mesh)
@@ -322,8 +322,8 @@
     fault = FaultCohesiveKin()
     fault.inventory.output.inventory.writer._configure()
     fault.inventory.output._configure()
-    fault.inventory.id = 10
-    fault.inventory.label = "fault"
+    fault.inventory.matId = 10
+    fault.inventory.faultLabel = "fault"
     fault.inventory.upDir = [0, 0, 1]
     fault.inventory.normalDir = [1, 0, 0]
     fault.inventory.quadrature = quadrature



More information about the CIG-COMMITS mailing list