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
33d4e355
Commit
33d4e355
authored
18 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
fix logic for 3d delaunay
parent
7c0911f1
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
Mesh/Generator.cpp
+6
-3
6 additions, 3 deletions
Mesh/Generator.cpp
Mesh/meshGRegion.cpp
+58
-59
58 additions, 59 deletions
Mesh/meshGRegion.cpp
Mesh/meshGRegion.h
+5
-0
5 additions, 0 deletions
Mesh/meshGRegion.h
with
69 additions
and
62 deletions
Mesh/Generator.cpp
+
6
−
3
View file @
33d4e355
// $Id: Generator.cpp,v 1.11
2
2007-01-1
6
1
1:31:41
geuzaine Exp $
// $Id: Generator.cpp,v 1.11
3
2007-01-1
8
1
0:18:30
geuzaine Exp $
//
//
// Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
// Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
//
//
...
@@ -236,8 +236,11 @@ void Mesh3D()
...
@@ -236,8 +236,11 @@ void Mesh3D()
// then subdivide if necessary (unfortunately the subdivision is a
// then subdivide if necessary (unfortunately the subdivision is a
// global operation, which can require changing the surface mesh!)
// global operation, which can require changing the surface mesh!)
SubdivideExtrudedMesh
(
GMODEL
);
SubdivideExtrudedMesh
(
GMODEL
);
// then mesh the rest
// then mesh all the non-delaunay regions
std
::
for_each
(
GMODEL
->
firstRegion
(),
GMODEL
->
lastRegion
(),
meshGRegion
());
std
::
vector
<
GRegion
*>
delaunay
;
std
::
for_each
(
GMODEL
->
firstRegion
(),
GMODEL
->
lastRegion
(),
meshGRegion
(
delaunay
));
// and finally mesh the delaunay regions (again, this is global)
MeshDelaunayVolume
(
delaunay
);
double
t2
=
Cpu
();
double
t2
=
Cpu
();
CTX
.
mesh_timer
[
2
]
=
t2
-
t1
;
CTX
.
mesh_timer
[
2
]
=
t2
-
t1
;
...
...
This diff is collapsed.
Click to expand it.
Mesh/meshGRegion.cpp
+
58
−
59
View file @
33d4e355
// $Id: meshGRegion.cpp,v 1.2
4
2007-01-1
6
1
4
:1
9
:3
1 remacl
e Exp $
// $Id: meshGRegion.cpp,v 1.2
5
2007-01-1
8
1
0
:1
8
:3
0 geuzain
e Exp $
//
//
// Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
// Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
//
//
...
@@ -25,6 +25,7 @@
...
@@ -25,6 +25,7 @@
#include
"GRegion.h"
#include
"GRegion.h"
#include
"GFace.h"
#include
"GFace.h"
#include
"GEdge.h"
#include
"GEdge.h"
#include
"gmshRegion.h"
#include
"MRep.h"
#include
"MRep.h"
#include
"BDS.h"
#include
"BDS.h"
#include
"Message.h"
#include
"Message.h"
...
@@ -183,6 +184,53 @@ void TransferTetgenMesh(GRegion *gr,
...
@@ -183,6 +184,53 @@ void TransferTetgenMesh(GRegion *gr,
#endif
#endif
void
MeshDelaunayVolume
(
std
::
vector
<
GRegion
*>
&
regions
)
{
if
(
regions
.
empty
())
return
;
#if !defined(HAVE_TETGEN)
Msg
(
GERROR
,
"Tetgen is not compiled in this version of Gmsh"
);
#else
// put all the faces in the same model
GRegion
*
gr
=
regions
[
0
];
std
::
list
<
GFace
*>
faces
=
gr
->
faces
();
std
::
set
<
GFace
*>
allFacesSet
;
for
(
unsigned
int
i
=
0
;
i
<
regions
.
size
();
i
++
){
std
::
list
<
GFace
*>
f
=
regions
[
i
]
->
faces
();
allFacesSet
.
insert
(
f
.
begin
(),
f
.
end
());
}
std
::
list
<
GFace
*>
allFaces
;
for
(
std
::
set
<
GFace
*>::
iterator
it
=
allFacesSet
.
begin
();
it
!=
allFacesSet
.
end
();
it
++
)
allFaces
.
push_back
(
*
it
);
gr
->
set
(
allFaces
);
// mesh with tetgen, possibly changing the mesh on boundaries
tetgenio
in
,
out
;
std
::
vector
<
MVertex
*>
numberedV
;
char
opts
[
128
];
buildTetgenStructure
(
gr
,
in
,
numberedV
);
sprintf
(
opts
,
"pe%c"
,
(
CTX
.
verbosity
<
3
)
?
'Q'
:
(
CTX
.
verbosity
>
6
)
?
'V'
:
'\0'
);
tetrahedralize
(
opts
,
&
in
,
&
out
);
TransferTetgenMesh
(
gr
,
in
,
out
,
numberedV
);
// sort triangles in all model faces in order to be able to search in vectors
std
::
list
<
GFace
*>::
iterator
itf
=
allFaces
.
begin
();
while
(
itf
!=
allFaces
.
end
()){
compareMTriangleLexicographic
cmp
;
std
::
sort
((
*
itf
)
->
triangles
.
begin
(),
(
*
itf
)
->
triangles
.
end
(),
cmp
);
++
itf
;
}
// restore the initial set of faces
gr
->
set
(
faces
);
// now do insertion of points
insertVerticesInRegion
(
gr
);
#endif
}
#if defined(HAVE_NETGEN)
#if defined(HAVE_NETGEN)
namespace
nglib
{
namespace
nglib
{
...
@@ -441,14 +489,14 @@ void meshGRegion::operator() (GRegion *gr)
...
@@ -441,14 +489,14 @@ void meshGRegion::operator() (GRegion *gr)
Msg
(
STATUS2
,
"Meshing volume %d"
,
gr
->
tag
());
Msg
(
STATUS2
,
"Meshing volume %d"
,
gr
->
tag
());
// destroy the mesh if it exists
// destroy the mesh if it exists
if
(
gr
->
meshAttributes
.
Method
==
TRANSFINI
)
deMeshGRegion
dem
;
{
dem
(
gr
);
deMeshGRegion
dem
;
dem
(
gr
);
MeshTransfiniteVolume
(
gr
);
return
;
}
if
(
gr
->
meshAttributes
.
Method
==
TRANSFINI
){
MeshTransfiniteVolume
(
gr
);
return
;
}
std
::
list
<
GFace
*>
faces
=
gr
->
faces
();
std
::
list
<
GFace
*>
faces
=
gr
->
faces
();
// sanity check
// sanity check
...
@@ -460,61 +508,12 @@ void meshGRegion::operator() (GRegion *gr)
...
@@ -460,61 +508,12 @@ void meshGRegion::operator() (GRegion *gr)
}
}
if
(
CTX
.
mesh
.
algo3d
==
ALGO_3D_DELAUNAY
||
CTX
.
mesh
.
algo3d
==
ALGO_3D_TETGEN
){
if
(
CTX
.
mesh
.
algo3d
==
ALGO_3D_DELAUNAY
||
CTX
.
mesh
.
algo3d
==
ALGO_3D_TETGEN
){
#if !defined(HAVE_TETGEN)
delaunay
.
push_back
(
gr
);
Msg
(
GERROR
,
"Tetgen is not compiled in this version of Gmsh"
);
#else
// delete the mesh for all regions
GModel
::
riter
rit
=
gr
->
model
()
->
firstRegion
()
;
if
(
gr
!=
*
rit
)
return
;
for
(;
rit
!=
gr
->
model
()
->
lastRegion
();
++
rit
)
{
deMeshGRegion
dem
;
dem
(
*
rit
);
}
// put all the faces in the same model
std
::
list
<
GFace
*>
allFaces
;
GModel
::
fiter
fit
=
gr
->
model
()
->
firstFace
()
;
while
(
fit
!=
gr
->
model
()
->
lastFace
()){
allFaces
.
push_back
(
*
fit
);
++
fit
;
}
gr
->
set
(
allFaces
);
// mesh with tetgen, possibly changing the mesh on boundaries
tetgenio
in
,
out
;
std
::
vector
<
MVertex
*>
numberedV
;
char
opts
[
128
];
buildTetgenStructure
(
gr
,
in
,
numberedV
);
sprintf
(
opts
,
"pe%c"
,
(
CTX
.
verbosity
<
3
)
?
'Q'
:
(
CTX
.
verbosity
>
6
)
?
'V'
:
'\0'
);
tetrahedralize
(
opts
,
&
in
,
&
out
);
TransferTetgenMesh
(
gr
,
in
,
out
,
numberedV
);
// sort triangles in all model faces in order to be able to search in vectors
{
std
::
list
<
GFace
*>::
iterator
itf
=
allFaces
.
begin
();
while
(
itf
!=
allFaces
.
end
())
{
compareMTriangleLexicographic
cmp
;
std
::
sort
((
*
itf
)
->
triangles
.
begin
(),
(
*
itf
)
->
triangles
.
end
(),
cmp
);
++
itf
;
}
}
// restore the initial set of faces
gr
->
set
(
faces
);
// now do insertion of points
insertVerticesInRegion
(
gr
);
// meshNormalsPointOutOfTheRegion(gr);
#endif
}
}
else
if
(
CTX
.
mesh
.
algo3d
==
ALGO_3D_NETGEN
){
if
(
CTX
.
mesh
.
algo3d
==
ALGO_3D_NETGEN
){
#if !defined(HAVE_NETGEN)
#if !defined(HAVE_NETGEN)
Msg
(
GERROR
,
"Netgen is not compiled in this version of Gmsh"
);
Msg
(
GERROR
,
"Netgen is not compiled in this version of Gmsh"
);
#else
#else
deMeshGRegion
dem
;
dem
(
gr
);
// orient the triangles of with respect to this region
// orient the triangles of with respect to this region
meshNormalsPointOutOfTheRegion
(
gr
);
meshNormalsPointOutOfTheRegion
(
gr
);
std
::
vector
<
MVertex
*>
numberedV
;
std
::
vector
<
MVertex
*>
numberedV
;
...
...
This diff is collapsed.
Click to expand it.
Mesh/meshGRegion.h
+
5
−
0
View file @
33d4e355
...
@@ -20,12 +20,16 @@
...
@@ -20,12 +20,16 @@
//
//
// Please report all bugs and problems to <gmsh@geuz.org>.
// Please report all bugs and problems to <gmsh@geuz.org>.
#include
<vector>
class
GModel
;
class
GModel
;
class
GRegion
;
class
GRegion
;
// Create the mesh of the region
// Create the mesh of the region
class
meshGRegion
{
class
meshGRegion
{
public
:
public
:
std
::
vector
<
GRegion
*>
&
delaunay
;
meshGRegion
(
std
::
vector
<
GRegion
*>
&
d
)
:
delaunay
(
d
)
{}
void
operator
()
(
GRegion
*
);
void
operator
()
(
GRegion
*
);
};
};
...
@@ -46,6 +50,7 @@ class deMeshGRegion {
...
@@ -46,6 +50,7 @@ class deMeshGRegion {
void
operator
()
(
GRegion
*
);
void
operator
()
(
GRegion
*
);
};
};
void
MeshDelaunayVolume
(
std
::
vector
<
GRegion
*>
&
delaunay
);
int
MeshTransfiniteVolume
(
GRegion
*
gr
);
int
MeshTransfiniteVolume
(
GRegion
*
gr
);
int
SubdivideExtrudedMesh
(
GModel
*
m
);
int
SubdivideExtrudedMesh
(
GModel
*
m
);
...
...
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