|
13 | 13 | Vector, AFFINE, REGULAR, IRREGULAR, mocksym0, |
14 | 14 | mocksym1) |
15 | 15 | from devito.ir.support.space import (NullInterval, Interval, Forward, Backward, |
16 | | - IterationSpace) |
| 16 | + IntervalGroup, IterationSpace) |
17 | 17 | from devito.ir.support.guards import GuardOverflow |
18 | 18 | from devito.symbolics import DefFunction, FieldFromPointer |
19 | 19 | from devito.tools import prod |
@@ -508,6 +508,24 @@ def test_intervals_switch(self, x, y): |
508 | 508 | assert iy.switch(x) == ix |
509 | 509 | assert ix.switch(y).switch(x) == ix |
510 | 510 |
|
| 511 | + def test_space_intersection(self, x, y): |
| 512 | + ig0 = IntervalGroup([Interval(x, 1, -1)]) |
| 513 | + ig1 = IntervalGroup([Interval(x, 2, -2), Interval(y, 3, -3)]) |
| 514 | + |
| 515 | + ig = IntervalGroup.generate('intersection', ig0, ig1) |
| 516 | + |
| 517 | + assert len(ig) == 1 |
| 518 | + assert ig[0] == Interval(x, 2, -2) |
| 519 | + |
| 520 | + # Now the same but with IterationSpaces |
| 521 | + ispace0 = IterationSpace(ig0) |
| 522 | + ispace1 = IterationSpace(ig1) |
| 523 | + |
| 524 | + ispace = IterationSpace.intersection(ispace0, ispace1) |
| 525 | + |
| 526 | + assert len(ispace) == 1 |
| 527 | + assert ispace.intervals == ig |
| 528 | + |
511 | 529 |
|
512 | 530 | class TestDependenceAnalysis: |
513 | 531 |
|
|
0 commit comments