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
e399296e
Commit
e399296e
authored
20 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
Generalized Plugin(Triangulate) to handle vector and tensor views
parent
0ee2236b
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
Plugin/Triangulate.cpp
+61
-54
61 additions, 54 deletions
Plugin/Triangulate.cpp
TODO
+1
-5
1 addition, 5 deletions
TODO
doc/VERSIONS
+3
-2
3 additions, 2 deletions
doc/VERSIONS
doc/texinfo/opt_plugin.texi
+2
-2
2 additions, 2 deletions
doc/texinfo/opt_plugin.texi
with
67 additions
and
63 deletions
Plugin/Triangulate.cpp
+
61
−
54
View file @
e399296e
// $Id: Triangulate.cpp,v 1.2
2
2004-0
5-17 21:28:02
geuzaine Exp $
// $Id: Triangulate.cpp,v 1.2
3
2004-0
6-24 07:13:18
geuzaine Exp $
//
// Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle
//
...
...
@@ -63,8 +63,8 @@ void GMSH_TriangulatePlugin::getInfos(char *author, char *copyright,
strcpy
(
copyright
,
"DGR (www.multiphysics.com)"
);
strcpy
(
help_text
,
"Plugin(Triangulate) triangulates the points
\n
"
"in the
scalar
view `iView', assuming that all
\n
"
"
the
points belong to a surface that can be
\n
"
"in the view `iView', assuming that all
the
\n
"
"points belong to a surface that can be
\n
"
"univoquely projected into a plane. If `iView'
\n
"
"< 0, the plugin is run on the current view.
\n
"
"
\n
"
...
...
@@ -88,7 +88,8 @@ void GMSH_TriangulatePlugin::catchErrorMessage(char *errorMessage) const
#if !defined(HAVE_TRIANGLE)
void
Triangulate
(
Post_View
*
vin
,
Post_View
*
vout
)
void
Triangulate
(
int
nbIn
,
List_T
*
inList
,
int
*
nbOut
,
List_T
*
outList
,
int
nbTimeStep
,
int
nbComp
)
{
Msg
(
GERROR
,
"Triangle is not compiled in this version of Gmsh"
);
}
...
...
@@ -103,34 +104,35 @@ extern "C"
#include
"triangle.h"
}
void
Triangulate
(
Post_View
*
vin
,
Post_View
*
vout
)
void
Triangulate
(
int
nbIn
,
List_T
*
inList
,
int
*
nbOut
,
List_T
*
outList
,
int
nbTimeStep
,
int
nbComp
)
{
int
nb
,
i
,
j
=
0
,
j0
,
j1
,
j2
;
Surface
*
s
;
Vertex
*
v
;
struct
triangulateio
in
,
out
;
List_T
*
points
=
List_Create
(
vin
->
NbSP
,
1
,
sizeof
(
Vertex
*
));
nb
=
List_Nbr
(
vin
->
SP
)
/
vin
->
NbSP
;
for
(
i
=
0
;
i
<
List_Nbr
(
vin
->
SP
);
i
+=
nb
)
{
v
=
Create_Vertex
(
j
++
,
*
(
double
*
)
List_Pointer_Fast
(
vin
->
SP
,
i
),
*
(
double
*
)
List_Pointer_Fast
(
vin
->
SP
,
i
+
1
),
*
(
double
*
)
List_Pointer_Fast
(
vin
->
SP
,
i
+
2
),
1.
,
0.
);
if
(
!
nbIn
)
return
;
List_T
*
points
=
List_Create
(
nbIn
,
1
,
sizeof
(
Vertex
*
));
int
nb
=
List_Nbr
(
inList
)
/
nbIn
;
int
j
=
0
;
for
(
int
i
=
0
;
i
<
List_Nbr
(
inList
);
i
+=
nb
)
{
Vertex
*
v
=
Create_Vertex
(
j
++
,
*
(
double
*
)
List_Pointer_Fast
(
inList
,
i
),
*
(
double
*
)
List_Pointer_Fast
(
inList
,
i
+
1
),
*
(
double
*
)
List_Pointer_Fast
(
inList
,
i
+
2
),
1.
,
0.
);
List_Add
(
points
,
&
v
);
}
s
=
Create_Surface
(
1
,
MSH_SURF_PLAN
);
Surface
*
s
=
Create_Surface
(
1
,
MSH_SURF_PLAN
);
MeanPlane
(
points
,
s
);
for
(
i
=
0
;
i
<
List_Nbr
(
points
);
i
++
)
{
for
(
int
i
=
0
;
i
<
List_Nbr
(
points
);
i
++
)
{
Vertex
*
v
;
List_Read
(
points
,
i
,
&
v
);
Projette
(
v
,
s
->
plan
);
}
Free_Surface
(
&
s
,
NULL
);
struct
triangulateio
in
;
in
.
numberofpoints
=
List_Nbr
(
points
);
in
.
pointlist
=
(
REAL
*
)
Malloc
(
in
.
numberofpoints
*
2
*
sizeof
(
REAL
));
in
.
numberofpointattributes
=
0
;
...
...
@@ -145,19 +147,22 @@ void Triangulate(Post_View * vin, Post_View * vout)
in
.
holelist
=
NULL
;
j
=
0
;
for
(
i
=
0
;
i
<
List_Nbr
(
points
);
i
++
)
{
for
(
int
i
=
0
;
i
<
List_Nbr
(
points
);
i
++
)
{
Vertex
*
v
;
List_Read
(
points
,
i
,
&
v
);
in
.
pointlist
[
j
]
=
v
->
Pos
.
X
;
in
.
pointlist
[
j
+
1
]
=
v
->
Pos
.
Y
;
j
+=
2
;
}
for
(
i
=
0
;
i
<
List_Nbr
(
points
);
i
++
)
{
for
(
int
i
=
0
;
i
<
List_Nbr
(
points
);
i
++
)
{
Vertex
*
v
;
List_Read
(
points
,
i
,
&
v
);
Free_Vertex
(
&
v
,
NULL
);
}
List_Delete
(
points
);
struct
triangulateio
out
;
out
.
pointlist
=
NULL
;
out
.
pointattributelist
=
NULL
;
out
.
pointmarkerlist
=
NULL
;
...
...
@@ -177,25 +182,27 @@ void Triangulate(Post_View * vin, Post_View * vout)
Free
(
in
.
pointlist
);
Free
(
out
.
pointlist
);
for
(
i
=
0
;
i
<
out
.
numberoftriangles
;
i
++
)
{
j0
=
out
.
trianglelist
[
i
*
out
.
numberofcorners
+
0
];
j1
=
out
.
trianglelist
[
i
*
out
.
numberofcorners
+
1
];
j2
=
out
.
trianglelist
[
i
*
out
.
numberofcorners
+
2
];
for
(
j
=
0
;
j
<
3
;
j
++
)
{
List_Add
(
v
out
->
ST
,
List_Pointer
(
v
in
->
SP
,
(
j0
*
nb
)
+
j
));
List_Add
(
v
out
->
ST
,
List_Pointer
(
v
in
->
SP
,
(
j1
*
nb
)
+
j
));
List_Add
(
v
out
->
ST
,
List_Pointer
(
v
in
->
SP
,
(
j2
*
nb
)
+
j
));
for
(
int
i
=
0
;
i
<
out
.
numberoftriangles
;
i
++
)
{
int
j0
=
out
.
trianglelist
[
i
*
out
.
numberofcorners
+
0
];
int
j1
=
out
.
trianglelist
[
i
*
out
.
numberofcorners
+
1
];
int
j2
=
out
.
trianglelist
[
i
*
out
.
numberofcorners
+
2
];
for
(
int
j
=
0
;
j
<
3
;
j
++
)
{
List_Add
(
out
List
,
List_Pointer
(
in
List
,
(
j0
*
nb
)
+
j
));
List_Add
(
out
List
,
List_Pointer
(
in
List
,
(
j1
*
nb
)
+
j
));
List_Add
(
out
List
,
List_Pointer
(
in
List
,
(
j2
*
nb
)
+
j
));
}
for
(
j
=
0
;
j
<
vin
->
NbTimeStep
;
j
++
)
{
List_Add
(
vout
->
ST
,
List_Pointer
(
vin
->
SP
,
(
j0
*
nb
)
+
3
+
j
));
List_Add
(
vout
->
ST
,
List_Pointer
(
vin
->
SP
,
(
j1
*
nb
)
+
3
+
j
));
List_Add
(
vout
->
ST
,
List_Pointer
(
vin
->
SP
,
(
j2
*
nb
)
+
3
+
j
));
for
(
int
j
=
0
;
j
<
nbTimeStep
;
j
++
)
{
for
(
int
k
=
0
;
k
<
nbComp
;
k
++
)
List_Add
(
outList
,
List_Pointer
(
inList
,
(
j0
*
nb
)
+
3
+
j
*
nbComp
+
k
));
for
(
int
k
=
0
;
k
<
nbComp
;
k
++
)
List_Add
(
outList
,
List_Pointer
(
inList
,
(
j1
*
nb
)
+
3
+
j
*
nbComp
+
k
));
for
(
int
k
=
0
;
k
<
nbComp
;
k
++
)
List_Add
(
outList
,
List_Pointer
(
inList
,
(
j2
*
nb
)
+
3
+
j
*
nbComp
+
k
));
}
vout
->
NbST
++
;
(
*
nbOut
)
++
;
}
Free
(
out
.
trianglelist
);
}
#endif // !HAVE_TRIANGLE
...
...
@@ -212,24 +219,24 @@ Post_View *GMSH_TriangulatePlugin::execute(Post_View * v)
return
v
;
}
if
(
v
->
NbSP
<
2
&&
v
->
NbVP
<
2
&&
v
->
NbTP
<
2
)
return
v
;
Post_View
*
v2
=
BeginView
(
1
);
Post_View
*
v1
=
(
Post_View
*
)
List_Pointer
(
CTX
.
post
.
list
,
iView
);
if
(
v1
->
NbSP
>
2
)
{
// FIXME: this is not secure: if BeginView forces a post.list
// reallocation, v1 could be wrong
Post_View
*
v2
=
BeginView
(
1
);
Triangulate
(
v1
,
v2
);
// copy time data
for
(
int
i
=
0
;
i
<
List_Nbr
(
v1
->
Time
);
i
++
)
List_Add
(
v2
->
Time
,
List_Pointer
(
v1
->
Time
,
i
));
// finalize
char
name
[
1024
],
filename
[
1024
];
sprintf
(
name
,
"%s_Triangulate"
,
v1
->
Name
);
sprintf
(
filename
,
"%s_Triangulate.pos"
,
v1
->
Name
);
EndView
(
v2
,
1
,
filename
,
name
);
return
v2
;
}
return
v1
;
}
Triangulate
(
v1
->
NbSP
,
v1
->
SP
,
&
v2
->
NbST
,
v2
->
ST
,
v1
->
NbTimeStep
,
1
);
Triangulate
(
v1
->
NbVP
,
v1
->
VP
,
&
v2
->
NbVT
,
v2
->
VT
,
v1
->
NbTimeStep
,
3
);
Triangulate
(
v1
->
NbTP
,
v1
->
TP
,
&
v2
->
NbTT
,
v2
->
TT
,
v1
->
NbTimeStep
,
9
);
// copy time data
for
(
int
i
=
0
;
i
<
List_Nbr
(
v1
->
Time
);
i
++
)
List_Add
(
v2
->
Time
,
List_Pointer
(
v1
->
Time
,
i
));
// finalize
char
name
[
1024
],
filename
[
1024
];
sprintf
(
name
,
"%s_Triangulate"
,
v1
->
Name
);
sprintf
(
filename
,
"%s_Triangulate.pos"
,
v1
->
Name
);
EndView
(
v2
,
1
,
filename
,
name
);
return
v2
;
}
This diff is collapsed.
Click to expand it.
TODO
+
1
−
5
View file @
e399296e
$Id: TODO,v 1.5
1
2004-06-2
3 19:53:52
geuzaine Exp $
$Id: TODO,v 1.5
2
2004-06-2
4 07:13:18
geuzaine Exp $
add ternary operator and <,>,<=,>=,== tests in MathEval
********************************************************************
generalize Plugin(Triangulate) to vector and tensor points
********************************************************************
gerard.fleury@inrs.fr: add the capability to mesh some entities using
1st order and some other using 2nd order elements (in the same
geometry)?
...
...
This diff is collapsed.
Click to expand it.
doc/VERSIONS
+
3
−
2
View file @
e399296e
$Id: VERSIONS,v 1.22
7
2004-06-2
3 18:52:45
geuzaine Exp $
$Id: VERSIONS,v 1.22
8
2004-06-2
4 07:13:18
geuzaine Exp $
New since 1.53: fixed UNV output; make Layers' region numbering
consistent between lines/surfaces/volumes; fixed home directory
...
...
@@ -6,7 +6,8 @@ problem on Win98; new Plugin(CutParametric); the default project file
is now created in the home directory if no current directory is
defined (e.g. when double-clicking on the icon on Windows/MacOS);
fixed the discrepancy between the orientation of geometrical surfaces
and the associated surface meshes; small bug fixes and cleanups.
and the associated surface meshes; generalized Plugin(Triangulate) to
handle vector and tensor views; small bug fixes and cleanups.
New in 1.53: completed support for second order elements in the mesh
module (lines, triangles, quadrangles, tetrahedra, hexahedra, prisms
...
...
This diff is collapsed.
Click to expand it.
doc/texinfo/opt_plugin.texi
+
2
−
2
View file @
e399296e
...
...
@@ -387,8 +387,8 @@ Default value: @code{-1}
@item Plugin(Triangulate)
Plugin(Triangulate) triangulates the points
in the
scalar
view `iView', assuming that all
the
points belong to a surface that can be
in the view `iView', assuming that all
the
points belong to a surface that can be
univoquely projected into a plane. If `iView'
< 0, the plugin is run on the current view.
...
...
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