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
c1f0b965
Commit
c1f0b965
authored
Nov 28, 2020
by
Praetorius, Simon
Browse files
Put TreeContainer in a separate namespace TypeTree and rename makeTreeContainer into treeContainer
parent
29c3c685
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
amdis/DataTransfer.hpp
View file @
c1f0b965
...
@@ -94,7 +94,7 @@ namespace AMDiS
...
@@ -94,7 +94,7 @@ namespace AMDiS
template
<
class
Node
>
template
<
class
Node
>
using
NodeElementData
=
typename
NodeDataTransfer
<
Node
,
Container
,
Basis
>::
NodeElementData
;
using
NodeElementData
=
typename
NodeDataTransfer
<
Node
,
Container
,
Basis
>::
NodeElementData
;
using
ElementData
=
TreeContainer
<
NodeElementData
,
Tree
,
true
>
;
using
ElementData
=
TypeTree
::
TreeContainer
<
NodeElementData
,
Tree
,
true
>
;
using
Interface
=
DataTransferInterface
<
Container
>
;
using
Interface
=
DataTransferInterface
<
Container
>
;
...
@@ -138,7 +138,7 @@ namespace AMDiS
...
@@ -138,7 +138,7 @@ namespace AMDiS
/// Data transfer on a single basis node
/// Data transfer on a single basis node
template
<
class
Node
>
template
<
class
Node
>
using
NDT
=
NodeDataTransfer
<
Node
,
Container
,
Basis
>
;
using
NDT
=
NodeDataTransfer
<
Node
,
Container
,
Basis
>
;
using
NodeDataTransferContainer
=
TreeContainer
<
NDT
,
Tree
,
true
>
;
using
NodeDataTransferContainer
=
TypeTree
::
TreeContainer
<
NDT
,
Tree
,
true
>
;
NodeDataTransferContainer
nodeDataTransfer_
;
NodeDataTransferContainer
nodeDataTransfer_
;
};
};
...
...
amdis/DataTransfer.inc.hpp
View file @
c1f0b965
...
@@ -66,7 +66,7 @@ preAdapt(C const& coeff, bool mightCoarsen)
...
@@ -66,7 +66,7 @@ preAdapt(C const& coeff, bool mightCoarsen)
persistentContainer_
.
clear
();
// Redundant if postAdapt was correctly called last cycle
persistentContainer_
.
clear
();
// Redundant if postAdapt was correctly called last cycle
for
(
const
auto
&
e
:
elements
(
gv
))
for
(
const
auto
&
e
:
elements
(
gv
))
{
{
auto
it
=
persistentContainer_
.
emplace
(
idSet
.
id
(
e
),
makeT
reeContainer
<
NodeElementData
,
true
>
(
lv
.
tree
()));
auto
it
=
persistentContainer_
.
emplace
(
idSet
.
id
(
e
),
TypeTree
::
t
reeContainer
<
NodeElementData
,
true
>
(
lv
.
tree
()));
lv
.
bind
(
e
);
lv
.
bind
(
e
);
auto
&
treeContainer
=
it
.
first
->
second
;
auto
&
treeContainer
=
it
.
first
->
second
;
...
@@ -88,7 +88,7 @@ preAdapt(C const& coeff, bool mightCoarsen)
...
@@ -88,7 +88,7 @@ preAdapt(C const& coeff, bool mightCoarsen)
while
(
father
.
mightVanish
()
&&
father
.
hasFather
())
while
(
father
.
mightVanish
()
&&
father
.
hasFather
())
{
{
father
=
father
.
father
();
father
=
father
.
father
();
auto
it
=
persistentContainer_
.
emplace
(
idSet
.
id
(
father
),
makeT
reeContainer
<
NodeElementData
,
true
>
(
lv
.
tree
()));
auto
it
=
persistentContainer_
.
emplace
(
idSet
.
id
(
father
),
TypeTree
::
t
reeContainer
<
NodeElementData
,
true
>
(
lv
.
tree
()));
if
(
!
it
.
second
)
if
(
!
it
.
second
)
continue
;
continue
;
...
...
amdis/OperatorList.hpp
View file @
c1f0b965
...
@@ -141,14 +141,14 @@ namespace AMDiS
...
@@ -141,14 +141,14 @@ namespace AMDiS
template
<
class
RowBasis
,
class
ColBasis
,
class
ElementMatrix
>
template
<
class
RowBasis
,
class
ColBasis
,
class
ElementMatrix
>
using
MatrixOperators
using
MatrixOperators
=
TreeMatrix
<
=
TypeTree
::
TreeMatrix
<
OperatorLists
<
typename
RowBasis
::
GridView
,
ElementMatrix
>::
template
MatData
,
OperatorLists
<
typename
RowBasis
::
GridView
,
ElementMatrix
>::
template
MatData
,
typename
RowBasis
::
LocalView
::
TreeCache
,
typename
RowBasis
::
LocalView
::
TreeCache
,
typename
ColBasis
::
LocalView
::
TreeCache
>;
typename
ColBasis
::
LocalView
::
TreeCache
>;
template
<
class
Basis
,
class
ElementVector
>
template
<
class
Basis
,
class
ElementVector
>
using
VectorOperators
using
VectorOperators
=
TreeContainer
<
=
TypeTree
::
TreeContainer
<
OperatorLists
<
typename
Basis
::
GridView
,
ElementVector
>::
template
VecData
,
OperatorLists
<
typename
Basis
::
GridView
,
ElementVector
>::
template
VecData
,
typename
Basis
::
LocalView
::
TreeCache
>;
typename
Basis
::
LocalView
::
TreeCache
>;
...
...
amdis/typetree/CMakeLists.txt
View file @
c1f0b965
...
@@ -6,6 +6,6 @@ install(FILES
...
@@ -6,6 +6,6 @@ install(FILES
Traits.hpp
Traits.hpp
Traversal.hpp
Traversal.hpp
TreeContainer.hpp
TreeContainer.hpp
TreeContainerTra
nsformation
.hpp
TreeContainerTra
fo
.hpp
TreePath.hpp
TreePath.hpp
DESTINATION
${
CMAKE_INSTALL_INCLUDEDIR
}
/amdis/typetree
)
DESTINATION
${
CMAKE_INSTALL_INCLUDEDIR
}
/amdis/typetree
)
amdis/typetree/TreeContainer.hpp
View file @
c1f0b965
This diff is collapsed.
Click to expand it.
amdis/typetree/TreeContainerTrafo.hpp
0 → 100644
View file @
c1f0b965
#pragma once
#include <amdis/common/RecursiveForEach.hpp>
#include <amdis/common/RecursiveMap.hpp>
#include <amdis/typetree/TreeContainer.hpp>
namespace
AMDiS
{
namespace
Recursive
{
// specializations of recursive utilities for TreeContainer entries
template
<
class
Value
>
struct
Apply
<
TypeTree
::
LeafNodeStorage
<
Value
>>
{
template
<
class
F
,
class
VC
>
static
auto
impl
(
F
&&
f
,
VC
const
&
vc
)
{
return
TypeTree
::
LeafNodeStorage
{
Recursive
::
apply
(
f
,
vc
.
value
())};
}
};
template
<
class
Value
,
class
Container
>
struct
Apply
<
TypeTree
::
InnerNodeStorage
<
Value
,
Container
>>
{
template
<
class
F
,
class
VC
>
static
auto
impl
(
F
&&
f
,
VC
const
&
vc
)
{
return
TypeTree
::
InnerNodeStorage
{
Recursive
::
apply
(
f
,
vc
.
value
()),
Recursive
::
apply
(
f
,
vc
.
container
())};
}
};
template
<
class
Container
>
struct
Apply
<
TypeTree
::
TreeContainerStorage
<
Container
>>
{
template
<
class
F
,
class
TC
>
static
auto
impl
(
F
&&
f
,
TC
const
&
c
)
{
return
TypeTree
::
TreeContainerStorage
{
Recursive
::
apply
(
f
,
c
.
data
())};
}
};
// -------------------------------------------------------------------------
template
<
class
Value
>
struct
ForEach
<
TypeTree
::
LeafNodeStorage
<
Value
>>
{
template
<
class
VC
,
class
F
>
static
void
impl
(
VC
&&
vc
,
F
&&
f
)
{
Recursive
::
forEach
(
vc
.
value
(),
f
);
}
};
template
<
class
Value
,
class
Container
>
struct
ForEach
<
TypeTree
::
InnerNodeStorage
<
Value
,
Container
>>
{
template
<
class
VC
,
class
F
>
static
void
impl
(
VC
&&
vc
,
F
&&
f
)
{
Recursive
::
forEach
(
vc
.
value
(),
f
);
Recursive
::
forEach
(
vc
.
container
(),
f
);
}
};
template
<
class
Container
>
struct
ForEach
<
TypeTree
::
TreeContainerStorage
<
Container
>>
{
template
<
class
F
,
class
TC
>
static
void
impl
(
TC
&&
c
,
F
&&
f
)
{
Recursive
::
forEach
(
c
.
data
(),
f
);
}
};
}}
// end namespace AMDiS::Recursive
amdis/typetree/TreeContainerTransformation.hpp
deleted
100644 → 0
View file @
29c3c685
#pragma once
#include <amdis/common/RecursiveForEach.hpp>
#include <amdis/common/RecursiveMap.hpp>
#include <amdis/typetree/TreeContainer.hpp>
namespace
AMDiS
{
namespace
Recursive
{
// specializations of recursive utilities for TreeContainer entries
template
<
>
struct
Apply
<
Impl
::
Ignore
>
{
template
<
class
F
>
static
auto
impl
(
F
&&
/*f*/
,
Impl
::
Ignore
)
{
return
Impl
::
Ignore
{};
}
};
template
<
class
Value
,
class
Container
>
struct
Apply
<
Impl
::
ValueAndContainer
<
Value
,
Container
>>
{
template
<
class
F
,
class
VC
>
static
auto
impl
(
F
&&
f
,
VC
const
&
vc
)
{
return
Impl
::
ValueAndContainer
{
Recursive
::
apply
(
f
,
vc
.
value
()),
Recursive
::
apply
(
f
,
vc
.
container
())};
}
};
template
<
class
Value
>
struct
Apply
<
Impl
::
ValueAndContainer
<
Value
,
void
>>
{
template
<
class
F
,
class
VC
>
static
auto
impl
(
F
&&
f
,
VC
const
&
vc
)
{
return
Impl
::
ValueAndContainer
{
Recursive
::
apply
(
f
,
vc
.
value
())};
}
};
template
<
class
Container
>
struct
Apply
<
TreeContainerStorage
<
Container
>>
{
template
<
class
F
,
class
TC
>
static
auto
impl
(
F
&&
f
,
TC
const
&
c
)
{
return
TreeContainerStorage
{
Recursive
::
apply
(
f
,
c
.
data
())};
}
};
// -------------------------------------------------------------------------
template
<
>
struct
ForEach
<
Impl
::
Ignore
>
{
template
<
class
F
>
static
void
impl
(
Impl
::
Ignore
,
F
&&
/*f*/
)
{}
};
template
<
class
Value
,
class
Container
>
struct
ForEach
<
Impl
::
ValueAndContainer
<
Value
,
Container
>>
{
template
<
class
VC
,
class
F
>
static
void
impl
(
VC
&&
vc
,
F
&&
f
)
{
Recursive
::
forEach
(
vc
.
value
(),
f
);
Recursive
::
forEach
(
vc
.
container
(),
f
);
}
};
template
<
class
Value
>
struct
ForEach
<
Impl
::
ValueAndContainer
<
Value
,
void
>>
{
template
<
class
VC
,
class
F
>
static
void
impl
(
VC
&&
vc
,
F
&&
f
)
{
Recursive
::
forEach
(
vc
.
value
(),
f
);
}
};
template
<
class
Container
>
struct
ForEach
<
TreeContainerStorage
<
Container
>>
{
template
<
class
F
,
class
TC
>
static
void
impl
(
TC
&&
c
,
F
&&
f
)
{
Recursive
::
forEach
(
c
.
data
(),
f
);
}
};
}
// end namespace Tools
}
// end namespace AMDiS
examples/treecontainer.cc
View file @
c1f0b965
...
@@ -25,7 +25,7 @@ int main(int argc, char** argv)
...
@@ -25,7 +25,7 @@ int main(int argc, char** argv)
auto
localView
=
basis1
.
localView
();
auto
localView
=
basis1
.
localView
();
auto
container
=
makeT
reeContainer
<
double
>
(
localView
.
tree
());
auto
container
=
TypeTree
::
t
reeContainer
<
double
>
(
localView
.
tree
());
auto
container2
=
makeT
reeContainer
(
localView
.
tree
(),
auto
container2
=
TypeTree
::
t
reeContainer
(
localView
.
tree
(),
[
&
](
auto
const
&
node
)
{
return
makeT
reeContainer
<
double
>
(
localView
.
tree
());
});
[
&
](
auto
const
&
node
)
{
return
TypeTree
::
t
reeContainer
<
double
>
(
localView
.
tree
());
});
}
}
test/TreeContainerTest.cpp
View file @
c1f0b965
...
@@ -31,9 +31,9 @@ int main (int argc, char** argv)
...
@@ -31,9 +31,9 @@ int main (int argc, char** argv)
auto
localView
=
basis
.
localView
();
auto
localView
=
basis
.
localView
();
auto
const
&
tree
=
localView
.
tree
();
auto
const
&
tree
=
localView
.
tree
();
auto
c1
=
makeT
reeContainer
<
double
>
(
tree
);
auto
c1
=
TypeTree
::
t
reeContainer
<
double
>
(
tree
);
auto
c2
=
makeT
reeContainer
<
decltype
(
c1
)
>
(
tree
);
auto
c2
=
TypeTree
::
t
reeContainer
<
decltype
(
c1
)
>
(
tree
);
auto
c3
=
makeT
reeContainer
(
tree
,
[
&
](
auto
const
&
)
{
return
makeT
reeContainer
<
double
>
(
tree
);
});
auto
c3
=
TypeTree
::
t
reeContainer
(
tree
,
[
&
](
auto
const
&
)
{
return
TypeTree
::
t
reeContainer
<
double
>
(
tree
);
});
// fill 1d treeContainer with data
// fill 1d treeContainer with data
for_each_leaf_node
(
tree
,
[
&
](
auto
const
&
node
,
auto
tp
)
{
for_each_leaf_node
(
tree
,
[
&
](
auto
const
&
node
,
auto
tp
)
{
...
...
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