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
b00839b4
Commit
b00839b4
authored
19 years ago
by
Jean-François Remacle
Browse files
Options
Downloads
Patches
Plain Diff
*** empty log message ***
parent
f29e84dc
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
Mesh/BDS.cpp
+78
-27
78 additions, 27 deletions
Mesh/BDS.cpp
Mesh/BDS.h
+13
-2
13 additions, 2 deletions
Mesh/BDS.h
Mesh/DiscreteSurface.cpp
+35
-30
35 additions, 30 deletions
Mesh/DiscreteSurface.cpp
with
126 additions
and
59 deletions
Mesh/BDS.cpp
+
78
−
27
View file @
b00839b4
...
@@ -12,6 +12,27 @@
...
@@ -12,6 +12,27 @@
*/
*/
double
BDS_Quadric
::
normalCurv
(
double
x
,
double
y
,
double
z
)
const
{
// K = div n = div ( Grad(f) / ||Grad(f)||)
// = Laplacian (f) / ||Grad(f)|| - Grad^t(f) Hessian Grad(f) / ||Grad(f)||^3
BDS_Vector
g
=
Gradient
(
x
,
y
,
z
);
double
normG
=
sqrt
(
g
.
x
*
g
.
x
+
g
.
y
*
g
.
y
+
g
.
z
*
g
.
z
);
double
c1
=
2
*
(
a
+
b
+
c
)
/
normG
;
double
c2
=
2
*
a
*
g
.
x
*
g
.
x
+
2
*
b
*
g
.
y
*
g
.
y
+
2
*
c
*
g
.
z
*
g
.
z
+
4
*
d
*
g
.
x
*
g
.
y
+
4
*
e
*
g
.
x
*
g
.
z
+
4
*
f
*
g
.
y
*
g
.
z
;
//printf("%g %g %g %g %g %g\n",a,b,c,normG,c1, c2 / (normG*normG*normG));
return
fabs
(
c1
-
c2
/
(
normG
*
normG
*
normG
));
}
void
BDS_Quadric
::
projection
(
double
xa
,
double
ya
,
double
za
,
void
BDS_Quadric
::
projection
(
double
xa
,
double
ya
,
double
za
,
double
&
x
,
double
&
y
,
double
&
z
)
const
double
&
x
,
double
&
y
,
double
&
z
)
const
...
@@ -47,7 +68,7 @@ void BDS_Quadric::projection ( double xa, double ya, double za,
...
@@ -47,7 +68,7 @@ void BDS_Quadric::projection ( double xa, double ya, double za,
grad
.
x
*
g
+
grad
.
y
*
h
+
grad
.
z
*
i
;
grad
.
x
*
g
+
grad
.
y
*
h
+
grad
.
z
*
i
;
double
delta
=
coef2
*
coef2
-
4.
*
coef1
*
residual
;
double
delta
=
coef2
*
coef2
-
4.
*
coef1
*
residual
;
if
(
delta
<
0
){
if
(
delta
<
0
){
printf
(
"aaargh error projection"
);
//
printf ("aaargh error projection");
}
}
else
else
{
{
...
@@ -432,9 +453,9 @@ void BDS_Mesh :: reverseEngineerCAD ( )
...
@@ -432,9 +453,9 @@ void BDS_Mesh :: reverseEngineerCAD ( )
int
k
=
0
;
int
k
=
0
;
while
(
pit
!=
pite
)
while
(
pit
!=
pite
)
{
{
PLANE
(
k
,
0
)
=
(
*
pit
).
x
;
PLANE
(
k
,
0
)
=
(
*
pit
).
x
+
(
rand
()
%
1000
)
*
LC
/
1.e12
;
PLANE
(
k
,
1
)
=
(
*
pit
).
y
;
PLANE
(
k
,
1
)
=
(
*
pit
).
y
+
(
rand
()
%
1000
)
*
LC
/
1.e12
;
PLANE
(
k
,
2
)
=
(
*
pit
).
z
;
PLANE
(
k
,
2
)
=
(
*
pit
).
z
+
(
rand
()
%
1000
)
*
LC
/
1.e12
;
ONES
(
k
)
=
-
1
;
ONES
(
k
)
=
-
1
;
k
++
;
k
++
;
++
pit
;
++
pit
;
...
@@ -447,7 +468,7 @@ void BDS_Mesh :: reverseEngineerCAD ( )
...
@@ -447,7 +468,7 @@ void BDS_Mesh :: reverseEngineerCAD ( )
for
(
int
i
=
0
;
i
<
pts
.
size
();
i
++
)
for
(
int
i
=
0
;
i
<
pts
.
size
();
i
++
)
{
{
const
double
dist
=
PLANE
(
i
,
0
)
*
RSLT
(
0
)
+
PLANE
(
i
,
1
)
*
RSLT
(
1
)
+
PLANE
(
i
,
2
)
*
RSLT
(
2
)
+
1
;
const
double
dist
=
PLANE
(
i
,
0
)
*
RSLT
(
0
)
+
PLANE
(
i
,
1
)
*
RSLT
(
1
)
+
PLANE
(
i
,
2
)
*
RSLT
(
2
)
+
1
;
if
(
fabs
(
dist
)
>
1.e-5
*
LC
)
plane
=
false
;
if
(
fabs
(
dist
)
>
1.e-5
*
LC
*
sqrt
(
RSLT
(
0
)
*
RSLT
(
0
)
+
RSLT
(
1
)
*
RSLT
(
1
)
+
RSLT
(
2
)
*
RSLT
(
2
))
)
plane
=
false
;
}
}
if
(
plane
)
if
(
plane
)
...
@@ -456,7 +477,7 @@ void BDS_Mesh :: reverseEngineerCAD ( )
...
@@ -456,7 +477,7 @@ void BDS_Mesh :: reverseEngineerCAD ( )
(
*
it
)
->
surf
=
new
BDS_Plane
(
RSLT
(
0
),
RSLT
(
1
),
RSLT
(
2
));
(
*
it
)
->
surf
=
new
BDS_Plane
(
RSLT
(
0
),
RSLT
(
1
),
RSLT
(
2
));
}
}
}
}
if
(
!
(
*
it
)
->
surf
&&
pts
.
size
()
>
1
0
)
if
(
!
(
*
it
)
->
surf
&&
pts
.
size
()
>
2
0
)
{
{
printf
(
"coucou quadrique
\n
"
);
printf
(
"coucou quadrique
\n
"
);
Double_Matrix
QUADRIC
(
pts
.
size
()
,
9
);
Double_Matrix
QUADRIC
(
pts
.
size
()
,
9
);
...
@@ -482,20 +503,20 @@ void BDS_Mesh :: reverseEngineerCAD ( )
...
@@ -482,20 +503,20 @@ void BDS_Mesh :: reverseEngineerCAD ( )
}
}
QUADRIC
.
least_squares
(
ONES
,
RSLT
);
QUADRIC
.
least_squares
(
ONES
,
RSLT
);
bool
quad
=
true
;
bool
quad
=
true
;
for
(
int
i
=
0
;
i
<
pts
.
size
();
i
++
)
BDS_Quadric
temp
(
RSLT
(
0
),
RSLT
(
1
),
RSLT
(
2
),
RSLT
(
3
),
RSLT
(
4
),
RSLT
(
5
),
RSLT
(
6
),
RSLT
(
7
),
RSLT
(
8
));
pit
=
pts
.
begin
();
while
(
pit
!=
pite
)
{
{
const
double
dist
=
double
x
,
y
,
z
;
QUADRIC
(
i
,
0
)
*
RSLT
(
0
)
+
temp
.
projection
((
*
pit
).
x
,
(
*
pit
).
y
,
(
*
pit
).
z
,
QUADRIC
(
i
,
1
)
*
RSLT
(
1
)
+
x
,
y
,
z
);
QUADRIC
(
i
,
2
)
*
RSLT
(
2
)
+
const
double
dist
=
sqrt
(
((
*
pit
).
x
-
x
)
*
((
*
pit
).
x
-
x
)
+
QUADRIC
(
i
,
3
)
*
RSLT
(
3
)
+
((
*
pit
).
y
-
y
)
*
((
*
pit
).
y
-
y
)
+
QUADRIC
(
i
,
4
)
*
RSLT
(
4
)
+
((
*
pit
).
z
-
z
)
*
((
*
pit
).
z
-
z
));
QUADRIC
(
i
,
5
)
*
RSLT
(
5
)
+
// printf("%g %g %g ... %g %g %g\n",(*pit).x , (*pit).y , (*pit).z ,x,y,z);
QUADRIC
(
i
,
6
)
*
RSLT
(
6
)
+
QUADRIC
(
i
,
7
)
*
RSLT
(
7
)
+
if
(
dist
>
1.e-2
*
LC
)
quad
=
false
;
QUADRIC
(
i
,
8
)
*
RSLT
(
8
)
-
1
;
++
pit
;
// printf("dist = %g LC %g\n",dist,LC);
if
(
fabs
(
dist
)
>
1.e-3
*
LC
)
quad
=
false
;
}
}
if
(
quad
)
if
(
quad
)
{
{
...
@@ -1860,6 +1881,7 @@ int BDS_Mesh :: adapt_mesh ( double l, bool smooth, BDS_Mesh *geom_mesh)
...
@@ -1860,6 +1881,7 @@ int BDS_Mesh :: adapt_mesh ( double l, bool smooth, BDS_Mesh *geom_mesh)
{
{
int
nb_modif
=
0
;
int
nb_modif
=
0
;
double
CURV_FACTOR
=
5
;
// add initial set of edges in a list
// add initial set of edges in a list
std
::
set
<
BDS_Edge
*
,
EdgeLessThan
>
small_to_long
;
std
::
set
<
BDS_Edge
*
,
EdgeLessThan
>
small_to_long
;
...
@@ -1887,12 +1909,26 @@ int BDS_Mesh :: adapt_mesh ( double l, bool smooth, BDS_Mesh *geom_mesh)
...
@@ -1887,12 +1909,26 @@ int BDS_Mesh :: adapt_mesh ( double l, bool smooth, BDS_Mesh *geom_mesh)
double
ll
=
sqrt
((
op
[
0
]
->
X
-
op
[
1
]
->
X
)
*
(
op
[
0
]
->
X
-
op
[
1
]
->
X
)
+
double
ll
=
sqrt
((
op
[
0
]
->
X
-
op
[
1
]
->
X
)
*
(
op
[
0
]
->
X
-
op
[
1
]
->
X
)
+
(
op
[
0
]
->
Y
-
op
[
1
]
->
Y
)
*
(
op
[
0
]
->
Y
-
op
[
1
]
->
Y
)
+
(
op
[
0
]
->
Y
-
op
[
1
]
->
Y
)
*
(
op
[
0
]
->
Y
-
op
[
1
]
->
Y
)
+
(
op
[
0
]
->
Z
-
op
[
1
]
->
Z
)
*
(
op
[
0
]
->
Z
-
op
[
1
]
->
Z
));
(
op
[
0
]
->
Z
-
op
[
1
]
->
Z
)
*
(
op
[
0
]
->
Z
-
op
[
1
]
->
Z
));
double
curv
=
0.5
*
(
*
it
)
->
p1
->
radius_of_curvature
+
0.5
*
(
*
it
)
->
p2
->
radius_of_curvature
;
double
LLL
=
l
;
double
LLL
=
l
;
/// if (l > .50 * curv ) LLL = .50*curv;
if
((
*
it
)
->
g
&&
(
*
it
)
->
g
->
classif_degree
==
2
&&
(
*
it
)
->
g
->
surf
)
{
double
curvature
=
(
*
it
)
->
g
->
surf
->
normalCurv
(
0.5
*
((
*
it
)
->
p1
->
X
+
(
*
it
)
->
p2
->
X
),
0.5
*
((
*
it
)
->
p1
->
Y
+
(
*
it
)
->
p2
->
Y
),
0.5
*
((
*
it
)
->
p1
->
Z
+
(
*
it
)
->
p2
->
Z
));
if
(
curvature
>
0.0
)
{
double
radius_of_curvature
=
1.
/
curvature
;
// printf("surface %d radius %g\n",(*it)->g->classif_tag,radius_of_curvature);
double
maxL
=
radius_of_curvature
/
CURV_FACTOR
;
if
(
LLL
>
maxL
)
LLL
=
maxL
;
}
}
if
(
!
(
*
it
)
->
deleted
&&
(
*
it
)
->
length
()
>
LLL
/
0.7
&&
ll
>
0.25
*
LLL
){
if
(
!
(
*
it
)
->
deleted
&&
(
*
it
)
->
length
()
>
LLL
/
0.7
&&
ll
>
0.25
*
LLL
){
// printf("we schpilt\n");
split_edge
(
*
it
,
0.5
);
split_edge
(
*
it
,
0.5
);
nb_modif
++
;
nb_modif
++
;
}
}
...
@@ -1919,10 +1955,20 @@ int BDS_Mesh :: adapt_mesh ( double l, bool smooth, BDS_Mesh *geom_mesh)
...
@@ -1919,10 +1955,20 @@ int BDS_Mesh :: adapt_mesh ( double l, bool smooth, BDS_Mesh *geom_mesh)
std
::
set
<
BDS_Edge
*
,
EdgeLessThan
>::
iterator
ite
=
small_to_long
.
end
();
std
::
set
<
BDS_Edge
*
,
EdgeLessThan
>::
iterator
ite
=
small_to_long
.
end
();
while
(
it
!=
ite
)
while
(
it
!=
ite
)
{
{
double
curv
=
0.5
*
(
*
it
)
->
p1
->
radius_of_curvature
+
0.5
*
(
*
it
)
->
p2
->
radius_of_curvature
;
double
LLL
=
l
;
double
LLL
=
l
;
// if (l > .50 * curv ) LLL = .50*curv;
if
((
*
it
)
->
g
&&
(
*
it
)
->
g
->
classif_degree
==
2
&&
(
*
it
)
->
g
->
surf
)
{
double
curvature
=
(
*
it
)
->
g
->
surf
->
normalCurv
(
0.5
*
((
*
it
)
->
p1
->
X
+
(
*
it
)
->
p2
->
X
),
0.5
*
((
*
it
)
->
p1
->
Y
+
(
*
it
)
->
p2
->
Y
),
0.5
*
((
*
it
)
->
p1
->
Z
+
(
*
it
)
->
p2
->
Z
));
if
(
curvature
>
0.0
)
{
double
radius_of_curvature
=
1.
/
curvature
;
double
maxL
=
radius_of_curvature
/
CURV_FACTOR
;
if
(
LLL
>
maxL
)
LLL
=
maxL
;
}
}
if
(
!
(
*
it
)
->
deleted
&&
(
*
it
)
->
length
()
<
0.7
*
LLL
){
if
(
!
(
*
it
)
->
deleted
&&
(
*
it
)
->
length
()
<
0.7
*
LLL
){
if
(
nb_modif
%
2
)
if
(
nb_modif
%
2
)
...
@@ -2033,6 +2079,8 @@ BDS_Mesh::BDS_Mesh (const BDS_Mesh &other)
...
@@ -2033,6 +2079,8 @@ BDS_Mesh::BDS_Mesh (const BDS_Mesh &other)
BDS_Point
*
p
=
add_point
((
*
it
)
->
iD
,(
*
it
)
->
X
,(
*
it
)
->
Y
,(
*
it
)
->
Z
);
BDS_Point
*
p
=
add_point
((
*
it
)
->
iD
,(
*
it
)
->
X
,(
*
it
)
->
Y
,(
*
it
)
->
Z
);
p
->
g
=
((
*
it
)
->
g
)
?
get_geom
((
*
it
)
->
g
->
classif_tag
,(
*
it
)
->
g
->
classif_degree
)
:
0
;
p
->
g
=
((
*
it
)
->
g
)
?
get_geom
((
*
it
)
->
g
->
classif_tag
,(
*
it
)
->
g
->
classif_degree
)
:
0
;
p
->
radius_of_curvature
=
(
*
it
)
->
radius_of_curvature
;
p
->
radius_of_curvature
=
(
*
it
)
->
radius_of_curvature
;
if
(
p
->
g
->
classif_degree
==
0
)
p
->
g
->
p
=
p
;
}
}
for
(
std
::
set
<
BDS_Edge
*
,
EdgeLessThan
>::
const_iterator
it
=
other
.
edges
.
begin
();
for
(
std
::
set
<
BDS_Edge
*
,
EdgeLessThan
>::
const_iterator
it
=
other
.
edges
.
begin
();
it
!=
other
.
edges
.
end
();
it
!=
other
.
edges
.
end
();
...
@@ -2040,6 +2088,8 @@ BDS_Mesh::BDS_Mesh (const BDS_Mesh &other)
...
@@ -2040,6 +2088,8 @@ BDS_Mesh::BDS_Mesh (const BDS_Mesh &other)
{
{
BDS_Edge
*
e
=
add_edge
((
*
it
)
->
p1
->
iD
,(
*
it
)
->
p2
->
iD
);
BDS_Edge
*
e
=
add_edge
((
*
it
)
->
p1
->
iD
,(
*
it
)
->
p2
->
iD
);
e
->
g
=
((
*
it
)
->
g
)
?
get_geom
((
*
it
)
->
g
->
classif_tag
,(
*
it
)
->
g
->
classif_degree
)
:
0
;
e
->
g
=
((
*
it
)
->
g
)
?
get_geom
((
*
it
)
->
g
->
classif_tag
,(
*
it
)
->
g
->
classif_degree
)
:
0
;
if
(
e
->
g
->
classif_degree
==
1
)
e
->
g
->
e
.
push_back
(
e
);
}
}
for
(
std
::
list
<
BDS_Triangle
*>::
const_iterator
it
=
other
.
triangles
.
begin
();
for
(
std
::
list
<
BDS_Triangle
*>::
const_iterator
it
=
other
.
triangles
.
begin
();
it
!=
other
.
triangles
.
end
();
it
!=
other
.
triangles
.
end
();
...
@@ -2049,5 +2099,6 @@ BDS_Mesh::BDS_Mesh (const BDS_Mesh &other)
...
@@ -2049,5 +2099,6 @@ BDS_Mesh::BDS_Mesh (const BDS_Mesh &other)
(
*
it
)
->
getNodes
(
n
);
(
*
it
)
->
getNodes
(
n
);
BDS_Triangle
*
t
=
add_triangle
(
n
[
0
]
->
iD
,
n
[
1
]
->
iD
,
n
[
2
]
->
iD
);
BDS_Triangle
*
t
=
add_triangle
(
n
[
0
]
->
iD
,
n
[
1
]
->
iD
,
n
[
2
]
->
iD
);
t
->
g
=
get_geom
((
*
it
)
->
g
->
classif_tag
,(
*
it
)
->
g
->
classif_degree
);
t
->
g
=
get_geom
((
*
it
)
->
g
->
classif_tag
,(
*
it
)
->
g
->
classif_degree
);
t
->
g
->
t
.
push_back
(
t
);
}
}
}
}
This diff is collapsed.
Click to expand it.
Mesh/BDS.h
+
13
−
2
View file @
b00839b4
...
@@ -23,6 +23,8 @@ public :
...
@@ -23,6 +23,8 @@ public :
virtual
void
projection
(
double
xa
,
double
ya
,
double
za
,
virtual
void
projection
(
double
xa
,
double
ya
,
double
za
,
double
&
x
,
double
&
y
,
double
&
z
)
const
=
0
;
double
&
x
,
double
&
y
,
double
&
z
)
const
=
0
;
virtual
std
::
string
nameOf
()
const
=
0
;
virtual
std
::
string
nameOf
()
const
=
0
;
// virtual BDS_Vector Gradient ( double x, double y, double z ) const = 0;
virtual
double
normalCurv
(
double
x
,
double
y
,
double
z
)
const
=
0
;
};
};
...
@@ -295,7 +297,7 @@ public:
...
@@ -295,7 +297,7 @@ public:
class
BDS_Plane
:
public
BDS_Surface
class
BDS_Plane
:
public
BDS_Surface
{
{
double
a
,
b
,
c
;
double
a
,
b
,
c
,
d
;
public
:
public
:
BDS_Plane
(
const
double
&
A
,
const
double
&
B
,
const
double
&
C
)
BDS_Plane
(
const
double
&
A
,
const
double
&
B
,
const
double
&
C
)
:
a
(
A
),
b
(
B
),
c
(
C
)
:
a
(
A
),
b
(
B
),
c
(
C
)
...
@@ -311,7 +313,14 @@ public :
...
@@ -311,7 +313,14 @@ public :
z
=
za
+
k
*
c
;
z
=
za
+
k
*
c
;
}
}
virtual
std
::
string
nameOf
()
const
{
return
std
::
string
(
"Plane"
);}
virtual
std
::
string
nameOf
()
const
{
return
std
::
string
(
"Plane"
);}
virtual
BDS_Vector
Gradient
(
double
x
,
double
y
,
double
z
)
const
{
return
BDS_Vector
(
a
,
b
,
c
);
}
virtual
double
normalCurv
(
double
x
,
double
y
,
double
z
)
const
{
return
0.0
;
}
};
};
class
BDS_Quadric
:
public
BDS_Surface
class
BDS_Quadric
:
public
BDS_Surface
...
@@ -330,6 +339,8 @@ public :
...
@@ -330,6 +339,8 @@ public :
2
*
(
e
*
x
+
f
*
y
+
c
*
z
)
+
i
);
2
*
(
e
*
x
+
f
*
y
+
c
*
z
)
+
i
);
}
}
virtual
double
normalCurv
(
double
x
,
double
y
,
double
z
)
const
;
virtual
double
signedDistanceTo
(
double
x
,
double
y
,
double
z
)
const
{
virtual
double
signedDistanceTo
(
double
x
,
double
y
,
double
z
)
const
{
const
double
q
=
const
double
q
=
a
*
x
*
x
+
a
*
x
*
x
+
...
...
This diff is collapsed.
Click to expand it.
Mesh/DiscreteSurface.cpp
+
35
−
30
View file @
b00839b4
// $Id: DiscreteSurface.cpp,v 1.1
7
2005-07-0
4 15:07:41
remacle Exp $
// $Id: DiscreteSurface.cpp,v 1.1
8
2005-07-0
7 07:19:27
remacle Exp $
//
//
// Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle
// Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle
//
//
...
@@ -63,6 +63,8 @@ void Mesh_To_BDS(Surface *s, BDS_Mesh *m)
...
@@ -63,6 +63,8 @@ void Mesh_To_BDS(Surface *s, BDS_Mesh *m)
void
BDS_To_Mesh_2
(
Mesh
*
m
)
void
BDS_To_Mesh_2
(
Mesh
*
m
)
{
{
Msg
(
STATUS2
,
"Moving the surface mesh in the old gmsh structure
\n
"
);
Tree_Action
(
m
->
Vertices
,
Free_Vertex
);
Tree_Action
(
m
->
Vertices
,
Free_Vertex
);
Tree_Delete
(
m
->
Vertices
);
Tree_Delete
(
m
->
Vertices
);
m
->
Vertices
=
Tree_Create
(
sizeof
(
Vertex
*
),
compareVertex
);
m
->
Vertices
=
Tree_Create
(
sizeof
(
Vertex
*
),
compareVertex
);
...
@@ -77,6 +79,7 @@ void BDS_To_Mesh_2(Mesh *m)
...
@@ -77,6 +79,7 @@ void BDS_To_Mesh_2(Mesh *m)
++
it
;
++
it
;
}
}
}
}
{
{
std
::
set
<
BDS_Edge
*
,
EdgeLessThan
>::
iterator
it
=
m
->
bds_mesh
->
edges
.
begin
();
std
::
set
<
BDS_Edge
*
,
EdgeLessThan
>::
iterator
it
=
m
->
bds_mesh
->
edges
.
begin
();
std
::
set
<
BDS_Edge
*
,
EdgeLessThan
>::
iterator
ite
=
m
->
bds_mesh
->
edges
.
end
();
std
::
set
<
BDS_Edge
*
,
EdgeLessThan
>::
iterator
ite
=
m
->
bds_mesh
->
edges
.
end
();
...
@@ -89,6 +92,7 @@ void BDS_To_Mesh_2(Mesh *m)
...
@@ -89,6 +92,7 @@ void BDS_To_Mesh_2(Mesh *m)
Vertex
*
v2
=
FindVertex
((
*
it
)
->
p2
->
iD
,
m
);
Vertex
*
v2
=
FindVertex
((
*
it
)
->
p2
->
iD
,
m
);
SimplexBase
*
simp
=
Create_SimplexBase
(
v1
,
v2
,
NULL
,
NULL
);
SimplexBase
*
simp
=
Create_SimplexBase
(
v1
,
v2
,
NULL
,
NULL
);
Curve
*
c
=
FindCurve
(
g
->
classif_tag
,
m
);
Curve
*
c
=
FindCurve
(
g
->
classif_tag
,
m
);
if
(
c
)
simp
->
iEnt
=
g
->
classif_tag
;
simp
->
iEnt
=
g
->
classif_tag
;
Tree_Insert
(
c
->
SimplexesBase
,
&
simp
);
Tree_Insert
(
c
->
SimplexesBase
,
&
simp
);
}
}
...
@@ -107,13 +111,15 @@ void BDS_To_Mesh_2(Mesh *m)
...
@@ -107,13 +111,15 @@ void BDS_To_Mesh_2(Mesh *m)
SimplexBase
*
simp
=
Create_SimplexBase
(
v1
,
v2
,
v3
,
NULL
);
SimplexBase
*
simp
=
Create_SimplexBase
(
v1
,
v2
,
v3
,
NULL
);
BDS_GeomEntity
*
g
=
(
*
it
)
->
g
;
BDS_GeomEntity
*
g
=
(
*
it
)
->
g
;
Surface
*
s
=
FindSurface
(
g
->
classif_tag
,
m
);
Surface
*
s
=
FindSurface
(
g
->
classif_tag
,
m
);
if
(
s
)
simp
->
iEnt
=
g
->
classif_tag
;
simp
->
iEnt
=
g
->
classif_tag
;
Tree_Add
(
s
->
Simplexes
,
&
simp
);
else
printf
(
"argh
\n
"
);
Tree_Add
(
s
->
SimplexesBase
,
&
simp
);
++
it
;
++
it
;
}
}
}
}
Msg
(
STATUS2
,
"Ready"
);
}
}
void
BDS_To_Mesh
(
Mesh
*
m
)
void
BDS_To_Mesh
(
Mesh
*
m
)
{
{
...
@@ -166,14 +172,13 @@ void BDS_To_Mesh(Mesh *m)
...
@@ -166,14 +172,13 @@ void BDS_To_Mesh(Mesh *m)
CTX
.
mesh
.
changed
=
1
;
CTX
.
mesh
.
changed
=
1
;
printf
(
"%d surfaces %d curves
\n
"
,
Tree_Nbr
(
m
->
Surfaces
),
Tree_Nbr
(
m
->
Curves
)
);
}
}
// Public interface for discrete surface/curve mesh algo
// Public interface for discrete surface/curve mesh algo
int
MeshDiscreteSurface
(
Surface
*
s
)
int
MeshDiscreteSurface
(
Surface
*
s
)
{
{
Msg
(
STATUS2
,
"Discrete Surface Mesh Generator..."
);
if
(
s
->
bds
){
if
(
s
->
bds
){
// s->bds is the discrete surface that defines the geometry
// s->bds is the discrete surface that defines the geometry
if
(
!
THEM
->
bds_mesh
){
if
(
!
THEM
->
bds_mesh
){
...
@@ -181,12 +186,12 @@ int MeshDiscreteSurface(Surface *s)
...
@@ -181,12 +186,12 @@ int MeshDiscreteSurface(Surface *s)
int
iter
=
0
;
int
iter
=
0
;
while
(
iter
<
20
&&
THEM
->
bds_mesh
->
adapt_mesh
(
CTX
.
mesh
.
lc_factor
*
THEM
->
bds
->
LC
,
while
(
iter
<
20
&&
THEM
->
bds_mesh
->
adapt_mesh
(
CTX
.
mesh
.
lc_factor
*
THEM
->
bds
->
LC
,
true
,
THEM
->
bds
)){
true
,
THEM
->
bds
)){
printf
(
"iter %d done
\n
"
,
iter
);
Msg
(
STATUS2
,
"Iteration %2d/20 done (%d triangles)
\n
"
,
iter
,
THEM
->
bds_mesh
->
triangles
.
size
()
);
iter
++
;
iter
++
;
}
}
BDS_To_Mesh_2
(
THEM
);
BDS_To_Mesh_2
(
THEM
);
printf
(
"m
esh has %d vertices (%d)
\n
"
,
Tree_Nbr
(
THEM
->
Vertices
),
THEM
->
bds
->
points
.
size
());
Msg
(
STATUS2
,
"M
esh has %d vertices (%d)
\n
"
,
Tree_Nbr
(
THEM
->
Vertices
),
THEM
->
bds
->
points
.
size
());
THEM
->
bds_mesh
->
save_gmsh_format
(
"3.msh"
);
//
THEM->bds_mesh->save_gmsh_format ( "3.msh" );
}
}
return
1
;
return
1
;
}
}
...
...
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