diff --git a/meshmode/mesh/__init__.py b/meshmode/mesh/__init__.py index e78f54fbfb1549e4e1dd67cf3b644e6abf64973f..32efe9b9e43da5f6d4d995119609f8d9db38403a 100644 --- a/meshmode/mesh/__init__.py +++ b/meshmode/mesh/__init__.py @@ -382,22 +382,22 @@ class NodalAdjacency(Record): # }}} -# {{{ partition adjacency - +# {{{ partition adjacency + class InterPartitionAdj(): """ Interface is not final. """ - + def __init__(self): self.adjacent = dict() - + def add_connection(self, elem, face, neighbor_elem, neighbor_face): self.adjacent[(elem, face)] = (neighbor_elem, neighbor_face) def get_neighbor(self, elem, face): return self.adjacent[(elem, face)] - + # }}} @@ -556,7 +556,7 @@ class Mesh(Record): will result in exceptions. Lastly, a data structure as described in :attr:`facial_adjacency_groups` may be passed. """ - + el_nr = 0 node_nr = 0 diff --git a/meshmode/mesh/processing.py b/meshmode/mesh/processing.py index 43b656ad2ae747a910d2da859b22787d3f1e8f42..b1fc9e2537f294abfb38dc2b19a739cb64ed6fc7 100644 --- a/meshmode/mesh/processing.py +++ b/meshmode/mesh/processing.py @@ -177,12 +177,12 @@ def partition_mesh(mesh, part_per_element, part_nr): rank_neighbor = (parent_facial_group.neighbors[idx] + parent_grp_elem_base) rank_neighbor_face = parent_facial_group.neighbor_faces[idx] - + n_part_nr = part_per_element[rank_neighbor] tags = tags & ~part_mesh.boundary_tag_bit(BTAG_ALL) tags = tags | part_mesh.boundary_tag_bit(n_part_nr) boundary_adj.neighbors[elem_idx] = -tags - + # Find the neighbor element from the other partition n_elem = np.count_nonzero( part_per_element[:rank_neighbor] == n_part_nr) diff --git a/test/test_meshmode.py b/test/test_meshmode.py index e51856d71236a62c6be32379f36a55778b49bec4..44ca2d0802dd2257978d6c2e266f559fde6ec861 100644 --- a/test/test_meshmode.py +++ b/test/test_meshmode.py @@ -101,19 +101,19 @@ def test_partition_boxes_mesh(): assert count_btag_all(mesh) == np.sum( [count_btag_all(new_meshes[i]) for i in range(num_parts)]), \ "part_mesh has the wrong number of BTAG_ALL boundaries" - + for part_nr in range(num_parts): for f_groups in new_meshes[part_nr].facial_adjacency_groups: f_grp = f_groups[None] for idx in range(len(f_grp.elements)): - # Are all f_grp.neighbors guaranteed to be negative + # Are all f_grp.neighbors guaranteed to be negative # since I'm taking the boundary facial group? tag = -f_grp.neighbors[idx] elem = f_grp.elements[idx] face = f_grp.element_faces[idx] for n_part_nr in range(num_parts): if tag >= 0 and \ - tag & new_meshes[part_nr].boundary_tag_bit(n_part_nr) != 0: + tag & new_meshes[part_nr].boundary_tag_bit(n_part_nr) != 0: # Is this the best way to probe the tag? # Can one tag have multiple partition neighbors? (n_elem, n_face) = new_meshes[part_nr].\ @@ -121,7 +121,7 @@ def test_partition_boxes_mesh(): assert (elem, face) == new_meshes[n_part_nr].\ interpartition_adj.get_neighbor(n_elem, n_face),\ "InterpartitionAdj is not consistent" - + def count_btag_all(mesh): num_bnds = 0 @@ -131,7 +131,7 @@ def count_btag_all(mesh): if neighbors < 0: if -neighbors & mesh.boundary_tag_bit(BTAG_ALL) != 0: num_bnds += 1 - return num_bnds + return num_bnds # }}}