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
7eab8984
Commit
7eab8984
authored
Mar 27, 2019
by
Samuel Scherrer
Browse files
[io][precision] started work on setting precision. Doesn't work with containers of containers yet.
parent
e4f43fd7
Changes
2
Hide whitespace changes
Inline
Side-by-side
dumux/io/container.hh
View file @
7eab8984
...
...
@@ -30,9 +30,12 @@
#include
<iostream>
#include
<fstream>
#include
<iterator>
#include
<iomanip>
#include
<limits>
namespace
Dumux
{
/*!
* \ingroup InputOutput
* \brief Writes a container to file
...
...
@@ -46,6 +49,8 @@ void writeContainerToFile(const Container& v,
const
std
::
string
&
filename
)
{
std
::
ofstream
outfile
(
filename
,
std
::
ios
::
out
);
outfile
<<
std
::
scientific
;
outfile
<<
std
::
setprecision
(
std
::
numeric_limits
<
typename
Container
::
value_type
>::
max_digits10
+
1
);
std
::
ostream_iterator
<
typename
Container
::
value_type
>
it
(
outfile
,
"
\n
"
);
std
::
copy
(
v
.
begin
(),
v
.
end
(),
it
);
}
...
...
test/io/container/test_container_io.cc
View file @
7eab8984
...
...
@@ -109,7 +109,7 @@ int main()
passed
=
passed
&&
Dumux
::
testContainerWriter
<
std
::
array
<
int
,
2
>>
({{
1
,
2
}});
passed
=
passed
&&
Dumux
::
testContainerWriter
<
std
::
array
<
std
::
string
,
2
>>
({{
"1.0"
,
"2.0"
}});
passed
=
passed
&&
Dumux
::
testContainerWriter
<
std
::
array
<
Dune
::
FieldVector
<
double
,
3
>
,
2
>>
(
std
::
array
<
Dune
::
FieldVector
<
double
,
3
>
,
2
>
{{
Dune
::
FieldVector
<
double
,
3
>
(
0.0
),
Dune
::
FieldVector
<
double
,
3
>
(
1.0
)}});
std
::
array
<
Dune
::
FieldVector
<
double
,
3
>
,
2
>
{{
Dune
::
FieldVector
<
double
,
3
>
(
0.0
000100012004
),
Dune
::
FieldVector
<
double
,
3
>
(
1.
12341502e-1
0
)}});
if
(
!
passed
)
return
1
;
return
0
;
...
...
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