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
baa85a7a
Commit
baa85a7a
authored
2 years ago
by
Timo Koch
Browse files
Options
Downloads
Patches
Plain Diff
[test][properties] Test Properties::hasDefinedType and GetPropOr
parent
56899d37
No related branches found
No related tags found
1 merge request
!3077
Provide defaults for FluxVariablesCache and FluxVariablesCacheFiller
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/common/propertysystem/test_propertysystem.cc
+21
-10
21 additions, 10 deletions
test/common/propertysystem/test_propertysystem.cc
with
21 additions
and
10 deletions
test/common/propertysystem/test_propertysystem.cc
+
21
−
10
View file @
baa85a7a
...
...
@@ -31,8 +31,7 @@
#include
<dumux/common/properties/propertysystem.hh>
namespace
Dumux
{
namespace
Properties
{
namespace
Dumux
::
Properties
{
// create some properties:
// the first type tag is the actual TypeTag for which the property will be obtained
...
...
@@ -77,8 +76,7 @@ struct CoordinateType<TypeTag, TTag::Grid> { using type = GetPropType<TypeTag, S
template
<
class
TypeTag
>
struct
UseTpfaFlux
<
TypeTag
,
TTag
::
CCTpfaDisc
>
{
static
constexpr
bool
value
=
true
;
};
}
// end namespace Properties
}
// end namespace Dumux
}
// end namespace Dumux::Properties
int
main
(
int
argc
,
char
*
argv
[])
{
...
...
@@ -87,27 +85,40 @@ int main(int argc, char* argv[])
{
using
Scalar
=
GetPropType
<
TTag
::
Base
,
Scalar
>
;
if
(
!
std
::
is_same
<
Scalar
,
float
>
::
value
)
if
(
!
std
::
is_same
_v
<
Scalar
,
float
>
)
DUNE_THROW
(
Dune
::
InvalidStateException
,
"Property Scalar in TTag::Base should be float but is "
<<
Dune
::
className
<
Scalar
>
());
}
{
using
Scalar
=
GetPropType
<
TTag
::
OnePTest
,
Scalar
>
;
if
(
!
std
::
is_same
<
Scalar
,
int
>
::
value
)
if
(
!
std
::
is_same
_v
<
Scalar
,
int
>
)
DUNE_THROW
(
Dune
::
InvalidStateException
,
"Property Scalar in TTag::OnePTest should be int but is "
<<
Dune
::
className
<
Scalar
>
());
}
{
using
Scalar
=
GetPropType
<
TTag
::
OnePModel
,
Scalar
>
;
if
(
!
std
::
is_same
<
Scalar
,
double
>::
value
)
DUNE_THROW
(
Dune
::
InvalidStateException
,
"Property Scalar in TTag::OnePModel should be double but is "
<<
Dune
::
className
<
Scalar
>
());
if
(
!
std
::
is_same_v
<
Scalar
,
double
>
)
DUNE_THROW
(
Dune
::
InvalidStateException
,
"Property Scalar in TTag::OnePModel should be double but is "
<<
Dune
::
className
<
Scalar
>
());
}
{
static_assert
(
!
hasDefinedType
<
TTag
::
Base
,
CoordinateType
>
(),
"Property type should be undefined for TTag::Base"
);
}
{
using
CoordinateType
=
GetPropTypeOr
<
TTag
::
Base
,
CoordinateType
,
double
>
;
static_assert
(
std
::
is_same_v
<
CoordinateType
,
double
>
,
"Property is expected to default to double"
);
}
{
using
CoordinateType
=
GetPropType
<
TTag
::
OnePTest
,
CoordinateType
>
;
if
(
!
std
::
is_same
<
CoordinateType
,
int
>
::
value
)
if
(
!
std
::
is_same
_v
<
CoordinateType
,
int
>
)
DUNE_THROW
(
Dune
::
InvalidStateException
,
"Property CoordinateType in TTag::OnePTest should be int but is "
<<
Dune
::
className
<
CoordinateType
>
());
}
{
using
CoordinateType
=
GetPropType
<
TTag
::
CCTpfaDisc
,
CoordinateType
>
;
if
(
!
std
::
is_same
<
CoordinateType
,
float
>
::
value
)
if
(
!
std
::
is_same
_v
<
CoordinateType
,
float
>
)
DUNE_THROW
(
Dune
::
InvalidStateException
,
"Property CoordinateType in TTag::CCTpfaDisc should be float but is "
<<
Dune
::
className
<
CoordinateType
>
());
}
{
...
...
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