Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
dumux
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
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
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
dumux-repositories
dumux
Commits
c7d4fbea
Commit
c7d4fbea
authored
6 months ago
by
Timo Koch
Browse files
Options
Downloads
Patches
Plain Diff
[common] Make variables backend work with FieldVector
parent
84c0c210
No related branches found
Branches containing commit
No related tags found
1 merge request
!3852
Nonlinear least squares solver
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dumux/common/variablesbackend.hh
+26
-4
26 additions, 4 deletions
dumux/common/variablesbackend.hh
with
26 additions
and
4 deletions
dumux/common/variablesbackend.hh
+
26
−
4
View file @
c7d4fbea
...
...
@@ -25,6 +25,8 @@
#include
<dune/common/typetraits.hh>
#include
<dune/istl/bvector.hh>
#include
<dumux/common/typetraits/isvalid.hh>
// forward declaration
namespace
Dune
{
...
...
@@ -33,6 +35,21 @@ class MultiTypeBlockVector;
}
// end namespace Dune
namespace
Dumux
::
Detail
::
DofBackend
{
struct
HasResize
{
template
<
class
V
>
auto
operator
()(
const
V
&
v
)
->
decltype
(
std
::
declval
<
V
>
().
resize
(
0
))
{}
};
template
<
class
Vector
>
static
constexpr
auto
hasResize
()
{
return
decltype
(
isValid
(
HasResize
())(
std
::
declval
<
Vector
>
())
)
::
value
;
}
}
// end namespace Dumux::Detail::VariablesBackend
namespace
Dumux
{
/*!
...
...
@@ -89,7 +106,12 @@ public:
//! Make a zero-initialized dof vector instance
static
DofVector
zeros
(
SizeType
size
)
{
DofVector
d
;
d
.
resize
(
size
);
return
d
;
}
{
DofVector
d
;
if
constexpr
(
Detail
::
DofBackend
::
hasResize
<
Vector
>
())
d
.
resize
(
size
);
return
d
;
}
//! Perform axpy operation (y += a * x)
template
<
class
OtherDofVector
>
...
...
@@ -172,9 +194,9 @@ class VariablesBackend;
*/
template
<
class
Vars
>
class
VariablesBackend
<
Vars
,
false
>
:
public
DofBackend
<
Vars
>
:
public
Dumux
::
DofBackend
<
Vars
>
{
using
ParentType
=
DofBackend
<
Vars
>
;
using
ParentType
=
Dumux
::
DofBackend
<
Vars
>
;
public:
using
Variables
=
Vars
;
...
...
@@ -200,7 +222,7 @@ public:
*/
template
<
class
Vars
>
class
VariablesBackend
<
Vars
,
true
>
:
public
DofBackend
<
typename
Vars
::
SolutionVector
>
:
public
Dumux
::
DofBackend
<
typename
Vars
::
SolutionVector
>
{
public:
using
DofVector
=
typename
Vars
::
SolutionVector
;
...
...
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