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
231d8b54
Commit
231d8b54
authored
7 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
pp
parent
f94a96f0
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
Common/gmsh.cpp
+22
-23
22 additions, 23 deletions
Common/gmsh.cpp
with
22 additions
and
23 deletions
Common/gmsh.cpp
+
22
−
23
View file @
231d8b54
...
...
@@ -34,14 +34,13 @@
#include
"Field.h"
#endif
// -1 : not initialized
// 0 : success
// 1 : generic error
// 2 : bad input arguments
#define GMSH_API std::vector<int>
#define GMSH_OK std::vector<int>(1, 0)
#define GMSH_ERROR(n) std::vector<int>(1, n)
// Error codes: -1 : not initialized
// 0 : success
// 1 : generic error
// 2 : bad input arguments
static
int
_initialized
=
0
;
...
...
@@ -503,8 +502,8 @@ GMSH_API gmshModelSetMeshVertices(const int dim, const int tag,
const
std
::
vector
<
double
>
&
parametricCoordinates
)
{
if
(
!
_isInitialized
())
return
GMSH_ERROR
(
-
1
);
GEntity
*
e
=
GModel
::
current
()
->
getEntityByTag
(
dim
,
tag
);
if
(
!
e
){
GEntity
*
g
e
=
GModel
::
current
()
->
getEntityByTag
(
dim
,
tag
);
if
(
!
g
e
){
Msg
::
Error
(
"%s does not exist"
,
_entityName
(
dim
,
tag
).
c_str
());
return
GMSH_ERROR
(
2
);
}
...
...
@@ -521,10 +520,10 @@ GMSH_API gmshModelSetMeshVertices(const int dim, const int tag,
param
=
true
;
}
GModel
::
current
()
->
destroyMeshCaches
();
if
(
e
->
mesh_vertices
.
size
())
if
(
g
e
->
mesh_vertices
.
size
())
Msg
::
Warning
(
"%s already contains mesh vertices"
,
_entityName
(
dim
,
tag
).
c_str
());
e
->
mesh_vertices
.
clear
();
g
e
->
mesh_vertices
.
clear
();
for
(
unsigned
int
i
=
0
;
i
<
vertexTags
.
size
();
i
++
){
int
n
=
vertexTags
[
i
];
double
x
=
coordinates
[
3
*
i
];
...
...
@@ -533,16 +532,16 @@ GMSH_API gmshModelSetMeshVertices(const int dim, const int tag,
MVertex
*
vv
=
0
;
if
(
param
&&
dim
==
1
){
double
u
=
parametricCoordinates
[
i
];
vv
=
new
MEdgeVertex
(
x
,
y
,
z
,
e
,
u
,
n
);
vv
=
new
MEdgeVertex
(
x
,
y
,
z
,
g
e
,
u
,
n
);
}
else
if
(
param
&&
dim
==
2
){
double
u
=
parametricCoordinates
[
i
];
double
v
=
parametricCoordinates
[
i
+
1
];
vv
=
new
MFaceVertex
(
x
,
y
,
z
,
e
,
u
,
v
,
n
);
vv
=
new
MFaceVertex
(
x
,
y
,
z
,
g
e
,
u
,
v
,
n
);
}
else
vv
=
new
MVertex
(
x
,
y
,
z
,
e
,
n
);
e
->
mesh_vertices
.
push_back
(
vv
);
vv
=
new
MVertex
(
x
,
y
,
z
,
g
e
,
n
);
g
e
->
mesh_vertices
.
push_back
(
vv
);
}
return
GMSH_OK
;
}
...
...
@@ -565,8 +564,8 @@ GMSH_API gmshModelSetMeshElements(const int dim, const int tag,
const
std
::
vector
<
std
::
vector
<
int
>
>
&
vertexTags
)
{
if
(
!
_isInitialized
())
return
GMSH_ERROR
(
-
1
);
GEntity
*
e
=
GModel
::
current
()
->
getEntityByTag
(
dim
,
tag
);
if
(
!
e
){
GEntity
*
g
e
=
GModel
::
current
()
->
getEntityByTag
(
dim
,
tag
);
if
(
!
g
e
){
Msg
::
Error
(
"%s does not exist"
,
_entityName
(
dim
,
tag
).
c_str
());
return
GMSH_ERROR
(
2
);
}
...
...
@@ -607,33 +606,33 @@ GMSH_API gmshModelSetMeshElements(const int dim, const int tag,
switch
(
dim
){
case
0
:
if
(
elements
[
0
]
->
getType
()
==
TYPE_PNT
)
_addElements
(
dim
,
tag
,
elements
,
static_cast
<
GVertex
*>
(
e
)
->
points
);
_addElements
(
dim
,
tag
,
elements
,
static_cast
<
GVertex
*>
(
g
e
)
->
points
);
else
ok
=
false
;
break
;
case
1
:
if
(
elements
[
0
]
->
getType
()
==
TYPE_LIN
)
_addElements
(
dim
,
tag
,
elements
,
static_cast
<
GEdge
*>
(
e
)
->
lines
);
_addElements
(
dim
,
tag
,
elements
,
static_cast
<
GEdge
*>
(
g
e
)
->
lines
);
else
ok
=
false
;
break
;
case
2
:
if
(
elements
[
0
]
->
getType
()
==
TYPE_TRI
)
_addElements
(
dim
,
tag
,
elements
,
static_cast
<
GFace
*>
(
e
)
->
triangles
);
_addElements
(
dim
,
tag
,
elements
,
static_cast
<
GFace
*>
(
g
e
)
->
triangles
);
else
if
(
elements
[
0
]
->
getType
()
==
TYPE_QUA
)
_addElements
(
dim
,
tag
,
elements
,
static_cast
<
GFace
*>
(
e
)
->
quadrangles
);
_addElements
(
dim
,
tag
,
elements
,
static_cast
<
GFace
*>
(
g
e
)
->
quadrangles
);
else
ok
=
false
;
break
;
case
3
:
if
(
elements
[
0
]
->
getType
()
==
TYPE_TET
)
_addElements
(
dim
,
tag
,
elements
,
static_cast
<
GRegion
*>
(
e
)
->
tetrahedra
);
_addElements
(
dim
,
tag
,
elements
,
static_cast
<
GRegion
*>
(
g
e
)
->
tetrahedra
);
else
if
(
elements
[
0
]
->
getType
()
==
TYPE_HEX
)
_addElements
(
dim
,
tag
,
elements
,
static_cast
<
GRegion
*>
(
e
)
->
hexahedra
);
_addElements
(
dim
,
tag
,
elements
,
static_cast
<
GRegion
*>
(
g
e
)
->
hexahedra
);
else
if
(
elements
[
0
]
->
getType
()
==
TYPE_PRI
)
_addElements
(
dim
,
tag
,
elements
,
static_cast
<
GRegion
*>
(
e
)
->
prisms
);
_addElements
(
dim
,
tag
,
elements
,
static_cast
<
GRegion
*>
(
g
e
)
->
prisms
);
else
if
(
elements
[
0
]
->
getType
()
==
TYPE_PYR
)
_addElements
(
dim
,
tag
,
elements
,
static_cast
<
GRegion
*>
(
e
)
->
pyramids
);
_addElements
(
dim
,
tag
,
elements
,
static_cast
<
GRegion
*>
(
g
e
)
->
pyramids
);
else
ok
=
false
;
break
;
...
...
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