[cig-commits] r12612 - short/3D/PyLith/trunk/libsrc/materials

brad at geodynamics.org brad at geodynamics.org
Tue Aug 12 13:06:44 PDT 2008


Author: brad
Date: 2008-08-12 13:06:44 -0700 (Tue, 12 Aug 2008)
New Revision: 12612

Modified:
   short/3D/PyLith/trunk/libsrc/materials/ElasticMaterial.cc
   short/3D/PyLith/trunk/libsrc/materials/Material.cc
Log:
Fixed initialization and testing of value of _initialState.

Modified: short/3D/PyLith/trunk/libsrc/materials/ElasticMaterial.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/materials/ElasticMaterial.cc	2008-08-12 20:06:18 UTC (rev 12611)
+++ short/3D/PyLith/trunk/libsrc/materials/ElasticMaterial.cc	2008-08-12 20:06:44 UTC (rev 12612)
@@ -181,21 +181,21 @@
   const int totalPropsQuadPt = _totalPropsQuadPt;
   assert(_propertiesCell.size() == numQuadPts*totalPropsQuadPt);  
   assert(_properties->getFiberDimension(cell) == numQuadPts*totalPropsQuadPt);
-  assert(_initialStateCell.size() == numQuadPts*_initialStateSize);  
+  assert(_initialStateCell.size() == numQuadPts*_initialStateSize);
   const real_section_type::value_type* parameterCell =
     _properties->restrictPoint(cell);
   memcpy(&_propertiesCell[0], parameterCell, 
 		      numQuadPts*totalPropsQuadPt*sizeof(double));
-  if (0 != _initialState) {
+  if (_initialState.isNull())
+    _initialStateCell = 0.0;
+  else {
     assert(_initialState->getFiberDimension(cell) == numQuadPts*_initialStateSize);
     const real_section_type::value_type* initialStateValuesCell =
       _initialState->restrictPoint(cell);
     memcpy(&_initialStateCell[0], initialStateValuesCell, 
 	   numQuadPts*_initialStateSize*sizeof(double));
-  } else {
-    for (int iVal=0; iVal < _initialStateSize*numQuadPts; ++iVal)
-      _initialStateCell[iVal] = 0.0;
-  } // if
+  } // else
+
 } // _getProperties
 
 // ----------------------------------------------------------------------

Modified: short/3D/PyLith/trunk/libsrc/materials/Material.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/materials/Material.cc	2008-08-12 20:06:18 UTC (rev 12611)
+++ short/3D/PyLith/trunk/libsrc/materials/Material.cc	2008-08-12 20:06:44 UTC (rev 12612)
@@ -114,7 +114,7 @@
 
   // If initial state is being used, create a section to hold it.
   if (0 == _initialStateDB)
-    _initialState = NULL;
+    assert(_initialState.isNull());
   else {
     _initialState = new real_section_type(mesh->comm(), mesh->debug());
     assert(!_initialState.isNull());



More information about the cig-commits mailing list