[cig-commits] r18225 - in short/3D/PyLith/branches/v1.5-stable: libsrc/meshio libsrc/topology pylith/feassemble pylith/problems
brad at geodynamics.org
brad at geodynamics.org
Mon Apr 11 12:50:33 PDT 2011
Author: brad
Date: 2011-04-11 12:50:33 -0700 (Mon, 11 Apr 2011)
New Revision: 18225
Modified:
short/3D/PyLith/branches/v1.5-stable/libsrc/meshio/MeshIO.cc
short/3D/PyLith/branches/v1.5-stable/libsrc/topology/Mesh.cc
short/3D/PyLith/branches/v1.5-stable/pylith/feassemble/FIATLagrange.py
short/3D/PyLith/branches/v1.5-stable/pylith/problems/Problem.py
Log:
Improved error checking for dimension of problem, cells, and coordinate system.
Modified: short/3D/PyLith/branches/v1.5-stable/libsrc/meshio/MeshIO.cc
===================================================================
--- short/3D/PyLith/branches/v1.5-stable/libsrc/meshio/MeshIO.cc 2011-04-11 18:09:31 UTC (rev 18224)
+++ short/3D/PyLith/branches/v1.5-stable/libsrc/meshio/MeshIO.cc 2011-04-11 19:50:33 UTC (rev 18225)
@@ -23,8 +23,6 @@
#include "pylith/topology/Mesh.hh" // USES Mesh
#include "pylith/utils/array.hh" // USES double_array, int_array
-#include "spatialdata/geocoords/CoordSys.hh" // USES CoordSys
-
#include "Selection.hh" // USES boundary()
#include <cassert> // USES assert()
Modified: short/3D/PyLith/branches/v1.5-stable/libsrc/topology/Mesh.cc
===================================================================
--- short/3D/PyLith/branches/v1.5-stable/libsrc/topology/Mesh.cc 2011-04-11 18:09:31 UTC (rev 18224)
+++ short/3D/PyLith/branches/v1.5-stable/libsrc/topology/Mesh.cc 2011-04-11 19:50:33 UTC (rev 18225)
@@ -116,33 +116,30 @@
const SieveMesh::label_sequence::iterator verticesEnd =
vertices->end();
- assert(0 != _coordsys);
- const int spaceDim = _coordsys->spaceDim();
- double_array coordsVertex(spaceDim);
- double_array coordsDimVertex(spaceDim);
-
- int i = 0;
+ double coordsVertex[3];
for (SieveMesh::label_sequence::iterator v_iter=verticesBegin;
v_iter != verticesEnd;
++v_iter) {
- coordsSection->restrictPoint(*v_iter,
- &coordsVertex[0], coordsVertex.size());
+ const int spaceDim = coordsSection->getFiberDimension(*v_iter);
+ assert(spaceDim <= 3);
+ const double* coordsDimVertex = coordsSection->restrictPoint(*v_iter);
+
+ // Update section with dimensioned coordinates
+ assert(spaceDim ==
+ coordsDimSection->getFiberDimension(*v_iter));
+ coordsDimSection->updatePoint(*v_iter, coordsDimVertex);
- // Save dimensioned coordinates in coordsDimVertex
- coordsDimVertex = coordsVertex;
+ // Copy coordinates to array for nondimensionalization.
+ for (int i=0; i < spaceDim; ++i)
+ coordsVertex[i] = coordsDimVertex[i];
// Nondimensionalize original coordinates.
normalizer.nondimensionalize(&coordsVertex[0], spaceDim, lengthScale);
-
+
// Update section with nondimensional coordinates
- assert(coordsVertex.size() ==
+ assert(spaceDim ==
coordsSection->getFiberDimension(*v_iter));
- coordsSection->updatePoint(*v_iter, &coordsVertex[0]);
-
- // Update section with dimensioned coordinates
- assert(coordsDimVertex.size() ==
- coordsDimSection->getFiberDimension(*v_iter));
- coordsDimSection->updatePoint(*v_iter, &coordsDimVertex[0]);
+ coordsSection->updatePoint(*v_iter, coordsVertex);
} // for
} // nondimensionalize
Modified: short/3D/PyLith/branches/v1.5-stable/pylith/feassemble/FIATLagrange.py
===================================================================
--- short/3D/PyLith/branches/v1.5-stable/pylith/feassemble/FIATLagrange.py 2011-04-11 18:09:31 UTC (rev 18224)
+++ short/3D/PyLith/branches/v1.5-stable/pylith/feassemble/FIATLagrange.py 2011-04-11 19:50:33 UTC (rev 18225)
@@ -445,8 +445,9 @@
elif 3 == spaceDim:
self.geometry = CellGeometry.GeometryPoint3D()
if None == self.geometry:
- raise ValueError("Could not set shape of cell for '%s' in spatial " \
- "dimension '%s'." % (self.name, spaceDim))
+ raise ValueError("Could not set shape of %dD cell for "
+ "Quadrature object '%s' in spatial " \
+ "dimension '%d'." % (self.cellDim, self.name, spaceDim))
return
Modified: short/3D/PyLith/branches/v1.5-stable/pylith/problems/Problem.py
===================================================================
--- short/3D/PyLith/branches/v1.5-stable/pylith/problems/Problem.py 2011-04-11 18:09:31 UTC (rev 18224)
+++ short/3D/PyLith/branches/v1.5-stable/pylith/problems/Problem.py 2011-04-11 19:50:33 UTC (rev 18225)
@@ -151,6 +151,12 @@
"for spatial dimension '%d'." % \
(self.dimension, self.mesh.dimension())
+ if self.dimension != self.mesh.coordsys().spaceDim():
+ raise ValueError, \
+ "Spatial dimension of problem is '%d' but mesh coordinate system " \
+ "is for spatial dimension '%d'." % \
+ (self.dimension, self.mesh.coordsys().spaceDim())
+
# Check to make sure ids of materials and interfaces are unique
materialIds = {}
for material in self.materials.components():
More information about the CIG-COMMITS
mailing list