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
988bab49
Commit
988bab49
authored
16 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
- fix contribs and license in Refine.cpp
- avoid dynamic_casts in Refine
parent
8eaf2a15
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/HighOrder.cpp
+4
-0
4 additions, 0 deletions
Mesh/HighOrder.cpp
Mesh/Refine.cpp
+213
-222
213 additions, 222 deletions
Mesh/Refine.cpp
Numeric/FunctionSpace.cpp
+4
-0
4 additions, 0 deletions
Numeric/FunctionSpace.cpp
with
221 additions
and
222 deletions
Mesh/HighOrder.cpp
+
4
−
0
View file @
988bab49
...
...
@@ -2,6 +2,10 @@
//
// See the LICENSE.txt file for license information. Please report all
// bugs and problems to <gmsh@geuz.org>.
//
// Contributor(s):
// Koen Hillewaert
//
#include
"HighOrder.h"
#include
"gmshSmoothHighOrder.h"
...
...
This diff is collapsed.
Click to expand it.
Mesh/Refine.cpp
+
213
−
222
View file @
988bab49
/*
* refine.cpp
* GMSH
*
* Created by Brian Helenbrook on 11/13/08.
* Copyright 2008 Clarkson University. All rights reserved.
*
*/
// Gmsh - Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
//
// See the LICENSE.txt file for license information. Please report all
// bugs and problems to <gmsh@geuz.org>.
//
// Contributor(s):
// Brian Helenbrook
//
#include
"HighOrder.h"
#include
"meshGFaceOptimize.h"
#include
"MElement.h"
#include
"GmshMessage.h"
#include
"OS.h"
#include
"Numeric.h"
#include
"Context.h"
#include
"GmshMatrix.h"
#include
"FunctionSpace.h"
void
Subdivide
(
GEdge
*
ge
)
{
std
::
vector
<
MLine
*>
lines2
;
for
(
unsigned
int
i
=
0
;
i
<
ge
->
lines
.
size
();
i
++
){
MLine3
*
l
=
dynamic_cast
<
MLine3
*>
(
ge
->
lines
[
i
]);
MLine
*
l
=
ge
->
lines
[
i
];
if
(
l
->
getNumVertices
()
==
3
){
lines2
.
push_back
(
new
MLine
(
l
->
getVertex
(
0
),
l
->
getVertex
(
2
)));
lines2
.
push_back
(
new
MLine
(
l
->
getVertex
(
2
),
l
->
getVertex
(
1
)));
}
delete
l
;
}
ge
->
lines
=
lines2
;
...
...
@@ -33,7 +31,8 @@ void Subdivide(GFace *gf)
{
std
::
vector
<
MTriangle
*>
triangles2
;
for
(
unsigned
int
i
=
0
;
i
<
gf
->
triangles
.
size
();
i
++
){
MTriangle6
*
t
=
dynamic_cast
<
MTriangle6
*>
(
gf
->
triangles
[
i
]);
MTriangle
*
t
=
gf
->
triangles
[
i
];
if
(
t
->
getNumVertices
()
==
6
){
triangles2
.
push_back
(
new
MTriangle
(
t
->
getVertex
(
0
),
t
->
getVertex
(
3
),
t
->
getVertex
(
5
)));
triangles2
.
push_back
...
...
@@ -42,13 +41,15 @@ void Subdivide(GFace *gf)
(
new
MTriangle
(
t
->
getVertex
(
3
),
t
->
getVertex
(
1
),
t
->
getVertex
(
4
)));
triangles2
.
push_back
(
new
MTriangle
(
t
->
getVertex
(
5
),
t
->
getVertex
(
4
),
t
->
getVertex
(
2
)));
}
delete
t
;
}
gf
->
triangles
=
triangles2
;
std
::
vector
<
MQuadrangle
*>
quadrangles2
;
for
(
unsigned
int
i
=
0
;
i
<
gf
->
quadrangles
.
size
();
i
++
){
MQuadrangle9
*
q
=
dynamic_cast
<
MQuadrangle9
*>
(
gf
->
quadrangles
[
i
]);
MQuadrangle
*
q
=
gf
->
quadrangles
[
i
];
if
(
q
->
getNumVertices
()
==
9
){
quadrangles2
.
push_back
(
new
MQuadrangle
(
q
->
getVertex
(
0
),
q
->
getVertex
(
4
),
q
->
getVertex
(
8
),
q
->
getVertex
(
7
)));
quadrangles2
.
push_back
...
...
@@ -57,7 +58,7 @@ void Subdivide(GFace *gf)
(
new
MQuadrangle
(
q
->
getVertex
(
8
),
q
->
getVertex
(
5
),
q
->
getVertex
(
2
),
q
->
getVertex
(
6
)));
quadrangles2
.
push_back
(
new
MQuadrangle
(
q
->
getVertex
(
7
),
q
->
getVertex
(
8
),
q
->
getVertex
(
6
),
q
->
getVertex
(
3
)));
}
delete
q
;
}
gf
->
quadrangles
=
quadrangles2
;
...
...
@@ -66,11 +67,10 @@ void Subdivide(GFace *gf)
void
Subdivide
(
GRegion
*
gr
)
{
std
::
vector
<
MTetrahedron
*>
tetrahedra2
;
for
(
unsigned
int
i
=
0
;
i
<
gr
->
tetrahedra
.
size
();
i
++
){
MTetrahedron
10
*
t
=
dynamic_cast
<
MTetrahedron10
*>
(
gr
->
tetrahedra
[
i
]
)
;
MTetrahedron
*
t
=
gr
->
tetrahedra
[
i
];
if
(
t
->
getNumVertices
()
==
10
){
tetrahedra2
.
push_back
(
new
MTetrahedron
(
t
->
getVertex
(
0
),
t
->
getVertex
(
4
),
t
->
getVertex
(
7
),
t
->
getVertex
(
6
)));
tetrahedra2
.
push_back
...
...
@@ -87,13 +87,15 @@ void Subdivide(GRegion *gr)
(
new
MTetrahedron
(
t
->
getVertex
(
7
),
t
->
getVertex
(
8
),
t
->
getVertex
(
5
),
t
->
getVertex
(
6
)));
tetrahedra2
.
push_back
(
new
MTetrahedron
(
t
->
getVertex
(
4
),
t
->
getVertex
(
7
),
t
->
getVertex
(
5
),
t
->
getVertex
(
6
)));
}
delete
t
;
}
gr
->
tetrahedra
=
tetrahedra2
;
std
::
vector
<
MHexahedron
*>
hexahedra2
;
for
(
unsigned
int
i
=
0
;
i
<
gr
->
hexahedra
.
size
();
i
++
){
MHexahedron27
*
h
=
dynamic_cast
<
MHexahedron27
*>
(
gr
->
hexahedra
[
i
]);
MHexahedron
*
h
=
gr
->
hexahedra
[
i
];
if
(
h
->
getNumVertices
()
==
27
){
hexahedra2
.
push_back
(
new
MHexahedron
(
h
->
getVertex
(
0
),
h
->
getVertex
(
8
),
h
->
getVertex
(
20
),
h
->
getVertex
(
9
),
h
->
getVertex
(
10
),
h
->
getVertex
(
21
),
h
->
getVertex
(
26
),
h
->
getVertex
(
22
)));
...
...
@@ -118,14 +120,15 @@ void Subdivide(GRegion *gr)
hexahedra2
.
push_back
(
new
MHexahedron
(
h
->
getVertex
(
26
),
h
->
getVertex
(
23
),
h
->
getVertex
(
14
),
h
->
getVertex
(
24
),
h
->
getVertex
(
25
),
h
->
getVertex
(
18
),
h
->
getVertex
(
6
),
h
->
getVertex
(
19
)));
}
delete
h
;
}
gr
->
hexahedra
=
hexahedra2
;
std
::
vector
<
MPrism
*>
prisms2
;
for
(
unsigned
int
i
=
0
;
i
<
gr
->
prisms
.
size
();
i
++
){
MPrism
18
*
p
=
dynamic_cast
<
MPrism18
*>
(
gr
->
prisms
[
i
]
)
;
MPrism
*
p
=
gr
->
prisms
[
i
];
if
(
p
->
getNumVertices
()
==
18
){
prisms2
.
push_back
(
new
MPrism
(
p
->
getVertex
(
0
),
p
->
getVertex
(
6
),
p
->
getVertex
(
7
),
p
->
getVertex
(
8
),
p
->
getVertex
(
15
),
p
->
getVertex
(
16
)));
...
...
@@ -150,17 +153,16 @@ void Subdivide(GRegion *gr)
prisms2
.
push_back
(
new
MPrism
(
p
->
getVertex
(
17
),
p
->
getVertex
(
16
),
p
->
getVertex
(
15
),
p
->
getVertex
(
14
),
p
->
getVertex
(
13
),
p
->
getVertex
(
12
)));
}
delete
p
;
}
gr
->
prisms
=
prisms2
;
std
::
vector
<
MPyramid
*>
pyramids2
;
for
(
unsigned
int
i
=
0
;
i
<
gr
->
pyramids
.
size
();
i
++
){
MPyramid
14
*
p
=
dynamic_cast
<
MPyramid14
*>
(
gr
->
pyramids
[
i
]
)
;
/*
BASE
*/
MPyramid
*
p
=
gr
->
pyramids
[
i
];
if
(
p
->
getNumVertices
()
==
14
){
//
BASE
pyramids2
.
push_back
(
new
MPyramid
(
p
->
getVertex
(
0
),
p
->
getVertex
(
5
),
p
->
getVertex
(
13
),
p
->
getVertex
(
6
),
p
->
getVertex
(
7
)));
pyramids2
.
push_back
...
...
@@ -170,58 +172,47 @@ void Subdivide(GRegion *gr)
pyramids2
.
push_back
(
new
MPyramid
(
p
->
getVertex
(
6
),
p
->
getVertex
(
13
),
p
->
getVertex
(
10
),
p
->
getVertex
(
3
),
p
->
getVertex
(
12
)));
/*
Split remaining into tets
*/
/*
Top
*/
gr
->
tetrahedra
.
push_back
(
(
new
MTetrahedron
(
p
->
getVertex
(
7
),
p
->
getVertex
(
9
),
p
->
getVertex
(
12
),
p
->
getVertex
(
4
))));
gr
->
tetrahedra
.
push_back
(
(
new
MTetrahedron
(
p
->
getVertex
(
9
),
p
->
getVertex
(
11
),
p
->
getVertex
(
12
),
p
->
getVertex
(
4
))));
/*
Upside down one
*/
gr
->
tetrahedra
.
push_back
(
(
new
MTetrahedron
(
p
->
getVertex
(
9
),
p
->
getVertex
(
12
),
p
->
getVertex
(
11
),
p
->
getVertex
(
13
))));
gr
->
tetrahedra
.
push_back
(
(
new
MTetrahedron
(
p
->
getVertex
(
7
),
p
->
getVertex
(
12
),
p
->
getVertex
(
9
),
p
->
getVertex
(
13
))));
/* Four tets around bottom perimeter */
gr
->
tetrahedra
.
push_back
(
(
new
MTetrahedron
(
p
->
getVertex
(
7
),
p
->
getVertex
(
9
),
p
->
getVertex
(
5
),
p
->
getVertex
(
13
))));
gr
->
tetrahedra
.
push_back
(
(
new
MTetrahedron
(
p
->
getVertex
(
9
),
p
->
getVertex
(
11
),
p
->
getVertex
(
8
),
p
->
getVertex
(
13
))));
gr
->
t
et
rahedra
.
push_back
(
(
new
MTetrahedron
(
p
->
getVertex
(
12
),
p
->
getVertex
(
10
),
p
->
getVertex
(
11
),
p
->
g
et
Vertex
(
13
))));
gr
->
tetrahedra
.
push_back
(
(
new
MTetrahedron
(
p
->
getVertex
(
7
),
p
->
getVertex
(
6
),
p
->
getVertex
(
12
),
p
->
getVertex
(
13
))));
//
Split remaining into tets
//
Top
gr
->
tetrahedra
.
push_back
(
(
new
MTetrahedron
(
p
->
getVertex
(
7
),
p
->
getVertex
(
9
),
p
->
getVertex
(
12
),
p
->
getVertex
(
4
))));
gr
->
tetrahedra
.
push_back
(
(
new
MTetrahedron
(
p
->
getVertex
(
9
),
p
->
getVertex
(
11
),
p
->
getVertex
(
12
),
p
->
getVertex
(
4
))));
//
Upside down one
gr
->
tetrahedra
.
push_back
(
(
new
MTetrahedron
(
p
->
getVertex
(
9
),
p
->
getVertex
(
12
),
p
->
getVertex
(
11
),
p
->
getVertex
(
13
))));
gr
->
tetrahedra
.
push_back
(
(
new
MTetrahedron
(
p
->
getVertex
(
7
),
p
->
getVertex
(
12
),
p
->
getVertex
(
9
),
p
->
getVertex
(
13
))));
// Four tets around bottom perimeter
gr
->
tetrahedra
.
push_back
((
new
MTetrahedron
(
p
->
getVertex
(
7
),
p
->
getVertex
(
9
),
p
->
getVertex
(
5
),
p
->
getVertex
(
13
))));
gr
->
tetrahedra
.
push_back
((
new
MTetrahedron
(
p
->
getVertex
(
9
),
p
->
getVertex
(
11
),
p
->
getVertex
(
8
),
p
->
getVertex
(
13
))));
gr
->
tetrahedra
.
push_back
((
new
MTetrahedron
(
p
->
getVertex
(
12
),
p
->
g
et
Vertex
(
10
),
p
->
getVertex
(
11
),
p
->
getVertex
(
13
))));
gr
->
t
et
rahedra
.
push_back
((
new
MTetrahedron
(
p
->
getVertex
(
7
),
p
->
getVertex
(
6
),
p
->
getVertex
(
12
),
p
->
getVertex
(
13
))));
}
delete
p
;
}
gr
->
pyramids
=
pyramids2
;
gr
->
deleteVertexArrays
();
}
void
Refine
(
GModel
*
m
,
bool
linear
)
{
//
r
efine all edges in a mesh by inserting a point on the midpoint
//
R
efine all edges in a mesh by inserting a point on the midpoint
// then recreate edge, face, and region definitions
//
//
- i
f linear is set to true, new vertices are created by linear
//
I
f linear is set to true, new vertices are created by linear
// interpolation between existing ones. If not, new vertices are
// created on the exact geometry, provided that the geometrical
// edges/faces are discretized with 1D/2D elements. (I.e., if
// there are only 3D elements in the mesh then any new vertices on
// the boundary will always be created by linear interpolation,
// whether linear is set or not.)
#if !defined(HAVE_GSL)
Msg
::
Error
(
"Mesh refinement requires the GSL"
);
return
;
#endif
// edges/faces are discretized with 1D/2D elements. (I.e., if there
// are only 3D elements in the mesh then any new vertices on the
// boundary will always be created by linear interpolation, whether
// linear is set or not.)
Msg
::
StatusBar
(
1
,
true
,
"Generating refined mesh ..."
);
double
t1
=
Cpu
();
...
...
This diff is collapsed.
Click to expand it.
Numeric/FunctionSpace.cpp
+
4
−
0
View file @
988bab49
...
...
@@ -2,6 +2,10 @@
//
// See the LICENSE.txt file for license information. Please report all
// bugs and problems to <gmsh@geuz.org>.
//
// Contributor(s):
// Koen Hillewaert
//
#include
"FunctionSpace.h"
#include
"GmshDefines.h"
...
...
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