Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
gmsh
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Larry Price
gmsh
Commits
816f1fa3
Commit
816f1fa3
authored
Oct 11, 2012
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
enable auto load of onelab.db + archival of db+output files in archive/ subdir
parent
2ab61a3a
No related branches found
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
Common/DefaultOptions.h
+1
-1
1 addition, 1 deletion
Common/DefaultOptions.h
Common/OS.cpp
+12
-0
12 additions, 0 deletions
Common/OS.cpp
Common/OS.h
+1
-0
1 addition, 0 deletions
Common/OS.h
Fltk/onelabWindow.cpp
+27
-16
27 additions, 16 deletions
Fltk/onelabWindow.cpp
with
41 additions
and
17 deletions
Common/DefaultOptions.h
+
1
−
1
View file @
816f1fa3
...
...
@@ -1108,7 +1108,7 @@ StringXNumber SolverOptions_Number[] = {
"Always listen to incoming connection requests?"
},
{
F
|
O
,
"AutoArchiveSolutions"
,
opt_solver_auto_archive_solutions
,
0
.
,
"Automatically archive solutions after each computation"
},
{
F
|
O
,
"AutoSaveDatabase"
,
opt_solver_auto_save_database
,
0
.
,
{
F
|
O
,
"AutoSaveDatabase"
,
opt_solver_auto_save_database
,
1
.
,
"Automatically save database after each computation"
},
{
F
|
O
,
"AutoMesh"
,
opt_solver_auto_mesh
,
1
.
,
"Automatically mesh if necesssary"
},
...
...
This diff is collapsed.
Click to expand it.
Common/OS.cpp
+
12
−
0
View file @
816f1fa3
...
...
@@ -161,6 +161,18 @@ int StatFile(const std::string &fileName)
#endif
}
int
CreateDirectory
(
const
std
::
string
&
dirName
)
{
#if !defined(WIN32) || defined(__CYGWIN__)
if
(
mkdir
(
dirName
.
c_str
(),
0777
))
return
0
;
#else
if
(
_mkdir
(
dirName
.
c_str
()))
return
0
;
#endif
return
1
;
}
int
KillProcess
(
int
pid
)
{
#if !defined(WIN32) || defined(__CYGWIN__)
...
...
This diff is collapsed.
Click to expand it.
Common/OS.h
+
1
−
0
View file @
816f1fa3
...
...
@@ -19,6 +19,7 @@ std::string GetHostName();
int
UnlinkFile
(
const
std
::
string
&
fileName
);
int
StatFile
(
const
std
::
string
&
fileName
);
int
KillProcess
(
int
pid
);
int
CreateDirectory
(
const
std
::
string
&
dirName
);
int
SystemCall
(
const
std
::
string
&
command
,
bool
blocking
=
false
);
#endif
This diff is collapsed.
Click to expand it.
Fltk/onelabWindow.cpp
+
27
−
16
View file @
816f1fa3
...
...
@@ -396,8 +396,19 @@ static std::string timeStamp()
return
std
::
string
(
stamp
);
}
static
void
archiveSolutions
(
const
std
::
string
&
timeSt
am
p
)
static
void
saveDb
(
const
std
::
string
&
fileN
am
e
)
{
Msg
::
StatusBar
(
2
,
true
,
"Saving database '%s'..."
,
fileName
.
c_str
());
if
(
onelab
::
server
::
instance
()
->
toFile
(
fileName
))
Msg
::
StatusBar
(
2
,
true
,
"Done saving database '%s'"
,
fileName
.
c_str
());
else
Msg
::
Error
(
"Could not save database '%s'"
,
fileName
.
c_str
());
}
static
void
archiveSolutions
(
const
std
::
string
&
fileName
)
{
std
::
string
stamp
=
timeStamp
();
// add time stamp in all output files in the db, and rename them on disk
std
::
vector
<
onelab
::
string
>
strings
;
onelab
::
server
::
instance
()
->
get
(
strings
);
...
...
@@ -411,7 +422,8 @@ static void archiveSolutions(const std::string &timeStamp)
if
(
n
<
18
||
split
[
1
][
n
-
3
]
!=
'-'
||
split
[
1
][
n
-
6
]
!=
'-'
||
split
[
1
][
n
-
9
]
!=
'_'
){
std
::
string
old
=
names
[
j
];
names
[
j
]
=
split
[
0
]
+
split
[
1
]
+
timeStamp
+
split
[
2
];
CreateDirectory
(
split
[
0
]
+
"archive/"
);
names
[
j
]
=
split
[
0
]
+
"archive/"
+
split
[
1
]
+
stamp
+
split
[
2
];
Msg
::
Info
(
"Renaming '%s' into '%s'"
,
old
.
c_str
(),
names
[
j
].
c_str
());
rename
(
old
.
c_str
(),
names
[
j
].
c_str
());
}
...
...
@@ -421,18 +433,15 @@ static void archiveSolutions(const std::string &timeStamp)
onelab
::
server
::
instance
()
->
set
(
strings
[
i
]);
}
}
FlGui
::
instance
()
->
onelab
->
rebuildTree
();
}
static
void
saveDb
(
const
std
::
string
&
fileName
,
const
std
::
string
&
timeStamp
=
""
)
// save stamped db
{
std
::
vector
<
std
::
string
>
split
=
SplitFileName
(
fileName
);
std
::
string
name
=
split
[
0
]
+
split
[
1
]
+
timeStamp
+
split
[
2
];
Msg
::
StatusBar
(
2
,
true
,
"Saving database '%s'..."
,
name
.
c_str
());
if
(
onelab
::
server
::
instance
()
->
toFile
(
name
))
Msg
::
StatusBar
(
2
,
true
,
"Done saving database '%s'"
,
name
.
c_str
());
else
Msg
::
Error
(
"Could not save database '%s'"
,
name
.
c_str
());
CreateDirectory
(
split
[
0
]
+
"archive/"
);
saveDb
(
split
[
0
]
+
"archive/"
+
split
[
1
]
+
stamp
+
split
[
2
]);
}
FlGui
::
instance
()
->
onelab
->
rebuildTree
();
}
static
void
loadDb
(
const
std
::
string
&
name
)
...
...
@@ -582,9 +591,8 @@ void onelab_cb(Fl_Widget *w, void *data)
if
(
action
==
"compute"
&&
(
CTX
::
instance
()
->
solver
.
autoSaveDatabase
||
CTX
::
instance
()
->
solver
.
autoArchiveSolutions
)){
std
::
string
db
=
SplitFileName
(
GModel
::
current
()
->
getFileName
())[
0
]
+
"onelab.db"
;
std
::
string
stamp
=
timeStamp
();
if
(
CTX
::
instance
()
->
solver
.
autoArchiveSolutions
)
archiveSolutions
(
stamp
);
if
(
CTX
::
instance
()
->
solver
.
autoSaveDatabase
)
saveDb
(
db
,
stamp
);
if
(
CTX
::
instance
()
->
solver
.
autoArchiveSolutions
)
archiveSolutions
(
db
);
if
(
CTX
::
instance
()
->
solver
.
autoSaveDatabase
)
saveDb
(
db
);
}
FlGui
::
instance
()
->
onelab
->
stop
(
false
);
...
...
@@ -1297,6 +1305,9 @@ void solver_cb(Fl_Widget *w, void *data)
else
FlGui
::
instance
()
->
onelab
->
rebuildSolverList
();
std
::
string
db
=
SplitFileName
(
GModel
::
current
()
->
getFileName
())[
0
]
+
"onelab.db"
;
if
(
!
StatFile
(
db
))
loadDb
(
db
);
if
(
FlGui
::
instance
()
->
onelab
->
isBusy
())
FlGui
::
instance
()
->
onelab
->
show
();
else
...
...
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