[cig-commits] r12470 - short/3D/PyLith/trunk/libsrc/feassemble

willic3 at geodynamics.org willic3 at geodynamics.org
Thu Jul 24 07:29:02 PDT 2008


Author: willic3
Date: 2008-07-24 07:29:01 -0700 (Thu, 24 Jul 2008)
New Revision: 12470

Modified:
   short/3D/PyLith/trunk/libsrc/feassemble/ElasticityImplicit.cc
Log:
Moved queryVals outside of cell loop.



Modified: short/3D/PyLith/trunk/libsrc/feassemble/ElasticityImplicit.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/feassemble/ElasticityImplicit.cc	2008-07-24 13:17:38 UTC (rev 12469)
+++ short/3D/PyLith/trunk/libsrc/feassemble/ElasticityImplicit.cc	2008-07-24 14:29:01 UTC (rev 12470)
@@ -172,6 +172,23 @@
   const int cellVecSize = numBasis*spaceDim;
   double_array dispTBctpdtCell(cellVecSize);
 
+  // Set up gravity field database for querying
+  if (0 != _gravityField) {
+    _gravityField->open();
+    if (1 == spaceDim){
+      const char* queryNames[] = { "x"};
+      _gravityField->queryVals(queryNames, spaceDim);
+    } else if (2 == spaceDim){
+      const char* queryNames[] = { "x", "y"};
+      _gravityField->queryVals(queryNames, spaceDim);
+    } else if (3 == spaceDim){
+      const char* queryNames[] = { "x", "y", "z"};
+      _gravityField->queryVals(queryNames, spaceDim);
+    } else {
+      assert(0);
+    } // else
+  } // if
+
   // Allocate vector for total strain
   double_array totalStrain(numQuadPts*tensorSize);
   totalStrain = 0.0;
@@ -213,20 +230,6 @@
     // Compute body force vector if gravity is being used.
     if (0 != _gravityField) {
 
-      // Make sure coordinate names exist in gravity field.
-      _gravityField->open();
-      if (1 == spaceDim){
-	const char* queryNames[] = { "x"};
-	_gravityField->queryVals(queryNames, spaceDim);
-      } else if (2 == spaceDim){
-	const char* queryNames[] = { "x", "y"};
-	_gravityField->queryVals(queryNames, spaceDim);
-      } else if (3 == spaceDim){
-        const char* queryNames[] = { "x", "y", "z"};
-	_gravityField->queryVals(queryNames, spaceDim);
-      } else
-	assert(0);
-
       // Get density at quadrature points for this cell
       const double_array& density = _material->calcDensity();
 



More information about the cig-commits mailing list