esys.pycad.gmsh Package¶
Classes¶
-
class
esys.pycad.gmsh.Arc(center, start, end)¶ 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.
-
getCenterPoint()¶ Returns the center point.
-
getEndPoint()¶ Returns the end point.
-
getStartPoint()¶ Returns the start point.
-
isColocated(primitive)¶ Returns True if curves are at the same position.
-
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 bysub_dictthe value is returned, otherwise a new instance with substituted arguments is returned.
-
-
class
esys.pycad.gmsh.BSpline(*points)¶ A BSpline curve. Control points may be repeated.
-
__init__(*points)¶ Defines a curve from control points given by
points.
-
-
class
esys.pycad.gmsh.BezierCurve(*points)¶ A Bezier curve.
-
__init__(*points)¶ Defines a curve from control points given by
points.
-
-
class
esys.pycad.gmsh.CurveLoop(*curves)¶ 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.
-
collectPrimitiveBases()¶ Returns primitives used to construct the CurveLoop.
-
getCurves()¶ Returns the curves defining the CurveLoop.
-
getPolygon()¶ Returns a list of start/end points of the 1D manifold from the loop. If not closed an exception is thrown.
-
isColocated(primitive)¶ Returns True if each curve is collocated with a curve in
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 bysub_dictthe 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)¶ 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
-
DELAUNAY= 'Delauny'¶
-
FRONTAL= 'Frontal'¶
-
MESHADAPT= 'MeshAdapt'¶
-
NETGEN= 'Frontal'¶
-
TETGEN= 'Delauny'¶
-
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.
-
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 adaptionsmoothing (non-negative
`int`) – number of smoothing stepsoptimize_quality (
`bool`) – switch for mesh quality optimizationgenerate_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
geois generated.
-
-
class
esys.pycad.gmsh.Ellipse(center, point_on_main_axis, start, end)¶ 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.
-
getCenterPoint()¶ Returns the center.
-
getEndPoint()¶ Returns the end point.
-
getPointOnMainAxis()¶ Returns a point on the main axis.
-
getStartPoint()¶ Returns the start point.
-
isColocated(primitive)¶ Returns True if curves are at the same position.
-
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 bysub_dictthe value is returned, otherwise a new instance with substituted arguments is returned.
-
-
class
esys.pycad.gmsh.Line(*points)¶ A line is defined by two points.
-
__init__(*points)¶ Defines a line with start and end point.
-
-
class
esys.pycad.gmsh.PlaneSurface(loop, holes=[])¶ 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.
-
collectPrimitiveBases()¶ Returns primitives used to construct the Surface.
-
getBoundary()¶ Returns a list of the one-dimensional manifolds forming the boundary of the Surface (including holes).
-
getBoundaryLoop()¶ Returns the loop defining the boundary.
-
getHoles()¶ Returns the holes.
-
hasHole()¶ Returns True if a hole is present.
-
isColocated(primitive)¶ Returns True if each curve is collocated with a curve in
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 bysub_dictthe 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)¶ 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 factorlocal_scale. Ifxis a list or similar it needs to have length less or equal 3. In this caseyandzare overwritten byx[1]andx[2].
-
collectPrimitiveBases()¶ Returns primitives 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.
-
getLocalScale()¶ Returns the local refinement factor.
-
isColocated(primitive)¶ Returns True if the
Pointprimitiveis collocated (has the same coordinates) with self. That is, if |self - primitive| <= tol * max(|self|,|primitive|).
-
modifyBy(transformation)¶ Modifies the coordinates by applying the given transformation.
-
setCoordinates(x)¶ Sets the coordinates of the point from a
numpy.ndarrayobjectx.
-
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 bysub_dictthe value is returned, otherwise a new instance with substituted arguments is returned.
-
-
class
esys.pycad.gmsh.PropertySet(name, *items)¶ 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 noPropertySet.
-
addItems(*items)¶ Adds items. An item my be any
Primitivebut noPropertySet.
-
clearItems()¶ Clears the list of items.
-
collectPrimitiveBases()¶ Returns primitives used to construct the PropertySet.
-
getDim()¶ Returns the dimensionality of the items.
-
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.
-
getTag()¶ Returns the tag used for this property set.
-
setName(name)¶ Sets the name.
-
-
class
esys.pycad.gmsh.RuledSurface(loop)¶ 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.
-
collectPrimitiveBases()¶ Returns primitives used to construct the Surface.
-
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.
-
hasHole()¶ Returns True if a hole is present.
-
isColocated(primitive)¶ Returns True if each curve is collocated with a curve in
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 bysub_dictthe value is returned, otherwise a new instance with substituted arguments is returned.
-
-
class
esys.pycad.gmsh.Spline(*points)¶ A spline curve defined through a list of control points.
-
__init__(*points)¶ Defines a curve from control points given by
points.
-
-
class
esys.pycad.gmsh.SurfaceLoop(*surfaces)¶ 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.
-
collectPrimitiveBases()¶ Returns primitives used to construct the SurfaceLoop.
-
getSurfaces()¶ Returns the surfaces defining the SurfaceLoop.
-
isColocated(primitive)¶ Returns True if each surface is collocated with a curve in
primitiveand vice versa.
-
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 bysub_dictthe value is returned, otherwise a new instance with substituted arguments is returned.
-
-
class
esys.pycad.gmsh.Volume(loop, holes=[])¶ A volume with holes.
-
__init__(loop, holes=[])¶ Creates a volume with holes.
- Parameters
loop –
SurfaceLoopdefining the boundary of the surfaceholes – 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.
-
collectPrimitiveBases()¶ Returns primitives used to construct the surface.
-
getBoundary()¶ Returns a list of the 2-dimensional manifolds forming the surface of the Volume (including holes).
-
getHoles()¶ Returns the holes in the volume.
-
getSurfaceLoop()¶ Returns the loop forming the surface.
-
hasHole()¶ Returns True if a hole is present.
-
isColocated(primitive)¶ Returns True if each curve is collocated with a curve in
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 bysub_dictthe 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((object)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