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
Package registry
Model registry
Operate
Terraform modules
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
Romin Tomasetti
gmsh
Commits
1d62c3a3
Commit
1d62c3a3
authored
7 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
basic gmshModelGeo API
parent
e8e09730
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
Common/gmsh.cpp
+161
-0
161 additions, 0 deletions
Common/gmsh.cpp
Common/gmsh.h
+9
-8
9 additions, 8 deletions
Common/gmsh.h
utils/api_demos/CMakeLists.txt
+3
-0
3 additions, 0 deletions
utils/api_demos/CMakeLists.txt
utils/api_demos/t1.cpp
+46
-0
46 additions, 0 deletions
utils/api_demos/t1.cpp
with
219 additions
and
8 deletions
Common/gmsh.cpp
+
161
−
0
View file @
1d62c3a3
...
@@ -19,6 +19,7 @@
...
@@ -19,6 +19,7 @@
#include
"MHexahedron.h"
#include
"MHexahedron.h"
#include
"MPrism.h"
#include
"MPrism.h"
#include
"MPyramid.h"
#include
"MPyramid.h"
#include
"ExtrudeParams.h"
// gmsh
// gmsh
...
@@ -467,3 +468,163 @@ int gmshModelAddEmbedded(int dim, const std::vector<int> &tags, int toDim, int t
...
@@ -467,3 +468,163 @@ int gmshModelAddEmbedded(int dim, const std::vector<int> &tags, int toDim, int t
}
}
// gmshModelGeo
// gmshModelGeo
int
gmshModelGeoAddVertex
(
int
&
tag
,
double
x
,
double
y
,
double
z
,
double
lc
)
{
return
!
GModel
::
current
()
->
getGEOInternals
()
->
addVertex
(
tag
,
x
,
y
,
z
,
lc
);
}
int
gmshModelGeoAddLine
(
int
&
tag
,
int
startTag
,
int
endTag
)
{
return
!
GModel
::
current
()
->
getGEOInternals
()
->
addLine
(
tag
,
startTag
,
endTag
);
}
int
gmshModelGeoAddCircleArc
(
int
&
tag
,
int
startTag
,
int
centerTag
,
int
endTag
,
double
nx
,
double
ny
,
double
nz
)
{
return
!
GModel
::
current
()
->
getGEOInternals
()
->
addCircleArc
(
tag
,
startTag
,
centerTag
,
endTag
,
nx
,
ny
,
nz
);
}
int
gmshModelGeoAddEllipseArc
(
int
&
tag
,
int
startTag
,
int
centerTag
,
int
majorTag
,
int
endTag
,
double
nx
,
double
ny
,
double
nz
)
{
return
!
GModel
::
current
()
->
getGEOInternals
()
->
addEllipseArc
(
tag
,
startTag
,
centerTag
,
majorTag
,
endTag
,
nx
,
ny
,
nz
);
}
int
gmshModelGeoAddSpline
(
int
&
tag
,
const
std
::
vector
<
int
>
&
vertexTags
)
{
return
!
GModel
::
current
()
->
getGEOInternals
()
->
addSpline
(
tag
,
vertexTags
);
}
int
gmshModelGeoAddBSpline
(
int
&
tag
,
const
std
::
vector
<
int
>
&
vertexTags
)
{
return
!
GModel
::
current
()
->
getGEOInternals
()
->
addBSpline
(
tag
,
vertexTags
);
}
int
gmshModelGeoAddBezier
(
int
&
tag
,
const
std
::
vector
<
int
>
&
vertexTags
)
{
return
!
GModel
::
current
()
->
getGEOInternals
()
->
addBezier
(
tag
,
vertexTags
);
}
int
gmshModelGeoAddLineLoop
(
int
&
tag
,
const
std
::
vector
<
int
>
&
edgeTags
)
{
return
!
GModel
::
current
()
->
getGEOInternals
()
->
addLineLoop
(
tag
,
edgeTags
);
}
int
gmshModelGeoAddPlaneSurface
(
int
&
tag
,
const
std
::
vector
<
int
>
&
wireTags
)
{
return
!
GModel
::
current
()
->
getGEOInternals
()
->
addPlaneSurface
(
tag
,
wireTags
);
}
int
gmshModelGeoAddSurfaceFilling
(
int
&
tag
,
const
std
::
vector
<
int
>
&
wireTags
,
int
sphereCenterTag
)
{
return
!
GModel
::
current
()
->
getGEOInternals
()
->
addSurfaceFilling
(
tag
,
wireTags
,
sphereCenterTag
);
}
int
gmshModelGeoAddSurfaceLoop
(
int
&
tag
,
const
std
::
vector
<
int
>
&
faceTags
)
{
return
!
GModel
::
current
()
->
getGEOInternals
()
->
addSurfaceLoop
(
tag
,
faceTags
);
}
int
gmshModelGeoAddVolume
(
int
&
tag
,
const
std
::
vector
<
int
>
&
shellTags
)
{
return
!
GModel
::
current
()
->
getGEOInternals
()
->
addVolume
(
tag
,
shellTags
);
}
static
ExtrudeParams
*
getExtrudeParams
(
const
std
::
vector
<
int
>
&
numElements
,
const
std
::
vector
<
double
>
&
heights
,
bool
recombine
)
{
ExtrudeParams
*
e
=
0
;
if
(
numElements
.
size
()){
e
=
new
ExtrudeParams
();
e
->
mesh
.
ExtrudeMesh
=
true
;
e
->
mesh
.
NbElmLayer
=
numElements
;
e
->
mesh
.
hLayer
=
heights
;
if
(
e
->
mesh
.
hLayer
.
empty
())
e
->
mesh
.
hLayer
.
push_back
(
1.
);
e
->
mesh
.
Recombine
=
recombine
;
}
return
e
;
}
int
gmshModelGeoExtrude
(
const
std
::
vector
<
std
::
pair
<
int
,
int
>
>
&
inDimTags
,
double
dx
,
double
dy
,
double
dz
,
std
::
vector
<
std
::
pair
<
int
,
int
>
>
&
outDimTags
,
const
std
::
vector
<
int
>
&
numElements
,
const
std
::
vector
<
double
>
&
heights
,
bool
recombine
)
{
return
!
GModel
::
current
()
->
getGEOInternals
()
->
extrude
(
inDimTags
,
dx
,
dy
,
dz
,
outDimTags
,
getExtrudeParams
(
numElements
,
heights
,
recombine
));
}
int
gmshModelGeoRevolve
(
const
std
::
vector
<
std
::
pair
<
int
,
int
>
>
&
inDimTags
,
double
x
,
double
y
,
double
z
,
double
ax
,
double
ay
,
double
az
,
double
angle
,
std
::
vector
<
std
::
pair
<
int
,
int
>
>
&
outDimTags
,
const
std
::
vector
<
int
>
&
numElements
,
const
std
::
vector
<
double
>
&
heights
,
bool
recombine
)
{
return
!
GModel
::
current
()
->
getGEOInternals
()
->
revolve
(
inDimTags
,
x
,
y
,
z
,
ax
,
ay
,
az
,
angle
,
outDimTags
,
getExtrudeParams
(
numElements
,
heights
,
recombine
));
}
int
gmshModelGeoTwist
(
const
std
::
vector
<
std
::
pair
<
int
,
int
>
>
&
inDimTags
,
double
x
,
double
y
,
double
z
,
double
dx
,
double
dy
,
double
dz
,
double
ax
,
double
ay
,
double
az
,
double
angle
,
std
::
vector
<
std
::
pair
<
int
,
int
>
>
&
outDimTags
,
const
std
::
vector
<
int
>
&
numElements
,
const
std
::
vector
<
double
>
&
heights
,
bool
recombine
)
{
return
!
GModel
::
current
()
->
getGEOInternals
()
->
twist
(
inDimTags
,
x
,
y
,
z
,
dx
,
dy
,
dz
,
ax
,
ay
,
az
,
angle
,
outDimTags
,
getExtrudeParams
(
numElements
,
heights
,
recombine
));
}
int
gmshModelGeoTranslate
(
const
std
::
vector
<
std
::
pair
<
int
,
int
>
>
&
dimTags
,
double
dx
,
double
dy
,
double
dz
)
{
}
int
gmshModelGeoRotate
(
const
std
::
vector
<
std
::
pair
<
int
,
int
>
>
&
dimTags
,
double
x
,
double
y
,
double
z
,
double
ax
,
double
ay
,
double
az
,
double
angle
)
{
}
int
gmshModelGeoDilate
(
const
std
::
vector
<
std
::
pair
<
int
,
int
>
>
&
dimTags
,
double
x
,
double
y
,
double
z
,
double
a
,
double
b
,
double
c
)
{
}
int
gmshModelGeoSymmetry
(
const
std
::
vector
<
std
::
pair
<
int
,
int
>
>
&
dimTags
,
double
a
,
double
b
,
double
c
,
double
d
)
{
}
int
gmshModelGeoCopy
(
const
std
::
vector
<
std
::
pair
<
int
,
int
>
>
&
inDimTags
,
std
::
vector
<
std
::
pair
<
int
,
int
>
>
&
outDimTags
)
{
}
int
gmshModelGeoRemove
(
const
std
::
vector
<
std
::
pair
<
int
,
int
>
>
&
dimTags
,
bool
recursive
)
{
}
int
gmshModelGeoRemoveAllDuplicates
()
{
}
int
gmshModelGeoSynchronize
()
{
GModel
::
current
()
->
getGEOInternals
()
->
synchronize
(
GModel
::
current
());
return
0
;
}
This diff is collapsed.
Click to expand it.
Common/gmsh.h
+
9
−
8
View file @
1d62c3a3
...
@@ -91,8 +91,6 @@ GMSH_API gmshModelGeoAddEllipseArc(int &tag, int startTag, int centerTag, int ma
...
@@ -91,8 +91,6 @@ GMSH_API gmshModelGeoAddEllipseArc(int &tag, int startTag, int centerTag, int ma
GMSH_API
gmshModelGeoAddSpline
(
int
&
tag
,
const
std
::
vector
<
int
>
&
vertexTags
);
GMSH_API
gmshModelGeoAddSpline
(
int
&
tag
,
const
std
::
vector
<
int
>
&
vertexTags
);
GMSH_API
gmshModelGeoAddBSpline
(
int
&
tag
,
const
std
::
vector
<
int
>
&
vertexTags
);
GMSH_API
gmshModelGeoAddBSpline
(
int
&
tag
,
const
std
::
vector
<
int
>
&
vertexTags
);
GMSH_API
gmshModelGeoAddBezier
(
int
&
tag
,
const
std
::
vector
<
int
>
&
vertexTags
);
GMSH_API
gmshModelGeoAddBezier
(
int
&
tag
,
const
std
::
vector
<
int
>
&
vertexTags
);
GMSH_API
gmshModelGeoAddNurbs
(
int
&
tag
,
const
std
::
vector
<
int
>
&
vertexTags
,
const
std
::
vector
<
double
>
&
knots
);
GMSH_API
gmshModelGeoAddLineLoop
(
int
&
tag
,
const
std
::
vector
<
int
>
&
edgeTags
);
GMSH_API
gmshModelGeoAddLineLoop
(
int
&
tag
,
const
std
::
vector
<
int
>
&
edgeTags
);
GMSH_API
gmshModelGeoAddPlaneSurface
(
int
&
tag
,
const
std
::
vector
<
int
>
&
wireTags
);
GMSH_API
gmshModelGeoAddPlaneSurface
(
int
&
tag
,
const
std
::
vector
<
int
>
&
wireTags
);
GMSH_API
gmshModelGeoAddSurfaceFilling
(
int
&
tag
,
const
std
::
vector
<
int
>
&
wireTags
,
GMSH_API
gmshModelGeoAddSurfaceFilling
(
int
&
tag
,
const
std
::
vector
<
int
>
&
wireTags
,
...
@@ -102,21 +100,24 @@ GMSH_API gmshModelGeoAddVolume(int &tag, const std::vector<int> &shellTags);
...
@@ -102,21 +100,24 @@ GMSH_API gmshModelGeoAddVolume(int &tag, const std::vector<int> &shellTags);
GMSH_API
gmshModelGeoExtrude
(
const
std
::
vector
<
std
::
pair
<
int
,
int
>
>
&
inDimTags
,
GMSH_API
gmshModelGeoExtrude
(
const
std
::
vector
<
std
::
pair
<
int
,
int
>
>
&
inDimTags
,
double
dx
,
double
dy
,
double
dz
,
double
dx
,
double
dy
,
double
dz
,
std
::
vector
<
std
::
pair
<
int
,
int
>
>
&
outDimTags
,
std
::
vector
<
std
::
pair
<
int
,
int
>
>
&
outDimTags
,
const
std
::
vector
<
int
>
&
numElements
,
const
std
::
vector
<
int
>
&
numElements
=
std
::
vector
<
int
>
(),
const
std
::
vector
<
double
>
&
heights
,
bool
recombine
);
const
std
::
vector
<
double
>
&
heights
=
std
::
vector
<
double
>
(),
bool
recombine
=
false
);
GMSH_API
gmshModelGeoRevolve
(
const
std
::
vector
<
std
::
pair
<
int
,
int
>
>
&
inDimTags
,
GMSH_API
gmshModelGeoRevolve
(
const
std
::
vector
<
std
::
pair
<
int
,
int
>
>
&
inDimTags
,
double
x
,
double
y
,
double
z
,
double
x
,
double
y
,
double
z
,
double
ax
,
double
ay
,
double
az
,
double
angle
,
double
ax
,
double
ay
,
double
az
,
double
angle
,
std
::
vector
<
std
::
pair
<
int
,
int
>
>
&
outDimTags
,
std
::
vector
<
std
::
pair
<
int
,
int
>
>
&
outDimTags
,
const
std
::
vector
<
int
>
&
numElements
,
const
std
::
vector
<
int
>
&
numElements
=
std
::
vector
<
int
>
(),
const
std
::
vector
<
double
>
&
heights
,
bool
recombine
);
const
std
::
vector
<
double
>
&
heights
=
std
::
vector
<
double
>
(),
bool
recombine
=
false
);
GMSH_API
gmshModelGeoTwist
(
const
std
::
vector
<
std
::
pair
<
int
,
int
>
>
&
inDimTags
,
GMSH_API
gmshModelGeoTwist
(
const
std
::
vector
<
std
::
pair
<
int
,
int
>
>
&
inDimTags
,
double
x
,
double
y
,
double
z
,
double
x
,
double
y
,
double
z
,
double
dx
,
double
dy
,
double
dz
,
double
dx
,
double
dy
,
double
dz
,
double
ax
,
double
ay
,
double
az
,
double
angle
,
double
ax
,
double
ay
,
double
az
,
double
angle
,
std
::
vector
<
std
::
pair
<
int
,
int
>
>
&
outDimTags
,
std
::
vector
<
std
::
pair
<
int
,
int
>
>
&
outDimTags
,
const
std
::
vector
<
int
>
&
numElements
,
const
std
::
vector
<
int
>
&
numElements
=
std
::
vector
<
int
>
(),
const
std
::
vector
<
double
>
&
heights
,
bool
recombine
);
const
std
::
vector
<
double
>
&
heights
=
std
::
vector
<
double
>
(),
bool
recombine
=
false
);
GMSH_API
gmshModelGeoTranslate
(
const
std
::
vector
<
std
::
pair
<
int
,
int
>
>
&
dimTags
,
GMSH_API
gmshModelGeoTranslate
(
const
std
::
vector
<
std
::
pair
<
int
,
int
>
>
&
dimTags
,
double
dx
,
double
dy
,
double
dz
);
double
dx
,
double
dy
,
double
dz
);
GMSH_API
gmshModelGeoRotate
(
const
std
::
vector
<
std
::
pair
<
int
,
int
>
>
&
dimTags
,
GMSH_API
gmshModelGeoRotate
(
const
std
::
vector
<
std
::
pair
<
int
,
int
>
>
&
dimTags
,
...
...
This diff is collapsed.
Click to expand it.
utils/api_demos/CMakeLists.txt
+
3
−
0
View file @
1d62c3a3
...
@@ -25,3 +25,6 @@ target_link_libraries(basic ${GMSH_LIB} ${LAPACK_LIB} ${BLAS_LIB})
...
@@ -25,3 +25,6 @@ target_link_libraries(basic ${GMSH_LIB} ${LAPACK_LIB} ${BLAS_LIB})
add_executable
(
basic2 basic2.cpp
)
add_executable
(
basic2 basic2.cpp
)
target_link_libraries
(
basic2
${
GMSH_LIB
}
${
LAPACK_LIB
}
${
BLAS_LIB
}
)
target_link_libraries
(
basic2
${
GMSH_LIB
}
${
LAPACK_LIB
}
${
BLAS_LIB
}
)
add_executable
(
t1 t1.cpp
)
target_link_libraries
(
t1
${
GMSH_LIB
}
${
LAPACK_LIB
}
${
BLAS_LIB
}
)
This diff is collapsed.
Click to expand it.
utils/api_demos/t1.cpp
0 → 100644
+
46
−
0
View file @
1d62c3a3
#include
<iostream>
#include
<gmsh.h>
// this reimplements gmsh/tutorial/t1.geo
int
main
(
int
argc
,
char
**
argv
)
{
gmshInitialize
(
argc
,
argv
);
gmshOptionSetNumber
(
"General.Terminal"
,
1
);
gmshModelCreate
(
"t1"
);
double
lc
=
1e-2
;
int
tag
;
tag
=
1
;
gmshModelGeoAddVertex
(
tag
,
0
,
0
,
0
,
lc
);
tag
=
2
;
gmshModelGeoAddVertex
(
tag
,
.1
,
0
,
0
,
lc
);
tag
=
3
;
gmshModelGeoAddVertex
(
tag
,
.1
,
.3
,
0
,
lc
);
tag
=
4
;
gmshModelGeoAddVertex
(
tag
,
0
,
.3
,
0
,
lc
);
tag
=
1
;
gmshModelGeoAddLine
(
tag
,
1
,
2
);
tag
=
2
;
gmshModelGeoAddLine
(
tag
,
3
,
2
);
tag
=
3
;
gmshModelGeoAddLine
(
tag
,
3
,
4
);
tag
=
4
;
gmshModelGeoAddLine
(
tag
,
4
,
1
);
std
::
vector
<
int
>
l
;
l
.
push_back
(
4
);
l
.
push_back
(
1
);
l
.
push_back
(
-
2
);
l
.
push_back
(
3
);
tag
=
1
;
gmshModelGeoAddLineLoop
(
tag
,
l
);
std
::
vector
<
int
>
ll
;
ll
.
push_back
(
1
);
tag
=
1
;
gmshModelGeoAddPlaneSurface
(
tag
,
ll
);
std
::
vector
<
int
>
p
;
p
.
push_back
(
1
);
p
.
push_back
(
2
);
gmshModelAddPhysicalGroup
(
0
,
1
,
p
);
gmshModelAddPhysicalGroup
(
1
,
2
,
p
);
p
.
clear
();
p
.
push_back
(
1
);
gmshModelAddPhysicalGroup
(
2
,
6
,
p
);
gmshModelSetPhysicalName
(
2
,
6
,
"My surface"
);
gmshModelGeoSynchronize
();
gmshModelMesh
(
2
);
gmshExport
(
"t1.msh"
);
gmshFinalize
();
return
0
;
}
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