Skip to content
GitLab
Menu
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
b4aa3f06
Commit
b4aa3f06
authored
Nov 14, 2017
by
Kilian Weishaupt
Browse files
[staggered][io] Complete faceWriter
* now allows writing out any Scalar valued or GlobalPos-type data on face
parent
ab2b1f23
Changes
2
Hide whitespace changes
Inline
Side-by-side
dumux/io/pointcloudvtkwriter.hh
View file @
b4aa3f06
...
...
@@ -178,10 +178,10 @@ public:
* \param name The name of the data set
* \param ncomps The number of components of the data set
*/
void
addPointData
(
const
std
::
vector
<
Scalar
>&
v
,
const
std
::
string
&
name
,
int
ncomps
=
1
)
void
addPointData
(
const
std
::
vector
<
Scalar
>&
v
,
const
std
::
string
&
name
)
{
assert
(
v
.
size
()
==
ncomps
*
coordinates_
.
size
());
scalarPointData_
.
push_back
(
ScalarFunction
(
v
,
name
,
ncomps
));
assert
(
v
.
size
()
==
coordinates_
.
size
());
scalarPointData_
.
push_back
(
ScalarFunction
(
v
,
name
,
1
));
}
/*!
...
...
@@ -191,10 +191,10 @@ public:
* \param name The name of the data set
* \param ncomps The number of components of the data set
*/
void
addPointData
(
const
std
::
vector
<
GlobalPosition
>&
v
,
const
std
::
string
&
name
,
int
ncomps
=
1
)
void
addPointData
(
const
std
::
vector
<
GlobalPosition
>&
v
,
const
std
::
string
&
name
)
{
assert
(
v
.
size
()
==
coordinates_
.
size
());
vectorPointData_
.
push_back
(
VectorFunction
(
v
,
name
,
ncomps
));
vectorPointData_
.
push_back
(
VectorFunction
(
v
,
name
,
3
));
}
/*!
...
...
dumux/io/staggeredvtkoutputmodule.hh
View file @
b4aa3f06
...
...
@@ -33,6 +33,7 @@
namespace
Dumux
{
/*!
* \ingroup InputOutput
* \brief A VTK output module to simplify writing dumux simulation data to VTK format
...
...
@@ -62,9 +63,6 @@ class StaggeredVtkOutputModule : public VtkOutputModule<TypeTag>
typename
DofTypeIndices
::
CellCenterIdx
cellCenterIdx
;
typename
DofTypeIndices
::
FaceIdx
faceIdx
;
struct
PriVarScalarDataInfo
{
unsigned
int
pvIdx
;
std
::
string
name
;
};
struct
PriVarVectorDataInfo
{
std
::
vector
<
unsigned
int
>
pvIdx
;
std
::
string
name
;
};
struct
FaceVarScalarDataInfo
{
std
::
function
<
Scalar
(
const
FaceVariables
&
)
>
get
;
std
::
string
name
;
};
struct
FaceVarVectorDataInfo
{
std
::
function
<
GlobalPosition
(
const
SubControlVolumeFace
&
scvf
,
const
FaceVariables
&
)
>
get
;
std
::
string
name
;
};
...
...
@@ -101,11 +99,19 @@ public:
//////////////////////////////////////////////////////////////////////////////////////////////
template
<
typename
Vector
>
void
addFaceField
(
const
Vector
&
v
,
const
std
::
string
&
name
,
int
nComp
=
1
)
void
addFaceField
(
const
Vector
&
v
,
const
std
::
string
&
name
)
{
static_assert
(
std
::
is_same
<
Vector
,
std
::
vector
<
Scalar
>>::
value
||
std
::
is_same
<
Vector
,
std
::
vector
<
GlobalPosition
>>::
value
,
"Only vectors of Scalar or GlobalPosition are supported"
);
if
(
v
.
size
()
==
this
->
gridGeom_
.
gridView
().
size
(
1
))
int
x
;
// fields_.emplace_back(gridGeom_.gridView(), gridGeom_.elementMapper(), v, name, nComp, 0);
{
if
(
!
coordinatesInitialized_
)
updateCoordinates_
();
faceWriter_
->
addPointData
(
v
,
name
);
}
else
DUNE_THROW
(
Dune
::
RangeError
,
"Size mismatch of added field!"
);
}
...
...
@@ -200,11 +206,12 @@ private:
if
(
!
faceVarVectorDataInfo_
.
empty
())
for
(
std
::
size_t
i
=
0
;
i
<
faceVarVectorDataInfo_
.
size
();
++
i
)
faceWriter_
->
addPointData
(
faceVarVectorData
[
i
],
faceVarVectorDataInfo_
[
i
].
name
,
3
);
faceWriter_
->
addPointData
(
faceVarVectorData
[
i
],
faceVarVectorDataInfo_
[
i
].
name
);
sequenceWriter_
.
write
(
time
);
// faceScalarFields_.clear();
// faceVectorFields_.clear();
coordinates_
.
clear
();
coordinates_
.
shrink_to_fit
();
coordinatesInitialized_
=
false
;
}
...
...
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