Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
dumux-repositories
dumux
Commits
41cbd22a
Commit
41cbd22a
authored
Oct 18, 2019
by
Katharina Heck
Browse files
Merge branch 'cherry-pick-
114e568d
' into 'releases/3.1'
Merge branch 'fix/pointcloudwriter' into 'master' See merge request
!1765
parents
30790a09
65d21bfa
Changes
1
Hide whitespace changes
Inline
Side-by-side
dumux/io/pointcloudvtkwriter.hh
View file @
41cbd22a
...
...
@@ -24,12 +24,13 @@
#ifndef DUMUX_POINTCLOUD_VTK_WRITER_HH
#define DUMUX_POINTCLOUD_VTK_WRITER_HH
#include
<string>
#include
<vector>
#include
<list>
#include
<dune/common/fvector.hh>
#include
<dumux/io/vtkoutputmodule.hh>
#include
<dumux/io/staggeredvtkoutputmodule.hh>
#include
<dune/grid/io/file/vtk/common.hh>
#include
<dune/common/exceptions.hh>
#include
<dune/common/path.hh>
#include
<dune/grid/io/file/vtk/common.hh>
namespace
Dumux
{
...
...
@@ -45,7 +46,9 @@ namespace Dumux {
template
<
class
Scalar
,
class
GlobalPosition
>
class
PointCloudVtkWriter
{
using
DimVector
=
Dune
::
FieldVector
<
Scalar
,
GlobalPosition
::
size
()
>
;
// GlobalPosition is used for the point coordinates, DimWorldVector for the actual data.
// GlobalPosition's ctype does not necessarily equal Scalar.
using
DimWorldVector
=
Dune
::
FieldVector
<
Scalar
,
GlobalPosition
::
size
()
>
;
static
constexpr
unsigned
int
precision
=
6
;
static
constexpr
unsigned
int
numBeforeLineBreak
=
15
;
...
...
@@ -117,7 +120,7 @@ class PointCloudVtkWriter
public:
using
ScalarFunction
=
VTKFunction
<
std
::
vector
<
Scalar
>>
;
using
VectorFunction
=
VTKFunction
<
std
::
vector
<
DimVector
>>
;
using
VectorFunction
=
VTKFunction
<
std
::
vector
<
Dim
World
Vector
>>
;
PointCloudVtkWriter
(
const
std
::
vector
<
GlobalPosition
>&
coordinates
)
:
coordinates_
(
coordinates
)
...
...
@@ -139,22 +142,20 @@ public:
writeCoordinates_
(
file
,
coordinates_
);
writeDataInfo_
(
file
);
for
(
auto
&&
data
:
scalarPointData_
)
{
for
(
auto
&&
data
:
scalarPointData_
)
writeData_
(
file
,
data
);
}
for
(
auto
&&
data
:
vectorPointData_
)
{
for
(
auto
&&
data
:
vectorPointData_
)
writeData_
(
file
,
data
);
}
file
<<
"</PointData>
\n
"
;
if
(
!
scalarPointData_
.
empty
()
||
!
vectorPointData_
.
empty
())
file
<<
"</PointData>
\n
"
;
file
<<
"</Piece>
\n
"
;
file
<<
"</PolyData>
\n
"
;
file
<<
"</VTKFile>"
;
clear
();
file
.
close
();
}
...
...
@@ -197,7 +198,7 @@ public:
* \param v The vector containing the data
* \param name The name of the data set
*/
void
addPointData
(
const
std
::
vector
<
DimVector
>&
v
,
const
std
::
string
&
name
)
void
addPointData
(
const
std
::
vector
<
Dim
World
Vector
>&
v
,
const
std
::
string
&
name
)
{
assert
(
v
.
size
()
==
coordinates_
.
size
());
vectorPointData_
.
push_back
(
VectorFunction
(
v
,
name
,
3
));
...
...
@@ -396,13 +397,13 @@ private:
* \param file The output file
* \param g The vector
*/
void
writeToFile_
(
std
::
ostream
&
file
,
const
DimVector
&
g
)
void
writeToFile_
(
std
::
ostream
&
file
,
const
Dim
World
Vector
&
g
)
{
assert
(
g
.
size
()
>
1
&&
g
.
size
()
<
4
);
if
(
g
.
size
()
<
3
)
file
<<
g
<<
" 0 "
;
else
file
<<
g
;
file
<<
g
<<
" "
;
}
const
std
::
vector
<
GlobalPosition
>&
coordinates_
;
...
...
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