Commit e08245f2 authored by Payton Oliveri (Cont ARL/CISD) poliveri's avatar Payton Oliveri (Cont ARL/CISD) poliveri Committed by Brian Panneton

Added XdmfError Replaced asserts with XdmfError::messages

parent 0aa88318
......@@ -12,6 +12,7 @@ swig -v -c++ -python -o XdmfPython.cpp Xdmf.i
#include <XdmfArrayType.hpp>
#include <XdmfCoreItemFactory.hpp>
#include <XdmfCoreReader.hpp>
#include <XdmfError.hpp>
#include <XdmfHDF5Controller.hpp>
#include <XdmfHDF5Writer.hpp>
#ifdef XDMF_BUILD_DSM
......
......@@ -24,6 +24,7 @@
#include "XdmfAttribute.hpp"
#include "XdmfAttributeCenter.hpp"
#include "XdmfAttributeType.hpp"
#include "XdmfError.hpp"
boost::shared_ptr<XdmfAttribute>
XdmfAttribute::New()
......@@ -92,7 +93,7 @@ XdmfAttribute::populateItem(const std::map<std::string, std::string> & itemPrope
mName = name->second;
}
else {
assert(false);
XdmfError::message(XdmfError::FATAL,"'Name' not found in itemProperties in XdmfAttribute::populateItem");
}
mCenter = XdmfAttributeCenter::New(itemProperties);
......
......@@ -22,6 +22,7 @@
/*****************************************************************************/
#include "XdmfAttributeCenter.hpp"
#include "XdmfError.hpp"
// Supported XdmfAttributeCenters
boost::shared_ptr<const XdmfAttributeCenter>
......@@ -96,10 +97,10 @@ XdmfAttributeCenter::New(const std::map<std::string, std::string> & itemProperti
return Node();
}
else {
assert(false);
XdmfError::message(XdmfError::FATAL, "Center not of 'Grid','Cell','Face','Edge','Node' in XdmfAttributeCenter::New");
}
}
assert(false);
XdmfError::message(XdmfError::FATAL, "'Center' not found in itemProperties in XdmfAttributeCenter::New");
return boost::shared_ptr<const XdmfAttributeCenter>();
}
......
......@@ -22,6 +22,7 @@
/*****************************************************************************/
#include "XdmfAttributeType.hpp"
#include "XdmfError.hpp"
// Supported XdmfAttributeTypes
boost::shared_ptr<const XdmfAttributeType>
......@@ -121,10 +122,10 @@ XdmfAttributeType::New(const std::map<std::string, std::string> & itemProperties
return GlobalId();
}
else {
assert(false);
XdmfError::message(XdmfError::FATAL, "Type not of 'None','Scalar','Vector','Tensor','Matrix','Tensor6', or 'GlobalId' in XdmfAttributeType::New");
}
}
assert(false);
XdmfError::message(XdmfError::FATAL, "Neither 'Type' nor 'AttributeType' found in itemProperties in XdmfAttributeType::New");
return boost::shared_ptr<const XdmfAttributeType>();
}
......
......@@ -27,6 +27,7 @@
#include "XdmfGeometry.hpp"
#include "XdmfTopology.hpp"
#include "XdmfTopologyType.hpp"
#include "XdmfError.hpp"
/**
* PIMPL
......@@ -108,7 +109,7 @@ public:
collectedProperties["Type"] = "2DSMesh";
}
else {
assert(false);
XdmfError::message(XdmfError::FATAL, "Grid dimensions not 2 or 3 in XdmfTopologyTypeCurvilinear::getProperties");
}
collectedProperties["Dimensions"] = dimensions->getValuesString();
}
......
......@@ -22,6 +22,7 @@
/*****************************************************************************/
#include "XdmfGeometryType.hpp"
#include "XdmfError.hpp"
// Supported XdmfGeometryTypes
boost::shared_ptr<const XdmfGeometryType>
......@@ -80,10 +81,10 @@ XdmfGeometryType::New(const std::map<std::string, std::string> & itemProperties)
return XY();
}
else {
assert(false);
XdmfError::message(XdmfError::FATAL, "Type not 'None', 'XYZ', or 'XY' in XdmfGeometryType::New");
}
}
assert(false);
XdmfError::message(XdmfError::FATAL, "Neither 'Type' nor 'GeometryType' in itemProperties in XdmfGeometryType::New");
return boost::shared_ptr<const XdmfGeometryType>();
}
......
......@@ -22,6 +22,7 @@
/*****************************************************************************/
#include "XdmfGridCollectionType.hpp"
#include "XdmfError.hpp"
// Supported XdmfGridCollectionTypes
boost::shared_ptr<const XdmfGridCollectionType>
......@@ -74,10 +75,10 @@ XdmfGridCollectionType::New(const std::map<std::string, std::string> & itemPrope
return Temporal();
}
else {
assert(false);
XdmfError::message(XdmfError::FATAL, "'CollectionType' not of 'None', 'Spatial', or 'Temporal' in XdmfGridCollectionType::New");
}
}
assert(false);
XdmfError::message(XdmfError::FATAL, "'CollectionType' not in itemProperties in XdmfGridCollectionType::New");
return boost::shared_ptr<const XdmfGridCollectionType>();
}
......
......@@ -26,6 +26,7 @@
#include "XdmfGridCollectionType.hpp"
#include "XdmfHeavyDataController.hpp"
#include "XdmfMap.hpp"
#include "XdmfError.hpp"
boost::shared_ptr<XdmfMap>
XdmfMap::New()
......@@ -167,9 +168,11 @@ XdmfMap::populateItem(const std::map<std::string, std::string> & itemProperties,
arrayVector.push_back(array);
}
}
assert(arrayVector.size() == 3);
assert(arrayVector[0]->getSize() == arrayVector[1]->getSize() &&
arrayVector[0]->getSize() == arrayVector[2]->getSize());
if(arrayVector.size() != 3)
XdmfError::message(XdmfError::FATAL, "Length of array vector not equal to 3 in XdmfMap::populateItem");
if(!(arrayVector[0]->getSize() == arrayVector[1]->getSize() &&
arrayVector[0]->getSize() == arrayVector[2]->getSize()))
XdmfError::message(XdmfError::FATAL, "Length of individual array vectors not equal in XdmfMap::populateItem");
bool needToRead = false;
for(std::vector<boost::shared_ptr<XdmfArray> >::const_iterator iter =
arrayVector.begin();
......@@ -206,10 +209,11 @@ XdmfMap::read()
if(mLocalNodeIdsController &&
mRemoteTaskIdsController &&
mRemoteLocalNodeIdsController) {
assert(mLocalNodeIdsController->getSize() ==
if(!(mLocalNodeIdsController->getSize() ==
mRemoteTaskIdsController->getSize() &&
mLocalNodeIdsController->getSize() ==
mRemoteLocalNodeIdsController->getSize());
mRemoteLocalNodeIdsController->getSize()))
XdmfError::message(XdmfError::FATAL, "Number of local nodes not equal to number of remote tasks or nodes in XdmfMap::read");
boost::shared_ptr<XdmfArray> globalNodeIds = XdmfArray::New();
boost::shared_ptr<XdmfArray> taskIds = XdmfArray::New();
boost::shared_ptr<XdmfArray> localNodeIds = XdmfArray::New();
......@@ -245,10 +249,11 @@ XdmfMap::setHeavyDataControllers(boost::shared_ptr<XdmfHeavyDataController> loca
boost::shared_ptr<XdmfHeavyDataController> remoteTaskIdsController,
boost::shared_ptr<XdmfHeavyDataController> remoteLocalNodeIdsController)
{
assert(localNodeIdsController->getSize() ==
if(!(localNodeIdsController->getSize() ==
remoteTaskIdsController->getSize() &&
localNodeIdsController->getSize() ==
remoteLocalNodeIdsController->getSize());
remoteLocalNodeIdsController->getSize()))
XdmfError::message(XdmfError::FATAL, "Number of local nodes not equal to number of remote tasks or nodes in XdmfMap::read");
mLocalNodeIdsController = localNodeIdsController;
mRemoteTaskIdsController = remoteTaskIdsController;
mRemoteLocalNodeIdsController = remoteLocalNodeIdsController;
......
......@@ -28,6 +28,7 @@
#include "XdmfRectilinearGrid.hpp"
#include "XdmfTopology.hpp"
#include "XdmfTopologyType.hpp"
#include "XdmfError.hpp"
/**
* PIMPL
......@@ -118,7 +119,7 @@ public:
collectedProperties["Type"] = "VXVY";
}
else {
assert(false);
XdmfError::message(XdmfError::FATAL, "Number of dimensions not 2 or 3 in XdmfGeometryTypeRectilinear::getProperties");
}
}
......@@ -207,7 +208,7 @@ public:
collectedProperties["Type"] = "2DRectMesh";
}
else {
assert(false);
XdmfError::message(XdmfError::FATAL, "Number of dimensions not 2 or 3 in XdmfTopologyTypeRectilinear::getProperties");
}
collectedProperties["Dimensions"] = dimensions->getValuesString();
}
......
......@@ -28,6 +28,7 @@
#include "XdmfRegularGrid.hpp"
#include "XdmfTopology.hpp"
#include "XdmfTopologyType.hpp"
#include "XdmfError.hpp"
/**
* PIMPL
......@@ -114,7 +115,7 @@ public:
collectedProperties["Type"] = "ORIGIN_DXDY";
}
else {
assert(false);
XdmfError::message(XdmfError::FATAL, "Dimensions not 2 or 3 in XdmfGeometryTypeRegular::getProperties");
}
}
......@@ -203,7 +204,7 @@ public:
collectedProperties["Type"] = "2DCoRectMesh";
}
else {
assert(false);
XdmfError::message(XdmfError::FATAL, "Dimensions not 2 or 3 in XdmfTopologyTypeRegular::getProperties");
}
collectedProperties["Dimensions"] = dimensions->getValuesString();
}
......
......@@ -25,6 +25,7 @@
#include "XdmfHDF5Controller.hpp"
#include "XdmfSet.hpp"
#include "XdmfSetType.hpp"
#include "XdmfError.hpp"
XDMF_CHILDREN_IMPLEMENTATION(XdmfSet, XdmfAttribute, Attribute, Name)
......@@ -86,7 +87,7 @@ XdmfSet::populateItem(const std::map<std::string, std::string> & itemProperties,
mName = name->second;
}
else {
assert(false);
XdmfError::message(XdmfError::FATAL, "'Name' not found in itemProperties in XdmfSet::populateItem");
}
mType = XdmfSetType::New(itemProperties);
for(std::vector<boost::shared_ptr<XdmfItem> >::const_iterator iter =
......
......@@ -22,6 +22,7 @@
/*****************************************************************************/
#include "XdmfSetType.hpp"
#include "XdmfError.hpp"
// Supported XdmfSetTypes
boost::shared_ptr<const XdmfSetType>
......@@ -94,10 +95,10 @@ XdmfSetType::New(const std::map<std::string, std::string> & itemProperties)
return Edge();
}
else {
assert(false);
XdmfError::message(XdmfError::FATAL, "Type not of 'None', 'Node', 'Cell', 'Face', or 'Edge' in XdmfSetType::New");
}
}
assert(false);
XdmfError::message(XdmfError::FATAL, "Neither 'Type' nor 'SetType' found in itemProperties in XdmfSetType::New");
return boost::shared_ptr<const XdmfSetType>();
}
......
......@@ -23,6 +23,7 @@
#include <sstream>
#include "XdmfTime.hpp"
#include "XdmfError.hpp"
boost::shared_ptr<XdmfTime>
XdmfTime::New(const double & value)
......@@ -76,7 +77,7 @@ XdmfTime::populateItem(const std::map<std::string, std::string> & itemProperties
mValue = atof(value->second.c_str());
}
else {
assert(false);
XdmfError::message(XdmfError::FATAL, "'Value' not in itemProperties in XdmfTime::populateItem");
}
}
......
......@@ -24,6 +24,7 @@
#include <cctype>
#include <sstream>
#include "XdmfTopologyType.hpp"
#include "XdmfError.hpp"
// Supported XdmfTopologyTypes
boost::shared_ptr<const XdmfTopologyType>
......@@ -287,7 +288,7 @@ XdmfTopologyType::New(const std::map<std::string, std::string> & itemProperties)
if(nodesPerElement != itemProperties.end()) {
return Polygon(atoi(nodesPerElement->second.c_str()));
}
assert(false);
XdmfError::message(XdmfError::FATAL, "'NodesPerElement' not in itemProperties and type 'POLYGON' selected in XdmfTopologyType::New");
}
else if(typeVal.compare("TRIANGLE") == 0) {
return Triangle();
......@@ -341,10 +342,10 @@ XdmfTopologyType::New(const std::map<std::string, std::string> & itemProperties)
return Mixed();
}
else {
assert(false);
XdmfError::message(XdmfError::FATAL, "Invalid Type selected in XdmfTopologyType::New");
}
}
assert(false);
XdmfError::message(XdmfError::FATAL, "Neither 'Type' nor 'TopologyType' found in itemProperties in XdmfTopologyType::New");
return boost::shared_ptr<const XdmfTopologyType>();
}
......
......@@ -29,6 +29,7 @@
#include "XdmfHeavyDataController.hpp"
#include "XdmfSystemUtils.hpp"
#include "XdmfVisitor.hpp"
#include "XdmfError.hpp"
class XdmfArray::Clear : public boost::static_visitor<void> {
public:
......@@ -599,7 +600,7 @@ XdmfArray::initialize(const boost::shared_ptr<const XdmfArrayType> arrayType,
this->release();
}
else {
assert(false);
XdmfError::message(XdmfError::FATAL, "Array of unsupported type in XdmfArray::initialize");
}
}
......@@ -676,7 +677,7 @@ XdmfArray::populateItem(const std::map<std::string, std::string> & itemPropertie
contentVal = content->second;
}
else {
assert(false);
XdmfError::message(XdmfError::FATAL, "'Content' not found in itemProperties in XdmfArray::populateItem");
}
std::map<std::string, std::string>::const_iterator dimensions =
......@@ -690,7 +691,7 @@ XdmfArray::populateItem(const std::map<std::string, std::string> & itemPropertie
}
}
else {
assert(false);
XdmfError::message(XdmfError::FATAL, "'Dimensions' not found in itemProperties in XdmfArray::populateItem");
}
std::map<std::string, std::string>::const_iterator format =
......@@ -700,7 +701,7 @@ XdmfArray::populateItem(const std::map<std::string, std::string> & itemPropertie
std::map<std::string, std::string>::const_iterator xmlDir =
itemProperties.find("XMLDir");
if(xmlDir == itemProperties.end()) {
assert(false);
XdmfError::message(XdmfError::FATAL, "'XMLDir' not found in itemProperties in XdmfArray::populateItem");
}
size_t colonLocation = contentVal.find(":");
if(colonLocation != std::string::npos) {
......@@ -725,7 +726,7 @@ XdmfArray::populateItem(const std::map<std::string, std::string> & itemPropertie
mDimensions);
}
else {
assert(false);
XdmfError::message(XdmfError::FATAL, "':' not found in content in XdmfArray::populateItem -- double check an HDF5 data set is specified for the file");
}
}
else if(format->second.compare("XML") == 0) {
......@@ -742,11 +743,11 @@ XdmfArray::populateItem(const std::map<std::string, std::string> & itemPropertie
}
}
else {
assert(false);
XdmfError::message(XdmfError::FATAL, "Neither 'HDF' nor 'XML' specified as 'Format' in XdmfArray::populateItem");
}
}
else {
assert(false);
XdmfError::message(XdmfError::FATAL, "'Format' not found in itemProperties in XdmfArray::populateItem");
}
std::map<std::string, std::string>::const_iterator name =
......
......@@ -23,6 +23,7 @@
#include <sstream>
#include "XdmfArrayType.hpp"
#include "XdmfError.hpp"
// Supported XdmfArrayTypes
boost::shared_ptr<const XdmfArrayType>
......@@ -163,10 +164,10 @@ XdmfArrayType::New(const std::map<std::string, std::string> & itemProperties)
return UInt32();
}
else {
assert(false);
XdmfError::message(XdmfError::FATAL, "Type not one of accepted values: "+typeVal+" in XdmfArrayType::New");
}
}
assert(false);
XdmfError::message(XdmfError::FATAL, "Type unset because neither 'DataType' nor 'NumberType' found in itemProperties in XdmfArrayType::New");
return boost::shared_ptr<const XdmfArrayType>();
}
......
......@@ -11,6 +11,7 @@ swig -v -c++ -python -o XdmfCorePython.cpp XdmfCore.i
#include <XdmfCore.hpp>
#include <XdmfCoreItemFactory.hpp>
#include <XdmfCoreReader.hpp>
#include <XdmfError.hpp>
#include <XdmfHeavyDataController.hpp>
#include <XdmfHeavyDataWriter.hpp>
#include <XdmfHDF5Controller.hpp>
......@@ -277,6 +278,7 @@ swig -v -c++ -python -o XdmfCorePython.cpp XdmfCore.i
%template() Loki::Visitor<XdmfItem>;
%include XdmfCore.hpp
%include XdmfError.hpp
%include XdmfItem.hpp
%include XdmfItemProperty.hpp
%include XdmfVisitor.hpp
......
......@@ -29,6 +29,7 @@
#include "XdmfCoreReader.hpp"
#include "XdmfItem.hpp"
#include "XdmfSystemUtils.hpp"
#include "XdmfError.hpp"
/**
* PIMPL
......@@ -69,7 +70,7 @@ public:
mDocument = xmlReadFile(filePath.c_str(), NULL, 0);
if(mDocument == NULL) {
assert(false);
XdmfError::message(XdmfError::FATAL, "xmlReadFile could not read "+filePath+" in XdmfCoreReader::XdmfCoreReaderImpl::openFile");
}
mXPathContext = xmlXPtrNewContext(mDocument, NULL, NULL);
......@@ -156,7 +157,7 @@ public:
itemProperties,
childItems);
if(newItem == NULL) {
assert(false);
XdmfError::message(XdmfError::FATAL, "mItemFactory failed to createItem in XdmfCoreReader::XdmfCoreReaderImpl::readSingleNode");
}
newItem->populateItem(itemProperties, childItems, mCoreReader);
......
......@@ -26,6 +26,8 @@ XdmfError::message(Level level, std::string msg)
{
if(level<=XdmfError::getLevel())
XdmfError::WriteToStream(msg);
if(level == XdmfError::FATAL)
exit(1);
}
void
......
......@@ -4,9 +4,9 @@
#include <iostream>
#include <sstream>
#include <Xdmf.hpp>
#include "XdmfCore.hpp"
class XDMF_EXPORT XdmfError
class XDMFCORE_EXPORT XdmfError
{
public:
XdmfError();
......
......@@ -27,6 +27,7 @@
#include "XdmfArrayType.hpp"
#include "XdmfHDF5Controller.hpp"
#include "XdmfSystemUtils.hpp"
#include "XdmfError.hpp"
boost::shared_ptr<XdmfHDF5Controller>
XdmfHDF5Controller::New(const std::string & hdf5FilePath,
......@@ -58,8 +59,8 @@ XdmfHDF5Controller::XdmfHDF5Controller(const std::string & hdf5FilePath,
mStart(start),
mStride(stride)
{
assert(mStart.size() == mStride.size() &&
mStride.size() == mDimensions.size());
if(!(mStart.size() == mStride.size() && mStride.size() == mDimensions.size()))
XdmfError::message(XdmfError::FATAL, "mStart, mStride, mDimensions must all be of equal length in XdmfHDF5Controller constructor");
}
XdmfHDF5Controller::~XdmfHDF5Controller()
......@@ -113,7 +114,8 @@ XdmfHDF5Controller::read(XdmfArray * const array, const int fapl)
array->initialize(mType, mDimensions);
assert(numVals == array->getSize());
if(numVals != array->getSize())
XdmfError::message(XdmfError::FATAL, "numVals in H5 does not match size of XdmfArray in XdmfHDF5Controller::read");
status = H5Dread(dataset,
datatype,
......
......@@ -27,6 +27,7 @@
#include "XdmfArrayType.hpp"
#include "XdmfHDF5Controller.hpp"
#include "XdmfHDF5Writer.hpp"
#include "XdmfError.hpp"
boost::shared_ptr<XdmfHDF5Writer>
XdmfHDF5Writer::New(const std::string & filePath)
......@@ -102,7 +103,7 @@ XdmfHDF5Writer::write(XdmfArray & array,
datatype = H5T_NATIVE_UINT;
}
else {
assert(false);
XdmfError::message(XdmfError::FATAL, "Array of unsupported type in XdmfHDF5Writer::write");
}
}
......@@ -196,12 +197,15 @@ XdmfHDF5Writer::write(XdmfArray & array,
hid_t dataspace = H5Dget_space(dataset);
const int ndims = H5Sget_simple_extent_ndims(dataspace);
assert(ndims == current_dims.size());
if(ndims != current_dims.size())
XdmfError::message(XdmfError::FATAL, "Data set rank different -- ndims != current_dims.size() -- in XdmfHDF5Writer::write");
status = H5Dset_extent(dataset, &current_dims[0]);
if(status < 0) {
assert(false);
std::ostringstream oss;
oss << "H5Dset_extent returned failure in XdmfHDF5Writer::write -- status: " << status;
XdmfError::message(XdmfError::FATAL, oss.str());
}
}
}
......@@ -213,7 +217,9 @@ XdmfHDF5Writer::write(XdmfArray & array,
array.getValuesInternal());
if(status < 0) {
assert(false);
std::ostringstream oss;
oss << "H5Dwrite returned failure in XdmfHDF5Writer::write -- status: " << status;
XdmfError::message(XdmfError::FATAL, oss.str());
}
if(dataspace != H5S_ALL) {
......
......@@ -22,6 +22,7 @@
/*****************************************************************************/
#include "XdmfInformation.hpp"
#include "XdmfError.hpp"
boost::shared_ptr<XdmfInformation>
XdmfInformation::New()
......@@ -91,7 +92,7 @@ XdmfInformation::populateItem(const std::map<std::string, std::string> & itemPro
mKey = key->second;
}
else {
assert(false);
XdmfError::message(XdmfError::FATAL, "'Name' not found in itemProperties in XdmfInformation::populateItem");
}
std::map<std::string, std::string>::const_iterator value =
......@@ -100,7 +101,7 @@ XdmfInformation::populateItem(const std::map<std::string, std::string> & itemPro
mValue = value->second;
}
else {
assert(false);
XdmfError::message(XdmfError::FATAL, "'Value' not found in itemProperties in XdmfInformation::populateItem");
}
}
......
......@@ -35,6 +35,7 @@
#include "XdmfTopology.hpp"
#include "XdmfTopologyType.hpp"
#include "XdmfUnstructuredGrid.hpp"
#include "XdmfError.hpp"
//
// local methods
......@@ -233,7 +234,7 @@ XdmfExodusReader::read(const std::string & fileName,
if(exodusHandle < 0) {
// Invalid fileName
assert(false);
XdmfError::message(XdmfError::FATAL, "Invalid fileName: "+fileName+" in XdmfExodusReader::read");
}
char * title = new char[MAX_LINE_LENGTH+1];
......@@ -275,7 +276,9 @@ XdmfExodusReader::read(const std::string & fileName,
}
else {
// Xdmf does not support geometries with less than 2 dimensions
assert(false);
std::ostringstream oss;
oss << "Xdmf does not support geometries with less than 2 dimensions -- num_dim: " << num_dim << "-- in XdmfExodusReader::read";
XdmfError::message(XdmfError::FATAL, oss.str());
}
toReturn->getGeometry()->initialize(XdmfArrayType::Float64());
......@@ -343,7 +346,8 @@ XdmfExodusReader::read(const std::string & fileName,
iter != topologyTypes.end();
++iter) {
// Cannot be mixed topology!
assert(toReturn->getTopology()->getType() == *iter);
if(toReturn->getTopology()->getType() != *iter)
XdmfError::message(XdmfError::FATAL, "Requested mix of topology types -- "+toReturn->getTopology()->getType()->getName()+" and "+(*iter)->getName()+" in XdmfExodusReader::read");
}
}
}
......
......@@ -36,6 +36,7 @@
#include "XdmfTopology.hpp"
#include "XdmfTopologyType.hpp"
#include "XdmfUnstructuredGrid.hpp"
#include "XdmfError.hpp"
//
// local methods
......@@ -176,7 +177,7 @@ XdmfExodusWriter::write(const std::string & filePath,
}
else {
// Only Temporal Collections are currently supported.
assert(false);
XdmfError::message(XdmfError::FATAL, "Only Temporal Collections are currently supported or no unstructured grids provided in XdmfExodusWriter::write");
}
}
else {
......@@ -184,7 +185,8 @@ XdmfExodusWriter::write(const std::string & filePath,
}
// Make sure geometry and topology are non null
assert(currGrid->getGeometry() && currGrid->getTopology());
if(!(currGrid->getGeometry() && currGrid->getTopology()))
XdmfError::message(XdmfError::FATAL, "Current grid's geometry or topology is null in XdmfExodusWriter::write");
int num_dim = currGrid->getGeometry()->getType()->getDimensions();
int num_nodes = currGrid->getGeometry()->getNumberPoints();
......@@ -230,7 +232,7 @@ XdmfExodusWriter::write(const std::string & filePath,
xdmfToExodusTopologyType(currGrid->getTopology()->getType());
if (exodusTopologyType.compare("") == 0) {
// Topology Type not supported by ExodusII
assert(false);
XdmfError::message(XdmfError::FATAL, "Topology type not supported by ExodusII in XdmfExodusWriter::write");
}
ex_put_elem_block(exodusHandle,
10,
......
......@@ -45,6 +45,7 @@ extern "C"
#include "XdmfTopology.hpp"
#include "XdmfTopologyType.hpp"
#include "XdmfUnstructuredGrid.hpp"
#include "XdmfError.hpp"
boost::shared_ptr<XdmfPartitioner>
XdmfPartitioner::New()
......@@ -67,7 +68,8 @@ XdmfPartitioner::partition(const boost::shared_ptr<XdmfUnstructuredGrid> gridToP
const boost::shared_ptr<XdmfHeavyDataWriter> heavyDataWriter) const
{
// Make sure geometry and topology are non null
assert(gridToPartition->getGeometry() && gridToPartition->getTopology());
if(!(gridToPartition->getGeometry() && gridToPartition->getTopology()))
XdmfError::message(XdmfError::FATAL, "Current grid's geometry or topology is null in XdmfPartitioner::partition");
const boost::shared_ptr<XdmfGeometry> geometry =
gridToPartition->getGeometry();
......@@ -105,7 +107,7 @@ XdmfPartitioner::partition(const boost::shared_ptr<XdmfUnstructuredGrid> gridToP
nodesPerElement = 8;
}
else {
assert(false);
XdmfError::message(XdmfError::FATAL, "Topology type is not 'Triangle', 'Quadrilateral', 'Tetrahedron', 'Hexahedron' in XdmfPartition::partition");
}
bool releaseTopology = false;
......
......@@ -32,6 +32,7 @@
#include "XdmfTopologyConverter.hpp"
#include "XdmfTopologyType.hpp"
#include "XdmfUnstructuredGrid.hpp"
#include "XdmfError.hpp"
//
// local methods
......@@ -2584,7 +2585,8 @@ XdmfTopologyConverter::convert(const boost::shared_ptr<XdmfUnstructuredGrid> gri
const boost::shared_ptr<XdmfHeavyDataWriter> heavyDataWriter) const
{
// Make sure geometry and topology are non null
assert(gridToConvert->getGeometry() && gridToConvert->getTopology());
if(!(gridToConvert->getGeometry() && gridToConvert->getTopology()))
XdmfError::message(XdmfError::FATAL, "Current grid's geometry or topology is null in XdmfTopologyConverter::convert");
boost::shared_ptr<const XdmfTopologyType> topologyTypeToConvert =
gridToConvert->getTopology()->getType();
......@@ -2594,7 +2596,7 @@ XdmfTopologyConverter::convert(const boost::shared_ptr<XdmfUnstructuredGrid> gri
}
if(gridToConvert->getGeometry()->getType() != XdmfGeometryType::XYZ()) {
assert(false);
XdmfError::message(XdmfError::FATAL, "Grid to convert's type is not 'XYZ' in XdmfTopologyConverter::convert");
}
Converter * converter = NULL;
......@@ -2629,6 +2631,6 @@ XdmfTopologyConverter::convert(const boost::shared_ptr<XdmfUnstructuredGrid> gri
return toReturn;
}
else {
assert(false);
XdmfError::message(XdmfError::FATAL, "Converter NULL because topology type to convert not of valid type in XdmfTopologyConverter::convert");
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment