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
9277c585
Commit
9277c585
authored
Nov 18, 2020
by
Praetorius, Simon
Browse files
Fix definition of NodeCache in DiscreteFunction
parent
d8ec05df
Changes
2
Hide whitespace changes
Inline
Side-by-side
amdis/gridfunctions/DiscreteFunction.hpp
View file @
9277c585
...
...
@@ -53,6 +53,11 @@ namespace AMDiS
,
mutableCoeff_
(
&
dofVector
)
{}
template
<
class
...
Path
>
DiscreteFunction
(
Coefficients
&
dofVector
,
std
::
shared_ptr
<
GlobalBasis
const
>
const
&
basis
,
Path
...
path
)
:
DiscreteFunction
(
dofVector
,
*
basis
,
path
...)
{}
/// Construct a DiscreteFunction directly from a DOFVector
template
<
class
DV
,
class
...
Path
,
class
Coeff_
=
TYPEOF
(
std
::
declval
<
DV
>().
coefficients
()),
...
...
@@ -146,7 +151,7 @@ namespace AMDiS
using
Tree
=
typename
GlobalBasis
::
LocalView
::
Tree
;
using
SubTree
=
typename
Dune
::
TypeTree
::
ChildForTreePath
<
Tree
,
TreePath
>
;
using
TreeCache
=
typename
GlobalBasis
::
LocalView
::
TreeCache
;
using
TreeCache
=
NodeCache_t
<
Tree
>
;
using
SubTreeCache
=
typename
Dune
::
TypeTree
::
ChildForTreePath
<
TreeCache
,
TreePath
>
;
using
NodeToRangeEntry
=
Dune
::
Functions
::
DefaultNodeToRangeMap
<
SubTree
>
;
...
...
@@ -188,12 +193,17 @@ namespace AMDiS
,
nodeToRangeEntry_
(
Dune
::
Functions
::
makeDefaultNodeToRangeMap
(
*
basis_
,
treePath_
))
{}
template
<
class
...
Path
>
DiscreteFunction
(
Coefficients
const
&
coefficients
,
std
::
shared_ptr
<
GlobalBasis
const
>
const
&
basisPtr
,
Path
...
path
)
:
DiscreteFunction
(
coefficients
,
*
basisPtr
,
path
...)
{}
/// 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
())
>
class
GB_
=
TYPEOF
(
std
::
declval
<
DV
>
().
basis
())
>
DiscreteFunction
(
DV
const
&
dofVector
,
Path
...
path
)
:
DiscreteFunction
(
dofVector
.
coefficients
(),
*
dofVector
.
basis
(),
path
...)
:
DiscreteFunction
(
dofVector
.
coefficients
(),
dofVector
.
basis
(),
path
...)
{}
...
...
@@ -247,18 +257,19 @@ namespace AMDiS
// deduction guides
template
<
class
Coeff
,
class
G
B
,
class
...
Path
,
template
<
class
Coeff
,
class
B
asis
,
class
...
Path
,
class
TP
=
TYPEOF
(
makeTreePath
(
std
::
declval
<
Path
>()...)),
class
GB
=
Underlying_t
<
Basis
>
,
REQUIRES
(
Concepts
::
GlobalBasis
<
GB
>
)
>
DiscreteFunction
(
Coeff
&
,
G
B
const
&
,
Path
...)
DiscreteFunction
(
Coeff
&
,
B
asis
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
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
>
;
->
DiscreteFunction
<
std
::
remove_reference_t
<
Coeff
>
,
Underlying
_t
<
GB
>
,
TP
>
;
// grid functions representing the DOFVector
...
...
@@ -284,7 +295,7 @@ namespace AMDiS
class
=
decltype
(
std
::
declval
<
DV
>
().
basis
())
>
auto
valueOf
(
DV
&
dofVec
,
Indices
...
ii
)
{
return
DiscreteFunction
{
dofVec
.
coefficients
(),
*
dofVec
.
basis
(),
makeTreePath
(
ii
...)};
return
DiscreteFunction
{
dofVec
.
coefficients
(),
dofVec
.
basis
(),
makeTreePath
(
ii
...)};
}
}
// end namespace AMDiS
...
...
amdis/gridfunctions/DiscreteLocalFunction.inc.hpp
View file @
9277c585
...
...
@@ -54,14 +54,16 @@ public:
LocalFunction
(
DiscreteFunction
const
&
globalFunction
)
:
globalFunction_
(
globalFunction
)
,
localView_
(
globalFunction_
.
basis
().
localView
())
,
subTreeCache_
(
&
Dune
::
TypeTree
::
child
(
localView_
.
treeCache
(),
globalFunction_
.
treePath
()))
,
treeCache_
(
makeNodeCache
(
localView_
.
tree
()))
,
subTreeCache_
(
&
Dune
::
TypeTree
::
child
(
treeCache_
,
globalFunction_
.
treePath
()))
{}
/// Copy constructor.
LocalFunction
(
LocalFunction
const
&
other
)
:
globalFunction_
(
other
.
globalFunction_
)
,
localView_
(
globalFunction_
.
basis
().
localView
())
,
subTreeCache_
(
&
Dune
::
TypeTree
::
child
(
localView_
.
treeCache
(),
globalFunction_
.
treePath
()))
,
treeCache_
(
makeNodeCache
(
localView_
.
tree
()))
,
subTreeCache_
(
&
Dune
::
TypeTree
::
child
(
treeCache_
,
globalFunction_
.
treePath
()))
{}
/// \brief Bind the LocalView to the element
...
...
@@ -149,6 +151,7 @@ public:
private:
DiscreteFunction
globalFunction_
;
LocalView
localView_
;
TreeCache
treeCache_
;
SubTreeCache
const
*
subTreeCache_
;
std
::
vector
<
ValueType
>
localCoefficients_
;
...
...
@@ -182,7 +185,8 @@ public:
:
globalFunction_
(
globalFunction
)
,
type_
(
type
)
,
localView_
(
globalFunction_
.
basis
().
localView
())
,
subTreeCache_
(
&
Dune
::
TypeTree
::
child
(
localView_
.
treeCache
(),
globalFunction_
.
treePath
()))
,
treeCache_
(
makeNodeCache
(
localView_
.
tree
()))
,
subTreeCache_
(
&
Dune
::
TypeTree
::
child
(
treeCache_
,
globalFunction_
.
treePath
()))
{}
/// Copy constructor.
...
...
@@ -190,7 +194,8 @@ public:
:
globalFunction_
(
other
.
globalFunction_
)
,
type_
(
other
.
type_
)
,
localView_
(
globalFunction_
.
basis
().
localView
())
,
subTreeCache_
(
&
Dune
::
TypeTree
::
child
(
localView_
.
treeCache
(),
globalFunction_
.
treePath
()))
,
treeCache_
(
makeNodeCache
(
localView_
.
tree
()))
,
subTreeCache_
(
&
Dune
::
TypeTree
::
child
(
treeCache_
,
globalFunction_
.
treePath
()))
{}
void
bind
(
Element
const
&
element
)
...
...
@@ -238,6 +243,7 @@ protected:
DiscreteFunction
globalFunction_
;
Type
type_
;
LocalView
localView_
;
TreeCache
treeCache_
;
SubTreeCache
const
*
subTreeCache_
;
std
::
optional
<
Geometry
>
geometry_
;
std
::
vector
<
ValueType
>
localCoefficients_
;
...
...
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