Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
pugs
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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
code
pugs
Commits
99ecd94b
Commit
99ecd94b
authored
7 years ago
by
Stéphane Del Pino
Browse files
Options
Downloads
Patches
Plain Diff
Slight connectivity performances improvement by unordered_map
parent
9e0f0343
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/mesh/Connectivity3D.hpp
+15
-2
15 additions, 2 deletions
src/mesh/Connectivity3D.hpp
with
15 additions
and
2 deletions
src/mesh/Connectivity3D.hpp
+
15
−
2
View file @
99ecd94b
...
@@ -8,6 +8,7 @@
...
@@ -8,6 +8,7 @@
#include
<ConnectivityUtils.hpp>
#include
<ConnectivityUtils.hpp>
#include
<vector>
#include
<vector>
#include
<map>
#include
<map>
#include
<unordered_map>
#include
<algorithm>
#include
<algorithm>
#include
<RefId.hpp>
#include
<RefId.hpp>
...
@@ -59,6 +60,18 @@ private:
...
@@ -59,6 +60,18 @@ private:
class
Face
class
Face
{
{
public:
friend
struct
Hash
;
struct
Hash
{
size_t
operator
()(
const
Face
&
f
)
const
{
size_t
hash
=
0
;
for
(
size_t
i
=
0
;
i
<
f
.
m_node_id_list
.
size
();
++
i
)
{
hash
^=
std
::
hash
<
unsigned
int
>
()(
f
.
m_node_id_list
[
i
])
>>
i
;
}
return
hash
;
}
};
private
:
private
:
bool
m_reversed
;
bool
m_reversed
;
std
::
vector
<
unsigned
int
>
m_node_id_list
;
std
::
vector
<
unsigned
int
>
m_node_id_list
;
...
@@ -156,7 +169,7 @@ private:
...
@@ -156,7 +169,7 @@ private:
~
Face
()
=
default
;
~
Face
()
=
default
;
};
};
std
::
map
<
Face
,
unsigned
int
>
m_face_number_map
;
std
::
unordered_
map
<
Face
,
unsigned
int
,
Face
::
Hash
>
m_face_number_map
;
void
_computeFaceCellConnectivities
()
void
_computeFaceCellConnectivities
()
{
{
...
@@ -346,7 +359,7 @@ private:
...
@@ -346,7 +359,7 @@ private:
}
}
m_face_cell_local_face
=
face_cell_local_face
;
m_face_cell_local_face
=
face_cell_local_face
;
std
::
map
<
unsigned
int
,
std
::
vector
<
unsigned
int
>>
node_faces_map
;
std
::
unordered_
map
<
unsigned
int
,
std
::
vector
<
unsigned
int
>>
node_faces_map
;
for
(
size_t
l
=
0
;
l
<
m_number_of_faces
;
++
l
)
{
for
(
size_t
l
=
0
;
l
<
m_number_of_faces
;
++
l
)
{
for
(
size_t
lr
=
0
;
lr
<
face_nb_nodes
(
l
);
++
lr
)
{
for
(
size_t
lr
=
0
;
lr
<
face_nb_nodes
(
l
);
++
lr
)
{
const
unsigned
int
r
=
face_nodes
(
l
,
lr
);
const
unsigned
int
r
=
face_nodes
(
l
,
lr
);
...
...
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