Code: Select all

```
cell 1 0 mat1 (1:-2 :3:-4) -5
```

outside surface 1

OR

inside surface 2

OR

outside surface 3

OR

inside surface 4

AND (provided that at least one of the above is true)

inside surface 5

Internally the geometry routine is based on a Reverse Polish notation -like algorithm that should be able to handle an arbitrary number of parentheses, but I've only tested it with relatively simple configurations, so be prepared for anything when dealing with complicated cell definitions.

A few notes:

- Reflected and periodic boundary conditions still require the outermost surface to be of specific type, such as a square or hexagonal cylinder.

- If the geometry can be defined without unions, it will probably run faster, even if the cell definitions require more complicated surfaces.

The note on performance is based on the fact that the routine tests every cell in the list when unions are used. If the list contains only intersections (logical AND), the test loop is terminated at the first failure (untrue), and the list is kept sorted according to previous failures.