Geometry objects

See also bfdtd.bfdtd_parser module and bfdtd.GeometryObjects module.

Block

class bfdtd.GeometryObjects.Block[source]

Bases: bfdtd.GeometryObjects.GeometryObject

Create a Block.

getAABB()[source]

Returns the lower and upper corners of an Axis-Aligned Bounding Box (AABB) in absolute coordinates in the form (minBB, maxBB), where minBB = [xmin,ymin,zmin] and maxBB = [xmax,ymax,zmax].

getCentro()[source]

Returns the centre of the block (which can be different from its location). At the moment, the origin of a block can be arbitrarily defined, so keeping this around is useful.

getLowerRelative()[source]
getMEEPobject()[source]
getMeshingParameters(xvec, yvec, zvec, epsx, epsy, epsz)[source]

get meshing parameters

getSize()[source]

get the size of the block as an array of size 3

getUpperRelative()[source]
read_entry(entry)[source]

read an entry extracted from a .geo file

setLowerAbsolute(lower_absolute)[source]
setLowerRelative(lower_relative)[source]
setOriginToGeometry()[source]

Sets the origin of the block (i.e. the location) to the geometric centre of the block, without changing the absolute lower and upper coordinates.

setSize(size_vec3)[source]

size_vec3 can be a vector of size 3 or a simple int or float (vector of size 1, scalar)

setUpperAbsolute(upper_absolute)[source]
setUpperRelative(upper_relative)[source]
writeCTL(FILE=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>, offset=array([0, 0, 0]))[source]
write_entry(FILE=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>)[source]

write an entry to a file object

Sphere

class bfdtd.GeometryObjects.Sphere[source]

Bases: bfdtd.GeometryObjects.GeometryObject

getInnerRadius()[source]
getLowerRelative()[source]
getOuterRadius()[source]
getSize()[source]

get the size of the sphere as an array of size 3

getUpperRelative()[source]
read_entry(entry)[source]
setInnerRadius(inner_radius)[source]
setOuterRadius(outer_radius)[source]
setSize(size_vec3)[source]

setSize wrapper for use in BFDTD export scripts

writeCTL(FILE=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>, offset=array([0, 0, 0]))[source]
write_entry(FILE=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>)[source]

BFDTD sphere object:

  • 1-5 Coordinates of the sphere ( xc yc zc r1 r2 )
  • 6 permittivity
  • 7 conductivity

Cylinder

class bfdtd.GeometryObjects.Cylinder(inner_radius=None, outer_radius=None, height=None, angle_deg=None)[source]

Bases: bfdtd.GeometryObjects.GeometryObject

createBlenderObject(blender_operator, context)[source]
getAABB()[source]

Returns the lower and upper corners of an Axis-Aligned Bounding Box (AABB) in absolute coordinates in the form (minBB, maxBB), where minBB = [xmin,ymin,zmin] and maxBB = [xmax,ymax,zmax].

getAxis()[source]
getCentro()[source]
getHeight()[source]
getInnerRadius()[source]
getLowerRelative()[source]

Returns the lower corner of an Axis-Aligned Bounding Box (AABB) in coordinates relative to the location (centre of the cylinder).

getMEEPobject()[source]
getMeshingParameters(xvec, yvec, zvec, epsx, epsy, epsz)[source]
getOuterRadius()[source]
getSize()[source]
getStartEndPoints()[source]
getUpperRelative()[source]

Returns the upper corner of an Axis-Aligned Bounding Box (AABB) in coordinates relative to the location (centre of the cylinder).

read_entry(entry)[source]
setAxis(axis_vec3)[source]
setDiametre(diametre)[source]
setHeight(height)[source]
setInnerRadius(inner_radius)[source]
setOuterRadius(outer_radius)[source]
setSize(dimensions)[source]

sets size from a 3d vector of the form [2*outer_radius, 2*outer_radius, height] (if the first 2 values are different, it takes the maximum)

setStartEndPoints(start_point_vec3, end_point_vec3)[source]
writeCTL(FILE=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>, offset=array([0, 0, 0]))[source]
write_entry(FILE=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>)[source]

cylinder { 1-7 Coordinates of the material volume ( xc yc zc r1 r2 h ) 7 permittivity 8 conductivity 9 angle_deg of inclination }

  • xc, yc and zc are the coordinates of the centro of the cylinder. r1 and r2 are the inner and outer radius respectively
  • h is the cylinder height
  • angle_deg is the angle of inclination in degrees The cylinder is aligned with the y direction if =0 and with the x direction if =90 i.e. angle_deg = Angle of rotation in degrees around -Z=(0,0,-1)

Distorted

class bfdtd.GeometryObjects.Distorted[source]

Bases: bfdtd.GeometryObjects.GeometryObject

A cuboid object with arbitrary vertex positioning.

_images/distorted_vertices.png

Vertex indices:

  • 0,1,2,3 = top face numbered clockwise viewed from outside
  • 4,5,6,7 = bottom face numbered clockwise viewed from outside

Edges:

  • 3 connected to 4
  • 2 connected to 5
  • 0 connected to 7
  • 1 connected to 6

Normal faces viewed from outside:

  • [3,2,1,0]
  • [7,6,5,4]
  • [0,1,6,7]
  • [1,2,5,6]
  • [2,3,4,5]
  • [3,0,7,4]
getCentroOfMassAbsolute()[source]

Returns the “centro of mass” of the object, i.e. sum(vertices)/8.

getMeshingParameters(xvec, yvec, zvec, epsx, epsy, epsz)[source]

todo:: improve meshing system + add support for rotations

getVerticesAbsolute()[source]

Get absolute coordinates of the object’s vertices.

getVerticesRelative()[source]

Get relative coordinates of the object’s vertices.

read_entry(entry)[source]

Read a .geo file entry.

setOrigin(location)[source]

Sets the location to the specified location, but so that the vertices keep the same absolute coordinates. This has no effect on BFDTD output, but is useful for placing objects. It is similar to changing the origin of an object in blender, while keeping the mesh in the same place. .. todo:: Rotations will complicate things here. May need to make sure it adapts the rotation accordingly.

setOriginToGeometry()[source]

Sets the origin of the object to its centro of mass.

setVerticesAbsolute(vertices_absolute)[source]

Set absolute coordinates of the object’s vertices.

setVerticesRelative(vertices_relative)[source]

Set relative coordinates of the object’s vertices.

write_entry(FILE=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>)[source]

Write a .geo file entry.

Parallelepiped

class bfdtd.GeometryObjects.Parallelepiped[source]

Bases: bfdtd.GeometryObjects.Distorted

A parallelepiped (i.e., a brick, possibly with non-orthogonal axes).

Properties:

  • location [vector3]: Center point of the object. default value: [0,0,0]
  • size [vector3]: The lengths of the block edges along each of its three axes. Not really a 3-vector, but it has three components, each of which should be nonzero. default value: [1,1,1]
  • e0, e1, e2 [vector3]: The directions of the axes of the block; the lengths of these vectors are ignored. Must be linearly independent. They default to the three lattice directions.
getAxes()[source]
getSize()[source]
setAxes(e0, e1, e2)[source]
setDirectionsAndSize(e0, e1, e2, size)[source]
setSize(size)[source]
updateVertices()[source]