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
947ef878
Verified
Commit
947ef878
authored
5 years ago
by
Lars Bilke
Browse files
Options
Downloads
Patches
Plain Diff
Refactor std::tmpnam to std::filesystem::temp_directory_path.
Requires gcc 8.
parent
2bc0235f
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/FileIO/CMakeLists.txt
+5
-0
5 additions, 0 deletions
Applications/FileIO/CMakeLists.txt
Applications/FileIO/Legacy/createSurface.cpp
+14
-18
14 additions, 18 deletions
Applications/FileIO/Legacy/createSurface.cpp
web/data/versions.json
+1
-1
1 addition, 1 deletion
web/data/versions.json
with
20 additions
and
19 deletions
Applications/FileIO/CMakeLists.txt
+
5
−
0
View file @
947ef878
...
@@ -32,6 +32,11 @@ target_link_libraries(ApplicationsFileIO
...
@@ -32,6 +32,11 @@ target_link_libraries(ApplicationsFileIO
logog
logog
PRIVATE MeshLib GitInfoLib
)
PRIVATE MeshLib GitInfoLib
)
# std::filesystem is available on gcc 8 by linking to stdc++fs
if
(
COMPILER_IS_GCC AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9
)
target_link_libraries
(
ApplicationsFileIO PUBLIC stdc++fs
)
endif
()
if
(
OGS_BUILD_GUI
)
if
(
OGS_BUILD_GUI
)
# Needed for the XmlPrjInterface, which links the DE/Base/OGSError.h.
# Needed for the XmlPrjInterface, which links the DE/Base/OGSError.h.
target_link_libraries
(
ApplicationsFileIO PUBLIC QtBase
)
target_link_libraries
(
ApplicationsFileIO PUBLIC QtBase
)
...
...
This diff is collapsed.
Click to expand it.
Applications/FileIO/Legacy/createSurface.cpp
+
14
−
18
View file @
947ef878
...
@@ -11,6 +11,8 @@
...
@@ -11,6 +11,8 @@
#include
<cstdio>
#include
<cstdio>
#include
<list>
#include
<list>
#include
<memory>
#include
<memory>
#include
<filesystem>
namespace
fs
=
std
::
filesystem
;
#include
<logog/include/logog.hpp>
#include
<logog/include/logog.hpp>
...
@@ -77,20 +79,18 @@ bool createSurface(GeoLib::Polyline const& ply,
...
@@ -77,20 +79,18 @@ bool createSurface(GeoLib::Polyline const& ply,
0.0
,
0
,
geo_names
,
false
,
false
);
0.0
,
0
,
geo_names
,
false
,
false
);
gmsh_io
.
setPrecision
(
std
::
numeric_limits
<
double
>::
digits10
);
gmsh_io
.
setPrecision
(
std
::
numeric_limits
<
double
>::
digits10
);
char
file_base_name_c
[
L_tmpnam
];
// fs::path const temp_dir = fs::temp_directory_path();
if
(
!
std
::
tmpnam
(
file_base_name_c
))
auto
geo_file
=
fs
::
temp_directory_path
()
/=
"createSurface.geo"
;
{
auto
msh_file
=
fs
::
temp_directory_path
()
/=
"createSurface.msh"
;
OGS_FATAL
(
"Could not create unique file name."
);
}
gmsh_io
.
writeToFile
(
geo_file
.
string
());
std
::
string
const
file_base_name
(
file_base_name_c
);
gmsh_io
.
writeToFile
(
file_base_name
+
".geo"
);
std
::
string
gmsh_command
=
gmsh_binary
+
" -2 -algo meshadapt
\"
"
+
file_base_name
+
".geo
\"
"
;
gmsh_command
+=
" -o
\"
"
+
file_base_name
+
".msh
\"
"
;
// Newer gmsh versions write a newer file format for meshes per default. At
// Newer gmsh versions write a newer file format for meshes per default. At
// the moment we can't read this new format. This is a switch for gmsh to
// the moment we can't read this new format. This is a switch for gmsh to
// write the 'old' file format.
// write the 'old' file format.
gmsh_command
+=
" -format msh22"
;
std
::
string
gmsh_command
=
gmsh_binary
+
" -2 -algo meshadapt -format msh22 -o "
+
msh_file
.
string
()
+
" "
+
geo_file
.
string
();
int
const
gmsh_return_value
=
std
::
system
(
gmsh_command
.
c_str
());
int
const
gmsh_return_value
=
std
::
system
(
gmsh_command
.
c_str
());
if
(
gmsh_return_value
!=
0
)
if
(
gmsh_return_value
!=
0
)
{
{
...
@@ -98,18 +98,14 @@ bool createSurface(GeoLib::Polyline const& ply,
...
@@ -98,18 +98,14 @@ bool createSurface(GeoLib::Polyline const& ply,
gmsh_return_value
);
gmsh_return_value
);
}
}
auto
surface_mesh
=
auto
surface_mesh
=
FileIO
::
GMSH
::
readGMSHMesh
(
"
\"
"
+
file_base_name
+
".msh
\"
"
);
FileIO
::
GMSH
::
readGMSHMesh
(
msh_file
.
string
()
);
if
(
!
surface_mesh
)
if
(
!
surface_mesh
)
{
{
WARN
(
"The surface mesh could not be created."
);
WARN
(
"The surface mesh could not be created."
);
return
false
;
return
false
;
}
}
if
(
std
::
remove
((
file_base_name
+
".geo"
).
c_str
())
!=
0
)
if
(
!
(
fs
::
remove
(
geo_file
)
&&
fs
::
remove
(
msh_file
)))
WARN
(
"Could not remove temporary file '%s'."
,
WARN
(
"Could not remove temporary files in createSurface."
);
(
file_base_name
+
".geo"
).
c_str
());
if
(
std
::
remove
((
file_base_name
+
".msh"
).
c_str
())
!=
0
)
WARN
(
"Could not remove temporary file '%s'."
,
(
file_base_name
+
".msh"
).
c_str
());
// convert the surface mesh into a geometric surface
// convert the surface mesh into a geometric surface
if
(
!
MeshLib
::
convertMeshToGeo
(
*
surface_mesh
,
geometries
,
if
(
!
MeshLib
::
convertMeshToGeo
(
*
surface_mesh
,
geometries
,
...
...
This diff is collapsed.
Click to expand it.
web/data/versions.json
+
1
−
1
View file @
947ef878
{
{
"minimum_version"
:
{
"minimum_version"
:
{
"gcc"
:
"
7.3
"
,
"gcc"
:
"
8.0
"
,
"clang"
:
"3.5"
,
"clang"
:
"3.5"
,
"msvc"
:
{
"msvc"
:
{
"year"
:
"2017"
,
"year"
:
"2017"
,
...
...
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