Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pacxx-projectseminar-2019
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
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
Vladyslav Kucher
pacxx-projectseminar-2019
Commits
46e95874
Commit
46e95874
authored
5 years ago
by
Jö Fahlke
Browse files
Options
Downloads
Patches
Plain Diff
Make the operator really matrix-free
Closes:
#2
parent
4af8ca7f
No related branches found
Branches containing commit
No related tags found
1 merge request
!5
Make the operator really matrix-free
Pipeline
#19405
passed
5 years ago
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/linearsolver.hh
+11
-10
11 additions, 10 deletions
src/linearsolver.hh
with
11 additions
and
10 deletions
src/linearsolver.hh
+
11
−
10
View file @
46e95874
...
...
@@ -54,36 +54,37 @@ namespace PPS {
};
template
<
class
GridOperator
,
class
X
,
class
Y
>
class
Fake
LinearizedMatrixFreeOperator
:
class
LinearizedMatrixFreeOperator
:
public
Dune
::
LinearOperator
<
X
,
Y
>
,
public
LinearizedOperatorMixin
<
X
>
{
using
field_type
=
typename
Y
::
field_type
;
using
Matrix
=
Dune
::
BCRSMatrix
<
Dune
::
FieldMatrix
<
field_type
,
1
,
1
>
>
;
const
GridOperator
*
go_
;
Matrix
matrix
_
;
X
linearizationPoint
_
;
public:
Fake
LinearizedMatrixFreeOperator
(
const
GridOperator
*
go
)
:
go_
(
go
)
,
matrix_
(
go
->
pattern
().
template
make
<
Matrix
>())
LinearizedMatrixFreeOperator
(
const
GridOperator
*
go
)
:
go_
(
go
)
{
}
void
linearizeAt
(
const
X
&
linearizationPoint
)
override
{
matrix_
=
0
;
go_
->
jacobian
(
linearizationPoint
,
matrix_
);
linearizationPoint_
=
linearizationPoint
;
}
//! apply operator to x: \f$ y = A(x) \f$
void
apply
(
const
X
&
x
,
Y
&
y
)
const
override
{
matrix_
.
mv
(
x
,
y
);
go_
->
nonlinear_jacobian_apply
(
linearizationPoint_
,
x
,
y
);
}
//! apply operator to x, scale and add: \f$ y = y + \alpha A(x) \f$
void
applyscaleadd
(
field_type
alpha
,
const
X
&
x
,
Y
&
y
)
const
override
{
matrix_
.
usmv
(
alpha
,
x
,
y
);
Y
y2
(
y
.
size
());
y2
=
0
;
go_
->
nonlinear_jacobian_apply
(
linearizationPoint_
,
x
,
y2
);
y
.
axpy
(
alpha
,
y2
);
}
//! Category of the solver (see SolverCategory::Category)
...
...
@@ -106,7 +107,7 @@ namespace PPS {
return
std
::
make_unique
<
Operator
>
(
go
);
}
if
(
type
==
"on-the-fly"
||
type
==
"matrix-free"
)
{
using
Operator
=
Fake
LinearizedMatrixFreeOperator
<
GridOperator
,
X
,
Y
>
;
using
Operator
=
LinearizedMatrixFreeOperator
<
GridOperator
,
X
,
Y
>
;
return
std
::
make_unique
<
Operator
>
(
go
);
}
DUNE_THROW
(
Dune
::
NotImplemented
,
"operator="
<<
type
);
...
...
This diff is collapsed.
Click to expand it.
Dr. Jorrit Fahlke
@jfahl_01
mentioned in issue
#10 (closed)
·
5 years ago
mentioned in issue
#10 (closed)
mentioned in issue #10
Toggle commit list
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