Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
ogs-feliks
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
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
Feliks Kiszkurno
ogs-feliks
Commits
fe177380
Commit
fe177380
authored
6 years ago
by
Dmitri Naumov
Browse files
Options
Downloads
Patches
Plain Diff
Pass domain mesh and meshes to PV construction.
parent
7ff18efb
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Applications/ApplicationsLib/ProjectData.cpp
+53
-27
53 additions, 27 deletions
Applications/ApplicationsLib/ProjectData.cpp
ProcessLib/ProcessVariable.cpp
+2
-2
2 additions, 2 deletions
ProcessLib/ProcessVariable.cpp
ProcessLib/ProcessVariable.h
+1
-0
1 addition, 0 deletions
ProcessLib/ProcessVariable.h
with
56 additions
and
29 deletions
Applications/ApplicationsLib/ProjectData.cpp
+
53
−
27
View file @
fe177380
...
...
@@ -112,6 +112,7 @@ std::unique_ptr<MeshLib::Mesh> readSingleMesh(
{
std
::
string
const
mesh_file
=
BaseLib
::
copyPathToFileName
(
mesh_config_parameter
.
getValue
<
std
::
string
>
(),
project_directory
);
DBUG
(
"Reading mesh file
\'
%s
\'
."
,
mesh_file
.
c_str
());
auto
mesh
=
std
::
unique_ptr
<
MeshLib
::
Mesh
>
(
MeshLib
::
IO
::
readMeshFromFile
(
mesh_file
));
...
...
@@ -137,26 +138,45 @@ std::vector<std::unique_ptr<MeshLib::Mesh>> readMeshes(
{
std
::
vector
<
std
::
unique_ptr
<
MeshLib
::
Mesh
>>
meshes
;
meshes
.
push_back
(
//! \ogs_file_param{prj__meshes}
auto
optional_meshes
=
config
.
getConfigSubtreeOptional
(
"meshes"
);
if
(
optional_meshes
)
{
DBUG
(
"Reading multiple meshes."
);
for
(
auto
mesh_config
:
//! \ogs_file_param{prj__meshes__mesh}
optional_meshes
->
getConfigParameterList
(
"mesh"
))
{
meshes
.
push_back
(
readSingleMesh
(
mesh_config
,
project_directory
));
}
}
else
{
// Read single mesh with geometry.
WARN
(
"Consider switching from mesh and geometry input to multiple "
"meshes input. See "
"https://www.opengeosys.org/docs/tools/model-preparation/"
"constructmeshesfromgeometry/ tool for conversion."
);
//! \ogs_file_param{prj__mesh}
readSingleMesh
(
config
.
getConfigParameter
(
"mesh"
),
project_directory
));
std
::
string
const
geometry_file
=
BaseLib
::
copyPathToFileName
(
//! \ogs_file_param{prj__geometry}
config
.
getConfigParameter
<
std
::
string
>
(
"geometry"
),
project_directory
);
GeoLib
::
GEOObjects
geoObjects
;
readGeometry
(
geometry_file
,
geoObjects
);
std
::
unique_ptr
<
MeshGeoToolsLib
::
SearchLength
>
search_length_algorithm
=
MeshGeoToolsLib
::
createSearchLengthAlgorithm
(
config
,
*
meshes
[
0
]);
auto
additional_meshes
=
MeshGeoToolsLib
::
constructAdditionalMeshesFromGeoObjects
(
geoObjects
,
*
meshes
[
0
],
std
::
move
(
search_length_algorithm
));
std
::
move
(
begin
(
additional_meshes
),
end
(
additional_meshes
),
std
::
back_inserter
(
meshes
));
meshes
.
push_back
(
readSingleMesh
(
config
.
getConfigParameter
(
"mesh"
),
project_directory
));
std
::
string
const
geometry_file
=
BaseLib
::
copyPathToFileName
(
//! \ogs_file_param{prj__geometry}
config
.
getConfigParameter
<
std
::
string
>
(
"geometry"
),
project_directory
);
GeoLib
::
GEOObjects
geoObjects
;
readGeometry
(
geometry_file
,
geoObjects
);
std
::
unique_ptr
<
MeshGeoToolsLib
::
SearchLength
>
search_length_algorithm
=
MeshGeoToolsLib
::
createSearchLengthAlgorithm
(
config
,
*
meshes
[
0
]);
auto
additional_meshes
=
MeshGeoToolsLib
::
constructAdditionalMeshesFromGeoObjects
(
geoObjects
,
*
meshes
[
0
],
std
::
move
(
search_length_algorithm
));
std
::
move
(
begin
(
additional_meshes
),
end
(
additional_meshes
),
std
::
back_inserter
(
meshes
));
}
return
meshes
;
}
}
// namespace
...
...
@@ -215,20 +235,26 @@ void ProjectData::parseProcessVariables(
{
DBUG
(
"Parse process variables:"
);
if
(
_mesh_vec
.
empty
()
||
_mesh_vec
[
0
]
==
nullptr
)
{
ERR
(
"A mesh is required to define process variables."
);
return
;
}
std
::
set
<
std
::
string
>
names
;
for
(
auto
var_config
//! \ogs_file_param{prj__process_variables__process_variable}
:
process_variables_config
.
getConfigSubtreeList
(
"process_variable"
))
{
auto
pv
=
ProcessLib
::
ProcessVariable
{
var_config
,
_mesh_vec
,
_parameters
};
// Either the mesh name is given, or the first mesh's name will be
// taken. Taking the first mesh's value is deprecated.
auto
const
mesh_name
=
//! \ogs_file_param{prj__process_variables__process_variable__mesh}
var_config
.
getConfigParameter
<
std
::
string
>
(
"mesh"
,
_mesh_vec
[
0
]
->
getName
());
auto
&
mesh
=
*
BaseLib
::
findElementOrError
(
begin
(
_mesh_vec
),
end
(
_mesh_vec
),
[
&
mesh_name
](
auto
const
&
m
)
{
return
m
->
getName
()
==
mesh_name
;
},
"Expected to find a mesh named "
+
mesh_name
+
"."
);
auto
pv
=
ProcessLib
::
ProcessVariable
{
var_config
,
mesh
,
_mesh_vec
,
_parameters
};
if
(
!
names
.
insert
(
pv
.
getName
()).
second
)
OGS_FATAL
(
"A process variable with name `%s' already exists."
,
pv
.
getName
().
c_str
());
...
...
This diff is collapsed.
Click to expand it.
ProcessLib/ProcessVariable.cpp
+
2
−
2
View file @
fe177380
...
...
@@ -23,12 +23,12 @@ namespace ProcessLib
{
ProcessVariable
::
ProcessVariable
(
BaseLib
::
ConfigTree
const
&
config
,
MeshLib
::
Mesh
&
mesh
,
std
::
vector
<
std
::
unique_ptr
<
MeshLib
::
Mesh
>>
const
&
meshes
,
std
::
vector
<
std
::
unique_ptr
<
ParameterBase
>>
const
&
parameters
)
:
//! \ogs_file_param{prj__process_variables__process_variable__name}
_name
(
config
.
getConfigParameter
<
std
::
string
>
(
"name"
)),
_mesh
(
*
meshes
[
0
]),
// Using the first mesh as the main mesh.
// TODO (naumov) potentially extend to named meshes.
_mesh
(
mesh
),
//! \ogs_file_param{prj__process_variables__process_variable__components}
_n_components
(
config
.
getConfigParameter
<
int
>
(
"components"
)),
//! \ogs_file_param{prj__process_variables__process_variable__order}
...
...
This diff is collapsed.
Click to expand it.
ProcessLib/ProcessVariable.h
+
1
−
0
View file @
fe177380
...
...
@@ -39,6 +39,7 @@ class ProcessVariable
public:
ProcessVariable
(
BaseLib
::
ConfigTree
const
&
config
,
MeshLib
::
Mesh
&
mesh
,
std
::
vector
<
std
::
unique_ptr
<
MeshLib
::
Mesh
>>
const
&
meshes
,
std
::
vector
<
std
::
unique_ptr
<
ParameterBase
>>
const
&
parameters
);
...
...
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