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
51ab2756
Commit
51ab2756
authored
Nov 05, 2020
by
Praetorius, Simon
Browse files
Rename gradientAtQp into gradientOf and similarly other expressions
parent
200b1e32
Changes
22
Show whitespace changes
Inline
Side-by-side
amdis/DOFVector.hpp
View file @
51ab2756
...
@@ -14,7 +14,6 @@
...
@@ -14,7 +14,6 @@
#include <amdis/common/Concepts.hpp>
#include <amdis/common/Concepts.hpp>
#include <amdis/common/TypeTraits.hpp>
#include <amdis/common/TypeTraits.hpp>
#include <amdis/functions/ParallelGlobalBasis.hpp>
#include <amdis/functions/ParallelGlobalBasis.hpp>
#include <amdis/gridfunctions/DiscreteFunction.hpp>
#include <amdis/typetree/TreePath.hpp>
#include <amdis/typetree/TreePath.hpp>
namespace
AMDiS
namespace
AMDiS
...
@@ -86,50 +85,11 @@ namespace AMDiS
...
@@ -86,50 +85,11 @@ namespace AMDiS
{}
{}
/// Return the global basis
/// Return the global basis
std
::
shared_ptr
<
GlobalBasis
const
>
const
&
basis
()
const
{
return
basis_
;
}
std
::
shared_ptr
<
GlobalBasis
const
>
const
&
basis
()
const
/// Transform the DOFVector into a DiscreteFunction
template
<
class
...
Indices
>
auto
discreteFunction
(
Indices
...
ii
)
{
return
DiscreteFunction
{
coefficients
(),
*
basis_
,
makeTreePath
(
ii
...)};
}
/// Transform the DOFVector into a DiscreteFunction
template
<
class
...
Indices
>
auto
discreteFunction
(
Indices
...
ii
)
const
{
return
DiscreteFunction
{
coefficients
(),
*
basis_
,
makeTreePath
(
ii
...)};
}
/// Interpolation of GridFunction to DOFVector, assuming that there is no
/// reference to this DOFVector in the expression.
/// See \ref DiscreteFunction::interpolate_noalias
template
<
class
Expr
,
class
Tag
=
tag
::
average
>
void
interpolate_noalias
(
Expr
&&
expr
,
Tag
strategy
=
{})
{
discreteFunction
().
interpolate_noalias
(
FWD
(
expr
),
strategy
);
}
/// Interpolation of GridFunction to DOFVector.
/// See \ref DiscreteFunction::interpolate
template
<
class
Expr
,
class
Tag
=
tag
::
average
>
void
interpolate
(
Expr
&&
expr
,
Tag
strategy
=
{})
{
{
discreteFunction
().
interpolate
(
FWD
(
expr
),
strategy
)
;
return
basis_
;
}
}
/// Interpolation of GridFunction to DOFVector.
/// See \ref DiscreteFunction::interpolate
template
<
class
Expr
>
DOFVector
&
operator
<<
(
Expr
&&
expr
)
{
discreteFunction
().
interpolate
(
FWD
(
expr
));
return
*
this
;
}
Coefficients
const
&
coefficients
()
const
Coefficients
const
&
coefficients
()
const
{
{
return
static_cast
<
Coefficients
const
&>
(
*
this
);
return
static_cast
<
Coefficients
const
&>
(
*
this
);
...
@@ -250,20 +210,6 @@ namespace AMDiS
...
@@ -250,20 +210,6 @@ namespace AMDiS
return
{
FWD
(
basis
),
op
};
return
{
FWD
(
basis
),
op
};
}
}
/// A Generator for a mutable \ref DiscreteFunction
template
<
class
GB
,
class
T
,
class
...
Indices
>
auto
discreteFunction
(
DOFVector
<
GB
,
T
>&
dofVec
,
Indices
...
ii
)
{
return
dofVec
.
discreteFunction
(
ii
...);
}
/// A Generator for a mutable \ref DiscreteFunction
template
<
class
GB
,
class
T
,
class
...
Indices
>
auto
discreteFunction
(
DOFVector
<
GB
,
T
>
const
&
dofVec
,
Indices
...
ii
)
{
return
dofVec
.
discreteFunction
(
ii
...);
}
}
// end namespace AMDiS
}
// end namespace AMDiS
#include <amdis/DOFVector.inc.hpp>
#include <amdis/DOFVector.inc.hpp>
amdis/ProblemInstat.hpp
View file @
51ab2756
...
@@ -67,7 +67,7 @@ namespace AMDiS
...
@@ -67,7 +67,7 @@ namespace AMDiS
{
{
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_
->
discreteFunction
(
ii
...);
return
valueOf
(
*
oldSolution_
,
ii
...);
}
}
/// Implementation of \ref ProblemTimeInterface::transferInitialSolution().
/// Implementation of \ref ProblemTimeInterface::transferInitialSolution().
...
...
amdis/ProblemStat.hpp
View file @
51ab2756
...
@@ -372,7 +372,7 @@ namespace AMDiS
...
@@ -372,7 +372,7 @@ namespace AMDiS
auto
solution
(
Indices
...
ii
)
auto
solution
(
Indices
...
ii
)
{
{
assert
(
bool
(
solution_
)
&&
"You have to call initialize() before."
);
assert
(
bool
(
solution_
)
&&
"You have to call initialize() before."
);
return
solution_
->
discreteFunction
(
ii
...);
return
valueOf
(
*
solution_
,
ii
...);
}
}
/// Return a const view to a solution component
/// Return a const view to a solution component
...
@@ -380,7 +380,7 @@ namespace AMDiS
...
@@ -380,7 +380,7 @@ namespace AMDiS
auto
solution
(
Indices
...
ii
)
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_
->
discreteFunction
(
ii
...);
return
valueOf
(
*
solution_
,
ii
...);
}
}
...
...
amdis/common/DerivativeTraits.hpp
View file @
51ab2756
...
@@ -15,42 +15,54 @@ namespace AMDiS
...
@@ -15,42 +15,54 @@ namespace AMDiS
{
{
namespace
tag
namespace
tag
{
{
struct
jacobian
{};
struct
gradient
{};
struct
gradient
{};
struct
divergence
{};
struct
divergence
{};
struct
partial
{
std
::
size_t
comp
=
0
;
};
struct
partial
{
std
::
size_t
comp
=
0
;
};
// register possible types for derivative traits
// register possible types for derivative traits
struct
derivative_type
:
gradient
,
divergence
,
partial
{};
struct
derivative_type
:
jacobian
,
gradient
,
divergence
,
partial
{};
}
}
template
<
class
Sig
,
class
Type
>
template
<
class
Sig
,
class
Type
>
struct
DerivativeTraits
;
struct
DerivativeTraits
;
template
<
class
R
,
class
D
>
template
<
class
R
,
class
D
>
struct
DerivativeTraits
<
R
(
D
),
tag
::
gradient
>
struct
DerivativeTraits
<
R
(
D
),
tag
::
jacobian
>
:
public
Dune
::
Functions
::
DefaultDerivativeTraits
<
R
(
D
)
>
:
public
Dune
::
Functions
::
DefaultDerivativeTraits
<
R
(
D
)
>
{};
{};
template
<
class
R
,
class
D
>
template
<
class
R
,
class
D
>
struct
DerivativeTraits
<
R
(
D
),
tag
::
partial
>
struct
DerivativeTraits
<
R
(
D
),
tag
::
gradient
>
:
public
Dune
::
Functions
::
DefaultDerivativeTraits
<
R
(
D
)
>
{};
template
<
class
K
,
int
n
>
struct
DerivativeTraits
<
K
(
Dune
::
FieldVector
<
K
,
n
>
),
tag
::
gradient
>
{
{
using
Range
=
R
;
using
Range
=
Dune
::
FieldVector
<
K
,
n
>
;
};
};
template
<
class
K
,
class
D
>
template
<
class
K
,
int
n
>
struct
DerivativeTraits
<
K
(
D
),
tag
::
divergence
>
struct
DerivativeTraits
<
Dune
::
FieldVector
<
K
,
1
>
(
Dune
::
FieldVector
<
K
,
n
>
),
tag
::
gradient
>
{
{
// error
using
Range
=
Dune
::
FieldVector
<
K
,
n
>
;
};
};
template
<
class
K
,
int
n
,
class
D
>
template
<
class
R
,
class
K
,
int
n
>
struct
DerivativeTraits
<
Dune
::
FieldVector
<
K
,
n
>
(
D
),
tag
::
divergence
>
struct
DerivativeTraits
<
R
(
Dune
::
FieldVector
<
K
,
n
>
),
tag
::
partial
>
{
using
Range
=
R
;
};
template
<
class
K
,
int
n
>
struct
DerivativeTraits
<
Dune
::
FieldVector
<
K
,
n
>
(
Dune
::
FieldVector
<
K
,
n
>
),
tag
::
divergence
>
{
{
using
Range
=
K
;
using
Range
=
K
;
};
};
template
<
class
K
,
int
n
,
int
m
,
class
D
>
template
<
class
K
,
int
n
,
int
m
>
struct
DerivativeTraits
<
Dune
::
FieldMatrix
<
K
,
n
,
m
>
(
D
),
tag
::
divergence
>
struct
DerivativeTraits
<
Dune
::
FieldMatrix
<
K
,
n
,
m
>
(
FieldVector
<
K
,
n
>
),
tag
::
divergence
>
{
{
using
Range
=
Dune
::
FieldVector
<
K
,
m
>
;
using
Range
=
Dune
::
FieldVector
<
K
,
m
>
;
};
};
...
...
amdis/gridfunctions/AnalyticGridFunction.hpp
View file @
51ab2756
...
@@ -28,7 +28,7 @@ namespace AMDiS
...
@@ -28,7 +28,7 @@ namespace AMDiS
/// The range type of the LocalFunction
/// The range type of the LocalFunction
using
Range
=
R
;
using
Range
=
R
;
/// This LocalFunction has its own \ref derivative() function
/// This LocalFunction has its own \ref derivative
Of
() function
enum
{
hasDerivative
=
true
};
enum
{
hasDerivative
=
true
};
private:
private:
...
@@ -100,12 +100,12 @@ namespace AMDiS
...
@@ -100,12 +100,12 @@ namespace AMDiS
* - The functor `F` must fulfill the concept \ref Concepts::HasDerivative
* - The functor `F` must fulfill the concept \ref Concepts::HasDerivative
**/
**/
template
<
class
R
,
class
D
,
class
LC
,
class
F
,
class
Type
>
template
<
class
R
,
class
D
,
class
LC
,
class
F
,
class
Type
>
auto
derivative
(
AnalyticLocalFunction
<
R
(
D
),
LC
,
F
>
const
&
lf
,
Type
const
&
type
)
auto
derivative
Of
(
AnalyticLocalFunction
<
R
(
D
),
LC
,
F
>
const
&
lf
,
Type
const
&
type
)
{
{
static_assert
(
Concepts
::
HasDerivative
<
F
,
Type
>
,
static_assert
(
Concepts
::
HasDerivative
<
F
,
Type
>
,
"No derivative(F,DerivativeType) defined for Functor F of AnalyticLocalFunction."
);
"No derivative(F,DerivativeType) defined for Functor F of AnalyticLocalFunction."
);
auto
df
=
derivative
(
lf
.
fct
(),
type
);
auto
df
=
derivative
Of
(
lf
.
fct
(),
type
);
using
RawSignature
=
typename
Dune
::
Functions
::
SignatureTraits
<
R
(
D
)
>::
RawSignature
;
using
RawSignature
=
typename
Dune
::
Functions
::
SignatureTraits
<
R
(
D
)
>::
RawSignature
;
using
DerivativeSignature
=
typename
DerivativeTraits
<
RawSignature
,
Type
>::
Range
(
D
);
using
DerivativeSignature
=
typename
DerivativeTraits
<
RawSignature
,
Type
>::
Range
(
D
);
...
@@ -220,12 +220,12 @@ namespace AMDiS
...
@@ -220,12 +220,12 @@ namespace AMDiS
* - Functor `F` must fulfill the concept \ref Concepts::HasDerivative<Type>
* - Functor `F` must fulfill the concept \ref Concepts::HasDerivative<Type>
**/
**/
template
<
class
F
,
class
GV
,
class
Type
>
template
<
class
F
,
class
GV
,
class
Type
>
auto
derivative
(
AnalyticGridFunction
<
F
,
GV
>
const
&
gf
,
Type
const
&
type
)
auto
derivative
Of
(
AnalyticGridFunction
<
F
,
GV
>
const
&
gf
,
Type
const
&
type
)
{
{
static_assert
(
Concepts
::
HasDerivative
<
F
,
Type
>
,
static_assert
(
Concepts
::
HasDerivative
<
F
,
Type
>
,
"No derivative(F,DerivativeType) defined for Functor of AnalyticLocalFunction."
);
"No derivative(F,DerivativeType) defined for Functor of AnalyticLocalFunction."
);
auto
df
=
derivative
(
gf
.
fct
(),
type
);
auto
df
=
derivative
Of
(
gf
.
fct
(),
type
);
return
AnalyticGridFunction
<
decltype
(
df
),
GV
>
{
df
,
gf
.
entitySet
().
gridView
()};
return
AnalyticGridFunction
<
decltype
(
df
),
GV
>
{
df
,
gf
.
entitySet
().
gridView
()};
}
}
...
...
amdis/gridfunctions/ConstantGridFunction.hpp
View file @
51ab2756
...
@@ -30,7 +30,7 @@ namespace AMDiS
...
@@ -30,7 +30,7 @@ namespace AMDiS
/// The range type of the LocalFunction
/// The range type of the LocalFunction
using
Range
=
R
;
using
Range
=
R
;
/// This LocalFunction has its own \ref derivative() function
/// This LocalFunction has its own \ref derivative
Of
() function
enum
{
hasDerivative
=
true
};
enum
{
hasDerivative
=
true
};
private:
private:
...
...
amdis/gridfunctions/CoordsGridFunction.hpp
View file @
51ab2756
...
@@ -49,7 +49,7 @@ namespace AMDiS
...
@@ -49,7 +49,7 @@ namespace AMDiS
return
Dune
::
DiagonalMatrix
<
T
,
N
>
{
T
(
1
)};
return
Dune
::
DiagonalMatrix
<
T
,
N
>
{
T
(
1
)};
}
}
};
};
friend
Derivative
derivative
(
CoordsFunction
const
&
/*f*/
,
tag
::
gradient
)
friend
Derivative
derivative
Of
(
CoordsFunction
const
&
/*f*/
,
tag
::
gradient
)
{
{
return
Derivative
{};
return
Derivative
{};
}
}
...
@@ -106,7 +106,7 @@ namespace AMDiS
...
@@ -106,7 +106,7 @@ namespace AMDiS
int
comp_
;
int
comp_
;
};
};
friend
Derivative
derivative
(
Self
const
&
f
,
tag
::
gradient
)
friend
Derivative
derivative
Of
(
Self
const
&
f
,
tag
::
gradient
)
{
{
return
Derivative
{
f
.
comp_
};
return
Derivative
{
f
.
comp_
};
}
}
...
...
amdis/gridfunctions/Derivative.hpp
View file @
51ab2756
...
@@ -11,7 +11,7 @@ namespace AMDiS
...
@@ -11,7 +11,7 @@ namespace AMDiS
/// The derivative of a localfunction as localfunction itself
/// The derivative of a localfunction as localfunction itself
template
<
class
LocalFunction
,
class
Type
,
template
<
class
LocalFunction
,
class
Type
,
REQUIRES
(
std
::
is_convertible_v
<
tag
::
derivative_type
,
Type
>)
>
REQUIRES
(
std
::
is_convertible_v
<
tag
::
derivative_type
,
Type
>)
>
auto
derivative
(
LocalFunction
const
&
lf
,
Type
const
&
type
)
auto
derivative
Of
(
LocalFunction
const
&
lf
,
Type
const
&
type
)
->
decltype
(
lf
.
makeDerivative
(
type
))
->
decltype
(
lf
.
makeDerivative
(
type
))
{
{
return
lf
.
makeDerivative
(
type
);
return
lf
.
makeDerivative
(
type
);
...
@@ -28,13 +28,13 @@ namespace AMDiS
...
@@ -28,13 +28,13 @@ namespace AMDiS
struct
HasDerivative
struct
HasDerivative
{
{
template
<
class
F
,
class
T
>
template
<
class
F
,
class
T
>
auto
require
(
F
&&
f
,
T
&&
t
)
->
decltype
(
derivative
(
f
,
t
)
);
auto
require
(
F
&&
f
,
T
&&
t
)
->
decltype
(
derivative
Of
(
f
,
t
)
);
};
};
struct
HasLocalFunctionDerivative
struct
HasLocalFunctionDerivative
{
{
template
<
class
F
,
class
T
>
template
<
class
F
,
class
T
>
auto
require
(
F
&&
f
,
T
&&
t
)
->
decltype
(
derivative
(
localFunction
(
f
),
t
)
);
auto
require
(
F
&&
f
,
T
&&
t
)
->
decltype
(
derivative
Of
(
localFunction
(
f
),
t
)
);
};
};
struct
HasPartial
struct
HasPartial
...
@@ -46,7 +46,7 @@ namespace AMDiS
...
@@ -46,7 +46,7 @@ namespace AMDiS
}
// end namespace Definition
}
// end namespace Definition
/// \brief GridFunction GF has free function `derivative
(F
)`
/// \brief GridFunction GF has free function `derivative
Of(F,type
)`
template
<
class
GF
,
class
Type
>
template
<
class
GF
,
class
Type
>
constexpr
bool
HasDerivative
=
models
<
Definition
::
HasDerivative
(
GF
,
Type
)
>
;
constexpr
bool
HasDerivative
=
models
<
Definition
::
HasDerivative
(
GF
,
Type
)
>
;
...
@@ -54,7 +54,7 @@ namespace AMDiS
...
@@ -54,7 +54,7 @@ namespace AMDiS
using
HasDerivative_t
=
models_t
<
Definition
::
HasDerivative
(
GF
,
Type
)
>
;
using
HasDerivative_t
=
models_t
<
Definition
::
HasDerivative
(
GF
,
Type
)
>
;
/// \brief GridFunction GF has free function `derivative(localFunction(F))`
/// \brief GridFunction GF has free function `derivative
Of
(localFunction(F))`
template
<
class
GF
,
class
Type
>
template
<
class
GF
,
class
Type
>
constexpr
bool
HasLocalFunctionDerivative
=
models
<
Definition
::
HasLocalFunctionDerivative
(
GF
,
Type
)
>
;
constexpr
bool
HasLocalFunctionDerivative
=
models
<
Definition
::
HasLocalFunctionDerivative
(
GF
,
Type
)
>
;
...
...
amdis/gridfunctions/DerivativeGridFunction.hpp
View file @
51ab2756
...
@@ -48,7 +48,7 @@ namespace AMDiS
...
@@ -48,7 +48,7 @@ namespace AMDiS
using
RawSignature
=
typename
Dune
::
Functions
::
SignatureTraits
<
GridFctRange
(
GridFctDomain
)
>::
RawSignature
;
using
RawSignature
=
typename
Dune
::
Functions
::
SignatureTraits
<
GridFctRange
(
GridFctDomain
)
>::
RawSignature
;
using
Traits
=
DerivativeTraits
<
RawSignature
,
Type
>
;
using
Traits
=
DerivativeTraits
<
RawSignature
,
Type
>
;
using
LocalFunction
=
TYPEOF
(
derivative
(
localFunction
(
std
::
declval
<
GridFunction
>
()),
std
::
declval
<
Type
>
())
)
;
using
LocalFunction
=
TYPEOF
(
derivative
Of
(
localFunction
(
std
::
declval
<
GridFunction
>
()),
std
::
declval
<
Type
>
())
)
;
using
LocalFctRange
=
typename
Traits
::
Range
;
using
LocalFctRange
=
typename
Traits
::
Range
;
using
LocalFctDomain
=
typename
GridFunction
::
EntitySet
::
LocalCoordinate
;
using
LocalFctDomain
=
typename
GridFunction
::
EntitySet
::
LocalCoordinate
;
...
@@ -96,7 +96,7 @@ namespace AMDiS
...
@@ -96,7 +96,7 @@ namespace AMDiS
/// Return the derivative-localFunction of the GridFunction.
/// Return the derivative-localFunction of the GridFunction.
LocalFunction
makeLocalFunction
()
const
LocalFunction
makeLocalFunction
()
const
{
{
return
derivative
(
localFunction
(
gridFct_
),
type_
);
return
derivative
Of
(
localFunction
(
gridFct_
),
type_
);
}
}
/// Return the \ref EntitySet of the \ref GridFunction.
/// Return the \ref EntitySet of the \ref GridFunction.
...
@@ -111,26 +111,26 @@ namespace AMDiS
...
@@ -111,26 +111,26 @@ namespace AMDiS
};
};
/// \fn derivative
/// \fn derivative
Of
/// \brief Create a GridFunction representing the derivative of the given
/// \brief Create a GridFunction representing the derivative of the given
/// Gridfunction.
/// Gridfunction.
/**
/**
* A GridFunction can be differentiated if the corresponding LocalFunction
* A GridFunction can be differentiated if the corresponding LocalFunction
* provides a free function `derivative()`
* provides a free function `derivative
Of
()`
*
*
* **Requirements:**
* **Requirements:**
* - The type `GridFct` models the concept of a GridFunction
* - The type `GridFct` models the concept of a GridFunction
* - The `GridFct` has no own `derivative()` function, i.e. it holds
* - The `GridFct` has no own `derivative
Of
()` function, i.e. it holds
* `GridFct::hasDerivative == false`.
* `GridFct::hasDerivative == false`.
* - The localFunction of the `GridFct` models `Concepts::HasDerivative`.
* - The localFunction of the `GridFct` models `Concepts::HasDerivative`.
**/
**/
template
<
class
GridFct
,
class
Type
,
template
<
class
GridFct
,
class
Type
,
class
LocalFct
=
decltype
(
localFunction
(
std
::
declval
<
GridFct
>())
),
class
LocalFct
=
decltype
(
localFunction
(
std
::
declval
<
GridFct
>())
),
REQUIRES
(
not
GridFct
::
hasDerivative
)
>
REQUIRES
(
not
GridFct
::
hasDerivative
)
>
auto
derivative
(
GridFct
const
&
gridFct
,
Type
const
&
type
)
auto
derivative
Of
(
GridFct
const
&
gridFct
,
Type
const
&
type
)
{
{
static_assert
(
Concepts
::
HasDerivative
<
LocalFct
,
Type
>
,
static_assert
(
Concepts
::
HasDerivative
<
LocalFct
,
Type
>
,
"derivative(LocalFunction,type) not defined!"
);
"derivative
Of
(LocalFunction,type) not defined!"
);
return
DerivativeGridFunction
<
GridFct
,
Type
>
{
gridFct
,
type
};
return
DerivativeGridFunction
<
GridFct
,
Type
>
{
gridFct
,
type
};
}
}
...
@@ -146,7 +146,7 @@ namespace AMDiS
...
@@ -146,7 +146,7 @@ namespace AMDiS
template
<
class
GridView
>
template
<
class
GridView
>
static
auto
create
(
Self
const
&
self
,
GridView
const
&
gridView
)
static
auto
create
(
Self
const
&
self
,
GridView
const
&
gridView
)
{
{
return
derivative
(
makeGridFunction
(
self
.
expr_
,
gridView
),
self
.
type_
);
return
derivative
Of
(
makeGridFunction
(
self
.
expr_
,
gridView
),
self
.
type_
);
}
}
};
};
...
@@ -163,7 +163,7 @@ namespace AMDiS
...
@@ -163,7 +163,7 @@ namespace AMDiS
#endif
#endif
/// \fn gradient
AtQP
/// \fn gradient
Of
/// \brief Generator function for DerivativeGridFunction expressions.
/// \brief Generator function for DerivativeGridFunction expressions.
/// \relates DerivativeGridFunction
/// \relates DerivativeGridFunction
/**
/**
...
@@ -172,25 +172,25 @@ namespace AMDiS
...
@@ -172,25 +172,25 @@ namespace AMDiS
* See \ref DerivativeGridFunction.
* See \ref DerivativeGridFunction.
*
*
* **Examples:**
* **Examples:**
* - `gradient
AtQP
(prob.solution(_0))`
* - `gradient
Of
(prob.solution(_0))`
* - `gradient
AtQP
(X(0) + X(1) + prob.solution(_0))`
* - `gradient
Of
(X(0) + X(1) + prob.solution(_0))`
**/
**/
template
<
class
Expr
>
template
<
class
Expr
>
auto
gradient
AtQP
(
Expr
const
&
expr
)
auto
gradient
Of
(
Expr
const
&
expr
)
{
{
return
DerivativePreGridFunction
<
Expr
,
tag
::
gradient
>
{
expr
};
return
DerivativePreGridFunction
<
Expr
,
tag
::
gradient
>
{
expr
};
}
}
/// Generates a Gridfunction representing the divergence of a vector-valued GridFunction.
/// Generates a Gridfunction representing the divergence of a vector-valued GridFunction.
template
<
class
Expr
>
template
<
class
Expr
>
auto
divergence
AtQP
(
Expr
const
&
expr
)
auto
divergence
Of
(
Expr
const
&
expr
)
{
{
return
DerivativePreGridFunction
<
Expr
,
tag
::
divergence
>
{
expr
};
return
DerivativePreGridFunction
<
Expr
,
tag
::
divergence
>
{
expr
};
}
}
/// Generates a Gridfunction representing the partial derivative of a GridFunction.
/// Generates a Gridfunction representing the partial derivative of a GridFunction.
template
<
class
Expr
>
template
<
class
Expr
>
auto
partial
AtQP
(
Expr
const
&
expr
,
std
::
size_t
i
)
auto
partial
DerivativeOf
(
Expr
const
&
expr
,
std
::
size_t
i
)
{
{
return
DerivativePreGridFunction
<
Expr
,
tag
::
partial
>
{
expr
,
tag
::
partial
{
i
}};
return
DerivativePreGridFunction
<
Expr
,
tag
::
partial
>
{
expr
,
tag
::
partial
{
i
}};
}
}
...
...
amdis/gridfunctions/DiscreteFunction.hpp
View file @
51ab2756
...
@@ -32,12 +32,6 @@ namespace AMDiS
...
@@ -32,12 +32,6 @@ namespace AMDiS
class
DiscreteFunction
;
class
DiscreteFunction
;
// deduction guide
template
<
class
Coeff
,
class
GB
,
class
Path
>
DiscreteFunction
(
Coeff
&
,
GB
const
&
,
Path
const
&
path
)
->
DiscreteFunction
<
Coeff
,
GB
,
TYPEOF
(
makeTreePath
(
path
))
>
;
/// A mutable view on the subspace of a DOFVector, \relates DiscreteFunction
/// A mutable view on the subspace of a DOFVector, \relates DiscreteFunction
template
<
class
Coeff
,
class
GB
,
class
TreePath
>
template
<
class
Coeff
,
class
GB
,
class
TreePath
>
class
DiscreteFunction
class
DiscreteFunction
...
@@ -72,7 +66,7 @@ namespace AMDiS
...
@@ -72,7 +66,7 @@ namespace AMDiS
/**
/**
* **Example:**
* **Example:**
* ```
* ```
* auto v =
discreteFunction
(prob.solutionVector(),0);
* auto v =
valueOf
(prob.solutionVector(),0);
* v.interpolate_noalias([](auto const& x) { return x[0]; });
* v.interpolate_noalias([](auto const& x) { return x[0]; });
* ```
* ```
**/
**/
...
@@ -83,11 +77,11 @@ namespace AMDiS
...
@@ -83,11 +77,11 @@ namespace AMDiS
/**
/**
* **Example:**
* **Example:**
* ```
* ```
* auto v =
discreteFunction
(prob.solutionVector(),0);
* auto v =
valueOf
(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
* \ref DiscreteFunction or \ref gradient
AtQP
() of a DiscreteFunction.
* \ref DiscreteFunction or \ref gradient
Of
() of a DiscreteFunction.
**/
**/
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
=
{});
...
@@ -261,6 +255,33 @@ namespace AMDiS
...
@@ -261,6 +255,33 @@ namespace AMDiS
DiscreteFunction
(
DV
&
,
Path
...)
DiscreteFunction
(
DV
&
,
Path
...)
->
DiscreteFunction
<
std
::
remove_reference_t
<
Coeff
>
,
std
::
decay_t
<
GB
>
,
TP
>
;
->
DiscreteFunction
<
std
::
remove_reference_t
<
Coeff
>
,
std
::
decay_t
<
GB
>
,
TP
>
;
// grid functions representing the DOFVector