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
8727f20f
Commit
8727f20f
authored
5 years ago
by
Florian Zill
Browse files
Options
Downloads
Patches
Plain Diff
[AppL] a medium can refer to multiple material IDs
changed media map to shared pointer
parent
b0918eb6
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
+30
-10
30 additions, 10 deletions
Applications/ApplicationsLib/ProjectData.cpp
Applications/ApplicationsLib/ProjectData.h
+1
-1
1 addition, 1 deletion
Applications/ApplicationsLib/ProjectData.h
with
31 additions
and
11 deletions
Applications/ApplicationsLib/ProjectData.cpp
+
30
−
10
View file @
8727f20f
...
@@ -14,6 +14,8 @@
...
@@ -14,6 +14,8 @@
#include
"ProjectData.h"
#include
"ProjectData.h"
#include
<algorithm>
#include
<algorithm>
#include
<boost/algorithm/string.hpp>
#include
<boost/algorithm/cxx11/all_of.hpp>
#include
<set>
#include
<set>
#include
<logog/include/logog.hpp>
#include
<logog/include/logog.hpp>
...
@@ -448,19 +450,37 @@ void ProjectData::parseMedia(
...
@@ -448,19 +450,37 @@ void ProjectData::parseMedia(
media_config
->
getConfigSubtreeList
(
"medium"
))
media_config
->
getConfigSubtreeList
(
"medium"
))
{
{
//! \ogs_file_attr{prj__media__medium__id}
//! \ogs_file_attr{prj__media__medium__id}
auto
const
material_id
=
medium_config
.
getConfigAttribute
<
int
>
(
"id"
,
0
);
auto
material_id_string
=
medium_config
.
getConfigAttribute
<
std
::
string
>
(
"id"
,
"0"
);
std
::
vector
<
std
::
string
>
material_ids
;
boost
::
algorithm
::
erase_all
(
material_id_string
,
" "
);
boost
::
split
(
material_ids
,
material_id_string
,
boost
::
is_any_of
(
","
));
if
(
_media
.
find
(
material_id
)
!=
_media
.
end
()
)
for
(
auto
const
&
m_id
:
material_ids
)
{
{
OGS_FATAL
(
if
(
!
boost
::
algorithm
::
all_of
(
m_id
,
boost
::
algorithm
::
is_digit
()))
"Multiple media were specified for the same material id %d. "
{
"Keep in mind, that if no material id is specified, it is "
OGS_FATAL
(
"assumed to be 0 by default."
,
"Could not parse material ID's from '%s'. Please separate "
material_id
);
"multiple material ID's by comma only. Invalid character: "
}
"%c"
,
material_id_string
.
c_str
(),
m_id
[
m_id
.
find_first_not_of
(
"0123456789"
)]);
}
if
(
_media
.
find
(
std
::
stoi
(
m_id
))
!=
_media
.
end
())
{
OGS_FATAL
(
"Multiple media were specified for the same material id "
"%d. "
"Keep in mind, that if no material id is specified, it is "
"assumed to be 0 by default."
,
m_id
.
c_str
());
}
_media
[
material_id
]
=
_media
[
std
::
stoi
(
m_id
)]
=
(
m_id
==
material_ids
[
0
])
MaterialPropertyLib
::
createMedium
(
medium_config
,
_parameters
);
?
MaterialPropertyLib
::
createMedium
(
medium_config
,
_parameters
)
:
_media
[
std
::
stoi
(
material_ids
[
0
])];
}
}
}
if
(
_media
.
empty
())
if
(
_media
.
empty
())
...
...
This diff is collapsed.
Click to expand it.
Applications/ApplicationsLib/ProjectData.h
+
1
−
1
View file @
8727f20f
...
@@ -125,7 +125,7 @@ private:
...
@@ -125,7 +125,7 @@ private:
boost
::
optional
<
ParameterLib
::
CoordinateSystem
>
_local_coordinate_system
;
boost
::
optional
<
ParameterLib
::
CoordinateSystem
>
_local_coordinate_system
;
std
::
map
<
int
,
std
::
unique
_ptr
<
MaterialPropertyLib
::
Medium
>>
_media
;
std
::
map
<
int
,
std
::
shared
_ptr
<
MaterialPropertyLib
::
Medium
>>
_media
;
/// The time loop used to solve this project's processes.
/// The time loop used to solve this project's processes.
std
::
unique_ptr
<
ProcessLib
::
TimeLoop
>
_time_loop
;
std
::
unique_ptr
<
ProcessLib
::
TimeLoop
>
_time_loop
;
...
...
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