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
852a05cc
Commit
852a05cc
authored
8 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
refactoring physical groups
parent
011af2a7
No related branches found
No related tags found
No related merge requests found
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
Geo/GModelIO_GEO.cpp
+104
-55
104 additions, 55 deletions
Geo/GModelIO_GEO.cpp
Geo/GModelIO_GEO.h
+2
-1
2 additions, 1 deletion
Geo/GModelIO_GEO.h
Parser/Gmsh.tab.cpp
+439
-571
439 additions, 571 deletions
Parser/Gmsh.tab.cpp
Parser/Gmsh.y
+8
-140
8 additions, 140 deletions
Parser/Gmsh.y
with
553 additions
and
767 deletions
Geo/GModelIO_GEO.cpp
+
104
−
55
View file @
852a05cc
...
@@ -109,13 +109,13 @@ void GEO_Internals::addLine(int num, std::vector<int> vertexTags)
...
@@ -109,13 +109,13 @@ void GEO_Internals::addLine(int num, std::vector<int> vertexTags)
Msg
::
Error
(
"GEO edge with tag %d already exists"
,
num
);
Msg
::
Error
(
"GEO edge with tag %d already exists"
,
num
);
return
;
return
;
}
}
List_T
*
t
e
mp
=
List_Create
(
2
,
2
,
sizeof
(
int
));
List_T
*
tmp
=
List_Create
(
2
,
2
,
sizeof
(
int
));
for
(
unsigned
int
i
=
0
;
i
<
vertexTags
.
size
();
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
vertexTags
.
size
();
i
++
)
List_Add
(
t
e
mp
,
&
vertexTags
[
i
]);
List_Add
(
tmp
,
&
vertexTags
[
i
]);
Curve
*
c
=
Create_Curve
(
num
,
MSH_SEGM_LINE
,
1
,
t
e
mp
,
NULL
,
-
1
,
-
1
,
0.
,
1.
);
Curve
*
c
=
Create_Curve
(
num
,
MSH_SEGM_LINE
,
1
,
tmp
,
NULL
,
-
1
,
-
1
,
0.
,
1.
);
Tree_Add
(
Curves
,
&
c
);
Tree_Add
(
Curves
,
&
c
);
CreateReversedCurve
(
c
);
CreateReversedCurve
(
c
);
List_Delete
(
t
e
mp
);
List_Delete
(
tmp
);
_changed
=
true
;
_changed
=
true
;
}
}
...
@@ -126,11 +126,11 @@ void GEO_Internals::addCircleArc(int num, int startTag, int centerTag, int endTa
...
@@ -126,11 +126,11 @@ void GEO_Internals::addCircleArc(int num, int startTag, int centerTag, int endTa
Msg
::
Error
(
"GEO edge with tag %d already exists"
,
num
);
Msg
::
Error
(
"GEO edge with tag %d already exists"
,
num
);
return
;
return
;
}
}
List_T
*
t
e
mp
=
List_Create
(
3
,
2
,
sizeof
(
int
));
List_T
*
tmp
=
List_Create
(
3
,
2
,
sizeof
(
int
));
List_Add
(
t
e
mp
,
&
startTag
);
List_Add
(
tmp
,
&
startTag
);
List_Add
(
t
e
mp
,
&
centerTag
);
List_Add
(
tmp
,
&
centerTag
);
List_Add
(
t
e
mp
,
&
endTag
);
List_Add
(
tmp
,
&
endTag
);
Curve
*
c
=
Create_Curve
(
num
,
MSH_SEGM_CIRC
,
2
,
t
e
mp
,
NULL
,
-
1
,
-
1
,
0.
,
1.
);
Curve
*
c
=
Create_Curve
(
num
,
MSH_SEGM_CIRC
,
2
,
tmp
,
NULL
,
-
1
,
-
1
,
0.
,
1.
);
if
(
nx
||
ny
||
nz
){
if
(
nx
||
ny
||
nz
){
c
->
Circle
.
n
[
0
]
=
nx
;
c
->
Circle
.
n
[
0
]
=
nx
;
c
->
Circle
.
n
[
1
]
=
ny
;
c
->
Circle
.
n
[
1
]
=
ny
;
...
@@ -145,7 +145,7 @@ void GEO_Internals::addCircleArc(int num, int startTag, int centerTag, int endTa
...
@@ -145,7 +145,7 @@ void GEO_Internals::addCircleArc(int num, int startTag, int centerTag, int endTa
rc
->
Circle
.
n
[
2
]
=
nz
;
rc
->
Circle
.
n
[
2
]
=
nz
;
End_Curve
(
rc
);
End_Curve
(
rc
);
}
}
List_Delete
(
t
e
mp
);
List_Delete
(
tmp
);
_changed
=
true
;
_changed
=
true
;
}
}
...
@@ -156,12 +156,12 @@ void GEO_Internals::addEllipseArc(int num, int startTag, int centerTag, int majo
...
@@ -156,12 +156,12 @@ void GEO_Internals::addEllipseArc(int num, int startTag, int centerTag, int majo
Msg
::
Error
(
"GEO edge with tag %d already exists"
,
num
);
Msg
::
Error
(
"GEO edge with tag %d already exists"
,
num
);
return
;
return
;
}
}
List_T
*
t
e
mp
=
List_Create
(
3
,
2
,
sizeof
(
int
));
List_T
*
tmp
=
List_Create
(
3
,
2
,
sizeof
(
int
));
List_Add
(
t
e
mp
,
&
startTag
);
List_Add
(
tmp
,
&
startTag
);
List_Add
(
t
e
mp
,
&
centerTag
);
List_Add
(
tmp
,
&
centerTag
);
List_Add
(
t
e
mp
,
&
majorTag
);
List_Add
(
tmp
,
&
majorTag
);
List_Add
(
t
e
mp
,
&
endTag
);
List_Add
(
tmp
,
&
endTag
);
Curve
*
c
=
Create_Curve
(
num
,
MSH_SEGM_ELLI
,
2
,
t
e
mp
,
NULL
,
-
1
,
-
1
,
0.
,
1.
);
Curve
*
c
=
Create_Curve
(
num
,
MSH_SEGM_ELLI
,
2
,
tmp
,
NULL
,
-
1
,
-
1
,
0.
,
1.
);
if
(
nx
||
ny
||
nz
){
if
(
nx
||
ny
||
nz
){
c
->
Circle
.
n
[
0
]
=
nx
;
c
->
Circle
.
n
[
0
]
=
nx
;
c
->
Circle
.
n
[
1
]
=
ny
;
c
->
Circle
.
n
[
1
]
=
ny
;
...
@@ -176,7 +176,7 @@ void GEO_Internals::addEllipseArc(int num, int startTag, int centerTag, int majo
...
@@ -176,7 +176,7 @@ void GEO_Internals::addEllipseArc(int num, int startTag, int centerTag, int majo
rc
->
Circle
.
n
[
2
]
=
nz
;
rc
->
Circle
.
n
[
2
]
=
nz
;
End_Curve
(
rc
);
End_Curve
(
rc
);
}
}
List_Delete
(
t
e
mp
);
List_Delete
(
tmp
);
_changed
=
true
;
_changed
=
true
;
}
}
...
@@ -186,13 +186,13 @@ void GEO_Internals::addSpline(int num, std::vector<int> vertexTags)
...
@@ -186,13 +186,13 @@ void GEO_Internals::addSpline(int num, std::vector<int> vertexTags)
Msg
::
Error
(
"GEO edge with tag %d already exists"
,
num
);
Msg
::
Error
(
"GEO edge with tag %d already exists"
,
num
);
return
;
return
;
}
}
List_T
*
t
e
mp
=
List_Create
(
2
,
2
,
sizeof
(
int
));
List_T
*
tmp
=
List_Create
(
2
,
2
,
sizeof
(
int
));
for
(
unsigned
int
i
=
0
;
i
<
vertexTags
.
size
();
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
vertexTags
.
size
();
i
++
)
List_Add
(
t
e
mp
,
&
vertexTags
[
i
]);
List_Add
(
tmp
,
&
vertexTags
[
i
]);
Curve
*
c
=
Create_Curve
(
num
,
MSH_SEGM_SPLN
,
3
,
t
e
mp
,
NULL
,
-
1
,
-
1
,
0.
,
1.
);
Curve
*
c
=
Create_Curve
(
num
,
MSH_SEGM_SPLN
,
3
,
tmp
,
NULL
,
-
1
,
-
1
,
0.
,
1.
);
Tree_Add
(
Curves
,
&
c
);
Tree_Add
(
Curves
,
&
c
);
CreateReversedCurve
(
c
);
CreateReversedCurve
(
c
);
List_Delete
(
t
e
mp
);
List_Delete
(
tmp
);
_changed
=
true
;
_changed
=
true
;
}
}
...
@@ -202,13 +202,13 @@ void GEO_Internals::addBSpline(int num, std::vector<int> vertexTags)
...
@@ -202,13 +202,13 @@ void GEO_Internals::addBSpline(int num, std::vector<int> vertexTags)
Msg
::
Error
(
"GEO edge with tag %d already exists"
,
num
);
Msg
::
Error
(
"GEO edge with tag %d already exists"
,
num
);
return
;
return
;
}
}
List_T
*
t
e
mp
=
List_Create
(
2
,
2
,
sizeof
(
int
));
List_T
*
tmp
=
List_Create
(
2
,
2
,
sizeof
(
int
));
for
(
unsigned
int
i
=
0
;
i
<
vertexTags
.
size
();
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
vertexTags
.
size
();
i
++
)
List_Add
(
t
e
mp
,
&
vertexTags
[
i
]);
List_Add
(
tmp
,
&
vertexTags
[
i
]);
Curve
*
c
=
Create_Curve
(
num
,
MSH_SEGM_BSPLN
,
2
,
t
e
mp
,
NULL
,
-
1
,
-
1
,
0.
,
1.
);
Curve
*
c
=
Create_Curve
(
num
,
MSH_SEGM_BSPLN
,
2
,
tmp
,
NULL
,
-
1
,
-
1
,
0.
,
1.
);
Tree_Add
(
Curves
,
&
c
);
Tree_Add
(
Curves
,
&
c
);
CreateReversedCurve
(
c
);
CreateReversedCurve
(
c
);
List_Delete
(
t
e
mp
);
List_Delete
(
tmp
);
_changed
=
true
;
_changed
=
true
;
}
}
...
@@ -218,13 +218,13 @@ void GEO_Internals::addBezier(int num, std::vector<int> vertexTags)
...
@@ -218,13 +218,13 @@ void GEO_Internals::addBezier(int num, std::vector<int> vertexTags)
Msg
::
Error
(
"GEO edge with tag %d already exists"
,
num
);
Msg
::
Error
(
"GEO edge with tag %d already exists"
,
num
);
return
;
return
;
}
}
List_T
*
t
e
mp
=
List_Create
(
2
,
2
,
sizeof
(
int
));
List_T
*
tmp
=
List_Create
(
2
,
2
,
sizeof
(
int
));
for
(
unsigned
int
i
=
0
;
i
<
vertexTags
.
size
();
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
vertexTags
.
size
();
i
++
)
List_Add
(
t
e
mp
,
&
vertexTags
[
i
]);
List_Add
(
tmp
,
&
vertexTags
[
i
]);
Curve
*
c
=
Create_Curve
(
num
,
MSH_SEGM_BEZIER
,
2
,
t
e
mp
,
NULL
,
-
1
,
-
1
,
0.
,
1.
);
Curve
*
c
=
Create_Curve
(
num
,
MSH_SEGM_BEZIER
,
2
,
tmp
,
NULL
,
-
1
,
-
1
,
0.
,
1.
);
Tree_Add
(
Curves
,
&
c
);
Tree_Add
(
Curves
,
&
c
);
CreateReversedCurve
(
c
);
CreateReversedCurve
(
c
);
List_Delete
(
t
e
mp
);
List_Delete
(
tmp
);
_changed
=
true
;
_changed
=
true
;
}
}
...
@@ -236,16 +236,16 @@ void GEO_Internals::addNurbs(int num, std::vector<int> vertexTags,
...
@@ -236,16 +236,16 @@ void GEO_Internals::addNurbs(int num, std::vector<int> vertexTags,
return
;
return
;
}
}
int
order
=
knots
.
size
()
-
vertexTags
.
size
()
-
1
;
int
order
=
knots
.
size
()
-
vertexTags
.
size
()
-
1
;
List_T
*
t
e
mp
=
List_Create
(
2
,
2
,
sizeof
(
int
));
List_T
*
tmp
=
List_Create
(
2
,
2
,
sizeof
(
int
));
for
(
unsigned
int
i
=
0
;
i
<
vertexTags
.
size
();
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
vertexTags
.
size
();
i
++
)
List_Add
(
t
e
mp
,
&
vertexTags
[
i
]);
List_Add
(
tmp
,
&
vertexTags
[
i
]);
List_T
*
knotsList
=
List_Create
(
2
,
2
,
sizeof
(
double
));
List_T
*
knotsList
=
List_Create
(
2
,
2
,
sizeof
(
double
));
for
(
unsigned
int
i
=
0
;
i
<
knots
.
size
();
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
knots
.
size
();
i
++
)
List_Add
(
knotsList
,
&
knots
[
i
]);
List_Add
(
knotsList
,
&
knots
[
i
]);
Curve
*
c
=
Create_Curve
(
num
,
MSH_SEGM_NURBS
,
order
,
t
e
mp
,
knotsList
,
-
1
,
-
1
,
0.
,
1.
);
Curve
*
c
=
Create_Curve
(
num
,
MSH_SEGM_NURBS
,
order
,
tmp
,
knotsList
,
-
1
,
-
1
,
0.
,
1.
);
Tree_Add
(
Curves
,
&
c
);
Tree_Add
(
Curves
,
&
c
);
CreateReversedCurve
(
c
);
CreateReversedCurve
(
c
);
List_Delete
(
t
e
mp
);
List_Delete
(
tmp
);
_changed
=
true
;
_changed
=
true
;
}
}
...
@@ -270,13 +270,13 @@ void GEO_Internals::addLineLoop(int num, std::vector<int> edgeTags)
...
@@ -270,13 +270,13 @@ void GEO_Internals::addLineLoop(int num, std::vector<int> edgeTags)
Msg
::
Error
(
"GEO line loop with tag %d already exists"
,
num
);
Msg
::
Error
(
"GEO line loop with tag %d already exists"
,
num
);
return
;
return
;
}
}
List_T
*
t
e
mp
=
List_Create
(
2
,
2
,
sizeof
(
int
));
List_T
*
tmp
=
List_Create
(
2
,
2
,
sizeof
(
int
));
for
(
unsigned
int
i
=
0
;
i
<
edgeTags
.
size
();
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
edgeTags
.
size
();
i
++
)
List_Add
(
t
e
mp
,
&
edgeTags
[
i
]);
List_Add
(
tmp
,
&
edgeTags
[
i
]);
sortEdgesInLoop
(
num
,
t
e
mp
);
sortEdgesInLoop
(
num
,
tmp
);
EdgeLoop
*
l
=
Create_EdgeLoop
(
num
,
t
e
mp
);
EdgeLoop
*
l
=
Create_EdgeLoop
(
num
,
tmp
);
Tree_Add
(
EdgeLoops
,
&
l
);
Tree_Add
(
EdgeLoops
,
&
l
);
List_Delete
(
t
e
mp
);
List_Delete
(
tmp
);
_changed
=
true
;
_changed
=
true
;
}
}
...
@@ -290,12 +290,12 @@ void GEO_Internals::addPlaneSurface(int num, std::vector<int> wireTags)
...
@@ -290,12 +290,12 @@ void GEO_Internals::addPlaneSurface(int num, std::vector<int> wireTags)
Msg
::
Error
(
"Plane surface requires at least one line loop"
);
Msg
::
Error
(
"Plane surface requires at least one line loop"
);
return
;
return
;
}
}
List_T
*
t
e
mp
=
List_Create
(
2
,
2
,
sizeof
(
int
));
List_T
*
tmp
=
List_Create
(
2
,
2
,
sizeof
(
int
));
for
(
unsigned
int
i
=
0
;
i
<
wireTags
.
size
();
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
wireTags
.
size
();
i
++
)
List_Add
(
t
e
mp
,
&
wireTags
[
i
]);
List_Add
(
tmp
,
&
wireTags
[
i
]);
Surface
*
s
=
Create_Surface
(
num
,
MSH_SURF_PLAN
);
Surface
*
s
=
Create_Surface
(
num
,
MSH_SURF_PLAN
);
setSurfaceGeneratrices
(
s
,
t
e
mp
);
setSurfaceGeneratrices
(
s
,
tmp
);
List_Delete
(
t
e
mp
);
List_Delete
(
tmp
);
End_Surface
(
s
);
End_Surface
(
s
);
Tree_Add
(
Surfaces
,
&
s
);
Tree_Add
(
Surfaces
,
&
s
);
_changed
=
true
;
_changed
=
true
;
...
@@ -337,12 +337,12 @@ void GEO_Internals::addSurfaceFilling(int num, std::vector<int> wireTags,
...
@@ -337,12 +337,12 @@ void GEO_Internals::addSurfaceFilling(int num, std::vector<int> wireTags,
else
else
Msg
::
Error
(
"Wrong definition of face %d: %d borders instead of 3 or 4"
,
Msg
::
Error
(
"Wrong definition of face %d: %d borders instead of 3 or 4"
,
num
,
j
);
num
,
j
);
List_T
*
t
e
mp
=
List_Create
(
2
,
2
,
sizeof
(
int
));
List_T
*
tmp
=
List_Create
(
2
,
2
,
sizeof
(
int
));
for
(
unsigned
int
i
=
0
;
i
<
wireTags
.
size
();
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
wireTags
.
size
();
i
++
)
List_Add
(
t
e
mp
,
&
wireTags
[
i
]);
List_Add
(
tmp
,
&
wireTags
[
i
]);
Surface
*
s
=
Create_Surface
(
num
,
type
);
Surface
*
s
=
Create_Surface
(
num
,
type
);
setSurfaceGeneratrices
(
s
,
t
e
mp
);
setSurfaceGeneratrices
(
s
,
tmp
);
List_Delete
(
t
e
mp
);
List_Delete
(
tmp
);
End_Surface
(
s
);
End_Surface
(
s
);
if
(
sphereCenterTag
>=
0
){
if
(
sphereCenterTag
>=
0
){
s
->
InSphereCenter
=
FindPoint
(
sphereCenterTag
);
s
->
InSphereCenter
=
FindPoint
(
sphereCenterTag
);
...
@@ -379,12 +379,12 @@ void GEO_Internals::addSurfaceLoop(int num, std::vector<int> faceTags)
...
@@ -379,12 +379,12 @@ void GEO_Internals::addSurfaceLoop(int num, std::vector<int> faceTags)
return
;
return
;
}
}
List_T
*
t
e
mp
=
List_Create
(
2
,
2
,
sizeof
(
int
));
List_T
*
tmp
=
List_Create
(
2
,
2
,
sizeof
(
int
));
for
(
unsigned
int
i
=
0
;
i
<
faceTags
.
size
();
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
faceTags
.
size
();
i
++
)
List_Add
(
t
e
mp
,
&
faceTags
[
i
]);
List_Add
(
tmp
,
&
faceTags
[
i
]);
SurfaceLoop
*
l
=
Create_SurfaceLoop
(
num
,
t
e
mp
);
SurfaceLoop
*
l
=
Create_SurfaceLoop
(
num
,
tmp
);
Tree_Add
(
SurfaceLoops
,
&
l
);
Tree_Add
(
SurfaceLoops
,
&
l
);
List_Delete
(
t
e
mp
);
List_Delete
(
tmp
);
_changed
=
true
;
_changed
=
true
;
}
}
...
@@ -395,12 +395,12 @@ void GEO_Internals::addVolume(int num, std::vector<int> shellTags)
...
@@ -395,12 +395,12 @@ void GEO_Internals::addVolume(int num, std::vector<int> shellTags)
return
;
return
;
}
}
List_T
*
t
e
mp
=
List_Create
(
2
,
2
,
sizeof
(
int
));
List_T
*
tmp
=
List_Create
(
2
,
2
,
sizeof
(
int
));
for
(
unsigned
int
i
=
0
;
i
<
shellTags
.
size
();
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
shellTags
.
size
();
i
++
)
List_Add
(
t
e
mp
,
&
shellTags
[
i
]);
List_Add
(
tmp
,
&
shellTags
[
i
]);
Volume
*
v
=
Create_Volume
(
num
,
MSH_VOLUME
);
Volume
*
v
=
Create_Volume
(
num
,
MSH_VOLUME
);
setVolumeSurfaces
(
v
,
t
e
mp
);
setVolumeSurfaces
(
v
,
tmp
);
List_Delete
(
t
e
mp
);
List_Delete
(
tmp
);
Tree_Add
(
Volumes
,
&
v
);
Tree_Add
(
Volumes
,
&
v
);
_changed
=
true
;
_changed
=
true
;
}
}
...
@@ -425,6 +425,55 @@ void GEO_Internals::resetPhysicalGroups()
...
@@ -425,6 +425,55 @@ void GEO_Internals::resetPhysicalGroups()
_changed
=
true
;
_changed
=
true
;
}
}
void
GEO_Internals
::
modifyPhysicalGroup
(
int
dim
,
int
num
,
int
op
,
std
::
vector
<
int
>
tags
)
{
int
type
;
std
::
string
str
;
switch
(
dim
){
case
0
:
type
=
MSH_PHYSICAL_POINT
;
str
=
"point"
;
break
;
case
1
:
type
=
MSH_PHYSICAL_LINE
;
str
=
"line"
;
break
;
case
2
:
type
=
MSH_PHYSICAL_SURFACE
;
str
=
"surface"
;
break
;
case
3
:
type
=
MSH_PHYSICAL_VOLUME
;
str
=
"volume"
;
break
;
}
PhysicalGroup
*
p
=
FindPhysicalGroup
(
num
,
type
);
if
(
p
&&
op
==
0
){
Msg
::
Error
(
"Physical %s %d already exists"
,
str
.
c_str
(),
num
);
}
else
if
(
!
p
&&
op
>
0
){
Msg
::
Error
(
"Physical %s %d does not exist"
,
str
.
c_str
(),
num
);
}
else
if
(
op
==
0
){
List_T
*
tmp
=
List_Create
(
10
,
10
,
sizeof
(
int
));
for
(
unsigned
int
i
=
0
;
i
<
tags
.
size
();
i
++
)
List_Add
(
tmp
,
&
tags
[
i
]);
p
=
Create_PhysicalGroup
(
num
,
type
,
tmp
);
List_Delete
(
tmp
);
List_Add
(
PhysicalGroups
,
&
p
);
}
else
if
(
op
==
1
){
for
(
unsigned
int
i
=
0
;
i
<
tags
.
size
();
i
++
){
List_Add
(
p
->
Entities
,
&
tags
[
i
]);
}
}
else
if
(
op
==
2
){
for
(
unsigned
int
i
=
0
;
i
<
tags
.
size
();
i
++
){
List_Suppress
(
p
->
Entities
,
&
tags
[
i
],
fcmp_int
);
}
if
(
!
List_Nbr
(
p
->
Entities
)){
switch
(
dim
){
case
0
:
DeletePhysicalPoint
(
num
);
break
;
case
1
:
DeletePhysicalLine
(
num
);
break
;
case
2
:
DeletePhysicalSurface
(
num
);
break
;
case
3
:
DeletePhysicalVolume
(
num
);
break
;
}
}
}
else
{
Msg
::
Error
(
"Unsupported operation on physical %s %d"
,
str
.
c_str
(),
num
);
}
}
void
GEO_Internals
::
removeAllDuplicates
()
void
GEO_Internals
::
removeAllDuplicates
()
{
{
ReplaceAllDuplicates
();
ReplaceAllDuplicates
();
...
@@ -1159,7 +1208,7 @@ int GModel::writeGEO(const std::string &name, bool printLabels, bool onlyPhysica
...
@@ -1159,7 +1208,7 @@ int GModel::writeGEO(const std::string &name, bool printLabels, bool onlyPhysica
int
GModel
::
exportDiscreteGEOInternals
()
int
GModel
::
exportDiscreteGEOInternals
()
{
{
int
maxv
=
1
;
// FIXME: tem
p
orary - see TODO below
int
maxv
=
1
;
// FIXME: temorary - see TODO below
if
(
_geo_internals
){
if
(
_geo_internals
){
maxv
=
_geo_internals
->
MaxVolumeNum
;
maxv
=
_geo_internals
->
MaxVolumeNum
;
...
...
This diff is collapsed.
Click to expand it.
Geo/GModelIO_GEO.h
+
2
−
1
View file @
852a05cc
...
@@ -52,8 +52,9 @@ class GEO_Internals{
...
@@ -52,8 +52,9 @@ class GEO_Internals{
void
addVolume
(
int
num
,
std
::
vector
<
int
>
shellTags
);
void
addVolume
(
int
num
,
std
::
vector
<
int
>
shellTags
);
void
addCompoundVolume
(
int
num
,
std
::
vector
<
int
>
regionTags
);
void
addCompoundVolume
(
int
num
,
std
::
vector
<
int
>
regionTags
);
// manipulate physical groups
(this will eventually move directly to GModel)
// manipulate physical groups
void
resetPhysicalGroups
();
void
resetPhysicalGroups
();
void
modifyPhysicalGroup
(
int
dim
,
int
num
,
int
op
,
std
::
vector
<
int
>
tags
);
// coherence
// coherence
void
removeAllDuplicates
();
void
removeAllDuplicates
();
...
...
This diff is collapsed.
Click to expand it.
Parser/Gmsh.tab.cpp
+
439
−
571
View file @
852a05cc
This diff is collapsed.
Click to expand it.
Parser/Gmsh.y
+
8
−
140
View file @
852a05cc
...
@@ -2319,41 +2319,8 @@ Shape :
...
@@ -2319,41 +2319,8 @@ Shape :
{
{
int num = (int)$4;
int num = (int)$4;
int op = $6;
int op = $6;
PhysicalGroup *p = FindPhysicalGroup(num, MSH_PHYSICAL_POINT);
std::vector<int> tags; ListOfDouble2Vector($7, tags);
if(p && op == 0){
GModel::current()->getGEOInternals()->modifyPhysicalGroup(0, num, op, tags);
yymsg(0, "Physical point %d already exists", num);
}
else if(!p && op > 0){
yymsg(0, "Physical point %d does not exist", num);
}
else if(op == 0){
List_T *temp = ListOfDouble2ListOfInt($7);
p = Create_PhysicalGroup(num, MSH_PHYSICAL_POINT, temp);
List_Delete(temp);
List_Add(GModel::current()->getGEOInternals()->PhysicalGroups, &p);
}
else if(op == 1){
for(int i = 0; i < List_Nbr($7); i++){
double d;
List_Read($7, i, &d);
int j = (int)d;
List_Add(p->Entities, &j);
}
}
else if(op == 2){
for(int i = 0; i < List_Nbr($7); i++){
double d;
List_Read($7, i, &d);
int j = (int)d;
List_Suppress(p->Entities, &j, fcmp_int);
}
if(!List_Nbr(p->Entities)){
DeletePhysicalPoint(num);
}
}
else{
yymsg(0, "Unsupported operation on physical point %d", num);
}
List_Delete($7);
List_Delete($7);
$$.Type = MSH_PHYSICAL_POINT;
$$.Type = MSH_PHYSICAL_POINT;
$$.Num = num;
$$.Num = num;
...
@@ -2362,41 +2329,8 @@ Shape :
...
@@ -2362,41 +2329,8 @@ Shape :
{
{
int num = (int)$4;
int num = (int)$4;
int op = $6;
int op = $6;
PhysicalGroup *p = FindPhysicalGroup(num, MSH_PHYSICAL_LINE);
std::vector<int> tags; ListOfDouble2Vector($7, tags);
if(p && op == 0){
GModel::current()->getGEOInternals()->modifyPhysicalGroup(1, num, op, tags);
yymsg(0, "Physical line %d already exists", num);
}
else if(!p && op > 0){
yymsg(0, "Physical line %d does not exist", num);
}
else if(op == 0){
List_T *temp = ListOfDouble2ListOfInt($7);
p = Create_PhysicalGroup(num, MSH_PHYSICAL_LINE, temp);
List_Delete(temp);
List_Add(GModel::current()->getGEOInternals()->PhysicalGroups, &p);
}
else if(op == 1){
for(int i = 0; i < List_Nbr($7); i++){
double d;
List_Read($7, i, &d);
int j = (int)d;
List_Add(p->Entities, &j);
}
}
else if(op == 2){
for(int i = 0; i < List_Nbr($7); i++){
double d;
List_Read($7, i, &d);
int j = (int)d;
List_Suppress(p->Entities, &j, fcmp_int);
}
if(!List_Nbr(p->Entities)){
DeletePhysicalLine(num);
}
}
else{
yymsg(0, "Unsupported operation on physical line %d", num);
}
List_Delete($7);
List_Delete($7);
$$.Type = MSH_PHYSICAL_LINE;
$$.Type = MSH_PHYSICAL_LINE;
$$.Num = num;
$$.Num = num;
...
@@ -2405,41 +2339,8 @@ Shape :
...
@@ -2405,41 +2339,8 @@ Shape :
{
{
int num = (int)$4;
int num = (int)$4;
int op = $6;
int op = $6;
PhysicalGroup *p = FindPhysicalGroup(num, MSH_PHYSICAL_SURFACE);
std::vector<int> tags; ListOfDouble2Vector($7, tags);
if(p && op == 0){
GModel::current()->getGEOInternals()->modifyPhysicalGroup(2, num, op, tags);
yymsg(0, "Physical surface %d already exists", num);
}
else if(!p && op > 0){
yymsg(0, "Physical surface %d does not exist", num);
}
else if(op == 0){
List_T *temp = ListOfDouble2ListOfInt($7);
p = Create_PhysicalGroup(num, MSH_PHYSICAL_SURFACE, temp);
List_Delete(temp);
List_Add(GModel::current()->getGEOInternals()->PhysicalGroups, &p);
}
else if(op == 1){
for(int i = 0; i < List_Nbr($7); i++){
double d;
List_Read($7, i, &d);
int j = (int)d;
List_Add(p->Entities, &j);
}
}
else if(op == 2){
for(int i = 0; i < List_Nbr($7); i++){
double d;
List_Read($7, i, &d);
int j = (int)d;
List_Suppress(p->Entities, &j, fcmp_int);
}
if(!List_Nbr(p->Entities)){
DeletePhysicalSurface(num);
}
}
else{
yymsg(0, "Unsupported operation on physical surface %d", num);
}
List_Delete($7);
List_Delete($7);
$$.Type = MSH_PHYSICAL_SURFACE;
$$.Type = MSH_PHYSICAL_SURFACE;
$$.Num = num;
$$.Num = num;
...
@@ -2448,41 +2349,8 @@ Shape :
...
@@ -2448,41 +2349,8 @@ Shape :
{
{
int num = (int)$4;
int num = (int)$4;
int op = $6;
int op = $6;
PhysicalGroup *p = FindPhysicalGroup(num, MSH_PHYSICAL_VOLUME);
std::vector<int> tags; ListOfDouble2Vector($7, tags);
if(p && op == 0){
GModel::current()->getGEOInternals()->modifyPhysicalGroup(3, num, op, tags);
yymsg(0, "Physical volume %d already exists", num);
}
else if(!p && op > 0){
yymsg(0, "Physical volume %d does not exist", num);
}
else if(op == 0){
List_T *temp = ListOfDouble2ListOfInt($7);
p = Create_PhysicalGroup(num, MSH_PHYSICAL_VOLUME, temp);
List_Delete(temp);
List_Add(GModel::current()->getGEOInternals()->PhysicalGroups, &p);
}
else if(op == 1){
for(int i = 0; i < List_Nbr($7); i++){
double d;
List_Read($7, i, &d);
int j = (int)d;
List_Add(p->Entities, &j);
}
}
else if(op == 2){
for(int i = 0; i < List_Nbr($7); i++){
double d;
List_Read($7, i, &d);
int j = (int)d;
List_Suppress(p->Entities, &j, fcmp_int);
}
if(!List_Nbr(p->Entities)){
DeletePhysicalVolume(num);
}
}
else{
yymsg(0, "Unsupported operation on physical volume %d", num);
}
List_Delete($7);
List_Delete($7);
$$.Type = MSH_PHYSICAL_VOLUME;
$$.Type = MSH_PHYSICAL_VOLUME;
$$.Num = num;
$$.Num = num;
...
...
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