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
23c2bd12
Commit
23c2bd12
authored
7 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
GUI for embedded entities
parent
ff259174
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Fltk/graphicWindow.cpp
+107
-3
107 additions, 3 deletions
Fltk/graphicWindow.cpp
Geo/GeoStringInterface.cpp
+6
-8
6 additions, 8 deletions
Geo/GeoStringInterface.cpp
Geo/GeoStringInterface.h
+2
-2
2 additions, 2 deletions
Geo/GeoStringInterface.h
with
115 additions
and
13 deletions
Fltk/graphicWindow.cpp
+
107
−
3
View file @
23c2bd12
...
...
@@ -2352,7 +2352,113 @@ static void mesh_define_transfinite_volume_cb(Fl_Widget *w, void *data)
static void mesh_define_embedded_cb(Fl_Widget *w, void *data)
{
// TODO
if(!data) return;
std::string what((const char*)data);
std::vector<int> entities;
bool selectEntities = true;
int type; const char *str = "";
if(what == "Surface"){
type = ENT_SURFACE; str = "surfaces";
opt_geometry_surfaces(0, GMSH_SET | GMSH_GUI, 1);
}
else if(what == "Line"){
type = ENT_LINE; str = "lines";
opt_geometry_lines(0, GMSH_SET | GMSH_GUI, 1);
}
else if(what == "Point"){
type = ENT_POINT; str = "points";
opt_geometry_points(0, GMSH_SET | GMSH_GUI, 1);
}
else{
Msg::Error("Unknown type of entity to embed: %s", what.c_str());
return;
}
while(1) {
if(entities.empty())
Msg::StatusGl("Select %s\n"
"[Press 'e' to end selection or 'q' to abort]", str);
else if(selectEntities)
Msg::StatusGl("Select %s\n"
"[Press 'e' to end selection, 'u' to undo last selection or "
"'q' to abort]", str);
else
Msg::StatusGl("Select entity in which to embed the %s\n"
"[Press 'e' to end selection or 'q' to abort]", str);
int t = type;
if(!selectEntities){
switch(FlGui::instance()->transformContext->choice->value()){
case 2: t = ENT_LINE; break;
case 3: t = ENT_SURFACE; break;
case 4: t = ENT_VOLUME; break;
default: t = ENT_ALL; break;
}
}
char ib = FlGui::instance()->selectEntity(t);
if(ib == 'l') {
if(selectEntities && what == "Point"){
for(unsigned int i = 0; i < FlGui::instance()->selectedVertices.size(); i++){
if(FlGui::instance()->selectedVertices[i]->getSelection() != 1){
FlGui::instance()->selectedVertices[i]->setSelection(1);
entities.push_back(FlGui::instance()->selectedVertices[i]->tag());
}
}
}
else if(selectEntities && what == "Line"){
for(unsigned int i = 0; i < FlGui::instance()->selectedEdges.size(); i++){
if(FlGui::instance()->selectedEdges[i]->getSelection() != 1){
FlGui::instance()->selectedEdges[i]->setSelection(1);
entities.push_back(FlGui::instance()->selectedEdges[i]->tag());
}
}
}
else if(selectEntities && what == "Surface"){
for(unsigned int i = 0; i < FlGui::instance()->selectedFaces.size(); i++){
if(FlGui::instance()->selectedFaces[i]->getSelection() != 1){
FlGui::instance()->selectedFaces[i]->setSelection(1);
entities.push_back(FlGui::instance()->selectedFaces[i]->tag());
}
}
}
else if(!selectEntities && (FlGui::instance()->selectedFaces.size() ||
FlGui::instance()->selectedRegions.size())){
int dim = FlGui::instance()->selectedFaces.size() ? 2 : 3;
int tag = (dim == 2) ? FlGui::instance()->selectedFaces[0]->tag() :
FlGui::instance()->selectedRegions[0]->tag();
add_embedded(GModel::current()->getFileName(), what, entities, dim, tag);
GModel::current()->setSelection(0);
selectEntities = true;
entities.clear();
}
}
if(ib == 'r') {
Msg::Warning("Entity de-selection not supported yet during boolean operation");
}
if(ib == 'u') {
if(selectEntities && entities.size()){
int dim = (what == "Surface") ? 2 : (what == "Line") ? 1 : 0;
GEntity *ge = GModel::current()->getEntityByTag(dim, entities.back());
if(ge) ge->setSelection(0);
entities.pop_back();
}
}
if(ib == 'e') {
if(selectEntities){
if(entities.empty())
Msg::Error("At least one entity must be selected");
else
selectEntities = false;
}
}
if(ib == 'q') {
GModel::current()->setSelection(0);
break;
}
}
FlGui::instance()->transformContext->hide();
drawContext::global()->draw();
Msg::StatusGl("");
}
static void mesh_define_compound_entity_cb(Fl_Widget *w, void *data)
...
...
@@ -4084,14 +4190,12 @@ static menuItem static_modules[] = {
(Fl_Callback *)mesh_define_length_cb } ,
{"0Modules/Mesh/Define/Size fields",
(Fl_Callback *)field_cb},
/* TODO:
{"0Modules/Mesh/Define/Embedded/Point",
(Fl_Callback *)mesh_define_embedded_cb, (void*)"Point" } ,
{"0Modules/Mesh/Define/Embedded/Line",
(Fl_Callback *)mesh_define_embedded_cb, (void*)"Line" } ,
{"0Modules/Mesh/Define/Embedded/Surface",
(Fl_Callback *)mesh_define_embedded_cb, (void*)"Surface" } ,
*/
{"0Modules/Mesh/Define/Transfinite/Line",
(Fl_Callback *)mesh_define_transfinite_line_cb} ,
{"0Modules/Mesh/Define/Transfinite/Surface",
...
...
This diff is collapsed.
Click to expand it.
Geo/GeoStringInterface.cpp
+
6
−
8
View file @
23c2bd12
...
...
@@ -249,16 +249,14 @@ void add_trsfvol(std::vector<int> &l, const std::string &fileName)
add_infile
(
sstream
.
str
(),
fileName
);
}
void
add_embedded
(
const
std
::
string
&
what
,
std
::
vector
<
int
>
&
l
,
const
std
::
string
&
fileName
)
void
add_embedded
(
const
std
::
string
&
fileName
,
const
std
::
string
&
what
,
std
::
vector
<
int
>
&
l
,
int
dim
,
int
tag
)
{
std
::
ostringstream
sstream
;
sstream
<<
"Point{"
;
for
(
unsigned
int
i
=
1
;
i
<
l
.
size
();
i
++
)
{
if
(
i
>
1
)
sstream
<<
", "
;
sstream
<<
l
[
i
];
}
sstream
<<
"} In Surface{"
<<
l
[
0
]
<<
"};"
;
sstream
<<
what
<<
"{"
<<
vector2String
(
l
)
<<
"} In "
;
if
(
dim
==
2
)
sstream
<<
"Surface{"
;
else
sstream
<<
"Volume{"
;
sstream
<<
tag
<<
"};"
;
add_infile
(
sstream
.
str
(),
fileName
);
}
...
...
This diff is collapsed.
Click to expand it.
Geo/GeoStringInterface.h
+
2
−
2
View file @
23c2bd12
...
...
@@ -20,8 +20,8 @@ void add_trsfline(std::vector<int> &l, const std::string &fileName,
void
add_trsfsurf
(
std
::
vector
<
int
>
&
l
,
const
std
::
string
&
fileName
,
const
std
::
string
&
dir
);
void
add_trsfvol
(
std
::
vector
<
int
>
&
l
,
const
std
::
string
&
fileName
);
void
add_embedded
(
const
std
::
string
&
what
,
std
::
vector
<
int
>
&
l
,
const
std
::
string
&
fileName
);
void
add_embedded
(
const
std
::
string
&
fileName
,
const
std
::
string
&
what
,
std
::
vector
<
int
>
&
l
,
int
dim
,
int
tag
);
void
add_param
(
const
std
::
string
&
par
,
const
std
::
string
&
value
,
const
std
::
string
&
label
,
const
std
::
string
&
path
,
const
std
::
string
&
fileName
);
...
...
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