Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
amdis
amdis-core
Commits
3e29302d
Commit
3e29302d
authored
Oct 29, 2020
by
Praetorius, Simon
Browse files
Add deduction guides to DiscreteFunction to allow construction from DOFVector
parent
99e2a494
Changes
2
Hide whitespace changes
Inline
Side-by-side
amdis/DOFVector.hpp
View file @
3e29302d
...
...
@@ -38,11 +38,14 @@ namespace AMDiS
,
private
Observer
<
event
::
postAdapt
>
{
using
Self
=
DOFVector
;
using
Coefficients
=
VectorFacade
<
T
,
TraitsType
::
template
VectorImpl
>;
public:
/// A global basis associated to the coefficients
using
GlobalBasis
=
GB
;
/// The internal coefficient vector storage
using
Coefficients
=
VectorFacade
<
T
,
TraitsType
::
template
VectorImpl
>;
/// The index/size - type
using
size_type
=
typename
GlobalBasis
::
size_type
;
...
...
amdis/gridfunctions/DiscreteFunction.hpp
View file @
3e29302d
...
...
@@ -52,12 +52,20 @@ namespace AMDiS
public:
/// Constructor. Stores a pointer to the mutable `dofvector`.
template
<
class
Path
>
DiscreteFunction
(
Coefficients
&
dofVector
,
GlobalBasis
const
&
basis
,
Path
const
&
path
)
:
Super
(
dofVector
,
basis
,
path
)
template
<
class
...
Path
>
DiscreteFunction
(
Coefficients
&
dofVector
,
GlobalBasis
const
&
basis
,
Path
...
path
)
:
Super
(
dofVector
,
basis
,
path
...
)
,
mutableCoeff_
(
&
dofVector
)
{}
/// Construct a DiscreteFunction directly from a DOFVector
template
<
class
DV
,
class
...
Path
,
class
Coeff_
=
TYPEOF
(
std
::
declval
<
DV
>().
coefficients
()),
class
GB_
=
TYPEOF
(
*
std
::
declval
<
DV
>
().
basis
())
>
DiscreteFunction
(
DV
&&
dofVector
,
Path
...
path
)
:
DiscreteFunction
(
dofVector
.
coefficients
(),
*
dofVector
.
basis
(),
path
...)
{}
public:
/// \brief Interpolation of GridFunction to DOFVector, assuming that there is no
/// reference to this DOFVector in the expression.
...
...
@@ -172,15 +180,24 @@ namespace AMDiS
public:
/// Constructor. Stores a pointer to the dofVector and a copy of the treePath.
template
<
class
Path
>
DiscreteFunction
(
Coefficients
const
&
coefficients
,
GlobalBasis
const
&
basis
,
Path
const
&
path
)
template
<
class
...
Path
>
DiscreteFunction
(
Coefficients
const
&
coefficients
,
GlobalBasis
const
&
basis
,
Path
...
path
)
:
coefficients_
(
&
coefficients
)
,
basis_
(
&
basis
)
,
treePath_
(
makeTreePath
(
path
))
,
treePath_
(
makeTreePath
(
path
...
))
,
entitySet_
(
basis_
->
gridView
())
,
nodeToRangeEntry_
(
Dune
::
Functions
::
makeDefaultNodeToRangeMap
(
*
basis_
,
treePath_
))
{}
/// Construct a DiscreteFunction directly from a DOFVector
template
<
class
DV
,
class
...
Path
,
class
Coeff_
=
TYPEOF
(
std
::
declval
<
DV
>().
coefficients
()),
class
GB_
=
TYPEOF
(
*
std
::
declval
<
DV
>
().
basis
())
>
DiscreteFunction
(
DV
const
&
dofVector
,
Path
...
path
)
:
DiscreteFunction
(
dofVector
.
coefficients
(),
*
dofVector
.
basis
(),
path
...)
{}
/// \brief Evaluate DiscreteFunction in global coordinates. NOTE: expensive
Range
operator
()(
Domain
const
&
x
)
const
;
...
...
@@ -229,6 +246,21 @@ namespace AMDiS
NodeToRangeEntry
nodeToRangeEntry_
;
};
// deduction guides
template
<
class
Coeff
,
class
GB
,
class
...
Path
,
class
TP
=
TYPEOF
(
makeTreePath
(
std
::
declval
<
Path
>()...)),
REQUIRES
(
Concepts
::
GlobalBasis
<
GB
>
)
>
DiscreteFunction
(
Coeff
&
,
GB
const
&
,
Path
...)
->
DiscreteFunction
<
Coeff
,
GB
,
TP
>
;
template
<
class
DV
,
class
...
Path
,
class
Coeff
=
decltype
(
std
::
declval
<
DV
>().
coefficients
()),
class
GB
=
decltype
(
*
std
::
declval
<
DV
>
().
basis
()),
class
TP
=
TYPEOF
(
makeTreePath
(
std
::
declval
<
Path
>
()...))
>
DiscreteFunction
(
DV
&
,
Path
...)
->
DiscreteFunction
<
std
::
remove_reference_t
<
Coeff
>
,
std
::
decay_t
<
GB
>
,
TP
>
;
}
// end namespace AMDiS
#include
"DiscreteLocalFunction.inc.hpp"
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment