morphogen.models.implicit¶
Implicit functions of the phases of the microstructures: helpers.
Every realization describes each of its phases by an implicit function
(phase_level_set()): negative inside the
phase, positive outside and zero on its boundary, so that its interfaces are those of the
model itself, at any resolution, and not those of a voxel image: conforming meshes
(morphogen.mesh.conforming.conforming_mesh()), surfaces and sections are cut from
them. The functions are exact where it matters, on the interfaces and around them: signed
distances to unions of spheres and segments, distances to the faces of cells, minima and
maxima of the functions of the components of a combination (the union, intersection and
difference of sets); away from the interfaces they are clipped to a band or only keep
their sign.
One interface gives these functions on grids and at any point:
implicit_phases(): the phases;phase_level_set(): the function of a phase at the centres of the voxels of a grid, clipped to a band of four voxels;phase_level_sets_at(): the functions of all the phases at any points,{k: phi_k}, exact within areachof the interfaces (the same values at the centres of the voxels): those that the exact meshes cut and that the curved elements follow; NotImplementedError for the structures whose functions are those of grids only (point_functions());level_setandlevel_set_at: the function of phase 1, on a grid and at points;implicit_at(phase, points, band): one phase ofphase_level_sets_at, clipped (None without point-wise functions);lipschitz: a bound of the slopes of the point-wise functions;implicit_pieces(): the smooth pieces of the phases of the structures whose functions have folds (morphogen.models.pieces).
The helpers of this module evaluate on the points of a regular grid (the centres of the
voxels of a Grid, which may extend beyond the box of a periodic
microstructure: the nodes of a background mesh) the functions of objects that cover one
another in an order: the leaves of a dead-leaves model, the osteons of a cross-section.
- morphogen.models.implicit.implicit_phases_of(micro) list[int][source]¶
The phases of a structure (
implicit_phases(); 0 and 1 for an object that has a level set only).
- morphogen.models.implicit.functions_at(micro, points, reach: float) dict[int, ndarray][source]¶
The functions of all the phases of a structure at points (
phase_level_sets_at();{1: phi, 0: -phi}for an object with alevel_set_atonly, such as a level set written as a function of the points).
- morphogen.models.implicit.point_functions(micro) bool[source]¶
Whether a structure gives the functions of its phases at any point (
functions_at()), not only at the points of grids.
- morphogen.models.implicit.BAND = 4.0¶
Voxels of the band around the interfaces to which the functions are clipped
- morphogen.models.implicit.band_of(grid: Grid) float[source]¶
The band of a grid:
BANDtimes its largest spacing, along the axes that it samples with more than one voxel (a slab one voxel thick, the plane of a section, has the band of the volume it is cut from).
- morphogen.models.implicit.grid_key(grid: Grid) tuple[source]¶
A key of the points of a grid (for the caches of the functions of all the phases, computed together).
- morphogen.models.implicit.implicit_functions(micro, shape=None, *, voxel_size=None, grid=None) list[tuple[str, object]][source]¶
The implicit functions that describe a microstructure, on the voxel centres of a grid (as
level_set()), with the suffix of their files: its level set alone (suffix"") for two phases; for several, the function of each phase ("_phase<k>"), in the order of the phases.
- morphogen.models.implicit.lattice_boxes(centre, reach: float, grid: Grid, lengths=None, axes=(0, 1, 2))[source]¶
The points of a grid within
reachofcentrealong each ofaxes(a box around it), for the centre and, with thelengthsof a periodic box, for each of its periodic images that comes that close to the grid: yields the slices of the points along the axes and their coordinates from the image of the centre (one array per axis, to broadcast).
- morphogen.models.implicit.ordered_cover(shape, band: float, objects, n_parts: int)[source]¶
The implicit functions of the visible parts of objects that cover one another, the first on top.
objectsyields, in that order and for each object and each box of points near it (lattice_boxes()),(slices, cover, parts): the implicit functioncoverof the object at these points (negative inside it) and, for each of the parts of the objects (its phases, or the rings of an osteon), its function there, or None where the object has no such part. The visible part of an object is what lies in it and in none of those on top: the maximum of its function and of minus the smallest function of those on top. Returns the functions of then_partsparts (the minimum over the objects) and the smallest function of all the objects (positive where nothing covers), clipped toband.