[cig-commits] r13713 - cs/cigma/trunk/src
luis at geodynamics.org
luis at geodynamics.org
Wed Dec 17 02:31:53 PST 2008
Author: luis
Date: 2008-12-17 02:31:52 -0800 (Wed, 17 Dec 2008)
New Revision: 13713
Modified:
cs/cigma/trunk/src/core_readers.cpp
Log:
Updated core_readers.cpp
* Added logging to cigma::ReadArray
* Added VTK file handler to Read{Array,NodeCoordinates,ElementBlock}
Modified: cs/cigma/trunk/src/core_readers.cpp
===================================================================
--- cs/cigma/trunk/src/core_readers.cpp 2008-12-17 10:31:50 UTC (rev 13712)
+++ cs/cigma/trunk/src/core_readers.cpp 2008-12-17 10:31:52 UTC (rev 13713)
@@ -22,6 +22,9 @@
cigma::array<double>* cigma::ReadArray(const DataPath& array_path)
{
+ TRI_LOG_STR("cigma::ReadArray()");
+ TRI_LOG(array_path);
+
cigma::array<double>* a = 0;
string filename = array_path.filename();
@@ -41,8 +44,13 @@
}
else if (rt == FileReader::VTK_FILE_READER)
{
- int status;
- throw cigma::Exception("ReadArray", "Error in VTK reader");
+ a = new cigma::array<double>();
+ int status = reader->getDataset(location.c_str(), &(a->_data), &(a->npts), &(a->ndim));
+ if (status < 0)
+ {
+ delete a;
+ throw cigma::Exception("ReadArray", "Error in VTK reader");
+ }
}
else if (rt == FileReader::TEXT_FILE_READER)
{
@@ -93,8 +101,16 @@
}
else if (rt == FileReader::VTK_FILE_READER)
{
- int status;
- throw cigma::Exception("ReadNodeCoordinates", "Error in VTK reader");
+ shared_ptr<nc_array> nc(new nc_array);
+ int status = reader->getCoordinates(location.c_str(), &(nc->coords), &(nc->nno), &(nc->nsd));
+ if (status < 0)
+ {
+ std::ostringstream stream;
+ stream << "Could not read node coordinates from VTK file '"
+ << filename << "'" << std::ends;
+ throw cigma::Exception("ReadNodeCoordinates", stream.str());
+ }
+ nc_ptr = nc;
}
else if (rt == FileReader::TEXT_FILE_READER)
{
@@ -105,7 +121,7 @@
std::ostringstream stream;
stream << "Could not read node coordinates from text file '"
<< filename << "'" << std::ends;
- throw cigma::Exception("ReadNodeCoordinates", "Error in text reader");
+ throw cigma::Exception("ReadNodeCoordinates", stream.str());
}
nc_ptr = nc;
}
@@ -151,8 +167,16 @@
}
else if (rt == FileReader::VTK_FILE_READER)
{
- int status;
- throw cigma::Exception("ReadElementBlock", "Error in VTK reader");
+ shared_ptr<eb_array> eb(new eb_array);
+ int status = reader->getConnectivity(location.c_str(), &(eb->connect), &(eb->nel), &(eb->ndofs));
+ if (status < 0)
+ {
+ std::ostringstream stream;
+ stream << "Could not open element block from VTK file '"
+ << filename << "'" << std::ends;
+ throw cigma::Exception("ReadElementBlock", stream.str());
+ }
+ eb_ptr = eb;
}
else if (rt == FileReader::TEXT_FILE_READER)
{
More information about the CIG-COMMITS
mailing list