Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
dumux
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
dumux-repositories
dumux
Commits
d07fc8fd
Commit
d07fc8fd
authored
6 years ago
by
Kilian Weishaupt
Browse files
Options
Downloads
Patches
Plain Diff
[niVolVars] Use Dune::is_detected for class introspection
parent
49309cbc
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!1337
WIP Fix/dirichlet caching v2
,
!1309
Use Dune::is_detected
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dumux/porousmediumflow/nonisothermal/volumevariables.hh
+63
-80
63 additions, 80 deletions
dumux/porousmediumflow/nonisothermal/volumevariables.hh
with
63 additions
and
80 deletions
dumux/porousmediumflow/nonisothermal/volumevariables.hh
+
63
−
80
View file @
d07fc8fd
...
...
@@ -26,6 +26,7 @@
#define DUMUX_ENERGY_VOLUME_VARIABLES_HH
#include
<type_traits>
#include
<dune/common/std/type_traits.hh>
#include
<dumux/material/solidsystems/inertsolidphase.hh>
#include
<dumux/porousmediumflow/volumevariables.hh>
...
...
@@ -34,35 +35,29 @@ namespace Dumux {
#ifndef DOXYGEN
namespace
Detail
{
// helper struct detecting if the user-defined spatial params class has user-specified functions
// helper struct
s and functions
detecting if the user-defined spatial params class has user-specified functions
// for solidHeatCapacity, solidDensity, and solidThermalConductivity.
// for g++ > 5.3, this can be replaced by a lambda
template
<
class
E
,
class
SCV
,
class
ES
,
class
SS
>
struct
hasSolidHeatCapacity
{
template
<
class
SpatialParams
>
auto
operator
()(
const
SpatialParams
&
a
)
->
decltype
(
a
.
solidHeatCapacity
(
std
::
declval
<
E
>
(),
std
::
declval
<
SCV
>
(),
std
::
declval
<
ES
>
(),
std
::
declval
<
SS
>
()))
{}
};
template
<
class
E
,
class
SCV
,
class
ES
,
class
SS
>
struct
hasSolidDensity
{
template
<
class
SpatialParams
>
auto
operator
()(
const
SpatialParams
&
a
)
->
decltype
(
a
.
solidDensity
(
std
::
declval
<
E
>
(),
std
::
declval
<
SCV
>
(),
std
::
declval
<
ES
>
(),
std
::
declval
<
SS
>
()))
{}
};
template
<
typename
T
,
typename
...
Ts
>
using
SolidHeatCapacityDetector
=
decltype
(
std
::
declval
<
T
>
().
solidHeatCapacity
(
std
::
declval
<
Ts
>
()...));
template
<
class
E
,
class
SCV
,
class
ES
,
class
SS
>
struct
hasSolidThermalConductivity
{
template
<
class
SpatialParams
>
auto
operator
()(
const
SpatialParams
&
a
)
->
decltype
(
a
.
solidThermalConductivity
(
std
::
declval
<
E
>
(),
std
::
declval
<
SCV
>
(),
std
::
declval
<
ES
>
(),
std
::
declval
<
SS
>
()))
{}
};
template
<
class
T
,
typename
...
Args
>
static
constexpr
bool
hasSolidHeatCapacity
()
{
return
Dune
::
Std
::
is_detected
<
SolidHeatCapacityDetector
,
T
,
Args
...
>::
value
;
}
template
<
typename
T
,
typename
...
Ts
>
using
SolidDensityDetector
=
decltype
(
std
::
declval
<
T
>
().
solidDensity
(
std
::
declval
<
Ts
>
()...));
template
<
class
T
,
typename
...
Args
>
static
constexpr
bool
hasSolidDensity
()
{
return
Dune
::
Std
::
is_detected
<
SolidDensityDetector
,
T
,
Args
...
>::
value
;
}
template
<
typename
T
,
typename
...
Ts
>
using
SolidThermalConductivityDetector
=
decltype
(
std
::
declval
<
T
>
().
solidThermalConductivity
(
std
::
declval
<
Ts
>
()...));
template
<
class
T
,
typename
...
Args
>
static
constexpr
bool
hasSolidThermalConductivity
()
{
return
Dune
::
Std
::
is_detected
<
SolidThermalConductivityDetector
,
T
,
Args
...
>::
value
;
}
template
<
class
SolidSystem
>
struct
isInertSolidPhase
:
public
std
::
false_type
{};
...
...
@@ -319,15 +314,13 @@ private:
* \param solidState the solid state
* \note this gets selected if the user uses the solidsystem / solidstate interface
*/
template
<
class
ElemSol
,
class
Problem
,
class
Element
,
class
Scv
>
auto
solidHeatCapacity_
(
const
ElemSol
&
elemSol
,
const
Problem
&
problem
,
const
Element
&
element
,
const
Scv
&
scv
,
const
SolidState
&
solidState
)
->
typename
std
::
enable_if_t
<!
decltype
(
isValid
(
Detail
::
hasSolidHeatCapacity
<
Element
,
Scv
,
ElemSol
,
SolidState
>
())(
problem
.
spatialParams
())
)
::
value
,
Scalar
>
template
<
class
ElemSol
,
class
Problem
,
class
Element
,
class
Scv
,
std
::
enable_if_t
<!
Detail
::
hasSolidHeatCapacity
<
typename
Problem
::
SpatialParams
,
Element
,
Scv
,
ElemSol
,
SolidState
>(),
int
>
=
0
>
Scalar
solidHeatCapacity_
(
const
ElemSol
&
elemSol
,
const
Problem
&
problem
,
const
Element
&
element
,
const
Scv
&
scv
,
const
SolidState
&
solidState
)
{
return
SolidSystem
::
heatCapacity
(
solidState
);
}
...
...
@@ -341,15 +334,13 @@ private:
* \param solidState the solid state
* \note this gets selected if the user uses the solidsystem / solidstate interface
*/
template
<
class
ElemSol
,
class
Problem
,
class
Element
,
class
Scv
>
auto
solidDensity_
(
const
ElemSol
&
elemSol
,
const
Problem
&
problem
,
const
Element
&
element
,
const
Scv
&
scv
,
const
SolidState
&
solidState
)
->
typename
std
::
enable_if_t
<!
decltype
(
isValid
(
Detail
::
hasSolidDensity
<
Element
,
Scv
,
ElemSol
,
SolidState
>
())(
problem
.
spatialParams
())
)
::
value
,
Scalar
>
template
<
class
ElemSol
,
class
Problem
,
class
Element
,
class
Scv
,
std
::
enable_if_t
<!
Detail
::
hasSolidDensity
<
typename
Problem
::
SpatialParams
,
Element
,
Scv
,
ElemSol
,
SolidState
>(),
int
>
=
0
>
Scalar
solidDensity_
(
const
ElemSol
&
elemSol
,
const
Problem
&
problem
,
const
Element
&
element
,
const
Scv
&
scv
,
const
SolidState
&
solidState
)
{
return
SolidSystem
::
density
(
solidState
);
}
...
...
@@ -363,15 +354,13 @@ private:
* \param solidState the solid state
* \note this gets selected if the user uses the solidsystem / solidstate interface
*/
template
<
class
ElemSol
,
class
Problem
,
class
Element
,
class
Scv
>
auto
solidThermalConductivity_
(
const
ElemSol
&
elemSol
,
const
Problem
&
problem
,
const
Element
&
element
,
const
Scv
&
scv
,
const
SolidState
&
solidState
)
->
typename
std
::
enable_if_t
<!
decltype
(
isValid
(
Detail
::
hasSolidThermalConductivity
<
Element
,
Scv
,
ElemSol
,
SolidState
>
())(
problem
.
spatialParams
())
)
::
value
,
Scalar
>
template
<
class
ElemSol
,
class
Problem
,
class
Element
,
class
Scv
,
std
::
enable_if_t
<!
Detail
::
hasSolidThermalConductivity
<
typename
Problem
::
SpatialParams
,
Element
,
Scv
,
ElemSol
,
SolidState
>(),
int
>
=
0
>
Scalar
solidThermalConductivity_
(
const
ElemSol
&
elemSol
,
const
Problem
&
problem
,
const
Element
&
element
,
const
Scv
&
scv
,
const
SolidState
&
solidState
)
{
return
SolidSystem
::
thermalConductivity
(
solidState
);
}
...
...
@@ -394,15 +383,13 @@ private:
* \note this gets selected if the user uses the simple spatial params interface in
* combination with an InertSolidPhase as solid system
*/
template
<
class
ElemSol
,
class
Problem
,
class
Element
,
class
Scv
>
auto
solidHeatCapacity_
(
const
ElemSol
&
elemSol
,
const
Problem
&
problem
,
const
Element
&
element
,
const
Scv
&
scv
,
const
SolidState
&
solidState
)
->
typename
std
::
enable_if_t
<
decltype
(
isValid
(
Detail
::
hasSolidHeatCapacity
<
Element
,
Scv
,
ElemSol
,
SolidState
>
())(
problem
.
spatialParams
())
)
::
value
,
Scalar
>
template
<
class
ElemSol
,
class
Problem
,
class
Element
,
class
Scv
,
std
::
enable_if_t
<
Detail
::
hasSolidHeatCapacity
<
typename
Problem
::
SpatialParams
,
Element
,
Scv
,
ElemSol
,
SolidState
>(),
int
>
=
0
>
Scalar
solidHeatCapacity_
(
const
ElemSol
&
elemSol
,
const
Problem
&
problem
,
const
Element
&
element
,
const
Scv
&
scv
,
const
SolidState
&
solidState
)
{
static_assert
(
Detail
::
isInertSolidPhase
<
SolidSystem
>::
value
,
"solidHeatCapacity can only be overwritten in the spatial params when the solid system is a simple InertSolidPhase
\n
"
...
...
@@ -420,15 +407,13 @@ private:
* \note this gets selected if the user uses the simple spatial params interface in
* combination with an InertSolidPhase as solid system
*/
template
<
class
ElemSol
,
class
Problem
,
class
Element
,
class
Scv
>
auto
solidDensity_
(
const
ElemSol
&
elemSol
,
const
Problem
&
problem
,
const
Element
&
element
,
const
Scv
&
scv
,
const
SolidState
&
solidState
)
->
typename
std
::
enable_if_t
<
decltype
(
isValid
(
Detail
::
hasSolidDensity
<
Element
,
Scv
,
ElemSol
,
SolidState
>
())(
problem
.
spatialParams
())
)
::
value
,
Scalar
>
template
<
class
ElemSol
,
class
Problem
,
class
Element
,
class
Scv
,
std
::
enable_if_t
<
Detail
::
hasSolidDensity
<
typename
Problem
::
SpatialParams
,
Element
,
Scv
,
ElemSol
,
SolidState
>(),
int
>
=
0
>
Scalar
solidDensity_
(
const
ElemSol
&
elemSol
,
const
Problem
&
problem
,
const
Element
&
element
,
const
Scv
&
scv
,
const
SolidState
&
solidState
)
{
static_assert
(
Detail
::
isInertSolidPhase
<
SolidSystem
>::
value
,
"solidDensity can only be overwritten in the spatial params when the solid system is a simple InertSolidPhase
\n
"
...
...
@@ -446,15 +431,13 @@ private:
* \note this gets selected if the user uses the simple spatial params interface in
* combination with an InertSolidPhase as solid system
*/
template
<
class
ElemSol
,
class
Problem
,
class
Element
,
class
Scv
>
auto
solidThermalConductivity_
(
const
ElemSol
&
elemSol
,
const
Problem
&
problem
,
const
Element
&
element
,
const
Scv
&
scv
,
const
SolidState
&
solidState
)
->
typename
std
::
enable_if_t
<
decltype
(
isValid
(
Detail
::
hasSolidThermalConductivity
<
Element
,
Scv
,
ElemSol
,
SolidState
>
())(
problem
.
spatialParams
())
)
::
value
,
Scalar
>
template
<
class
ElemSol
,
class
Problem
,
class
Element
,
class
Scv
,
std
::
enable_if_t
<
Detail
::
hasSolidThermalConductivity
<
typename
Problem
::
SpatialParams
,
Element
,
Scv
,
ElemSol
,
SolidState
>(),
int
>
=
0
>
Scalar
solidThermalConductivity_
(
const
ElemSol
&
elemSol
,
const
Problem
&
problem
,
const
Element
&
element
,
const
Scv
&
scv
,
const
SolidState
&
solidState
)
{
static_assert
(
Detail
::
isInertSolidPhase
<
SolidSystem
>::
value
,
"solidThermalConductivity can only be overwritten in the spatial params when the solid system is a simple InertSolidPhase
\n
"
...
...
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