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
Karsten Rink
ogs
Commits
02a78fca
Commit
02a78fca
authored
9 years ago
by
Dmitri Naumov
Browse files
Options
Downloads
Patches
Plain Diff
[AL] Add parsing of parameters in ProjectData.
parent
535b3673
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
Applications/ApplicationsLib/ProjectData.cpp
+52
-0
52 additions, 0 deletions
Applications/ApplicationsLib/ProjectData.cpp
Applications/ApplicationsLib/ProjectData.h
+8
-0
8 additions, 0 deletions
Applications/ApplicationsLib/ProjectData.h
with
60 additions
and
0 deletions
Applications/ApplicationsLib/ProjectData.cpp
+
52
−
0
View file @
02a78fca
...
...
@@ -61,6 +61,9 @@ ProjectData::ProjectData(ConfigTree const& project_config,
// process variables
parseProcessVariables
(
project_config
.
get_child
(
"process_variables"
));
// parameters
parseParameters
(
project_config
.
get_child
(
"parameters"
));
// processes
parseProcesses
(
project_config
.
get_child
(
"processes"
));
...
...
@@ -190,6 +193,55 @@ void ProjectData::parseProcessVariables(
}
}
void
ProjectData
::
parseParameters
(
ConfigTree
const
&
parameters_config
)
{
using
namespace
ProcessLib
;
DBUG
(
"Reading parameters:"
);
for
(
auto
pc_it
:
parameters_config
)
{
// Skip non-parameter section.
if
(
pc_it
.
first
!=
"parameter"
)
continue
;
ConfigTree
const
&
parameter_config
=
pc_it
.
second
;
auto
name
=
parameter_config
.
get_optional
<
std
::
string
>
(
"name"
);
if
(
!
name
)
{
ERR
(
"The parameter config does not provide a name tag."
);
std
::
abort
();
}
auto
type
=
parameter_config
.
get_optional
<
std
::
string
>
(
"type"
);
if
(
!
type
)
{
ERR
(
"Could not find required parameter type."
);
std
::
abort
();
}
// Create parameter based on the provided type.
if
(
*
type
==
"Constant"
)
{
INFO
(
"ConstantParameter: %s."
,
name
->
c_str
());
_parameters
.
push_back
(
createConstParameter
(
parameter_config
));
_parameters
.
back
()
->
name
=
*
name
;
}
else
if
(
*
type
==
"MeshProperty"
)
{
INFO
(
"MeshPropertyParameter: %s"
,
name
->
c_str
());
_parameters
.
push_back
(
createMeshPropertyParameter
(
parameter_config
,
*
_mesh_vec
[
0
]));
_parameters
.
back
()
->
name
=
*
name
;
}
else
{
ERR
(
"Cannot construct property of given type
\'
%s
\'
."
,
type
->
c_str
());
std
::
abort
();
}
}
}
void
ProjectData
::
parseProcesses
(
ConfigTree
const
&
processes_config
)
{
DBUG
(
"Reading processes:"
);
...
...
This diff is collapsed.
Click to expand it.
Applications/ApplicationsLib/ProjectData.h
+
8
−
0
View file @
02a78fca
...
...
@@ -13,6 +13,7 @@
#ifndef PROJECTDATA_H_
#define PROJECTDATA_H_
#include
<memory>
#include
<boost/property_tree/ptree.hpp>
#ifdef OGS_BUILD_GUI
...
...
@@ -144,6 +145,10 @@ private:
/// variable constructor.
void
parseProcessVariables
(
ConfigTree
const
&
process_variables_config
);
/// Parses the parameters configuration and saves them in a list.
/// Checks if a parameter has name tag.
void
parseParameters
(
ConfigTree
const
&
parameters_config
);
/// Parses the processes configuration and creates new processes for each
/// process entry passing the corresponding subtree to the process
/// constructor.
...
...
@@ -166,6 +171,9 @@ private:
/// Buffer for each process' config used in the process building function.
std
::
vector
<
ConfigTree
>
_process_configs
;
/// Buffer for each parameter config passed to the process.
std
::
vector
<
std
::
unique_ptr
<
ProcessLib
::
ParameterBase
>>
_parameters
;
/// Output file path with project prefix.
std
::
string
_output_file_prefix
;
};
...
...
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