Commit c7288346 authored by Kenneth Leiter's avatar Kenneth Leiter

ENH: Commit Pat's changes for Fortran interface.

Add method to output heavy data.
Add method to read file from disk.
parent 71b4e1a7
......@@ -22,6 +22,7 @@
/* for more information. */
/* */
/*******************************************************************/
#include <sys/stat.h>
#include "XdmfFortran.hpp"
......@@ -42,6 +43,7 @@
#include "XdmfTopologyType.hpp"
#include "XdmfUnstructuredGrid.hpp"
#include "XdmfWriter.hpp"
#include "XdmfHDF5Writer.hpp"
namespace {
......@@ -577,6 +579,21 @@ XdmfFortran::write(const char * const xmlFilePath)
mDomain->accept(writer);
}
void
XdmfFortran::writeHDF5(const char * const xmlFilePath)
{
shared_ptr<XdmfHDF5Writer> writer = XdmfHDF5Writer::New(xmlFilePath);
writer->setReleaseData( true );
mDomain->accept(writer);
}
void
XdmfFortran::read(const char * const xmlFilePath)
{
shared_ptr<XdmfReader> reader = XdmfReader::New();
mDomain = shared_dynamic_cast<XdmfDomain>(reader->read( xmlFilePath ));
}
//
// C++ will mangle the name based on the argument list. This tells the
// compiler not to mangle the name so we can call it from 'C' (but
......@@ -727,5 +744,25 @@ extern "C"
XdmfFortran * xdmfFortran = reinterpret_cast<XdmfFortran *>(*pointer);
xdmfFortran->write(xmlFilePath);
}
void
XdmfWriteHDF5(long * pointer,
char * xmlFilePath)
{
XdmfFortran * xdmfFortran = reinterpret_cast<XdmfFortran *>(*pointer);
xdmfFortran->writeHDF5(xmlFilePath);
}
void
XdmfRead(long * pointer,
char * xmlFilePath)
{
struct stat buffer;
if ( stat(xmlFilePath, &buffer) == 0 ) {
XdmfFortran * xdmfFortran = (XdmfFortran *) *pointer;
xdmfFortran->read( xmlFilePath );
}
}
}
......@@ -137,6 +137,8 @@ class XdmfUnstructuredGrid;
#define XdmfSetTime xdmfsettime_
#define XdmfSetTopology xdmfsettopology_
#define XdmfWrite xdmfwrite_
#define XdmfRead xdmfread_
#define XdmfWriteHDF5 xdmfwritehdf5_
#endif
/**
......@@ -300,6 +302,21 @@ public:
*/
void write(const char * const xmlFilePath);
/**
* Write HDF5 heavy data to disk and release
*
* @param xmlFilePath the path to the xml file to write to.
*/
void writeHDF5(const char * const xmlFilePath);
/**
* Read xml file and make it the domain
*
* @param xmlFilePath the path to the xml file to read.
*/
void read(const char * const xmlFilePath);
private:
shared_ptr<XdmfDomain> mDomain;
......
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