Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
meshmode
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Xiaoyu Wei
meshmode
Commits
058fd557
Commit
058fd557
authored
8 years ago
by
Ellis Hoag
Browse files
Options
Downloads
Patches
Plain Diff
possible optimizations for required_indices
parent
39643d25
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
meshmode/mesh/processing.py
+10
-5
10 additions, 5 deletions
meshmode/mesh/processing.py
with
10 additions
and
5 deletions
meshmode/mesh/processing.py
+
10
−
5
View file @
058fd557
...
...
@@ -70,7 +70,11 @@ def partition_mesh(mesh, part_per_element, part_nr):
new_nodes
=
[]
# The set of vertex indices we need.
index_set
=
set
()
# NOTE: There are two methods for producing required_indices.
# Optimizations may come from further exploring these options.
#index_set = np.array([], dtype=int)
index_sets
=
np
.
array
([],
dtype
=
set
)
skip_groups
=
[]
num_prev_elems
=
0
start_idx
=
0
...
...
@@ -103,13 +107,15 @@ def partition_mesh(mesh, part_per_element, part_nr):
new_idx
=
j
-
start_idx
new_nodes
[
group_nr
][
i
,
new_idx
,
:]
=
mesh_group
.
nodes
[
i
,
elems
,
:]
index_set
|=
set
(
new_indices
[
group_nr
].
ravel
())
#index_set = np.append(index_set, new_indices[group_nr].ravel())
index_sets
=
np
.
append
(
index_sets
,
set
(
new_indices
[
group_nr
].
ravel
()))
num_prev_elems
+=
mesh_group
.
nelements
start_idx
=
end_idx
# A sorted np.array of vertex indices we need (without duplicates).
required_indices
=
np
.
array
(
list
(
index_set
))
#required_indices = np.unique(np.sort(index_set))
required_indices
=
np
.
array
(
list
(
set
.
union
(
*
index_sets
)))
new_vertices
=
np
.
zeros
((
mesh
.
ambient_dim
,
len
(
required_indices
)))
for
dim
in
range
(
mesh
.
ambient_dim
):
...
...
@@ -124,8 +130,6 @@ def partition_mesh(mesh, part_per_element, part_nr):
new_indices
[
group_nr
][
i
,
j
]
=
np
.
where
(
required_indices
==
original_index
)[
0
]
from
meshmode.mesh
import
SimplexElementGroup
,
Mesh
new_mesh_groups
=
[]
for
group_nr
in
range
(
num_groups
):
if
group_nr
not
in
skip_groups
:
...
...
@@ -134,6 +138,7 @@ def partition_mesh(mesh, part_per_element, part_nr):
type
(
mesh_group
)(
mesh_group
.
order
,
new_indices
[
group_nr
],
new_nodes
[
group_nr
],
unit_nodes
=
mesh_group
.
unit_nodes
))
from
meshmode.mesh
import
Mesh
part_mesh
=
Mesh
(
new_vertices
,
new_mesh_groups
)
return
(
part_mesh
,
queried_elems
)
...
...
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