Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-solvers
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
agnumpde
dune-solvers
Commits
dd62361e
Commit
dd62361e
authored
11 years ago
by
Elias Pipping
Committed by
pipping
11 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Make TwoNorm work for FieldVectors
[[Imported from SVN: r12469]]
parent
048a725a
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dune/solvers/norms/twonorm.hh
+34
-0
34 additions, 0 deletions
dune/solvers/norms/twonorm.hh
with
34 additions
and
0 deletions
dune/solvers/norms/twonorm.hh
+
34
−
0
View file @
dd62361e
...
...
@@ -4,6 +4,8 @@
#include
<cmath>
#include
<cstring>
// For size_t
#include
<dune/common/fvector.hh>
#include
"norm.hh"
//! Wrapper around the two_norm() method of a vector class
...
...
@@ -46,4 +48,36 @@ class TwoNorm : public Norm<VectorType>
};
template
<
typename
T
,
int
dimension
>
class
TwoNorm
<
Dune
::
FieldVector
<
T
,
dimension
>
>
:
public
Norm
<
Dune
::
FieldVector
<
T
,
dimension
>
>
{
typedef
Dune
::
FieldVector
<
T
,
dimension
>
VectorType
;
public:
/** \brief Destructor, doing nothing */
virtual
~
TwoNorm
()
{};
//! Compute the norm of the given vector
virtual
double
operator
()(
const
VectorType
&
f
)
const
{
return
f
.
two_norm
();
}
//! Compute the square of the norm of the given vector
virtual
double
normSquared
(
const
VectorType
&
f
)
const
{
return
f
.
two_norm2
();
}
//! Compute the norm of the difference of two vectors
virtual
double
diff
(
const
VectorType
&
f1
,
const
VectorType
&
f2
)
const
{
VectorType
tmp
=
f1
;
tmp
-=
f2
;
return
tmp
.
two_norm
();
}
};
#endif
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