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
15764e96
Commit
15764e96
authored
Jul 02, 2018
by
Praetorius, Simon
Browse files
Derivative Gridfunction corrected
parent
01aefb50
Changes
9
Hide whitespace changes
Inline
Side-by-side
src/amdis/Assembler.hpp
View file @
15764e96
...
...
@@ -8,7 +8,7 @@
#include <amdis/DirichletBC.hpp>
#include <amdis/LinearAlgebra.hpp>
#include <amdis/LocalAssembler
Base
.hpp>
#include <amdis/LocalAssembler
List
.hpp>
#include <amdis/common/Mpl.hpp>
#include <amdis/common/TypeDefs.hpp>
...
...
src/amdis/ProblemStat.hpp
View file @
15764e96
...
...
@@ -19,6 +19,7 @@
#include <amdis/Flag.hpp>
#include <amdis/Initfile.hpp>
#include <amdis/LinearAlgebra.hpp>
#include <amdis/LocalAssemblerList.hpp>
#include <amdis/Marker.hpp>
#include <amdis/Mesh.hpp>
#include <amdis/ProblemStatBase.hpp>
...
...
src/amdis/common/TupleUtility.hpp
View file @
15764e96
...
...
@@ -31,7 +31,7 @@ namespace AMDiS
{
static_assert
(
std
::
tuple_size
<
Tuple
>::
value
==
sizeof
...(
args
),
"Nr. of argument != tuple-size"
);
return
{
std
::
forward
<
Args
>
(
args
)...};
return
Tuple
{
std
::
forward
<
Args
>
(
args
)...};
}
};
...
...
@@ -43,7 +43,7 @@ namespace AMDiS
{
static_assert
(
std
::
tuple_size
<
Tuple
>::
value
==
0
,
"Construction of empty tuples with empty argument list only!"
);
return
{};
return
Tuple
{};
}
};
...
...
src/amdis/gridfunctions/AnalyticGridFunction.hpp
View file @
15764e96
...
...
@@ -25,6 +25,8 @@ namespace AMDiS
using
Geometry
=
typename
LocalContext
::
Geometry
;
enum
{
hasDerivative
=
true
};
public:
AnalyticLocalFunction
(
Function
const
&
fct
)
:
fct_
{
fct
}
...
...
@@ -100,6 +102,8 @@ namespace AMDiS
using
Domain
=
typename
EntitySet
::
GlobalCoordinate
;
using
Range
=
std
::
decay_t
<
std
::
result_of_t
<
Function
(
Domain
)
>>
;
enum
{
hasDerivative
=
true
};
private:
using
Element
=
typename
EntitySet
::
Element
;
using
LocalDomain
=
typename
EntitySet
::
LocalCoordinate
;
...
...
src/amdis/gridfunctions/ConstantGridFunction.hpp
View file @
15764e96
...
...
@@ -27,6 +27,8 @@ namespace AMDiS
using
Geometry
=
typename
LocalContext
::
Geometry
;
enum
{
hasDerivative
=
true
};
public:
ConstantLocalFunction
(
T
const
&
value
)
:
value_
(
value
)
...
...
@@ -97,6 +99,8 @@ namespace AMDiS
using
LocalDomain
=
typename
EntitySet
::
LocalCoordinate
;
using
Range
=
Underlying_t
<
T
>
;
enum
{
hasDerivative
=
false
};
public:
using
LocalFunction
=
ConstantLocalFunction
<
Range
(
LocalDomain
),
Element
,
T
>
;
...
...
src/amdis/gridfunctions/DOFVectorView.hpp
View file @
15764e96
...
...
@@ -49,6 +49,7 @@ namespace AMDiS
template
<
class
Block
>
using
Flat
=
Dune
::
Functions
::
FlatVectorBackend
<
Block
>
;
enum
{
hasDerivative
=
false
};
public:
// a local view on the gradients
...
...
@@ -59,6 +60,8 @@ namespace AMDiS
using
Domain
=
LocalDomain
;
using
Range
=
DerivativeRange
;
enum
{
hasDerivative
=
false
};
private:
using
LocalBasisView
=
typename
GlobalBasis
::
LocalView
;
using
LocalIndexSet
=
typename
GlobalBasis
::
LocalIndexSet
;
...
...
@@ -135,6 +138,8 @@ namespace AMDiS
using
Domain
=
typename
DOFVectorConstView
::
LocalDomain
;
using
Range
=
typename
DOFVectorConstView
::
Range
;
enum
{
hasDerivative
=
true
};
private:
using
LocalBasisView
=
typename
GlobalBasis
::
LocalView
;
using
LocalIndexSet
=
typename
GlobalBasis
::
LocalIndexSet
;
...
...
src/amdis/gridfunctions/DerivativeGridFunction.hpp
View file @
15764e96
...
...
@@ -32,6 +32,8 @@ namespace AMDiS
using
DerivativeTraits
=
Dune
::
Functions
::
DefaultDerivativeTraits
<
RawSignature
>
;
using
LocalFunction
=
std
::
decay_t
<
decltype
(
derivative
(
localFunction
(
std
::
declval
<
GridFunction
>
())))
>
;
enum
{
hasDerivative
=
false
};
public:
/// The Range of the derivative of the GridFunction
using
Range
=
typename
DerivativeTraits
::
Range
;
...
...
@@ -58,9 +60,9 @@ namespace AMDiS
}
/// Return the derivative-localFunction of the GridFunction.
LocalFunction
localFunction
(
)
const
friend
LocalFunction
localFunction
(
DerivativeGridFunction
const
&
gf
)
{
return
derivative
(
localFunction
(
gridFct_
));
return
derivative
(
localFunction
(
gf
.
gridFct_
));
}
/// Return the \ref EntitySet of the \ref GridFunction.
...
...
@@ -74,16 +76,10 @@ namespace AMDiS
};
template
<
class
GF
>
auto
localFunction
(
DerivativeGridFunction
<
GF
>
const
&
gf
)
{
return
gf
.
localFunction
();
}
#ifndef DOXYGEN
template
<
class
GridFct
,
class
LocalFct
=
decltype
(
localFunction
(
std
::
declval
<
GridFct
>())),
REQUIRES
(
not
Concepts
::
H
asDerivative
<
GridFct
>
)
>
REQUIRES
(
not
GridFct
::
h
asDerivative
)
>
auto
derivative
(
GridFct
const
&
gridFct
)
{
static_assert
(
Concepts
::
HasDerivative
<
LocalFct
>
,
"derivative(LocalFunction) not defined!"
);
...
...
@@ -91,7 +87,6 @@ namespace AMDiS
}
#ifndef DOXYGEN
template
<
class
Expr
>
struct
DerivativePreGridFunction
{
...
...
src/amdis/gridfunctions/FunctorGridFunction.hpp
View file @
15764e96
...
...
@@ -9,7 +9,6 @@
#include <amdis/common/IndexSeq.hpp>
#include <amdis/common/Loops.hpp>
#include <amdis/common/Mpl.hpp>
#include <amdis/utility/Tuple.hpp>
#include <amdis/gridfunctions/GridFunctionConcepts.hpp>
namespace
AMDiS
...
...
@@ -47,6 +46,8 @@ namespace AMDiS
using
Range
=
R
;
using
Domain
=
D
;
enum
{
hasDerivative
=
true
};
template
<
class
LocalFct
>
struct
LocalFunctionWrapper
{
...
...
@@ -90,7 +91,7 @@ namespace AMDiS
Range
operator
()(
Domain
const
&
x
)
const
{
using
Dune
::
Std
::
apply
;
return
apply
([
&
](
auto
&&
...
localFct
)
{
return
fct_
(
localFct
(
x
)...);
},
localFcts_
);
return
apply
([
&
](
auto
&&
...
localFct
)
{
return
fct_
(
(
*
localFct
)
(
x
)...);
},
localFcts_
);
}
public:
...
...
@@ -187,6 +188,8 @@ namespace AMDiS
/// The set of entities this grid-function binds to
using
EntitySet
=
typename
Impl
::
EntitySetType
<
GridFunctions
...
>::
type
;
enum
{
hasDerivative
=
false
};
private:
template
<
class
GridFct
>
using
LocalFct
=
std
::
decay_t
<
decltype
(
localFunction
(
std
::
declval
<
GridFct
>
()))
>
;
...
...
@@ -234,7 +237,7 @@ namespace AMDiS
template
<
class
F
,
class
...
GFs
>
auto
localFunction
(
FunctorGridFunction
<
F
,
GFs
...
>
const
&
gf
)
{
return
g
t
.
localFunction
();
return
g
f
.
localFunction
();
}
...
...
test/TupleUtilityTest.cpp
View file @
15764e96
...
...
@@ -14,13 +14,13 @@ int main()
using
TupleInt
=
std
::
tuple
<
int
,
int
>
;
using
Tuple2
=
std
::
tuple
<
TupleDouble
,
TupleInt
>
;
Tuple1
u
=
{
1.3
,
2
};
Tuple1
u
{
1.3
,
2
};
auto
v
=
constructTuple
<
Tuple1
>
(
1.5
);
auto
w
=
foldTuples
<
Tuple2
>
(
u
,
v
);
AMDIS_TEST
(
u
==
Tuple1
(
{
1.3
,
2
}));
AMDIS_TEST
(
v
==
Tuple1
(
{
1.5
,
1
}));
AMDIS_TEST
(
w
==
Tuple2
(
{
{
1.3
,
1.5
},
{
2
,
1
}}
));
AMDIS_TEST
(
(
u
==
Tuple1
{
1.3
,
2
}));
AMDIS_TEST
(
(
v
==
Tuple1
{
1.5
,
1
}));
AMDIS_TEST
(
(
w
==
Tuple2
{
TupleDouble
{
1.3
,
1.5
},
TupleDouble
{
2
,
1
}}
));
return
report_errors
();
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment