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
Package registry
Model registry
Operate
Terraform modules
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
Romin Tomasetti
gmsh
Commits
308bf03c
Commit
308bf03c
authored
8 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
more work on boolean numbering
parent
26df45f9
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
Geo/GModelIO_OCC.cpp
+25
-40
25 additions, 40 deletions
Geo/GModelIO_OCC.cpp
benchmarks/3d/Cube-05.geo
+2
-2
2 additions, 2 deletions
benchmarks/3d/Cube-05.geo
demos/boolean/baffles.geo
+4
-5
4 additions, 5 deletions
demos/boolean/baffles.geo
with
31 additions
and
47 deletions
Geo/GModelIO_OCC.cpp
+
25
−
40
View file @
308bf03c
...
@@ -2214,12 +2214,9 @@ bool OCC_Internals::booleanOperator(int tag, BooleanOperator op,
...
@@ -2214,12 +2214,9 @@ bool OCC_Internals::booleanOperator(int tag, BooleanOperator op,
return
false
;
return
false
;
}
}
// don't try to preserve numbering if we specify the tag explicitly, or if
// if we specify the tag explicitly, just go ahead and bind the resulting
// there is a problem
// shape (and sub-shapes)
bool
bug1
=
(
objectDimTags
.
size
()
+
toolDimTags
.
size
()
!=
mapModified
.
size
());
if
(
tag
>=
0
){
bool
bug2
=
(
op
==
OCC_Internals
::
Union
);
// strange fuse behavior in OCC 7.1
if
(
tag
>=
0
||
bug1
||
bug2
){
if
(
bug1
)
Msg
::
Error
(
"Wrong shape count in boolean operation"
);
if
(
removeObject
){
if
(
removeObject
){
for
(
unsigned
int
i
=
0
;
i
<
objectDimTags
.
size
();
i
++
){
for
(
unsigned
int
i
=
0
;
i
<
objectDimTags
.
size
();
i
++
){
int
d
=
objectDimTags
[
i
].
first
;
int
d
=
objectDimTags
[
i
].
first
;
...
@@ -2239,26 +2236,22 @@ bool OCC_Internals::booleanOperator(int tag, BooleanOperator op,
...
@@ -2239,26 +2236,22 @@ bool OCC_Internals::booleanOperator(int tag, BooleanOperator op,
return
true
;
return
true
;
}
}
// otherwise, try to preserve the numbering
// otherwise, preserve the numbering of the input shapes that did not change,
// or that were replaced by a single shape
for
(
unsigned
int
i
=
0
;
i
<
objectDimTags
.
size
();
i
++
){
for
(
unsigned
int
i
=
0
;
i
<
objectDimTags
.
size
();
i
++
){
int
dim
=
objectDimTags
[
i
].
first
;
int
dim
=
objectDimTags
[
i
].
first
;
int
tag
=
objectDimTags
[
i
].
second
;
int
tag
=
objectDimTags
[
i
].
second
;
if
(
mapDeleted
[
i
]
&&
!
mapGenerated
[
i
].
Extent
()){
if
(
mapDeleted
[
i
]){
// object deleted
// the shape has been deleted
if
(
removeObject
)
unbind
(
mapOriginal
[
i
],
dim
,
tag
,
true
);
if
(
removeObject
&&
_isBound
(
dim
,
mapOriginal
[
i
])){
unbind
(
mapOriginal
[
i
],
dim
,
tag
,
true
);
}
}
}
else
if
(
mapModified
[
i
].
Extent
()
==
0
){
else
if
(
mapModified
[
i
].
Extent
()
==
0
){
// object not modified
// the shape has not been modified
outDimTags
.
push_back
(
std
::
pair
<
int
,
int
>
(
dim
,
tag
));
outDimTags
.
push_back
(
std
::
pair
<
int
,
int
>
(
dim
,
tag
));
unbind
(
mapOriginal
[
i
],
dim
,
tag
,
false
);
// not recursive!
bind
(
mapOriginal
[
i
],
dim
,
tag
,
false
);
// not recursive!
}
}
else
if
(
mapModified
[
i
].
Extent
()
==
1
){
else
if
(
mapModified
[
i
].
Extent
()
==
1
){
// object replaced by single one
if
(
removeObject
){
if
(
removeObject
){
// the shape has been replaced by a single shape, keep the same tag
if
(
_isBound
(
dim
,
mapOriginal
[
i
])){
unbind
(
mapOriginal
[
i
],
dim
,
tag
,
true
);
unbind
(
mapOriginal
[
i
],
dim
,
tag
,
true
);
}
bind
(
mapModified
[
i
].
First
(),
dim
,
tag
,
false
);
// not recursive!
bind
(
mapModified
[
i
].
First
(),
dim
,
tag
,
false
);
// not recursive!
int
t
=
_find
(
dim
,
mapModified
[
i
].
First
());
int
t
=
_find
(
dim
,
mapModified
[
i
].
First
());
if
(
tag
!=
t
)
if
(
tag
!=
t
)
...
@@ -2267,32 +2260,24 @@ bool OCC_Internals::booleanOperator(int tag, BooleanOperator op,
...
@@ -2267,32 +2260,24 @@ bool OCC_Internals::booleanOperator(int tag, BooleanOperator op,
}
}
}
}
else
{
else
{
if
(
removeObject
&&
_isBound
(
dim
,
mapOriginal
[
i
])){
if
(
removeObject
)
unbind
(
mapOriginal
[
i
],
dim
,
tag
,
true
);
unbind
(
mapOriginal
[
i
],
dim
,
tag
,
true
);
}
}
}
}
}
for
(
unsigned
int
i
=
0
;
i
<
toolDimTags
.
size
();
i
++
){
for
(
unsigned
int
i
=
0
;
i
<
toolDimTags
.
size
();
i
++
){
int
k
=
objectDimTags
.
size
()
+
i
;
int
k
=
objectDimTags
.
size
()
+
i
;
int
dim
=
toolDimTags
[
i
].
first
;
int
dim
=
toolDimTags
[
i
].
first
;
int
tag
=
toolDimTags
[
i
].
second
;
int
tag
=
toolDimTags
[
i
].
second
;
if
(
mapDeleted
[
k
]
&&
!
mapGenerated
[
k
].
Extent
()){
if
(
mapDeleted
[
k
]){
// tool deleted
// the shape has been deleted
if
(
removeTool
)
unbind
(
mapOriginal
[
k
],
dim
,
tag
,
true
);
if
(
removeTool
&&
_isBound
(
dim
,
mapOriginal
[
k
])){
unbind
(
mapOriginal
[
k
],
dim
,
tag
,
true
);
}
}
}
else
if
(
mapModified
[
k
].
Extent
()
==
0
){
else
if
(
mapModified
[
k
].
Extent
()
==
0
){
// tool not modified
// the shape has not been modified
outDimTags
.
push_back
(
std
::
pair
<
int
,
int
>
(
dim
,
tag
));
outDimTags
.
push_back
(
std
::
pair
<
int
,
int
>
(
dim
,
tag
));
unbind
(
mapOriginal
[
k
],
dim
,
tag
,
false
);
// not recursive!
bind
(
mapOriginal
[
k
],
dim
,
tag
,
false
);
// not recursive!
}
}
else
if
(
mapModified
[
k
].
Extent
()
==
1
){
else
if
(
mapModified
[
k
].
Extent
()
==
1
){
if
(
removeTool
){
if
(
removeTool
){
// tool replaced by single one
// the shape has been replaced by a single shape, keep the same tag
if
(
_isBound
(
dim
,
mapOriginal
[
k
])){
unbind
(
mapOriginal
[
k
],
dim
,
tag
,
true
);
unbind
(
mapOriginal
[
k
],
dim
,
tag
,
true
);
}
bind
(
mapModified
[
k
].
First
(),
dim
,
tag
,
false
);
// not recursive!
bind
(
mapModified
[
k
].
First
(),
dim
,
tag
,
false
);
// not recursive!
int
t
=
_find
(
dim
,
mapModified
[
k
].
First
());
int
t
=
_find
(
dim
,
mapModified
[
k
].
First
());
if
(
tag
!=
t
)
if
(
tag
!=
t
)
...
@@ -2301,14 +2286,12 @@ bool OCC_Internals::booleanOperator(int tag, BooleanOperator op,
...
@@ -2301,14 +2286,12 @@ bool OCC_Internals::booleanOperator(int tag, BooleanOperator op,
}
}
}
}
else
{
else
{
if
(
removeTool
&&
_isBound
(
dim
,
mapOriginal
[
k
])){
if
(
removeTool
)
unbind
(
mapOriginal
[
k
],
dim
,
tag
,
true
);
unbind
(
mapOriginal
[
k
],
dim
,
tag
,
true
);
}
}
}
}
}
// bind all remaining entities and add
(only)
new one to the returned list
// bind all remaining entities and add
the
new one
s
to the returned list
_multiBind
(
result
,
tag
,
outDimTags
,
false
,
true
,
true
);
_multiBind
(
result
,
-
1
,
outDimTags
,
false
,
true
,
true
);
_filterTags
(
outDimTags
,
minDim
);
_filterTags
(
outDimTags
,
minDim
);
return
true
;
return
true
;
...
@@ -2383,6 +2366,8 @@ bool OCC_Internals::_transform(const std::vector<std::pair<int, int> > &inDimTag
...
@@ -2383,6 +2366,8 @@ bool OCC_Internals::_transform(const std::vector<std::pair<int, int> > &inDimTag
}
}
result
=
gtfo
->
Shape
();
result
=
gtfo
->
Shape
();
}
}
// FIXME we should implement rebind(object, result, dim) which would
// unbind/bind all subshapes to the same tags
unbind
(
object
,
dim
,
tag
,
true
);
unbind
(
object
,
dim
,
tag
,
true
);
bind
(
result
,
dim
,
tag
,
true
);
bind
(
result
,
dim
,
tag
,
true
);
}
}
...
...
This diff is collapsed.
Click to expand it.
benchmarks/3d/Cube-05.geo
+
2
−
2
View file @
308bf03c
lv
=
.1
;
lv
=
.1
5
;
lc
=
.1
;
lc
=
.1
2
;
Point
(
1
)
=
{
0.0
,
0.0
,
0.0
,
lv
};
Point
(
1
)
=
{
0.0
,
0.0
,
0.0
,
lv
};
Point
(
2
)
=
{
1
,
0.0
,
0.0
,
lv
};
Point
(
2
)
=
{
1
,
0.0
,
0.0
,
lv
};
Point
(
3
)
=
{
1
,
1
,
0.0
,
lv
};
Point
(
3
)
=
{
1
,
1
,
0.0
,
lv
};
...
...
This diff is collapsed.
Click to expand it.
demos/boolean/baffles.geo
+
4
−
5
View file @
308bf03c
SetFactory
(
"OpenCASCADE"
);
SetFactory
(
"OpenCASCADE"
);
Block
(
1
)
=
{
-
0
,
0
,
0
,
1
,
1
,
1
};
Block
(
1
)
=
{
-
0
,
0
,
0
,
1
,
1
,
1
};
p
()
=
PointsOf
{
Volume
{
1
};
};
Characteristic
Length
{
p
()}
=
0.2
;
// intersecting:
Rectangle
(
7
)
=
{
0.4
,
0.7
,
0.2
,
0.3
,
0.3
,
0
};
Rectangle
(
7
)
=
{
0.4
,
0.7
,
0.2
,
0.3
,
0.3
,
0
};
Rectangle
(
8
)
=
{
-
0.2
,
0.3
,
0.5
,
0.3
,
0.3
,
0
};
Rectangle
(
8
)
=
{
-
0.2
,
0.3
,
0.5
,
0.3
,
0.3
,
0
};
Rectangle
(
9
)
=
{
0.8
,
-
0.2
,
0.5
,
0.3
,
0.3
,
0
};
Rectangle
(
9
)
=
{
0.8
,
-
0.2
,
0.5
,
0.3
,
0.3
,
0
};
...
@@ -11,6 +11,5 @@ Rectangle(10) = {0.3, 0.3, 0.5, 0.3, 0.3, 0};
...
@@ -11,6 +11,5 @@ Rectangle(10) = {0.3, 0.3, 0.5, 0.3, 0.3, 0};
a
()
=
BooleanFragments
{
Volume
{
1
};
Delete
;
}{
Surface
{
7
:
10
};
Delete
;
};
a
()
=
BooleanFragments
{
Volume
{
1
};
Delete
;
}{
Surface
{
7
:
10
};
Delete
;
};
Printf
(
"a = "
,
a
());
Printf
(
"a = "
,
a
());
//Characteristic Length{Point "*"} = 0.1;
p
()
=
PointsOf
{
Surface
{
a
({
1
:
6
})};
};
//p() = PointsOf{ Surface{a({1:#a()-1})}; };
Characteristic
Length
{
p
()}
=
0.04
;
//Characteristic Length{p()} = 0.01;
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