esys.pycad.Triangle Package¶
Classes¶
- Arc
- BSpline
- BezierCurve
- CurveLoop
- Design
- Line
- PlaneSurface
- Point
- PropertySet
- RuledSurface
- Spline
- SurfaceLoop
- Volume
- 
class esys.pycad.Triangle.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 - Noneis 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 - otheris 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 - progressiondefines the change of element size between neighboured elements. If- createBumpis 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
 
- n (
 - 
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_dictthe value is returned, otherwise a new instance with substituted arguments is returned.
 
- 
- 
class esys.pycad.Triangle.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 - Noneis 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 - otheris 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 - progressiondefines the change of element size between neighboured elements. If- createBumpis 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
 
- n (
 - 
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_dictthe value is returned, otherwise a new instance with substituted arguments is returned.
 
- 
- 
class esys.pycad.Triangle.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 - Noneis 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 - otheris 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 - progressiondefines the change of element size between neighboured elements. If- createBumpis 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
 
- n (
 - 
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_dictthe value is returned, otherwise a new instance with substituted arguments is returned.
 
- 
- 
class esys.pycad.Triangle.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 - Manifold1Ds 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 - otheris 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_dictthe value is returned, otherwise a new instance with substituted arguments is returned.
 
- 
- 
class esys.pycad.Triangle.Design(dim=2, keep_files=False)¶
- Bases: - esys.pycad.design.AbstractDesign- Design for Triangle. - 
__init__(dim=2, keep_files=False)¶
- Initializes the Triangle design. - Parameters: - dim – spatial dimension
- keep_files – flag to keep work files
 
 - 
CGNS= 'cgns'¶
 - 
DIFFPACK= 'diff'¶
 - 
GMSH= 'msh'¶
 - 
IDEAS= 'unv'¶
 - 
MEDIT= 'mesh'¶
 - 
NASTRAN= 'bdf'¶
 - 
PLOT3D= 'p3d'¶
 - 
STL= 'stl'¶
 - 
VRML= 'vrml'¶
 - 
addItems(*items)¶
- Adds items to the design. 
 - 
clearItems()¶
- Removes all items from the design. 
 - 
generate()¶
- generate output file - Note: - this method may be overwritten by a particular design implementation. 
 - 
getAllPrimitives()¶
- Returns a list of all primitives used to create the design. Each primitive appears once. The primitives are ordered by their order of generation. 
 - 
getCommandString()¶
- Returns the Triangle command line: - triangle [-prq__a__uAcDjevngBPNEIOXzo_YS__iFlsCQVh] input_file see http://www.cs.cmu.edu/~quake/triangle.switch.html 
 - 
getDim(dim=3)¶
- Returns the spatial dimension. 
 - 
getElementOrder()¶
- Returns the element order. 
 - 
getElementSize()¶
- Returns the global element size. 
 - 
getFileFormat()¶
- Returns the file format 
 - 
getItems()¶
- Returns a list of the items used in the design. 
 - 
getMeshFileName()¶
- Returns the name of the Triangle mesh file. 
 - 
getMeshHandler()¶
- Returns a handle to a mesh meshing the design. In the current implementation a mesh file name in Triangle format is returned. 
 - 
getScriptFileName()¶
- Returns the name of the gmsh script file. 
 - 
getScriptString()¶
- Returns the Triangle script to generate the mesh. 
 - 
getTagMap()¶
- Returns a - TagMapto map the names of- PropertySets to tags.
 - 
keepFiles()¶
- Returns True if work files are kept, False otherwise. 
 - 
setDim(dim=3)¶
- Sets the spatial dimension. 
 - 
setElementOrder(order=1)¶
- Sets the element order. 
 - 
setElementSize(element_size=1.0)¶
- Sets the global element size. 
 - 
setFileFormat(format='msh')¶
- Sets the file format to be used. - Parameters: - format – format to be used. needs to be one of 
 - 
setKeepFilesOff()¶
- Work files are deleted at the end of the generation 
 - 
setKeepFilesOn()¶
- Work files are kept at the end of the generation. 
 - 
setMeshFileName(name=None)¶
- Sets the name of the Triangle mesh file. 
 - 
setOptions(cmdLineArgs='')¶
- Sets command line options for the mesh generator: - triangle [-prq__a__uAcDjevngBPNEIOXzo_YS__iFlsCQVh] input_file see http://www.cs.cmu.edu/~quake/triangle.switch.html - Parameters: - cmdLineArgs – the switches you would ordinarily use at the command line (e.g. cmdLineArgs=”pq25a7.5”) 
 - 
setScriptFileName(name=None)¶
- Sets the filename for the Triangle input script. If no name is given a name with extension - polyis generated.
 
- 
- 
class esys.pycad.Triangle.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 - Noneis 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 - otheris 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 - progressiondefines the change of element size between neighboured elements. If- createBumpis 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
 
- n (
 - 
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_dictthe value is returned, otherwise a new instance with substituted arguments is returned.
 
- 
- 
class esys.pycad.Triangle.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: - 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: - listof- Points
 - 
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, - Noneis returned.- Return type: - floator- None
 - 
getTransfiniteMeshing()¶
- returns the transfinite meshing settings. If transfinite meshing is not set, - Noneis 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,- Noneis returned.- Return type: - tupleof a- tupleof- Points (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 - otheris 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
 
- n (
 - 
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_deviationspecifies the maximum derivation of the largest angle in the quadrangle from the right angle. Use- max_deviation``==``Noneto switch off recombination.- Parameters: - max_deviation ( - floator- 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_dictthe value is returned, otherwise a new instance with substituted arguments is returned.
 
- 
- 
class esys.pycad.Triangle.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,- zwith the local refinement factor- local_scale. If- xis a list or similar it needs to have length less or equal 3. In this case- yand- zare 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.ndarrayobject.
 - 
getCoordinatesAsList()¶
- Returns the coordinates of the point as a - listobject.
 - 
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 - otheris the same primitive and has the same orientation, False otherwise.
 - 
isColocated(primitive)¶
- Returns True if the - Point- primitiveis 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.ndarrayobject- 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_dictthe value is returned, otherwise a new instance with substituted arguments is returned.
 
- 
- 
class esys.pycad.Triangle.PropertySet(name, *items)¶
- Bases: - esys.pycad.primitives.Primitive,- esys.pycad.primitives.PrimitiveBase- Defines a group of - Primitives 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 - Primitivebut no- PropertySet.
 - 
addItems(*items)¶
- Adds items. An item my be any - Primitivebut 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 - otheris 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_dictthe value is returned, otherwise a new instance with substituted arguments is returned.- Note: - This method is overwritten by subclasses. 
 
- 
- 
class esys.pycad.Triangle.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: - loop – - CurveLoopdefining 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: - listof- Points
 - 
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, - Noneis returned.- Return type: - floator- None
 - 
getTransfiniteMeshing()¶
- returns the transfinite meshing settings. If transfinite meshing is not set, - Noneis 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,- Noneis returned.- Return type: - tupleof a- tupleof- Points (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 - otheris 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
 
- n (
 - 
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_deviationspecifies the maximum derivation of the largest angle in the quadrangle from the right angle. Use- max_deviation``==``Noneto switch off recombination.- Parameters: - max_deviation ( - floator- 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_dictthe value is returned, otherwise a new instance with substituted arguments is returned.
 
- 
- 
class esys.pycad.Triangle.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 - Noneis 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 - otheris 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 - progressiondefines the change of element size between neighboured elements. If- createBumpis 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
 
- n (
 - 
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_dictthe value is returned, otherwise a new instance with substituted arguments is returned.
 
- 
- 
class esys.pycad.Triangle.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 - otheris the same primitive and has the same orientation, False otherwise.
 - 
isColocated(primitive)¶
- Returns True if each surface is collocated with a curve in - primitiveand 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_dictthe value is returned, otherwise a new instance with substituted arguments is returned.
 
- 
- 
class esys.pycad.Triangle.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: - loop – SurfaceLoopdefining the boundary of the surface
- holes – list of SurfaceLoopdefining 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. 
- loop – 
 - 
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, - Noneis 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,- Noneis returned.- Return type: - tupleof a- tupleof- Points (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 - otheris 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
 
- n (
 - 
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_deviationspecifies the maximum derivation of the largest angle in the quadrangle from the right angle. Use- max_deviation``==``Noneto switch off recombination.- Parameters: - max_deviation ( - floator- 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 - orientationis 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_dictthe value is returned, otherwise a new instance with substituted arguments is returned.
 
- 
Functions¶
- 
esys.pycad.Triangle.getMPIRankWorld() → int :¶
- Return the rank of this process in the MPI World. 
- 
esys.pycad.Triangle.getMPIWorldMax((int)arg1) → int :¶
- Each MPI process calls this function with a value for arg1. The maximum value is computed and returned. - Return type: - int