Skip to content
Snippets Groups Projects
Commit 621e756d authored by Oliver Sander's avatar Oliver Sander
Browse files

Fix OwnerOverlapCopyCommunication::norm for scalar vector entries

parent 5a6ab47b
No related branches found
No related tags found
1 merge request!307Unit test for scalar products
......@@ -435,6 +435,8 @@ namespace Dune {
template<class T1>
typename FieldTraits<typename T1::field_type>::real_type norm (const T1& x) const
{
using real_type = typename FieldTraits<typename T1::field_type>::real_type;
// set up mask vector
if (mask.size()!=static_cast<typename std::vector<double>::size_type>(x.size()))
{
......@@ -445,10 +447,10 @@ namespace Dune {
if (i->local().attribute()!=OwnerOverlapCopyAttributeSet::owner)
mask[i->local().local()] = 0;
}
typename T1::field_type result = typename T1::field_type(0.0);
auto result = real_type(0.0);
for (typename T1::size_type i=0; i<x.size(); i++)
result += x[i].two_norm2()*mask[i];
return static_cast<double>(sqrt(cc.sum(result)));
result += Impl::asVector(x[i]).two_norm2()*mask[i];
return sqrt(cc.sum(result));
}
typedef Dune::EnumItem<AttributeSet,OwnerOverlapCopyAttributeSet::copy> CopyFlags;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment