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
D
dune-amdis
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Praetorius, Simon
dune-amdis
Commits
90c3d73b
Commit
90c3d73b
authored
Dec 28, 2017
by
Praetorius, Simon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improved error messages, added quadrature degree parameter
parent
e4baaf0f
Changes
38
Hide whitespace changes
Inline
Side-by-side
Showing
38 changed files
with
403 additions
and
327 deletions
+403
-327
dune/amdis/GridFunctionOperator.hpp
dune/amdis/GridFunctionOperator.hpp
+64
-12
dune/amdis/GridFunctions.hpp
dune/amdis/GridFunctions.hpp
+11
-0
dune/amdis/ProblemStat.hpp
dune/amdis/ProblemStat.hpp
+1
-0
dune/amdis/ProblemStat.inc.hpp
dune/amdis/ProblemStat.inc.hpp
+1
-1
dune/amdis/assembler/FirstOrderDivTestvecTrial.hpp
dune/amdis/assembler/FirstOrderDivTestvecTrial.hpp
+2
-2
dune/amdis/assembler/FirstOrderGradTestTrial.hpp
dune/amdis/assembler/FirstOrderGradTestTrial.hpp
+2
-2
dune/amdis/assembler/FirstOrderGradTestTrialvec.hpp
dune/amdis/assembler/FirstOrderGradTestTrialvec.hpp
+2
-2
dune/amdis/assembler/FirstOrderPartialTestTrial.hpp
dune/amdis/assembler/FirstOrderPartialTestTrial.hpp
+2
-2
dune/amdis/assembler/FirstOrderTestDivTrialvec.hpp
dune/amdis/assembler/FirstOrderTestDivTrialvec.hpp
+2
-2
dune/amdis/assembler/FirstOrderTestGradTrial.hpp
dune/amdis/assembler/FirstOrderTestGradTrial.hpp
+2
-2
dune/amdis/assembler/FirstOrderTestPartialTrial.hpp
dune/amdis/assembler/FirstOrderTestPartialTrial.hpp
+2
-2
dune/amdis/assembler/FirstOrderTestvecGradTrial.hpp
dune/amdis/assembler/FirstOrderTestvecGradTrial.hpp
+2
-2
dune/amdis/assembler/SecondOrderDivTestvecDivTrialvec.hpp
dune/amdis/assembler/SecondOrderDivTestvecDivTrialvec.hpp
+2
-2
dune/amdis/assembler/SecondOrderGradTestGradTrial.hpp
dune/amdis/assembler/SecondOrderGradTestGradTrial.hpp
+2
-2
dune/amdis/assembler/SecondOrderPartialTestPartialTrial.hpp
dune/amdis/assembler/SecondOrderPartialTestPartialTrial.hpp
+2
-2
dune/amdis/assembler/ZeroOrderTest.hpp
dune/amdis/assembler/ZeroOrderTest.hpp
+2
-2
dune/amdis/assembler/ZeroOrderTestTrial.hpp
dune/amdis/assembler/ZeroOrderTestTrial.hpp
+2
-2
dune/amdis/assembler/ZeroOrderTestTrialvec.hpp
dune/amdis/assembler/ZeroOrderTestTrialvec.hpp
+2
-2
dune/amdis/assembler/ZeroOrderTestvec.hpp
dune/amdis/assembler/ZeroOrderTestvec.hpp
+2
-2
dune/amdis/assembler/ZeroOrderTestvecTrial.hpp
dune/amdis/assembler/ZeroOrderTestvecTrial.hpp
+2
-2
dune/amdis/assembler/ZeroOrderTestvecTrialvec.hpp
dune/amdis/assembler/ZeroOrderTestvecTrialvec.hpp
+2
-2
dune/amdis/gridfunctions/AnalyticGridFunction.hpp
dune/amdis/gridfunctions/AnalyticGridFunction.hpp
+40
-30
dune/amdis/gridfunctions/ConstantGridFunction.hpp
dune/amdis/gridfunctions/ConstantGridFunction.hpp
+17
-24
dune/amdis/gridfunctions/CoordsGridFunction.hpp
dune/amdis/gridfunctions/CoordsGridFunction.hpp
+41
-46
dune/amdis/gridfunctions/DOFVectorView.hpp
dune/amdis/gridfunctions/DOFVectorView.hpp
+1
-11
dune/amdis/gridfunctions/DerivativeGridFunction.hpp
dune/amdis/gridfunctions/DerivativeGridFunction.hpp
+12
-8
dune/amdis/gridfunctions/FunctorGridFunction.hpp
dune/amdis/gridfunctions/FunctorGridFunction.hpp
+57
-54
dune/amdis/gridfunctions/GridFunctionConcepts.hpp
dune/amdis/gridfunctions/GridFunctionConcepts.hpp
+10
-16
dune/amdis/gridfunctions/Integrate.hpp
dune/amdis/gridfunctions/Integrate.hpp
+61
-15
dune/amdis/operations/Arithmetic.hpp
dune/amdis/operations/Arithmetic.hpp
+0
-6
dune/amdis/operations/Basic.hpp
dune/amdis/operations/Basic.hpp
+15
-0
dune/amdis/operations/CMath.hpp
dune/amdis/operations/CMath.hpp
+20
-34
dune/amdis/operations/Composer.hpp
dune/amdis/operations/Composer.hpp
+5
-1
dune/amdis/operations/MaxMin.hpp
dune/amdis/operations/MaxMin.hpp
+0
-24
src/ellipt.cc
src/ellipt.cc
+1
-1
src/expressions.cc
src/expressions.cc
+9
-7
src/heat.cc
src/heat.cc
+2
-2
src/vecellipt.cc
src/vecellipt.cc
+1
-1
No files found.
dune/amdis/GridFunctionOperator.hpp
View file @
90c3d73b
...
...
@@ -3,7 +3,8 @@
#include <cassert>
#include <type_traits>
#include <dune/amdis/gridfunctions/GridFunctionConcepts.hpp>
#include <dune/amdis/GridFunctions.hpp>
#include <dune/amdis/common/Utility.hpp>
#include <dune/amdis/utility/GetDegree.hpp>
namespace
AMDiS
...
...
@@ -24,10 +25,11 @@ namespace AMDiS
* \ref ExpressionBase, and stores a copy. Additionally, it gets the
* differentiation order, to calculate the quadrature degree in \ref getDegree.
**/
GridFunctionOperatorBase
(
GridFunction
const
&
gridFct
,
int
order
)
GridFunctionOperatorBase
(
GridFunction
const
&
gridFct
,
int
order
,
int
degree
=
-
1
)
:
gridFct_
(
gridFct
)
,
localFct_
(
localFunction
(
gridFct_
))
,
order_
(
order
)
,
degree_
(
degree
)
{}
/// \brief Binds operator to `element` and `geometry`.
...
...
@@ -75,7 +77,7 @@ namespace AMDiS
assert
(
bound_
);
int
psiDegree
=
getPolynomialDegree
(
node
);
int
coeffDegree
=
order
(
localFct_
);
int
coeffDegree
=
getGridFctDegree
(
localFct_
);
int
degree
=
psiDegree
+
coeffDegree
;
if
(
isSimplex_
)
...
...
@@ -100,7 +102,7 @@ namespace AMDiS
int
psiDegree
=
getPolynomialDegree
(
rowNode
);
int
phiDegree
=
getPolynomialDegree
(
colNode
);
int
coeffDegree
=
order
(
localFct_
);
int
coeffDegree
=
getGridFctDegree
(
localFct_
);
int
degree
=
psiDegree
+
phiDegree
+
coeffDegree
;
if
(
isSimplex_
)
...
...
@@ -111,11 +113,27 @@ namespace AMDiS
return
degree
;
}
protected:
template
<
class
LocalFct
,
REQUIRES
(
Concepts
::
HasOrder
<
LocalFct
>)
>
int
getGridFctDegree
(
LocalFct
const
&
localFct
)
const
{
return
degree_
>=
0
?
degree_
:
order
(
localFct_
);
}
template
<
class
LocalFct
,
REQUIRES
(
not
Concepts
::
HasOrder
<
LocalFct
>)
>
int
getGridFctDegree
(
LocalFct
const
&
localFct
)
const
{
return
degree_
;
}
private:
GridFunction
gridFct_
;
LocalFunction
localFct_
;
int
order_
;
//< the derivative order of this operator
int
degree_
;
//< the polynomial order of the gridFunction
bool
isSimplex_
=
false
;
//< the bound element is a simplex
bool
isAffine_
=
false
;
//< the bound geometry is affine
...
...
@@ -166,50 +184,84 @@ namespace AMDiS
}
};
namespace
Concepts
{
namespace
Definition
{
struct
HasGridFunctionOrder
{
template
<
class
F
,
class
GridView
>
auto
requires_
(
F
&&
f
,
GridView
const
&
gridView
)
->
decltype
(
order
(
localFunction
(
makeGridFunction
(
f
,
gridView
)))
);
};
}
template
<
class
F
,
class
GridView
=
Dune
::
YaspGrid
<
2
>
::
LeafGridView
>
constexpr
bool
HasGridFunctionOrder
=
models
<
Definition
::
HasGridFunctionOrder
(
F
,
GridView
)
>
;
}
// end namespace Concepts
template
<
class
Tag
,
class
Expr
>
struct
ExpressionPreOperator
{
Tag
tag
;
Expr
expr
;
int
order
=
-
1
;
};
/// Store tag and expression in struct
template
<
class
Tag
,
class
Expr
>
auto
makeOperator
(
Tag
t
,
Expr
const
&
expr
)
{
using
RawExpr
=
Underlying_t
<
Expr
>
;
static_assert
(
Concepts
::
HasGridFunctionOrder
<
RawExpr
>
,
"Polynomial degree of expression can not be deduced. You need to provide an explicit value for polynomial order in `makeOperator()`."
);
return
ExpressionPreOperator
<
Tag
,
Expr
>
{
t
,
expr
};
}
template
<
class
Tag
,
class
Expr
>
auto
makeOperator
(
Tag
t
,
Expr
const
&
expr
,
int
order
)
{
return
ExpressionPreOperator
<
Tag
,
Expr
>
{
t
,
expr
,
order
};
}
/// Generate an \ref GridFunctionOperator from a PreOperator (tag, expr).
/// @{
template
<
class
Tag
,
class
Expr
,
class
GridView
>
auto
makeGridOperator
(
ExpressionPreOperator
<
Tag
,
Expr
>
const
&
op
,
GridView
const
&
gridView
)
{
auto
gridFct
=
makeGridFunction
(
op
.
expr
,
gridView
,
Dune
::
PriorityTag
<
42
>
{}
);
return
GridFunctionOperator
<
Tag
,
decltype
(
gridFct
)
>
{
op
.
tag
,
gridFct
};
auto
gridFct
=
makeGridFunction
(
op
.
expr
,
gridView
);
return
GridFunctionOperator
<
Tag
,
decltype
(
gridFct
)
>
{
op
.
tag
,
gridFct
,
op
.
order
};
}
template
<
class
Tag
,
class
Expr
,
class
GridView
>
auto
makeGridOperator
(
std
::
reference_wrapper
<
ExpressionPreOperator
<
Tag
,
Expr
>>
op
,
GridView
const
&
gridView
)
{
ExpressionPreOperator
<
Tag
,
Expr
>
const
&
op_ref
=
op
;
auto
gridFct
=
makeGridFunction
(
std
::
ref
(
op_ref
.
expr
),
gridView
,
Dune
::
PriorityTag
<
42
>
{}
);
return
GridFunctionOperator
<
Tag
,
decltype
(
gridFct
)
>
{
op_ref
.
tag
,
gridFct
};
auto
gridFct
=
makeGridFunction
(
std
::
ref
(
op_ref
.
expr
),
gridView
);
return
GridFunctionOperator
<
Tag
,
decltype
(
gridFct
)
>
{
op_ref
.
tag
,
gridFct
,
op_ref
.
order
};
}
/// @}
/// Generate a shared_ptr to \ref GridFunctionOperator from a PreOperator (tag, expr).
/// @{
template
<
class
Tag
,
class
Expr
,
class
GridView
>
auto
makeGridOperatorPtr
(
ExpressionPreOperator
<
Tag
,
Expr
>
const
&
op
,
GridView
const
&
gridView
)
{
auto
gridFct
=
makeGridFunction
(
op
.
expr
,
gridView
,
Dune
::
PriorityTag
<
42
>
{}
);
return
std
::
make_shared
<
GridFunctionOperator
<
Tag
,
decltype
(
gridFct
)
>>
(
op
.
tag
,
gridFct
);
auto
gridFct
=
makeGridFunction
(
op
.
expr
,
gridView
);
return
std
::
make_shared
<
GridFunctionOperator
<
Tag
,
decltype
(
gridFct
)
>>
(
op
.
tag
,
gridFct
,
op
.
order
);
}
template
<
class
Tag
,
class
Expr
,
class
GridView
>
auto
makeGridOperatorPtr
(
std
::
reference_wrapper
<
ExpressionPreOperator
<
Tag
,
Expr
>>
op
,
GridView
const
&
gridView
)
{
ExpressionPreOperator
<
Tag
,
Expr
>
const
&
op_ref
=
op
;
auto
gridFct
=
makeGridFunction
(
std
::
ref
(
op_ref
.
expr
),
gridView
,
Dune
::
PriorityTag
<
42
>
{}
);
return
std
::
make_shared
<
GridFunctionOperator
<
Tag
,
decltype
(
gridFct
)
>>
(
op_ref
.
tag
,
gridFct
);
auto
gridFct
=
makeGridFunction
(
std
::
ref
(
op_ref
.
expr
),
gridView
);
return
std
::
make_shared
<
GridFunctionOperator
<
Tag
,
decltype
(
gridFct
)
>>
(
op_ref
.
tag
,
gridFct
,
op_ref
.
order
);
}
/// @}
}
// end namespace AMDiS
dune/amdis/GridFunctions.hpp
View file @
90c3d73b
...
...
@@ -6,3 +6,14 @@
#include <dune/amdis/gridfunctions/DerivativeGridFunction.hpp>
#include <dune/amdis/gridfunctions/FunctorGridFunction.hpp>
#include <dune/amdis/gridfunctions/OperationsGridFunction.hpp>
namespace
AMDiS
{
// Generator for Gridfunctions from Pre-Gridfunctions
template
<
class
PreGridFct
,
class
GridView
>
decltype
(
auto
)
makeGridFunction
(
PreGridFct
&&
preGridFct
,
GridView
const
&
gridView
)
{
return
Impl
::
makeGridFunctionImpl
(
std
::
forward
<
PreGridFct
>
(
preGridFct
),
gridView
,
Dune
::
PriorityTag
<
10
>
{});
}
}
// end namespace AMDiS
dune/amdis/ProblemStat.hpp
View file @
90c3d73b
...
...
@@ -31,6 +31,7 @@
#include <dune/amdis/common/TypeDefs.hpp>
#include <dune/amdis/common/Utility.hpp>
#include <dune/amdis/GridFunctions.hpp>
#include <dune/amdis/gridfunctions/DOFVectorView.hpp>
#include <dune/amdis/io/FileWriterInterface.hpp>
...
...
dune/amdis/ProblemStat.inc.hpp
View file @
90c3d73b
...
...
@@ -216,7 +216,7 @@ addDirichletBC(Predicate const& predicate, RowTreePath row, ColTreePath col, Val
auto
i
=
child
(
globalBasis
->
localView
().
tree
(),
makeTreePath
(
row
));
auto
j
=
child
(
globalBasis
->
localView
().
tree
(),
makeTreePath
(
col
));
auto
valueGridFct
=
makeGridFunction
(
values
,
globalBasis
->
gridView
()
,
Dune
::
PriorityTag
<
42
>
{}
);
auto
valueGridFct
=
makeGridFunction
(
values
,
globalBasis
->
gridView
());
using
Range
=
typename
decltype
(
valueGridFct
)
::
Range
;
using
BcType
=
DirichletBC
<
WorldVector
,
Range
>
;
...
...
dune/amdis/assembler/FirstOrderDivTestvecTrial.hpp
View file @
90c3d73b
...
...
@@ -20,8 +20,8 @@ namespace AMDiS
using
Transposed
=
GridFunctionOperator
<
tag
::
test_divtrialvec
,
GridFct
>
;
public:
GridFunctionOperator
(
tag
::
divtestvec_trial
,
GridFct
const
&
expr
)
:
Transposed
(
tag
::
test_divtrialvec
{},
expr
)
GridFunctionOperator
(
tag
::
divtestvec_trial
,
GridFct
const
&
expr
,
int
degree
)
:
Transposed
(
tag
::
test_divtrialvec
{},
expr
,
degree
)
{}
template
<
class
Context
,
class
QuadratureRule
,
...
...
dune/amdis/assembler/FirstOrderGradTestTrial.hpp
View file @
90c3d73b
...
...
@@ -20,8 +20,8 @@ namespace AMDiS
using
Transposed
=
GridFunctionOperator
<
tag
::
test_gradtrial
,
GridFct
>
;
public:
GridFunctionOperator
(
tag
::
gradtest_trial
,
GridFct
const
&
expr
)
:
Transposed
(
tag
::
test_gradtrial
{},
expr
)
GridFunctionOperator
(
tag
::
gradtest_trial
,
GridFct
const
&
expr
,
int
degree
)
:
Transposed
(
tag
::
test_gradtrial
{},
expr
,
degree
)
{}
template
<
class
Context
,
class
QuadratureRule
,
...
...
dune/amdis/assembler/FirstOrderGradTestTrialvec.hpp
View file @
90c3d73b
...
...
@@ -20,8 +20,8 @@ namespace AMDiS
using
Transposed
=
GridFunctionOperator
<
tag
::
testvec_gradtrial
,
GridFct
>
;
public:
GridFunctionOperator
(
tag
::
gradtest_trialvec
,
GridFct
const
&
expr
)
:
Transposed
(
tag
::
testvec_gradtrial
{},
expr
)
GridFunctionOperator
(
tag
::
gradtest_trialvec
,
GridFct
const
&
expr
,
int
degree
)
:
Transposed
(
tag
::
testvec_gradtrial
{},
expr
,
degree
)
{}
template
<
class
Context
,
class
QuadratureRule
,
...
...
dune/amdis/assembler/FirstOrderPartialTestTrial.hpp
View file @
90c3d73b
...
...
@@ -23,8 +23,8 @@ namespace AMDiS
using
Transposed
=
GridFunctionOperator
<
tag
::
test_partialtrial
,
GridFct
>
;
public:
GridFunctionOperator
(
tag
::
partialtest_trial
tag
,
GridFct
const
&
expr
)
:
Transposed
(
tag
::
test_partialtrial
{
tag
.
comp
},
expr
)
GridFunctionOperator
(
tag
::
partialtest_trial
tag
,
GridFct
const
&
expr
,
int
degree
)
:
Transposed
(
tag
::
test_partialtrial
{
tag
.
comp
},
expr
,
degree
)
{}
template
<
class
Context
,
class
QuadratureRule
,
...
...
dune/amdis/assembler/FirstOrderTestDivTrialvec.hpp
View file @
90c3d73b
...
...
@@ -24,8 +24,8 @@ namespace AMDiS
static_assert
(
Category
::
Scalar
<
typename
GridFct
::
Range
>
,
"Expression must be of scalar type."
);
public:
GridFunctionOperator
(
tag
::
test_divtrialvec
,
GridFct
const
&
expr
)
:
Super
(
expr
,
1
)
GridFunctionOperator
(
tag
::
test_divtrialvec
,
GridFct
const
&
expr
,
int
degree
)
:
Super
(
expr
,
1
,
degree
)
{}
template
<
class
Context
,
class
QuadratureRule
,
...
...
dune/amdis/assembler/FirstOrderTestGradTrial.hpp
View file @
90c3d73b
...
...
@@ -24,8 +24,8 @@ namespace AMDiS
static_assert
(
Category
::
Vector
<
typename
GridFct
::
Range
>
,
"Expression must be of vector type."
);
public:
GridFunctionOperator
(
tag
::
test_gradtrial
,
GridFct
const
&
expr
)
:
Super
(
expr
,
1
)
GridFunctionOperator
(
tag
::
test_gradtrial
,
GridFct
const
&
expr
,
int
degree
)
:
Super
(
expr
,
1
,
degree
)
{}
template
<
class
Context
,
class
QuadratureRule
,
...
...
dune/amdis/assembler/FirstOrderTestPartialTrial.hpp
View file @
90c3d73b
...
...
@@ -27,8 +27,8 @@ namespace AMDiS
static_assert
(
Category
::
Scalar
<
typename
GridFct
::
Range
>
,
"Expression must be of scalar type."
);
public:
GridFunctionOperator
(
tag
::
test_partialtrial
tag
,
GridFct
const
&
expr
)
:
Super
(
expr
,
1
)
GridFunctionOperator
(
tag
::
test_partialtrial
tag
,
GridFct
const
&
expr
,
int
degree
)
:
Super
(
expr
,
1
,
degree
)
,
comp_
(
tag
.
comp
)
{}
...
...
dune/amdis/assembler/FirstOrderTestvecGradTrial.hpp
View file @
90c3d73b
...
...
@@ -24,8 +24,8 @@ namespace AMDiS
static_assert
(
Category
::
Scalar
<
typename
GridFct
::
Range
>
,
"Expression must be of scalar type."
);
public:
GridFunctionOperator
(
tag
::
testvec_gradtrial
,
GridFct
const
&
expr
)
:
Super
(
expr
,
1
)
GridFunctionOperator
(
tag
::
testvec_gradtrial
,
GridFct
const
&
expr
,
int
degree
)
:
Super
(
expr
,
1
,
degree
)
{}
template
<
class
Context
,
class
QuadratureRule
,
...
...
dune/amdis/assembler/SecondOrderDivTestvecDivTrialvec.hpp
View file @
90c3d73b
...
...
@@ -24,8 +24,8 @@ namespace AMDiS
static_assert
(
Category
::
Scalar
<
typename
GridFct
::
Range
>
,
"Expression must be of scalar type."
);
public:
GridFunctionOperator
(
tag
::
divtestvec_divtrialvec
,
GridFct
const
&
expr
)
:
Super
(
expr
,
2
)
GridFunctionOperator
(
tag
::
divtestvec_divtrialvec
,
GridFct
const
&
expr
,
int
degree
)
:
Super
(
expr
,
2
,
degree
)
{}
template
<
class
Context
,
class
QuadratureRule
,
...
...
dune/amdis/assembler/SecondOrderGradTestGradTrial.hpp
View file @
90c3d73b
...
...
@@ -26,8 +26,8 @@ namespace AMDiS
"Expression must be of scalar or matrix type."
);
public:
GridFunctionOperator
(
tag
::
gradtest_gradtrial
,
GridFct
const
&
expr
)
:
Super
(
expr
,
2
)
GridFunctionOperator
(
tag
::
gradtest_gradtrial
,
GridFct
const
&
expr
,
int
degree
)
:
Super
(
expr
,
2
,
degree
)
{}
template
<
class
Context
,
class
QuadratureRule
,
...
...
dune/amdis/assembler/SecondOrderPartialTestPartialTrial.hpp
View file @
90c3d73b
...
...
@@ -28,8 +28,8 @@ namespace AMDiS
static_assert
(
Category
::
Scalar
<
typename
GridFct
::
Range
>
,
"Expression must be of scalar type."
);
public:
GridFunctionOperator
(
tag
::
partialtest_partialtrial
tag
,
GridFct
const
&
expr
)
:
Super
(
expr
,
2
)
GridFunctionOperator
(
tag
::
partialtest_partialtrial
tag
,
GridFct
const
&
expr
,
int
degree
)
:
Super
(
expr
,
2
,
degree
)
,
compTest_
(
tag
.
comp_test
)
,
compTrial_
(
tag
.
comp_trial
)
{}
...
...
dune/amdis/assembler/ZeroOrderTest.hpp
View file @
90c3d73b
...
...
@@ -23,8 +23,8 @@ namespace AMDiS
static_assert
(
Category
::
Scalar
<
typename
GridFct
::
Range
>
,
"Expression must be of scalar type."
);
public:
GridFunctionOperator
(
tag
::
test
,
GridFct
const
&
expr
)
:
Super
(
expr
,
0
)
GridFunctionOperator
(
tag
::
test
,
GridFct
const
&
expr
,
int
degree
)
:
Super
(
expr
,
0
,
degree
)
{}
template
<
class
Context
,
class
QuadratureRule
,
...
...
dune/amdis/assembler/ZeroOrderTestTrial.hpp
View file @
90c3d73b
...
...
@@ -23,8 +23,8 @@ namespace AMDiS
static_assert
(
Category
::
Scalar
<
typename
GridFct
::
Range
>
,
"Expression must be of scalar type."
);
public:
GridFunctionOperator
(
tag
::
test_trial
,
GridFct
const
&
expr
)
:
Super
(
expr
,
0
)
GridFunctionOperator
(
tag
::
test_trial
,
GridFct
const
&
expr
,
int
degree
)
:
Super
(
expr
,
0
,
degree
)
{}
template
<
class
Context
,
class
QuadratureRule
,
...
...
dune/amdis/assembler/ZeroOrderTestTrialvec.hpp
View file @
90c3d73b
...
...
@@ -23,8 +23,8 @@ namespace AMDiS
static_assert
(
Category
::
Vector
<
typename
GridFct
::
Range
>
,
"Expression must be of vector type."
);
public:
GridFunctionOperator
(
tag
::
test_trialvec
,
GridFct
const
&
expr
)
:
Super
(
expr
,
0
)
GridFunctionOperator
(
tag
::
test_trialvec
,
GridFct
const
&
expr
,
int
degree
)
:
Super
(
expr
,
0
,
degree
)
{}
template
<
class
Context
,
class
QuadratureRule
,
...
...
dune/amdis/assembler/ZeroOrderTestvec.hpp
View file @
90c3d73b
...
...
@@ -23,8 +23,8 @@ namespace AMDiS
static_assert
(
Category
::
Vector
<
typename
GridFct
::
Range
>
,
"Expression must be of vector type."
);
public:
GridFunctionOperator
(
tag
::
testvec
,
GridFct
const
&
expr
)
:
Super
(
expr
,
0
)
GridFunctionOperator
(
tag
::
testvec
,
GridFct
const
&
expr
,
int
degree
)
:
Super
(
expr
,
0
,
degree
)
{}
template
<
class
Context
,
class
QuadratureRule
,
...
...
dune/amdis/assembler/ZeroOrderTestvecTrial.hpp
View file @
90c3d73b
...
...
@@ -20,8 +20,8 @@ namespace AMDiS
using
Transposed
=
GridFunctionOperator
<
tag
::
test_trialvec
,
GridFct
>
;
public:
GridFunctionOperator
(
tag
::
testvec_trial
,
GridFct
const
&
expr
)
:
Transposed
(
tag
::
test_trialvec
{},
expr
)
GridFunctionOperator
(
tag
::
testvec_trial
,
GridFct
const
&
expr
,
int
degree
)
:
Transposed
(
tag
::
test_trialvec
{},
expr
,
degree
)
{}
template
<
class
Context
,
class
QuadratureRule
,
...
...
dune/amdis/assembler/ZeroOrderTestvecTrialvec.hpp
View file @
90c3d73b
...
...
@@ -25,8 +25,8 @@ namespace AMDiS
"Expression must be of scalar or matrix type."
);
public:
GridFunctionOperator
(
tag
::
testvec_trialvec
,
GridFct
const
&
expr
)
:
Super
(
expr
,
0
)
GridFunctionOperator
(
tag
::
testvec_trialvec
,
GridFct
const
&
expr
,
int
degree
)
:
Super
(
expr
,
0
,
degree
)
{}
template
<
class
Context
,
class
QuadratureRule
,
...
...
dune/amdis/gridfunctions/AnalyticGridFunction.hpp
View file @
90c3d73b
...
...
@@ -76,25 +76,33 @@ namespace AMDiS
/// Return the polynomial order of the function f, if a free function
/// order(f) exists, otherwise return a default value.
#ifdef AMDIS_HAS_CXX_CONSTEXPR_IF
template
<
class
Sig
,
class
LocalContext
,
class
F
>
template
<
class
Sig
,
class
LocalContext
,
class
F
,
REQUIRES
(
Concepts
::
HasOrder
<
F
>)
>
int
order
(
AnalyticLocalFunction
<
Sig
,
LocalContext
,
F
>
const
&
lf
)
{
if
constexpr
(
Concepts
::
HasOrder
<
F
>
)
return
order
(
lf
.
fct
(),
1
);
else
return
AMDIS_CALLABLE_DEFAULT_ORDER
;
return
order
(
lf
.
fct
(),
1
);
}
#else
template
<
class
Sig
,
class
LC
,
class
F
>
int
order
(
AnalyticLocalFunction
<
Sig
,
LC
,
F
>
const
&
lf
)
{
return
Dune
::
Hybrid
::
ifElse
(
bool_
<
Concepts
::
HasOrder
<
F
>>
,
[
&
lf
](
auto
id
)
{
return
id
(
order
(
lf
.
fct
(),
1
)
);
},
[]
(
auto
id
)
{
return
AMDIS_CALLABLE_DEFAULT_ORDER
;
}
);
}
#endif
// #ifdef AMDIS_HAS_CXX_CONSTEXPR_IF
// template <class Sig, class LocalContext, class F>
// int order(AnalyticLocalFunction<Sig,LocalContext,F> const& lf)
// {
// if constexpr (Concepts::HasOrder<F>)
// return order(lf.fct(),1);
// else
// return AMDIS_CALLABLE_DEFAULT_ORDER;
// }
// #else
// template <class Sig, class LC, class F>
// int order(AnalyticLocalFunction<Sig,LC,F> const& lf)
// {
// return Dune::Hybrid::ifElse( bool_<Concepts::HasOrder<F>>,
// [&lf](auto id) { return id( order(lf.fct(),1) ); },
// [] (auto id) { return AMDIS_CALLABLE_DEFAULT_ORDER; }
// );
// }
// #endif
/// A Gridfunction that evaluates a function with global coordinates
...
...
@@ -180,22 +188,24 @@ namespace AMDiS
return
AnalyticPreGridFunction
<
Function
>
{
f
};
}
/** @} **/
/// Generator function for \ref AnalyticGridFunction expressions from callable functions.
template
<
class
Function
,
class
GridView
,
REQUIRES
(
Concepts
::
CallableDomain
<
Function
>)
>
auto
makeGridFunction
(
Function
const
&
f
,
GridView
const
&
gridView
,
Dune
::
PriorityTag
<
3
>
)
{
return
AnalyticGridFunction
<
Function
,
GridView
>
{
f
,
gridView
};
}
/// Generator function for \ref AnalyticGridFunction expressions from \ref AnalyticPreGridFunction.
template
<
class
Function
,
class
GridView
>
auto
makeGridFunction
(
AnalyticPreGridFunction
<
Function
>
const
&
pre
,
GridView
const
&
gridView
,
Dune
::
PriorityTag
<
3
>
)
namespace
Impl
{
return
AnalyticGridFunction
<
Function
,
GridView
>
{
pre
.
fct_
,
gridView
};
}
/// Generator function for \ref AnalyticGridFunction expressions from callable functions.
template
<
class
Function
,
class
GridView
,
REQUIRES
(
Concepts
::
CallableDomain
<
Function
>)
>
auto
makeGridFunctionImpl
(
Function
const
&
f
,
GridView
const
&
gridView
,
Dune
::
PriorityTag
<
3
>
)
{
return
AnalyticGridFunction
<
Function
,
GridView
>
{
f
,
gridView
};
}
/** @} **/
/// Generator function for \ref AnalyticGridFunction expressions from \ref AnalyticPreGridFunction.
template
<
class
Function
,
class
GridView
>
auto
makeGridFunctionImpl
(
AnalyticPreGridFunction
<
Function
>
const
&
pre
,
GridView
const
&
gridView
,
Dune
::
PriorityTag
<
3
>
)
{
return
AnalyticGridFunction
<
Function
,
GridView
>
{
pre
.
fct_
,
gridView
};
}
}
// end namespace Impl
}
// end namespace AMDiS
dune/amdis/gridfunctions/ConstantGridFunction.hpp
View file @
90c3d73b
...
...
@@ -57,21 +57,19 @@ namespace AMDiS
return
0
;
}
friend
auto
derivative
(
ConstantLocalFunction
const
&
lf
)
{
using
RawSignature
=
typename
Dune
::
Functions
::
SignatureTraits
<
R
(
D
)
>::
RawSignature
;
using
DerivativeRange
=
typename
Dune
::
Functions
::
DefaultDerivativeTraits
<
RawSignature
>::
Range
;
DerivativeRange
diff
(
0
);
return
ConstantLocalFunction
<
DerivativeRange
(
D
),
LocalContext
,
DerivativeRange
>
{
diff
};
}
private:
T
value_
;
};
template
<
class
R
,
class
D
,
class
LC
,
class
T
>
auto
derivative
(
ConstantLocalFunction
<
R
(
D
),
LC
,
T
>
const
&
lf
)
{
using
RawSignature
=
typename
Dune
::
Functions
::
SignatureTraits
<
R
(
D
)
>::
RawSignature
;
using
DerivativeRange
=
typename
Dune
::
Functions
::
DefaultDerivativeTraits
<
RawSignature
>::
Range
;
DerivativeRange
diff
(
0
);
return
ConstantLocalFunction
<
DerivativeRange
(
D
),
LC
,
DerivativeRange
>
{
diff
};
}
/// A Gridfunction that evaluates a function with global coordinates
template
<
class
T
,
class
GridView
>
class
ConstantGridFunction
...
...
@@ -157,20 +155,15 @@ namespace AMDiS
}
// end namespace Concepts
/**
* \addtogroup GridFunctions
* @{
**/
/// Generator for a GridFunction representing a constant value
template
<
class
T
,
class
GridView
,
REQUIRES
(
Concepts
::
ConstantToGridFunction
<
T
>)
>
auto
makeGridFunction
(
T
const
&
value
,
GridView
const
&
gridView
,
Dune
::
PriorityTag
<
2
>
)
namespace
Impl
{
return
ConstantGridFunction
<
T
,
GridView
>
{
value
,
gridView
};
}
/** @} **/
/// Generator for a GridFunction representing a constant value
template
<
class
T
,
class
GridView
,
REQUIRES
(
Concepts
::
ConstantToGridFunction
<
T
>)
>
auto
makeGridFunctionImpl
(
T
const
&
value
,
GridView
const
&
gridView
,
Dune
::
PriorityTag
<
2
>
)
{
return
ConstantGridFunction
<
T
,
GridView
>
{
value
,
gridView
};
}
}
// end namespace Impl
}
// end namespace AMDiS
dune/amdis/gridfunctions/CoordsGridFunction.hpp
View file @
90c3d73b
...
...
@@ -16,6 +16,17 @@ namespace AMDiS
/// A functor that evaluates to the global coordinates
struct
CoordsFunction
{
template
<
class
T
,
int
N
>
Dune
::
FieldVector
<
T
,
N
>
const
&
operator
()(
Dune
::
FieldVector
<
T
,
N
>
const
&
x
)
const
{
return
x
;
}
friend
int
order
(
CoordsFunction
const
&
/*f*/
,
int
/*d*/
)
{
return
1
;
}
struct
Derivative
{
template
<
class
T
,
int
N
>
...
...
@@ -24,28 +35,32 @@ namespace AMDiS
return
Dune
::
DiagonalMatrix
<
T
,
N
>
{
T
(
1
)};
}
};
template
<
class
T
,
int
N
>
Dune
::
FieldVector
<
T
,
N
>
const
&
operator
()(
Dune
::
FieldVector
<
T
,
N
>
const
&
x
)
const
{
return
x
;
}
friend
Derivative
partial
(
CoordsFunction
const
&
/*f*/
,
index_t
<
0
>
)
{
return
Derivative
{};
}