File: test_indexset.py

package info (click to toggle)
dune-grid 2.11.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 8,472 kB
  • sloc: cpp: 60,883; python: 1,438; perl: 191; makefile: 12; sh: 3
file content (20 lines) | stat: -rw-r--r-- 912 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file LICENSE.md in module root
# SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception

from dune.grid import structuredGrid

def test_subIndices(gridView):
    indexSet = gridView.indexSet
    for intersection in gridView.boundaryIntersections:
        entity      = intersection.inside
        subentity   = (intersection.indexInInside, 1)
        indices_global      = indexSet.subIndices(entity, subentity, 2)
        indices_reference   = entity.referenceElement.subEntities(subentity, 2)
        indices_lookup      = indexSet.subIndices(entity, 2)
        assert len(indices_global) == len(indices_reference)
        for i, j in zip(indices_global, indices_reference):
            assert i == indices_lookup[j]

if __name__ == "__main__":
    gridView = structuredGrid([0,0],[1,1],[10,10])
    test_subIndices(gridView)