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
1f6515fe
Commit
1f6515fe
authored
Nov 04, 2020
by
Praetorius, Simon
Browse files
Allow storage of GridFunctions in DirichletBC
parent
abaa18d6
Changes
2
Hide whitespace changes
Inline
Side-by-side
amdis/DirichletBC.hpp
View file @
1f6515fe
...
@@ -40,17 +40,18 @@ namespace AMDiS
...
@@ -40,17 +40,18 @@ namespace AMDiS
* \tparam CB Basis of the column FE space
* \tparam CB Basis of the column FE space
* \tparam CTP Treepath to the column node this constraint applies to
* \tparam CTP Treepath to the column node this constraint applies to
**/
**/
template
<
class
Mat
,
class
Sol
,
class
Rhs
,
class
R
B
,
class
RTP
,
class
CB
,
class
CTP
>
template
<
class
Mat
,
class
Sol
,
class
Rhs
,
class
R
owSubBasis
,
class
ColSubBasis
,
class
ValueGridFct
>
class
DirichletBC
class
DirichletBC
:
public
BoundaryCondition
<
Mat
,
Sol
,
Rhs
>
:
public
BoundaryCondition
<
Mat
,
Sol
,
Rhs
>
{
{
using
Super
=
BoundaryCondition
<
Mat
,
Sol
,
Rhs
>
;
using
Super
=
BoundaryCondition
<
Mat
,
Sol
,
Rhs
>
;
using
RowSubBasis
=
Dune
::
Functions
::
SubspaceBasis
<
RB
,
RTP
>
;
using
ColSubBasis
=
Dune
::
Functions
::
SubspaceBasis
<
CB
,
CTP
>
;
// We assume CB's GridView to be the same as RB's
// We assume CB's GridView to be the same as RB's
using
Domain
=
typename
RB
::
GridView
::
template
Codim
<
0
>
::
Geometry
::
GlobalCoordinate
;
using
GridView
=
typename
RowSubBasis
::
GridView
;
using
Intersection
=
typename
RB
::
GridView
::
Intersection
;
using
Intersection
=
typename
GridView
::
Intersection
;
using
Range
=
RangeType_t
<
typename
ColSubBasis
::
LocalView
::
Tree
>
;
using
Domain
=
typename
GridView
::
template
Codim
<
0
>
::
Geometry
::
GlobalCoordinate
;
using
Range
=
TYPEOF
(
std
::
declval
<
ValueGridFct
>
()(
std
::
declval
<
Domain
>
()));
public:
public:
/// Constructor accepting subspacebases.
/// Constructor accepting subspacebases.
...
@@ -64,17 +65,6 @@ namespace AMDiS
...
@@ -64,17 +65,6 @@ namespace AMDiS
,
values_
(
FWD
(
values
))
,
values_
(
FWD
(
values
))
{}
{}
/// Constructor accepting global bases and treepaths.
template
<
class
Values
,
REQUIRES
(
Concepts
::
Functor
<
Values
,
Range
(
Domain
)>)
>
DirichletBC
(
RB
const
&
rowBasis
,
RTP
const
&
rowTreePath
,
CB
const
&
colBasis
,
CTP
const
&
colTreePath
,
BoundarySubset
<
Intersection
>
boundarySubset
,
Values
&&
values
)
:
DirichletBC
(
Dune
::
Functions
::
subspaceBasis
(
rowBasis
,
rowTreePath
),
Dune
::
Functions
::
subspaceBasis
(
colBasis
,
colTreePath
),
std
::
move
(
boundarySubset
),
FWD
(
values
))
{}
// fill \ref dirichletNodes_ with 1 or 0 whether DOF corresponds to the boundary or not.
// fill \ref dirichletNodes_ with 1 or 0 whether DOF corresponds to the boundary or not.
/**
/**
* \see BoundaryCondition::init
* \see BoundaryCondition::init
...
@@ -92,7 +82,8 @@ namespace AMDiS
...
@@ -92,7 +82,8 @@ namespace AMDiS
RowSubBasis
rowBasis_
;
RowSubBasis
rowBasis_
;
ColSubBasis
colBasis_
;
ColSubBasis
colBasis_
;
BoundarySubset
<
Intersection
>
boundarySubset_
;
BoundarySubset
<
Intersection
>
boundarySubset_
;
std
::
function
<
Range
(
Domain
)
>
values_
;
ValueGridFct
values_
;
std
::
vector
<
bool
>
dirichletNodes_
;
std
::
vector
<
bool
>
dirichletNodes_
;
};
};
...
@@ -104,7 +95,9 @@ namespace AMDiS
...
@@ -104,7 +95,9 @@ namespace AMDiS
BoundarySubset
<
typename
RB
::
GridView
::
Intersection
>
boundarySubset
,
BoundarySubset
<
typename
RB
::
GridView
::
Intersection
>
boundarySubset
,
Values
&&
values
)
Values
&&
values
)
{
{
using
BcType
=
DirichletBC
<
Mat
,
Sol
,
Rhs
,
RB
,
RTP
,
CB
,
CTP
>
;
using
RowSubBasis
=
Dune
::
Functions
::
SubspaceBasis
<
RB
,
RTP
>
;
using
ColSubBasis
=
Dune
::
Functions
::
SubspaceBasis
<
CB
,
CTP
>
;
using
BcType
=
DirichletBC
<
Mat
,
Sol
,
Rhs
,
RowSubBasis
,
ColSubBasis
,
TYPEOF
(
values
)
>
;
return
BcType
(
std
::
move
(
rowBasis
),
std
::
move
(
colBasis
),
std
::
move
(
boundarySubset
),
FWD
(
values
));
return
BcType
(
std
::
move
(
rowBasis
),
std
::
move
(
colBasis
),
std
::
move
(
boundarySubset
),
FWD
(
values
));
}
}
...
@@ -117,9 +110,10 @@ namespace AMDiS
...
@@ -117,9 +110,10 @@ namespace AMDiS
BoundarySubset
<
typename
RB
::
GridView
::
Intersection
>
boundarySubset
,
BoundarySubset
<
typename
RB
::
GridView
::
Intersection
>
boundarySubset
,
Values
&&
values
)
Values
&&
values
)
{
{
using
BcType
=
DirichletBC
<
Mat
,
Sol
,
Rhs
,
RB
,
RTP
,
CB
,
CTP
>
;
return
makeDirichletBC
<
Mat
,
Sol
,
Rhs
>
(
return
BcType
(
rowBasis
,
rowTreePath
,
colBasis
,
colTreePath
,
Dune
::
Functions
::
subspaceBasis
(
rowBasis
,
rowTreePath
),
std
::
move
(
boundarySubset
),
FWD
(
values
));
Dune
::
Functions
::
subspaceBasis
(
colBasis
,
colTreePath
),
std
::
move
(
boundarySubset
),
FWD
(
values
));
}
}
/// Make a DirichletBC from a global row- and colbasis
/// Make a DirichletBC from a global row- and colbasis
...
@@ -130,8 +124,9 @@ namespace AMDiS
...
@@ -130,8 +124,9 @@ namespace AMDiS
BoundarySubset
<
typename
RB
::
GridView
::
Intersection
>
boundarySubset
,
BoundarySubset
<
typename
RB
::
GridView
::
Intersection
>
boundarySubset
,
Values
&&
values
)
Values
&&
values
)
{
{
return
makeDirichletBC
<
Mat
,
Sol
,
Rhs
>
(
rowBasis
,
makeTreePath
(),
colBasis
,
makeTreePath
(),
return
makeDirichletBC
<
Mat
,
Sol
,
Rhs
>
(
std
::
move
(
boundarySubset
),
FWD
(
values
));
rowBasis
,
makeTreePath
(),
colBasis
,
makeTreePath
(),
std
::
move
(
boundarySubset
),
FWD
(
values
));
}
}
}
// end namespace AMDiS
}
// end namespace AMDiS
...
...
amdis/DirichletBC.inc.hpp
View file @
1f6515fe
...
@@ -33,11 +33,11 @@ void forEachInteriorBoundaryDOF(Basis const& basis, F&& f)
...
@@ -33,11 +33,11 @@ void forEachInteriorBoundaryDOF(Basis const& basis, F&& f)
}
// end namespace Impl
}
// end namespace Impl
template
<
class
Mat
,
class
Sol
,
class
Rhs
,
class
RB
,
class
RTP
,
class
CB
,
class
CTP
>
template
<
class
Mat
,
class
Sol
,
class
Rhs
,
class
RB
,
class
CB
,
class
V
>
void
DirichletBC
<
Mat
,
Sol
,
Rhs
,
RB
,
RTP
,
CB
,
CTP
>::
void
DirichletBC
<
Mat
,
Sol
,
Rhs
,
RB
,
CB
,
V
>::
init
()
init
()
{
{
using
LV
=
typename
C
olSubBasis
::
LocalView
;
using
LV
=
typename
C
B
::
LocalView
;
dirichletNodes_
.
assign
(
colBasis_
.
dimension
(),
false
);
dirichletNodes_
.
assign
(
colBasis_
.
dimension
(),
false
);
Impl
::
forEachInteriorBoundaryDOF
(
colBasis_
,
Impl
::
forEachInteriorBoundaryDOF
(
colBasis_
,
[
&
](
int
localIndex
,
LV
const
&
localView
,
Intersection
const
&
intersection
)
{
[
&
](
int
localIndex
,
LV
const
&
localView
,
Intersection
const
&
intersection
)
{
...
@@ -47,13 +47,11 @@ init()
...
@@ -47,13 +47,11 @@ init()
}
}
template
<
class
Mat
,
class
Sol
,
class
Rhs
,
class
RB
,
class
RTP
,
class
CB
,
class
CTP
>
template
<
class
Mat
,
class
Sol
,
class
Rhs
,
class
RB
,
class
CB
,
class
V
>
void
DirichletBC
<
Mat
,
Sol
,
Rhs
,
RB
,
RTP
,
CB
,
CTP
>::
void
DirichletBC
<
Mat
,
Sol
,
Rhs
,
RB
,
CB
,
V
>::
apply
(
Mat
&
matrix
,
Sol
&
solution
,
Rhs
&
rhs
)
apply
(
Mat
&
matrix
,
Sol
&
solution
,
Rhs
&
rhs
)
{
{
auto
&&
gf
=
makeGridFunction
(
values_
,
colBasis_
.
gridView
());
AMDiS
::
interpolate
(
colBasis_
,
solution
,
values_
,
tag
::
defaulted
{},
tag
::
defaulted
{},
dirichletNodes_
);
AMDiS
::
interpolate
(
colBasis_
,
solution
,
gf
,
tag
::
defaulted
{},
tag
::
defaulted
{},
dirichletNodes_
);
dirichletBC
(
matrix
,
solution
,
rhs
,
dirichletNodes_
);
dirichletBC
(
matrix
,
solution
,
rhs
,
dirichletNodes_
);
}
}
...
...
Write
Preview
Supports
Markdown
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