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
f59e7d61
Commit
f59e7d61
authored
12 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
import physical groups as onelab regions
parent
81261931
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
Common/GmshMessage.cpp
+29
-1
29 additions, 1 deletion
Common/GmshMessage.cpp
Common/GmshMessage.h
+1
-0
1 addition, 0 deletions
Common/GmshMessage.h
Common/OpenFile.cpp
+2
-0
2 additions, 0 deletions
Common/OpenFile.cpp
Fltk/onelabWindow.cpp
+0
-28
0 additions, 28 deletions
Fltk/onelabWindow.cpp
with
32 additions
and
29 deletions
Common/GmshMessage.cpp
+
29
−
1
View file @
f59e7d61
...
...
@@ -649,7 +649,7 @@ void Msg::ExchangeOnelabParameter(const std::string &key,
std
::
vector
<
onelab
::
number
>
ps
;
_onelabClient
->
get
(
ps
,
name
);
bool
noRange
=
true
,
noChoices
=
true
,
noLoop
=
true
,
noGraph
=
true
;
if
(
ps
.
size
()){
if
(
ps
.
size
()){
if
(
ps
[
0
].
getReadOnly
())
ps
[
0
].
setValue
(
val
[
0
]);
// use value from gmsh
else
...
...
@@ -697,6 +697,34 @@ void Msg::ExchangeOnelabParameter(const std::string &key,
#endif
}
void
Msg
::
ImportPhysicalsAsOnelabRegions
()
{
#if defined(HAVE_ONELAB)
if
(
_onelabClient
){
std
::
map
<
int
,
std
::
vector
<
GEntity
*>
>
groups
[
4
];
GModel
::
current
()
->
getPhysicalGroups
(
groups
);
for
(
int
dim
=
0
;
dim
<
3
;
dim
++
){
for
(
std
::
map
<
int
,
std
::
vector
<
GEntity
*>
>::
iterator
it
=
groups
[
dim
].
begin
();
it
!=
groups
[
dim
].
end
();
it
++
){
// create "read-only" onelab region
std
::
string
name
=
GModel
::
current
()
->
getPhysicalName
(
dim
,
it
->
first
);
std
::
ostringstream
num
;
num
<<
it
->
first
;
if
(
name
.
empty
())
name
=
std
::
string
(
"Physical"
)
+
((
dim
==
3
)
?
"Volume"
:
(
dim
==
2
)
?
"Surface"
:
(
dim
==
1
)
?
"Line"
:
"Point"
)
+
num
.
str
();
name
.
insert
(
0
,
"Gmsh/Physical groups/"
);
onelab
::
region
p
(
name
,
num
.
str
());
p
.
setDimension
(
dim
);
p
.
setReadOnly
(
true
);
_onelabClient
->
set
(
p
);
}
}
}
#endif
}
void
Msg
::
FinalizeOnelab
()
{
#if defined(HAVE_ONELAB)
...
...
This diff is collapsed.
Click to expand it.
Common/GmshMessage.h
+
1
−
0
View file @
f59e7d61
...
...
@@ -90,6 +90,7 @@ class Msg {
std
::
vector
<
double
>
&
val
,
std
::
map
<
std
::
string
,
std
::
vector
<
double
>
>
&
fopt
,
std
::
map
<
std
::
string
,
std
::
vector
<
std
::
string
>
>
&
copt
);
static
void
ImportPhysicalsAsOnelabRegions
();
};
#endif
This diff is collapsed.
Click to expand it.
Common/OpenFile.cpp
+
2
−
0
View file @
f59e7d61
...
...
@@ -425,6 +425,8 @@ int MergeFile(std::string fileName, bool warnIfMissing)
}
#endif
Msg
::
ImportPhysicalsAsOnelabRegions
();
if
(
!
status
)
Msg
::
Error
(
"Error loading '%s'"
,
fileName
.
c_str
());
Msg
::
StatusBar
(
2
,
true
,
"Done reading '%s'"
,
fileName
.
c_str
());
...
...
This diff is collapsed.
Click to expand it.
Fltk/onelabWindow.cpp
+
0
−
28
View file @
f59e7d61
...
...
@@ -673,31 +673,6 @@ static void updateOnelabGraphs()
drawContext
::
global
()
->
draw
();
}
static
void
importPhysicalGroups
(
onelab
::
client
*
c
,
GModel
*
m
)
{
std
::
map
<
int
,
std
::
vector
<
GEntity
*>
>
groups
[
4
];
m
->
getPhysicalGroups
(
groups
);
for
(
int
dim
=
0
;
dim
<
3
;
dim
++
){
for
(
std
::
map
<
int
,
std
::
vector
<
GEntity
*>
>::
iterator
it
=
groups
[
dim
].
begin
();
it
!=
groups
[
dim
].
end
();
it
++
){
// create "read-only" onelab region
std
::
string
name
=
m
->
getPhysicalName
(
dim
,
it
->
first
);
std
::
ostringstream
num
;
num
<<
it
->
first
;
if
(
name
.
empty
())
name
=
std
::
string
(
"Physical"
)
+
((
dim
==
3
)
?
"Volume"
:
(
dim
==
2
)
?
"Surface"
:
(
dim
==
1
)
?
"Line"
:
"Point"
)
+
num
.
str
();
name
.
insert
(
0
,
"Gmsh/Physical groups/"
);
onelab
::
region
p
(
name
,
num
.
str
());
p
.
setDimension
(
dim
);
p
.
setReadOnly
(
true
);
//p.setVisible(false);
c
->
set
(
p
);
}
}
}
static
void
runGmshClient
(
const
std
::
string
&
action
)
{
onelab
::
server
::
citer
it
=
onelab
::
server
::
instance
()
->
findClient
(
"Gmsh"
);
...
...
@@ -712,7 +687,6 @@ static void runGmshClient(const std::string &action)
// first pass is special to prevent model reload, as well as
// remeshing if a mesh file already exists on disk
modelName
=
GModel
::
current
()
->
getName
();
importPhysicalGroups
(
c
,
GModel
::
current
());
if
(
!
StatFile
(
mshFileName
))
onelab
::
server
::
instance
()
->
setChanged
(
false
,
"Gmsh"
);
}
...
...
@@ -724,7 +698,6 @@ static void runGmshClient(const std::string &action)
// the model name has changed
modelName
=
GModel
::
current
()
->
getName
();
geometry_reload_cb
(
0
,
0
);
importPhysicalGroups
(
c
,
GModel
::
current
());
}
}
else
if
(
action
==
"compute"
){
...
...
@@ -735,7 +708,6 @@ static void runGmshClient(const std::string &action)
// changed
modelName
=
GModel
::
current
()
->
getName
();
geometry_reload_cb
(
0
,
0
);
importPhysicalGroups
(
c
,
GModel
::
current
());
if
(
FlGui
::
instance
()
->
onelab
->
meshAuto
()){
mesh_3d_cb
(
0
,
0
);
CreateOutputFile
(
mshFileName
,
CTX
::
instance
()
->
mesh
.
fileFormat
);
...
...
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