Skip to content
Snippets Groups Projects
Commit 714cd554 authored by Steffen Müthing's avatar Steffen Müthing
Browse files

[Infrastructure] Be more careful about field_type / real_type

This patch removes the assumption that the field_type and / or real_type
can always be implicitly converted to double and can be implicitly
constructed from an int (in constructs like field_type d = 0;).

This patch is required for compatibility with the FLOP counter in PDELab.
parent 6390935b
No related branches found
No related tags found
No related merge requests found
......@@ -412,7 +412,7 @@ namespace Dune {
if (i->local().attribute()!=OwnerOverlapCopyAttributeSet::owner)
mask[i->local().local()] = 0;
}
result = 0;
result = T2(0.0);
for (typename T1::size_type i=0; i<x.size(); i++)
result += x[i]*(y[i])*mask[i];
......@@ -439,10 +439,10 @@ namespace Dune {
if (i->local().attribute()!=OwnerOverlapCopyAttributeSet::owner)
mask[i->local().local()] = 0;
}
double result = 0;
typename T1::field_type result = typename T1::field_type(0.0);
for (typename T1::size_type i=0; i<x.size(); i++)
result += x[i].two_norm2()*mask[i];
return sqrt(cc.sum(result));
return static_cast<double>(sqrt(cc.sum(result)));
}
typedef Dune::EnumItem<AttributeSet,OwnerOverlapCopyAttributeSet::copy> CopyFlags;
......
......@@ -115,7 +115,7 @@ namespace Dune {
*/
virtual double norm (const X& x)
{
return x.two_norm();
return static_cast<double>(x.two_norm());
}
};
......
......@@ -128,7 +128,7 @@ namespace Dune
//! helper function for printing solver output
template <class DataType>
void printOutput(std::ostream& s,
const double iter,
const DataType& iter,
const DataType& norm,
const DataType& norm_old) const
{
......@@ -141,7 +141,7 @@ namespace Dune
//! helper function for printing solver output
template <class DataType>
void printOutput(std::ostream& s,
const double iter,
const DataType& iter,
const DataType& norm) const
{
s << std::setw(iterationSpacing) << iter << " ";
......
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment