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
a9db9bda
Commit
a9db9bda
authored
15 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
make MElement and MVertex thread-safe by guarding _globalNum
parent
242fb5aa
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
Geo/MElement.cpp
+15
-0
15 additions, 0 deletions
Geo/MElement.cpp
Geo/MElement.h
+1
-11
1 addition, 11 deletions
Geo/MElement.h
Geo/MVertex.cpp
+25
-0
25 additions, 0 deletions
Geo/MVertex.cpp
Geo/MVertex.h
+2
-17
2 additions, 17 deletions
Geo/MVertex.h
with
43 additions
and
28 deletions
Geo/MElement.cpp
+
15
−
0
View file @
a9db9bda
...
...
@@ -29,6 +29,21 @@ int MElement::_globalNum = 0;
double
MElement
::
_isInsideTolerance
=
1.e-6
;
double
MElementLessThanLexicographic
::
tolerance
=
1.e-6
;
MElement
::
MElement
(
int
num
,
int
part
)
:
_visible
(
1
)
{
#pragma omp critical
{
if
(
num
){
_num
=
num
;
_globalNum
=
std
::
max
(
_globalNum
,
_num
);
}
else
{
_num
=
++
_globalNum
;
}
_partition
=
(
short
)
part
;
}
}
void
MElement
::
_getEdgeRep
(
MVertex
*
v0
,
MVertex
*
v1
,
double
*
x
,
double
*
y
,
double
*
z
,
SVector3
*
n
,
int
faceIndex
)
...
...
This diff is collapsed.
Click to expand it.
Geo/MElement.h
+
1
−
11
View file @
a9db9bda
...
...
@@ -42,17 +42,7 @@ class MElement
void
_getFaceRep
(
MVertex
*
v0
,
MVertex
*
v1
,
MVertex
*
v2
,
double
*
x
,
double
*
y
,
double
*
z
,
SVector3
*
n
);
public
:
MElement
(
int
num
=
0
,
int
part
=
0
)
:
_visible
(
1
)
{
if
(
num
){
_num
=
num
;
_globalNum
=
std
::
max
(
_globalNum
,
_num
);
}
else
{
_num
=
++
_globalNum
;
}
_partition
=
(
short
)
part
;
}
MElement
(
int
num
=
0
,
int
part
=
0
);
virtual
~
MElement
(){}
// reset the global node number
...
...
This diff is collapsed.
Click to expand it.
Geo/MVertex.cpp
+
25
−
0
View file @
a9db9bda
...
...
@@ -26,6 +26,31 @@ bool MVertexLessThanLexicographic::operator()(const MVertex *v1, const MVertex *
return
false
;
}
MVertex
::
MVertex
(
double
x
,
double
y
,
double
z
,
GEntity
*
ge
,
int
num
)
:
_visible
(
1
),
_order
(
1
),
_x
(
x
),
_y
(
y
),
_z
(
z
),
_ge
(
ge
)
{
#pragma omp critical
{
if
(
num
){
_num
=
num
;
_globalNum
=
std
::
max
(
_globalNum
,
_num
);
}
else
{
_num
=
++
_globalNum
;
}
_index
=
num
;
}
}
void
MVertex
::
setNum
(
int
num
)
{
#pragma omp critical
{
_num
=
num
;
_globalNum
=
std
::
max
(
_globalNum
,
_num
);
}
}
void
MVertex
::
writeMSH
(
FILE
*
fp
,
bool
binary
,
bool
saveParametric
,
double
scalingFactor
)
{
if
(
_index
<
0
)
return
;
// negative index vertices are never saved
...
...
This diff is collapsed.
Click to expand it.
Geo/MVertex.h
+
2
−
17
View file @
a9db9bda
...
...
@@ -43,18 +43,7 @@ class MVertex{
GEntity
*
_ge
;
public
:
MVertex
(
double
x
,
double
y
,
double
z
,
GEntity
*
ge
=
0
,
int
num
=
0
)
:
_visible
(
1
),
_order
(
1
),
_x
(
x
),
_y
(
y
),
_z
(
z
),
_ge
(
ge
)
{
if
(
num
){
_num
=
num
;
_globalNum
=
std
::
max
(
_globalNum
,
_num
);
}
else
{
_num
=
++
_globalNum
;
}
_index
=
num
;
}
MVertex
(
double
x
,
double
y
,
double
z
,
GEntity
*
ge
=
0
,
int
num
=
0
);
virtual
~
MVertex
(){}
// get/reset the global node number
...
...
@@ -84,11 +73,7 @@ class MVertex{
// get/set the number
inline
int
getNum
()
const
{
return
_num
;
}
inline
void
setNum
(
int
num
)
{
_num
=
num
;
_globalNum
=
std
::
max
(
_globalNum
,
_num
);
}
void
setNum
(
int
num
);
// get/set the index
inline
int
getIndex
()
const
{
return
_index
;
}
...
...
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