[cig-commits] r14440 - short/3D/PyLith/branches/pylith-swig/libsrc/topology
brad at geodynamics.org
brad at geodynamics.org
Tue Mar 24 18:06:31 PDT 2009
Author: brad
Date: 2009-03-24 18:06:30 -0700 (Tue, 24 Mar 2009)
New Revision: 14440
Modified:
short/3D/PyLith/branches/pylith-swig/libsrc/topology/Field.cc
Log:
Added check for empty sequence.
Modified: short/3D/PyLith/branches/pylith-swig/libsrc/topology/Field.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/topology/Field.cc 2009-03-24 23:31:28 UTC (rev 14439)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/topology/Field.cc 2009-03-25 01:06:30 UTC (rev 14440)
@@ -94,12 +94,18 @@
_section = new RealSection(_mesh.comm(), _mesh.debug());
- const point_type pointMin =
- *std::min_element(points->begin(), points->end());
- const point_type pointMax =
- *std::max_element(points->begin(), points->end());
- _section->setChart(chart_type(pointMin, pointMax+1));
- _section->setFiberDimension(points, fiberDim);
+ if (points.size() > 0) {
+ const point_type pointMin =
+ *std::min_element(points->begin(), points->end());
+ const point_type pointMax =
+ *std::max_element(points->begin(), points->end());
+ _section->setChart(chart_type(pointMin, pointMax+1));
+ _section->setFiberDimension(points, fiberDim);
+ } else {
+ // Create empty chart
+ _section->setChart(chart_type(0, 0));
+ _section->setFiberDimension(points, fiberDim);
+ } // if/else
} // newSection
// ----------------------------------------------------------------------
More information about the CIG-COMMITS
mailing list