Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
ogs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
Dmitri Naumov
ogs
Commits
eb009012
Commit
eb009012
authored
4 years ago
by
joergbuchwald
Committed by
Dmitri Naumov
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
MPL: add debug warnings for unused parameters
parent
37aa049e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
MaterialLib/MPL/Property.cpp
+18
-0
18 additions, 0 deletions
MaterialLib/MPL/Property.cpp
MaterialLib/MPL/Property.h
+35
-0
35 additions, 0 deletions
MaterialLib/MPL/Property.h
with
53 additions
and
0 deletions
MaterialLib/MPL/Property.cpp
+
18
−
0
View file @
eb009012
...
@@ -71,6 +71,9 @@ PropertyDataType Property::initialValue(
...
@@ -71,6 +71,9 @@ PropertyDataType Property::initialValue(
PropertyDataType
Property
::
value
()
const
PropertyDataType
Property
::
value
()
const
{
{
#ifndef NDEBUG
property_used
=
true
;
#endif
return
value_
;
return
value_
;
}
}
...
@@ -79,6 +82,9 @@ PropertyDataType Property::value(VariableArray const& /*variable_array*/,
...
@@ -79,6 +82,9 @@ PropertyDataType Property::value(VariableArray const& /*variable_array*/,
ParameterLib
::
SpatialPosition
const
&
/*pos*/
,
ParameterLib
::
SpatialPosition
const
&
/*pos*/
,
double
const
/*t*/
,
double
const
/*dt*/
)
const
double
const
/*t*/
,
double
const
/*dt*/
)
const
{
{
#ifndef NDEBUG
property_used
=
true
;
#endif
return
value_
;
return
value_
;
}
}
...
@@ -86,6 +92,9 @@ PropertyDataType Property::value(VariableArray const& variable_array,
...
@@ -86,6 +92,9 @@ PropertyDataType Property::value(VariableArray const& variable_array,
ParameterLib
::
SpatialPosition
const
&
pos
,
ParameterLib
::
SpatialPosition
const
&
pos
,
double
const
t
,
double
const
dt
)
const
double
const
t
,
double
const
dt
)
const
{
{
#ifndef NDEBUG
property_used
=
true
;
#endif
return
value
(
variable_array
,
VariableArray
{},
pos
,
t
,
dt
);
return
value
(
variable_array
,
VariableArray
{},
pos
,
t
,
dt
);
}
}
...
@@ -95,6 +104,9 @@ PropertyDataType Property::dValue(VariableArray const& /*variable_array*/,
...
@@ -95,6 +104,9 @@ PropertyDataType Property::dValue(VariableArray const& /*variable_array*/,
ParameterLib
::
SpatialPosition
const
&
/*pos*/
,
ParameterLib
::
SpatialPosition
const
&
/*pos*/
,
double
const
/*t*/
,
double
const
/*dt*/
)
const
double
const
/*t*/
,
double
const
/*dt*/
)
const
{
{
#ifndef NDEBUG
property_used
=
true
;
#endif
return
dvalue_
;
return
dvalue_
;
}
}
...
@@ -105,6 +117,9 @@ PropertyDataType Property::dValue(VariableArray const& variable_array,
...
@@ -105,6 +117,9 @@ PropertyDataType Property::dValue(VariableArray const& variable_array,
ParameterLib
::
SpatialPosition
const
&
pos
,
ParameterLib
::
SpatialPosition
const
&
pos
,
double
const
t
,
double
const
dt
)
const
double
const
t
,
double
const
dt
)
const
{
{
#ifndef NDEBUG
property_used
=
true
;
#endif
return
dValue
(
variable_array
,
VariableArray
{},
variable
,
pos
,
t
,
dt
);
return
dValue
(
variable_array
,
VariableArray
{},
variable
,
pos
,
t
,
dt
);
}
}
...
@@ -116,6 +131,9 @@ PropertyDataType Property::d2Value(VariableArray const& /*variable_array*/,
...
@@ -116,6 +131,9 @@ PropertyDataType Property::d2Value(VariableArray const& /*variable_array*/,
double
const
/*t*/
,
double
const
/*t*/
,
double
const
/*dt*/
)
const
double
const
/*dt*/
)
const
{
{
#ifndef NDEBUG
property_used
=
true
;
#endif
return
0.0
;
return
0.0
;
}
}
...
...
This diff is collapsed.
Click to expand it.
MaterialLib/MPL/Property.h
+
35
−
0
View file @
eb009012
...
@@ -44,7 +44,21 @@ PropertyDataType fromVector(std::vector<double> const& values);
...
@@ -44,7 +44,21 @@ PropertyDataType fromVector(std::vector<double> const& values);
class
Property
class
Property
{
{
public:
public:
#ifndef NDEBUG
virtual
~
Property
()
{
if
(
property_used
)
{
DBUG
(
"Property is used: '{:s}'"
,
description
());
}
else
{
WARN
(
"Property is not used: '{:s}'"
,
description
());
}
}
#else
virtual
~
Property
()
=
default
;
virtual
~
Property
()
=
default
;
#endif
/// Returns the initial (or reference) value of the property.
/// Returns the initial (or reference) value of the property.
/// The default implementation forwards to the value function.
/// The default implementation forwards to the value function.
...
@@ -120,6 +134,9 @@ public:
...
@@ -120,6 +134,9 @@ public:
{
{
try
try
{
{
#ifndef NDEBUG
property_used
=
true
;
#endif
return
std
::
get
<
T
>
(
value
());
return
std
::
get
<
T
>
(
value
());
}
}
catch
(
std
::
bad_variant_access
const
&
)
catch
(
std
::
bad_variant_access
const
&
)
...
@@ -141,6 +158,9 @@ public:
...
@@ -141,6 +158,9 @@ public:
{
{
try
try
{
{
#ifndef NDEBUG
property_used
=
true
;
#endif
return
std
::
get
<
T
>
(
return
std
::
get
<
T
>
(
value
(
variable_array
,
variable_array_prev
,
pos
,
t
,
dt
));
value
(
variable_array
,
variable_array_prev
,
pos
,
t
,
dt
));
}
}
...
@@ -163,6 +183,9 @@ public:
...
@@ -163,6 +183,9 @@ public:
{
{
try
try
{
{
#ifndef NDEBUG
property_used
=
true
;
#endif
return
std
::
get
<
T
>
(
value
(
variable_array
,
pos
,
t
,
dt
));
return
std
::
get
<
T
>
(
value
(
variable_array
,
pos
,
t
,
dt
));
}
}
catch
(
std
::
bad_variant_access
const
&
)
catch
(
std
::
bad_variant_access
const
&
)
...
@@ -185,6 +208,9 @@ public:
...
@@ -185,6 +208,9 @@ public:
{
{
try
try
{
{
#ifndef NDEBUG
property_used
=
true
;
#endif
return
std
::
get
<
T
>
(
dValue
(
variable_array
,
variable_array_prev
,
return
std
::
get
<
T
>
(
dValue
(
variable_array
,
variable_array_prev
,
variable
,
pos
,
t
,
dt
));
variable
,
pos
,
t
,
dt
));
}
}
...
@@ -206,6 +232,9 @@ public:
...
@@ -206,6 +232,9 @@ public:
{
{
try
try
{
{
#ifndef NDEBUG
property_used
=
true
;
#endif
return
std
::
get
<
T
>
(
dValue
(
variable_array
,
variable
,
pos
,
t
,
dt
));
return
std
::
get
<
T
>
(
dValue
(
variable_array
,
variable
,
pos
,
t
,
dt
));
}
}
catch
(
std
::
bad_variant_access
const
&
)
catch
(
std
::
bad_variant_access
const
&
)
...
@@ -227,6 +256,9 @@ public:
...
@@ -227,6 +256,9 @@ public:
{
{
try
try
{
{
#ifndef NDEBUG
property_used
=
true
;
#endif
return
std
::
get
<
T
>
(
return
std
::
get
<
T
>
(
d2Value
(
variable_array
,
variable1
,
variable2
,
pos
,
t
,
dt
));
d2Value
(
variable_array
,
variable1
,
variable2
,
pos
,
t
,
dt
));
}
}
...
@@ -260,6 +292,9 @@ private:
...
@@ -260,6 +292,9 @@ private:
// medium, phase or component
// medium, phase or component
}
}
std
::
string
description
()
const
;
std
::
string
description
()
const
;
#ifndef NDEBUG
mutable
bool
property_used
=
false
;
#endif
private
:
private
:
/// Corresponds to the PropertyDataType
/// Corresponds to the PropertyDataType
...
...
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