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
7f7d3d80
Commit
7f7d3d80
authored
Oct 14, 2020
by
Praetorius, Simon
Browse files
rename child() into discreteFunction()
parent
dc6aa48e
Changes
24
Show whitespace changes
Inline
Side-by-side
amdis/DOFVector.hpp
View file @
7f7d3d80
...
@@ -82,20 +82,21 @@ namespace AMDiS
...
@@ -82,20 +82,21 @@ namespace AMDiS
:
DOFVector
(
std
::
make_shared
<
GB
>
(
gridView
,
preBasisFactory
),
op
)
:
DOFVector
(
std
::
make_shared
<
GB
>
(
gridView
,
preBasisFactory
),
op
)
{}
{}
/// Return the global basis
std
::
shared_ptr
<
GlobalBasis
const
>
const
&
basis
()
const
{
return
basis_
;
}
std
::
shared_ptr
<
GlobalBasis
const
>
const
&
basis
()
const
{
return
basis_
;
}
template
<
class
TreePath
=
RootTreePath
>
/// Transform the DOFVector into a DiscreteFunction
auto
child
(
TreePath
const
&
path
=
{})
template
<
class
...
Indices
>
auto
discreteFunction
(
Indices
...
ii
)
{
{
auto
&&
tp
=
makeTreePath
(
path
);
return
DiscreteFunction
{
coefficients
(),
*
basis_
,
makeTreePath
(
ii
...)};
return
makeDiscreteFunction
(
coefficients
(),
*
basis_
,
tp
);
}
}
template
<
class
TreePath
=
RootTreePath
>
/// Transform the DOFVector into a DiscreteFunction
auto
child
(
TreePath
const
&
path
=
{})
const
template
<
class
...
Indices
>
auto
discreteFunction
(
Indices
...
ii
)
const
{
{
auto
&&
tp
=
makeTreePath
(
path
);
return
DiscreteFunction
{
coefficients
(),
*
basis_
,
makeTreePath
(
ii
...)};
return
makeDiscreteFunction
(
coefficients
(),
*
basis_
,
tp
);
}
}
...
@@ -105,7 +106,7 @@ namespace AMDiS
...
@@ -105,7 +106,7 @@ namespace AMDiS
template
<
class
Expr
,
class
Tag
=
tag
::
average
>
template
<
class
Expr
,
class
Tag
=
tag
::
average
>
void
interpolate_noalias
(
Expr
&&
expr
,
Tag
strategy
=
{})
void
interpolate_noalias
(
Expr
&&
expr
,
Tag
strategy
=
{})
{
{
child
().
interpolate_noalias
(
FWD
(
expr
),
strategy
);
discreteFunction
().
interpolate_noalias
(
FWD
(
expr
),
strategy
);
}
}
/// Interpolation of GridFunction to DOFVector.
/// Interpolation of GridFunction to DOFVector.
...
@@ -113,7 +114,7 @@ namespace AMDiS
...
@@ -113,7 +114,7 @@ namespace AMDiS
template
<
class
Expr
,
class
Tag
=
tag
::
average
>
template
<
class
Expr
,
class
Tag
=
tag
::
average
>
void
interpolate
(
Expr
&&
expr
,
Tag
strategy
=
{})
void
interpolate
(
Expr
&&
expr
,
Tag
strategy
=
{})
{
{
child
().
interpolate
(
FWD
(
expr
),
strategy
);
discreteFunction
().
interpolate
(
FWD
(
expr
),
strategy
);
}
}
/// Interpolation of GridFunction to DOFVector.
/// Interpolation of GridFunction to DOFVector.
...
@@ -121,7 +122,7 @@ namespace AMDiS
...
@@ -121,7 +122,7 @@ namespace AMDiS
template
<
class
Expr
>
template
<
class
Expr
>
DOFVector
&
operator
<<
(
Expr
&&
expr
)
DOFVector
&
operator
<<
(
Expr
&&
expr
)
{
{
child
().
interpolate
(
FWD
(
expr
));
discreteFunction
().
interpolate
(
FWD
(
expr
));
return
*
this
;
return
*
this
;
}
}
...
@@ -247,17 +248,17 @@ namespace AMDiS
...
@@ -247,17 +248,17 @@ namespace AMDiS
}
}
/// A Generator for a mutable \ref DiscreteFunction
/// A Generator for a mutable \ref DiscreteFunction
template
<
class
GB
,
class
T
,
class
Path
=
RootTreePath
>
template
<
class
GB
,
class
T
,
class
...
Indices
>
auto
makeD
iscreteFunction
(
DOFVector
<
GB
,
T
>&
dofVec
,
Path
const
&
path
=
{}
)
auto
d
iscreteFunction
(
DOFVector
<
GB
,
T
>&
dofVec
,
Indices
...
ii
)
{
{
return
dofVec
.
child
(
path
);
return
dofVec
.
discreteFunction
(
ii
...
);
}
}
/// A Generator for a mutable \ref DiscreteFunction
/// A Generator for a mutable \ref DiscreteFunction
template
<
class
GB
,
class
T
,
class
Path
=
RootTreePath
>
template
<
class
GB
,
class
T
,
class
...
Indices
>
auto
makeD
iscreteFunction
(
DOFVector
<
GB
,
T
>
const
&
dofVec
,
Path
const
&
path
=
{}
)
auto
d
iscreteFunction
(
DOFVector
<
GB
,
T
>
const
&
dofVec
,
Indices
...
ii
)
{
{
return
dofVec
.
child
(
path
);
return
dofVec
.
discreteFunction
(
ii
...
);
}
}
}
// end namespace AMDiS
}
// end namespace AMDiS
...
...
amdis/DirichletBC.hpp
View file @
7f7d3d80
...
@@ -130,7 +130,7 @@ namespace AMDiS
...
@@ -130,7 +130,7 @@ namespace AMDiS
BoundarySubset
<
typename
RB
::
GridView
::
Intersection
>
boundarySubset
,
BoundarySubset
<
typename
RB
::
GridView
::
Intersection
>
boundarySubset
,
Values
&&
values
)
Values
&&
values
)
{
{
return
makeDirichletBC
<
Mat
,
Sol
,
Rhs
>
(
rowBasis
,
t
ree
p
ath
(),
colBasis
,
t
ree
p
ath
(),
return
makeDirichletBC
<
Mat
,
Sol
,
Rhs
>
(
rowBasis
,
makeT
ree
P
ath
(),
colBasis
,
makeT
ree
P
ath
(),
std
::
move
(
boundarySubset
),
FWD
(
values
));
std
::
move
(
boundarySubset
),
FWD
(
values
));
}
}
...
...
amdis/LinearForm.inc.hpp
View file @
7f7d3d80
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
#include
<amdis/LocalOperator.hpp>
#include
<amdis/LocalOperator.hpp>
#include
<amdis/operations/Assigner.hpp>
#include
<amdis/operations/Assigner.hpp>
#include
<amdis/typetree/Traversal.hpp>
#include
<amdis/typetree/Traversal.hpp>
#include
<amdis/typetree/TreePath.hpp>
#include
<amdis/utility/AssembleOperators.hpp>
#include
<amdis/utility/AssembleOperators.hpp>
namespace
AMDiS
{
namespace
AMDiS
{
...
...
amdis/PeriodicBC.hpp
View file @
7f7d3d80
...
@@ -161,7 +161,7 @@ namespace AMDiS
...
@@ -161,7 +161,7 @@ namespace AMDiS
BoundarySubset
<
typename
B
::
GridView
::
Intersection
>
boundarySubset
,
BoundarySubset
<
typename
B
::
GridView
::
Intersection
>
boundarySubset
,
Impl
::
FaceTrafo
<
B
>
trafo
)
Impl
::
FaceTrafo
<
B
>
trafo
)
{
{
return
makePeriodicBC
<
Mat
,
Sol
,
Rhs
>
(
basis
,
t
ree
p
ath
(),
std
::
move
(
boundarySubset
),
return
makePeriodicBC
<
Mat
,
Sol
,
Rhs
>
(
basis
,
makeT
ree
P
ath
(),
std
::
move
(
boundarySubset
),
std
::
move
(
trafo
));
std
::
move
(
trafo
));
}
}
...
...
amdis/ProblemInstat.hpp
View file @
7f7d3d80
...
@@ -62,12 +62,12 @@ namespace AMDiS
...
@@ -62,12 +62,12 @@ namespace AMDiS
}
}
/// Return a const view to a oldSolution component
/// Return a const view to a oldSolution component
template
<
class
TreePath
=
RootTreePath
>
template
<
class
...
Indices
>
auto
oldSolution
(
TreePath
path
=
{}
)
const
auto
oldSolution
(
Indices
...
ii
)
const
{
{
test_exit_dbg
(
bool
(
oldSolution_
),
test_exit_dbg
(
bool
(
oldSolution_
),
"OldSolution need to be created. Call initialize with INIT_UH_OLD."
);
"OldSolution need to be created. Call initialize with INIT_UH_OLD."
);
return
oldSolution_
->
child
(
path
);
return
oldSolution_
->
discreteFunction
(
ii
...
);
}
}
/// Implementation of \ref ProblemTimeInterface::transferInitialSolution().
/// Implementation of \ref ProblemTimeInterface::transferInitialSolution().
...
...
amdis/ProblemStat.hpp
View file @
7f7d3d80
...
@@ -148,9 +148,9 @@ namespace AMDiS
...
@@ -148,9 +148,9 @@ namespace AMDiS
*
*
* \param op A (pre-) local operator, \see LocalOperator, \see GridFunctionOperator
* \param op A (pre-) local operator, \see LocalOperator, \see GridFunctionOperator
* \param row TreePath identifying the sub-basis in the global basis tree
* \param row TreePath identifying the sub-basis in the global basis tree
* corresponding to the row basis. \see
t
ree
p
ath()
* corresponding to the row basis. \see
makeT
ree
P
ath()
* \param col TreePath identifying the sub-basis in the global basis tree
* \param col TreePath identifying the sub-basis in the global basis tree
* corresponding to the column basis. \see
t
ree
p
ath()
* corresponding to the column basis. \see
makeT
ree
P
ath()
*
*
* Example:
* Example:
* ```
* ```
...
@@ -173,9 +173,9 @@ namespace AMDiS
...
@@ -173,9 +173,9 @@ namespace AMDiS
* constructed from an integer. \see BoundaryType
* constructed from an integer. \see BoundaryType
* \param op A (pre-) local operator, \see LocalOperator, \see GridFunctionOperator
* \param op A (pre-) local operator, \see LocalOperator, \see GridFunctionOperator
* \param row TreePath identifying the sub-basis in the global basis tree
* \param row TreePath identifying the sub-basis in the global basis tree
* corresponding to the row basis. \see
t
ree
p
ath()
* corresponding to the row basis. \see
makeT
ree
P
ath()
* \param col TreePath identifying the sub-basis in the global basis tree
* \param col TreePath identifying the sub-basis in the global basis tree
* corresponding to the column basis. \see
t
ree
p
ath()
* corresponding to the column basis. \see
makeT
ree
P
ath()
*
*
* Example:
* Example:
* ```
* ```
...
@@ -201,7 +201,7 @@ namespace AMDiS
...
@@ -201,7 +201,7 @@ namespace AMDiS
*
*
* \param op A (pre-) local operator, \see LocalOperator, \see GridFunctionOperator
* \param op A (pre-) local operator, \see LocalOperator, \see GridFunctionOperator
* \param path TreePath identifying the sub-basis in the global basis tree
* \param path TreePath identifying the sub-basis in the global basis tree
* corresponding to the row basis. \see
t
ree
p
ath()
* corresponding to the row basis. \see
makeT
ree
P
ath()
*
*
* Example:
* Example:
* ```
* ```
...
@@ -224,7 +224,7 @@ namespace AMDiS
...
@@ -224,7 +224,7 @@ namespace AMDiS
* constructed from an integer. \see BoundaryType
* constructed from an integer. \see BoundaryType
* \param op A (pre-) local operator, \see LocalOperator, \see GridFunctionOperator
* \param op A (pre-) local operator, \see LocalOperator, \see GridFunctionOperator
* \param path TreePath identifying the sub-basis in the global basis tree
* \param path TreePath identifying the sub-basis in the global basis tree
* corresponding to the row basis. \see
t
ree
p
ath()
* corresponding to the row basis. \see
makeT
ree
P
ath()
*
*
* Example:
* Example:
* ```
* ```
...
@@ -251,9 +251,9 @@ namespace AMDiS
...
@@ -251,9 +251,9 @@ namespace AMDiS
* \param predicate Functor `bool(WorldVector)` returning true for all
* \param predicate Functor `bool(WorldVector)` returning true for all
* DOFs on the boundary that should be assigned a value.
* DOFs on the boundary that should be assigned a value.
* \param row TreePath identifying the sub-basis in the global basis tree
* \param row TreePath identifying the sub-basis in the global basis tree
* corresponding to the row basis. \see
t
ree
p
ath()
* corresponding to the row basis. \see
makeT
ree
P
ath()
* \param col TreePath identifying the sub-basis in the global basis tree
* \param col TreePath identifying the sub-basis in the global basis tree
* corresponding to the column basis. \see
t
ree
p
ath()
* corresponding to the column basis. \see
makeT
ree
P
ath()
* \param values Functor `Range(WorldVector)` or any \ref GridFunction
* \param values Functor `Range(WorldVector)` or any \ref GridFunction
* that is evaluated in the DOFs identified by the predicate.
* that is evaluated in the DOFs identified by the predicate.
*
*
...
@@ -368,19 +368,19 @@ namespace AMDiS
...
@@ -368,19 +368,19 @@ namespace AMDiS
/// Return a mutable view to a solution component
/// Return a mutable view to a solution component
template
<
class
TreePath
=
RootTreePath
>
template
<
class
...
Indices
>
auto
solution
(
TreePath
path
=
{}
)
auto
solution
(
Indices
...
ii
)
{
{
assert
(
bool
(
solution_
)
&&
"You have to call initialize() before."
);
assert
(
bool
(
solution_
)
&&
"You have to call initialize() before."
);
return
solution_
->
child
(
path
);
return
solution_
->
discreteFunction
(
ii
...
);
}
}
/// Return a const view to a solution component
/// Return a const view to a solution component
template
<
class
TreePath
=
RootTreePath
>
template
<
class
...
Indices
>
auto
solution
(
TreePath
path
=
{}
)
const
auto
solution
(
Indices
...
ii
)
const
{
{
assert
(
bool
(
solution_
)
&&
"You have to call initialize() before."
);
assert
(
bool
(
solution_
)
&&
"You have to call initialize() before."
);
return
solution_
->
child
(
path
);
return
solution_
->
discreteFunction
(
ii
...
);
}
}
...
...
amdis/ProblemStat.inc.hpp
View file @
7f7d3d80
...
@@ -335,10 +335,10 @@ void ProblemStat<Traits>::
...
@@ -335,10 +335,10 @@ void ProblemStat<Traits>::
addPeriodicBC
(
BoundaryType
id
,
WorldMatrix
const
&
matrix
,
WorldVector
const
&
vector
)
addPeriodicBC
(
BoundaryType
id
,
WorldMatrix
const
&
matrix
,
WorldVector
const
&
vector
)
{
{
auto
localView
=
globalBasis_
->
localView
();
auto
localView
=
globalBasis_
->
localView
();
auto
basis
=
Dune
::
Functions
::
subspaceBasis
(
*
globalBasis_
,
t
ree
p
ath
());
auto
basis
=
Dune
::
Functions
::
subspaceBasis
(
*
globalBasis_
,
makeT
ree
P
ath
());
auto
bc
=
makePeriodicBC
<
SystemMatrix
,
SolutionVector
,
SystemVector
>
(
auto
bc
=
makePeriodicBC
<
SystemMatrix
,
SolutionVector
,
SystemVector
>
(
std
::
move
(
basis
),
{
*
boundaryManager_
,
id
},
{
matrix
,
vector
});
std
::
move
(
basis
),
{
*
boundaryManager_
,
id
},
{
matrix
,
vector
});
boundaryConditions_
[
t
ree
p
ath
()][
t
ree
p
ath
()].
push_back
(
makeUniquePtr
(
std
::
move
(
bc
)));
boundaryConditions_
[
makeT
ree
P
ath
()][
makeT
ree
P
ath
()].
push_back
(
makeUniquePtr
(
std
::
move
(
bc
)));
}
}
...
...
amdis/gridfunctions/DiscreteFunction.hpp
View file @
7f7d3d80
...
@@ -28,23 +28,14 @@ namespace AMDiS
...
@@ -28,23 +28,14 @@ namespace AMDiS
* **Requirements:**
* **Requirements:**
* - GB models \ref Concepts::GlobalBasis
* - GB models \ref Concepts::GlobalBasis
**/
**/
template
<
class
Coeff
,
class
GB
,
class
TreePath
=
Dune
::
TypeTree
::
HybridTreePath
<
>
>
template
<
class
Coeff
,
class
GB
,
class
TreePath
>
class
DiscreteFunction
;
class
DiscreteFunction
;
// deduction guide
// deduction guide
template
<
class
Coeff
,
class
GB
,
class
TreePath
=
RootTreePath
>
template
<
class
Coeff
,
class
GB
,
class
Path
>
DiscreteFunction
(
Coeff
&
,
GB
const
&
,
TreePath
=
{})
DiscreteFunction
(
Coeff
&
,
GB
const
&
,
Path
const
&
path
)
->
DiscreteFunction
<
Coeff
,
GB
,
TreePath_t
<
TreePath
>>
;
->
DiscreteFunction
<
Coeff
,
GB
,
TYPEOF
(
makeTreePath
(
path
))
>
;
/// A Generator for a mutable \ref DiscreteFunction
template
<
class
Coeff
,
class
GB
,
class
Path
=
RootTreePath
,
class
=
std
::
void_t
<
decltype
(
std
::
declval
<
GB
>().
localView
())
>
>
auto
makeDiscreteFunction
(
Coeff
&
coefficients
,
GB
const
&
basis
,
Path
const
&
path
=
{})
{
return
DiscreteFunction
<
Coeff
,
GB
,
TreePath_t
<
Path
>>
{
coefficients
,
basis
,
path
};
}
/// A mutable view on the subspace of a DOFVector, \relates DiscreteFunction
/// A mutable view on the subspace of a DOFVector, \relates DiscreteFunction
...
@@ -61,8 +52,8 @@ namespace AMDiS
...
@@ -61,8 +52,8 @@ namespace AMDiS
public:
public:
/// Constructor. Stores a pointer to the mutable `dofvector`.
/// Constructor. Stores a pointer to the mutable `dofvector`.
template
<
class
Path
=
TreePath
>
template
<
class
Path
>
DiscreteFunction
(
Coefficients
&
dofVector
,
GlobalBasis
const
&
basis
,
Path
const
&
path
=
{}
)
DiscreteFunction
(
Coefficients
&
dofVector
,
GlobalBasis
const
&
basis
,
Path
const
&
path
)
:
Super
(
dofVector
,
basis
,
path
)
:
Super
(
dofVector
,
basis
,
path
)
,
mutableCoeff_
(
&
dofVector
)
,
mutableCoeff_
(
&
dofVector
)
{}
{}
...
@@ -73,7 +64,7 @@ namespace AMDiS
...
@@ -73,7 +64,7 @@ namespace AMDiS
/**
/**
* **Example:**
* **Example:**
* ```
* ```
* auto v =
makeD
iscreteFunction(prob.solutionVector(),0);
* auto v =
d
iscreteFunction(prob.solutionVector(),0);
* v.interpolate_noalias([](auto const& x) { return x[0]; });
* v.interpolate_noalias([](auto const& x) { return x[0]; });
* ```
* ```
**/
**/
...
@@ -84,7 +75,7 @@ namespace AMDiS
...
@@ -84,7 +75,7 @@ namespace AMDiS
/**
/**
* **Example:**
* **Example:**
* ```
* ```
* auto v =
makeD
iscreteFunction(prob.solutionVector(),0);
* auto v =
d
iscreteFunction(prob.solutionVector(),0);
* v.interpolate(v + [](auto const& x) { return x[0]; });
* v.interpolate(v + [](auto const& x) { return x[0]; });
* ```
* ```
* Allows to have a reference to the DOFVector in the expression, e.g. as
* Allows to have a reference to the DOFVector in the expression, e.g. as
...
@@ -126,11 +117,11 @@ namespace AMDiS
...
@@ -126,11 +117,11 @@ namespace AMDiS
/// Return the const DOFVector
/// Return the const DOFVector
using
Super
::
coefficients
;
using
Super
::
coefficients
;
template
<
class
Path
=
RootTreePath
>
template
<
class
...
Indices
>
auto
child
(
Path
const
&
path
=
{}
)
auto
child
(
Indices
...
ii
)
{
{
auto
tp
=
cat
(
this
->
treePath_
,
makeTreePath
(
path
));
auto
tp
=
cat
(
this
->
treePath_
,
makeTreePath
(
ii
...
));
return
make
DiscreteFunction
(
*
mutableCoeff_
,
this
->
basis
(),
tp
)
;
return
DiscreteFunction
<
Coeff
,
GB
,
TYPEOF
(
makeTreePath
(
tp
))
>
{
*
mutableCoeff_
,
this
->
basis
(),
tp
}
;
}
}
using
Super
::
child
;
using
Super
::
child
;
...
@@ -181,8 +172,8 @@ namespace AMDiS
...
@@ -181,8 +172,8 @@ namespace AMDiS
public:
public:
/// Constructor. Stores a pointer to the dofVector and a copy of the treePath.
/// Constructor. Stores a pointer to the dofVector and a copy of the treePath.
template
<
class
Path
=
TreePath
>
template
<
class
Path
>
DiscreteFunction
(
Coefficients
const
&
coefficients
,
GlobalBasis
const
&
basis
,
Path
const
&
path
=
{}
)
DiscreteFunction
(
Coefficients
const
&
coefficients
,
GlobalBasis
const
&
basis
,
Path
const
&
path
)
:
coefficients_
(
&
coefficients
)
:
coefficients_
(
&
coefficients
)
,
basis_
(
&
basis
)
,
basis_
(
&
basis
)
,
treePath_
(
makeTreePath
(
path
))
,
treePath_
(
makeTreePath
(
path
))
...
@@ -223,11 +214,11 @@ namespace AMDiS
...
@@ -223,11 +214,11 @@ namespace AMDiS
return
*
coefficients_
;
return
*
coefficients_
;
}
}
template
<
class
Path
=
RootTreePath
>
template
<
class
...
Indices
>
auto
child
(
Path
const
&
path
=
{}
)
const
auto
child
(
Indices
...
ii
)
const
{
{
auto
tp
=
cat
(
this
->
treePath_
,
makeTreePath
(
path
));
auto
tp
=
cat
(
this
->
treePath_
,
makeTreePath
(
ii
...
));
return
make
DiscreteFunction
(
*
coefficients_
,
*
basis_
,
tp
)
;
return
DiscreteFunction
<
Coeff
const
,
GB
,
TYPEOF
(
makeTreePath
(
tp
))
>
{
*
coefficients_
,
*
basis_
,
tp
}
;
}
}
protected:
protected:
...
...
amdis/io/FileWriterCreator.hpp
View file @
7f7d3d80
...
@@ -40,13 +40,13 @@ namespace AMDiS
...
@@ -40,13 +40,13 @@ namespace AMDiS
/**
/**
* \param type String representing the type of the writer. One of {vtk, dune-vtk, gmsh, backup}
* \param type String representing the type of the writer. One of {vtk, dune-vtk, gmsh, backup}
* \param prefix The initfile prefix tp configure the filewriter
* \param prefix The initfile prefix tp configure the filewriter
* \param
treePath T
reepath to the component of the systemVector to be handled by the fileWriter.
* \param
ii... Indices of the t
reepath to the component of the systemVector to be handled by the fileWriter.
**/
**/
template
<
class
TreePath
=
RootTreePath
>
template
<
class
...
Indices
>
std
::
unique_ptr
<
FileWriterInterface
>
std
::
unique_ptr
<
FileWriterInterface
>
create
(
std
::
string
type
,
std
::
string
prefix
,
TreePath
treePath
=
{}
)
const
create
(
std
::
string
type
,
std
::
string
prefix
,
Indices
...
ii
)
const
{
{
auto
data
=
makeD
iscreteFunction
(
*
systemVector_
,
treePath
);
auto
data
=
d
iscreteFunction
(
*
systemVector_
,
ii
...
);
return
create_impl
(
std
::
move
(
type
),
std
::
move
(
prefix
),
data
,
Dune
::
PriorityTag
<
42
>
{});
return
create_impl
(
std
::
move
(
type
),
std
::
move
(
prefix
),
data
,
Dune
::
PriorityTag
<
42
>
{});
}
}
...
...
amdis/typetree/TreeContainer.hpp
View file @
7f7d3d80
...
@@ -260,7 +260,7 @@ namespace AMDiS
...
@@ -260,7 +260,7 @@ namespace AMDiS
return
ValueAndContainer
{
return
ValueAndContainer
{
value
(
node
),
value
(
node
),
Tools
::
apply_indices
<
Node
::
degree
()
>
(
Tools
::
apply_indices
<
Node
::
degree
()
>
(
[
&
](
auto
...
i
)
{
return
Dune
::
makeTupleVector
((
*
this
)(
node
.
child
(
i
))...);
})};
[
&
](
auto
...
i
i
)
{
return
Dune
::
makeTupleVector
((
*
this
)(
node
.
child
(
i
i
))...);
})};
}
}
else
{
else
{
static_assert
(
Node
::
isLeaf
||
Node
::
isPower
||
Node
::
isComposite
,
static_assert
(
Node
::
isLeaf
||
Node
::
isPower
||
Node
::
isComposite
,
...
...
amdis/typetree/TreePath.hpp
View file @
7f7d3d80
...
@@ -23,29 +23,24 @@ namespace AMDiS
...
@@ -23,29 +23,24 @@ namespace AMDiS
namespace
Definition
namespace
Definition
{
{
template
<
class
TP
>
template
<
class
Index
>
struct
IsPreTreePath
struct
IsPreTreePath
:
std
::
is_integral
<
TP
>
:
std
::
is_integral
<
Index
>
{};
{};
template
<
int
I
>
template
<
class
Index
,
Index
I
>
struct
IsPreTreePath
<
std
::
integral_constant
<
int
,
I
>>
struct
IsPreTreePath
<
std
::
integral_constant
<
Index
,
I
>>
:
std
::
true_type
:
std
::
is_integral
<
Index
>
{};
template
<
std
::
size_t
I
>
struct
IsPreTreePath
<
std
::
integral_constant
<
std
::
size_t
,
I
>>
:
std
::
true_type
{};
{};
template
<
int
...
I
>
template
<
class
Index
,
Index
...
I
>
struct
IsPreTreePath
<
std
::
integer_sequence
<
int
,
I
...
>>
struct
IsPreTreePath
<
std
::
integer_sequence
<
Index
,
I
...
>>
:
std
::
true_type
:
std
::
is_integral
<
Index
>
{};
{};
template
<
std
::
size_t
...
I
>
template
<
class
...
Indices
>
struct
IsPreTreePath
<
std
::
index_sequence
<
I
...
>>
struct
IsPreTreePath
<
std
::
tuple
<
Indices
...
>>
:
std
::
true_type
:
std
::
conjunction
<
std
::
is_integral
<
Indices
>
...
>
{};
{};
template
<
>
template
<
>
...
@@ -65,24 +60,46 @@ namespace AMDiS
...
@@ -65,24 +60,46 @@ namespace AMDiS
}
// end namespace Concepts
}
// end namespace Concepts
namespace
Impl
{
template
<
class
Index
,
std
::
enable_if_t
<
std
::
is_integral_v
<
Index
>,
int
>
=
0
>
std
::
size_t
treePathIndex
(
Index
i
)
{
return
std
::
size_t
(
i
);
}
template
<
class
Index
,
Index
i
,
std
::
enable_if_t
<
std
::
is_integral_v
<
Index
>,
int
>
=
0
>
auto
treePathIndex
(
std
::
integral_constant
<
Index
,
i
>
)
{
return
std
::
integral_constant
<
std
::
size_t
,
std
::
size_t
(
i
)
>
{};
}
}
// end namespace Impl
#ifdef DOXYGEN
#ifdef DOXYGEN
/// \brief Converts a
(pre)TreePath
into a HybridTreePath
/// \brief Converts a
sequence of indices
into a HybridTreePath
/**
/**
* Converts an integer, an integralconstant
or a Dune TreePath into an
* Converts an integer, an integralconstant
, a sequence of those, or a TreePath
* \ref Dune::TypeTree::HybridTreePath that is used in GlobalBasis traversal.
*
into an
\ref Dune::TypeTree::HybridTreePath that is used in GlobalBasis traversal.
*
*
* **Requirements:**
* **Requirements:**
* - `PreTreePath` one of
* The arguments can be one or more of
* + integer type (`int, std::size_t`),
* - integer type (`int, std::size_t`)
* + integral constant (`std::integral_constant<[int|std::size_t], i>`)
* - integral constant (`std::integral_constant<[int|std::size_t],i>, index_t<i>`)
* + any Dune TreePath (`TreePath<std::size_t...>, DynamicTreePath, HybridTreePath<class... T>`)
* or one of dune treepath types, e.g.
* - any Dune TreePath (`TreePath<std::size_t...>, HybridTreePath<class... T>`)
* - a `std::tuple` type
*
*
* **Example:**
* **Example:**
* ```
* ```
* makeTreePath(1),
* makeTreePath(0,1,2),
* makeTreePath(int_<2>),
* makeTreePath(int_<2>, 0),
* makeTreePath(treepath(1, int_<2>))
* makeTreePath(1, index_<2>),
* makeTreePath(hybridTreePath(0,1,2)),
* makeTreePath(std::tuple{0,index_<2>,2})
* ```
* ```
**/
**/
template
<
class
PreTreePath
>
template
<
class
PreTreePath
>
...
@@ -90,35 +107,34 @@ namespace AMDiS
...
@@ -90,35 +107,34 @@ namespace AMDiS
#else // DOXYGEN
#else // DOXYGEN
inline
auto
makeTreePath
(
int
i
)
{
return
Dune
::
TypeTree
::
hybridTreePath
(
std
::
size_t
(
i
));
}
template
<
class
...
Indices
>
inline
auto
makeTreePath
(
std
::
size_t
i
)
{
return
Dune
::
TypeTree
::
hybridTreePath
(
i
);
}