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
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
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
Mojtaba Abdolkhani
ogs
Commits
2039bc4e
Commit
2039bc4e
authored
8 years ago
by
Christoph Lehmann
Browse files
Options
Downloads
Patches
Plain Diff
[PL] number of components of parameters must be specified
parent
ce69acae
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
ProcessLib/GroundwaterFlow/CreateGroundwaterFlowProcess.cpp
+1
-1
1 addition, 1 deletion
ProcessLib/GroundwaterFlow/CreateGroundwaterFlowProcess.cpp
ProcessLib/Process.h
+15
-4
15 additions, 4 deletions
ProcessLib/Process.h
with
16 additions
and
5 deletions
ProcessLib/GroundwaterFlow/CreateGroundwaterFlowProcess.cpp
+
1
−
1
View file @
2039bc4e
...
@@ -42,7 +42,7 @@ std::unique_ptr<Process> createGroundwaterFlowProcess(
...
@@ -42,7 +42,7 @@ std::unique_ptr<Process> createGroundwaterFlowProcess(
config
,
config
,
//! \ogs_file_param_special{process__GROUNDWATER_FLOW__hydraulic_conductivity}
//! \ogs_file_param_special{process__GROUNDWATER_FLOW__hydraulic_conductivity}
"hydraulic_conductivity"
,
"hydraulic_conductivity"
,
parameters
);
parameters
,
1
);
DBUG
(
"Use
\'
%s
\'
as hydraulic conductivity parameter."
,
DBUG
(
"Use
\'
%s
\'
as hydraulic conductivity parameter."
,
hydraulic_conductivity
.
name
.
c_str
());
hydraulic_conductivity
.
name
.
c_str
());
...
...
This diff is collapsed.
Click to expand it.
ProcessLib/Process.h
+
15
−
4
View file @
2039bc4e
...
@@ -215,6 +215,7 @@ std::vector<std::reference_wrapper<ProcessVariable>> findProcessVariables(
...
@@ -215,6 +215,7 @@ std::vector<std::reference_wrapper<ProcessVariable>> findProcessVariables(
/// Find a parameter of specific type for a name given in the process
/// Find a parameter of specific type for a name given in the process
/// configuration under the tag.
/// configuration under the tag.
/// The parameter must have the specified number of components.
/// In the process config a parameter is referenced by a name. For example it
/// In the process config a parameter is referenced by a name. For example it
/// will be looking for a parameter named "K" in the list of parameters
/// will be looking for a parameter named "K" in the list of parameters
/// when the tag is "hydraulic_conductivity":
/// when the tag is "hydraulic_conductivity":
...
@@ -229,7 +230,8 @@ std::vector<std::reference_wrapper<ProcessVariable>> findProcessVariables(
...
@@ -229,7 +230,8 @@ std::vector<std::reference_wrapper<ProcessVariable>> findProcessVariables(
template
<
typename
ParameterDataType
>
template
<
typename
ParameterDataType
>
Parameter
<
ParameterDataType
>&
findParameter
(
Parameter
<
ParameterDataType
>&
findParameter
(
BaseLib
::
ConfigTree
const
&
process_config
,
std
::
string
const
&
tag
,
BaseLib
::
ConfigTree
const
&
process_config
,
std
::
string
const
&
tag
,
std
::
vector
<
std
::
unique_ptr
<
ParameterBase
>>
const
&
parameters
)
std
::
vector
<
std
::
unique_ptr
<
ParameterBase
>>
const
&
parameters
,
unsigned
const
num_components
)
{
{
// Find parameter name in process config.
// Find parameter name in process config.
//! \ogs_file_special
//! \ogs_file_special
...
@@ -244,18 +246,27 @@ Parameter<ParameterDataType>& findParameter(
...
@@ -244,18 +246,27 @@ Parameter<ParameterDataType>& findParameter(
if
(
parameter_it
==
parameters
.
end
())
{
if
(
parameter_it
==
parameters
.
end
())
{
OGS_FATAL
(
OGS_FATAL
(
"Could not find parameter
'
%s' in the provided parameters list for "
"Could not find parameter
`
%s' in the provided parameters list for "
"config tag <%s>."
,
"config tag <%s>."
,
name
.
c_str
(),
tag
.
c_str
());
name
.
c_str
(),
tag
.
c_str
());
}
}
DBUG
(
"Found parameter
\'
%s
\
'
."
,
(
*
parameter_it
)
->
name
.
c_str
());
DBUG
(
"Found parameter
`
%s'."
,
(
*
parameter_it
)
->
name
.
c_str
());
// Check the type correctness of the found parameter.
// Check the type correctness of the found parameter.
auto
*
const
parameter
=
auto
*
const
parameter
=
dynamic_cast
<
Parameter
<
ParameterDataType
>*>
(
parameter_it
->
get
());
dynamic_cast
<
Parameter
<
ParameterDataType
>*>
(
parameter_it
->
get
());
if
(
!
parameter
)
{
if
(
!
parameter
)
{
OGS_FATAL
(
"The read parameter is of incompatible type."
);
OGS_FATAL
(
"The read parameter `%s' is of incompatible type."
,
name
.
c_str
());
}
}
if
(
parameter
->
getNumberOfComponents
()
!=
num_components
)
{
OGS_FATAL
(
"The read parameter `%s' has the wrong number of components (%lu "
"instead of %u)."
,
name
.
c_str
(),
parameter
->
getNumberOfComponents
(),
num_components
);
}
return
*
parameter
;
return
*
parameter
;
}
}
...
...
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