Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-matrix-vector
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
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
agnumpde
dune-matrix-vector
Commits
2693915e
Commit
2693915e
authored
8 years ago
by
Elias Pipping
Browse files
Options
Downloads
Patches
Plain Diff
Incorporate addToDiagonal from StaticMatrix
parent
273fa630
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
dune/matrix-vector/CMakeLists.txt
+1
-0
1 addition, 0 deletions
dune/matrix-vector/CMakeLists.txt
dune/matrix-vector/addtodiagonal.hh
+44
-0
44 additions, 0 deletions
dune/matrix-vector/addtodiagonal.hh
with
45 additions
and
0 deletions
dune/matrix-vector/CMakeLists.txt
+
1
−
0
View file @
2693915e
#install headers
install
(
FILES
addtodiagonal.hh
axpy.hh
componentwisematrixmap.hh
genericvectortools.hh
...
...
This diff is collapsed.
Click to expand it.
dune/matrix-vector/addtodiagonal.hh
0 → 100644
+
44
−
0
View file @
2693915e
#ifndef DUNE_MATRIX_VECTOR_ADDTODIAGONAL_HH
#define DUNE_MATRIX_VECTOR_ADDTODIAGONAL_HH
#include
<dune/istl/scaledidmatrix.hh>
namespace
Dune
{
namespace
MatrixVector
{
template
<
class
Matrix
>
static
void
addToDiagonal
(
Matrix
&
x
,
const
typename
Matrix
::
field_type
a
)
{
for
(
int
i
=
0
;
i
<
Matrix
::
rows
;
++
i
)
x
[
i
][
i
]
+=
a
;
}
/*
the line
template <typename FieldType, int n> static void
addToDiagonal(Dune::ScaledIdentityMatrix<FieldType,n>& x, const
FieldType a)
should NOT be used as it may lead to ambiguities in which case the
general method above will be used. an example is the line taken
from massassembler.hh (line 83 at the time):
StaticMatrix::addToDiagonal(localMatrix[i][i], values[i] * zi);
where values[i] is of type FieldVector<FieldType,1> and zi is a
double. This call then does not exactly fit this specialization
(without the implicit cast of FV<FT,1>) and hence some wild
template voodoo decides which of the templates is to be taken - in
this case with a gcc 4.4.5 that was the one above leading to a
wrong factor n in the diagonal value
*/
template
<
typename
FieldType
,
int
n
>
static
void
addToDiagonal
(
Dune
::
ScaledIdentityMatrix
<
FieldType
,
n
>&
x
,
const
typename
Dune
::
ScaledIdentityMatrix
<
FieldType
,
n
>::
field_type
a
)
{
x
.
scalar
()
+=
a
;
}
}
}
#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