esys.pycad.gmsh Package

Classes

class esys.pycad.gmsh.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.gmsh.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.gmsh.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.gmsh.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.gmsh.Design(dim=3, element_size=1.0, order=1, keep_files=False)

Bases: esys.pycad.design.AbstractDesign

Design for gmsh.

__init__(dim=3, element_size=1.0, order=1, keep_files=False)

Initializes the gmsh design.

Parameters:
  • dim – spatial dimension
  • element_size – global element size
  • order – element order
  • keep_files – flag to keep work files
CGNS = 'cgns'
DELAUNAY = 'Delauny'
DIFFPACK = 'diff'
FRONTAL = 'Frontal'
GMSH = 'msh'
IDEAS = 'unv'
MEDIT = 'mesh'
MESHADAPT = 'MeshAdapt'
NASTRAN = 'bdf'
NETGEN = 'Frontal'
PLOT3D = 'p3d'
STL = 'stl'
TETGEN = 'Delauny'
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.

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 mesh file.

getMeshHandler()

Returns a handle to a mesh meshing the design. In the current implementation a mesh file name in gmsh format is returned.

getOptions(name=None)

Returns the current options for the mesh generator.

getScriptFileName()

Returns the name of the gmsh script file.

getScriptHandler()

Returns a handler to the script file to generate the geometry. In the current implementation a script file name is returned.

getScriptString()

Returns the gmsh script to generate the mesh.

getTagMap()

Returns a TagMap to map the names of PropertySet s 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 for the mesh file. If no name is given a name is generated.

setOptions(algorithm=None, optimize_quality=True, smoothing=1, curvature_based_element_size=False, algorithm2D=None, algorithm3D=None, generate_hexahedra=False, random_factor=None)

Sets options for the mesh generator.

Parameters:
  • algorithm (in self.DELAUNAY, self.MESHADAPT, self.FRONTAL) – selects 2D meshing algorithm
  • algorithm2D (in self.DELAUNAY, self.MESHADAPT, self.FRONTAL) – must be equal to algorithm
  • algorithm3D (in self.DELAUNAY, self.FRONTAL) – selects 3D meshing algorithm
  • curvature_based_element_size (`bool`) – switch for curvature based element size adaption
  • smoothing (non-negative `int`) – number of smoothing steps
  • optimize_quality (`bool`) – switch for mesh quality optimization
  • generate_hexahedra (`bool`) – switch for using quadrangles/hexahedra elements everywhere.
  • random_factor (positive `float`) – used in the 2D meshing algorithm (should be increased if RandomFactor * size(triangle)/size(model) approaches machine accuracy)
setScriptFileName(name=None)

Sets the filename for the gmsh input script. If no name is given a name with extension geo is generated.

class esys.pycad.gmsh.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.gmsh.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.gmsh.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.gmsh.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.gmsh.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.gmsh.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.gmsh.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.gmsh.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.gmsh.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.gmsh.getMPIRankWorld() → int :

Return the rank of this process in the MPI World.

esys.pycad.gmsh.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
esys.pycad.gmsh.gmshGeo2Msh(geoFile, mshFile, numDim, order=1, verbosity=0)

Runs gmsh to mesh input geoFile. Returns 0 on success.

Others

  • DEG

Packages