Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
amdis-core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
8
Issues
8
List
Boards
Labels
Service Desk
Milestones
Merge Requests
7
Merge Requests
7
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
External Wiki
External Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
amdis
amdis-core
Commits
7f7d3d80
Commit
7f7d3d80
authored
Oct 14, 2020
by
Praetorius, Simon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rename child() into discreteFunction()
parent
dc6aa48e
Changes
24
Hide whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
236 additions
and
266 deletions
+236
-266
amdis/DOFVector.hpp
amdis/DOFVector.hpp
+18
-17
amdis/DirichletBC.hpp
amdis/DirichletBC.hpp
+1
-1
amdis/LinearForm.inc.hpp
amdis/LinearForm.inc.hpp
+1
-0
amdis/PeriodicBC.hpp
amdis/PeriodicBC.hpp
+1
-1
amdis/ProblemInstat.hpp
amdis/ProblemInstat.hpp
+3
-3
amdis/ProblemStat.hpp
amdis/ProblemStat.hpp
+14
-14
amdis/ProblemStat.inc.hpp
amdis/ProblemStat.inc.hpp
+2
-2
amdis/gridfunctions/DiscreteFunction.hpp
amdis/gridfunctions/DiscreteFunction.hpp
+18
-27
amdis/io/FileWriterCreator.hpp
amdis/io/FileWriterCreator.hpp
+4
-4
amdis/typetree/TreeContainer.hpp
amdis/typetree/TreeContainer.hpp
+1
-1
amdis/typetree/TreePath.hpp
amdis/typetree/TreePath.hpp
+59
-68
docs/reference/DOFVector.md
docs/reference/DOFVector.md
+22
-77
docs/reference/GlobalBasis.md
docs/reference/GlobalBasis.md
+5
-5
docs/reference/Operators.md
docs/reference/Operators.md
+1
-1
docs/reference/Problem.md
docs/reference/Problem.md
+7
-7
examples/navier_stokes.cc
examples/navier_stokes.cc
+2
-2
examples/stokes0.cc
examples/stokes0.cc
+3
-3
examples/stokes1.cc
examples/stokes1.cc
+1
-1
test/AdaptInfoTest.cpp
test/AdaptInfoTest.cpp
+2
-2
test/BackupRestoreTest.cpp
test/BackupRestoreTest.cpp
+4
-4
test/CMakeLists.txt
test/CMakeLists.txt
+3
-0
test/DiscreteFunctionTest.cpp
test/DiscreteFunctionTest.cpp
+19
-20
test/GradientTest.cpp
test/GradientTest.cpp
+6
-6
test/TreePathTest.cpp
test/TreePathTest.cpp
+39
-0
No files found.
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
makeDiscreteFunction
(
DOFVector
<
GB
,
T
>&
dofVec
,
Path
const
&
path
=
{}
)
auto
discreteFunction
(
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
makeDiscreteFunction
(
DOFVector
<
GB
,
T
>
const
&
dofVec
,
Path
const
&
path
=
{}
)
auto
discreteFunction
(
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
,
treepath
(),
colBasis
,
treep
ath
(),
return
makeDirichletBC
<
Mat
,
Sol
,
Rhs
>
(
rowBasis
,
makeTreePath
(),
colBasis
,
makeTreeP
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
,
treep
ath
(),
std
::
move
(
boundarySubset
),
return
makePeriodicBC
<
Mat
,
Sol
,
Rhs
>
(
basis
,
makeTreeP
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
treep
ath()
* corresponding to the row basis. \see
makeTreeP
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
treep
ath()
* corresponding to the column basis. \see
makeTreeP
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
treep
ath()
* corresponding to the row basis. \see
makeTreeP
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
treep
ath()
* corresponding to the column basis. \see
makeTreeP
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
treep
ath()
* corresponding to the row basis. \see
makeTreeP
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
treep
ath()
* corresponding to the row basis. \see
makeTreeP
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
treep
ath()
* corresponding to the row basis. \see
makeTreeP
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
treep
ath()
* corresponding to the column basis. \see
makeTreeP
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_
,
treep
ath
());
auto
basis
=
Dune
::
Functions
::
subspaceBasis
(
*
globalBasis_
,
makeTreeP
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_
[
treepath
()][
treep
ath
()].
push_back
(
makeUniquePtr
(
std
::
move
(
bc
)));
boundaryConditions_
[
makeTreePath
()][
makeTreeP
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
makeDiscreteFunction
(
*
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
makeDiscreteFunction
(
*
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
=
makeDiscreteFunction
(
*
systemVector_
,
treePath
);
auto
data
=
discreteFunction
(
*
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
>
template
<
class
Index
,
Index
...
I
>
struct
IsPreTreePath
<
std
::
integral_constant
<
std
::
size_t
,
I
>>
struct
IsPreTreePath
<
std
::
integer_sequence
<
Index
,
I
...
>>
:
std
::
true_type
:
std
::
is_integral
<
Index
>
{};
template
<
int
...
I
>
struct
IsPreTreePath
<
std
::
integer_sequence
<
int
,
I
...
>>
:
std
::
true_type
{};
{};
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