[cig-commits] r22568 - in short/3D/PyLith/trunk: libsrc/pylith/faults libsrc/pylith/friction libsrc/pylith/materials libsrc/pylith/meshio libsrc/pylith/problems pylith/problems
brad at geodynamics.org
brad at geodynamics.org
Thu Jul 11 12:41:57 PDT 2013
Author: brad
Date: 2013-07-11 12:41:57 -0700 (Thu, 11 Jul 2013)
New Revision: 22568
Modified:
short/3D/PyLith/trunk/libsrc/pylith/faults/FaultCohesiveDyn.cc
short/3D/PyLith/trunk/libsrc/pylith/faults/FaultCohesiveImpulses.cc
short/3D/PyLith/trunk/libsrc/pylith/faults/FaultCohesiveKin.cc
short/3D/PyLith/trunk/libsrc/pylith/faults/FaultCohesiveLagrange.cc
short/3D/PyLith/trunk/libsrc/pylith/friction/FrictionModel.cc
short/3D/PyLith/trunk/libsrc/pylith/materials/ElasticMaterial.cc
short/3D/PyLith/trunk/libsrc/pylith/materials/Material.cc
short/3D/PyLith/trunk/libsrc/pylith/meshio/OutputSolnPoints.cc
short/3D/PyLith/trunk/libsrc/pylith/problems/Formulation.cc
short/3D/PyLith/trunk/libsrc/pylith/problems/SolverLumped.cc
short/3D/PyLith/trunk/pylith/problems/Explicit.py
short/3D/PyLith/trunk/pylith/problems/Implicit.py
Log:
Use Field::zeroAll() instead of Field::zero() where possible due to differences in efficiency.
Modified: short/3D/PyLith/trunk/libsrc/pylith/faults/FaultCohesiveDyn.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/faults/FaultCohesiveDyn.cc 2013-07-11 02:25:45 UTC (rev 22567)
+++ short/3D/PyLith/trunk/libsrc/pylith/faults/FaultCohesiveDyn.cc 2013-07-11 19:41:57 UTC (rev 22568)
@@ -54,6 +54,8 @@
#include <sstream> // USES std::ostringstream
#include <stdexcept> // USES std::runtime_error
+//#define DETAILED_EVENT_LOGGING
+
// ----------------------------------------------------------------------
// Default constructor.
pylith::faults::FaultCohesiveDyn::FaultCohesiveDyn(void) :
@@ -1462,7 +1464,7 @@
const PylithScalar pressureScale = _normalizer->pressureScale();
tractions->label("traction");
tractions->scale(pressureScale);
- tractions->zero();
+ tractions->zeroAll();
topology::VecVisitorMesh tractionsVisitor(*tractions);
PetscScalar* tractionsArray = tractionsVisitor.localArray();
@@ -1610,7 +1612,7 @@
dispRel.cloneSection(solution);
} // if
topology::Field& dispRel = _fields->get("sensitivity relative disp");
- dispRel.zero();
+ dispRel.zeroAll();
if (!_fields->hasField("sensitivity dLagrange")) {
_fields->add("sensitivity dLagrange", "sensitivity_dlagrange");
@@ -1618,7 +1620,7 @@
dLagrange.cloneSection(solution);
} // if
topology::Field& dLagrange = _fields->get("sensitivity dLagrange");
- dLagrange.zero();
+ dLagrange.zeroAll();
// Setup Jacobian sparse matrix for sensitivity solve.
if (!_jacobian) {
@@ -1828,7 +1830,7 @@
scalar_array residualCell(numBasis*spaceDim);
topology::Field& residual = _fields->get("sensitivity residual");
topology::VecVisitorMesh residualVisitor(residual);
- residual.zero();
+ residual.zeroAll();
// Loop over cells
for(PetscInt c = cStart; c < cEnd; ++c) {
Modified: short/3D/PyLith/trunk/libsrc/pylith/faults/FaultCohesiveImpulses.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/faults/FaultCohesiveImpulses.cc 2013-07-11 02:25:45 UTC (rev 22567)
+++ short/3D/PyLith/trunk/libsrc/pylith/faults/FaultCohesiveImpulses.cc 2013-07-11 19:41:57 UTC (rev 22568)
@@ -174,7 +174,7 @@
_logger->eventBegin(setupEvent);
topology::Field& dispRel = _fields->get("relative disp");
- dispRel.zero();
+ dispRel.zeroAll();
// Set impulse corresponding to current time.
_setRelativeDisp(dispRel, int(t+0.1));
Modified: short/3D/PyLith/trunk/libsrc/pylith/faults/FaultCohesiveKin.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/faults/FaultCohesiveKin.cc 2013-07-11 02:25:45 UTC (rev 22567)
+++ short/3D/PyLith/trunk/libsrc/pylith/faults/FaultCohesiveKin.cc 2013-07-11 19:41:57 UTC (rev 22568)
@@ -135,7 +135,7 @@
_logger->eventBegin(setupEvent);
topology::Field& dispRel = _fields->get("relative disp");
- dispRel.zero();
+ dispRel.zeroAll();
// Compute slip field at current time step
const srcs_type::const_iterator srcsEnd = _eqSrcs.end();
for (srcs_type::iterator s_iter = _eqSrcs.begin(); s_iter != srcsEnd; ++s_iter) {
Modified: short/3D/PyLith/trunk/libsrc/pylith/faults/FaultCohesiveLagrange.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/faults/FaultCohesiveLagrange.cc 2013-07-11 02:25:45 UTC (rev 22567)
+++ short/3D/PyLith/trunk/libsrc/pylith/faults/FaultCohesiveLagrange.cc 2013-07-11 19:41:57 UTC (rev 22568)
@@ -1310,7 +1310,7 @@
if (spaceDim > 2) orientation.updateDof("dip_dir", pylith::topology::FieldBase::VERTICES_FIELD, spaceDim);
orientation.updateDof("normal_dir", pylith::topology::FieldBase::VERTICES_FIELD, spaceDim);
orientation.allocate();
- orientation.zero();
+ orientation.zeroAll();
topology::VecVisitorMesh orientationVisitor(orientation);
PetscScalar* orientationArray = orientationVisitor.localArray();
@@ -1563,7 +1563,7 @@
area.vectorFieldType(topology::FieldBase::SCALAR);
const PylithScalar lengthScale = _normalizer->lengthScale();
area.scale(pow(lengthScale, (spaceDim-1)));
- area.zero();
+ area.zeroAll();
topology::VecVisitorMesh areaVisitor(area);
scalar_array areaCell(numBasis);
@@ -1639,7 +1639,7 @@
const topology::Field& dispRel = _fields->get("relative disp");
tractions->cloneSection(dispRel);
} // if
- tractions->zero();
+ tractions->zeroAll();
topology::VecVisitorMesh tractionsVisitor(*tractions);
PetscScalar* tractionsArray = tractionsVisitor.localArray();
@@ -1696,7 +1696,7 @@
const topology::Field& dispRel =
_fields->get("relative disp");
buffer.cloneSection(dispRel);
- buffer.zero();
+ buffer.zeroAll();
assert(buffer.vectorFieldType() == topology::FieldBase::VECTOR);
PYLITH_METHOD_END;
@@ -1721,7 +1721,7 @@
buffer.allocate();
buffer.vectorFieldType(topology::FieldBase::SCALAR);
buffer.scale(1.0);
- buffer.zero();
+ buffer.zeroAll();
assert(buffer.vectorFieldType() == topology::FieldBase::SCALAR);
PYLITH_METHOD_END;
Modified: short/3D/PyLith/trunk/libsrc/pylith/friction/FrictionModel.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/friction/FrictionModel.cc 2013-07-11 02:25:45 UTC (rev 22567)
+++ short/3D/PyLith/trunk/libsrc/pylith/friction/FrictionModel.cc 2013-07-11 19:41:57 UTC (rev 22568)
@@ -499,7 +499,7 @@
propertyField.allocate();
propertyField.vectorFieldType(property.fieldType);
propertyField.scale(propertiesVertex[iScale]);
- propertyField.zero();
+ propertyField.zeroAll();
iScale += property.fiberDim;
} // for
@@ -512,7 +512,7 @@
stateVarField.allocate();
stateVarField.vectorFieldType(stateVar.fieldType);
stateVarField.scale(stateVarsVertex[iScale]);
- stateVarField.zero();
+ stateVarField.zeroAll();
iScale += stateVar.fiberDim;
} // for
assert(_varsFiberDim >= 0);
Modified: short/3D/PyLith/trunk/libsrc/pylith/materials/ElasticMaterial.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/materials/ElasticMaterial.cc 2013-07-11 02:25:45 UTC (rev 22567)
+++ short/3D/PyLith/trunk/libsrc/pylith/materials/ElasticMaterial.cc 2013-07-11 19:41:57 UTC (rev 22568)
@@ -583,7 +583,7 @@
int_array cellsTmp(cells, numCells);
initialStress.newSection(cellsTmp, fiberDim);
initialStress.allocate();
- initialStress.zero();
+ initialStress.zeroAll();
topology::VecVisitorMesh stressVisitor(initialStress);
// Setup databases for querying
@@ -715,7 +715,7 @@
int_array cellsTmp(cells, numCells);
initialStrain.newSection(cellsTmp, fiberDim);
initialStrain.allocate();
- initialStrain.zero();
+ initialStrain.zeroAll();
topology::VecVisitorMesh strainVisitor(initialStrain);
// Setup databases for querying
Modified: short/3D/PyLith/trunk/libsrc/pylith/materials/Material.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/materials/Material.cc 2013-07-11 02:25:45 UTC (rev 22567)
+++ short/3D/PyLith/trunk/libsrc/pylith/materials/Material.cc 2013-07-11 19:41:57 UTC (rev 22568)
@@ -142,7 +142,7 @@
_properties->newSection(cellsTmp, propsFiberDim);
_properties->allocate();
- _properties->zero();
+ _properties->zeroAll();
topology::VecVisitorMesh propertiesVisitor(*_properties);
PetscScalar* propertiesArray = propertiesVisitor.localArray();
@@ -174,7 +174,7 @@
assert(_properties);
_stateVars->newSection(*_properties, stateVarsFiberDim);
_stateVars->allocate();
- _stateVars->zero();
+ _stateVars->zeroAll();
stateVarsVisitor = new topology::VecVisitorMesh(*_stateVars);
stateVarsArray = stateVarsVisitor->localArray();
} // if
Modified: short/3D/PyLith/trunk/libsrc/pylith/meshio/OutputSolnPoints.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/meshio/OutputSolnPoints.cc 2013-07-11 02:25:45 UTC (rev 22567)
+++ short/3D/PyLith/trunk/libsrc/pylith/meshio/OutputSolnPoints.cc 2013-07-11 19:41:57 UTC (rev 22568)
@@ -255,10 +255,10 @@
fieldInterp.allocate();
} // if
- fieldInterp.zero();
fieldInterp.label(field.label());
fieldInterp.vectorFieldType(field.vectorFieldType());
fieldInterp.scale(field.scale());
+ fieldInterp.zeroAll();
const char* context = fieldName.c_str();
fieldInterp.createScatter(*_pointsMesh, context);
Modified: short/3D/PyLith/trunk/libsrc/pylith/problems/Formulation.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/problems/Formulation.cc 2013-07-11 02:25:45 UTC (rev 22567)
+++ short/3D/PyLith/trunk/libsrc/pylith/problems/Formulation.cc 2013-07-11 19:41:57 UTC (rev 22568)
@@ -208,7 +208,7 @@
// Set residual to zero.
topology::Field& residual = _fields->get("residual");
- residual.zero();
+ residual.zeroAll();
// Add in contributions that require assembly.
const int numIntegrators = _integrators.size();
@@ -291,7 +291,7 @@
assert(_fields);
// Set jacobian to zero.
- _jacobianLumped->zero();
+ _jacobianLumped->zeroAll();
// Add in contributions that require assembly.
const int numIntegrators = _integrators.size();
@@ -323,7 +323,7 @@
adjust.cloneSection(solution);
} // for
topology::Field& adjust = _fields->get("dispIncr adjust");
- adjust.zero();
+ adjust.zeroAll();
// Update section view of field.
if (tmpSolutionVec) {
@@ -364,7 +364,7 @@
adjust.cloneSection(solution);
} // for
topology::Field& adjust = _fields->get("dispIncr adjust");
- adjust.zero();
+ adjust.zeroAll();
const int numIntegrators = _integrators.size();
for (int i=0; i < numIntegrators; ++i) {
Modified: short/3D/PyLith/trunk/libsrc/pylith/problems/SolverLumped.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/problems/SolverLumped.cc 2013-07-11 02:25:45 UTC (rev 22567)
+++ short/3D/PyLith/trunk/libsrc/pylith/problems/SolverLumped.cc 2013-07-11 19:41:57 UTC (rev 22568)
@@ -161,7 +161,6 @@
_logger->registerEvent("SoLu solve");
_logger->registerEvent("SoLu adjust");
-
PYLITH_METHOD_END;
} // initializeLogger
Modified: short/3D/PyLith/trunk/pylith/problems/Explicit.py
===================================================================
--- short/3D/PyLith/trunk/pylith/problems/Explicit.py 2013-07-11 02:25:45 UTC (rev 22567)
+++ short/3D/PyLith/trunk/pylith/problems/Explicit.py 2013-07-11 19:41:57 UTC (rev 22568)
@@ -125,11 +125,11 @@
# Setup fields and set to zero
dispTmdt = self.fields.get("disp(t-dt)")
- dispTmdt.zero()
+ dispTmdt.zeroAll()
dispT = self.fields.get("disp(t)")
- dispT.zero()
+ dispT.zeroAll()
residual = self.fields.get("residual")
- residual.zero()
+ residual.zeroAll()
residual.createScatter(residual.mesh())
lengthScale = normalizer.lengthScale()
@@ -137,12 +137,12 @@
velocityScale = lengthScale / timeScale
velocityT = self.fields.get("velocity(t)")
velocityT.scale(velocityScale.value)
- velocityT.zero()
+ velocityT.zeroAll()
accelerationScale = velocityScale / timeScale
accelerationT = self.fields.get("acceleration(t)")
accelerationT.scale(accelerationScale.value)
- accelerationT.zero()
+ accelerationT.zeroAll()
self._debug.log(resourceUsageString())
#memoryLogger.stagePop()
@@ -197,9 +197,6 @@
"""
Advance to next time step.
"""
- logEvent = "%sstep" % self._loggingPrefix
- self._eventLogger.eventBegin(logEvent)
-
from pylith.mpi.Communicator import mpi_comm_world
comm = mpi_comm_world()
@@ -207,11 +204,11 @@
if 0 == comm.rank:
self._info.log("Solving equations.")
+
residual = self.fields.get("residual")
dispIncr = self.fields.get("dispIncr(t->t+dt)")
self.solver.solve(dispIncr, self.jacobian, residual)
- self._eventLogger.eventEnd(logEvent)
return
@@ -242,7 +239,7 @@
dispTmdt.copy(dispT)
dispT.add(dispIncr)
- dispIncr.zero()
+ dispIncr.zeroAll()
# Complete post-step processing.
Formulation.poststep(self, t, dt)
@@ -261,7 +258,7 @@
if 0 == comm.rank:
self._info.log("Setting constraints.")
disp = self.fields.get("dispIncr(t->t+dt)")
- disp.zero()
+ disp.zeroAll()
for constraint in self.constraints:
constraint.setField(t+dt, disp)
Modified: short/3D/PyLith/trunk/pylith/problems/Implicit.py
===================================================================
--- short/3D/PyLith/trunk/pylith/problems/Implicit.py 2013-07-11 02:25:45 UTC (rev 22567)
+++ short/3D/PyLith/trunk/pylith/problems/Implicit.py 2013-07-11 19:41:57 UTC (rev 22568)
@@ -139,9 +139,9 @@
# Setup fields and set to zero
dispT = self.fields.get("disp(t)")
- dispT.zero()
+ dispT.zeroAll()
residual = self.fields.get("residual")
- residual.zero()
+ residual.zeroAll()
residual.createScatter(residual.mesh())
lengthScale = normalizer.lengthScale()
@@ -149,7 +149,7 @@
velocityScale = lengthScale / timeScale
velocityT = self.fields.get("velocity(t)")
velocityT.scale(velocityScale.value)
- velocityT.zero()
+ velocityT.zeroAll()
self._debug.log(resourceUsageString())
#memoryLogger.stagePop()
@@ -185,7 +185,7 @@
if 0 == comm.rank:
self._info.log("Setting constraints.")
dispIncr = self.fields.get("dispIncr(t->t+dt)")
- dispIncr.zero()
+ dispIncr.zeroAll()
for constraint in self.constraints:
constraint.setFieldIncr(t, t+dt, dispIncr)
@@ -213,8 +213,9 @@
if 0 == comm.rank:
self._info.log("Solving equations.")
+ self._eventLogger.stagePush("Solve")
+
residual = self.fields.get("residual")
- self._eventLogger.stagePush("Solve")
#self.jacobian.view() # TEMPORARY
self.solver.solve(dispIncr, self.jacobian, residual)
#dispIncr.view("DISP INCR") # TEMPORARY
@@ -239,7 +240,7 @@
dispIncr = self.fields.get("dispIncr(t->t+dt)")
disp = self.fields.get("disp(t)")
disp.add(dispIncr)
- dispIncr.zero()
+ dispIncr.zeroAll()
# Complete post-step processing, then write data.
Formulation.poststep(self, t, dt)
@@ -265,7 +266,7 @@
if 0 == comm.rank:
self._info.log("Setting constraints.")
disp = self.fields.get("dispIncr(t->t+dt)")
- disp.zero()
+ disp.zeroAll()
for constraint in self.constraints:
constraint.setField(t+dt, disp)
More information about the CIG-COMMITS
mailing list