3from .GridSelector
import GridSelector
9 Select the mesh entities of one level of the spacetree
11 The root of the spacetree, i.e. the bounding box of the whole domain,
12 is level 0. Each further level splits the cells of its parent into
13 three along each axis, i.e. a cell on level l has the size
14 domain_size/3^l. The guards select exactly the vertices, faces and
15 cells of this size, no matter whether they are refined further or not.
16 If the mesh is coarser than the level somewhere, the guards do not
19 The markers do not know their level, so the guards compare the mesh
20 size h() of the vertex, face or cell with the size of a cell on the
21 selected level. Different to FineGridSelector, the selection does not
22 depend on the refinement state, i.e. it is the same in each and every
31 Level of the spacetree, with 0 being the root.
33 domain_size: list of float
34 Size of the computational domain along each axis, i.e. the same
35 value as handed over to the project's global simulation
39 assert level >= 0,
"level has to be non-negative"
41 self.
_mesh_size = [size / 3**level
for size
in domain_size]
46 Compare each entry of marker.h() with the size of a cell on the
47 selected level. The tolerance is relative to this size, as the
48 sizes become tiny on fine levels.
52 f
"tarch::la::equals(marker.h()({axis}), {size!r}, {size * 1e-6!r})"