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
5a169a85
Commit
5a169a85
authored
Aug 22, 2019
by
Praetorius, Simon
Browse files
added helper utility to wrap Dune::FunctionFromCallable constructors
parent
fb5c14f2
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/amdis/DataTransfer.inc.hpp
View file @
5a169a85
...
...
@@ -17,10 +17,9 @@
#include <dune/grid/common/geometry.hh>
#include <dune/grid/common/rangegenerators.hh>
#include <dune/functions/common/functionfromcallable.hh>
#include <amdis/Output.hpp>
#include <amdis/common/ConcurrentCache.hpp>
#include <amdis/functions/FunctionFromCallable.hpp>
#include <amdis/typetree/Traversal.hpp>
namespace
AMDiS
{
...
...
@@ -373,9 +372,8 @@ bool NodeDataTransfer<N,C,B>::
return
fatherDOFsTemp_
[
currentDOF
++
];
};
using
FFC
=
Dune
::
Functions
::
FunctionFromCallable
<
LIRangeType
(
LIDomainType
),
decltype
(
evalLeaf
)
>
;
fatherFE
.
localInterpolation
().
interpolate
(
FFC
(
evalLeaf
),
fatherDOFs
);
auto
evalLeafFct
=
functionFromCallable
<
LIRangeType
(
LIDomainType
)
>
(
evalLeaf
);
fatherFE
.
localInterpolation
().
interpolate
(
evalLeafFct
,
fatherDOFs
);
// Return true if all father DOFs have been evaluated
return
std
::
accumulate
(
finishedDOFs_
.
begin
(),
finishedDOFs_
.
end
(),
true
,
...
...
@@ -413,9 +411,8 @@ void NodeDataTransfer<N,C,B>::
auto
const
&
childFE
=
childNode
.
finiteElement
();
thread_local
std
::
vector
<
T
>
childDOFs
;
using
FFC
=
Dune
::
Functions
::
FunctionFromCallable
<
LIRangeType
(
LIDomainType
),
decltype
(
evalFather
)
>
;
childFE
.
localInterpolation
().
interpolate
(
FFC
(
evalFather
),
childDOFs
);
auto
evalFatherFct
=
functionFromCallable
<
LIRangeType
(
LIDomainType
)
>
(
evalFather
);
childFE
.
localInterpolation
().
interpolate
(
evalFatherFct
,
childDOFs
);
for
(
std
::
size_t
i
=
0
;
i
<
childDOFs
.
size
();
++
i
)
(
*
coeff_
)[
lv_
->
index
(
childNode
.
localIndex
(
i
))]
=
childDOFs
[
i
];
...
...
src/amdis/PeriodicBC.inc.hpp
View file @
5a169a85
...
...
@@ -211,9 +211,8 @@ coords(Node const& tree, std::vector<std::size_t> const& localIndices) const
std
::
array
<
std
::
vector
<
typename
RangeType
::
field_type
>
,
D
::
dimension
>
coeffs
;
for
(
int
d
=
0
;
d
<
D
::
dimension
;
++
d
)
{
auto
evalCoord
=
[
&
](
DomainType
const
&
local
)
->
RangeType
{
return
geometry
.
global
(
local
)[
d
];
};
using
FFC
=
Dune
::
Functions
::
FunctionFromCallable
<
RangeType
(
DomainType
),
decltype
(
evalCoord
)
>
;
localInterpol
.
interpolate
(
FFC
(
evalCoord
),
coeffs
[
d
]);
auto
evalCoord
=
functionFromCallable
<
RangeType
(
DomainType
)
>
([
&
](
DomainType
const
&
local
)
->
RangeType
{
return
geometry
.
global
(
local
)[
d
];
});
localInterpol
.
interpolate
(
evalCoord
,
coeffs
[
d
]);
}
for
(
std
::
size_t
j
=
0
;
j
<
localIndices
.
size
();
++
j
)
{
...
...
src/amdis/functions/CMakeLists.txt
View file @
5a169a85
#install headers
install
(
FILES
FunctionFromCallable.hpp
GlobalIdSet.hpp
HierarchicNodeToRangeMap.hpp
Interpolate.hpp
...
...
src/amdis/functions/FunctionFromCallable.hpp
0 → 100644
View file @
5a169a85
#pragma once
#include <dune/common/typeutilities.hh>
#include <dune/functions/common/functionfromcallable.hh>
namespace
AMDiS
{
namespace
Impl
{
template
<
class
Traits
,
class
F
,
class
Range
=
typename
Traits
::
RangeType
,
class
Domain
=
typename
Traits
::
DomainType
>
auto
functionFromCallableImpl
(
F
const
&
f
,
Dune
::
PriorityTag
<
2
>
)
{
return
Dune
::
Functions
::
FunctionFromCallable
<
Range
(
Domain
),
F
>
(
f
);
}
template
<
class
Signature
,
class
F
>
auto
functionFromCallableImpl
(
F
const
&
f
,
Dune
::
PriorityTag
<
1
>
)
{
return
Dune
::
Functions
::
FunctionFromCallable
<
Signature
,
F
>
(
f
);
}
}
template
<
class
SigTraits
,
class
F
>
auto
functionFromCallable
(
F
const
&
f
)
{
return
Impl
::
functionFromCallableImpl
<
SigTraits
>
(
f
,
Dune
::
PriorityTag
<
10
>
{});
}
}
// end namespace AMDiS
Write
Preview
Supports
Markdown
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