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
af1d36c3
Commit
af1d36c3
authored
Sep 03, 2020
by
Praetorius, Simon
Browse files
add constructor and deduction guide for DOFVector
parent
6b3c8bca
Changes
5
Hide whitespace changes
Inline
Side-by-side
amdis/DOFVector.hpp
View file @
af1d36c3
...
...
@@ -13,6 +13,7 @@
#include
<amdis/Observer.hpp>
#include
<amdis/common/Concepts.hpp>
#include
<amdis/common/TypeTraits.hpp>
#include
<amdis/functions/ParallelGlobalBasis.hpp>
#include
<amdis/gridfunctions/DiscreteFunction.hpp>
#include
<amdis/typetree/TreePath.hpp>
...
...
@@ -74,12 +75,11 @@ namespace AMDiS
:
DOFVector
(
Dune
::
wrap_or_move
(
FWD
(
basis
)),
op
)
{}
/// (3) Constructor. Forwards to (1) by creating a new basis from a dune-functions basis.
template
<
class
GB_
,
REQUIRES
(
not
Concepts
::
Similar
<
GB_
,
GB
>),
REQUIRES
(
Concepts
::
GlobalBasis
<
GB_
>
)
>
DOFVector
(
GB_
&&
basis
,
DataTransferOperation
op
=
DataTransferOperation
::
INTERPOLATE
)
:
DOFVector
(
std
::
make_shared
<
GB
>
(
std
::
move
(
basis
)),
op
)
/// (3) Constructor. Forwards to (1) by creating a new basis from a dune-functions pre-basis factory.
template
<
class
GV
,
class
PBF
,
REQUIRES
(
Concepts
::
PreBasisFactory
<
PBF
,
GV
,
MultiIndex_t
<
PBF
>
>
)
>
DOFVector
(
GV
const
&
gridView
,
PBF
const
&
preBasisFactory
,
DataTransferOperation
op
=
DataTransferOperation
::
INTERPOLATE
)
:
DOFVector
(
std
::
make_shared
<
GB
>
(
gridView
,
preBasisFactory
),
op
)
{}
std
::
shared_ptr
<
GlobalBasis
const
>
const
&
basis
()
const
{
return
basis_
;
}
...
...
@@ -224,6 +224,10 @@ namespace AMDiS
DOFVector
(
GB
&&
basis
,
DataTransferOperation
op
=
DataTransferOperation
::
INTERPOLATE
)
->
DOFVector
<
ParallelGlobalBasis
<
typename
Underlying_t
<
GB
>::
PreBasis
>>
;
template
<
class
GV
,
class
PBF
>
DOFVector
(
GV
const
&
gridView
,
PBF
const
&
pbf
,
DataTransferOperation
op
=
DataTransferOperation
::
INTERPOLATE
)
->
DOFVector
<
decltype
(
ParallelGlobalBasis
{
gridView
,
pbf
})
>
;
/// \brief Create a DOFVector from a basis.
/**
...
...
amdis/ProblemStat.hpp
View file @
af1d36c3
...
...
@@ -116,7 +116,7 @@ namespace AMDiS
/// on the fly.
template
<
class
Grid_
,
class
PBF_
,
class
GV_
=
typename
Underlying_t
<
Grid_
>
::
LeafGridView
,
REQUIRES
(
Concepts
::
PreBasisFactory
<
PBF_
,
GV_
>
)
>
REQUIRES
(
Concepts
::
PreBasisFactory
<
PBF_
,
GV_
,
MultiIndex_t
<
PBF_
>
>
)
>
ProblemStat
(
std
::
string
const
&
name
,
Grid_
&&
grid
,
PBF_
const
&
preBasisFactory
)
:
ProblemStat
(
name
,
FWD
(
grid
))
{
...
...
@@ -536,7 +536,7 @@ namespace AMDiS
template
<
class
G
,
class
PBF
>
struct
DeducedProblemTraits
<
G
,
PBF
,
std
::
enable_if_t
<
Concepts
::
PreBasisFactory
<
PBF
,
typename
G
::
LeafGridView
>>>
std
::
enable_if_t
<
Concepts
::
PreBasisFactory
<
PBF
,
typename
G
::
LeafGridView
,
MultiIndex_t
<
PBF
>
>>>
{
using
Grid
=
AdaptiveGrid_t
<
G
>
;
using
GridView
=
typename
Grid
::
LeafGridView
;
...
...
amdis/common/Concepts.hpp
View file @
af1d36c3
...
...
@@ -192,11 +192,11 @@ namespace AMDiS
template
<
class
GB
,
class
GV
=
typename
GB
::
GridView
>
using
GlobalBasis_t
=
models_t
<
Dune
::
Functions
::
Concept
::
GlobalBasis
<
GV
>
(
GB
)
>
;
template
<
class
PBF
,
class
GV
,
class
M
ultiIndex
=
std
::
array
<
std
::
size_t
,
1
>
>
constexpr
bool
PreBasisFactory
=
models
<
Definition
::
PreBasisFactory
<
M
ultiIndex
>
(
PBF
,
GV
)
>
;
template
<
class
PBF
,
class
GV
,
class
M
I
=
std
::
array
<
std
::
size_t
,
1
>
>
constexpr
bool
PreBasisFactory
=
models
<
Definition
::
PreBasisFactory
<
M
I
>
(
PBF
,
GV
)
>
;
template
<
class
PBF
,
class
GV
,
class
M
ultiIndex
=
std
::
array
<
std
::
size_t
,
1
>
>
using
PreBasisFactory_t
=
models_t
<
Definition
::
PreBasisFactory
<
M
ultiIndex
>
(
PBF
,
GV
)
>
;
template
<
class
PBF
,
class
GV
,
class
M
I
=
std
::
array
<
std
::
size_t
,
1
>
>
using
PreBasisFactory_t
=
models_t
<
Definition
::
PreBasisFactory
<
M
I
>
(
PBF
,
GV
)
>
;
/** @} **/
...
...
amdis/functions/ParallelGlobalBasis.hpp
View file @
af1d36c3
...
...
@@ -38,7 +38,7 @@
namespace
AMDiS
{
template
<
class
PreBasisFactory
>
using
MultiIndex
=
std
::
conditional_t
<
using
MultiIndex
_t
=
std
::
conditional_t
<
(
remove_cvref_t
<
PreBasisFactory
>::
requiredMultiIndexSize
==
1
),
Dune
::
Functions
::
FlatMultiIndex
<
std
::
size_t
>
,
Dune
::
ReservedVector
<
std
::
size_t
,
remove_cvref_t
<
PreBasisFactory
>::
requiredMultiIndexSize
>>
;
...
...
@@ -101,9 +101,9 @@ namespace AMDiS
/// Construct this global basis with a preBasisFactory
template
<
class
PBF
>
ParallelGlobalBasis
(
std
::
string
const
&
name
,
GridView
const
&
gridView
,
PBF
&
&
preBasisFactory
)
ParallelGlobalBasis
(
std
::
string
const
&
name
,
GridView
const
&
gridView
,
PBF
const
&
preBasisFactory
)
:
ParallelGlobalBasis
(
name
,
gridView
.
grid
(),
preBasisFactory
.
template
makePreBasis
<
MultiIndex
<
PBF
>
>
(
gridView
))
preBasisFactory
.
template
makePreBasis
<
MultiIndex
_t
<
PBF
>
>
(
gridView
))
{}
/// Construct this global basis with empty name
...
...
@@ -181,11 +181,11 @@ namespace AMDiS
template
<
class
GV
,
class
PBF
>
ParallelGlobalBasis
(
std
::
string
const
&
name
,
GV
const
&
gridView
,
PBF
&&
preBasisFactory
)
->
ParallelGlobalBasis
<
decltype
(
preBasisFactory
.
template
makePreBasis
<
MultiIndex
<
PBF
>
>
(
gridView
))
>
;
preBasisFactory
.
template
makePreBasis
<
MultiIndex
_t
<
PBF
>
>
(
gridView
))
>
;
template
<
class
GV
,
class
PBF
>
ParallelGlobalBasis
(
GV
const
&
gridView
,
PBF
&&
preBasisFactory
)
->
ParallelGlobalBasis
<
decltype
(
preBasisFactory
.
template
makePreBasis
<
MultiIndex
<
PBF
>
>
(
gridView
))
>
;
preBasisFactory
.
template
makePreBasis
<
MultiIndex
_t
<
PBF
>
>
(
gridView
))
>
;
}
// end namespace AMDiS
test/DOFVectorTest.cpp
View file @
af1d36c3
...
...
@@ -98,7 +98,7 @@ int main(int argc, char** argv)
DOFVector
<
Basis
>
vec1
(
basis
);
// Conversion from Dune::Functions::DefaultGlobalBasis
auto
vec2
=
makeDOFVector
(
makeBasis
(
gridView
,
preBasis
)
)
;
DOFVector
vec2
(
gridView
,
preBasis
);
for
(
auto
const
&
e
:
elements
(
gridView
))
grid
.
mark
(
1
,
e
);
...
...
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