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
30c743fa
Commit
30c743fa
authored
15 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
encapsule most of the FLTK main into GmshFLTK so that it can be used as-is
by external codes
parent
5ff41ee9
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/Gmsh.cpp
+70
-0
70 additions, 0 deletions
Common/Gmsh.cpp
Common/Gmsh.h
+1
-0
1 addition, 0 deletions
Common/Gmsh.h
Fltk/FlGui.cpp
+21
-1
21 additions, 1 deletion
Fltk/FlGui.cpp
Fltk/Main.cpp
+2
-84
2 additions, 84 deletions
Fltk/Main.cpp
with
94 additions
and
85 deletions
Common/Gmsh.cpp
+
70
−
0
View file @
30c743fa
...
@@ -16,6 +16,7 @@
...
@@ -16,6 +16,7 @@
#include
"CommandLine.h"
#include
"CommandLine.h"
#include
"OS.h"
#include
"OS.h"
#include
"Context.h"
#include
"Context.h"
#include
"ConnectionManager.h"
#include
"robustPredicates.h"
#include
"robustPredicates.h"
#if defined(HAVE_MESH)
#if defined(HAVE_MESH)
...
@@ -28,6 +29,12 @@
...
@@ -28,6 +29,12 @@
#include
"PluginManager.h"
#include
"PluginManager.h"
#endif
#endif
#if defined(HAVE_FLTK)
#include
"FlGui.h"
#include
"menuWindow.h"
#include
"drawContext.h"
#endif
#if defined(HAVE_LUA)
#if defined(HAVE_LUA)
#include
"LuaBindings.h"
#include
"LuaBindings.h"
#endif
#endif
...
@@ -190,3 +197,66 @@ int GmshBatch()
...
@@ -190,3 +197,66 @@ int GmshBatch()
return
1
;
return
1
;
}
}
int
GmshFLTK
(
int
argc
,
char
**
argv
)
{
#if defined(HAVE_FLTK) && defined(HAVE_POST)
// create the GUI
FlGui
::
instance
(
argc
,
argv
);
// display GUI immediately for quick launch time
FlGui
::
instance
()
->
check
();
// open project file and merge all other input files
OpenProject
(
GModel
::
current
()
->
getFileName
());
for
(
unsigned
int
i
=
1
;
i
<
CTX
::
instance
()
->
files
.
size
();
i
++
){
if
(
CTX
::
instance
()
->
files
[
i
]
==
"-new"
){
GModel
::
current
()
->
setVisibility
(
0
);
new
GModel
();
}
else
MergeFile
(
CTX
::
instance
()
->
files
[
i
]);
}
if
(
CTX
::
instance
()
->
post
.
combineTime
){
PView
::
combine
(
true
,
2
,
CTX
::
instance
()
->
post
.
combineRemoveOrig
);
FlGui
::
instance
()
->
updateViews
();
}
// init first context
switch
(
CTX
::
instance
()
->
initialContext
)
{
case
1
:
FlGui
::
instance
()
->
menu
->
setContext
(
menu_geometry
,
0
);
break
;
case
2
:
FlGui
::
instance
()
->
menu
->
setContext
(
menu_mesh
,
0
);
break
;
case
3
:
FlGui
::
instance
()
->
menu
->
setContext
(
menu_solver
,
0
);
break
;
case
4
:
FlGui
::
instance
()
->
menu
->
setContext
(
menu_post
,
0
);
break
;
default:
// automatic
if
(
PView
::
list
.
size
())
FlGui
::
instance
()
->
menu
->
setContext
(
menu_post
,
0
);
else
FlGui
::
instance
()
->
menu
->
setContext
(
menu_geometry
,
0
);
break
;
}
// read background mesh if any
if
(
!
CTX
::
instance
()
->
bgmFileName
.
empty
())
{
MergeFile
(
CTX
::
instance
()
->
bgmFileName
);
if
(
PView
::
list
.
size
())
GModel
::
current
()
->
getFields
()
->
setBackgroundMesh
(
PView
::
list
.
size
()
-
1
);
else
Msg
::
Error
(
"Invalid background mesh (no view)"
);
}
// draw the scene
drawContext
::
global
()
->
draw
();
// listen to external solvers
if
(
CTX
::
instance
()
->
solver
.
listen
)
ConnectionManager
::
get
(
-
1
)
->
run
(
""
);
// loop
return
FlGui
::
instance
()
->
run
();
#else
Msg
::
Error
(
"GmshFLTK unavailable: please recompile with FLTK support"
);
return
0
;
#endif
}
This diff is collapsed.
Click to expand it.
Common/Gmsh.h
+
1
−
0
View file @
30c743fa
...
@@ -24,5 +24,6 @@ int GmshMergeFile(std::string fileName);
...
@@ -24,5 +24,6 @@ int GmshMergeFile(std::string fileName);
int
GmshWriteFile
(
std
::
string
fileName
);
int
GmshWriteFile
(
std
::
string
fileName
);
int
GmshFinalize
();
int
GmshFinalize
();
int
GmshBatch
();
int
GmshBatch
();
int
GmshFLTK
(
int
argc
,
char
**
argv
);
#endif
#endif
This diff is collapsed.
Click to expand it.
Fltk/FlGui.cpp
+
21
−
1
View file @
30c743fa
...
@@ -38,6 +38,7 @@
...
@@ -38,6 +38,7 @@
#include
"OpenFile.h"
#include
"OpenFile.h"
#include
"Win32Icon.h"
#include
"Win32Icon.h"
#include
"Options.h"
#include
"Options.h"
#include
"CommandLine.h"
#include
"Context.h"
#include
"Context.h"
#include
"StringUtils.h"
#include
"StringUtils.h"
#include
"gl2ps.h"
#include
"gl2ps.h"
...
@@ -279,7 +280,26 @@ FlGui *FlGui::_instance = 0;
...
@@ -279,7 +280,26 @@ FlGui *FlGui::_instance = 0;
FlGui
*
FlGui
::
instance
(
int
argc
,
char
**
argv
)
FlGui
*
FlGui
::
instance
(
int
argc
,
char
**
argv
)
{
{
if
(
!
_instance
)
_instance
=
new
FlGui
(
argc
,
argv
);
if
(
!
_instance
){
_instance
=
new
FlGui
(
argc
,
argv
);
// set all options in the new GUI
InitOptionsGUI
(
0
);
// say welcome!
Msg
::
StatusBar
(
1
,
false
,
"Geometry"
);
Msg
::
StatusBar
(
2
,
false
,
"Gmsh %s"
,
GetGmshVersion
());
// log the following for bug reports
Msg
::
Info
(
"-------------------------------------------------------"
);
Msg
::
Info
(
"Gmsh version : %s"
,
GetGmshVersion
());
Msg
::
Info
(
"Build OS : %s"
,
GetGmshBuildOS
());
Msg
::
Info
(
"Build options :%s"
,
GetGmshBuildOptions
());
Msg
::
Info
(
"Build date : %s"
,
GetGmshBuildDate
());
Msg
::
Info
(
"Build host : %s"
,
GetGmshBuildHost
());
Msg
::
Info
(
"Packager : %s"
,
GetGmshPackager
());
Msg
::
Info
(
"Home directory : %s"
,
CTX
::
instance
()
->
homeDir
.
c_str
());
Msg
::
Info
(
"Launch date : %s"
,
Msg
::
GetLaunchDate
().
c_str
());
Msg
::
Info
(
"Command line : %s"
,
Msg
::
GetCommandLineArgs
().
c_str
());
Msg
::
Info
(
"-------------------------------------------------------"
);
}
return
_instance
;
return
_instance
;
}
}
...
...
This diff is collapsed.
Click to expand it.
Fltk/Main.cpp
+
2
−
84
View file @
30c743fa
...
@@ -6,20 +6,10 @@
...
@@ -6,20 +6,10 @@
#include
<string>
#include
<string>
#include
"Gmsh.h"
#include
"Gmsh.h"
#include
"GmshMessage.h"
#include
"GmshMessage.h"
#include
"ConnectionManager.h"
#include
"FlGui.h"
#include
"menuWindow.h"
#include
"drawContext.h"
#include
"Context.h"
#include
"Context.h"
#include
"Options.h"
#include
"Options.h"
#include
"Parser.h"
#include
"OpenFile.h"
#include
"CommandLine.h"
#include
"PluginManager.h"
#include
"PluginManager.h"
#include
"GModel.h"
#include
"GModel.h"
#include
"Field.h"
#include
"BackgroundMesh.h"
#include
"PView.h"
int
main
(
int
argc
,
char
*
argv
[])
int
main
(
int
argc
,
char
*
argv
[])
{
{
...
@@ -46,78 +36,6 @@ int main(int argc, char *argv[])
...
@@ -46,78 +36,6 @@ int main(int argc, char *argv[])
Msg
::
Exit
(
0
);
Msg
::
Exit
(
0
);
}
}
// Create the GUI
// Interactive Gmsh with FLTK GUI
FlGui
::
instance
(
argc
,
argv
);
return
GmshFLTK
(
argc
,
argv
);
// Set all previously defined options in the GUI
InitOptionsGUI
(
0
);
// Say welcome!
Msg
::
StatusBar
(
1
,
false
,
"Geometry"
);
Msg
::
StatusBar
(
2
,
false
,
"Gmsh %s"
,
GetGmshVersion
());
// Log the following for bug reports
Msg
::
Info
(
"-------------------------------------------------------"
);
Msg
::
Info
(
"Gmsh version : %s"
,
GetGmshVersion
());
Msg
::
Info
(
"Build OS : %s"
,
GetGmshBuildOS
());
Msg
::
Info
(
"Build options :%s"
,
GetGmshBuildOptions
());
Msg
::
Info
(
"Build date : %s"
,
GetGmshBuildDate
());
Msg
::
Info
(
"Build host : %s"
,
GetGmshBuildHost
());
Msg
::
Info
(
"Packager : %s"
,
GetGmshPackager
());
Msg
::
Info
(
"Home directory : %s"
,
CTX
::
instance
()
->
homeDir
.
c_str
());
Msg
::
Info
(
"Launch date : %s"
,
Msg
::
GetLaunchDate
().
c_str
());
Msg
::
Info
(
"Command line : %s"
,
Msg
::
GetCommandLineArgs
().
c_str
());
Msg
::
Info
(
"-------------------------------------------------------"
);
// Display the GUI immediately to have a quick "a la Windows" launch time
FlGui
::
instance
()
->
check
();
// Open project file and merge all other input files
OpenProject
(
GModel
::
current
()
->
getFileName
());
for
(
unsigned
int
i
=
1
;
i
<
CTX
::
instance
()
->
files
.
size
();
i
++
){
if
(
CTX
::
instance
()
->
files
[
i
]
==
"-new"
){
GModel
::
current
()
->
setVisibility
(
0
);
new
GModel
();
}
else
MergeFile
(
CTX
::
instance
()
->
files
[
i
]);
}
if
(
CTX
::
instance
()
->
post
.
combineTime
){
PView
::
combine
(
true
,
2
,
CTX
::
instance
()
->
post
.
combineRemoveOrig
);
FlGui
::
instance
()
->
updateViews
();
}
// Init first context
switch
(
CTX
::
instance
()
->
initialContext
)
{
case
1
:
FlGui
::
instance
()
->
menu
->
setContext
(
menu_geometry
,
0
);
break
;
case
2
:
FlGui
::
instance
()
->
menu
->
setContext
(
menu_mesh
,
0
);
break
;
case
3
:
FlGui
::
instance
()
->
menu
->
setContext
(
menu_solver
,
0
);
break
;
case
4
:
FlGui
::
instance
()
->
menu
->
setContext
(
menu_post
,
0
);
break
;
default:
// automatic
if
(
PView
::
list
.
size
())
FlGui
::
instance
()
->
menu
->
setContext
(
menu_post
,
0
);
else
FlGui
::
instance
()
->
menu
->
setContext
(
menu_geometry
,
0
);
break
;
}
// Read background mesh if any
if
(
!
CTX
::
instance
()
->
bgmFileName
.
empty
())
{
MergeFile
(
CTX
::
instance
()
->
bgmFileName
);
if
(
PView
::
list
.
size
())
GModel
::
current
()
->
getFields
()
->
setBackgroundMesh
(
PView
::
list
.
size
()
-
1
);
else
Msg
::
Error
(
"Invalid background mesh (no view)"
);
}
// Draw the scene
drawContext
::
global
()
->
draw
();
// Listen to external solvers
if
(
CTX
::
instance
()
->
solver
.
listen
)
ConnectionManager
::
get
(
-
1
)
->
run
(
""
);
// loop
return
FlGui
::
instance
()
->
run
();
}
}
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