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
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Larry Price
gmsh
Commits
2795e213
Commit
2795e213
authored
12 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
more refactoring
parent
2c89bb93
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Common/onelabUtils.cpp
+60
-0
60 additions, 0 deletions
Common/onelabUtils.cpp
Common/onelabUtils.h
+1
-0
1 addition, 0 deletions
Common/onelabUtils.h
Fltk/onelabWindow.cpp
+9
-57
9 additions, 57 deletions
Fltk/onelabWindow.cpp
with
70 additions
and
57 deletions
Common/onelabUtils.cpp
+
60
−
0
View file @
2795e213
...
...
@@ -10,6 +10,8 @@
#include
"GmshDefines.h"
#include
"GModel.h"
#include
"Context.h"
#include
"OS.h"
#include
"OpenFile.h"
#include
"CreateFile.h"
#include
"StringUtils.h"
#include
"onelabUtils.h"
...
...
@@ -258,6 +260,64 @@ namespace onelabUtils {
return
changed
;
}
bool
runGmshClient
(
const
std
::
string
&
action
,
bool
meshAuto
)
{
bool
redraw
=
false
;
onelab
::
server
::
citer
it
=
onelab
::
server
::
instance
()
->
findClient
(
"Gmsh"
);
if
(
it
==
onelab
::
server
::
instance
()
->
lastClient
())
return
redraw
;
onelab
::
client
*
c
=
it
->
second
;
std
::
string
mshFileName
=
onelabUtils
::
getMshFileName
(
c
);
if
(
action
==
"initialize"
)
return
redraw
;
static
std
::
string
modelName
=
""
;
if
(
modelName
.
empty
()){
// first pass is special to prevent model reload, as well as
// remeshing if a mesh file already exists on disk
modelName
=
GModel
::
current
()
->
getName
();
if
(
!
StatFile
(
mshFileName
))
onelab
::
server
::
instance
()
->
setChanged
(
false
,
"Gmsh"
);
}
if
(
action
==
"check"
){
if
(
onelab
::
server
::
instance
()
->
getChanged
(
"Gmsh"
)
||
modelName
!=
GModel
::
current
()
->
getName
()){
// reload geometry if Gmsh parameters have been modified or if
// the model name has changed
modelName
=
GModel
::
current
()
->
getName
();
redraw
=
true
;
OpenProject
(
GModel
::
current
()
->
getFileName
());
}
}
else
if
(
action
==
"compute"
){
if
(
onelab
::
server
::
instance
()
->
getChanged
(
"Gmsh"
)
||
modelName
!=
GModel
::
current
()
->
getName
()){
// reload the geometry, mesh it and save the mesh if Gmsh
// parameters have been modified or if the model name has
// changed
modelName
=
GModel
::
current
()
->
getName
();
redraw
=
true
;
OpenProject
(
GModel
::
current
()
->
getFileName
());
if
(
!
GModel
::
current
()
->
empty
()
&&
meshAuto
){
GModel
::
current
()
->
mesh
(
3
);
CreateOutputFile
(
mshFileName
,
CTX
::
instance
()
->
mesh
.
fileFormat
);
}
}
else
if
(
StatFile
(
mshFileName
)){
// mesh+save if the mesh file does not exist
if
(
meshAuto
){
redraw
=
true
;
GModel
::
current
()
->
mesh
(
3
);
CreateOutputFile
(
mshFileName
,
CTX
::
instance
()
->
mesh
.
fileFormat
);
}
}
onelab
::
server
::
instance
()
->
setChanged
(
false
,
"Gmsh"
);
}
return
redraw
;
}
}
#endif
This diff is collapsed.
Click to expand it.
Common/onelabUtils.h
+
1
−
0
View file @
2795e213
...
...
@@ -19,6 +19,7 @@ namespace onelabUtils {
bool
incrementLoop
(
const
std
::
string
&
level
);
std
::
vector
<
double
>
getRange
(
onelab
::
number
&
p
);
bool
updateGraph
(
const
std
::
string
&
graphNum
);
bool
runGmshClient
(
const
std
::
string
&
action
,
bool
meshAuto
);
}
#endif
This diff is collapsed.
Click to expand it.
Fltk/onelabWindow.cpp
+
9
−
57
View file @
2795e213
...
...
@@ -380,58 +380,6 @@ static void updateGraphs()
}
}
static
void
runGmshClient
(
const
std
::
string
&
action
)
{
onelab
::
server
::
citer
it
=
onelab
::
server
::
instance
()
->
findClient
(
"Gmsh"
);
if
(
it
==
onelab
::
server
::
instance
()
->
lastClient
())
return
;
onelab
::
client
*
c
=
it
->
second
;
std
::
string
mshFileName
=
onelabUtils
::
getMshFileName
(
c
);
if
(
action
==
"initialize"
)
return
;
static
std
::
string
modelName
=
""
;
if
(
modelName
.
empty
()){
// first pass is special to prevent model reload, as well as
// remeshing if a mesh file already exists on disk
modelName
=
GModel
::
current
()
->
getName
();
if
(
!
StatFile
(
mshFileName
))
onelab
::
server
::
instance
()
->
setChanged
(
false
,
"Gmsh"
);
}
if
(
action
==
"check"
){
if
(
onelab
::
server
::
instance
()
->
getChanged
(
"Gmsh"
)
||
modelName
!=
GModel
::
current
()
->
getName
()){
// reload geometry if Gmsh parameters have been modified or if
// the model name has changed
modelName
=
GModel
::
current
()
->
getName
();
geometry_reload_cb
(
0
,
0
);
}
}
else
if
(
action
==
"compute"
){
if
(
onelab
::
server
::
instance
()
->
getChanged
(
"Gmsh"
)
||
modelName
!=
GModel
::
current
()
->
getName
()){
// reload the geometry, mesh it and save the mesh if Gmsh
// parameters have been modified or if the model name has
// changed
modelName
=
GModel
::
current
()
->
getName
();
geometry_reload_cb
(
0
,
0
);
if
(
!
GModel
::
current
()
->
empty
()
&&
FlGui
::
instance
()
->
onelab
->
meshAuto
()){
mesh_3d_cb
(
0
,
0
);
CreateOutputFile
(
mshFileName
,
CTX
::
instance
()
->
mesh
.
fileFormat
);
}
}
else
if
(
StatFile
(
mshFileName
)){
// mesh+save if the mesh file does not exist
if
(
FlGui
::
instance
()
->
onelab
->
meshAuto
()){
mesh_3d_cb
(
0
,
0
);
CreateOutputFile
(
mshFileName
,
CTX
::
instance
()
->
mesh
.
fileFormat
);
}
}
onelab
::
server
::
instance
()
->
setChanged
(
false
,
"Gmsh"
);
}
}
void
onelab_cb
(
Fl_Widget
*
w
,
void
*
data
)
{
if
(
!
data
)
return
;
...
...
@@ -509,13 +457,16 @@ void onelab_cb(Fl_Widget *w, void *data)
do
{
// enter loop
//check whether the client is a onelab Metamodel
//
check whether the client is a onelab Metamodel
std
::
vector
<
onelab
::
number
>
n
;
onelab
::
server
::
instance
()
->
get
(
n
,
"HasGmsh"
);
onelab
::
server
::
instance
()
->
get
(
n
,
"HasGmsh"
);
bool
metamodel
=
(
n
.
size
()
&&
n
[
0
].
getValue
());
// If the client is a NOT a metamodel Gmsh gets executed
if
(
!
metamodel
)
runGmshClient
(
action
);
// if the client is a not a metamodel, run Gmsh
if
(
!
metamodel
){
if
(
onelabUtils
::
runGmshClient
(
action
,
FlGui
::
instance
()
->
onelab
->
meshAuto
()))
drawContext
::
global
()
->
draw
();
}
if
(
action
==
"compute"
)
FlGui
::
instance
()
->
onelab
->
checkForErrors
(
"Gmsh"
);
...
...
@@ -539,7 +490,8 @@ void onelab_cb(Fl_Widget *w, void *data)
if
(
FlGui
::
instance
()
->
onelab
->
stop
())
break
;
}
// update geometry in Gmsh window which might have been by the metamodel
// update geometry in Gmsh window which might have been changed by the
// metamodel
if
(
metamodel
)
geometry_reload_cb
(
0
,
0
);
...
...
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