Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
Nektar
Nektar
Commits
0f43ef67
Commit
0f43ef67
authored
Apr 02, 2013
by
Chris Cantwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added XML compression support to FldToTecGmsh and MeshConvert.
parent
fd6830ba
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
3 deletions
+42
-3
utilities/PostProcessing/FldToTecGmsh.cpp
utilities/PostProcessing/FldToTecGmsh.cpp
+11
-0
utilities/PreProcessing/MeshConvert/OutputNekpp.cpp
utilities/PreProcessing/MeshConvert/OutputNekpp.cpp
+31
-3
No files found.
utilities/PostProcessing/FldToTecGmsh.cpp
View file @
0f43ef67
...
...
@@ -69,6 +69,17 @@ int main(int argc, char *argv[])
{
fname
=
fname
.
substr
(
0
,
fdot
);
}
else
if
(
ending
==
".gz"
)
{
fname
=
fname
.
substr
(
0
,
fdot
);
fdot
=
fname
.
find_last_of
(
'.'
);
ASSERTL0
(
fdot
!=
std
::
string
::
npos
,
"Error: expected file extension before .gz."
);
ending
=
fname
.
substr
(
fdot
);
ASSERTL0
(
ending
==
".xml"
,
"Compressed non-xml files are not supported."
);
continue
;
}
else
if
(
ending
==
".xml"
)
{
continue
;
...
...
utilities/PreProcessing/MeshConvert/OutputNekpp.cpp
View file @
0f43ef67
...
...
@@ -37,6 +37,13 @@
#include <string>
using
namespace
std
;
#include <boost/iostreams/filtering_streambuf.hpp>
#include <boost/iostreams/copy.hpp>
#include <boost/iostreams/filter/gzip.hpp>
namespace
io
=
boost
::
iostreams
;
#include <tinyxml/tinyxml.h>
#include "MeshElements.h"
#include "OutputNekpp.h"
...
...
@@ -51,7 +58,8 @@ namespace Nektar
OutputNekpp
::
OutputNekpp
(
MeshSharedPtr
m
)
:
OutputModule
(
m
)
{
config
[
"z"
]
=
ConfigOption
(
true
,
"0"
,
"Compress output file and append a .gz extension."
);
}
OutputNekpp
::~
OutputNekpp
()
...
...
@@ -89,8 +97,28 @@ namespace Nektar
WriteXmlExpansions
(
root
);
WriteXmlConditions
(
root
);
// Save the XML file.
doc
.
SaveFile
(
config
[
"outfile"
].
as
<
string
>
());
// Extract the output filename and extension
string
filename
=
config
[
"outfile"
].
as
<
string
>
();
// Compress output and append .gz extension
if
(
config
[
"z"
].
as
<
bool
>
())
{
filename
+=
".gz"
;
ofstream
fout
(
filename
.
c_str
(),
std
::
ios_base
::
out
|
std
::
ios_base
::
binary
);
std
::
stringstream
decompressed
;
decompressed
<<
doc
;
io
::
filtering_streambuf
<
io
::
output
>
out
;
out
.
push
(
io
::
gzip_compressor
());
out
.
push
(
fout
);
io
::
copy
(
decompressed
,
out
);
fout
.
close
();
}
else
{
doc
.
SaveFile
(
filename
);
}
}
void
OutputNekpp
::
WriteXmlNodes
(
TiXmlElement
*
pRoot
)
...
...
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