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
9a07ac65
Commit
9a07ac65
authored
Jun 08, 2019
by
Praetorius, Simon
Browse files
make StandardProblemIteration copyable
parent
c4f8fac9
Changes
3
Show whitespace changes
Inline
Side-by-side
src/amdis/ProblemStat.hpp
View file @
9a07ac65
...
...
@@ -49,7 +49,7 @@ namespace AMDiS
template
<
class
Traits
>
class
ProblemStat
:
public
ProblemStatBase
,
public
StandardProblemIteration
,
public
StandardProblemIteration
Adaptor
<
ProblemStat
<
Traits
>>
{
using
Self
=
ProblemStat
;
...
...
@@ -81,8 +81,7 @@ namespace AMDiS
* access values corresponding to this problem in the parameter file.
**/
explicit
ProblemStat
(
std
::
string
const
&
name
)
:
StandardProblemIteration
(
dynamic_cast
<
ProblemStatBase
&>
(
*
this
))
,
name_
(
name
)
:
name_
(
name
)
{}
/// Constructor taking additionally a reference to a grid that is used
...
...
src/amdis/StandardProblemIteration.hpp
View file @
9a07ac65
...
...
@@ -53,4 +53,44 @@ namespace AMDiS
ProblemStatBase
&
problem_
;
};
/// \brief StandardProblemIteration when derived from ProblemStat
/**
* Use this adaptor when multiple inheritance is used:
* ```
* class Problem
* : public ProblemStatBase
* : StandardProblemIterationAdaptor<Problem>
* {};
* ```
*
* **Requirements:**
* - Model must be derived from ProblemStatBase and from StandardProblemIterationAdaptor
**/
template
<
class
Model
>
class
StandardProblemIterationAdaptor
:
public
StandardProblemIteration
{
template
<
class
Self
>
static
ProblemStatBase
&
asProblemStatBase
(
Self
&
self
)
{
Model
&
model
=
static_cast
<
Model
&>
(
self
);
return
dynamic_cast
<
ProblemStatBase
&>
(
model
);
}
public:
StandardProblemIterationAdaptor
()
:
StandardProblemIteration
(
asProblemStatBase
(
*
this
))
{}
StandardProblemIterationAdaptor
(
StandardProblemIterationAdaptor
const
&
)
:
StandardProblemIteration
(
asProblemStatBase
(
*
this
))
{}
StandardProblemIterationAdaptor
(
StandardProblemIterationAdaptor
&&
)
:
StandardProblemIteration
(
asProblemStatBase
(
*
this
))
{}
};
}
// end namespace AMDiS
test/ProblemStatTest.cpp
View file @
9a07ac65
#include <amdis/AMDiS.hpp>
#include <amdis/AdaptStationary.hpp>
#include <amdis/LocalOperators.hpp>
#include <amdis/ProblemStat.hpp>
...
...
@@ -21,6 +22,19 @@ void test()
prob
.
addMatrixOperator
(
sot
(
T
(
1
)),
0
,
0
);
prob
.
addVectorOperator
(
zot
(
T
(
1
)),
0
);
prob
.
addDirichletBC
(
BoundaryType
{
1
},
0
,
0
,
T
(
0
));
AdaptInfo
adaptInfo
(
"adapt"
);
// test copy constructor of problem
auto
prob2
(
prob
);
AdaptStationary
adaptStat2
(
"adapt"
,
prob2
,
adaptInfo
);
adaptStat2
.
adapt
();
// test move constructor of problem
auto
prob3
(
std
::
move
(
prob2
));
AdaptStationary
adaptStat3
(
"adapt"
,
prob3
,
adaptInfo
);
adaptStat3
.
adapt
();
}
int
main
(
int
argc
,
char
**
argv
)
...
...
Write
Preview
Markdown
is supported
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