diff --git a/tidy3d/__init__.py b/tidy3d/__init__.py index 28ba6dafdd..969d7d9837 100644 --- a/tidy3d/__init__.py +++ b/tidy3d/__init__.py @@ -8,7 +8,7 @@ # geometry from .components.geometry.base import Box, Transformed, ClipOperation, GeometryGroup -from .components.geometry.primitives import Sphere, Cylinder, Point +from .components.geometry.primitives import Sphere, Cylinder from .components.geometry.mesh import TriangleMesh from .components.geometry.polyslab import PolySlab @@ -179,7 +179,6 @@ def set_logging_level(level: str) -> None: "AutoGrid", "Box", "Sphere", - "Point", "Cylinder", "PolySlab", "GeometryGroup", diff --git a/tidy3d/components/geometry/primitives.py b/tidy3d/components/geometry/primitives.py index d8dd733972..1be832e0a7 100644 --- a/tidy3d/components/geometry/primitives.py +++ b/tidy3d/components/geometry/primitives.py @@ -10,7 +10,7 @@ import shapely from ..base import cached_property, skip_if_fields_missing -from ..types import Axis, Bound, Coordinate, MatrixReal4x4, Shapely, Tuple, Literal +from ..types import Axis, Bound, Coordinate, MatrixReal4x4, Shapely, Tuple from ...exceptions import SetupError, ValidationError from ...constants import MICROMETER, LARGE_NUMBER from ...packaging import verify_packages_import @@ -166,19 +166,6 @@ def _surface_area(self, bounds: Bound) -> float: return area -class Point(Sphere): - """A point: a sphere of radius = 0. - - Example - ------- - >>> b = Point(center=(1,2,3)) - """ - - radius: Literal[0] = pydantic.Field( - 0, title="Radius", description="Radius of geometry.", units=MICROMETER - ) - - class Cylinder(base.Centered, base.Circular, base.Planar): """Cylindrical geometry with optional sidewall angle along axis direction. When ``sidewall_angle`` is nonzero, the shape is a diff --git a/tidy3d/components/grid/grid_spec.py b/tidy3d/components/grid/grid_spec.py index 0ed5f0de6f..238eea9894 100644 --- a/tidy3d/components/grid/grid_spec.py +++ b/tidy3d/components/grid/grid_spec.py @@ -10,11 +10,10 @@ from .grid import Coords1D, Coords, Grid from .mesher import GradedMesher, MesherType from ..base import Tidy3dBaseModel, cached_property -from ..types import Axis, Symmetry, annotate_type, TYPE_TAG_STR +from ..types import Axis, Symmetry, annotate_type, TYPE_TAG_STR, Coordinate from ..source import SourceType from ..structure import Structure, StructureType from ..geometry.base import Box -from ..geometry.primitives import Point from ...log import log from ...exceptions import SetupError from ...constants import MICROMETER, C_0, fp_eps @@ -87,7 +86,7 @@ def make_coords( periodic: bool, wavelength: pd.PositiveFloat, num_pml_layers: Tuple[pd.NonNegativeInt, pd.NonNegativeInt], - fixpoints: List[Point], + fixpoints: List[Coordinate], ) -> Coords1D: """Generate 1D coords to be used as grid boundaries, based on simulation parameters. Symmetry, and PML layers will be treated here. @@ -105,7 +104,7 @@ def make_coords( Free-space wavelength. num_pml_layers : Tuple[int, int] number of layers in the absorber + and - direction along one dimension. - fixpoints : List[Point] + fixpoints : List[Coordinate] A set of points that enforce grid boundaries to pass through them. Returns @@ -428,7 +427,7 @@ def _make_coords_initial( wavelength: float, symmetry: Symmetry, is_periodic: bool, - fixpoints: List[Point], + fixpoints: List[Coordinate], ) -> Coords1D: """Customized 1D coords to be used as grid boundaries. @@ -445,7 +444,7 @@ def _make_coords_initial( normal to each of the three axes. is_periodic : bool Apply periodic boundary condition or not. - fixpoints : List[Point] + fixpoints : List[Coordinate] A set of points that enforce grid boundaries to pass through them. Returns @@ -585,7 +584,7 @@ class GridSpec(Tidy3dBaseModel): "uses :class:`.AutoGrid`.", ) - fixpoints: Tuple[Point, ...] = pd.Field( + fixpoints: Tuple[Coordinate, ...] = pd.Field( (), title="Grid specification fixpoints", description="A set of points that enforce grid boundaries to pass through them. " @@ -723,7 +722,7 @@ def auto( min_steps_per_wvl: pd.PositiveFloat = 10.0, max_scale: pd.PositiveFloat = 1.4, override_structures: List[StructureType] = (), - fixpoints: List[Point] = (), + fixpoints: List[Coordinate] = (), dl_min: pd.NonNegativeFloat = 0.0, mesher: MesherType = GradedMesher(), ) -> GridSpec: @@ -743,7 +742,7 @@ def auto( A list of structures that is added on top of the simulation structures in the process of generating the grid. This can be used to refine the grid or make it coarser depending than the expected need for higher/lower resolution regions. - fixpoints : List[Point] + fixpoints : List[Coordinate] A set of points that enforce grid boundaries to pass through them. dl_min: pd.NonNegativeFloat Lower bound of grid size. diff --git a/tidy3d/components/grid/mesher.py b/tidy3d/components/grid/mesher.py index 215e88b971..ab010c2cc7 100644 --- a/tidy3d/components/grid/mesher.py +++ b/tidy3d/components/grid/mesher.py @@ -14,10 +14,9 @@ from shapely.errors import ShapelyDeprecationWarning from ..base import Tidy3dBaseModel -from ..types import Axis, ArrayFloat1D +from ..types import Axis, ArrayFloat1D, Coordinate from ..structure import Structure, MeshOverrideStructure, StructureType from ..medium import AnisotropicMedium, Medium2D, PECMedium -from ..geometry.primitives import Point from ...exceptions import SetupError, ValidationError from ...constants import C_0, fp_eps from ...log import log @@ -50,7 +49,7 @@ def insert_fixpoints( axis: Axis, interval_coords: ArrayFloat1D, max_dl_list: ArrayFloat1D, - fixpoints: List[Point], + fixpoints: List[Coordinate], ) -> Tuple[ArrayFloat1D, ArrayFloat1D]: """Insert fixpoints to the intervals.""" @@ -74,7 +73,7 @@ def insert_fixpoints( axis: Axis, interval_coords: ArrayFloat1D, max_dl_list: ArrayFloat1D, - fixpoints: List[Point], + fixpoints: List[Coordinate], ) -> Tuple[ArrayFloat1D, ArrayFloat1D]: """Insert fixpoints to the intervals. @@ -86,7 +85,7 @@ def insert_fixpoints( Coordinate of interval boundaries. max_dl_list : ArrayFloat1D Maximal allowed step size of each interval generated from `parse_structures`. - fixpoints : List[Point] + fixpoints : List[Coordinate] A set of points that enforce grid boundaries to pass through them. Returns @@ -109,7 +108,7 @@ def insert_fixpoints( min_step = np.amin(max_dl_list) * 0.5 for point in fixpoints: - new_coord = point.center[axis] + new_coord = point[axis] # Skip if the point is outside the domain if new_coord >= interval_coords[-1] or new_coord <= interval_coords[0]: continue diff --git a/tidy3d/components/simulation.py b/tidy3d/components/simulation.py index 86382ea6d3..5507c0e30c 100644 --- a/tidy3d/components/simulation.py +++ b/tidy3d/components/simulation.py @@ -714,7 +714,7 @@ def plot_grid( # Plot fixpoints for point in self.grid_spec.fixpoints: - _, (x_point, y_point) = point.pop_axis(point.center, axis=axis) + _, (x_point, y_point) = Geometry.pop_axis(point, axis=axis) x_point, y_point = (self._evaluate_inf(v) for v in (x_point, y_point)) ax.scatter(x_point, y_point, color=plot_params.edgecolor)