esys.pycad Package

Classes

class esys.pycad.Arc(center, start, end)

Bases: esys.pycad.primitives.ArcBase, esys.pycad.primitives.Primitive

Defines an arc which is strictly smaller than pi.

__init__(center, start, end)

Creates an arc defined by the start point, end point and center.

apply(transformation)

Returns a new object by applying the transformation.

collectPrimitiveBases()

Returns the primitives used to construct the Arc.

copy()

Returns a deep copy of the object.

getBoundary()

Returns a list of the zero-dimensional manifolds forming the boundary of the curve.

getCenterPoint()

Returns the center point.

getConstructionPoints()

Returns the points used to construct the primitive.

getDirectedID()

Returns the primitive ID where a negative sign means that reversed ordering is used.

getElementDistribution()

Returns the element distribution.

Returns:the tuple of the number of elements, the progression factor and the bump flag. If no element distribution is set None is returned
Return type:tuple
getEndPoint()

Returns the end point.

getID()

Returns the primitive ID.

getPrimitives()

Returns a list of primitives used to construct the primitive with no double entries.

getStartPoint()

Returns the start point.

getUnderlyingPrimitive()

Returns the underlying primitive.

hasSameOrientation(other)

Returns True if other is the same primitive and has the same orientation, False otherwise.

isColocated(primitive)

Returns True if curves are at the same position.

isReversed()

returns True is the primitive is a reversed primitive.

modifyBy(transformation)

Modifies the coordinates by applying a transformation.

resetElementDistribution()

removes the a previously set element distribution from the line.

setElementDistribution(n, progression=1, createBump=False)

Defines the number of elements on the line. If set it overwrites the local length setting which would be applied. The progression factor progression defines the change of element size between neighboured elements. If createBump is set progression is applied towards the center of the line.

Parameters:
  • n (int) – number of elements on the line
  • progression (positive float) – a positive progression factor
  • createBump (bool) – of elements on the line
setLocalScale(factor=1.0)

Sets the local refinement factor.

substitute(sub_dict)

Returns a copy of self with substitutes for the primitives used to construct it given by the dictionary sub_dict. If a substitute for the object is given by sub_dict the value is returned, otherwise a new instance with substituted arguments is returned.

class esys.pycad.ArcBase

Bases: esys.pycad.primitives.Manifold1D

Base class for arcs.

__init__()

Initializes the arc.

apply(transformation)

Returns a new object by applying the transformation.

collectPrimitiveBases()

Returns the primitives used to construct the Arc.

copy()

Returns a deep copy of the object.

getBoundary()

Returns a list of the zero-dimensional manifolds forming the boundary of the curve.

getCenterPoint()

Returns the center.

getConstructionPoints()

Returns the points used to construct the primitive.

getElementDistribution()

Returns the element distribution.

Returns:the tuple of the number of elements, the progression factor and the bump flag. If no element distribution is set None is returned
Return type:tuple
getEndPoint()

Returns the end point.

getPrimitives()

Returns a list of primitives used to construct the primitive with no double entries.

getStartPoint()

Returns the start point.

modifyBy(transformation)

Modifies the coordinates by applying a transformation.

resetElementDistribution()

removes the a previously set element distribution from the line.

setElementDistribution(n, progression=1, createBump=False)

Defines the number of elements on the line. If set it overwrites the local length setting which would be applied. The progression factor progression defines the change of element size between neighboured elements. If createBump is set progression is applied towards the center of the line.

Parameters:
  • n (int) – number of elements on the line
  • progression (positive float) – a positive progression factor
  • createBump (bool) – of elements on the line
setLocalScale(factor=1.0)

Sets the local refinement factor.

class esys.pycad.BSpline(*points)

Bases: esys.pycad.primitives.Curve

A BSpline curve. Control points may be repeated.

__init__(*points)

Defines a curve from control points given by points.

apply(transformation)

Returns a new object by applying the transformation.

collectPrimitiveBases()

Returns the primitives used to construct the curve.

copy()

Returns a deep copy of the object.

getBoundary()

Returns a list of the zero-dimensional manifolds forming the boundary of the curve.

getConstructionPoints()

Returns the points used to construct the primitive.

getControlPoints()

Returns a list of the points.

getDirectedID()

Returns the primitive ID where a negative sign means that reversed ordering is used.

getElementDistribution()

Returns the element distribution.

Returns:the tuple of the number of elements, the progression factor and the bump flag. If no element distribution is set None is returned
Return type:tuple
getEndPoint()

Returns the end point.

getID()

Returns the primitive ID.

getPrimitives()

Returns a list of primitives used to construct the primitive with no double entries.

getStartPoint()

Returns the start point.

getUnderlyingPrimitive()

Returns the underlying primitive.

hasSameOrientation(other)

Returns True if other is the same primitive and has the same orientation, False otherwise.

isColocated(primitive)

Returns True if curves are at the same position.

isReversed()

returns True is the primitive is a reversed primitive.

modifyBy(transformation)

Modifies the coordinates by applying a transformation.

resetElementDistribution()

removes the a previously set element distribution from the line.

setElementDistribution(n, progression=1, createBump=False)

Defines the number of elements on the line. If set it overwrites the local length setting which would be applied. The progression factor progression defines the change of element size between neighboured elements. If createBump is set progression is applied towards the center of the line.

Parameters:
  • n (int) – number of elements on the line
  • progression (positive float) – a positive progression factor
  • createBump (bool) – of elements on the line
setLocalScale(factor=1.0)

Sets the local refinement factor.

substitute(sub_dict)

Returns a copy of self with substitutes for the primitives used to construct it given by the dictionary sub_dict. If a substitute for the object is given by sub_dict the value is returned, otherwise a new instance with substituted arguments is returned.

class esys.pycad.BezierCurve(*points)

Bases: esys.pycad.primitives.Curve

A Bezier curve.

__init__(*points)

Defines a curve from control points given by points.

apply(transformation)

Returns a new object by applying the transformation.

collectPrimitiveBases()

Returns the primitives used to construct the curve.

copy()

Returns a deep copy of the object.

getBoundary()

Returns a list of the zero-dimensional manifolds forming the boundary of the curve.

getConstructionPoints()

Returns the points used to construct the primitive.

getControlPoints()

Returns a list of the points.

getDirectedID()

Returns the primitive ID where a negative sign means that reversed ordering is used.

getElementDistribution()

Returns the element distribution.

Returns:the tuple of the number of elements, the progression factor and the bump flag. If no element distribution is set None is returned
Return type:tuple
getEndPoint()

Returns the end point.

getID()

Returns the primitive ID.

getPrimitives()

Returns a list of primitives used to construct the primitive with no double entries.

getStartPoint()

Returns the start point.

getUnderlyingPrimitive()

Returns the underlying primitive.

hasSameOrientation(other)

Returns True if other is the same primitive and has the same orientation, False otherwise.

isColocated(primitive)

Returns True if curves are at the same position.

isReversed()

returns True is the primitive is a reversed primitive.

modifyBy(transformation)

Modifies the coordinates by applying a transformation.

resetElementDistribution()

removes the a previously set element distribution from the line.

setElementDistribution(n, progression=1, createBump=False)

Defines the number of elements on the line. If set it overwrites the local length setting which would be applied. The progression factor progression defines the change of element size between neighboured elements. If createBump is set progression is applied towards the center of the line.

Parameters:
  • n (int) – number of elements on the line
  • progression (positive float) – a positive progression factor
  • createBump (bool) – of elements on the line
setLocalScale(factor=1.0)

Sets the local refinement factor.

substitute(sub_dict)

Returns a copy of self with substitutes for the primitives used to construct it given by the dictionary sub_dict. If a substitute for the object is given by sub_dict the value is returned, otherwise a new instance with substituted arguments is returned.

class esys.pycad.Curve(*points)

Bases: esys.pycad.primitives.CurveBase, esys.pycad.primitives.Primitive

A curve defined through a list of control points.

__init__(*points)

Defines a curve from control points given by points.

apply(transformation)

Returns a new object by applying the transformation.

collectPrimitiveBases()

Returns the primitives used to construct the curve.

copy()

Returns a deep copy of the object.

getBoundary()

Returns a list of the zero-dimensional manifolds forming the boundary of the curve.

getConstructionPoints()

Returns the points used to construct the primitive.

getControlPoints()

Returns a list of the points.

getDirectedID()

Returns the primitive ID where a negative sign means that reversed ordering is used.

getElementDistribution()

Returns the element distribution.

Returns:the tuple of the number of elements, the progression factor and the bump flag. If no element distribution is set None is returned
Return type:tuple
getEndPoint()

Returns the end point.

getID()

Returns the primitive ID.

getPrimitives()

Returns a list of primitives used to construct the primitive with no double entries.

getStartPoint()

Returns the start point.

getUnderlyingPrimitive()

Returns the underlying primitive.

hasSameOrientation(other)

Returns True if other is the same primitive and has the same orientation, False otherwise.

isColocated(primitive)

Returns True if curves are at the same position.

isReversed()

returns True is the primitive is a reversed primitive.

modifyBy(transformation)

Modifies the coordinates by applying a transformation.

resetElementDistribution()

removes the a previously set element distribution from the line.

setElementDistribution(n, progression=1, createBump=False)

Defines the number of elements on the line. If set it overwrites the local length setting which would be applied. The progression factor progression defines the change of element size between neighboured elements. If createBump is set progression is applied towards the center of the line.

Parameters:
  • n (int) – number of elements on the line
  • progression (positive float) – a positive progression factor
  • createBump (bool) – of elements on the line
setLocalScale(factor=1.0)

Sets the local refinement factor.

substitute(sub_dict)

Returns a copy of self with substitutes for the primitives used to construct it given by the dictionary sub_dict. If a substitute for the object is given by sub_dict the value is returned, otherwise a new instance with substituted arguments is returned.

class esys.pycad.CurveBase

Bases: esys.pycad.primitives.Manifold1D

Base class for curves. A Curve is defined by a set of control points.

__init__()

Initializes the curve.

apply(transformation)

Returns a new object by applying the transformation.

copy()

Returns a deep copy of the object.

getBoundary()

Returns a list of the zero-dimensional manifolds forming the boundary of the curve.

getConstructionPoints()

Returns the points used to construct the primitive.

getControlPoints()

Returns a list of the points.

getElementDistribution()

Returns the element distribution.

Returns:the tuple of the number of elements, the progression factor and the bump flag. If no element distribution is set None is returned
Return type:tuple
getEndPoint()

Returns the end point.

getPrimitives()

Returns a list of primitives used to construct the primitive with no double entries.

getStartPoint()

Returns the start point.

modifyBy(transformation)

Modifies the coordinates by applying a transformation.

resetElementDistribution()

removes the a previously set element distribution from the line.

setElementDistribution(n, progression=1, createBump=False)

Defines the number of elements on the line. If set it overwrites the local length setting which would be applied. The progression factor progression defines the change of element size between neighboured elements. If createBump is set progression is applied towards the center of the line.

Parameters:
  • n (int) – number of elements on the line
  • progression (positive float) – a positive progression factor
  • createBump (bool) – of elements on the line
setLocalScale(factor=1.0)

Sets the local refinement factor.

class esys.pycad.CurveLoop(*curves)

Bases: esys.pycad.primitives.Primitive, esys.pycad.primitives.PrimitiveBase

An oriented loop of one-dimensional manifolds (= curves and arcs).

The loop must be closed and the Manifold1D s should be oriented consistently.

__init__(*curves)

Creates a polygon from a list of line curves. The curves must form a closed loop.

apply(transformation)

Returns a new object by applying the transformation.

collectPrimitiveBases()

Returns primitives used to construct the CurveLoop.

copy()

Returns a deep copy of the object.

getConstructionPoints()

Returns the points used to construct the primitive.

getCurves()

Returns the curves defining the CurveLoop.

getDirectedID()

Returns the primitive ID where a negative sign means that reversed ordering is used.

getID()

Returns the primitive ID.

getPolygon()

Returns a list of start/end points of the 1D manifold from the loop. If not closed an exception is thrown.

getPrimitives()

Returns a list of primitives used to construct the primitive with no double entries.

getUnderlyingPrimitive()

Returns the underlying primitive.

hasSameOrientation(other)

Returns True if other is the same primitive and has the same orientation, False otherwise.

isColocated(primitive)

Returns True if each curve is collocated with a curve in primitive.

isReversed()

returns True is the primitive is a reversed primitive.

modifyBy(transformation)

Modifies the coordinates by applying a transformation.

setLocalScale(factor=1.0)

Sets the local refinement factor.

substitute(sub_dict)

Returns a copy of self with substitutes for the primitives used to construct it given by the dictionary sub_dict. If a substitute for the object is given by sub_dict the value is returned, otherwise a new instance with substituted arguments is returned.

class esys.pycad.Dilation(factor=1.0, center=array([0., 0., 0.]))

Bases: esys.pycad.transformations.Transformation

Defines a dilation.

__init__(factor=1.0, center=array([0., 0., 0.]))

Creates a dilation with a center and a given expansion/contraction factor.

class esys.pycad.Ellipse(center, point_on_main_axis, start, end)

Bases: esys.pycad.primitives.EllipseBase, esys.pycad.primitives.Primitive

Defines an ellipse which is strictly smaller than pi.

__init__(center, point_on_main_axis, start, end)

Creates an ellipse defined by the start point, end point, the center and a point on the main axis.

apply(transformation)

Returns a new object by applying the transformation.

collectPrimitiveBases()

Returns the primitives used to construct the ellipse.

copy()

Returns a deep copy of the object.

getBoundary()

Returns a list of the zero-dimensional manifolds forming the boundary of the curve.

getCenterPoint()

Returns the center.

getConstructionPoints()

Returns the points used to construct the primitive.

getDirectedID()

Returns the primitive ID where a negative sign means that reversed ordering is used.

getElementDistribution()

Returns the element distribution.

Returns:the tuple of the number of elements, the progression factor and the bump flag. If no element distribution is set None is returned
Return type:tuple
getEndPoint()

Returns the end point.

getID()

Returns the primitive ID.

getPointOnMainAxis()

Returns a point on the main axis.

getPrimitives()

Returns a list of primitives used to construct the primitive with no double entries.

getStartPoint()

Returns the start point.

getUnderlyingPrimitive()

Returns the underlying primitive.

hasSameOrientation(other)

Returns True if other is the same primitive and has the same orientation, False otherwise.

isColocated(primitive)

Returns True if curves are at the same position.

isReversed()

returns True is the primitive is a reversed primitive.

modifyBy(transformation)

Modifies the coordinates by applying a transformation.

resetElementDistribution()

removes the a previously set element distribution from the line.

setElementDistribution(n, progression=1, createBump=False)

Defines the number of elements on the line. If set it overwrites the local length setting which would be applied. The progression factor progression defines the change of element size between neighboured elements. If createBump is set progression is applied towards the center of the line.

Parameters:
  • n (int) – number of elements on the line
  • progression (positive float) – a positive progression factor
  • createBump (bool) – of elements on the line
setLocalScale(factor=1.0)

Sets the local refinement factor.

substitute(sub_dict)

Returns a copy of self with substitutes for the primitives used to construct it given by the dictionary sub_dict. If a substitute for the object is given by sub_dict the value is returned, otherwise a new instance with substituted arguments is returned.

class esys.pycad.EllipseBase

Bases: esys.pycad.primitives.Manifold1D

Base class for ellipses.

__init__()

Initializes the ellipse.

apply(transformation)

Returns a new object by applying the transformation.

collectPrimitiveBases()

Returns the primitives used to construct the ellipse.

copy()

Returns a deep copy of the object.

getBoundary()

Returns a list of the zero-dimensional manifolds forming the boundary of the curve.

getConstructionPoints()

Returns the points used to construct the primitive.

getElementDistribution()

Returns the element distribution.

Returns:the tuple of the number of elements, the progression factor and the bump flag. If no element distribution is set None is returned
Return type:tuple
getEndPoint()

Returns the end point.

getPrimitives()

Returns a list of primitives used to construct the primitive with no double entries.

getStartPoint()

Returns the start point.

modifyBy(transformation)

Modifies the coordinates by applying a transformation.

resetElementDistribution()

removes the a previously set element distribution from the line.

setElementDistribution(n, progression=1, createBump=False)

Defines the number of elements on the line. If set it overwrites the local length setting which would be applied. The progression factor progression defines the change of element size between neighboured elements. If createBump is set progression is applied towards the center of the line.

Parameters:
  • n (int) – number of elements on the line
  • progression (positive float) – a positive progression factor
  • createBump (bool) – of elements on the line
setLocalScale(factor=1.0)

Sets the local refinement factor.

class esys.pycad.Line(*points)

Bases: esys.pycad.primitives.Curve

A line is defined by two points.

__init__(*points)

Defines a line with start and end point.

apply(transformation)

Returns a new object by applying the transformation.

collectPrimitiveBases()

Returns the primitives used to construct the curve.

copy()

Returns a deep copy of the object.

getBoundary()

Returns a list of the zero-dimensional manifolds forming the boundary of the curve.

getConstructionPoints()

Returns the points used to construct the primitive.

getControlPoints()

Returns a list of the points.

getDirectedID()

Returns the primitive ID where a negative sign means that reversed ordering is used.

getElementDistribution()

Returns the element distribution.

Returns:the tuple of the number of elements, the progression factor and the bump flag. If no element distribution is set None is returned
Return type:tuple
getEndPoint()

Returns the end point.

getID()

Returns the primitive ID.

getPrimitives()

Returns a list of primitives used to construct the primitive with no double entries.

getStartPoint()

Returns the start point.

getUnderlyingPrimitive()

Returns the underlying primitive.

hasSameOrientation(other)

Returns True if other is the same primitive and has the same orientation, False otherwise.

isColocated(primitive)

Returns True if curves are at the same position.

isReversed()

returns True is the primitive is a reversed primitive.

modifyBy(transformation)

Modifies the coordinates by applying a transformation.

resetElementDistribution()

removes the a previously set element distribution from the line.

setElementDistribution(n, progression=1, createBump=False)

Defines the number of elements on the line. If set it overwrites the local length setting which would be applied. The progression factor progression defines the change of element size between neighboured elements. If createBump is set progression is applied towards the center of the line.

Parameters:
  • n (int) – number of elements on the line
  • progression (positive float) – a positive progression factor
  • createBump (bool) – of elements on the line
setLocalScale(factor=1.0)

Sets the local refinement factor.

substitute(sub_dict)

Returns a copy of self with substitutes for the primitives used to construct it given by the dictionary sub_dict. If a substitute for the object is given by sub_dict the value is returned, otherwise a new instance with substituted arguments is returned.

class esys.pycad.Manifold1D

Bases: esys.pycad.primitives.PrimitiveBase

General one-dimensional manifold in 1D defined by a start and end point.

__init__()

Initializes the one-dimensional manifold.

apply(transformation)

Returns a new object by applying the transformation.

copy()

Returns a deep copy of the object.

getBoundary()

Returns a list of the zero-dimensional manifolds forming the boundary of the curve.

getConstructionPoints()

Returns the points used to construct the primitive.

getElementDistribution()

Returns the element distribution.

Returns:the tuple of the number of elements, the progression factor and the bump flag. If no element distribution is set None is returned
Return type:tuple
getEndPoint()

Returns the end point.

getPrimitives()

Returns a list of primitives used to construct the primitive with no double entries.

getStartPoint()

Returns the start point.

modifyBy(transformation)

Modifies the coordinates by applying a transformation.

resetElementDistribution()

removes the a previously set element distribution from the line.

setElementDistribution(n, progression=1, createBump=False)

Defines the number of elements on the line. If set it overwrites the local length setting which would be applied. The progression factor progression defines the change of element size between neighboured elements. If createBump is set progression is applied towards the center of the line.

Parameters:
  • n (int) – number of elements on the line
  • progression (positive float) – a positive progression factor
  • createBump (bool) – of elements on the line
setLocalScale(factor=1.0)

Sets the local refinement factor.

class esys.pycad.Manifold2D

Bases: esys.pycad.primitives.PrimitiveBase

General two-dimensional manifold.

Note:Instance variable LEFT - left element orientation when meshing with transfinite meshing
Note:Instance variable RIGHT - right element orientation when meshing with transfinite meshing
Note:Instance variable ALTERNATE - alternate element orientation when meshing with transfinite meshing
__init__()

Creates a two-dimensional manifold.

ALTERNATE = 'Alternate'
LEFT = 'Left'
RIGHT = 'Right'
apply(transformation)

Returns a new object by applying the transformation.

copy()

Returns a deep copy of the object.

getBoundary()

Returns a list of the one-dimensional manifolds forming the boundary of the surface (including holes).

getConstructionPoints()

Returns the points used to construct the primitive.

getPoints()

returns a list of points used to define the boundary

Returns:list of points used to define the boundary
Return type:list of Point s
getPrimitives()

Returns a list of primitives used to construct the primitive with no double entries.

getRecombination()

returns max deviation from right angle in the recombination algorithm

Returns:max deviation from right angle in the recombination algorithm. If recombination is switched off, None is returned.
Return type:float or None
getTransfiniteMeshing()

returns the transfinite meshing settings. If transfinite meshing is not set, None is returned.

Returns:a tuple of the tuple of points used to define the transfinite meshing and the orientation. If no points are set the points tuple is returned as None. If no transfinite meshing is not set, None is returned.
Return type:tuple of a tuple of Point s (or None) and the orientation which is one of the values Manifold2D.LEFT , Manifold2D.RIGHT , Manifold2D.ALTERNATE
hasHole()

Returns True if a hole is present.

modifyBy(transformation)

Modifies the coordinates by applying a transformation.

resetTransfiniteMeshing()

removes the transfinite meshing from the surface

setElementDistribution(n, progression=1, createBump=False)

Defines the number of elements on the lines

Parameters:
  • n (int) – number of elements on the line
  • progression (positive float) – a positive progression factor
  • createBump (bool) – of elements on the line
setLocalScale(factor=1.0)

Sets the local refinement factor.

setRecombination(max_deviation=0.7853981633974483)

Recombines triangular meshes on the surface into mixed triangular/quadrangular meshes. max_deviation specifies the maximum derivation of the largest angle in the quadrangle from the right angle. Use max_deviation``==``None to switch off recombination.

Parameters:max_deviation (float or None.) – maximum derivation of the largest angle in the quadrangle from the right angle.
setTransfiniteMeshing(orientation='Left')

applies 2D transfinite meshing to the surface.

Parameters:orientation (Manifold2D.LEFT, Manifold2D.RIGHT, Manifold2D.ALTERNATE) – sets the orientation of the triangles. It is only relevant if recombination is not used.
Note:Transfinite meshing can not be applied if holes are present.
class esys.pycad.Manifold3D

Bases: esys.pycad.primitives.PrimitiveBase

General three-dimensional manifold.

__init__()

Creates a three-dimensional manifold.

apply(transformation)

Returns a new object by applying the transformation.

copy()

Returns a deep copy of the object.

getBoundary()

Returns a list of the 2-dimensional manifolds forming the boundary of the volume (including holes).

getConstructionPoints()

Returns the points used to construct the primitive.

getPrimitives()

Returns a list of primitives used to construct the primitive with no double entries.

getTransfiniteMeshing()

returns the transfinite meshing settings. If transfinite meshing is not set, None is returned.

Returns:a tuple of the tuple of points used to define the transfinite meshing and the orientation. If no points are set the points tuple is returned as None. If no transfinite meshing is not set, None is returned.
Return type:tuple of a tuple of Point s (or None) and the orientation which is one of the values Manifold2D.LEFT , Manifold2D.RIGHT , Manifold2D.ALTERNATE
modifyBy(transformation)

Modifies the coordinates by applying a transformation.

resetTransfiniteMeshing()

removes the transfinite meshing from the volume but not from the surfaces

setElementDistribution(n, progression=1, createBump=False)

Defines the number of elements on the lines and surfaces

Parameters:
  • n (int) – number of elements on the line
  • progression (positive float) – a positive progression factor
  • createBump (bool) – of elements on the line
setLocalScale(factor=1.0)

Sets the local refinement factor.

setRecombination(max_deviation=0.7853981633974483)

Recombines triangular meshes on all surface into mixed triangular/quadrangular meshes. These meshes are then used to generate the volume mesh if possible. Recombination requires 3D transfinite meshing.

max_deviation specifies the maximum derivation of the largest angle in the quadrangle from the right angle. Use max_deviation``==``None to switch off recombination.

Parameters:max_deviation (float or None.) – maximum derivation of the largest angle in the quadrangle from the right angle.
setTransfiniteMeshing(orientation='Left')

applies 3D transfinite meshing to the volume and all surface. It requires transfinite meshing on all faces which will be enforced (except if orientation is equal to None). :param orientation: sets the orientation of the triangles on the surfaces. It is only relevant if recombination is not used. If orientation is equal to None, the transfinite meshing is not applied to the surfaces but must be set by the user. :type orientation: Manifold2D.LEFT, Manifold2D.RIGHT, Manifold2D.ALTERNATE :note: Transfinite meshing can not be applied if holes are present. :note: only five or six surfaces may be used. :warning: The functionality of transfinite meshing without recombination is not entirely clear in gmsh. So please apply this method with care.

class esys.pycad.PlaneSurface(loop, holes=[])

Bases: esys.pycad.primitives.Primitive, esys.pycad.primitives.Manifold2D

A plane surface with holes.

__init__(loop, holes=[])

Creates a plane surface with holes.

Parameters:
  • loopCurveLoop defining the boundary of the surface
  • holes – list of CurveLoop s defining holes in the surface
Note:

A CurveLoop defining a hole should not have any lines in common with the exterior CurveLoop.

Note:

A CurveLoop defining a hole should not have any lines in common with another CurveLoop defining a hole in the same surface.

ALTERNATE = 'Alternate'
LEFT = 'Left'
RIGHT = 'Right'
apply(transformation)

Returns a new object by applying the transformation.

collectPrimitiveBases()

Returns primitives used to construct the Surface.

copy()

Returns a deep copy of the object.

getBoundary()

Returns a list of the one-dimensional manifolds forming the boundary of the Surface (including holes).

getBoundaryLoop()

Returns the loop defining the boundary.

getConstructionPoints()

Returns the points used to construct the primitive.

getDirectedID()

Returns the primitive ID where a negative sign means that reversed ordering is used.

getHoles()

Returns the holes.

getID()

Returns the primitive ID.

getPoints()

returns a list of points used to define the boundary

Returns:list of points used to define the boundary
Return type:list of Point s
getPrimitives()

Returns a list of primitives used to construct the primitive with no double entries.

getRecombination()

returns max deviation from right angle in the recombination algorithm

Returns:max deviation from right angle in the recombination algorithm. If recombination is switched off, None is returned.
Return type:float or None
getTransfiniteMeshing()

returns the transfinite meshing settings. If transfinite meshing is not set, None is returned.

Returns:a tuple of the tuple of points used to define the transfinite meshing and the orientation. If no points are set the points tuple is returned as None. If no transfinite meshing is not set, None is returned.
Return type:tuple of a tuple of Point s (or None) and the orientation which is one of the values Manifold2D.LEFT , Manifold2D.RIGHT , Manifold2D.ALTERNATE
getUnderlyingPrimitive()

Returns the underlying primitive.

hasHole()

Returns True if a hole is present.

hasSameOrientation(other)

Returns True if other is the same primitive and has the same orientation, False otherwise.

isColocated(primitive)

Returns True if each curve is collocated with a curve in primitive.

isReversed()

returns True is the primitive is a reversed primitive.

modifyBy(transformation)

Modifies the coordinates by applying a transformation.

resetTransfiniteMeshing()

removes the transfinite meshing from the surface

setElementDistribution(n, progression=1, createBump=False)

Defines the number of elements on the lines

Parameters:
  • n (int) – number of elements on the line
  • progression (positive float) – a positive progression factor
  • createBump (bool) – of elements on the line
setLocalScale(factor=1.0)

Sets the local refinement factor.

setRecombination(max_deviation=0.7853981633974483)

Recombines triangular meshes on the surface into mixed triangular/quadrangular meshes. max_deviation specifies the maximum derivation of the largest angle in the quadrangle from the right angle. Use max_deviation``==``None to switch off recombination.

Parameters:max_deviation (float or None.) – maximum derivation of the largest angle in the quadrangle from the right angle.
setTransfiniteMeshing(orientation='Left')

applies 2D transfinite meshing to the surface.

Parameters:orientation (Manifold2D.LEFT, Manifold2D.RIGHT, Manifold2D.ALTERNATE) – sets the orientation of the triangles. It is only relevant if recombination is not used.
Note:Transfinite meshing can not be applied if holes are present.
substitute(sub_dict)

Returns a copy of self with substitutes for the primitives used to construct it given by the dictionary sub_dict. If a substitute for the object is given by sub_dict the value is returned, otherwise a new instance with substituted arguments is returned.

class esys.pycad.Point(x=0.0, y=0.0, z=0.0, local_scale=1.0)

Bases: esys.pycad.primitives.Primitive, esys.pycad.primitives.PrimitiveBase

A three-dimensional point.

__init__(x=0.0, y=0.0, z=0.0, local_scale=1.0)

Creates a point with coordinates x, y, z with the local refinement factor local_scale. If x is a list or similar it needs to have length less or equal 3. In this case y and z are overwritten by x[1] and x[2].

apply(transformation)

Returns a new object by applying the transformation.

collectPrimitiveBases()

Returns primitives used to construct the primitive.

copy()

Returns a deep copy of the object.

getConstructionPoints()

Returns the points used to construct the primitive.

getCoordinates()

Returns the coordinates of the point as a numpy.ndarray object.

getCoordinatesAsList()

Returns the coordinates of the point as a list object.

getDirectedID()

Returns the primitive ID where a negative sign means that reversed ordering is used.

getID()

Returns the primitive ID.

getLocalScale()

Returns the local refinement factor.

getPrimitives()

Returns a list of primitives used to construct the primitive with no double entries.

getUnderlyingPrimitive()

Returns the underlying primitive.

hasSameOrientation(other)

Returns True if other is the same primitive and has the same orientation, False otherwise.

isColocated(primitive)

Returns True if the Point primitive is collocated (has the same coordinates) with self. That is, if |self - primitive| <= tol * max(|self|,|primitive|).

isReversed()

returns True is the primitive is a reversed primitive.

modifyBy(transformation)

Modifies the coordinates by applying the given transformation.

setCoordinates(x)

Sets the coordinates of the point from a numpy.ndarray object x.

setLocalScale(factor=1.0)

Sets the local refinement factor.

substitute(sub_dict)

Returns a copy of self with substitutes for the primitives used to construct it given by the dictionary sub_dict. If a substitute for the object is given by sub_dict the value is returned, otherwise a new instance with substituted arguments is returned.

class esys.pycad.Primitive

Bases: object

Class that represents a general primitive.

__init__()

Initializes the Primitive instance object with a unique ID.

collectPrimitiveBases()

Returns a list of primitives used to construct the primitive. It may contain primitives twice.

Note:This method is overwritten by subclasses.
getDirectedID()

Returns the primitive ID where a negative sign means that reversed ordering is used.

getID()

Returns the primitive ID.

getUnderlyingPrimitive()

Returns the underlying primitive.

hasSameOrientation(other)

Returns True if other is the same primitive and has the same orientation, False otherwise.

isColocated(primitive)

Returns True if the two primitives are located at the same position.

Note:This method is overwritten by subclasses.
isReversed()

returns True is the primitive is a reversed primitive.

substitute(sub_dict)

Returns a copy of self with substitutes for the primitives used to construct it given by the dictionary sub_dict. If a substitute for the object is given by sub_dict the value is returned, otherwise a new instance with substituted arguments is returned.

Note:This method is overwritten by subclasses.
class esys.pycad.PrimitiveBase

Bases: object

Template for a set of primitives.

__init__()

Initializes the PrimitiveBase instance object.

apply(transformation)

Returns a new object by applying the transformation.

copy()

Returns a deep copy of the object.

getConstructionPoints()

Returns the points used to construct the primitive.

getPrimitives()

Returns a list of primitives used to construct the primitive with no double entries.

modifyBy(transformation)

Modifies the coordinates by applying a transformation.

setLocalScale(factor=1.0)

Sets the local refinement factor.

class esys.pycad.PropertySet(name, *items)

Bases: esys.pycad.primitives.Primitive, esys.pycad.primitives.PrimitiveBase

Defines a group of Primitive s which can be accessed through a name.

__init__(name, *items)

Initializes the Primitive instance object with a unique ID.

addItem(*items)

Adds items. An item my be any Primitive but no PropertySet.

addItems(*items)

Adds items. An item my be any Primitive but no PropertySet.

apply(transformation)

Returns a new object by applying the transformation.

clearItems()

Clears the list of items.

collectPrimitiveBases()

Returns primitives used to construct the PropertySet.

copy()

Returns a deep copy of the object.

getConstructionPoints()

Returns the points used to construct the primitive.

getDim()

Returns the dimensionality of the items.

getDirectedID()

Returns the primitive ID where a negative sign means that reversed ordering is used.

getID()

Returns the primitive ID.

getItems()

Returns the list of items.

getManifoldClass()

Returns the manifold class expected from items.

getName()

Returns the name of the set.

getNumItems()

Returns the number of items in the property set.

getPrimitives()

Returns a list of primitives used to construct the primitive with no double entries.

getTag()

Returns the tag used for this property set.

getUnderlyingPrimitive()

Returns the underlying primitive.

hasSameOrientation(other)

Returns True if other is the same primitive and has the same orientation, False otherwise.

isColocated(primitive)

Returns True if the two primitives are located at the same position.

Note:This method is overwritten by subclasses.
isReversed()

returns True is the primitive is a reversed primitive.

modifyBy(transformation)

Modifies the coordinates by applying a transformation.

setLocalScale(factor=1.0)

Sets the local refinement factor.

setName(name)

Sets the name.

substitute(sub_dict)

Returns a copy of self with substitutes for the primitives used to construct it given by the dictionary sub_dict. If a substitute for the object is given by sub_dict the value is returned, otherwise a new instance with substituted arguments is returned.

Note:This method is overwritten by subclasses.
class esys.pycad.Reflection(normal=array([1., 1., 1.]), offset=0.0)

Bases: esys.pycad.transformations.Transformation

Defines a reflection on a plane.

__init__(normal=array([1., 1., 1.]), offset=0.0)

Defines a reflection on a plane defined in normal form.

class esys.pycad.ReverseArc(arc)

Bases: esys.pycad.primitives.ArcBase, esys.pycad.primitives.ReversePrimitive

Defines an arc which is strictly smaller than pi.

__init__(arc)

Creates an arc defined by the start point, end point and center.

apply(transformation)

Returns a new object by applying the transformation.

collectPrimitiveBases()

Returns the primitives used to construct the Arc.

copy()

Returns a deep copy of the object.

getBoundary()

Returns a list of the zero-dimensional manifolds forming the boundary of the curve.

getCenterPoint()

Returns the center point.

getConstructionPoints()

Returns the points used to construct the primitive.

getDirectedID()

Returns the primitive ID where a negative signs means that reversed ordering is used.

getElementDistribution()

Returns the element distribution.

Returns:the tuple of the number of elements, the progression factor and the bump flag. If no element distribution is set None is returned
Return type:tuple
getEndPoint()

Returns the end point.

getID()

Returns the primitive ID.

getPrimitives()

Returns a list of primitives used to construct the primitive with no double entries.

getStartPoint()

Returns the start point.

getUnderlyingPrimitive()

Returns the underlying primitive.

hasSameOrientation(other)

Returns True if other is the same primitive and has the same orientation as self.

isColocated(primitive)

Returns True if the two primitives are located at the same position.

Note:This method is overwritten by subclasses.
isReversed()

returns True is the primitive is a reversed primitive.

modifyBy(transformation)

Modifies the coordinates by applying a transformation.

resetElementDistribution()

removes the a previously set element distribution from the line.

setElementDistribution(n, progression=1, createBump=False)

Defines the number of elements on the line. If set it overwrites the local length setting which would be applied. The progression factor progression defines the change of element size between neighboured elements. If createBump is set progression is applied towards the center of the line.

Parameters:
  • n (int) – number of elements on the line
  • progression (positive float) – a positive progression factor
  • createBump (bool) – of elements on the line
setLocalScale(factor=1.0)

Sets the local refinement factor.

substitute(sub_dict)

Returns a copy of self with substitutes for the primitives used to construct it given by the dictionary sub_dict. If a substitute for the object is given by sub_dict the value is returned, otherwise a new instance with substituted arguments is returned.

class esys.pycad.ReverseCurve(curve)

Bases: esys.pycad.primitives.CurveBase, esys.pycad.primitives.ReversePrimitive

A curve defined through a list of control points.

__init__(curve)

Defines a curve from control points.

apply(transformation)

Returns a new object by applying the transformation.

collectPrimitiveBases()

Returns a list of primitives used to construct the primitive. It may contain primitives twice.

copy()

Returns a deep copy of the object.

getBoundary()

Returns a list of the zero-dimensional manifolds forming the boundary of the curve.

getConstructionPoints()

Returns the points used to construct the primitive.

getControlPoints()

Returns a list of the points.

getDirectedID()

Returns the primitive ID where a negative signs means that reversed ordering is used.

getElementDistribution()

Returns the element distribution.

Returns:the tuple of the number of elements, the progression factor and the bump flag. If no element distribution is set None is returned
Return type:tuple
getEndPoint()

Returns the end point.

getID()

Returns the primitive ID.

getPrimitives()

Returns a list of primitives used to construct the primitive with no double entries.

getStartPoint()

Returns the start point.

getUnderlyingPrimitive()

Returns the underlying primitive.

hasSameOrientation(other)

Returns True if other is the same primitive and has the same orientation as self.

isColocated(primitive)

Returns True if the two primitives are located at the same position.

Note:This method is overwritten by subclasses.
isReversed()

returns True is the primitive is a reversed primitive.

modifyBy(transformation)

Modifies the coordinates by applying a transformation.

resetElementDistribution()

removes the a previously set element distribution from the line.

setElementDistribution(n, progression=1, createBump=False)

Defines the number of elements on the line. If set it overwrites the local length setting which would be applied. The progression factor progression defines the change of element size between neighboured elements. If createBump is set progression is applied towards the center of the line.

Parameters:
  • n (int) – number of elements on the line
  • progression (positive float) – a positive progression factor
  • createBump (bool) – of elements on the line
setLocalScale(factor=1.0)

Sets the local refinement factor.

substitute(sub_dict)

Returns a copy of self with substitutes for the primitives used to construct it given by the dictionary sub_dict. If a substitute for the object is given by sub_dict the value is returned, otherwise a new instance with substituted arguments is returned.

class esys.pycad.ReverseCurveLoop(curve_loop)

Bases: esys.pycad.primitives.ReversePrimitive, esys.pycad.primitives.PrimitiveBase

An oriented loop of one-dimensional manifolds (= curves and arcs).

The loop must be closed and the one-dimensional manifolds should be oriented consistently.

__init__(curve_loop)

Creates a polygon from a list of line curves. The curves must form a closed loop.

apply(transformation)

Returns a new object by applying the transformation.

collectPrimitiveBases()

Returns a list of primitives used to construct the primitive. It may contain primitives twice.

copy()

Returns a deep copy of the object.

getConstructionPoints()

Returns the points used to construct the primitive.

getCurves()

Returns the curves defining the CurveLoop.

getDirectedID()

Returns the primitive ID where a negative signs means that reversed ordering is used.

getID()

Returns the primitive ID.

getPrimitives()

Returns a list of primitives used to construct the primitive with no double entries.

getUnderlyingPrimitive()

Returns the underlying primitive.

hasSameOrientation(other)

Returns True if other is the same primitive and has the same orientation as self.

isColocated(primitive)

Returns True if the two primitives are located at the same position.

Note:This method is overwritten by subclasses.
isReversed()

returns True is the primitive is a reversed primitive.

modifyBy(transformation)

Modifies the coordinates by applying a transformation.

setLocalScale(factor=1.0)

Sets the local refinement factor.

substitute(sub_dict)

Returns a copy of self with substitutes for the primitives used to construct it given by the dictionary sub_dict. If a substitute for the object is given by sub_dict the value is returned, otherwise a new instance with substituted arguments is returned.

class esys.pycad.ReverseEllipse(arc)

Bases: esys.pycad.primitives.EllipseBase, esys.pycad.primitives.ReversePrimitive

Defines an ellipse which is strictly smaller than pi.

__init__(arc)

Creates an instance of a reverse view to an ellipse.

apply(transformation)

Returns a new object by applying the transformation.

collectPrimitiveBases()

Returns the primitives used to construct the ellipse.

copy()

Returns a deep copy of the object.

getBoundary()

Returns a list of the zero-dimensional manifolds forming the boundary of the curve.

getCenterPoint()

Returns the center point.

getConstructionPoints()

Returns the points used to construct the primitive.

getDirectedID()

Returns the primitive ID where a negative signs means that reversed ordering is used.

getElementDistribution()

Returns the element distribution.

Returns:the tuple of the number of elements, the progression factor and the bump flag. If no element distribution is set None is returned
Return type:tuple
getEndPoint()

Returns the end point.

getID()

Returns the primitive ID.

getPointOnMainAxis()

Returns a point on the main axis.

getPrimitives()

Returns a list of primitives used to construct the primitive with no double entries.

getStartPoint()

Returns the start point.

getUnderlyingPrimitive()

Returns the underlying primitive.

hasSameOrientation(other)

Returns True if other is the same primitive and has the same orientation as self.

isColocated(primitive)

Returns True if the two primitives are located at the same position.

Note:This method is overwritten by subclasses.
isReversed()

returns True is the primitive is a reversed primitive.

modifyBy(transformation)

Modifies the coordinates by applying a transformation.

resetElementDistribution()

removes the a previously set element distribution from the line.

setElementDistribution(n, progression=1, createBump=False)

Defines the number of elements on the line. If set it overwrites the local length setting which would be applied. The progression factor progression defines the change of element size between neighboured elements. If createBump is set progression is applied towards the center of the line.

Parameters:
  • n (int) – number of elements on the line
  • progression (positive float) – a positive progression factor
  • createBump (bool) – of elements on the line
setLocalScale(factor=1.0)

Sets the local refinement factor.

substitute(sub_dict)

Returns a copy of self with substitutes for the primitives used to construct it given by the dictionary sub_dict. If a substitute for the object is given by sub_dict the value is returned, otherwise a new instance with substituted arguments is returned.

class esys.pycad.ReversePlaneSurface(surface)

Bases: esys.pycad.primitives.ReversePrimitive, esys.pycad.primitives.Manifold2D

Creates a view onto a PlaneSurface but with reverse orientation.

__init__(surface)

Creates a polygon from a PlaneSurface.

ALTERNATE = 'Alternate'
LEFT = 'Left'
RIGHT = 'Right'
apply(transformation)

Returns a new object by applying the transformation.

collectPrimitiveBases()

Returns a list of primitives used to construct the primitive. It may contain primitives twice.

copy()

Returns a deep copy of the object.

getBoundary()

Returns a list of the one-dimensional manifolds forming the boundary of the Surface (including holes).

getBoundaryLoop()

Returns the CurveLoop defining the ReversePlaneSurface.

getConstructionPoints()

Returns the points used to construct the primitive.

getDirectedID()

Returns the primitive ID where a negative signs means that reversed ordering is used.

getHoles()

Returns the holes.

getID()

Returns the primitive ID.

getPoints()

returns a list of points used to define the boundary

Returns:list of points used to define the boundary
Return type:list of Point s
getPrimitives()

Returns a list of primitives used to construct the primitive with no double entries.

getRecombination()

returns max deviation from right angle in the recombination algorithm

Returns:max deviation from right angle in the recombination algorithm. If recombination is switched off, None is returned.
Return type:float or None
getTransfiniteMeshing()

returns the transfinite meshing settings. If transfinite meshing is not set, None is returned.

Returns:a tuple of the tuple of points used to define the transfinite meshing and the orientation. If no points are set the points tuple is returned as None. If no transfinite meshing is not set, None is returned.
Return type:tuple of a tuple of Point s (or None) and the orientation which is one of the values Manifold2D.LEFT , Manifold2D.RIGHT , Manifold2D.ALTERNATE
getUnderlyingPrimitive()

Returns the underlying primitive.

hasHole()

Returns True if a hole is present.

hasSameOrientation(other)

Returns True if other is the same primitive and has the same orientation as self.

isColocated(primitive)

Returns True if the two primitives are located at the same position.

Note:This method is overwritten by subclasses.
isReversed()

returns True is the primitive is a reversed primitive.

modifyBy(transformation)

Modifies the coordinates by applying a transformation.

resetTransfiniteMeshing()

removes the transfinite meshing from the surface

setElementDistribution(n, progression=1, createBump=False)

Defines the number of elements on the lines

Parameters:
  • n (int) – number of elements on the line
  • progression (positive float) – a positive progression factor
  • createBump (bool) – of elements on the line
setLocalScale(factor=1.0)

Sets the local refinement factor.

setRecombination(max_deviation=0.7853981633974483)

Recombines triangular meshes on the surface into mixed triangular/quadrangular meshes. max_deviation specifies the maximum derivation of the largest angle in the quadrangle from the right angle. Use max_deviation``==``None to switch off recombination.

Parameters:max_deviation (float or None.) – maximum derivation of the largest angle in the quadrangle from the right angle.
setTransfiniteMeshing(orientation='Left')

applies 2D transfinite meshing to the surface.

Parameters:orientation (Manifold2D.LEFT, Manifold2D.RIGHT, Manifold2D.ALTERNATE) – sets the orientation of the triangles. It is only relevant if recombination is not used.
Note:Transfinite meshing can not be applied if holes are present.
substitute(sub_dict)

Returns a copy of self with substitutes for the primitives used to construct it given by the dictionary sub_dict. If a substitute for the object is given by sub_dict the value is returned, otherwise a new instance with substituted arguments is returned.

class esys.pycad.ReversePrimitive(primitive)

Bases: object

A view onto a primitive creating a reverse orientation.

__init__(primitive)

Instantiates a view onto primitive.

collectPrimitiveBases()

Returns a list of primitives used to construct the primitive. It may contain primitives twice.

getDirectedID()

Returns the primitive ID where a negative signs means that reversed ordering is used.

getID()

Returns the primitive ID.

getUnderlyingPrimitive()

Returns the underlying primitive.

hasSameOrientation(other)

Returns True if other is the same primitive and has the same orientation as self.

isColocated(primitive)

Returns True if the two primitives are located at the same position.

Note:This method is overwritten by subclasses.
isReversed()

returns True is the primitive is a reversed primitive.

substitute(sub_dict)

Returns a copy of self with substitutes for the primitives used to construct it given by the dictionary sub_dict. If a substitute for the object is given by sub_dict the value is returned, otherwise a new instance with substituted arguments is returned.

class esys.pycad.ReverseRuledSurface(surface)

Bases: esys.pycad.primitives.ReversePrimitive, esys.pycad.primitives.Manifold2D

Creates a view onto a RuledSurface but with reverse orientation.

__init__(surface)

Creates a polygon from a list of line curves. The curves must form a closed loop.

ALTERNATE = 'Alternate'
LEFT = 'Left'
RIGHT = 'Right'
apply(transformation)

Returns a new object by applying the transformation.

collectPrimitiveBases()

Returns a list of primitives used to construct the primitive. It may contain primitives twice.

copy()

Returns a deep copy of the object.

getBoundary()

Returns a list of the one-dimensional manifolds forming the boundary of the Surface (including holes).

getBoundaryLoop()

Returns the CurveLoop defining the ReverseRuledSurface.

getConstructionPoints()

Returns the points used to construct the primitive.

getDirectedID()

Returns the primitive ID where a negative signs means that reversed ordering is used.

getID()

Returns the primitive ID.

getPoints()

returns a list of points used to define the boundary

Returns:list of points used to define the boundary
Return type:list of Point s
getPrimitives()

Returns a list of primitives used to construct the primitive with no double entries.

getRecombination()

returns max deviation from right angle in the recombination algorithm

Returns:max deviation from right angle in the recombination algorithm. If recombination is switched off, None is returned.
Return type:float or None
getTransfiniteMeshing()

returns the transfinite meshing settings. If transfinite meshing is not set, None is returned.

Returns:a tuple of the tuple of points used to define the transfinite meshing and the orientation. If no points are set the points tuple is returned as None. If no transfinite meshing is not set, None is returned.
Return type:tuple of a tuple of Point s (or None) and the orientation which is one of the values Manifold2D.LEFT , Manifold2D.RIGHT , Manifold2D.ALTERNATE
getUnderlyingPrimitive()

Returns the underlying primitive.

hasHole()

Returns True if a hole is present.

hasSameOrientation(other)

Returns True if other is the same primitive and has the same orientation as self.

isColocated(primitive)

Returns True if the two primitives are located at the same position.

Note:This method is overwritten by subclasses.
isReversed()

returns True is the primitive is a reversed primitive.

modifyBy(transformation)

Modifies the coordinates by applying a transformation.

resetTransfiniteMeshing()

removes the transfinite meshing from the surface

setElementDistribution(n, progression=1, createBump=False)

Defines the number of elements on the lines

Parameters:
  • n (int) – number of elements on the line
  • progression (positive float) – a positive progression factor
  • createBump (bool) – of elements on the line
setLocalScale(factor=1.0)

Sets the local refinement factor.

setRecombination(max_deviation=0.7853981633974483)

Recombines triangular meshes on the surface into mixed triangular/quadrangular meshes. max_deviation specifies the maximum derivation of the largest angle in the quadrangle from the right angle. Use max_deviation``==``None to switch off recombination.

Parameters:max_deviation (float or None.) – maximum derivation of the largest angle in the quadrangle from the right angle.
setTransfiniteMeshing(orientation='Left')

applies 2D transfinite meshing to the surface.

Parameters:orientation (Manifold2D.LEFT, Manifold2D.RIGHT, Manifold2D.ALTERNATE) – sets the orientation of the triangles. It is only relevant if recombination is not used.
Note:Transfinite meshing can not be applied if holes are present.
substitute(sub_dict)

Returns a copy of self with substitutes for the primitives used to construct it given by the dictionary sub_dict. If a substitute for the object is given by sub_dict the value is returned, otherwise a new instance with substituted arguments is returned.

class esys.pycad.ReverseSurfaceLoop(surface_loop)

Bases: esys.pycad.primitives.ReversePrimitive, esys.pycad.primitives.PrimitiveBase

A view of a SurfaceLoop with reverse orientation.

The loop must represent a closed shell and the primitives should be oriented consistently.

__init__(surface_loop)

Creates a polygon from a list of line surfaces. The curves must form a closed loop.

apply(transformation)

Returns a new object by applying the transformation.

collectPrimitiveBases()

Returns a list of primitives used to construct the primitive. It may contain primitives twice.

copy()

Returns a deep copy of the object.

getConstructionPoints()

Returns the points used to construct the primitive.

getDirectedID()

Returns the primitive ID where a negative signs means that reversed ordering is used.

getID()

Returns the primitive ID.

getPrimitives()

Returns a list of primitives used to construct the primitive with no double entries.

getSurfaces()

Returns the surfaces defining the SurfaceLoop.

getUnderlyingPrimitive()

Returns the underlying primitive.

hasSameOrientation(other)

Returns True if other is the same primitive and has the same orientation as self.

isColocated(primitive)

Returns True if the two primitives are located at the same position.

Note:This method is overwritten by subclasses.
isReversed()

returns True is the primitive is a reversed primitive.

modifyBy(transformation)

Modifies the coordinates by applying a transformation.

setLocalScale(factor=1.0)

Sets the local refinement factor.

substitute(sub_dict)

Returns a copy of self with substitutes for the primitives used to construct it given by the dictionary sub_dict. If a substitute for the object is given by sub_dict the value is returned, otherwise a new instance with substituted arguments is returned.

class esys.pycad.Rotatation(axis=array([1., 1., 1.]), point=array([0., 0., 0.]), angle=0.0)

Bases: esys.pycad.transformations.Transformation

Defines a rotation.

__init__(axis=array([1., 1., 1.]), point=array([0., 0., 0.]), angle=0.0)

Creates a rotation using an axis and a point on the axis.

class esys.pycad.RuledSurface(loop)

Bases: esys.pycad.primitives.Primitive, esys.pycad.primitives.Manifold2D

A ruled surface, i.e. a surface that can be interpolated using transfinite interpolation.

__init__(loop)

Creates a ruled surface with boundary loop.

Parameters:loopCurveLoop defining the boundary of the surface.
ALTERNATE = 'Alternate'
LEFT = 'Left'
RIGHT = 'Right'
apply(transformation)

Returns a new object by applying the transformation.

collectPrimitiveBases()

Returns primitives used to construct the Surface.

copy()

Returns a deep copy of the object.

getBoundary()

Returns a list of the one-dimensional manifolds forming the boundary of the Surface (including holes).

getBoundaryLoop()

Returns the loop defining the outer boundary.

getConstructionPoints()

Returns the points used to construct the primitive.

getDirectedID()

Returns the primitive ID where a negative sign means that reversed ordering is used.

getID()

Returns the primitive ID.

getPoints()

returns a list of points used to define the boundary

Returns:list of points used to define the boundary
Return type:list of Point s
getPrimitives()

Returns a list of primitives used to construct the primitive with no double entries.

getRecombination()

returns max deviation from right angle in the recombination algorithm

Returns:max deviation from right angle in the recombination algorithm. If recombination is switched off, None is returned.
Return type:float or None
getTransfiniteMeshing()

returns the transfinite meshing settings. If transfinite meshing is not set, None is returned.

Returns:a tuple of the tuple of points used to define the transfinite meshing and the orientation. If no points are set the points tuple is returned as None. If no transfinite meshing is not set, None is returned.
Return type:tuple of a tuple of Point s (or None) and the orientation which is one of the values Manifold2D.LEFT , Manifold2D.RIGHT , Manifold2D.ALTERNATE
getUnderlyingPrimitive()

Returns the underlying primitive.

hasHole()

Returns True if a hole is present.

hasSameOrientation(other)

Returns True if other is the same primitive and has the same orientation, False otherwise.

isColocated(primitive)

Returns True if each curve is collocated with a curve in primitive.

isReversed()

returns True is the primitive is a reversed primitive.

modifyBy(transformation)

Modifies the coordinates by applying a transformation.

resetTransfiniteMeshing()

removes the transfinite meshing from the surface

setElementDistribution(n, progression=1, createBump=False)

Defines the number of elements on the lines

Parameters:
  • n (int) – number of elements on the line
  • progression (positive float) – a positive progression factor
  • createBump (bool) – of elements on the line
setLocalScale(factor=1.0)

Sets the local refinement factor.

setRecombination(max_deviation=0.7853981633974483)

Recombines triangular meshes on the surface into mixed triangular/quadrangular meshes. max_deviation specifies the maximum derivation of the largest angle in the quadrangle from the right angle. Use max_deviation``==``None to switch off recombination.

Parameters:max_deviation (float or None.) – maximum derivation of the largest angle in the quadrangle from the right angle.
setTransfiniteMeshing(orientation='Left')

applies 2D transfinite meshing to the surface.

Parameters:orientation (Manifold2D.LEFT, Manifold2D.RIGHT, Manifold2D.ALTERNATE) – sets the orientation of the triangles. It is only relevant if recombination is not used.
Note:Transfinite meshing can not be applied if holes are present.
substitute(sub_dict)

Returns a copy of self with substitutes for the primitives used to construct it given by the dictionary sub_dict. If a substitute for the object is given by sub_dict the value is returned, otherwise a new instance with substituted arguments is returned.

class esys.pycad.Spline(*points)

Bases: esys.pycad.primitives.Curve

A spline curve defined through a list of control points.

__init__(*points)

Defines a curve from control points given by points.

apply(transformation)

Returns a new object by applying the transformation.

collectPrimitiveBases()

Returns the primitives used to construct the curve.

copy()

Returns a deep copy of the object.

getBoundary()

Returns a list of the zero-dimensional manifolds forming the boundary of the curve.

getConstructionPoints()

Returns the points used to construct the primitive.

getControlPoints()

Returns a list of the points.

getDirectedID()

Returns the primitive ID where a negative sign means that reversed ordering is used.

getElementDistribution()

Returns the element distribution.

Returns:the tuple of the number of elements, the progression factor and the bump flag. If no element distribution is set None is returned
Return type:tuple
getEndPoint()

Returns the end point.

getID()

Returns the primitive ID.

getPrimitives()

Returns a list of primitives used to construct the primitive with no double entries.

getStartPoint()

Returns the start point.

getUnderlyingPrimitive()

Returns the underlying primitive.

hasSameOrientation(other)

Returns True if other is the same primitive and has the same orientation, False otherwise.

isColocated(primitive)

Returns True if curves are at the same position.

isReversed()

returns True is the primitive is a reversed primitive.

modifyBy(transformation)

Modifies the coordinates by applying a transformation.

resetElementDistribution()

removes the a previously set element distribution from the line.

setElementDistribution(n, progression=1, createBump=False)

Defines the number of elements on the line. If set it overwrites the local length setting which would be applied. The progression factor progression defines the change of element size between neighboured elements. If createBump is set progression is applied towards the center of the line.

Parameters:
  • n (int) – number of elements on the line
  • progression (positive float) – a positive progression factor
  • createBump (bool) – of elements on the line
setLocalScale(factor=1.0)

Sets the local refinement factor.

substitute(sub_dict)

Returns a copy of self with substitutes for the primitives used to construct it given by the dictionary sub_dict. If a substitute for the object is given by sub_dict the value is returned, otherwise a new instance with substituted arguments is returned.

class esys.pycad.SurfaceLoop(*surfaces)

Bases: esys.pycad.primitives.Primitive, esys.pycad.primitives.PrimitiveBase

A loop of 2D primitives which defines the shell of a volume.

The loop must represent a closed shell, and the primitives should be oriented consistently.

__init__(*surfaces)

Creates a surface loop.

apply(transformation)

Returns a new object by applying the transformation.

collectPrimitiveBases()

Returns primitives used to construct the SurfaceLoop.

copy()

Returns a deep copy of the object.

getConstructionPoints()

Returns the points used to construct the primitive.

getDirectedID()

Returns the primitive ID where a negative sign means that reversed ordering is used.

getID()

Returns the primitive ID.

getPrimitives()

Returns a list of primitives used to construct the primitive with no double entries.

getSurfaces()

Returns the surfaces defining the SurfaceLoop.

getUnderlyingPrimitive()

Returns the underlying primitive.

hasSameOrientation(other)

Returns True if other is the same primitive and has the same orientation, False otherwise.

isColocated(primitive)

Returns True if each surface is collocated with a curve in primitive and vice versa.

isReversed()

returns True is the primitive is a reversed primitive.

modifyBy(transformation)

Modifies the coordinates by applying a transformation.

setLocalScale(factor=1.0)

Sets the local refinement factor.

substitute(sub_dict)

Returns a copy of self with substitutes for the primitives used to construct it given by the dictionary sub_dict. If a substitute for the object is given by sub_dict the value is returned, otherwise a new instance with substituted arguments is returned.

class esys.pycad.TagMap(mapping={})

Bases: object

A class that allows to map tags to names.

Example:

tm=TagMap({5 : x })
tm.setMap(a=1,x=4)
assert tm.getTags("a") == [ 1 ]
assert tm.getTags("x") == [ 5, 4 ]
assert tm.map(x=10., a=20.) == { 5 : 10, 4: 10, 1 : 20 }
__init__(mapping={})

Initializes the mapping. mapping defines an initial mapping from tag to a name.

fillFromXML(iostream)

Uses the XML file or string to set the mapping.

fromDom(node)

Fills names and tags from dom node.

getMapping()

Returns a dictionary where the tags define the keys and the values the corresponding names.

getName(tag=None)

Returns the name of a tag. If tag is not present a list of all names is returned.

getTags(name=None)

Returns a list of the tags assigned to name. If name is not present a list of all tags is returned.

insert(data, default=0, **kwargs)

Inserts values into the esys.escript.Data object according to the given values assigned to the keywords. The default is used for tags which map onto name with unspecified values.

map(default=0, **kwargs)

Returns a dictionary where the tags define the keys and the values give the values assigned to the tag via name and kwargs:

tm=TagMap(x=5)
tm.setMap(a=1,x=4)
print tm.map(x=10., a=20.)
{ 5 : 10, 4: 10, 1 : 20 }

The default is used for tags which map onto name with unspecified values.

passToDomain(domain)

Passes the tag map to the esys.escript.Domain domain.

setMap(**kwargs)

Sets a new map where <name>=<tag> assigns the tag <tag> to name <name>. <tag> has to be an integer. If <tag> has been assigned to a name before the mapping will be overwritten. Otherwise a new mapping <tag> -> <name> is set. Notice that a single name can be assigned to different tags.

toDOM(dom)

Adds object to dom.

writeXML(iostream=None)

Serializes self as XML into iostream or if not present returns the XML as string.

class esys.pycad.Transformation

Bases: object

General class to define an affine transformation x->Ax+b.

__init__()

Creates a linear transformation.

class esys.pycad.Translation(b=array([0., 0., 0.]))

Bases: esys.pycad.transformations.Transformation

Defines a translation x->x+b.

__init__(b=array([0., 0., 0.]))

Creates the linear transformation x->x+b.

class esys.pycad.Volume(loop, holes=[])

Bases: esys.pycad.primitives.Manifold3D, esys.pycad.primitives.Primitive

A volume with holes.

__init__(loop, holes=[])

Creates a volume with holes.

Parameters:
  • loopSurfaceLoop defining the boundary of the surface
  • holes – list of SurfaceLoop defining holes in the surface
Note:

A SurfaceLoop defining a hole should not have any surfaces in common with the exterior SurfaceLoop.

Note:

A SurfaceLoop defining a hole should not have any surfaces in common with another SurfaceLoop defining a hole in the same volume.

apply(transformation)

Returns a new object by applying the transformation.

collectPrimitiveBases()

Returns primitives used to construct the surface.

copy()

Returns a deep copy of the object.

getBoundary()

Returns a list of the 2-dimensional manifolds forming the surface of the Volume (including holes).

getConstructionPoints()

Returns the points used to construct the primitive.

getDirectedID()

Returns the primitive ID where a negative sign means that reversed ordering is used.

getHoles()

Returns the holes in the volume.

getID()

Returns the primitive ID.

getPrimitives()

Returns a list of primitives used to construct the primitive with no double entries.

getSurfaceLoop()

Returns the loop forming the surface.

getTransfiniteMeshing()

returns the transfinite meshing settings. If transfinite meshing is not set, None is returned.

Returns:a tuple of the tuple of points used to define the transfinite meshing and the orientation. If no points are set the points tuple is returned as None. If no transfinite meshing is not set, None is returned.
Return type:tuple of a tuple of Point s (or None) and the orientation which is one of the values Manifold2D.LEFT , Manifold2D.RIGHT , Manifold2D.ALTERNATE
getUnderlyingPrimitive()

Returns the underlying primitive.

hasHole()

Returns True if a hole is present.

hasSameOrientation(other)

Returns True if other is the same primitive and has the same orientation, False otherwise.

isColocated(primitive)

Returns True if each curve is collocated with a curve in primitive.

isReversed()

returns True is the primitive is a reversed primitive.

modifyBy(transformation)

Modifies the coordinates by applying a transformation.

resetTransfiniteMeshing()

removes the transfinite meshing from the volume but not from the surfaces

setElementDistribution(n, progression=1, createBump=False)

Defines the number of elements on the lines and surfaces

Parameters:
  • n (int) – number of elements on the line
  • progression (positive float) – a positive progression factor
  • createBump (bool) – of elements on the line
setLocalScale(factor=1.0)

Sets the local refinement factor.

setRecombination(max_deviation=0.7853981633974483)

Recombines triangular meshes on all surface into mixed triangular/quadrangular meshes. These meshes are then used to generate the volume mesh if possible. Recombination requires 3D transfinite meshing.

max_deviation specifies the maximum derivation of the largest angle in the quadrangle from the right angle. Use max_deviation``==``None to switch off recombination.

Parameters:max_deviation (float or None.) – maximum derivation of the largest angle in the quadrangle from the right angle.
setTransfiniteMeshing(orientation='Left')

applies 3D transfinite meshing to the volume and all surface. It requires transfinite meshing on all faces which will be enforced (except if orientation is equal to None). :param orientation: sets the orientation of the triangles on the surfaces. It is only relevant if recombination is not used. If orientation is equal to None, the transfinite meshing is not applied to the surfaces but must be set by the user. :type orientation: Manifold2D.LEFT, Manifold2D.RIGHT, Manifold2D.ALTERNATE :note: Transfinite meshing can not be applied if holes are present. :note: only five or six surfaces may be used. :warning: The functionality of transfinite meshing without recombination is not entirely clear in gmsh. So please apply this method with care.

substitute(sub_dict)

Returns a copy of self with substitutes for the primitives used to construct it given by the dictionary sub_dict. If a substitute for the object is given by sub_dict the value is returned, otherwise a new instance with substituted arguments is returned.

Functions

esys.pycad.Brick(start, end)

Creates a brick with given start and end point.

esys.pycad.createRuledSurface(*curves)

An easier way to create a RuledSurface from given curves.

esys.pycad.getToleranceForColocation()

Returns the global tolerance for colocation checks.

esys.pycad.resetGlobalPrimitiveIdCounter()

Initializes the global primitive ID counter.

esys.pycad.setToleranceForColocation(tol=1e-11)

Sets the global tolerance for colocation checks to tol.

Others

  • DEG
  • RAD
  • global_primitive_id_counter
  • global_tolerance_for_colocation
  • numpyImported