Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
iwr
amdis
Commits
3d291c93
Commit
3d291c93
authored
Feb 25, 2008
by
Thomas Witkowski
Browse files
* ParaView animation file writer
parent
c7001e3c
Changes
5
Hide whitespace changes
Inline
Side-by-side
AMDiS/src/FileWriter.cc
View file @
3d291c93
...
...
@@ -23,7 +23,6 @@ namespace AMDiS {
FUNCNAME
(
"FileWriter::FileWriter()"
);
initialize
();
readParameters
();
feSpace
=
vec
->
getFESpace
();
...
...
@@ -41,7 +40,6 @@ namespace AMDiS {
FUNCNAME
(
"FileWriter::FileWriter()"
);
initialize
();
readParameters
();
for
(
int
i
=
0
;
i
<
static_cast
<
int
>
(
vecs
.
size
());
i
++
)
{
TEST_EXIT
(
vecs
[
0
]
->
getFESpace
()
==
vecs
[
i
]
->
getFESpace
())
...
...
@@ -62,7 +60,6 @@ namespace AMDiS {
FUNCNAME
(
"FileWriter::FileWriter()"
);
initialize
();
readParameters
();
// Create the temporal DOFVectors for all components of WorldVector.
nTmpSolutions_
=
(
*
vec
)[
0
].
getSize
();
...
...
@@ -107,12 +104,16 @@ namespace AMDiS {
writeTecPlotFormat
=
0
;
writeAMDiSFormat
=
0
;
writeParaViewFormat
=
0
;
writeParaViewAnimation
=
0
;
writePeriodicFormat
=
0
;
appendIndex
=
0
;
indexLength
=
5
;
indexDecimals
=
3
;
tsModulo
=
1
;
nTmpSolutions_
=
0
;
paraViewAnimationFrames_
.
resize
(
0
);
readParameters
();
}
void
FileWriter
::
readParameters
()
...
...
@@ -126,7 +127,8 @@ namespace AMDiS {
GET_PARAMETER
(
0
,
name
+
"->AMDiS mesh ext"
,
&
amdisMeshExt
);
GET_PARAMETER
(
0
,
name
+
"->AMDiS data ext"
,
&
amdisDataExt
);
GET_PARAMETER
(
0
,
name
+
"->ParaView format"
,
"%d"
,
&
writeParaViewFormat
);
GET_PARAMETER
(
0
,
name
+
"->ParaView ext"
,
&
paraViewFileExt
);
GET_PARAMETER
(
0
,
name
+
"->ParaView animation"
,
"%d"
,
&
writeParaViewAnimation
);
GET_PARAMETER
(
0
,
name
+
"->ParaView ext"
,
&
paraViewFileExt
);
GET_PARAMETER
(
0
,
name
+
"->Periodic format"
,
"%d"
,
&
writePeriodicFormat
);
GET_PARAMETER
(
0
,
name
+
"->Periodic ext"
,
&
periodicFileExt
);
GET_PARAMETER
(
0
,
name
+
"->append index"
,
"%d"
,
&
appendIndex
);
...
...
@@ -211,6 +213,12 @@ namespace AMDiS {
MSG
(
"ParaView file written to %s
\n
"
,
(
fn
+
paraViewFileExt
).
c_str
());
}
if
(
writeParaViewAnimation
)
{
VtkWriter
::
updateAnimationFile
(
fn
+
paraViewFileExt
,
&
paraViewAnimationFrames_
,
const_cast
<
char
*>
(
(
filename
+
".pvd"
).
c_str
()));
}
for
(
int
i
=
0
;
i
<
static_cast
<
int
>
(
dc
.
size
());
i
++
)
{
DELETE
dc
[
i
];
}
...
...
AMDiS/src/FileWriter.h
View file @
3d291c93
...
...
@@ -26,6 +26,7 @@
#ifndef AMDIS_FILEWRITER_H
#define AMDIS_FILEWRITER_H
#include <vector>
#include <string>
#include "MemoryManager.h"
#include "MatrixVector.h"
...
...
@@ -208,6 +209,12 @@ namespace AMDiS {
*/
int
writeParaViewFormat
;
/** \brief
* 0: Don't write ParaView animation file.
* 1: Write ParaView animation file.
*/
int
writeParaViewAnimation
;
/** \brief
* 0: Don't write periodic files.
* 1: Write periodic files.
...
...
@@ -235,6 +242,11 @@ namespace AMDiS {
*/
int
tsModulo
;
/** \brief
* Stores all writen filename to a ParaView animation file.
*/
::
std
::
vector
<
::
std
::
string
>
paraViewAnimationFrames_
;
/**
*/
int
timestepNumber
;
...
...
AMDiS/src/ProblemScal.h
View file @
3d291c93
...
...
@@ -80,7 +80,7 @@ namespace AMDiS {
* Destructor
*/
virtual
~
ProblemScal
()
{
FUNCNAME
(
"~ProblemScal"
);
FUNCNAME
(
"
ProblemScal::
~ProblemScal
()
"
);
};
/** \brief
...
...
AMDiS/src/VtkWriter.cc
View file @
3d291c93
#include <stdio.h>
#include <string>
#include <fstream>
...
...
@@ -132,4 +133,35 @@ namespace AMDiS {
return
0
;
}
int
VtkWriter
::
updateAnimationFile
(
::
std
::
string
valueFilename
,
::
std
::
vector
<
::
std
::
string
>
*
paraViewAnimationFrames
,
const
char
*
animationFilename
)
{
size_t
found
=
valueFilename
.
find_last_of
(
"/
\\
"
);
paraViewAnimationFrames
->
push_back
(
valueFilename
.
substr
(
found
+
1
));
::
std
::
ofstream
file
;
file
.
open
(
animationFilename
);
file
<<
"<?xml version=
\"
1.0
\"
?>"
<<
::
std
::
endl
;
file
<<
"<VTKFile type=
\"
Collection
\"
version=
\"
0.1
\"
>"
<<
::
std
::
endl
;
file
<<
"<Collection>"
<<
::
std
::
endl
;
int
counter
=
0
;
::
std
::
vector
<
::
std
::
string
>::
iterator
it
;
for
(
it
=
paraViewAnimationFrames
->
begin
();
it
<
paraViewAnimationFrames
->
end
();
++
it
,
counter
++
)
{
file
<<
"<DataSet timestep=
\"
"
<<
counter
<<
"
\"
part=
\"
0
\"
file=
\"
"
<<
(
*
it
)
<<
"
\"
/>"
<<
::
std
::
endl
;
}
file
<<
"</Collection>"
<<
::
std
::
endl
;
file
<<
"</VTKFile>"
<<
::
std
::
endl
;
file
.
close
();
return
0
;
}
}
AMDiS/src/VtkWriter.h
View file @
3d291c93
...
...
@@ -29,8 +29,18 @@ namespace AMDiS {
class
VtkWriter
{
public:
/** \brief
* Writes a ParaView-VTK file.
*/
static
int
writeFile
(
::
std
::
vector
<
DataCollector
*>
*
dc
,
const
char
*
name
);
/** \brief
* Adds a new entry to a ParaView animation file.
*/
static
int
updateAnimationFile
(
::
std
::
string
valueFilename
,
::
std
::
vector
<
::
std
::
string
>
*
paraViewAnimationFrames
,
const
char
*
animationFilename
);
};
}
...
...
Write
Preview
Supports
Markdown
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