Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Aland, Sebastian
amdis
Commits
1641e793
Commit
1641e793
authored
Oct 21, 2015
by
Siqi Ling
Browse files
change in arh, parh file. update with meshconv
parent
7acfe3ad
Changes
4
Hide whitespace changes
Inline
Side-by-side
AMDiS/src/io/Arh3Writer.h
View file @
1641e793
...
...
@@ -6,9 +6,9 @@
#include
"detail/Arh3Writer.h"
#ifdef HAVE_PARALLEL_DOMAIN_AMDIS
#define WRITE_MACRO
false
#define WRITE_MACRO
Macroformat::NONE
#else
#define WRITE_MACRO
true
#define WRITE_MACRO
Macroformat::PT_MACROFILE
#endif
namespace
AMDiS
{
namespace
io
{
...
...
@@ -50,9 +50,9 @@ namespace AMDiS { namespace io {
inline
void
writeFile
(
SystemVector
*
sysVec
,
std
::
string
filename
,
bool
writeParallel
=
true
,
Cpsformat
cps
=
NONE
,
Cpsformat
::
Value
cps
=
Cpsformat
::
NONE
,
std
::
string
dataformat
=
"SF64"
,
bool
writeMacro
=
WRITE_MACRO
)
Macroformat
::
Value
writeMacro
=
WRITE_MACRO
)
{
std
::
vector
<
DOFVector
<
double
>*>
vecs
;
for
(
int
i
=
0
;
i
<
sysVec
->
getSize
();
i
++
)
...
...
@@ -63,9 +63,9 @@ namespace AMDiS { namespace io {
inline
void
writeFile
(
SystemVector
&
sysVec
,
std
::
string
filename
,
bool
writeParallel
=
true
,
Cpsformat
cps
=
NONE
,
Cpsformat
::
Value
cps
=
Cpsformat
::
NONE
,
std
::
string
dataformat
=
"SF64"
,
bool
writeMacro
=
WRITE_MACRO
)
Macroformat
::
Value
writeMacro
=
WRITE_MACRO
)
{
writeFile
(
&
sysVec
,
filename
,
writeParallel
,
cps
,
dataformat
,
writeMacro
);
}
...
...
@@ -75,9 +75,9 @@ namespace AMDiS { namespace io {
inline
void
writeFile
(
DOFVector
<
double
>*
vec0
,
std
::
string
filename
,
bool
writeParallel
=
true
,
Cpsformat
cps
=
NONE
,
Cpsformat
::
Value
cps
=
Cpsformat
::
NONE
,
std
::
string
dataformat
=
"SF64"
,
bool
writeMacro
=
WRITE_MACRO
)
Macroformat
::
Value
writeMacro
=
WRITE_MACRO
)
{
std
::
vector
<
DOFVector
<
double
>*>
vecs
;
vecs
.
push_back
(
vec0
);
...
...
@@ -89,9 +89,9 @@ namespace AMDiS { namespace io {
inline
void
writeFile
(
DOFVector
<
double
>&
vec0
,
std
::
string
filename
,
bool
writeParallel
=
true
,
Cpsformat
cps
=
NONE
,
Cpsformat
::
Value
cps
=
Cpsformat
::
NONE
,
std
::
string
dataformat
=
"SF64"
,
bool
writeMacro
=
WRITE_MACRO
)
Macroformat
::
Value
writeMacro
=
WRITE_MACRO
)
{
writeFile
(
&
vec0
,
filename
,
writeParallel
,
cps
,
dataformat
,
writeMacro
);
}
...
...
@@ -101,9 +101,9 @@ namespace AMDiS { namespace io {
inline
void
writeFile
(
std
::
vector
<
DOFVector
<
double
>*>
vecs
,
std
::
string
filename
,
bool
writeParallel
=
true
,
Cpsformat
cps
=
NONE
,
Cpsformat
::
Value
cps
=
Cpsformat
::
NONE
,
std
::
string
dataformat
=
"SF64"
,
bool
writeMacro
=
WRITE_MACRO
)
Macroformat
::
Value
writeMacro
=
WRITE_MACRO
)
{
detail
::
write
(
filename
,
NULL
,
vecs
,
writeParallel
,
cps
,
dataformat
,
writeMacro
);
}
...
...
@@ -112,9 +112,9 @@ namespace AMDiS { namespace io {
inline
void
writeFile
(
Mesh
*
mesh
,
std
::
string
filename
,
bool
writeParallel
=
true
,
Cpsformat
cps
=
NONE
,
Cpsformat
::
Value
cps
=
Cpsformat
::
NONE
,
std
::
string
dataformat
=
"SF64"
,
bool
writeMacro
=
WRITE_MACRO
)
Macroformat
::
Value
writeMacro
=
WRITE_MACRO
)
{
std
::
vector
<
DOFVector
<
double
>*>
vecs
;
detail
::
write
(
filename
,
mesh
,
vecs
,
writeParallel
,
cps
,
dataformat
,
writeMacro
);
...
...
AMDiS/src/io/detail/Arh3Reader.cc
View file @
1641e793
...
...
@@ -228,7 +228,7 @@ namespace AMDiS { namespace io {
TEST_EXIT
(
file
.
is_open
())
(
"Cannot open file %s
\n
"
,
filename
.
c_str
());
Cpsformat
cps
=
NONE
;
Cpsformat
::
Value
cps
=
Cpsformat
::
NONE
;
uint32_t
headerLen
=
0
;
uint32_t
nMacroElements
=
0
;
uint32_t
nValueVectors
=
0
;
...
...
@@ -246,15 +246,15 @@ namespace AMDiS { namespace io {
file
.
read
(
reinterpret_cast
<
char
*>
(
&
nValueVectors
),
4
);
file
.
read
(
reinterpret_cast
<
char
*>
(
&
nMacroElements
),
4
);
file
.
read
(
reinterpret_cast
<
char
*>
(
&
cpsflag
),
4
);
cps
=
static_cast
<
Cpsformat
>
(
cpsflag
);
cps
=
static_cast
<
Cpsformat
::
Value
>
(
cpsflag
);
#ifdef HAVE_COMPRESSION
TEST_EXIT
(
cps
==
ZLIB
||
cps
==
BZIP2
||
cps
==
NONE
)
TEST_EXIT
(
cps
==
Cpsformat
::
ZLIB
||
cps
==
Cpsformat
::
BZIP2
||
cps
==
Cpsformat
::
NONE
)
(
"Cannot read Arh2 file. Currently only support zlib and bzip2 compression.
\n
"
);
#else
TEST_EXIT
(
cps
==
NONE
)
TEST_EXIT
(
cps
==
Cpsformat
::
NONE
)
(
"HAVE_COMPRESSION OFF. Cannot read compressed Arh2 file.
\n
"
);
#endif
...
...
@@ -323,7 +323,7 @@ namespace AMDiS { namespace io {
dataformat
.
push_back
(
tmpString
);
}
// Read macroFile_nl
// Read macroFile_nl
//TODO
uint32_t
macroFile_nl
=
0
;
file
.
read
(
reinterpret_cast
<
char
*>
(
&
macroFile_nl
),
4
);
if
(
macroFile_nl
>
0
)
{
...
...
@@ -412,13 +412,13 @@ namespace AMDiS { namespace io {
boost
::
iostreams
::
filtering_streambuf
<
boost
::
iostreams
::
input
>
in
;
switch
(
cps
)
{
case
ZLIB
:
case
Cpsformat
::
ZLIB
:
in
.
push
(
boost
::
iostreams
::
zlib_decompressor
());
break
;
case
BZIP2
:
case
Cpsformat
::
BZIP2
:
in
.
push
(
boost
::
iostreams
::
bzip2_decompressor
());
break
;
case
NONE
:
case
Cpsformat
::
NONE
:
break
;
default:
MSG
(
"NOT correct compression flag.
\n
"
);
...
...
@@ -662,7 +662,7 @@ namespace AMDiS { namespace io {
uint32_t
nValueVectors
=
0
;
uint32_t
nFeSpaces
=
0
;
int
cpsflag
=
0
,
fileSize
=
0
;
Cpsformat
cps
=
NONE
;
Cpsformat
::
Value
cps
=
Cpsformat
::
NONE
;
firstRead
(
file
,
"sarh"
,
MAJOR
,
MINOR
);
...
...
@@ -673,12 +673,12 @@ namespace AMDiS { namespace io {
file
.
read
(
reinterpret_cast
<
char
*>
(
&
nValueVectors
),
4
);
file
.
read
(
reinterpret_cast
<
char
*>
(
&
nMacroElements
),
4
);
file
.
read
(
reinterpret_cast
<
char
*>
(
&
cpsflag
),
4
);
cps
=
static_cast
<
Cpsformat
>
(
cpsflag
);
cps
=
static_cast
<
Cpsformat
::
Value
>
(
cpsflag
);
#ifdef HAVE_COMPRESSION
TEST_EXIT
(
cps
==
ZLIB
||
cps
==
BZIP2
||
cps
==
NONE
)
TEST_EXIT
(
cps
==
Cpsformat
::
ZLIB
||
cps
==
Cpsformat
::
BZIP2
||
cps
==
Cpsformat
::
NONE
)
(
"Cannot read Arh2 file. Currently only support zlib and bzip2 compression.
\n
"
);
#else
TEST_EXIT
(
cps
==
NONE
)
...
...
@@ -746,13 +746,13 @@ namespace AMDiS { namespace io {
boost
::
iostreams
::
filtering_streambuf
<
boost
::
iostreams
::
input
>
in
;
switch
(
cps
)
{
case
ZLIB
:
case
Cpsformat
::
ZLIB
:
in
.
push
(
boost
::
iostreams
::
zlib_decompressor
());
break
;
case
BZIP2
:
case
Cpsformat
::
BZIP2
:
in
.
push
(
boost
::
iostreams
::
bzip2_decompressor
());
break
;
case
NONE
:
case
Cpsformat
::
NONE
:
break
;
default:
MSG
(
"NOT correct compression flag.
\n
"
);
...
...
@@ -857,7 +857,7 @@ namespace AMDiS { namespace io {
file
.
read
(
const_cast
<
char
*>
(
baseDir
.
data
()),
baseDirLen
);
file
.
read
(
reinterpret_cast
<
char
*>
(
&
nFiles
),
4
);
file
.
read
(
reinterpret_cast
<
char
*>
(
&
macroFile_nl
),
4
);
if
(
macroFile_nl
>
0
)
{
if
(
macroFile_nl
>
0
)
{
//TODO
macroFilename
.
resize
(
macroFile_nl
,
' '
);
file
.
read
(
const_cast
<
char
*>
(
macroFilename
.
data
()),
macroFile_nl
);
}
...
...
AMDiS/src/io/detail/Arh3Writer.cc
View file @
1641e793
...
...
@@ -32,9 +32,9 @@ namespace AMDiS { namespace io {
DOFVector
<
double
>*
vec1
,
DOFVector
<
double
>*
vec2
,
bool
writeParallel
,
Cpsformat
cps
,
Cpsformat
::
Value
cps
,
string
dataformat
,
bool
writeMacro
)
Macroformat
::
Value
writeMacro
)
{
vector
<
DOFVector
<
double
>*>
vecs
(
0
);
if
(
vec0
!=
NULL
)
...
...
@@ -97,22 +97,24 @@ namespace AMDiS { namespace io {
}
#ifdef HAVE_PARALLEL_DOMAIN_AMDIS
void
writeParallelFile
(
string
filename
,
Mesh
*
mesh
,
bool
createSubDir
,
bool
writeMacro
)
void
writeParallelFile
(
string
filename
,
Mesh
*
mesh
,
bool
createSubDir
,
Macroformat
::
Value
writeMacro
)
{
ofstream
file
;
file
.
open
(
filename
.
c_str
(),
ios
::
out
|
ios
::
binary
|
ios
::
trunc
);
string
typeId
=
"parh"
,
macroFilename
=
""
,
perFilename
=
""
;
string
baseDir
=
createSubDir
?
"./data/"
:
"./"
;
string
macroFile
=
""
;
uint32_t
macroFile_nl
=
0
;
string
macroData
=
""
,
periodicData
=
""
;
uint32_t
baseDirLen
=
baseDir
.
length
();
Parameters
::
get
(
mesh
->
getName
()
+
"->macro file name"
,
macroFilename
);
Parameters
::
get
(
mesh
->
getName
()
+
"->periodic file"
,
perFilename
);
bool
hasPeriodic
=
perFilename
.
length
();
int
major
=
AMDiS
::
io
::
Arh3Reader
::
PARH_MAJOR
;
int
minor
=
AMDiS
::
io
::
Arh3Reader
::
PARH_MINOR
;
uint32_t
nFiles
=
MPI
::
COMM_WORLD
.
Get_size
();
uint32_t
macroFile_nl
=
0
;
map
<
int
,
int
>
partitionMap
=
Parallel
::
MeshDistributor
::
globalMeshDistributor
->
getPartitionMap
();
uint32_t
nMacros
=
partitionMap
.
size
();
...
...
@@ -130,16 +132,26 @@ namespace AMDiS { namespace io {
file
.
write
(
baseDir
.
c_str
(),
baseDirLen
);
file
.
write
(
reinterpret_cast
<
char
*>
(
&
nFiles
),
4
);
if
(
writeMacro
&&
macroFilename
.
length
())
{
macroFile_nl
=
13
;
readFileToString
(
macroFilename
,
macroData
);
if
(
writeMacro
!=
Macroformat
::
NONE
&&
macroFilename
.
length
())
{
if
(
perFilename
.
length
())
{
macroFile_nl
=
27
;
readFileToString
(
perFilename
,
periodicData
);
if
(
writeMacro
==
Macroformat
::
PT_MACROFILE
)
{
macroFile
=
!
hasPeriodic
?
macroFilename
:
macroFilename
+
';'
+
perFilename
;
macroFile_nl
=
macroFile
.
length
();
}
else
if
(
writeMacro
==
Macroformat
::
THIS
)
{
macroFile_nl
=
13
;
readFileToString
(
macroFilename
,
macroData
);
if
(
hasPeriodic
)
{
macroFile_nl
=
27
;
readFileToString
(
perFilename
,
periodicData
);
}
macroFile
.
resize
(
macroFile_nl
,
' '
);
}
}
file
.
write
(
reinterpret_cast
<
char
*>
(
&
macroFile_nl
),
4
);
file
.
write
(
macroFile
.
c_str
(),
macroFile_nl
);
file
.
write
(
reinterpret_cast
<
char
*>
(
&
nMacros
),
4
);
map
<
int
,
int
>::
const_iterator
it
=
partitionMap
.
begin
();
...
...
@@ -150,12 +162,12 @@ namespace AMDiS { namespace io {
}
// write macro and periodic file
if
(
writeMacro
&&
macroFilename
.
length
())
{
if
(
writeMacro
==
Macroformat
::
THIS
&&
macroFilename
.
length
())
{
file
.
seekp
(
0
,
ios_base
::
end
);
long
macroPos
=
file
.
tellp
(),
perPos
=
0
;
file
.
write
(
macroData
.
c_str
(),
macroData
.
length
());
if
(
perFilename
.
length
()
)
{
if
(
hasPeriodic
)
{
perPos
=
file
.
tellp
();
file
.
write
(
periodicData
.
c_str
(),
periodicData
.
length
());
}
...
...
@@ -167,9 +179,12 @@ namespace AMDiS { namespace io {
4
+
//nFiles
4
;
//macroFile_nl
file
.
seekp
(
offset
);
file
<<
"this:"
<<
macroPos
;
if
(
perFilename
.
length
())
file
<<
";this:"
<<
perPos
;
file
.
write
(
"this:"
,
5
);
file
.
write
(
reinterpret_cast
<
char
*>
(
&
macroPos
),
8
);
if
(
hasPeriodic
)
{
file
.
write
(
";this:"
,
6
);
file
.
write
(
reinterpret_cast
<
char
*>
(
&
perPos
),
8
);
}
}
}
#endif
...
...
@@ -178,9 +193,9 @@ namespace AMDiS { namespace io {
Mesh
*
mesh
,
vector
<
DOFVector
<
double
>*>
vecs
,
bool
writeParallel
,
Cpsformat
cps
,
Cpsformat
::
Value
cps
,
string
dataformat
,
bool
writeMacro
)
Macroformat
::
Value
writeMacro
)
{
FUNCNAME
(
"Arh3Writer::detail::write()"
);
...
...
@@ -257,8 +272,9 @@ namespace AMDiS { namespace io {
Mesh
*
mesh
,
vector
<
DOFVector
<
double
>*>
vecs
,
map
<
const
FiniteElemSpace
*
,
vector
<
int
>
>&
feSpaces
,
Cpsformat
cps
,
string
dataformat
)
Cpsformat
::
Value
cps
,
string
dataformat
,
Macroformat
::
Value
writeMacro
)
{
FUNCNAME
(
"Arh3Writer::detail::writeHeader()"
);
// int nbits = boost::lexical_cast<int>(dataformat.substr(2, 2));
...
...
@@ -286,7 +302,26 @@ namespace AMDiS { namespace io {
el
=
st
.
traverseNext
(
el
);
}
uint32_t
dow
=
mesh
->
getGeo
(
WORLD
);
string
macroFilename
=
""
,
perFilename
=
""
;
string
macroFile
=
""
;
uint32_t
macroFile_nl
=
0
;
Parameters
::
get
(
mesh
->
getName
()
+
"->macro file name"
,
macroFilename
);
Parameters
::
get
(
mesh
->
getName
()
+
"->periodic file"
,
perFilename
);
if
(
writeMacro
!=
Macroformat
::
NONE
&&
macroFilename
.
length
())
{
if
(
writeMacro
==
Macroformat
::
PT_MACROFILE
)
{
macroFile
=
!
perFilename
.
length
()
?
macroFilename
:
macroFilename
+
';'
+
perFilename
;
macroFile_nl
=
macroFile
.
length
();
}
else
if
(
writeMacro
==
Macroformat
::
THIS
)
{
macroFile_nl
=
perFilename
.
length
()
?
27
:
13
;
macroFile
.
resize
(
macroFile_nl
,
' '
);
}
}
uint32_t
dow
=
mesh
->
getGeo
(
WORLD
);
uint32_t
dim
=
mesh
->
getDim
();
uint32_t
headerLen
=
34
+
//fixed part of header
nMacroElements
*
12
+
12
+
//macroElemnts table
...
...
@@ -294,7 +329,8 @@ namespace AMDiS { namespace io {
nFeSpaces
*
20
+
//feSpaces table
valueNamesLen
+
//value vector table
nValueVectors
*
12
+
//also value vector table
4
;
//macroFile_nl
4
+
//macroFile_nl
macroFile_nl
;
//macroFile
string
typeId
=
"sarh"
;
#ifndef HAVE_COMPRESSION
cps
=
NONE
;
...
...
@@ -370,17 +406,17 @@ namespace AMDiS { namespace io {
file
.
write
(
dataformat
.
c_str
(),
4
);
}
uint32_t
macroFile_nl
=
0
;
file
.
write
(
reinterpret_cast
<
char
*>
(
&
macroFile_nl
),
4
);
file
.
write
(
macroFile
.
c_str
(),
macroFile_nl
);
return
headerLen
;
}
void
writeAux
(
string
filename
,
Mesh
*
mesh
,
vector
<
DOFVector
<
double
>*>
vecs
,
bool
writeParallel
,
Cpsformat
cps
,
Cpsformat
::
Value
cps
,
string
dataformat
,
bool
writeMacro
)
Macroformat
::
Value
writeMacro
)
{
FUNCNAME
(
"Arh3Writer::detail::writeAux()"
);
...
...
@@ -404,7 +440,7 @@ namespace AMDiS { namespace io {
vector
<
std
::
set
<
DegreeOfFreedom
>
>
visited
(
sortedFeSpaces
.
size
());
pair
<
std
::
set
<
DegreeOfFreedom
>::
iterator
,
bool
>
ret
;
//file header information
int
headerLen
=
writeHeader
(
file
,
mesh
,
vecs
,
sortedFeSpaces
,
cps
,
dataformat
);
int
headerLen
=
writeHeader
(
file
,
mesh
,
vecs
,
sortedFeSpaces
,
cps
,
dataformat
,
writeMacro
);
//macro elements information
MeshStructure
elementStructure
;
...
...
@@ -528,8 +564,10 @@ namespace AMDiS { namespace io {
TEST_EXIT
(
macroSize
.
size
()
==
(
unsigned
)
mesh
->
getNumberOfMacros
())(
"Should not happen.
\n
"
);
//reset the macro positions in file
setMacrosPos
(
file
,
headerLen
,
macroSize
);
if
(
writeMacro
)
setMacroFile
(
file
,
headerLen
,
mesh
);
if
(
writeMacro
==
Macroformat
::
THIS
)
setMacroFile
(
file
,
headerLen
,
mesh
,
writeMacro
);
file
.
close
();
MSG
(
"ARH file written to: %s
\n
"
,
filename
.
c_str
());
}
...
...
@@ -553,18 +591,22 @@ namespace AMDiS { namespace io {
file
.
write
(
reinterpret_cast
<
char
*>
(
&
startPos
),
4
);
}
void
setMacroFile
(
std
::
ofstream
&
file
,
int
headerLen
,
Mesh
*
mesh
)
void
setMacroFile
(
std
::
ofstream
&
file
,
int
headerLen
,
Mesh
*
mesh
,
Macroformat
::
Value
writeMacro
)
{
FUNCNAME
(
"setMacroFile()"
);
TEST_EXIT
(
writeMacro
==
Macroformat
::
THIS
)
(
"This function should only be called under Macroformat::THIS.
\n
"
);
string
macroFilename
=
""
,
perFilename
=
""
;
string
macroData
=
""
,
periodicData
=
""
;
Parameters
::
get
(
mesh
->
getName
()
+
"->macro file name"
,
macroFilename
);
Parameters
::
get
(
mesh
->
getName
()
+
"->periodic file"
,
perFilename
);
bool
hasPeriodic
=
perFilename
.
length
();
if
(
!
macroFilename
.
length
())
{
WARNING
(
"macro file not found.
\n
"
);
if
(
!
macroFilename
.
length
())
return
;
}
// write macro file to the end
readFileToString
(
macroFilename
,
macroData
);
...
...
@@ -573,24 +615,22 @@ namespace AMDiS { namespace io {
file
.
write
(
macroData
.
c_str
(),
macroData
.
length
());
// write periodic file to the end
if
(
perFilename
.
length
()
)
{
if
(
hasPeriodic
)
{
readFileToString
(
perFilename
,
periodicData
);
perPos
=
file
.
tellp
();
file
.
write
(
periodicData
.
c_str
(),
periodicData
.
length
());
}
// update macroFile_nl
uint32_t
macroFile_nl
=
perFilename
.
length
()
?
27
:
13
;
file
.
seekp
(
headerLen
-
4
);
file
.
write
(
reinterpret_cast
<
char
*>
(
&
macroFile_nl
),
4
);
file
<<
"this:"
<<
macroPos
;
if
(
perFilename
.
length
())
file
<<
";this:"
<<
perPos
;
// update headerLen
headerLen
+=
macroFile_nl
;
file
.
seekp
(
6
);
file
.
write
(
reinterpret_cast
<
char
*>
(
&
headerLen
),
4
);
int
offset
=
hasPeriodic
?
27
:
13
;
file
.
seekp
(
headerLen
-
offset
);
file
.
write
(
"this:"
,
5
);
file
.
write
(
reinterpret_cast
<
char
*>
(
&
macroPos
),
8
);
if
(
hasPeriodic
)
{
file
.
write
(
";this:"
,
6
);
file
.
write
(
reinterpret_cast
<
char
*>
(
&
perPos
),
8
);
}
}
void
readFileToString
(
std
::
string
filename
,
std
::
string
&
data
)
...
...
@@ -606,7 +646,7 @@ namespace AMDiS { namespace io {
MeshStructure
&
code
,
vector
<
vector
<
double
>
>&
values
,
map
<
const
FiniteElemSpace
*
,
vector
<
int
>
>&
feSpaces
,
Cpsformat
cps
,
Cpsformat
::
Value
cps
,
string
dataformat
)
{
stringstream
dataStream
(
ios
::
out
|
ios
::
in
|
ios
::
binary
);
...
...
@@ -640,13 +680,13 @@ namespace AMDiS { namespace io {
#ifdef HAVE_COMPRESSION
switch
(
cps
)
{
case
ZLIB
:
case
Cpsformat
::
ZLIB
:
in
.
push
(
boost
::
iostreams
::
zlib_compressor
());
break
;
case
BZIP2
:
case
Cpsformat
::
BZIP2
:
in
.
push
(
boost
::
iostreams
::
bzip2_compressor
());
break
;
case
NONE
:
case
Cpsformat
::
NONE
:
break
;
default:
MSG
(
"NOT correct compression flag.
\n
"
);
...
...
AMDiS/src/io/detail/Arh3Writer.h
View file @
1641e793
...
...
@@ -13,11 +13,23 @@ namespace AMDiS { namespace io {
namespace
Arh3Writer
{
typedef
enum
{
NONE
=
0
,
ZLIB
=
1
,
BZIP2
=
2
}
Cpsformat
;
namespace
Cpsformat
{
typedef
enum
{
NONE
=
0
,
// no compression
ZLIB
=
1
,
// zlib compression
BZIP2
=
2
// bzip2 compression
}
Value
;
};
namespace
Macroformat
{
typedef
enum
{
NONE
=
0
,
// no macro
PT_MACROFILE
=
1
,
// pointer to macro file
THIS
=
2
// pointer to this file, at the end of this file
}
Value
;
};
typedef
enum
{
SI08
,
SI16
,
SI32
,
SI64
,
UI08
,
UI16
,
UI32
,
UI64
,
SF32
,
SF64
}
Valformat
;
...
...
@@ -42,9 +54,9 @@ namespace AMDiS { namespace io {
DOFVector
<
double
>*
vec1
=
NULL
,
DOFVector
<
double
>*
vec2
=
NULL
,
bool
writeParallel
=
true
,
Cpsformat
cps
=
NONE
,
Cpsformat
::
Value
cps
=
Cpsformat
::
NONE
,
std
::
string
dataformat
=
"SF64"
,
bool
writeMacro
=
false
);
Macroformat
::
Value
writeMacro
=
Macroformat
::
NONE
);
/**
* \ingroup Output
...
...
@@ -70,15 +82,15 @@ namespace AMDiS { namespace io {
Mesh
*
mesh
,
std
::
vector
<
DOFVector
<
double
>*>
vecs
,
bool
writeParallel
=
true
,
Cpsformat
cps
=
NONE
,
Cpsformat
::
Value
cps
=
Cpsformat
::
NONE
,
std
::
string
dataformat
=
"SF64"
,
bool
writeMacro
=
false
);
Macroformat
::
Value
writeMacro
=
Macroformat
::
NONE
);
void
writeAux
(
std
::
string
filename
,
Mesh
*
mesh
,
std
::
vector
<
DOFVector
<
double
>*>
vecs
,
bool
writeParallel
,
Cpsformat
cps
,
bool
writeParallel
,
Cpsformat
::
Value
cps
,
std
::
string
dataformat
,
bool
writeMacro
=
false
);
Macroformat
::
Value
writeMacro
=
Macroformat
::
NONE
);
///\return the size of the macro block in file
std
::
pair
<
int
,
int
>
writeMacroElement
(
std
::
ofstream
&
file
,
...
...
@@ -86,7 +98,7 @@ namespace AMDiS { namespace io {
std
::
vector
<
std
::
vector
<
double
>
>&
values
,
std
::
map
<
const
FiniteElemSpace
*
,
std
::
vector
<
int
>
>&
feSpaces
,
Cpsformat
cps
,
std
::
string
dataformat
);
Cpsformat
::
Value
cps
,
std
::
string
dataformat
);
int
writeValues
(
std
::
stringstream
&
file
,
std
::
string
dataformat
,
...
...
@@ -100,15 +112,19 @@ namespace AMDiS { namespace io {
std
::
vector
<
DOFVector
<
double
>*>
vecs
,
std
::
map
<
const
FiniteElemSpace
*
,
std
::
vector
<
int
>
>&
feSpaces
,
Cpsformat
cps
,
std
::
string
dataformat
);
Cpsformat
::
Value
cps
,
std
::
string
dataformat
,
Macroformat
::
Value
writeMacro
);
///internal method, don't call
void
setMacrosPos
(
std
::
ofstream
&
file
,
int
headerLen
,
std
::
vector
<
std
::
pair
<
int
,
int
>
>&
macroSize
);
///internal method, don't call
void
setMacroFile
(
std
::
ofstream
&
file
,
int
headerLen
,
Mesh
*
mesh
);
void
setMacroFile
(
std
::
ofstream
&
file
,
int
headerLen
,
Mesh
*
mesh
,
Macroformat
::
Value
writeMacro
);
void
readFileToString
(
std
::
string
filename
,
std
::
string
&
data
);
...
...
@@ -123,7 +139,7 @@ namespace AMDiS { namespace io {
void
writeParallelFile
(
std
::
string
filename
,
Mesh
*
mesh
,
bool
createSubDir
,
bool
writeMacro
=
true
);
Macroformat
::
Value
writeMacro
=
Macroformat
::
NONE
);
#endif
}
//end namespace detail
}
// end namespace Arh3Writer
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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