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
342e7182
Commit
342e7182
authored
May 08, 2019
by
Praetorius, Simon
Browse files
Merge branch 'feature/lambda_return_Type' into 'master'
Add explicit return type for lambdas See merge request
!48
parents
37d31160
30a457d9
Changes
6
Hide whitespace changes
Inline
Side-by-side
src/amdis/BoundaryManager.hpp
View file @
342e7182
...
...
@@ -146,7 +146,7 @@ namespace AMDiS
if
(
!
segment
.
boundary
())
continue
;
Dune
::
Hybrid
::
ifElse
(
Dune
::
Std
::
is_detected
<
HasBoundaryId
,
Segment
>
{},
[
&
](
auto
id
)
{
Dune
::
Hybrid
::
ifElse
(
Dune
::
Std
::
is_detected
<
HasBoundaryId
,
Segment
>
{},
[
&
](
auto
id
)
->
void
{
auto
index
=
segment
.
boundarySegmentIndex
();
boundaryIds_
[
index
]
=
id
(
segment
).
boundaryId
();
});
...
...
src/amdis/ProblemStat.inc.hpp
View file @
342e7182
...
...
@@ -179,7 +179,7 @@ void ProblemStat<Traits>::createMatricesAndVectors()
rhs_
=
std
::
make_shared
<
SystemVector
>
(
globalBasis_
,
DataTransferOperation
::
NO_OPERATION
);
auto
localView
=
globalBasis_
->
localView
();
for_each_node
(
localView
.
tree
(),
[
&
,
this
](
auto
const
&
node
,
auto
treePath
)
for_each_node
(
localView
.
tree
(),
[
&
,
this
](
auto
const
&
node
,
auto
treePath
)
->
void
{
std
::
string
i
=
to_string
(
treePath
);
estimates_
[
i
].
resize
(
globalBasis_
->
gridView
().
indexSet
().
size
(
0
));
...
...
@@ -207,7 +207,7 @@ void ProblemStat<Traits>::createMarker()
{
marker_
.
clear
();
auto
localView
=
globalBasis_
->
localView
();
for_each_node
(
localView
.
tree
(),
[
&
,
this
](
auto
const
&
node
,
auto
treePath
)
for_each_node
(
localView
.
tree
(),
[
&
,
this
](
auto
const
&
node
,
auto
treePath
)
->
void
{
std
::
string
componentName
=
name_
+
"->marker["
+
to_string
(
treePath
)
+
"]"
;
...
...
@@ -228,7 +228,7 @@ void ProblemStat<Traits>::createFileWriter()
{
filewriter_
.
clear
();
auto
localView
=
globalBasis_
->
localView
();
for_each_node
(
localView
.
tree
(),
[
&
,
this
](
auto
const
&
node
,
auto
treePath
)
for_each_node
(
localView
.
tree
(),
[
&
,
this
](
auto
const
&
node
,
auto
treePath
)
->
void
{
std
::
string
componentName
=
name_
+
"->output["
+
to_string
(
treePath
)
+
"]"
;
...
...
@@ -380,11 +380,11 @@ globalRefine(int refCount)
Dune
::
Timer
t
;
bool
adapted
=
false
;
Dune
::
Hybrid
::
ifElse
(
Dune
::
Std
::
is_detected
<
HasGlobalRefineADHI
,
Grid
>
{},
/*then*/
[
&
](
auto
id
)
{
/*then*/
[
&
](
auto
id
)
->
void
{
// TODO(FM): Add a way to pass a GridTransfer as ADH with *globalBasis_ argument
id
(
grid_
)
->
globalRefine
(
refCount
,
GridTransferManager
::
gridTransfer
(
*
grid_
));
},
/*else*/
[
&
](
auto
id
)
{
/*else*/
[
&
](
auto
id
)
->
void
{
for
(
int
i
=
0
;
i
<
refCount
;
++
i
)
{
// mark all entities for grid refinement
for
(
const
auto
&
element
:
elements
(
grid_
->
leafGridView
()))
...
...
@@ -423,9 +423,9 @@ buildAfterAdapt(AdaptInfo& /*adaptInfo*/, Flag /*flag*/, bool asmMatrix, bool as
rhs_
->
init
(
asmVector
);
auto
localView
=
globalBasis_
->
localView
();
for_each_node
(
localView
.
tree
(),
[
&
,
this
](
auto
const
&
rowNode
,
auto
rowTp
)
{
for_each_node
(
localView
.
tree
(),
[
&
,
this
](
auto
const
&
rowNode
,
auto
rowTp
)
->
void
{
auto
rowBasis
=
Dune
::
Functions
::
subspaceBasis
(
*
globalBasis_
,
rowTp
);
for_each_node
(
localView
.
tree
(),
[
&
,
this
](
auto
const
&
colNode
,
auto
colTp
)
{
for_each_node
(
localView
.
tree
(),
[
&
,
this
](
auto
const
&
colNode
,
auto
colTp
)
->
void
{
auto
colBasis
=
Dune
::
Functions
::
subspaceBasis
(
*
globalBasis_
,
colTp
);
for
(
auto
bc
:
dirichletBCs_
[
rowNode
][
colNode
])
bc
->
init
(
rowBasis
,
colBasis
);
...
...
@@ -451,8 +451,8 @@ buildAfterAdapt(AdaptInfo& /*adaptInfo*/, Flag /*flag*/, bool asmMatrix, bool as
systemMatrix_
->
finish
(
asmMatrix
);
rhs_
->
finish
(
asmVector
);
for_each_node
(
localView
.
tree
(),
[
&
,
this
](
auto
const
&
rowNode
,
auto
row_tp
)
{
for_each_node
(
localView
.
tree
(),
[
&
,
this
](
auto
const
&
colNode
,
auto
col_tp
)
{
for_each_node
(
localView
.
tree
(),
[
&
,
this
](
auto
const
&
rowNode
,
auto
row_tp
)
->
void
{
for_each_node
(
localView
.
tree
(),
[
&
,
this
](
auto
const
&
colNode
,
auto
col_tp
)
->
void
{
// finish boundary condition
for
(
auto
bc
:
dirichletBCs_
[
rowNode
][
colNode
])
bc
->
fillBoundaryCondition
(
*
systemMatrix_
,
*
solution_
,
*
rhs_
,
rowNode
,
row_tp
,
colNode
,
col_tp
);
...
...
src/amdis/localoperators/ConvectionDiffusionOperator.hpp
View file @
342e7182
...
...
@@ -184,8 +184,8 @@ namespace AMDiS
{
using
Concept
=
Dune
::
Std
::
is_detected
<
HasLocalFunctionOrder
,
LocalFct
>
;
return
Dune
::
Hybrid
::
ifElse
(
Concept
{},
[
&
](
auto
id
)
{
return
order
(
id
(
localFct
));
},
[]
(
auto
)
{
return
0
;
});
[
&
](
auto
id
)
->
int
{
return
order
(
id
(
localFct
));
},
[]
(
auto
)
->
int
{
return
0
;
});
}
template
<
class
T
,
int
N
>
...
...
src/amdis/typetree/Traversal.hpp
View file @
342e7182
...
...
@@ -96,7 +96,7 @@ namespace AMDiS {
if
constexpr
(
visitChild
)
applyToTree
(
child
,
childTP
,
visitor
);
#else // AMDIS_HAS_CXX_CONSTEXPR_IF
Dune
::
Hybrid
::
ifElse
(
bool_t
<
visitChild
>
{},
[
&
]
(
auto
/*id*/
)
{
Dune
::
Hybrid
::
ifElse
(
bool_t
<
visitChild
>
{},
[
&
]
(
auto
/*id*/
)
->
void
{
applyToTree
(
child
,
childTP
,
visitor
);
});
#endif // AMDIS_HAS_CXX_CONSTEXPR_IF
...
...
src/amdis/typetree/TreeData.hpp
View file @
342e7182
...
...
@@ -120,7 +120,9 @@ namespace AMDiS
assert
(
initialized_
);
assert
(
data_
.
size
()
>
node
.
treeIndex
());
using
NodePtr
=
NodeData
<
Node
>*
;
return
*
NodePtr
(
data_
[
node
.
treeIndex
()]);
auto
*
nodePtr
=
NodePtr
(
data_
[
node
.
treeIndex
()]);
assert
(
nodePtr
);
return
*
nodePtr
;
}
//! Get reference to data associated to given node
...
...
@@ -130,7 +132,9 @@ namespace AMDiS
assert
(
initialized_
);
assert
(
data_
.
size
()
>
node
.
treeIndex
());
using
NodePtr
=
NodeData
<
Node
>*
;
return
*
NodePtr
(
data_
[
node
.
treeIndex
()]);
auto
*
nodePtr
=
NodePtr
(
data_
[
node
.
treeIndex
()]);
assert
(
nodePtr
);
return
*
nodePtr
;
}
//! Swap tree and data container with `other`
...
...
@@ -152,12 +156,12 @@ namespace AMDiS
void
initData
()
{
std
::
size_t
s
=
0
;
apply
([
&
s
](
const
auto
&
node
,
auto
)
{
apply
([
&
s
](
const
auto
&
node
,
auto
)
->
void
{
s
=
std
::
max
(
s
,
node
.
treeIndex
()
+
1
);
});
data_
.
resize
(
s
,
nullptr
);
apply
([
this
](
const
auto
&
node
,
auto
)
{
apply
([
this
](
const
auto
&
node
,
auto
)
->
void
{
using
Node
=
std
::
remove_reference_t
<
decltype
(
node
)
>
;
data_
[
node
.
treeIndex
()]
=
new
NodeData
<
Node
>
;
});
...
...
@@ -167,7 +171,7 @@ namespace AMDiS
// Deep copy of node data
void
copyData
(
const
TreeData
&
other
)
{
apply
([
&
other
,
this
](
const
auto
&
node
,
auto
)
{
apply
([
&
other
,
this
](
const
auto
&
node
,
auto
)
->
void
{
(
*
this
)[
node
]
=
other
[
node
];
});
}
...
...
@@ -175,7 +179,7 @@ namespace AMDiS
// For each node, delete the allocated node data
void
destroyData
()
{
apply
([
this
](
const
auto
&
node
,
auto
)
{
apply
([
this
](
const
auto
&
node
,
auto
)
->
void
{
using
Node
=
std
::
remove_reference_t
<
decltype
(
node
)
>
;
using
NodePtr
=
NodeData
<
Node
>*
;
auto
*
p
=
NodePtr
(
data_
[
node
.
treeIndex
()]);
...
...
src/amdis/utility/QuadratureFactory.hpp
View file @
342e7182
...
...
@@ -57,8 +57,8 @@ namespace AMDiS
void
bind
(
LocalFunction
const
&
localFct
)
final
{
order_
=
Dune
::
Hybrid
::
ifElse
(
Concept
{},
[
&
](
auto
id
)
{
return
AMDiS
::
order
(
id
(
localFct
));
},
[]
(
auto
)
{
return
-
1
;
});
[
&
](
auto
id
)
->
int
{
return
AMDiS
::
order
(
id
(
localFct
));
},
[]
(
auto
)
->
int
{
return
-
1
;
});
}
int
order
()
const
final
{
return
order_
;
}
...
...
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