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
9c8fac88
Commit
9c8fac88
authored
9 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
better export of physical groups to onelab
parent
aae54ca3
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/GmshMessage.cpp
+39
-15
39 additions, 15 deletions
Common/GmshMessage.cpp
Common/GmshMessage.h
+1
-1
1 addition, 1 deletion
Common/GmshMessage.h
Common/OpenFile.cpp
+2
-3
2 additions, 3 deletions
Common/OpenFile.cpp
Fltk/graphicWindow.cpp
+2
-0
2 additions, 0 deletions
Fltk/graphicWindow.cpp
with
44 additions
and
19 deletions
Common/GmshMessage.cpp
+
39
−
15
View file @
9c8fac88
...
@@ -1255,30 +1255,54 @@ void Msg::UndefineOnelabParameter(const std::string &name)
...
@@ -1255,30 +1255,54 @@ void Msg::UndefineOnelabParameter(const std::string &name)
#endif
#endif
}
}
void
Msg
::
ImportPhysical
sAsOnelabRegions
()
void
Msg
::
ImportPhysical
GroupsInOnelab
()
{
{
#if defined(HAVE_ONELAB)
#if defined(HAVE_ONELAB)
if
(
_onelabClient
){
if
(
_onelabClient
){
std
::
map
<
int
,
std
::
vector
<
GEntity
*>
>
groups
[
4
];
std
::
map
<
int
,
std
::
vector
<
GEntity
*>
>
groups
[
4
];
GModel
::
current
()
->
getPhysicalGroups
(
groups
);
GModel
::
current
()
->
getPhysicalGroups
(
groups
);
int
size
=
0
;
for
(
int
dim
=
0
;
dim
<=
3
;
dim
++
)
size
+=
groups
[
dim
].
size
();
onelab
::
number
n
(
"Gmsh/Number of physical groups"
,
size
);
n
.
setReadOnly
(
true
);
n
.
setVisible
(
false
);
n
.
setAttribute
(
"Closed"
,
"1"
);
_onelabClient
->
set
(
n
);
onelab
::
number
nd
(
"Gmsh/Model dimension"
,
GModel
::
current
()
->
getDim
());
nd
.
setReadOnly
(
true
);
nd
.
setVisible
(
false
);
nd
.
setAttribute
(
"Closed"
,
"1"
);
_onelabClient
->
set
(
nd
);
int
index
=
1
;
for
(
int
dim
=
0
;
dim
<=
3
;
dim
++
){
for
(
int
dim
=
0
;
dim
<=
3
;
dim
++
){
for
(
std
::
map
<
int
,
std
::
vector
<
GEntity
*>
>::
iterator
it
=
groups
[
dim
].
begin
();
for
(
std
::
map
<
int
,
std
::
vector
<
GEntity
*>
>::
iterator
it
=
groups
[
dim
].
begin
();
it
!=
groups
[
dim
].
end
();
it
++
){
it
!=
groups
[
dim
].
end
();
it
++
){
// create "read-only" onelab region
int
num
=
it
->
first
;
std
::
string
name
=
GModel
::
current
()
->
getPhysicalName
(
dim
,
it
->
first
);
std
::
string
name
=
GModel
::
current
()
->
getPhysicalName
(
dim
,
it
->
first
);
std
::
ostringstream
num
;
char
tmp
[
256
];
num
<<
it
->
first
;
if
(
name
.
empty
()){
if
(
name
.
empty
())
sprintf
(
tmp
,
"Physical %s %d"
,
(
dim
==
3
)
?
"Volume "
:
(
dim
==
2
)
?
"Surface "
:
name
=
std
::
string
(
"Physical"
)
+
(
dim
==
1
)
?
"Line "
:
"Point "
,
num
);
((
dim
==
3
)
?
"Volume"
:
(
dim
==
2
)
?
"Surface"
:
name
=
tmp
;
(
dim
==
1
)
?
"Line"
:
"Point"
)
+
num
.
str
();
}
name
.
insert
(
0
,
"Gmsh/Physical groups/"
);
sprintf
(
tmp
,
"Gmsh/Physical group %d/"
,
index
);
onelab
::
region
p
(
name
,
num
.
str
());
std
::
string
str
=
tmp
;
p
.
setDimension
(
dim
);
onelab
::
number
n1
(
str
+
"Dimension"
,
dim
);
p
.
setReadOnly
(
true
);
n1
.
setReadOnly
(
true
);
p
.
setVisible
(
false
);
n1
.
setVisible
(
false
);
p
.
setAttribute
(
"Closed"
,
"1"
);
_onelabClient
->
set
(
n1
);
_onelabClient
->
set
(
p
);
onelab
::
number
n2
(
str
+
"Number"
,
num
);
n2
.
setReadOnly
(
true
);
n2
.
setVisible
(
false
);
_onelabClient
->
set
(
n2
);
onelab
::
string
s
(
str
+
"Name"
,
name
);
s
.
setReadOnly
(
true
);
s
.
setVisible
(
false
);
_onelabClient
->
set
(
s
);
index
++
;
}
}
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Common/GmshMessage.h
+
1
−
1
View file @
9c8fac88
...
@@ -146,7 +146,7 @@ class Msg {
...
@@ -146,7 +146,7 @@ class Msg {
std
::
map
<
std
::
string
,
std
::
vector
<
std
::
string
>
>
&
copt
);
std
::
map
<
std
::
string
,
std
::
vector
<
std
::
string
>
>
&
copt
);
static
void
UndefineOnelabParameter
(
const
std
::
string
&
name
);
static
void
UndefineOnelabParameter
(
const
std
::
string
&
name
);
static
void
RunOnelabClient
(
const
std
::
string
&
name
,
const
std
::
string
&
exe
=
""
);
static
void
RunOnelabClient
(
const
std
::
string
&
name
,
const
std
::
string
&
exe
=
""
);
static
void
ImportPhysical
sAsOnelabRegions
();
static
void
ImportPhysical
GroupsInOnelab
();
};
};
#endif
#endif
This diff is collapsed.
Click to expand it.
Common/OpenFile.cpp
+
2
−
3
View file @
9c8fac88
...
@@ -361,7 +361,6 @@ int MergeFile(const std::string &fileName, bool warnIfMissing, bool setWindowTit
...
@@ -361,7 +361,6 @@ int MergeFile(const std::string &fileName, bool warnIfMissing, bool setWindowTit
CTX
::
instance
()
->
launchSolverAtStartup
=
num
;
CTX
::
instance
()
->
launchSolverAtStartup
=
num
;
CTX
::
instance
()
->
solverToRun
=
num
;
// used in ONELAB2
CTX
::
instance
()
->
solverToRun
=
num
;
// used in ONELAB2
return
1
;
return
1
;
}
}
else
if
(
ext
==
".py"
||
ext
==
".PY"
||
else
if
(
ext
==
".py"
||
ext
==
".PY"
||
ext
==
".m"
||
ext
==
".M"
||
ext
==
".m"
||
ext
==
".M"
||
...
@@ -518,6 +517,8 @@ int MergeFile(const std::string &fileName, bool warnIfMissing, bool setWindowTit
...
@@ -518,6 +517,8 @@ int MergeFile(const std::string &fileName, bool warnIfMissing, bool setWindowTit
CTX
::
instance
()
->
geom
.
draw
=
1
;
CTX
::
instance
()
->
geom
.
draw
=
1
;
CTX
::
instance
()
->
mesh
.
changed
=
ENT_ALL
;
CTX
::
instance
()
->
mesh
.
changed
=
ENT_ALL
;
Msg
::
ImportPhysicalGroupsInOnelab
();
#if defined(HAVE_FLTK) && defined(HAVE_POST)
#if defined(HAVE_FLTK) && defined(HAVE_POST)
if
(
FlGui
::
available
()){
if
(
FlGui
::
available
()){
// go directly to the first non-empty step after the one that is requested
// go directly to the first non-empty step after the one that is requested
...
@@ -529,8 +530,6 @@ int MergeFile(const std::string &fileName, bool warnIfMissing, bool setWindowTit
...
@@ -529,8 +530,6 @@ int MergeFile(const std::string &fileName, bool warnIfMissing, bool setWindowTit
}
}
#endif
#endif
Msg
::
ImportPhysicalsAsOnelabRegions
();
if
(
!
status
)
Msg
::
Error
(
"Error loading '%s'"
,
fileName
.
c_str
());
if
(
!
status
)
Msg
::
Error
(
"Error loading '%s'"
,
fileName
.
c_str
());
Msg
::
StatusBar
(
true
,
"Done reading '%s'"
,
fileName
.
c_str
());
Msg
::
StatusBar
(
true
,
"Done reading '%s'"
,
fileName
.
c_str
());
...
...
This diff is collapsed.
Click to expand it.
Fltk/graphicWindow.cpp
+
2
−
0
View file @
9c8fac88
...
@@ -1326,6 +1326,8 @@ static void action_point_line_surface_volume(int action, int mode, const char *w
...
@@ -1326,6 +1326,8 @@ static void action_point_line_surface_volume(int action, int mode, const char *w
FlGui
::
instance
()
->
physicalContext
->
append
,
FlGui
::
instance
()
->
physicalContext
->
append
,
FlGui
::
instance
()
->
physicalContext
->
mode
);
FlGui
::
instance
()
->
physicalContext
->
mode
);
FlGui
::
instance
()
->
physicalContext
->
show
(
action
==
7
?
false
:
true
);
FlGui
::
instance
()
->
physicalContext
->
show
(
action
==
7
?
false
:
true
);
// ask clients to update the tree using the new physical definition
onelab_cb
(
0
,
(
void
*
)
"check"
);
break
;
break
;
case
8
:
case
8
:
add_charlength
(
List1
,
GModel
::
current
()
->
getFileName
(),
add_charlength
(
List1
,
GModel
::
current
()
->
getFileName
(),
...
...
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