Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
S
SWE
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Gaurav Kukreja
SWE
Commits
a83ba300
Commit
a83ba300
authored
Apr 04, 2013
by
Sebastian Rettenberger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change vtk writer to behave like netcdf writer
parent
2746fc63
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
11 deletions
+11
-11
VtkWriter.cpp
src/writer/VtkWriter.cpp
+11
-11
No files found.
src/writer/VtkWriter.cpp
View file @
a83ba300
...
...
@@ -63,7 +63,7 @@ void io::VtkWriter::writeTimeStep(
std
::
ofstream
vtkFile
(
generateFileName
().
c_str
());
assert
(
vtkFile
.
good
());
// VTK
HEADER
// VTK
header
vtkFile
<<
"<?xml version=
\"
1.0
\"
?>"
<<
std
::
endl
<<
"<VTKFile type=
\"
StructuredGrid
\"
>"
<<
std
::
endl
<<
"<StructuredGrid WholeExtent=
\"
"
<<
offsetX
<<
" "
<<
offsetX
+
nX
...
...
@@ -74,7 +74,7 @@ void io::VtkWriter::writeTimeStep(
vtkFile
<<
"<Points>"
<<
std
::
endl
<<
"<DataArray NumberOfComponents=
\"
3
\"
type=
\"
Float32
\"
format=
\"
ascii
\"
>"
<<
std
::
endl
;
//G
ITTER PUNKTE
//G
rid points
for
(
int
j
=
0
;
j
<
nX
+
1
;
j
++
)
for
(
int
i
=
0
;
i
<
nX
+
1
;
i
++
)
vtkFile
<<
(
offsetX
+
i
)
*
dX
<<
" "
<<
(
offsetY
+
j
)
*
dY
<<
" 0"
<<
std
::
endl
;
...
...
@@ -84,28 +84,28 @@ void io::VtkWriter::writeTimeStep(
vtkFile
<<
"<CellData>"
<<
std
::
endl
;
// Water surface height
(h+b)
vtkFile
<<
"<DataArray Name=
\"
H
\"
type=
\"
Float32
\"
format=
\"
ascii
\"
>"
<<
std
::
endl
;
// Water surface height
h
vtkFile
<<
"<DataArray Name=
\"
h
\"
type=
\"
Float32
\"
format=
\"
ascii
\"
>"
<<
std
::
endl
;
for
(
int
j
=
1
;
j
<
nY
+
1
;
j
++
)
for
(
int
i
=
1
;
i
<
nX
+
1
;
i
++
)
vtkFile
<<
i_h
[
i
][
j
]
+
b
[
i
][
j
]
<<
std
::
endl
;
vtkFile
<<
i_h
[
i
][
j
]
<<
std
::
endl
;
vtkFile
<<
"</DataArray>"
<<
std
::
endl
;
//
Velocitie
s
vtkFile
<<
"<DataArray Name=
\"
U
\"
type=
\"
Float32
\"
format=
\"
ascii
\"
>"
<<
std
::
endl
;
//
Momentum
s
vtkFile
<<
"<DataArray Name=
\"
hu
\"
type=
\"
Float32
\"
format=
\"
ascii
\"
>"
<<
std
::
endl
;
for
(
int
j
=
1
;
j
<
nY
+
1
;
j
++
)
for
(
int
i
=
1
;
i
<
nX
+
1
;
i
++
)
vtkFile
<<
((
i_h
[
i
][
j
]
>
0
)
?
i_hu
[
i
][
j
]
/
i_h
[
i
][
j
]
:
0.0
)
<<
std
::
endl
;
vtkFile
<<
i_hu
[
i
][
j
]
<<
std
::
endl
;
vtkFile
<<
"</DataArray>"
<<
std
::
endl
;
vtkFile
<<
"<DataArray Name=
\"
V
\"
type=
\"
Float32
\"
format=
\"
ascii
\"
>"
<<
std
::
endl
;
vtkFile
<<
"<DataArray Name=
\"
hv
\"
type=
\"
Float32
\"
format=
\"
ascii
\"
>"
<<
std
::
endl
;
for
(
int
j
=
1
;
j
<
nY
+
1
;
j
++
)
for
(
int
i
=
1
;
i
<
nX
+
1
;
i
++
)
vtkFile
<<
((
i_h
[
i
][
j
]
>
0
)
?
i_hv
[
i
][
j
]
/
i_h
[
i
][
j
]
:
0.0
)
<<
std
::
endl
;
vtkFile
<<
i_hv
[
i
][
j
]
<<
std
::
endl
;
vtkFile
<<
"</DataArray>"
<<
std
::
endl
;
// Bathymetry
vtkFile
<<
"<DataArray Name=
\"
B
\"
type=
\"
Float32
\"
format=
\"
ascii
\"
>"
<<
std
::
endl
;
vtkFile
<<
"<DataArray Name=
\"
b
\"
type=
\"
Float32
\"
format=
\"
ascii
\"
>"
<<
std
::
endl
;
for
(
int
j
=
1
;
j
<
nY
+
1
;
j
++
)
for
(
int
i
=
1
;
i
<
nX
+
1
;
i
++
)
vtkFile
<<
b
[
i
][
j
]
<<
std
::
endl
;
...
...
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