{
  "title": "LayerRefinementSpec",
  "public_path": "flex_rf.tidy3d.LayerRefinementSpec",
  "lookup_path": "tidy3d.rf.LayerRefinementSpec",
  "slug": "flex_rf/tidy3d/LayerRefinementSpec",
  "public_url": "/rf/latest/autogenerated/flex_rf/tidy3d/layerrefinementspec/",
  "object_kind": "class",
  "introduction": "Specification for automatic mesh refinement and snapping in layered structures. Structure corners\non the cross section perpendicular to layer thickness direction can be automatically identified. Subsequently,\nmesh is snapped and refined around the corners. Mesh can also be refined and snapped around the bounds along\nthe layer thickness direction.",
  "notes": "Corner detection is performed on a 2D plane sitting in the middle of the layer. If the layer is finite\nalong inplane axes, corners outside the bounds are discarded.\n\nThis class only takes effect when `AutoGrid` is applied.",
  "examples": "```python\nlayer_spec = LayerRefinementSpec(axis=2, center=(0,0,0), size=(2, 3, 1))\n```",
  "references": "",
  "signature": "class LayerRefinementSpec(Box)",
  "source": {
    "path": "flex/public/tidy3d/tidy3d/components/grid/grid_spec.py",
    "url": "",
    "lineno": 1227,
    "endlineno": 2553
  },
  "bases": [
    "Box"
  ],
  "parameter_rows": [
    {
      "name": "axis",
      "annotation": "Axis",
      "default": "",
      "description": "Specifies dimension of the layer normal axis (0,1,2) -> (x,y,z).",
      "origin": "declared"
    },
    {
      "name": "min_steps_along_axis",
      "annotation": "PositiveFloat | None",
      "default": "None",
      "description": "If not `None` and the thickness of the layer is nonzero, set minimal number of steps discretizing the layer thickness.",
      "origin": "declared"
    },
    {
      "name": "bounds_refinement",
      "annotation": "GridRefinement | None",
      "default": "None",
      "description": "If not `None`, refine mesh around minimum and maximum positions of the layer along normal axis dimension. If `min_steps_along_axis` is also specified, refinement here is only applied if it sets a smaller grid size.",
      "origin": "declared"
    },
    {
      "name": "bounds_snapping",
      "annotation": "Literal['bounds', 'lower', 'upper', 'center'] | None",
      "default": "'lower'",
      "description": "If not `None`, enforcing grid boundaries to pass through `lower`, `center`, or `upper` position of the layer; or both `lower` and `upper` with `bounds`.",
      "origin": "declared"
    },
    {
      "name": "corner_finder",
      "annotation": "CornerFinderSpec | None",
      "default": "factory: CornerFinderSpec",
      "description": "Specification for inplane corner detection. Inplane mesh refinement is based on the coordinates of those corners.",
      "origin": "declared"
    },
    {
      "name": "corner_snapping",
      "annotation": "bool",
      "default": "True",
      "description": "If `True` and `corner_finder` is not `None`, enforcing inplane grid boundaries to pass through corners of geometries specified by `corner_finder`.",
      "origin": "declared"
    },
    {
      "name": "corner_refinement",
      "annotation": "GridRefinement | None",
      "default": "factory: GridRefinement",
      "description": "If not `None` and `corner_finder` is not `None`, refine mesh around corners of geometries specified by `corner_finder`.",
      "origin": "declared"
    },
    {
      "name": "refinement_inside_sim_only",
      "annotation": "bool",
      "default": "True",
      "description": "If `True`, only apply mesh refinement to features such as corners inside the simulation domain; If `False`, features outside the domain can take effect along the dimensions where the projection of the feature and the projection of the simulation domain overlaps.",
      "origin": "declared"
    },
    {
      "name": "gap_meshing_iters",
      "annotation": "NonNegativeInt",
      "default": "1",
      "description": "Number of recursive iterations for resolving thin gaps. The underlying algorithm detects gaps contained in a single cell and places a snapping plane at the gaps's centers.",
      "origin": "declared"
    },
    {
      "name": "dl_min_from_gap_width",
      "annotation": "bool",
      "default": "True",
      "description": "Take into account autodetected minimal PEC gap width when determining `dl_min`. This only applies if `dl_min` in `AutoGrid` specification is not set.",
      "origin": "declared"
    },
    {
      "name": "interior_disjoint_geometries",
      "annotation": "bool",
      "default": "True",
      "description": "If `True`, geometries made of different materials on the plane must not be overlapping. This can speed up the performance of corner finder when there are many structures crossing the plane.",
      "origin": "declared"
    },
    {
      "name": "attrs",
      "annotation": "dict",
      "default": "factory: dict",
      "description": "Dictionary storing arbitrary metadata for a Tidy3D object. This dictionary can be freely used by the user for storing data without affecting the operation of Tidy3D as it is not used internally. Note that, unlike regular Tidy3D fields, `attrs` are mutable. For example, the following is allowed for setting an `attr` `obj.attrs['foo'] = bar`. Also note that Tidy3D will raise a `TypeError` if `attrs` contain objects that can not be serialized. One can check if `attrs` are serializable by calling `obj.model_dump_json()`.",
      "origin": "inherited"
    },
    {
      "name": "center",
      "annotation": "TracedCoordinate",
      "default": "(0.0, 0.0, 0.0)",
      "description": "Center of object in x, y, and z.",
      "origin": "inherited"
    },
    {
      "name": "size",
      "annotation": "TracedSize",
      "default": "",
      "description": "Size in x, y, and z directions.",
      "origin": "inherited"
    }
  ],
  "members": [
    {
      "name": "center_axis",
      "kind": "function",
      "signature": "center_axis()",
      "description": "Gets the position of the center of the layer along the layer dimension."
    },
    {
      "name": "from_bounds",
      "kind": "function",
      "signature": "from_bounds(rmin: Coordinate, rmax: Coordinate, axis: Axis = None, min_steps_along_axis: PositiveFloat = None, bounds_refinement: GridRefinement = None, bounds_snapping: Literal['bounds', 'lower', 'upper', 'center'] = 'lower', corner_finder: CornerFinderSpec = Undefined, corner_snapping: bool = True, corner_refinement: GridRefinement = Undefined, refinement_inside_sim_only: bool = True, gap_meshing_iters: NonNegativeInt = 1, dl_min_from_gap_width: bool = True, **kwargs: Any)",
      "description": "Constructs a `LayerRefinementSpec` from minimum and maximum coordinate bounds."
    },
    {
      "name": "from_layer_bounds",
      "kind": "function",
      "signature": "from_layer_bounds(axis: Axis, bounds: tuple[float, float], min_steps_along_axis: PositiveFloat = None, bounds_refinement: GridRefinement = None, bounds_snapping: Literal['bounds', 'lower', 'upper', 'center'] = 'lower', corner_finder: CornerFinderSpec | None | object = Undefined, corner_snapping: bool = True, corner_refinement: GridRefinement | None | object = Undefined, refinement_inside_sim_only: bool = True, gap_meshing_iters: NonNegativeInt = 1, dl_min_from_gap_width: bool = True, **kwargs: Any)",
      "description": "Constructs a `LayerRefinementSpec` that is unbounded in inplane dimensions from bounds along layer thickness dimension."
    },
    {
      "name": "from_structures",
      "kind": "function",
      "signature": "from_structures(structures: list[Structure], axis: Axis = None, min_steps_along_axis: PositiveFloat = None, bounds_refinement: GridRefinement = None, bounds_snapping: Literal['bounds', 'lower', 'upper', 'center'] = 'lower', corner_finder: CornerFinderSpec = Undefined, corner_snapping: bool = True, corner_refinement: GridRefinement = Undefined, refinement_inside_sim_only: bool = True, gap_meshing_iters: NonNegativeInt = 1, dl_min_from_gap_width: bool = True, **kwargs: Any)",
      "description": "Constructs a `LayerRefinementSpec` from the bounding box of a list of structures."
    },
    {
      "name": "generate_override_structures",
      "kind": "function",
      "signature": "generate_override_structures(grid_size_in_vacuum: float, structure_list: list[Structure], sim_bounds: tuple, boundary_type: tuple, cached_corners_and_convexity: CornersAndConvexity | None = None, cached_merged_geos: list[tuple[Any, Shapely]] | None = None)",
      "description": "Generate mesh override structures for mesh refinement."
    },
    {
      "name": "generate_snapping_points",
      "kind": "function",
      "signature": "generate_snapping_points(structure_list: list[Structure], sim_bounds: tuple, boundary_type: tuple, cached_corners_and_convexity: CornersAndConvexity | None = None, cached_merged_geos: list[tuple[Any, Shapely]] | None = None)",
      "description": "generate snapping points for mesh refinement."
    },
    {
      "name": "length_axis",
      "kind": "function",
      "signature": "length_axis()",
      "description": "Gets the thickness of the layer."
    },
    {
      "name": "suggested_dl_min",
      "kind": "function",
      "signature": "suggested_dl_min(grid_size_in_vacuum: float, structures: list[Structure], sim_bounds: tuple, boundary_type: tuple, cached_merged_geos: list[tuple[Any, Shapely]] | None = None, cached_corners_and_convexity: CornersAndConvexity | None = None)",
      "description": "Suggested lower bound of grid step size for this layer."
    }
  ],
  "group": "flex_rf.tidy3d"
}
