:py:mod:`bempp.api.shapes` ========================== .. py:module:: bempp.api.shapes .. autoapi-nested-parse:: Define various test shapes. Submodules ---------- .. toctree:: :titlesonly: :maxdepth: 1 shapes/index.rst Package Contents ---------------- Functions ~~~~~~~~~ .. autoapisummary:: bempp.api.shapes.regular_sphere bempp.api.shapes.cube bempp.api.shapes.multitrace_cube bempp.api.shapes.reference_triangle bempp.api.shapes.sphere bempp.api.shapes.ellipsoid bempp.api.shapes.cuboid bempp.api.shapes.almond bempp.api.shapes.reentrant_cube bempp.api.shapes.screen bempp.api.shapes.cylinders bempp.api.shapes.multitrace_ellipsoid bempp.api.shapes.multitrace_sphere .. py:function:: regular_sphere(refine_level) Create a regular sphere with a given refinement level. Starting from an octahedron with 8 elements the grid is refined in each step by subdividing each element into four new elements, to create a sphere approximation. The number of elements in the final sphere is given as 8 * 4**refine_level. The maximum allowed refinement level is 9. .. py:function:: cube(length=1, origin=(0, 0, 0), h=0.1) Return a cube mesh. Parameters ---------- length : float Side length of the cube. origin : tuple Coordinates of the origin (bottom left corner) h : float Element size. .. py:function:: multitrace_cube(h=0.1) Definitition of a cube with an interface at z=.5. The normal direction at the interface shows into the positive z-direction and has the domain index and has the domain index 11. The lower half of the cube is given through the segments [1, 2, 3, 4, 5, 6]. The top half of the cube is defined by the segments [6, 7, 8, 9, 10, 11]. For the upper half the normal direction of segment 6 shows in the interior of the domain. .. py:function:: reference_triangle() Return a grid consisting of only the reference triangle. .. py:function:: sphere(r=1, origin=(0, 0, 0), h=0.1) Return a sphere grid. Parameters ---------- r : float Radius of the sphere. origin : tuple Center of the sphere. h : float Element size. .. py:function:: ellipsoid(r1=1, r2=1, r3=1, origin=(0, 0, 0), h=0.1) Return an ellipsoid grid. Parameters ---------- r1 : float Radius of first major axis r2 : float Radius of second major axis r3 : float Radius of third major axis origin : tuple Tuple specifying the origin of the ellipsoid h : float Element size. .. py:function:: cuboid(length=(1, 1, 1), origin=(0, 0, 0), h=0.1) Return a cuboid mesh. Parameters ---------- length : tuple Side lengths of the cube. origin : tuple Coordinates of the origin (bottom left corner) h : float Element size. .. py:function:: almond(h=0.01) Return the Nasa almond shape with element size h. .. py:function:: reentrant_cube(h=0.1, refinement_factor=0.2) Create a reentrant corner in 3d. Parameters ---------- h : float Element size. refinement_factor : float Fractional size with respect to h of elements close to reentrant corner. .. py:function:: screen(corners, h=0.1) Create a screen. Parameters ---------- corners : np.ndarray A (4 x 3) array that defines four corners of the screen. h : float A floating point number specifying the grid size. Output ------- grid : bempp.Grid A structured grid. .. py:function:: cylinders(h=1.0, z=1.0, r=[0.5, 1, 1.5, 1.7], origin=(0.0, 0.0, 0.0), square=False) Create a sequence of concentric cylindrical or cuboidal objects. Parameters ---------- h : float A floating point number specifying the grid size. z : float A floating point number specifying the extrusion parameter along z-axis. r : increasing sequence of floats A sequence definying the radius of each concentric cylinder. origin: tuple of floats The centre of the base of the cylinder. square: boolean Specifies whether the cylindrical shape is a sequence of squares or circles Output ------- grid : bempp.Grid A structured grid. .. py:function:: multitrace_ellipsoid(r1=1, r2=1, r3=1, origin=(0, 0, 0), h=0.1) Return an ellipsoid grid. Parameters ---------- r1 : float Radius of first major axis r2 : float Radius of second major axis r3 : float Radius of third major axis origin : tuple Tuple specifying the origin of the ellipsoid h : float Element size. .. py:function:: multitrace_sphere(r=1, origin=(0, 0, 0), h=0.1) Return a multitrace sphere grid. Parameters ---------- r : float Radius of the sphere. origin : tuple Center of the sphere. h : float Element size.