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
faf9c317
Commit
faf9c317
authored
8 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
fix
parent
ca0cb8f4
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
Geo/GModelIO_OCC.cpp
+87
-14
87 additions, 14 deletions
Geo/GModelIO_OCC.cpp
Geo/GModelIO_OCC.h
+2
-2
2 additions, 2 deletions
Geo/GModelIO_OCC.h
with
89 additions
and
16 deletions
Geo/GModelIO_OCC.cpp
+
87
−
14
View file @
faf9c317
...
...
@@ -183,6 +183,79 @@ void OCC_Internals::_addShapeToLists(TopoDS_Shape shape, std::vector<int> indice
}
}
/*
void OCC_Internals::_removeShapeFromLists(TopoDS_Shape shape)
{
std::vector<int> toRemove[6];
// Solids
TopExp_Explorer exp0, exp1, exp2, exp3, exp4, exp5;
for(exp0.Init(shape, TopAbs_SOLID); exp0.More(); exp0.Next()){
TopoDS_Solid solid = TopoDS::Solid(exp0.Current());
int soi = _somap.FindIndex(solid);
if(index > 0){
toRemove[0].push_back(soi);
for(exp1.Init(solid, TopAbs_SHELL); exp1.More(); exp1.Next()){
TopoDS_Shell shell = TopoDS::Shell(exp1.Current());
int shi = _shmap.FindIndex(shell);
if(shi > 0){
toRemove[1].push_back(shi);
for(exp2.Init(shell, TopAbs_FACE); exp2.More(); exp2.Next()){
TopoDS_Face face = TopoDS::Face(exp2.Current());
int fi = _fmap.FindIndex(face);
if(fi > 0){
toRemove[2].push_back(fi);
for(exp3.Init(exp2.Current().Oriented(TopAbs_FORWARD), TopAbs_WIRE); exp3.More(); exp3.Next()){
TopoDS_Wire wire = TopoDS::Wire(exp3.Current());
int wi = _wmap.FindIndex(wire);
if(wi > 0){
toRemove[3].push_back(wi);
for(exp4.Init(exp3.Current(), TopAbs_EDGE); exp4.More(); exp4.Next()){
TopoDS_Edge edge = TopoDS::Edge(exp4.Current());
int ei = _emap.FindIndex(edge);
if(ei > 0){
toRemove[4].push_back(ei);
for(exp5.Init(exp4.Current(), TopAbs_VERTEX); exp5.More(); exp5.Next()){
TopoDS_Vertex vertex = TopoDS::Vertex(exp5.Current());
int vi = _vmap.FindIndex(vertex);
if(vi > 0){
toRemove[5].push_back(vi);
}
}
}
}
}
}
}
}
}
}
}
}
// TODO do the same with other shapes
TopTools_IndexedMapOfShape somap, shmap, fmap, wmap, emap, vmap;
std::map<int, int> rIndexTag, rTagIndex;
for(int i = 1; i <= _somap.Extent(); i++){
bool remove = false;
for(int j = 0; j < toRemove[0].size(); j++){
if(i == toRemove[j]){
remove = true;
break;
}
}
if(remove) continue;
int tag = _rIndexTag[i];
somap.Add(_somap(i));
int index = tmp.Extent();
rIndexTag[index] = tag;
rTagIndex[tag] = index;
}
_somap = somap;
_rTagIndex = rTagIndex;
_rIndexTag = rIndexTag;
}
*/
void
OCC_Internals
::
addVertex
(
int
tag
,
double
x
,
double
y
,
double
z
)
{
if
(
_vTagIndex
.
count
(
tag
)){
...
...
@@ -209,27 +282,27 @@ void OCC_Internals::addVertex(int tag, double x, double y, double z)
}
}
void
OCC_Internals
::
addCircleArc
(
int
tag
,
int
tagS
tart
,
int
tagC
enter
,
int
tagEnd
)
void
OCC_Internals
::
addCircleArc
(
int
tag
,
int
s
tart
Tag
,
int
c
enter
Tag
,
int
endTag
)
{
if
(
_eTagIndex
.
count
(
tag
)){
Msg
::
Error
(
"OCC edge with tag %d already exists"
,
tag
);
return
;
}
std
::
map
<
int
,
int
>::
iterator
itStart
=
_vTagIndex
.
find
(
tagS
tart
);
std
::
map
<
int
,
int
>::
iterator
itCenter
=
_vTagIndex
.
find
(
tagC
enter
);
std
::
map
<
int
,
int
>::
iterator
itEnd
=
_vTagIndex
.
find
(
tagEnd
);
std
::
map
<
int
,
int
>::
iterator
itStart
=
_vTagIndex
.
find
(
s
tart
Tag
);
std
::
map
<
int
,
int
>::
iterator
itCenter
=
_vTagIndex
.
find
(
c
enter
Tag
);
std
::
map
<
int
,
int
>::
iterator
itEnd
=
_vTagIndex
.
find
(
endTag
);
if
(
itStart
==
_vTagIndex
.
end
()){
Msg
::
Error
(
"Unknown OCC vertex with tag %d"
,
tagS
tart
);
Msg
::
Error
(
"Unknown OCC vertex with tag %d"
,
s
tart
Tag
);
return
;
}
if
(
itCenter
==
_vTagIndex
.
end
()){
Msg
::
Error
(
"Unknown OCC vertex with tag %d"
,
tagC
enter
);
Msg
::
Error
(
"Unknown OCC vertex with tag %d"
,
c
enter
Tag
);
return
;
}
if
(
itEnd
==
_vTagIndex
.
end
()){
Msg
::
Error
(
"Unknown OCC vertex with tag %d"
,
tagEnd
);
Msg
::
Error
(
"Unknown OCC vertex with tag %d"
,
endTag
);
return
;
}
...
...
@@ -289,7 +362,7 @@ void OCC_Internals::addSphere(int tag, double xc, double yc, double zc, double r
}
}
void
OCC_Internals
::
addThruSections
(
int
tag
,
std
::
vector
<
std
::
vector
<
int
>
>
tagEdge
s
)
void
OCC_Internals
::
addThruSections
(
int
tag
,
std
::
vector
<
std
::
vector
<
int
>
>
edgeTag
s
)
{
if
(
_rTagIndex
.
count
(
tag
)){
Msg
::
Error
(
"OCC region with tag %d already exists"
,
tag
);
...
...
@@ -299,12 +372,12 @@ void OCC_Internals::addThruSections(int tag, std::vector<std::vector<int> > tagE
TopoDS_Solid
result
;
try
{
BRepOffsetAPI_ThruSections
aGenerator
(
Standard_True
);
// create solid
for
(
unsigned
i
=
0
;
i
<
tagEdge
s
.
size
();
i
++
)
{
for
(
unsigned
i
=
0
;
i
<
edgeTag
s
.
size
();
i
++
)
{
BRepBuilderAPI_MakeWire
wire_maker
;
for
(
unsigned
j
=
0
;
j
<
tagEdge
s
[
i
].
size
();
j
++
)
{
std
::
map
<
int
,
int
>::
iterator
it
=
_eTagIndex
.
find
(
tagEdge
s
[
i
][
j
]);
for
(
unsigned
j
=
0
;
j
<
edgeTag
s
[
i
].
size
();
j
++
)
{
std
::
map
<
int
,
int
>::
iterator
it
=
_eTagIndex
.
find
(
edgeTag
s
[
i
][
j
]);
if
(
it
==
_eTagIndex
.
end
()){
Msg
::
Error
(
"Unknown OCC edge with tag %d"
,
tagEdge
s
[
i
][
j
]);
Msg
::
Error
(
"Unknown OCC edge with tag %d"
,
edgeTag
s
[
i
][
j
]);
return
;
}
TopoDS_Edge
edge
=
TopoDS
::
Edge
(
_emap
(
it
->
second
));
...
...
@@ -1558,8 +1631,8 @@ GRegion* GModel::getRegionForOCCShape(const void *shape)
return
0
;
}
int
GModel
::
importOCCInternals
()
{
Msg
::
Error
(
"Gmsh must be compiled with Open CASCADE support to query OCC shape"
);
int
GModel
::
importOCCInternals
()
{
return
0
;
}
...
...
This diff is collapsed.
Click to expand it.
Geo/GModelIO_OCC.h
+
2
−
2
View file @
faf9c317
...
...
@@ -38,9 +38,9 @@ class OCC_Internals {
// add shapes only using internal OCC data
void
addVertex
(
int
tag
,
double
x
,
double
y
,
double
z
);
void
addCircleArc
(
int
tag
,
int
tagS
tart
,
int
tagC
enter
,
int
tagEnd
);
void
addCircleArc
(
int
tag
,
int
s
tart
Tag
,
int
c
enter
Tag
,
int
endTag
);
void
addSphere
(
int
tag
,
double
xc
,
double
yc
,
double
zc
,
double
radius
);
void
addThruSections
(
int
tag
,
std
::
vector
<
std
::
vector
<
int
>
>
tagEdge
s
);
void
addThruSections
(
int
tag
,
std
::
vector
<
std
::
vector
<
int
>
>
edgeTag
s
);
// apply boolean operation
void
applyBooleanOperator
(
int
tag
,
...
...
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