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
9f1bd050
Commit
9f1bd050
authored
18 years ago
by
Jean-François Remacle
Browse files
Options
Downloads
Patches
Plain Diff
*** empty log message ***
parent
ba08d9a7
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Geo/OCCEdge.cpp
+19
-12
19 additions, 12 deletions
Geo/OCCEdge.cpp
Mesh/BDS.cpp
+9
-3
9 additions, 3 deletions
Mesh/BDS.cpp
Mesh/meshGFace.cpp
+33
-22
33 additions, 22 deletions
Mesh/meshGFace.cpp
with
61 additions
and
37 deletions
Geo/OCCEdge.cpp
+
19
−
12
View file @
9f1bd050
// $Id: OCCEdge.cpp,v 1.1
4
2006-1
1-29 16:57:01
remacle Exp $
// $Id: OCCEdge.cpp,v 1.1
5
2006-1
2-11 20:12:33
remacle Exp $
//
// Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
//
...
...
@@ -23,6 +23,8 @@
#include
"Message.h"
#include
"OCCEdge.h"
#include
"OCCFace.h"
#include
"Context.h"
extern
Context_T
CTX
;
#if defined(HAVE_OCC)
#include
"Geom2dLProp_CLProps2d.hxx"
...
...
@@ -62,26 +64,31 @@ SPoint2 OCCEdge::reparamOnFace(GFace *face, double epar,int dir) const
double
t0
,
t1
;
Handle
(
Geom2d_Curve
)
c2d
=
BRep_Tool
::
CurveOnSurface
(
c
,
*
s
,
t0
,
t1
);
if
(
c2d
.
IsNull
())
return
GEdge
::
reparamOnFace
(
face
,
epar
,
dir
);
{
Msg
(
GERROR
,
"Reparam on face failed : curve %d is not on surface %d
\n
"
,
tag
(),
face
->
tag
());
return
GEdge
::
reparamOnFace
(
face
,
epar
,
dir
);
}
double
u
,
v
;
c2d
->
Value
(
epar
).
Coord
(
u
,
v
);
if
(
!
isSeam
(
face
)
)
{
// sometimes OCC miserably fails ...
GPoint
p1
=
point
(
epar
);
GPoint
p2
=
face
->
point
(
u
,
v
);
const
double
dx
=
p1
.
x
()
-
p2
.
x
();
const
double
dy
=
p1
.
y
()
-
p2
.
y
();
const
double
dz
=
p1
.
z
()
-
p2
.
z
();
if
(
sqrt
(
dx
*
dx
+
dy
*
dy
+
dz
*
dz
)
>
1.e-7
*
CTX
.
lc
)
{
GPoint
ppp
=
face
->
closestPoint
(
SPoint3
(
p1
.
x
(),
p1
.
y
(),
p1
.
z
()));
return
SPoint2
(
ppp
.
u
(),
ppp
.
v
());
}
return
SPoint2
(
u
,
v
);
}
else
{
BRepAdaptor_Surface
surface
(
*
s
);
// printf ("surface %d (%d %d) firstu %g lastu %g firstv %g lastv %g\n",
// surface.IsUPeriodic() ,
// surface.IsVPeriodic() ,
// face->tag(),
// surface.FirstUParameter(),
// surface.LastUParameter(),
// surface.FirstVParameter(),
// surface.LastVParameter());
if
(
surface
.
IsUPeriodic
()
)
{
if
(
dir
==
-
1
)
...
...
This diff is collapsed.
Click to expand it.
Mesh/BDS.cpp
+
9
−
3
View file @
9f1bd050
// $Id: BDS.cpp,v 1.7
0
2006-12-
05 14:22:05
remacle Exp $
// $Id: BDS.cpp,v 1.7
1
2006-12-
11 20:12:33
remacle Exp $
//
// Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
//
...
...
@@ -991,6 +991,9 @@ bool test_move_point_parametric_triangle (BDS_Point * p, double u, double v, BDS
double
b
[
2
]
=
{
pc
[
0
]
-
pa
[
0
],
pc
[
1
]
-
pa
[
1
]};
double
area_init
=
fabs
(
a
[
1
]
*
b
[
2
]
-
a
[
2
]
*
b
[
1
]);
if
(
area_init
==
0.0
)
return
true
;
double
ori_init
=
gmsh
::
orient2d
(
pa
,
pb
,
pc
);
if
(
p
==
pts
[
0
])
...
...
@@ -1006,7 +1009,7 @@ bool test_move_point_parametric_triangle (BDS_Point * p, double u, double v, BDS
if
(
area_final
<
0.1
*
area_init
)
return
false
;
double
ori_final
=
gmsh
::
orient2d
(
pa
,
pb
,
pc
);
// allow to move a point when a triangle was flat
return
ori_init
*
ori_final
>
=
0
;
return
ori_init
*
ori_final
>
0
;
}
bool
BDS_Mesh
::
smooth_point_parametric
(
BDS_Point
*
p
,
GFace
*
gf
)
...
...
@@ -1025,15 +1028,18 @@ bool BDS_Mesh::smooth_point_parametric(BDS_Point * p, GFace *gf)
while
(
eit
!=
p
->
edges
.
end
())
{
if
((
*
eit
)
->
numfaces
()
==
1
)
return
false
;
BDS_Point
*
op
=
((
*
eit
)
->
p1
==
p
)
?
(
*
eit
)
->
p2
:
(
*
eit
)
->
p1
;
// const double l_e = (*eit)->length();
U
+=
op
->
u
;
V
+=
op
->
v
;
// tot_length +=
(*eit)->length();
// tot_length +=
l_e;
LC
+=
op
->
lc
();
++
eit
;
}
U
/=
(
p
->
edges
.
size
());
V
/=
(
p
->
edges
.
size
());
// U /= tot_length;
// V /= tot_length;
LC
/=
p
->
edges
.
size
();
std
::
list
<
BDS_Face
*
>
ts
;
...
...
This diff is collapsed.
Click to expand it.
Mesh/meshGFace.cpp
+
33
−
22
View file @
9f1bd050
// $Id: meshGFace.cpp,v 1.3
8
2006-12-
05 14:22:05
remacle Exp $
// $Id: meshGFace.cpp,v 1.3
9
2006-12-
11 20:12:33
remacle Exp $
//
// Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
//
...
...
@@ -427,7 +427,7 @@ void RefineMesh ( GFace *gf, BDS_Mesh &m , const int NIT)
}
// recompute mesh sizes takin into account curvature , BGMESH & co
m
.
cleanup
();
if
(
IT
%
5
==
0
&&
(
CTX
.
mesh
.
lc_from_curvature
||
BGMExists
()))
if
(
IT
==
5
&&
(
CTX
.
mesh
.
lc_from_curvature
||
BGMExists
()))
{
std
::
set
<
BDS_Point
*
,
PointLessThan
>::
iterator
itp
=
m
.
points
.
begin
();
while
(
itp
!=
m
.
points
.
end
())
...
...
@@ -441,7 +441,7 @@ void RefineMesh ( GFace *gf, BDS_Mesh &m , const int NIT)
}
++
itp
;
}
for
(
int
ITERA
=
0
;
ITERA
<
6
;
ITERA
++
);
for
(
int
ITERA
=
0
;
ITERA
<
0
;
ITERA
++
);
{
it
=
m
.
edges
.
begin
();
while
(
it
!=
m
.
edges
.
end
())
...
...
@@ -556,7 +556,7 @@ bool recover_medge ( BDS_Mesh *m, GEdge *ge)
// domain, including embedded points
// and surfaces
void
gmsh2DMeshGenerator
(
GFace
*
gf
)
bool
gmsh2DMeshGenerator
(
GFace
*
gf
)
{
typedef
std
::
set
<
MVertex
*>
v_container
;
...
...
@@ -570,6 +570,8 @@ void gmsh2DMeshGenerator ( GFace *gf )
it
=
edges
.
begin
();
while
(
it
!=
edges
.
end
())
{
if
((
*
it
)
->
isSeam
(
gf
))
return
false
;
all_vertices
.
insert
(
(
*
it
)
->
mesh_vertices
.
begin
()
,
(
*
it
)
->
mesh_vertices
.
end
()
);
all_vertices
.
insert
(
(
*
it
)
->
getBeginVertex
()
->
mesh_vertices
.
begin
()
,
(
*
it
)
->
getBeginVertex
()
->
mesh_vertices
.
end
()
);
all_vertices
.
insert
(
(
*
it
)
->
getEndVertex
()
->
mesh_vertices
.
begin
()
,
(
*
it
)
->
getEndVertex
()
->
mesh_vertices
.
end
()
);
...
...
@@ -720,7 +722,7 @@ void gmsh2DMeshGenerator ( GFace *gf )
if
(
!
recover_medge
(
m
,
*
it
))
{
Msg
(
WARNING
,
"Face not meshed"
);
return
;
return
false
;
}
++
it
;
}
...
...
@@ -796,8 +798,8 @@ void gmsh2DMeshGenerator ( GFace *gf )
char
name
[
245
];
//sprintf(name,"param%d.pos",gf->tag());
//outputScalarField(m->triangles, name,1);
// sprintf(name,"real%d.pos",gf->tag());
// outputScalarField(m->triangles, name,0);
// sprintf(name,"real%d.pos",gf->tag());
// outputScalarField(m->triangles, name,0);
m
->
cleanup
();
...
...
@@ -863,14 +865,13 @@ void gmsh2DMeshGenerator ( GFace *gf )
// delete the mesh
// char name[245];
// sprintf(name,"s%d.pos",gf->tag());
// outputScalarField(m->triangles, name);
delete
m
;
delete
[]
U_
;
delete
[]
V_
;
return
true
;
}
// this function buils a list of vertices (BDS) that
...
...
@@ -1082,10 +1083,11 @@ bool buildConsecutiveListOfVertices ( GFace *gf,
result
.
insert
(
result
.
end
(),
edgeLoop_BDS
.
begin
(),
edgeLoop_BDS
.
end
());
}
// for (int i=0;i<result.size();i++)
// {
// printf("point %3d (%8.5f %8.5f) (%2d,%2d)\n",i,result[i]->u,result[i]->v,result[i]->g->classif_tag,result[i]->g->classif_degree);
// }
if
(
gf
->
tag
()
==
280
)
for
(
int
i
=
0
;
i
<
result
.
size
();
i
++
)
{
printf
(
"point %3d (%8.5f %8.5f) (%2d,%2d)
\n
"
,
i
,
result
[
i
]
->
u
,
result
[
i
]
->
v
,
result
[
i
]
->
g
->
classif_tag
,
result
[
i
]
->
g
->
classif_degree
);
}
return
true
;
}
...
...
@@ -1093,6 +1095,8 @@ bool buildConsecutiveListOfVertices ( GFace *gf,
bool
gmsh2DMeshGeneratorPeriodic
(
GFace
*
gf
)
{
// if(gf->tag() != 6)return true;
std
::
map
<
BDS_Point
*
,
MVertex
*>
recover_map
;
...
...
@@ -1108,8 +1112,8 @@ bool gmsh2DMeshGeneratorPeriodic ( GFace *gf )
// Buid a BDS_Mesh structure that is convenient for doing the actual meshing procedure
BDS_Mesh
*
m
=
new
BDS_Mesh
;
m
->
scalingU
=
fabs
(
du
);
m
->
scalingV
=
fabs
(
dv
);
//
m->scalingU = fabs(du);
//
m->scalingV = fabs(dv);
std
::
vector
<
std
::
vector
<
BDS_Point
*
>
>
edgeLoops_BDS
;
SBoundingBox3d
bbox
;
int
nbPointsTotal
=
0
;
...
...
@@ -1186,6 +1190,8 @@ bool gmsh2DMeshGeneratorPeriodic ( GFace *gf )
// Free stuff
free
(
doc
.
points
);
free
(
doc
.
delaunay
);
// Recover the boundary edges
// and compute characteristic lenghts using mesh edge spacing
...
...
@@ -1281,6 +1287,8 @@ bool gmsh2DMeshGeneratorPeriodic ( GFace *gf )
m
->
del_point
(
m
->
find_point
(
-
3
));
m
->
del_point
(
m
->
find_point
(
-
4
));
// goto hhh;
// start mesh generation
...
...
@@ -1337,12 +1345,12 @@ bool gmsh2DMeshGeneratorPeriodic ( GFace *gf )
// delete the mesh
char
name
[
245
];
sprintf
(
name
,
"param%d.pos"
,
gf
->
tag
());
outputScalarField
(
m
->
triangles
,
name
,
1
);
sprintf
(
name
,
"real%d.pos"
,
gf
->
tag
());
outputScalarField
(
m
->
triangles
,
name
,
0
);
// char name[245];
// sprintf(name,"param%d.pos",gf->tag());
// outputScalarField(m->triangles, name,1);
// sprintf(name,"real%d.pos",gf->tag());
// outputScalarField(m->triangles, name,0);
delete
m
;
return
true
;
}
...
...
@@ -1385,7 +1393,10 @@ void meshGFace :: operator() (GFace *gf)
if
(
gf
->
getNativeType
()
==
GEntity
::
GmshModel
||
gf
->
edgeLoops
.
empty
())
gmsh2DMeshGenerator
(
gf
)
;
else
gmsh2DMeshGeneratorPeriodic
(
gf
)
;
{
if
(
!
gmsh2DMeshGeneratorPeriodic
(
gf
))
Msg
(
GERROR
,
"Impossible to mesh face %d"
,
gf
->
tag
());
}
Msg
(
DEBUG1
,
"type %d %d triangles generated, %d internal vertices"
,
gf
->
geomType
(),
gf
->
triangles
.
size
(),
gf
->
mesh_vertices
.
size
());
...
...
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