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
900bb6b6
Commit
900bb6b6
authored
18 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
start work on extrusion
parent
507f7732
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Mesh/meshGFaceExtruded.cpp
+79
-29
79 additions, 29 deletions
Mesh/meshGFaceExtruded.cpp
with
79 additions
and
29 deletions
Mesh/meshGFaceExtruded.cpp
+
79
−
29
View file @
900bb6b6
// $Id: meshGFaceExtruded.cpp,v 1.
3
2006-11-26
19:30
:2
3
geuzaine Exp $
// $Id: meshGFaceExtruded.cpp,v 1.
4
2006-11-26
21:56
:2
6
geuzaine Exp $
//
// Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle
//
...
...
@@ -19,39 +19,91 @@
//
// Please report all bugs and problems to <gmsh@geuz.org>.
#include
<
map
>
#include
<
set
>
#include
"ExtrudeParams.h"
#include
"meshGFace.h"
#include
"GModel.h"
#include
"GVertex.h"
#include
"GEdge.h"
#include
"GFace.h"
#include
"MVertex.h"
#include
"MElement.h"
#include
"Context.h"
#include
"Message.h"
int
extrude
Vertex
(
GFace
*
gf
,
MVertex
*
v
)
int
extrude
Mesh
(
GEdge
*
from
,
GFace
*
to
)
{
ExtrudeParams
*
ep
=
gf
->
meshAttributes
.
extrude
;
for
(
int
i
=
0
;
i
<
ep
->
mesh
.
NbLayer
;
i
++
)
{
for
(
int
j
=
1
;
j
<
ep
->
mesh
.
NbElmLayer
[
i
];
j
++
)
{
double
x
=
v
->
x
(),
y
=
v
->
y
(),
z
=
v
->
z
();
ep
->
Extrude
(
i
,
j
,
x
,
y
,
z
);
gf
->
mesh_vertices
.
push_back
(
new
MVertex
(
x
,
y
,
z
,
gf
));
ExtrudeParams
*
ep
=
to
->
meshAttributes
.
extrude
;
// create vertices
for
(
unsigned
int
i
=
0
;
i
<
from
->
mesh_vertices
.
size
();
i
++
){
MVertex
*
v
=
from
->
mesh_vertices
[
i
];
for
(
int
j
=
0
;
j
<
ep
->
mesh
.
NbLayer
;
j
++
)
{
for
(
int
k
=
1
;
k
<
ep
->
mesh
.
NbElmLayer
[
j
];
k
++
)
{
double
x
=
v
->
x
(),
y
=
v
->
y
(),
z
=
v
->
z
();
ep
->
Extrude
(
j
,
k
,
x
,
y
,
z
);
to
->
mesh_vertices
.
push_back
(
new
MVertex
(
x
,
y
,
z
,
to
));
}
}
}
// create elements
}
int
copyMesh
(
GFace
*
g
f
,
GFace
*
from
)
int
copyMesh
(
GFace
*
f
rom
,
GFace
*
to
)
{
ExtrudeParams
*
ep
=
gf
->
meshAttributes
.
extrude
;
ExtrudeParams
*
ep
=
to
->
meshAttributes
.
extrude
;
// build a set with all the vertices on the boundary of to
std
::
set
<
MVertex
*
,
MVertexLessThanLexicographic
>
pos
;
std
::
list
<
GEdge
*>
edges
=
to
->
edges
();
std
::
list
<
GEdge
*>::
iterator
it
=
edges
.
begin
();
while
(
it
!=
edges
.
end
()){
pos
.
insert
((
*
it
)
->
mesh_vertices
.
begin
(),
(
*
it
)
->
mesh_vertices
.
end
());
pos
.
insert
((
*
it
)
->
getBeginVertex
()
->
mesh_vertices
.
begin
(),
(
*
it
)
->
getBeginVertex
()
->
mesh_vertices
.
end
());
pos
.
insert
((
*
it
)
->
getEndVertex
()
->
mesh_vertices
.
begin
(),
(
*
it
)
->
getEndVertex
()
->
mesh_vertices
.
end
());
++
it
;
}
// create new vertices
for
(
unsigned
int
i
=
0
;
i
<
from
->
mesh_vertices
.
size
();
i
++
){
MVertex
*
v
=
from
->
mesh_vertices
[
i
];
double
x
=
v
->
x
(),
y
=
v
->
y
(),
z
=
v
->
z
();
ep
->
Extrude
(
ep
->
mesh
.
NbLayer
-
1
,
ep
->
mesh
.
NbElmLayer
[
ep
->
mesh
.
NbLayer
-
1
],
x
,
y
,
z
);
gf
->
mesh_vertices
.
push_back
(
new
MVertex
(
x
,
y
,
z
,
gf
));
MVertex
*
newv
=
new
MVertex
(
x
,
y
,
z
,
to
);
to
->
mesh_vertices
.
push_back
(
newv
);
pos
.
insert
(
newv
);
}
// create new elements
std
::
set
<
MVertex
*
,
MVertexLessThanLexicographic
>::
iterator
itp
;
for
(
unsigned
int
i
=
0
;
i
<
from
->
triangles
.
size
();
i
++
){
std
::
vector
<
MVertex
*>
verts
;
for
(
int
j
=
0
;
j
<
3
;
j
++
){
MVertex
*
v
=
from
->
triangles
[
i
]
->
getVertex
(
j
);
MVertex
tmp
(
v
->
x
(),
v
->
y
(),
v
->
z
(),
0
,
0
);
ep
->
Extrude
(
ep
->
mesh
.
NbLayer
-
1
,
ep
->
mesh
.
NbElmLayer
[
ep
->
mesh
.
NbLayer
-
1
],
tmp
.
x
(),
tmp
.
y
(),
tmp
.
z
());
itp
=
pos
.
find
(
&
tmp
);
if
(
itp
==
pos
.
end
())
{
Msg
(
GERROR
,
"Could not find extruded vertex in surface %d"
,
to
->
tag
());
return
0
;
}
verts
.
push_back
(
*
itp
);
}
to
->
triangles
.
push_back
(
new
MTriangle
(
verts
));
}
for
(
unsigned
int
i
=
0
;
i
<
from
->
quadrangles
.
size
();
i
++
){
std
::
vector
<
MVertex
*>
verts
;
for
(
int
j
=
0
;
j
<
4
;
j
++
){
MVertex
*
v
=
from
->
quadrangles
[
i
]
->
getVertex
(
j
);
MVertex
tmp
(
v
->
x
(),
v
->
y
(),
v
->
z
(),
0
,
0
);
ep
->
Extrude
(
ep
->
mesh
.
NbLayer
-
1
,
ep
->
mesh
.
NbElmLayer
[
ep
->
mesh
.
NbLayer
-
1
],
tmp
.
x
(),
tmp
.
y
(),
tmp
.
z
());
itp
=
pos
.
find
(
&
tmp
);
if
(
itp
==
pos
.
end
())
{
Msg
(
GERROR
,
"Could not find extruded vertex in surface %d"
,
to
->
tag
());
return
0
;
}
verts
.
push_back
(
*
itp
);
}
to
->
quadrangles
.
push_back
(
new
MQuadrangle
(
verts
));
}
}
...
...
@@ -63,18 +115,16 @@ int MeshExtrudedSurface(GFace *gf)
return
0
;
if
(
ep
->
geo
.
Mode
==
EXTRUDED_ENTITY
)
{
// extruded from a curve
GEdge
*
e
=
gf
->
model
()
->
edgeByTag
(
std
::
abs
(
ep
->
geo
.
Source
));
if
(
!
e
)
return
0
;
for
(
unsigned
int
i
=
0
;
i
<
e
->
mesh_vertices
.
size
();
i
++
)
extrudeVertex
(
gf
,
e
->
mesh_vertices
[
i
]);
// get bounding edges and create quads/tris
// surface is extruded from a curve
GEdge
*
from
=
gf
->
model
()
->
edgeByTag
(
std
::
abs
(
ep
->
geo
.
Source
));
if
(
!
from
)
return
0
;
extrudeMesh
(
from
,
gf
);
}
else
{
// copy of a surface ("chapeau")
GFace
*
f
=
gf
->
model
()
->
faceByTag
(
std
::
abs
(
ep
->
geo
.
Source
));
if
(
!
f
)
return
0
;
copyMesh
(
g
f
,
f
);
//
surface is a
copy of a
nother
surface ("chapeau")
GFace
*
f
rom
=
gf
->
model
()
->
faceByTag
(
std
::
abs
(
ep
->
geo
.
Source
));
if
(
!
f
rom
)
return
0
;
copyMesh
(
f
rom
,
g
f
);
}
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