Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
pugs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
code
pugs
Commits
26f7dc21
Commit
26f7dc21
authored
6 years ago
by
Stéphane Del Pino
Browse files
Options
Downloads
Patches
Plain Diff
Improve VTK output
-use pvtu files to allow simple parallel output -remain very naive implementation
parent
f8e3832e
No related branches found
No related tags found
1 merge request
!11
Feature/mpi
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
CMakeLists.txt
+3
-0
3 additions, 0 deletions
CMakeLists.txt
src/output/VTKWriter.hpp
+132
-88
132 additions, 88 deletions
src/output/VTKWriter.hpp
with
135 additions
and
88 deletions
CMakeLists.txt
+
3
−
0
View file @
26f7dc21
...
@@ -174,6 +174,9 @@ include_directories(src/output)
...
@@ -174,6 +174,9 @@ include_directories(src/output)
include_directories
(
src/utils
)
include_directories
(
src/utils
)
include_directories
(
src/scheme
)
include_directories
(
src/scheme
)
# Pastis generated sources
include_directories
(
${
PASTIS_BINARY_DIR
}
/src/utils
)
# Pastis tests
# Pastis tests
set
(
CATCH_MODULE_PATH
"
${
PASTIS_SOURCE_DIR
}
/packages/Catch2"
)
set
(
CATCH_MODULE_PATH
"
${
PASTIS_SOURCE_DIR
}
/packages/Catch2"
)
...
...
This diff is collapsed.
Click to expand it.
src/output/VTKWriter.hpp
+
132
−
88
View file @
26f7dc21
...
@@ -9,6 +9,7 @@
...
@@ -9,6 +9,7 @@
#include
<IConnectivity.hpp>
#include
<IConnectivity.hpp>
#include
<ItemValue.hpp>
#include
<ItemValue.hpp>
#include
<Messenger.hpp>
class
VTKWriter
class
VTKWriter
{
{
...
@@ -18,6 +19,24 @@ class VTKWriter
...
@@ -18,6 +19,24 @@ class VTKWriter
double
m_last_time
;
double
m_last_time
;
const
double
m_time_period
;
const
double
m_time_period
;
std
::
string
_getFilenamePVTU
()
{
std
::
ostringstream
sout
;
sout
<<
m_base_filename
;
sout
<<
'.'
<<
std
::
setfill
(
'0'
)
<<
std
::
setw
(
4
)
<<
m_file_number
<<
".pvtu"
;
return
sout
.
str
();
}
std
::
string
_getFilenameVTU
(
const
int
&
rank_number
)
const
{
std
::
ostringstream
sout
;
sout
<<
m_base_filename
;
if
(
parallel
::
size
()
>
1
)
{
sout
<<
'-'
<<
std
::
setfill
(
'0'
)
<<
std
::
setw
(
4
)
<<
rank_number
;
}
sout
<<
'.'
<<
std
::
setfill
(
'0'
)
<<
std
::
setw
(
4
)
<<
m_file_number
<<
".vtu"
;
return
sout
.
str
();
}
public
:
public
:
template
<
typename
MeshType
>
template
<
typename
MeshType
>
void
write
(
const
MeshType
&
mesh
,
void
write
(
const
MeshType
&
mesh
,
...
@@ -30,9 +49,34 @@ class VTKWriter
...
@@ -30,9 +49,34 @@ class VTKWriter
}
else
{
}
else
{
return
;
return
;
}
}
std
::
ostringstream
sout
;
sout
<<
m_base_filename
<<
'.'
<<
std
::
setfill
(
'0'
)
<<
std
::
setw
(
4
)
<<
m_file_number
<<
".vtu"
<<
std
::
ends
;
if
(
parallel
::
rank
()
==
0
)
std
::
ofstream
fout
(
sout
.
str
());
{
// write PVTK file
std
::
ofstream
fout
(
_getFilenamePVTU
());
fout
<<
"<?xml version=
\"
1.0
\"
?>
\n
"
;
fout
<<
"<VTKFile type=
\"
PUnstructuredGrid
\"
>
\n
"
;
fout
<<
"<PUnstructuredGrid GhostLevel=
\"
0
\"
>
\n
"
;
fout
<<
"<PPoints>
\n
"
;
fout
<<
"<PDataArray Name=
\"
Positions
\"
NumberOfComponents=
\"
3
\"
type=
\"
Float64
\"
/>
\n
"
;
fout
<<
"</PPoints>
\n
"
;
fout
<<
"<PCells>
\n
"
;
fout
<<
"<PDataArray type=
\"
Int32
\"
Name=
\"
connectivity
\"
NumberOfComponents=
\"
1
\"
/>
\n
"
;
fout
<<
"<PDataArray type=
\"
UInt32
\"
Name=
\"
offsets
\"
NumberOfComponents=
\"
1
\"
/>
\n
"
;
fout
<<
"<PDataArray type=
\"
Int8
\"
Name=
\"
types
\"
NumberOfComponents=
\"
1
\"
/>
\n
"
;
fout
<<
"</PCells>
\n
"
;
for
(
size_t
i_rank
=
0
;
i_rank
<
parallel
::
size
();
++
i_rank
)
{
fout
<<
"<Piece Source=
\"
"
<<
_getFilenameVTU
(
i_rank
)
<<
"
\"
/>
\n
"
;
}
fout
<<
"</PUnstructuredGrid>
\n
"
;
fout
<<
"</VTKFile>
\n
"
;
}
{
// write VTK files
std
::
ofstream
fout
(
_getFilenameVTU
(
parallel
::
rank
()));
fout
<<
"<?xml version=
\"
1.0
\"
?>
\n
"
;
fout
<<
"<?xml version=
\"
1.0
\"
?>
\n
"
;
fout
<<
"<VTKFile type=
\"
UnstructuredGrid
\"
>
\n
"
;
fout
<<
"<VTKFile type=
\"
UnstructuredGrid
\"
>
\n
"
;
fout
<<
"<UnstructuredGrid>
\n
"
;
fout
<<
"<UnstructuredGrid>
\n
"
;
...
@@ -133,7 +177,7 @@ class VTKWriter
...
@@ -133,7 +177,7 @@ class VTKWriter
fout
<<
"</Piece>
\n
"
;
fout
<<
"</Piece>
\n
"
;
fout
<<
"</UnstructuredGrid>
\n
"
;
fout
<<
"</UnstructuredGrid>
\n
"
;
fout
<<
"</VTKFile>
\n
"
;
fout
<<
"</VTKFile>
\n
"
;
}
m_file_number
++
;
m_file_number
++
;
}
}
VTKWriter
(
const
std
::
string
&
base_filename
,
VTKWriter
(
const
std
::
string
&
base_filename
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment