fusionsc.geometry.Geometry

class fusionsc.geometry.Geometry(val=None, msgSize=1024, byReference=False)

Methods

__init__([val, msgSize, byReference])

Creates a new instance by either: - Allocating a new message of size msgSize (if val is None) - Storing a reference to the target (if byReference is set) - Copying the message from the given target (accepts Cap'n'proto messages, YAML strings, lists, dicts, and NumPy arrays)

asPolyMesh([triangulate])

Exports as a single merged polygon mesh Note Has asynchronous variant '.asnc(...)' that returns Promise[...]

asPyvista([reduce])

Convert the given geometry into a PyVista / VTK mesh Note Has asynchronous variant '.asnc(...)' that returns Promise[...]

cache(filename)

Note Has asynchronous variant '.asnc(...)' that returns Promise[...]

download()

For a geometry of 'ref' type, downloads the contents of the referenced geometry and wraps them in a new Geometry instance Note Has asynchronous variant '.asnc(...)' that returns Promise[...]

exportTo(filename[, binary, triangulate])

Saves the geometry to the given filename.

filter(filter)

Restricts the geometry to meshes where the given tags meet one (or more) specified values

from2D(r, z[, nPhi, phi1, phi2, close, tags])

Creates a geometry out of a 2D RZ array by wrapping it toroidally

fromPyvista(polyData)

Creates a geometry from a pyvista.PolyData object

getMerged()

After merging the geometry, downloads the merged data and returns them Note Has asynchronous variant '.asnc(...)' that returns Promise[...]

graph(**kwargs)

Visualizes the contents in a graph structure.

importFrom(filename)

Creates a geometry from a file (non-PLY loaded using meshio)

index(geometryGrid)

Computes an indexed geometry for accelerated intersection tests Note Has asynchronous variant '.asnc(...)' that returns Promise[...]

intersect(pStart, pEnd[, grid])

Computes a line intersection test Note Has asynchronous variant '.asnc(...)' that returns Promise[...]

load()

Loads an instance of this class from a previously written archive file.

merge()

Creates a merged geometry (all meshes combined into one big message) Note Has asynchronous variant '.asnc(...)' that returns Promise[...]

planarCut([phi, normal, center])

Computes a planar cut of the geometry along either a given plane or a given phi plane Note Has asynchronous variant '.asnc(...)' that returns Promise[...]

plotCut([phi, ax, plot])

Plot the phi cut of a given geometry in either the given axes or the current active matplotlib axes Note Has asynchronous variant '.asnc(...)' that returns Promise[...]

polyMesh(vertices, polyIndices)

Creates a polygon mesh from a [N, 3] array-like of vertices and a list of polygins (which is each a list of vertex indices)

ptree()

Prints a tree version of this object.

quadMesh(vertices[, wrapU, wrapV])

Creates a geometry out of a quad mesh

reduce([maxVerts, maxIndices])

Creates a new geometry with small meshes combined into a small number of large meshes Note Has asynchronous variant '.asnc(...)' that returns Promise[...]

resolve()

Returns a new geometry with all unresolved nodes replaced by their resolved equivalents.

rotate(angle, axis[, center])

Returns a new geometry rotated around the prescribed axis and center point

save(filename)

Saves the object into an archive file (including all referenced data)

scale([by])

Returns a geometry scaled by the given factor

toYaml([flow])

Prints the contents as block-structured YAML

translate(dx)

Returns a new geometry shifted by the given vector

upload()

Note Has asynchronous variant '.asnc(...)' that returns Promise[...]

weightedSample(scale)

Converts the geometry into a point cloud Note Has asynchronous variant '.asnc(...)' that returns Promise[...]

withTags(extraTags)

Returns a new geometry with the given tags

Attributes

data

Underlying Cap'n'proto struct (usually a builder type).

type

Methods

Geometry.__init__(val=None, msgSize=1024, byReference=False)

Creates a new instance by either: - Allocating a new message of size msgSize (if val is None) - Storing a reference to the target (if byReference is set) - Copying the message from the given target (accepts Cap’n’proto messages,

YAML strings, lists, dicts, and NumPy arrays)

Geometry.asPolyMesh(triangulate: bool = False) Any

Exports as a single merged polygon mesh Note Has asynchronous variant ‘.asnc(…)’ that returns Promise[…]

Geometry.asPyvista(reduce: bool = True) Any

Convert the given geometry into a PyVista / VTK mesh Note Has asynchronous variant ‘.asnc(…)’ that returns Promise[…]

Geometry.cache(filename) Any

Note Has asynchronous variant ‘.asnc(…)’ that returns Promise[…]

Geometry.download() Any

For a geometry of ‘ref’ type, downloads the contents of the referenced geometry and wraps them in a new Geometry instance Note Has asynchronous variant ‘.asnc(…)’ that returns Promise[…]

Geometry.exportTo(filename: str, binary=True, triangulate=True) Any

Saves the geometry to the given filename. Supports ‘.ply’, ‘.stl’, and ‘.vtk’ files. Note Has asynchronous variant ‘.asnc(…)’ that returns Promise[…]

Geometry.filter(filter)

Restricts the geometry to meshes where the given tags meet one (or more) specified values

static Geometry.from2D(r, z, nPhi=100, phi1=None, phi2=None, close=True, tags={})

Creates a geometry out of a 2D RZ array by wrapping it toroidally

static Geometry.fromPyvista(polyData)

Creates a geometry from a pyvista.PolyData object

Geometry.getMerged() Any

After merging the geometry, downloads the merged data and returns them Note Has asynchronous variant ‘.asnc(…)’ that returns Promise[…]

Geometry.graph(**kwargs)

Visualizes the contents in a graph structure. Requires graphviz

static Geometry.importFrom(filename: str)

Creates a geometry from a file (non-PLY loaded using meshio)

Geometry.index(geometryGrid) Any

Computes an indexed geometry for accelerated intersection tests Note Has asynchronous variant ‘.asnc(…)’ that returns Promise[…]

Geometry.intersect(pStart, pEnd, grid=None) Any

Computes a line intersection test Note Has asynchronous variant ‘.asnc(…)’ that returns Promise[…]

Geometry.load() Any

Loads an instance of this class from a previously written archive file.

Note Has asynchronous variant ‘.asnc(…)’ that returns Promise[…]

Geometry.merge() Any

Creates a merged geometry (all meshes combined into one big message) Note Has asynchronous variant ‘.asnc(…)’ that returns Promise[…]

Geometry.planarCut(phi=None, normal=None, center=None) Any

Computes a planar cut of the geometry along either a given plane or a given phi plane Note Has asynchronous variant ‘.asnc(…)’ that returns Promise[…]

Geometry.plotCut(phi=0, ax=None, plot=True, **kwArgs) Any

Plot the phi cut of a given geometry in either the given axes or the current active matplotlib axes Note Has asynchronous variant ‘.asnc(…)’ that returns Promise[…]

static Geometry.polyMesh(vertices, polyIndices)

Creates a polygon mesh from a [N, 3] array-like of vertices and a list of polygins (which is each a list of vertex indices)

Geometry.ptree()

Prints a tree version of this object. Requires the printree library.

static Geometry.quadMesh(vertices, wrapU=False, wrapV=False)

Creates a geometry out of a quad mesh

params:
  • vertices: A numpy array-like of shape [3, nU, nV] containing the individual vertices

  • wrapU: Whether to link the first and last slice of the “u” dimension

  • wrapV: Whether to link the first and last slice of the “v” dimension

Geometry.reduce(maxVerts=1000000, maxIndices=1000000) Any

Creates a new geometry with small meshes combined into a small number of large meshes Note Has asynchronous variant ‘.asnc(…)’ that returns Promise[…]

Geometry.resolve() Any

Returns a new geometry with all unresolved nodes replaced by their resolved equivalents. Note Has asynchronous variant ‘.asnc(…)’ that returns Promise[…]

Geometry.rotate(angle, axis, center=[0, 0, 0])

Returns a new geometry rotated around the prescribed axis and center point

Geometry.save(filename) Any

Saves the object into an archive file (including all referenced data)

Note Has asynchronous variant ‘.asnc(…)’ that returns Promise[…]

Geometry.scale(by=1.0)

Returns a geometry scaled by the given factor

Geometry.toYaml(flow=False)

Prints the contents as block-structured YAML

Geometry.translate(dx)

Returns a new geometry shifted by the given vector

Geometry.upload() Any

Note Has asynchronous variant ‘.asnc(…)’ that returns Promise[…]

Geometry.weightedSample(scale: float) Any

Converts the geometry into a point cloud Note Has asynchronous variant ‘.asnc(…)’ that returns Promise[…]

Geometry.withTags(extraTags)

Returns a new geometry with the given tags