Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
amdis-core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
amdis
amdis-core
Commits
95ed026e
Commit
95ed026e
authored
5 years ago
by
Praetorius, Simon
Browse files
Options
Downloads
Patches
Plain Diff
Move transformTreePath helper function to HierarchicNodeToRangeMap
parent
7e46647e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!101
Move transformTreePath helper function to HierarchicNodeToRangeMap
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/amdis/functions/HierarchicNodeToRangeMap.hpp
+21
-2
21 additions, 2 deletions
src/amdis/functions/HierarchicNodeToRangeMap.hpp
src/amdis/functions/Interpolate.hpp
+1
-15
1 addition, 15 deletions
src/amdis/functions/Interpolate.hpp
with
22 additions
and
17 deletions
src/amdis/functions/HierarchicNodeToRangeMap.hpp
+
21
−
2
View file @
95ed026e
...
...
@@ -15,7 +15,7 @@ namespace AMDiS
/**
* \brief A simple node to range map using the nested tree indices
*
* This map directly us
s
es the tree path entries of the given
* This map directly uses the tree path entries of the given
* node to access the nested container.
*
* If the container does not provide any operator[] access,
...
...
@@ -23,19 +23,38 @@ namespace AMDiS
*/
struct
HierarchicNodeToRangeMap
{
// Specialization for ranges with operator[] access
template
<
class
Node
,
class
TreePath
,
class
Range
,
REQUIRES
(
Dune
::
models
<
Dune
::
Functions
::
Concept
::
HasIndexAccess
,
Range
,
Dune
::
index_constant
<
0
>
>
())
>
decltype
(
auto
)
operator
()(
const
Node
&
node
,
const
TreePath
&
treePath
,
Range
&&
y
)
const
{
return
Dune
::
Functions
::
resolveStaticMultiIndex
(
y
,
tr
eePath
);
return
Dune
::
Functions
::
resolveStaticMultiIndex
(
y
,
tr
ansformTreePath
(
treePath
)
);
}
// Specialization for non-container ranges
template
<
class
Node
,
class
TreePath
,
class
Range
,
REQUIRES
(
not
Dune
::
models
<
Dune
::
Functions
::
Concept
::
HasIndexAccess
,
Range
,
Dune
::
index_constant
<
0
>
>
())
>
decltype
(
auto
)
operator
()(
const
Node
&
node
,
const
TreePath
&
treePath
,
Range
&&
y
)
const
{
return
std
::
forward
<
Range
>
(
y
);
}
private
:
#if DUNE_VERSION_GT(DUNE_FUNCTIONS,2,6)
template
<
class
TreePath
>
static
TreePath
const
&
transformTreePath
(
TreePath
const
&
treePath
)
{
return
treePath
;
}
#else
// NOTE: due to a bug in dune-functions <= 2.6, a hybrid-treepath can not be passed to a HierarchicNodeToRangeMap,
// i.e. the HybridTreePath missed a size() function
template
<
class
TreePath
>
static
auto
transformTreePath
(
TreePath
const
&
treePath
)
{
return
Tools
::
apply
([](
auto
...
i
)
{
return
Dune
::
makeTupleVector
(
i
...);
},
treePath
.
_data
);
}
#endif
};
}
// end namespace AMDiS
This diff is collapsed.
Click to expand it.
src/amdis/functions/Interpolate.hpp
+
1
−
15
View file @
95ed026e
...
...
@@ -85,7 +85,7 @@ namespace Impl {
{
const
auto
&
tmp
=
localF_
(
x
);
const
auto
&
tmp_vec
=
Dune
::
MatVec
::
as_vector
(
tmp
);
y
=
Dune
::
Functions
::
flatVectorView
(
nodeToRangeEntry_
(
node_
,
transformTreePath
(
treePath_
)
,
tmp_vec
))[
comp_
];
y
=
Dune
::
Functions
::
flatVectorView
(
nodeToRangeEntry_
(
node_
,
treePath_
,
tmp_vec
))[
comp_
];
}
void
setComponent
(
std
::
size_t
comp
)
...
...
@@ -93,20 +93,6 @@ namespace Impl {
comp_
=
comp
;
}
#if DUNE_VERSION_GT(DUNE_FUNCTIONS,2,6)
static
TreePath
const
&
transformTreePath
(
TreePath
const
&
treePath
)
{
return
treePath
;
}
#else
// NOTE: due to a bug in dune-functions <= 2.6, a hybrid-treepath can not be passed to a HierarchicNodeToRangeMap,
// i.e. the HybridTreePath missed a size() function
static
auto
transformTreePath
(
TreePath
const
&
treePath
)
{
return
Tools
::
apply
([](
auto
...
i
)
{
return
Dune
::
makeTupleVector
(
i
...);
},
treePath
.
_data
);
}
#endif
private
:
Node
const
&
node_
;
TreePath
const
&
treePath_
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment