Skip to content
GitLab
Menu
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
bbf1bef8
Commit
bbf1bef8
authored
Feb 24, 2020
by
Müller, Felix
Browse files
Replace explicit type LocalView by template with concept check
parent
69256912
Changes
7
Hide whitespace changes
Inline
Side-by-side
amdis/BiLinearForm.hpp
View file @
bbf1bef8
...
...
@@ -5,6 +5,8 @@
#include <amdis/LinearAlgebra.hpp>
#include <amdis/Observer.hpp>
#include <amdis/OperatorList.hpp>
#include <amdis/common/Concepts.hpp>
#include <amdis/common/ConceptsBase.hpp>
#include <amdis/common/FlatMatrix.hpp>
#include <amdis/common/TypeTraits.hpp>
#include <amdis/linearalgebra/SymmetryStructure.hpp>
...
...
@@ -32,11 +34,9 @@ namespace AMDiS
public:
/// The type of the finite element space / basis of the row
using
RowBasis
=
RB
;
using
RowLocalView
=
typename
RowBasis
::
LocalView
;
/// The type of the finite element space / basis of the column
using
ColBasis
=
CB
;
using
ColLocalView
=
typename
ColBasis
::
LocalView
;
/// The type of the elements of the DOFVector
using
CoefficientType
=
T
;
...
...
@@ -115,7 +115,7 @@ namespace AMDiS
template
<
class
Expr
,
class
Row
=
RootTreePath
,
class
Col
=
RootTreePath
>
void
addOperator
(
Expr
const
&
expr
,
Row
row
=
{},
Col
col
=
{})
{
using
E
=
typename
RowLocalView
::
Element
;
using
E
=
typename
Row
Basis
::
LocalView
::
Element
;
addOperator
(
tag
::
element_operator
<
E
>
{},
expr
,
row
,
col
);
}
...
...
@@ -123,12 +123,15 @@ namespace AMDiS
template
<
class
Expr
,
class
Row
=
RootTreePath
,
class
Col
=
RootTreePath
>
void
addIntersectionOperator
(
Expr
const
&
expr
,
Row
row
=
{},
Col
col
=
{})
{
using
I
=
typename
RowLocalView
::
GridView
::
Intersection
;
using
I
=
typename
Row
Basis
::
LocalView
::
GridView
::
Intersection
;
addOperator
(
tag
::
intersection_operator
<
I
>
{},
expr
,
row
,
col
);
}
/// @}
/// Assemble the matrix operators on the bound element.
template
<
class
RowLocalView
,
class
ColLocalView
,
REQUIRES
(
Concepts
::
LocalView
<
RowLocalView
>),
REQUIRES
(
Concepts
::
LocalView
<
ColLocalView
>
)
>
void
assemble
(
RowLocalView
const
&
rowLocalView
,
ColLocalView
const
&
colLocalView
);
...
...
amdis/BiLinearForm.inc.hpp
View file @
bbf1bef8
...
...
@@ -33,6 +33,9 @@ addOperator(ContextTag contextTag, Expr const& expr,
template
<
class
RB
,
class
CB
,
class
T
,
class
Traits
>
template
<
class
RowLocalView
,
class
ColLocalView
,
REQUIRES_
(
Concepts
::
LocalView
<
RowLocalView
>),
REQUIRES_
(
Concepts
::
LocalView
<
ColLocalView
>
)
>
void
BiLinearForm
<
RB
,
CB
,
T
,
Traits
>::
assemble
(
RowLocalView
const
&
rowLocalView
,
ColLocalView
const
&
colLocalView
)
{
...
...
amdis/LinearForm.hpp
View file @
bbf1bef8
...
...
@@ -4,6 +4,8 @@
#include <amdis/LinearAlgebra.hpp>
#include <amdis/OperatorList.hpp>
#include <amdis/common/Concepts.hpp>
#include <amdis/common/ConceptsBase.hpp>
#include <amdis/common/FlatVector.hpp>
#include <amdis/common/TypeTraits.hpp>
#include <amdis/typetree/TreePath.hpp>
...
...
@@ -29,7 +31,6 @@ namespace AMDiS
public:
/// The type of the functionspace basis associated to this linearform
using
GlobalBasis
=
GB
;
using
LocalView
=
typename
GlobalBasis
::
LocalView
;
/// The type of the elements of the DOFVector
using
CoefficientType
=
T
;
...
...
@@ -83,7 +84,7 @@ namespace AMDiS
template
<
class
Expr
,
class
TreePath
=
RootTreePath
>
void
addOperator
(
Expr
const
&
expr
,
TreePath
path
=
{})
{
using
E
=
typename
LocalView
::
Element
;
using
E
=
typename
GlobalBasis
::
LocalView
::
Element
;
addOperator
(
tag
::
element_operator
<
E
>
{},
expr
,
path
);
}
...
...
@@ -91,13 +92,15 @@ namespace AMDiS
template
<
class
Expr
,
class
TreePath
=
RootTreePath
>
void
addIntersectionOperator
(
Expr
const
&
expr
,
TreePath
path
=
{})
{
using
I
=
typename
LocalView
::
GridView
::
Intersection
;
using
I
=
typename
GlobalBasis
::
LocalView
::
GridView
::
Intersection
;
addOperator
(
tag
::
intersection_operator
<
I
>
{},
expr
,
path
);
}
/// @}
/// Assemble the vector operators on the bound element.
template
<
class
LocalView
,
REQUIRES
(
Concepts
::
LocalView
<
LocalView
>)
>
void
assemble
(
LocalView
const
&
localView
);
/// Assemble all vector operators added by \ref addOperator().
...
...
amdis/LinearForm.inc.hpp
View file @
bbf1bef8
...
...
@@ -30,8 +30,9 @@ addOperator(ContextTag contextTag, Expr const& expr, TreePath path)
template
<
class
GB
,
class
T
,
class
Traits
>
template
<
class
LocalView
,
REQUIRES_
(
Concepts
::
LocalView
<
LocalView
>)
>
void
LinearForm
<
GB
,
T
,
Traits
>::
assemble
(
typename
GB
::
LocalView
const
&
localView
)
assemble
(
LocalView
const
&
localView
)
{
elementVector_
.
resize
(
localView
.
size
());
elementVector_
=
0
;
...
...
amdis/common/Concepts.hpp
View file @
bbf1bef8
...
...
@@ -3,6 +3,7 @@
#include <type_traits>
#include <dune/functions/common/functionconcepts.hh>
#include <dune/functions/functionspacebases/concepts.hh>
#include <amdis/common/ConceptsBase.hpp>
#include <amdis/common/Logical.hpp>
...
...
@@ -142,6 +143,15 @@ namespace AMDiS
template
<
class
MI
>
using
MultiIndex_t
=
models_t
<
Definition
::
MultiIndex
(
MI
)
>
;
/// A Dune::Functions::LocalView type
template
<
class
LV
>
constexpr
bool
LocalView
=
models
<
Dune
::
Functions
::
Concept
::
LocalView
<
typename
LV
::
GlobalBasis
>
(
LV
)
>
;
template
<
class
LV
>
using
LocalView_t
=
models_t
<
Dune
::
Functions
::
Concept
::
LocalView
<
typename
LV
::
GlobalBasis
>
(
LV
)
>
;
/** @} **/
}
// end namespace Concepts
...
...
amdis/linearalgebra/MatrixFacade.hpp
View file @
bbf1bef8
...
...
@@ -3,9 +3,9 @@
#include <type_traits>
#include <dune/common/shared_ptr.hh>
#include <dune/functions/functionspacebases/concepts.hh>
#include <amdis/common/Concepts.hpp>
#include <amdis/common/ConceptsBase.hpp>
#include <amdis/common/TypeTraits.hpp>
#include <amdis/functions/NodeIndices.hpp>
#include <amdis/linearalgebra/SymmetryStructure.hpp>
...
...
@@ -70,8 +70,8 @@ namespace AMDiS
/// Insert a block of values into the sparse matrix (add to existing values)
/// The global matrix indices are determined by the corresponding localviews.
template
<
class
RowLocalView
,
class
ColLocalView
,
class
LocalMatrix
,
REQUIRES
(
Dune
::
models
<
Dune
::
Functions
::
Concept
::
LocalView
<
typename
RowLocalView
::
GlobalBasis
>,
RowLocalView
>
()
),
REQUIRES
(
Dune
::
models
<
Dune
::
Functions
::
Concept
::
LocalView
<
typename
ColLocalView
::
GlobalBasis
>
,
ColLocalView
>
()
)
>
REQUIRES
(
Concept
s
::
LocalView
<
RowLocalView
>),
REQUIRES
(
Concept
s
::
LocalView
<
ColLocalView
>
)
>
void
scatter
(
RowLocalView
const
&
r
,
ColLocalView
const
&
c
,
LocalMatrix
const
&
localMatrix
)
{
assert
(
r
.
size
()
*
c
.
size
()
==
localMatrix
.
size
());
...
...
amdis/linearalgebra/VectorFacade.hpp
View file @
bbf1bef8
...
...
@@ -15,6 +15,7 @@
#include <amdis/Output.hpp>
#include <amdis/common/Concepts.hpp>
#include <amdis/common/ConceptsBase.hpp>
#include <amdis/common/FakeContainer.hpp>
#include <amdis/common/TypeTraits.hpp>
#include <amdis/functions/NodeIndices.hpp>
...
...
@@ -190,7 +191,7 @@ namespace AMDiS
* [[possibly neighbor-wise collective operation]]
*/
template
<
class
LocalView
,
class
Node
,
class
Buffer
,
REQUIRES
(
Dune
::
models
<
Dune
::
Functions
::
Concept
::
LocalView
<
typename
LocalView
::
GlobalBasis
>,
LocalView
>
()
),
REQUIRES
(
Concept
s
::
LocalView
<
LocalView
>),
REQUIRES
(
Dune
::
models
<
Dune
::
Functions
::
Concept
::
BasisNode
,
Node
>
())
>
void
gather
(
LocalView
const
&
localView
,
Node
const
&
node
,
Buffer
&
buffer
)
const
{
...
...
@@ -206,7 +207,7 @@ namespace AMDiS
// [[expects: localView is bound to an element]]
template
<
class
LocalView
,
class
Buffer
,
REQUIRES
(
Dune
::
models
<
Dune
::
Functions
::
Concept
::
LocalView
<
typename
LocalView
::
GlobalBasis
>,
LocalView
>
()
)
>
REQUIRES
(
Concept
s
::
LocalView
<
LocalView
>)
>
void
gather
(
LocalView
const
&
localView
,
Buffer
&
buffer
)
const
{
gather
(
localView
,
localView
.
tree
(),
buffer
);
...
...
@@ -233,7 +234,7 @@ namespace AMDiS
* [[not collective]]
*/
template
<
class
LocalView
,
class
Node
,
class
NodeVector
,
class
MaskRange
,
class
Assign
,
REQUIRES
(
Dune
::
models
<
Dune
::
Functions
::
Concept
::
LocalView
<
typename
LocalView
::
GlobalBasis
>,
LocalView
>
()
),
REQUIRES
(
Concept
s
::
LocalView
<
LocalView
>),
REQUIRES
(
Dune
::
models
<
Dune
::
Functions
::
Concept
::
BasisNode
,
Node
>
())
>
void
scatter
(
LocalView
const
&
localView
,
Node
const
&
node
,
NodeVector
const
&
localVector
,
MaskRange
const
&
mask
,
Assign
assign
)
...
...
@@ -256,7 +257,7 @@ namespace AMDiS
// [[expects: localView is bound to an element]]
// [[expects: node is in localView.tree()]]
template
<
class
LocalView
,
class
Node
,
class
NodeVector
,
class
Assign
,
REQUIRES
(
Dune
::
models
<
Dune
::
Functions
::
Concept
::
LocalView
<
typename
LocalView
::
GlobalBasis
>,
LocalView
>
()
),
REQUIRES
(
Concept
s
::
LocalView
<
LocalView
>),
REQUIRES
(
Dune
::
models
<
Dune
::
Functions
::
Concept
::
BasisNode
,
Node
>
())
>
void
scatter
(
LocalView
const
&
localView
,
Node
const
&
node
,
NodeVector
const
&
localVector
,
Assign
assign
)
{
...
...
@@ -266,7 +267,7 @@ namespace AMDiS
/// Call \ref scatter with `Node` given by the tree of the \p localView.
// [[expects: localView is bound to an element]]
template
<
class
LocalView
,
class
LocalVector
,
class
Assign
,
REQUIRES
(
Dune
::
models
<
Dune
::
Functions
::
Concept
::
LocalView
<
typename
LocalView
::
GlobalBasis
>,
LocalView
>
()
)
>
REQUIRES
(
Concept
s
::
LocalView
<
LocalView
>)
>
void
scatter
(
LocalView
const
&
localView
,
LocalVector
const
&
localVector
,
Assign
assign
)
{
scatter
(
localView
,
localView
.
tree
(),
localVector
,
assign
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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