Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-istl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Core Modules
dune-istl
Commits
48602258
Commit
48602258
authored
11 years ago
by
Christian Engwer
Browse files
Options
Downloads
Patches
Plain Diff
[MultiTypeBlockVector]
use FieldTraits to determin the return type of the norm methods
parent
19c8ba47
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dune/istl/multitypeblockvector.hh
+9
-4
9 additions, 4 deletions
dune/istl/multitypeblockvector.hh
with
9 additions
and
4 deletions
dune/istl/multitypeblockvector.hh
+
9
−
4
View file @
48602258
...
...
@@ -10,6 +10,7 @@
#include
<iostream>
#include
<dune/common/dotproduct.hh>
#include
<dune/common/ftraits.hh>
#include
"istlexception.hh"
...
...
@@ -215,11 +216,13 @@ namespace Dune {
template
<
int
count
,
typename
T
>
class
MultiTypeBlockVector_Norm
{
public:
typedef
typename
T
::
field_type
field_type
;
typedef
typename
FieldTraits
<
field_type
>::
real_type
real_type
;
/**
* sum up all elements' 2-norms
*/
static
doubl
e
result
(
const
T
&
a
)
{
//result = sum of all elements' 2-norms
static
real_typ
e
result
(
const
T
&
a
)
{
//result = sum of all elements' 2-norms
return
fusion
::
at_c
<
count
-
1
>
(
a
).
two_norm2
()
+
MultiTypeBlockVector_Norm
<
count
-
1
,
T
>::
result
(
a
);
}
};
...
...
@@ -227,7 +230,9 @@ namespace Dune {
template
<
typename
T
>
//recursion end: no more vector elements to add...
class
MultiTypeBlockVector_Norm
<
0
,
T
>
{
public:
static
double
result
(
const
T
&
a
)
{
return
0.0
;}
typedef
typename
T
::
field_type
field_type
;
typedef
typename
FieldTraits
<
field_type
>::
real_type
real_type
;
static
real_type
result
(
const
T
&
a
)
{
return
0.0
;}
};
/**
...
...
@@ -282,12 +287,12 @@ namespace Dune {
/**
* two-norm^2
*/
doubl
e
two_norm2
()
const
{
return
MultiTypeBlockVector_Norm
<
mpl
::
size
<
type
>::
value
,
type
>::
result
(
*
this
);}
typename
FieldTraits
<
field_type
>::
real_typ
e
two_norm2
()
const
{
return
MultiTypeBlockVector_Norm
<
mpl
::
size
<
type
>::
value
,
type
>::
result
(
*
this
);}
/**
* the real two-norm
*/
doubl
e
two_norm
()
const
{
return
sqrt
(
this
->
two_norm2
());}
typename
FieldTraits
<
field_type
>::
real_typ
e
two_norm
()
const
{
return
sqrt
(
this
->
two_norm2
());}
/**
* axpy operation on this vector (*this += a * y)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment