Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Ben Boeckel
Xdmf
Commits
c7288346
Commit
c7288346
authored
Jun 22, 2012
by
Kenneth Leiter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ENH: Commit Pat's changes for Fortran interface.
Add method to output heavy data. Add method to read file from disk.
parent
71b4e1a7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
0 deletions
+54
-0
utils/XdmfFortran.cpp
utils/XdmfFortran.cpp
+37
-0
utils/XdmfFortran.hpp
utils/XdmfFortran.hpp
+17
-0
No files found.
utils/XdmfFortran.cpp
View file @
c7288346
...
...
@@ -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
);
}
}
}
utils/XdmfFortran.hpp
View file @
c7288346
...
...
@@ -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
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment