Skip to content
GitLab
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
bf054388
Commit
bf054388
authored
Jan 20, 2018
by
Praetorius, Simon
Browse files
Some cleanup for intel compiler
parent
520d1838
Changes
5
Hide whitespace changes
Inline
Side-by-side
dune/amdis/ProblemStat.inc.hpp
View file @
bf054388
...
...
@@ -137,9 +137,9 @@ void ProblemStat<Traits>::addMatrixOperator(
RowTreePath
row
,
ColTreePath
col
,
double
*
factor
,
double
*
estFactor
)
{
static_assert
(
Concept
::
PreTreePath
<
RowTreePath
>
,
static_assert
(
Concept
s
::
PreTreePath
<
RowTreePath
>
,
"row must be a valid treepath, or an integer/index-constant"
);
static_assert
(
Concept
::
PreTreePath
<
ColTreePath
>
,
static_assert
(
Concept
s
::
PreTreePath
<
ColTreePath
>
,
"col must be a valid treepath, or an integer/index-constant"
);
auto
i
=
child
(
globalBasis
->
localView
().
tree
(),
makeTreePath
(
row
));
...
...
@@ -161,9 +161,9 @@ void ProblemStat<Traits>::addMatrixOperator(
RowTreePath
row
,
ColTreePath
col
,
double
*
factor
,
double
*
estFactor
)
{
static_assert
(
Concept
::
PreTreePath
<
RowTreePath
>
,
static_assert
(
Concept
s
::
PreTreePath
<
RowTreePath
>
,
"row must be a valid treepath, or an integer/index-constant"
);
static_assert
(
Concept
::
PreTreePath
<
ColTreePath
>
,
static_assert
(
Concept
s
::
PreTreePath
<
ColTreePath
>
,
"col must be a valid treepath, or an integer/index-constant"
);
auto
i
=
child
(
globalBasis
->
localView
().
tree
(),
makeTreePath
(
row
));
...
...
@@ -185,7 +185,7 @@ void ProblemStat<Traits>::addVectorOperator(
TreePath
path
,
double
*
factor
,
double
*
estFactor
)
{
static_assert
(
Concept
::
PreTreePath
<
TreePath
>
,
static_assert
(
Concept
s
::
PreTreePath
<
TreePath
>
,
"path must be a valid treepath, or an integer/index-constant"
);
auto
i
=
child
(
globalBasis
->
localView
().
tree
(),
makeTreePath
(
path
));
...
...
@@ -206,7 +206,7 @@ void ProblemStat<Traits>::addVectorOperator(
TreePath
path
,
double
*
factor
,
double
*
estFactor
)
{
static_assert
(
Concept
::
PreTreePath
<
TreePath
>
,
static_assert
(
Concept
s
::
PreTreePath
<
TreePath
>
,
"path must be a valid treepath, or an integer/index-constant"
);
auto
i
=
child
(
globalBasis
->
localView
().
tree
(),
makeTreePath
(
path
));
...
...
dune/amdis/common/FieldMatVec.hpp
View file @
bf054388
...
...
@@ -338,4 +338,15 @@ namespace AMDiS
return
C
;
}
template
<
class
T
,
int
M
,
int
N
>
Dune
::
FieldMatrix
<
T
,
M
,
N
>&
multiplies_ABt
(
Dune
::
FieldMatrix
<
T
,
M
,
N
>
const
&
A
,
Dune
::
DiagonalMatrix
<
T
,
N
>
const
&
B
,
Dune
::
FieldMatrix
<
T
,
M
,
N
>&
C
)
{
for
(
int
m
=
0
;
m
<
M
;
++
m
)
{
for
(
int
n
=
0
;
n
<
N
;
++
n
)
{
C
[
m
][
n
]
=
A
[
m
][
n
]
*
B
.
diagonal
(
n
);
}
}
return
C
;
}
}
// end namespace AMDiS
dune/amdis/common/Literals.hpp
View file @
bf054388
...
...
@@ -15,14 +15,16 @@ namespace AMDiS
return
unsigned
(
c
)
-
unsigned
(
'0'
);
}
template
<
std
::
size_t
N
>
constexpr
std
::
size_t
string2num
(
const
char
(
&
arr
)[
N
]
)
template
<
char
...
digits
>
constexpr
std
::
size_t
string2num
()
{
const
char
arr
[]
=
{
digits
...};
assert
(
arr
[
0
]
!=
'-'
&&
"Negative integral constant"
);
std
::
size_t
result
=
0
;
std
::
size_t
power
=
1
;
const
int
N
=
sizeof
...(
digits
);
for
(
std
::
size_t
i
=
0
;
i
<
N
;
++
i
)
{
char
c
=
arr
[
N
-
1
-
i
];
result
+=
char2digit
(
c
)
*
power
;
...
...
@@ -38,7 +40,7 @@ namespace AMDiS
template
<
char
...
digits
>
constexpr
auto
operator
""
_c
()
{
return
index_
<
Impl
::
string2num
<
sizeof
...(
digits
)
>
({
digits
...
}
)
>
;
return
index_
<
Impl
::
string2num
<
digits
...
>
(
)
>
;
}
}
// end namespace AMDiS
dune/amdis/gridfunctions/AnalyticGridFunction.hpp
View file @
bf054388
...
...
@@ -45,18 +45,6 @@ namespace AMDiS
return
fct_
(
geometry_
.
value
().
global
(
local
));
}
friend
auto
derivative
(
AnalyticLocalFunction
const
&
lf
)
{
static_assert
(
Concepts
::
HasPartial
<
Function
>
,
"No partial(_0,...) defined for Functor F of AnalyticLocalFunction."
);
auto
df
=
partial
(
lf
.
fct
(),
index_
<
0
>
);
using
RawSignature
=
typename
Dune
::
Functions
::
SignatureTraits
<
R
(
D
)
>::
RawSignature
;
using
DerivativeSignature
=
typename
Dune
::
Functions
::
DefaultDerivativeTraits
<
RawSignature
>::
Range
(
D
);
return
AnalyticLocalFunction
<
DerivativeSignature
,
LocalContext
,
decltype
(
df
)
>
{
df
};
}
Function
const
&
fct
()
const
{
return
fct_
;
...
...
@@ -77,6 +65,20 @@ namespace AMDiS
}
template
<
class
R
,
class
D
,
class
LocalContext
,
class
F
>
auto
derivative
(
AnalyticLocalFunction
<
R
(
D
),
LocalContext
,
F
>
const
&
lf
)
{
static_assert
(
Concepts
::
HasPartial
<
F
>
,
"No partial(_0,...) defined for Functor F of AnalyticLocalFunction."
);
auto
df
=
partial
(
lf
.
fct
(),
index_
<
0
>
);
using
RawSignature
=
typename
Dune
::
Functions
::
SignatureTraits
<
R
(
D
)
>::
RawSignature
;
using
DerivativeSignature
=
typename
Dune
::
Functions
::
DefaultDerivativeTraits
<
RawSignature
>::
Range
(
D
);
return
AnalyticLocalFunction
<
DerivativeSignature
,
LocalContext
,
decltype
(
df
)
>
{
df
};
}
/// \class AnalyticGridFunction
/// \brief A Gridfunction that evaluates a function with global coordinates.
/**
...
...
@@ -121,16 +123,6 @@ namespace AMDiS
return
LocalFunction
{
gf
.
fct_
};
}
/// \brief Return a GridFunction representing the derivative of a functor.
// [expects: Functor f has free function derivative(f)]
friend
auto
derivative
(
AnalyticGridFunction
const
&
gf
)
{
static_assert
(
Concepts
::
HasPartial
<
Function
>
,
"No partial(_0,...) defined for Functor of AnalyticLocalFunction."
);
auto
df
=
partial
(
gf
.
fct
(),
index_
<
0
>
);
return
AnalyticGridFunction
<
decltype
(
df
),
GridView
>
{
df
,
gf
.
entitySet
().
gridView
()};
}
EntitySet
const
&
entitySet
()
const
{
...
...
@@ -146,6 +138,19 @@ namespace AMDiS
};
/// \brief Return a GridFunction representing the derivative of a functor.
// [expects: Functor f has free function derivative(f)]
template
<
class
F
,
class
GV
>
auto
derivative
(
AnalyticGridFunction
<
F
,
GV
>
const
&
gf
)
{
static_assert
(
Concepts
::
HasPartial
<
F
>
,
"No partial(_0,...) defined for Functor of AnalyticLocalFunction."
);
auto
df
=
partial
(
gf
.
fct
(),
index_
<
0
>
);
return
AnalyticGridFunction
<
decltype
(
df
),
GV
>
{
df
,
gf
.
entitySet
().
gridView
()};
}
#ifndef DOXYGEN
// A pre-GridFunction that just stores the function
template
<
class
Function
>
...
...
dune/amdis/gridfunctions/FunctorGridFunction.hpp
View file @
bf054388
...
...
@@ -179,9 +179,10 @@ namespace AMDiS
using
RawRange
=
std
::
decay_t
<
Range
>
;
using
LocalDomain
=
typename
EntitySet
::
LocalCoordinate
;
using
LocalFunction
=
FunctorLocalFunction
<
RawRange
(
LocalDomain
),
Functor
,
LocalFct
<
GridFunctions
>
...
>
;
public:
using
LocalFunction
=
FunctorLocalFunction
<
RawRange
(
LocalDomain
),
Functor
,
LocalFct
<
GridFunctions
>
...
>
;
/// Constructor. Stores copies of the functor and gridfunctions.
template
<
class
...
GridFcts
>
explicit
FunctorGridFunction
(
Functor
const
&
fct
,
GridFcts
&&
...
gridFcts
)
...
...
@@ -196,22 +197,15 @@ namespace AMDiS
MakeSeq_t
<
sizeof
...(
GridFunctions
)
>
{});
}
/// \brief Creates a LocalFunction from the LocalFunctions of the GridFunctions. \relates FunctorLocalFunction
friend
LocalFunction
localFunction
(
FunctorGridFunction
const
&
gf
)
{
return
Dune
::
Std
::
apply
([
&
gf
](
auto
const
&
...
gridFcts
)
{
return
LocalFunction
{
gf
.
fct_
,
localFunction
(
gridFcts
)...};
},
gf
.
gridFcts_
);
}
/// Return the stored \ref EntitySet of the first GridFunction
EntitySet
const
&
entitySet
()
const
{
return
std
::
get
<
0
>
(
gridFcts_
).
entitySet
();
}
auto
const
&
fct
()
const
{
return
fct_
;
}
auto
const
&
gridFcts
()
const
{
return
gridFcts_
;
}
private:
template
<
class
Outer
,
class
Inner
,
std
::
size_t
...
I
>
auto
eval
(
Outer
outer
,
Inner
inner
,
Indices
<
I
...
>
)
const
...
...
@@ -225,6 +219,19 @@ namespace AMDiS
};
/// \brief Creates a LocalFunction from the LocalFunctions of the GridFunctions. \relates FunctorLocalFunction
template
<
class
F
,
class
...
GFs
>
auto
localFunction
(
FunctorGridFunction
<
F
,
GFs
...
>
const
&
gf
)
{
return
Dune
::
Std
::
apply
([
&
gf
](
auto
const
&
...
gridFcts
)
{
using
LocalFunction
=
typename
FunctorGridFunction
<
F
,
GFs
...
>::
LocalFunction
;
return
LocalFunction
{
gf
.
fct
(),
localFunction
(
gridFcts
)...};
},
gf
.
gridFcts
());
}
#ifndef DOXYGEN
// Generator function for FunctorGridFunction expressions
template
<
class
Functor
,
class
...
GridFcts
>
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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