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
a5d7f4a6
Verified
Commit
a5d7f4a6
authored
5 years ago
by
Lars Bilke
Browse files
Options
Downloads
Patches
Plain Diff
[FileIO] Write to random files in createSurface.
parent
3d4a8394
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/Legacy/createSurface.cpp
+5
-3
5 additions, 3 deletions
Applications/FileIO/Legacy/createSurface.cpp
BaseLib/StringTools.cpp
+17
-0
17 additions, 0 deletions
BaseLib/StringTools.cpp
BaseLib/StringTools.h
+3
-0
3 additions, 0 deletions
BaseLib/StringTools.h
with
25 additions
and
3 deletions
Applications/FileIO/Legacy/createSurface.cpp
+
5
−
3
View file @
a5d7f4a6
...
@@ -20,6 +20,8 @@
...
@@ -20,6 +20,8 @@
#include
"Applications/FileIO/Gmsh/GMSHInterface.h"
#include
"Applications/FileIO/Gmsh/GMSHInterface.h"
#include
"Applications/FileIO/Gmsh/GmshReader.h"
#include
"Applications/FileIO/Gmsh/GmshReader.h"
#include
"BaseLib/StringTools.h"
#include
"GeoLib/GEOObjects.h"
#include
"GeoLib/GEOObjects.h"
#include
"GeoLib/Point.h"
#include
"GeoLib/Point.h"
#include
"GeoLib/Polygon.h"
#include
"GeoLib/Polygon.h"
...
@@ -78,9 +80,9 @@ bool createSurface(GeoLib::Polyline const& ply,
...
@@ -78,9 +80,9 @@ 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
);
//
fs::path const temp_dir = fs::
temp
_
directory
_path();
//
write to random file in
temp
directory
auto
geo_file
=
fs
::
temp_directory_path
()
/=
"createSurface.geo"
;
auto
geo_file
=
fs
::
temp_directory_path
()
/=
BaseLib
::
random_string
(
32
)
;
auto
msh_file
=
fs
::
temp_directory_path
()
/=
"createSurface.msh"
;
auto
msh_file
=
fs
::
temp_directory_path
()
/=
BaseLib
::
random_string
(
32
)
;
gmsh_io
.
writeToFile
(
geo_file
.
string
());
gmsh_io
.
writeToFile
(
geo_file
.
string
());
// 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
...
...
This diff is collapsed.
Click to expand it.
BaseLib/StringTools.cpp
+
17
−
0
View file @
a5d7f4a6
...
@@ -104,4 +104,21 @@ std::string format(const char* format_str, ... )
...
@@ -104,4 +104,21 @@ std::string format(const char* format_str, ... )
return
std
::
string
(
buffer
.
data
());
return
std
::
string
(
buffer
.
data
());
}
}
std
::
string
random_string
(
size_t
length
)
{
auto
randchar
=
[]()
->
char
{
const
char
charset
[]
=
"0123456789"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz"
;
const
size_t
max_index
=
(
sizeof
(
charset
)
-
1
);
return
charset
[
rand
()
%
max_index
];
};
std
::
string
str
(
length
,
0
);
std
::
generate_n
(
str
.
begin
(),
length
,
randchar
);
return
str
;
}
}
// end namespace BaseLib
}
// end namespace BaseLib
This diff is collapsed.
Click to expand it.
BaseLib/StringTools.h
+
3
−
0
View file @
a5d7f4a6
...
@@ -83,4 +83,7 @@ std::string const& tostring(std::string const& value);
...
@@ -83,4 +83,7 @@ std::string const& tostring(std::string const& value);
//! returns printf-like formatted string
//! returns printf-like formatted string
std
::
string
format
(
const
char
*
format_string
,
...
);
std
::
string
format
(
const
char
*
format_string
,
...
);
//! Returns a random string of the given length containing just a-z,A-Z,0-9
std
::
string
random_string
(
size_t
length
);
}
// end namespace BaseLib
}
// end namespace BaseLib
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