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

brad at geodynamics.org brad at geodynamics.org
Fri Mar 12 17:12:54 PST 2010


Author: brad
Date: 2010-03-12 17:12:53 -0800 (Fri, 12 Mar 2010)
New Revision: 16408

Modified:
   short/3D/PyLith/trunk/libsrc/feassemble/ElasticityExplicit.cc
Log:
Better error trap.

Modified: short/3D/PyLith/trunk/libsrc/feassemble/ElasticityExplicit.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/feassemble/ElasticityExplicit.cc	2010-03-13 01:12:12 UTC (rev 16407)
+++ short/3D/PyLith/trunk/libsrc/feassemble/ElasticityExplicit.cc	2010-03-13 01:12:53 UTC (rev 16408)
@@ -140,23 +140,30 @@
   // Set variables dependent on dimension of cell
   totalStrain_fn_type calcTotalStrainFn;
   elasticityResidual_fn_type elasticityResidualFn;
-  if (1 == cellDim) {
+  switch (cellDim) {
+  case 1 :
     elasticityResidualFn = 
       &pylith::feassemble::ElasticityExplicit::_elasticityResidual1D;
     calcTotalStrainFn = 
       &pylith::feassemble::IntegratorElasticity::_calcTotalStrain1D;
-  } else if (2 == cellDim) {
+    break;
+  case 2 :
     elasticityResidualFn = 
       &pylith::feassemble::ElasticityExplicit::_elasticityResidual2D;
     calcTotalStrainFn = 
       &pylith::feassemble::IntegratorElasticity::_calcTotalStrain2D;
-  } else if (3 == cellDim) {
+    break;
+  case 3 :
     elasticityResidualFn = 
       &pylith::feassemble::ElasticityExplicit::_elasticityResidual3D;
     calcTotalStrainFn = 
       &pylith::feassemble::IntegratorElasticity::_calcTotalStrain3D;
-  } else
+    break;
+  default :
     assert(0);
+    throw std::logic_error("Unknown cellDim in "
+			   "ElasticityExplicit::integrateResidual.");
+  } // switch
 
   // Allocate vectors for cell values.
   double_array dispTCell(numBasis*spaceDim);



More information about the CIG-COMMITS mailing list