py4sci

6.2. steps.geom

Namespace for geometry objects.

_images/steps.geom.jpg

Class diagram for steps.geom namespace.

class steps.geom.Geom(*args)

Top-level geometry container to which a number of compartment objects and patches objects may be grouped.

A steps.geom.Geom object is parent to the following objects:

  • steps.geom.Comp
  • steps.geom.Patch

Construction:

g = steps.geom.Geom()

Create a geometry container object.

Arguments:
None
delComp(*args)

Removes the steps.geom.Comp object with identifier string comp_id (if defined) from the geometry container.

Syntax:

delComp(comp_id)
Arguments:
string comp_id
Return:
None
delPatch(*args)

Removes the steps.geom.Patch object with identifier string patch_id (if defined) from the geometry container.

Syntax:

delPatch(patch_id)
Arguments:
string patch_id
Return:
None
getAllComps(*args)

Returns a list of references to all steps.geom.Comp compartment objects in the geometry container.

Syntax:

getAllComps()
Arguments:
None
Return:
list<steps.geom.Comp>
getAllPatches(*args)

Returns a list of references to all steps.geom.Patch patch objects in the geometry container.

Syntax:

getAllPatches()
Arguments:
None
Return:
list<steps.geom.Patch>
getComp(*args)

Returns a reference to the steps.model.Comp compartment object with identifier string comp_id (if defined).

Syntax:

getComp(comp_id)
Arguments:
string comp_id
Return:
steps.model.Comp
getPatch(*args)

Removes the steps.geom.Patch object with identifier string patch_id (if defined) from the geometry container.

Syntax:

getPatch(patch_id)
Arguments:
string patch_id
Return:
steps.geom.Patch
class steps.geom.Comp(*args, **kwargs)

Base class for compartment objects. It provides basic functionality and data that is shared by the derived class steps.geom.TmComp (that is used to describe a compartment in a tetrahedral mesh):

  • Getting and setting a valid compartment identifier string, and handling the interaction with the container object.
  • Getting (and at least in this base class also setting) the total volume of the compartment.
  • Adding volume systems to the compartment.
  • References to steps.geom.Patch objects to which the compartment is adjoined.

This base class can be used directly with well-mixed solvers.

Relationship between Compartments and Patches

It is necessary to explain the inner/outer relationship between compartments and patches. When a patch object is created (a surface of a compartment, which may be shared with another compartment). it is necessary to arbitrarily label the compartment(s) “inner” and “outer” (if a patch is connected to only one compartment then the compartment must be labelled “inner” by convention). This is necessary in order to fully describe the surface reaction rules. Accordingly, compartments also store a list of connections, “inner” patches and “outer” patches. So if a patch1 is created with comp1 as it’s “inner” compartment, comp1 knows patch 1 as an “outer” patch. The labelling is purely defined when creating the Patch objects, bearing in mind the stoichiometry defined in the surface reaction objects. This may seem a little confusing at first, but will become clearer when experience is gained with these objects.

Construction:

comp = steps.geom.Comp(id, container, vol = 0.0)

Construct a compartment object with identifier string id and assign container as the parent geometry container. Optionally set volume to vol (in m^3).

Arguments:
  • string id
  • steps.geom.Geom container
  • float vol (default = 0.0)
addVolsys(*args)

Add volume system identifier string volsys_id to the compartment object.

Syntax:

addVolsys(volsys_id)
Arguments:
string volsys_id
Return:
None
delVolsys(*args)

Removes volume system identifier string volsys_id from this compartment.

Syntax:

delVolsys(volsys_id)
Arguments:
string volsys_id
Return:
None
getContainer(*args)

Returns a reference to the parent steps.geom.Geom container object.

Syntax:

getContainer()
Arguments:
None
Return:
steps.geom.Geom
getID(*args)

Get the identifier string of the compartment.

Syntax:

getID()
Arguments:
None
Return:
string
getIPatches(*args)

Returns a list of references to steps.geom.Patch patch objects: the ‘inner’ patches.

Syntax:

getIPatches()
Arguments:
None
Return:
list<steps.geom.Patch>
getOPatches(*args)

Returns a list of references to steps.geom.Patch patch objects: the ‘outer’ patches.

Syntax:

getOPatches()
Arguments:
None
Return:
list<steps.geom.Patch>
getVol(*args)

Get the volume of the compartment (in m^3).

Syntax:

getVol()
Arguments:
None
Return:
float
getVolsys(*args)

Returns a list of the volume system identifier strings which have been added to the compartment.

Syntax:

getVolsys()
Arguments:
None
Return:
list<string>
setID(*args)

Set the identifier string of the compartment.

Syntax:

setID(name)
Arguments:
string name
Return:
None
setVol(*args)

Set the volume of the compartment (in m^3).

Syntax:

setVol(vol)
Arguments:
float vol
Return:
None
container
Reference to parent steps.geom.Geom container.
id
Identifier string of the compartment.
ipatches
List of reference to inner patches.
opatches
List of reference to outer patches.
vol
Volume of the compartment.
volsys
Reference to assocated volume system.
class steps.geom.Patch(*args, **kwargs)

Base class for patch objects. A patch is a piece of 2D surface surrounding (part of) a 3D compartment, which may be connected to another compartment. It provides basic functionality and descriptive data that is shared by the derived class steps.geom.TmPatch (that is used to describe a surface comprised of triangles in a tetrahedral mesh):

  • Getting and setting a valid patch identifier string, and handling the interaction with the container object.
  • Getting (and at least in this base class also setting) the total area of the patch.
  • Adding surface systems to the patch.
  • References to inside/outside compartments to which the patch is adjoined.

This base class can be used directly with well-mixed solvers.

Construction:

patch = steps.geom.Patch(id, container, icomp, ocomp = None, area = 0.0)

Construct a patch object with identifier string id, assign container as the parent geometry container and assign icomp as the “inner” compartment. Assign also ocomp as the “outer” compartment (if required) and optionally set the area to area (in m^2).

Arguments:
  • string id
  • steps.geom.Geom container
  • steps.geom.Comp icomp
  • steps.geom.Comp ocomp (default = None)
  • float area (default = 0.0)
addSurfsys(*args)

Add surface system identifier string surfsys_id to the patch object.

Syntax:

addSurfsys(surfsys_id)
Arguments:
string surfsys_id
Return:
None
delSurfsys(*args)

Removes surface system identifier string surfsys_id from this patch.

Syntax:

delSurfsys(surfsys_id)
Arguments:
string surfsys_id
Return:
None
getArea(*args)

Get the area of the patch (in m^2).

Syntax:

getArea()
Arguments:
None
Return:
float
getContainer(*args)

Returns a reference to the parent steps.geom.Geom container object.

Syntax:

getContainer()
Arguments:
None
Return:
steps.geom.Geom
getIComp(*args)

Returns a reference to the steps.geom.Comp compartment object representing the inner compartment.

Syntax:

getIComp()
Arguments:
None
Return:
steps.geom.Comp
getID(*args)

Get the identifier string of the patch.

Syntax:

getID()
Arguments:
None
Return:
string
getOComp(*args)

Returns a reference to the steps.geom.Comp compartment object representing the outer compartment.

Syntax:

getOComp()
Arguments:
None
Return:
steps.geom.Comp
getSurfsys(*args)

Returns a list of the surface system identifier strings which have been added to the patch.

Syntax:

getSurfsys()
Arguments:
None
Return:
list<string>
setArea(*args)

Set the area of the patch (in m^2).

Syntax:

setArea(area)
Arguments:
float area
Return:
None
setID(*args)

Set the identifier string of the patch.

Syntax:

setID(name)
Arguments:
string name
Return:
None
area
Area of the patch.
container
Reference to parent steps.geom.Geom container.
icomp
Reference to the inner compartment.
id
Identifier string of the patch.
ocomp
reference to the outer compartment.
surfsys
Reference to assocated surface system.
class steps.geom.Tetmesh(*args)

Main container class for static tetrahedral meshes. This class stores the vertices points, 3D tetrahedral and 2D triangular elements that comprise the mesh. The indices of the elements will be stored as unsigned integers (a positive integer or zero) beginning at zero and incremented by 1. For example, if there are ntets number of tetrahedrons in the mesh, the indices of the tetrahedrons will be [0,1,2,..., (ntets-1)]. In addition, this class computes and contains some auxiliary data from the mesh:

  • Rectangular, axis-aligned bounding box.
  • Overall volume.
  • The total number of tetrahedrons in the mesh.
  • The total number of triangles in the mesh.
  • The total number of vertices in the mesh.

Auxiliary data is also stored for each tetrahedron:

  • Volume of the tetrahedron.
  • Indices of the 4 neighbouring tetrahedrons. If there is no neighbour (i.e. if the tetrahedron lies on the border), this index will be -1. The sequence of neighbours is determined by the following common boundary triangles: (0,1,2), (0,1,3), (0,2,3), (1,2,3).
  • Indices of the 4 neighbouring boundary triangles. The sequence of neighbours is also determined by (0,1,2), (0,1,3), (0,2,3), (1,2,3).
  • Compartment (steps.geom.TmComp object) that the tetrahedron belongs to. Stores zero pointer if the tetrahedron has not been assigned to a compartment.

And for each triangle:

  • Area of the triangle.
  • Normal vector of the triangle, normalized to length 1.0.
  • Indices of the 2 neighbouring tetrahedrons. If one tetrahedron does not exist (because the triangle lies on the outer boundary), this index will be -1.
  • Patch (steps.geom.TmPatch object) that a triangle belongs to. Stores zero pointer if triangle has not been assigned to a patch.

Construction1:

mesh = steps.geom.Tetmesh(verts, tets, tris)

Construct a Tetmesh container by the “first” method: Supply a list of all vertices verts (by Cartesian coordinates), supply a list of all tetrahedrons tets (by indices of the 4 vertices) and supply a full or partial list of triangles tris (by indices of the 3 vertices). Indexing in STEPS begins at zero, so the first 3 coordinates in verts will describe the zeroth vertex, t he next 3 coordinates will describe the 1st vertex and so on. Labelling of the vertices in tets and tris should follow this indexing. Lists must be one-dimensional. Length of verts = nverts*3 where nverts is the total number of vertices; length of tets = ntets*4 where ntets is the total number of tetrahedrons; maximum length of tris ntris*3 where ntris is the total number of triangles. For example, if we have just three tetrahedrons; tet0=[0,1,2,3], tet1=[0,1,3,4] and tet2=[1,3,4,5] then the required one-dimensional list tets=[0,1,2,3,0,1,3,4,1,3,4,5].

Arguments:
  • list<float> verts
  • list<uint> tets
  • list<unit> tris
Construction2::
mesh = steps.geom.Tetmesh(nverts, ntets, ntris)

Construct a Tetmesh container by the “second” method: Supply only the number of vertices nverts, the number of tetrahedrons ntets and the number of triangles ntris to the initializer, then use set methods to supply the vertex, tetrahedron and triangle information one by one. It is up to the user to make sure all information is supplied and then call setup() explicitly. It is highly recommended to use the first constructor wherever possible due to t he scope for user error when using this method.

Arguments:
  • uint nverts
  • uint ntets
  • uint ntris
countTets(*args)

Returns the total number of tetrahedrons in the mesh.

Syntax:

countTets()
Arguments:
None
Return:
uint
countTris(*args)

Returns the total number of triangles in the mesh.

Syntax:

countTris()
Arguments:
None
Return:
uint
countVertices(*args)

Returns the total number of vertices in the mesh.

Syntax:

countVertices()
Arguments:
None
Return:
uint
delComp(*args)

Removes the steps.geom.Comp object with identifier string comp_id (if defined) from the geometry container.

Syntax:

delComp(comp_id)
Arguments:
string comp_id
Return:
None
delPatch(*args)

Removes the steps.geom.Patch object with identifier string patch_id (if defined) from the geometry container.

Syntax:

delPatch(patch_id)
Arguments:
string patch_id
Return:
None
findTetByPoint(*args)

Returns the index of the tetrahedron which encompasses a given point p (given in Cartesian coordinates x,y,z). Returns -1 if p is a position outside the mesh.

Syntax:

findTetByPoint(p)
Arguments:
list<float, length = 3> p
Return:
int
getAllComps(*args)

Returns a list of references to all steps.geom.Comp compartment objects in the geometry container.

Syntax:

getAllComps()
Arguments:
None
Return:
list<steps.geom.Comp>
getAllPatches(*args)

Returns a list of references to all steps.geom.Patch patch objects in the geometry container.

Syntax:

getAllPatches()
Arguments:
None
Return:
list<steps.geom.Patch>
getBoundMax(*args)

Returns the maximal Cartesian coordinate of the rectangular bounding box of the mesh.

Syntax:

getBoundMax()
Arguments:
None
Return:
list<float, length = 3>
getBoundMin(*args)

Returns the minimal Cartesian coordinate of the rectangular bounding box of the mesh.

Syntax:

getBoundMin()
Arguments:
None
Return:
list<float, length = 3>
getComp(*args)

Returns a reference to the steps.model.Comp compartment object with identifier string comp_id (if defined).

Syntax:

getComp(comp_id)
Arguments:
string comp_id
Return:
steps.model.Comp
getMeshVolume(*args)

Returns the total volume of the mesh.

Syntax:

getMeshVolume()
Arguments:
None
Return:
float
getPatch(*args)

Removes the steps.geom.Patch object with identifier string patch_id (if defined) from the geometry container.

Syntax:

getPatch(patch_id)
Arguments:
string patch_id
Return:
steps.geom.Patch
getTet(*args)

Returns the tetrahedron with index tidx in the container by its four vertex indices.

Syntax::
getTet(tidx)
Arguments:
uint tidx
Return:
list<uint, length = 4>
getTetBarycenter(*args)

Returns the barycenter of the tetrahedron with index tidx.

Syntax:

getTetBarycenter(tidx)
Arguments:
uint tidx
Return:
list<float, length = 3>
getTetComp(*args)

Returns a reference to a steps.geom.Comp object: the compartment which tetrahedron with index tidx belongs to. Returns None if tetrahedron not assigned to a compartment.

Syntax:

getTetComp(tidx)
Arguments:
uint tidx
Return:
steps.geom.TmComp
getTetQualityRER(*args)

Returns the radius-edge-ratio (a quality measurement) of tetrahedron with index tidx.

Syntax:

getTetQualityRER(tidx)
Arguments:
uint tidx
Return:
float
getTetTetNeighb(*args)

Returns the indices of the four neighbouring tetrahedrons of tetrahedron with index tidx. An index of -1 indicates no neighbour (tetrahedron is on the mesh border).

Syntax:

getTetTetNeighb(tidx)
Arguments:
uint tidx
Return:
list<int, length = 4>
getTetTriNeighb(*args)

Returns the indices of the four neighbouring triangles of tetrahedron with index tidx.

Syntax:

getTetTriNeighb(tidx)
Arguments:
uint tidx
Return:
list<uint, length = 4>
getTetVol(*args)

Returns the volume of the tetrahedron with index tidx.

Syntax:

getTetVol(tidx)
Arguments:
uint tidx
Return:
float
getTri(*args)

Returns the triangle with index tidx in the container by its three vertex indices.

Syntax:

getTri(tidx)
Arguments:
uint tidx
Return:
list<uint, length = 3>
getTriArea(*args)

Returns the area of the triangle with index tidx.

Syntax:

getTriArea(tidx)
Arguments:
uint tidx
Return:
float
getTriBarycenter(*args)

Returns the Cartesian coordinates of the barycenter of triangle with index tidx.

Syntax:

getTriBarycenter(tidx)
Arguments:
uint tidx
Return:
list<float, length = 3>
getTriBoundary(*args)

Returns a list of triangles that form the mesh boundary. Support function for steps.utilities.visual.

Syntax:

getTriBoundary()
Arguments:
None
Return:
list<int>
getTriNorm(*args)

Returns the normal vector of the triangle with index tidx.

Syntax:

getTriNorm(tidx)
Arguments:
uint tidx
Return:
list<float, length = 3>
getTriPatch(*args)

Returns a reference to a step.geom.TmPatch object: the patch which triangle with index tidx belongs to. Returns None if triangle not assigned to a patch.

Syntax:

getTriPatch(tidx)
Arguments:
uint tidx
Return:
steps.geom.TmPatch
getTriTetNeighb(*args)

Returns the indices of the two neighbouring tetrahedrons of triangle with index tidx. An index of -1 indicates no neighbour (triangle is on the mesh border).

Syntax:

getTriTetNeighb(tidx)
Arguments:
uint tidx
Return:
list<int, length = 2>
getVertex(*args)

Returns the coordinates of vertex with index vidx in the container.

Syntax:

getVertex(vidx)
Arguments:
uint vidx
Return:
list<float, length = 3>
isSetupDone(*args)

Check if setup() has been called, either internally by the first constructor, or by the user if the second constructor was used.

Syntax:

isSetupDone()
Arguments:
None
Return:
True if setup is done. False if setup is not done.
setTet(*args)

Set the tetrahedron with index tidx formed by vertices vidx0, vidx1, vidx2, vidx3. Should be called ntets number of times to supply tetrahedron information if the second constructor is used. Cannot be called after setup() has been called.

Syntax:

setTet(tidx, vidx0, vidx1, vidx2, vidx3)
Arguments:
  • uint tidx
  • uint vidx0
  • uint vidx1
  • uint vidx2
  • uint vidx3
Return:
None
setTri(*args)

Set the triangle with index tidx formed by vertices vidx0, vidx1, vidx2. Should be called ntris number of times to supply triangle information if the second constructor is used. Cannot be called after setup() has been called.

Syntax:

setTri(tidx, vidx0, vidx1, vidx2)
Arguments:
  • uint tidx
  • uint vidx0
  • uint vidx1
  • uint vidx2
Return:
None
setVertex(*args)

Set a vertex with index vidx to coordinates x, y, z. Should be used nverts number of times to supply all vertex information if the second constructor is used. Cannot be called after setup() has been called.

Syntax:

setVertex(vidx, x, y, z)
Arguments:
  • uint vidx
  • float x
  • float y
  • float z
Return:
None
setup(*args)

Setup the Tetmesh object by computing the auxiliary data. This method should be called when the second constructor is used and all vertex, tetrahedron and triangle information has been supplied with the set methods. The first constructor calls this method internally, so setup does not have to be called when using the first constructor.

Syntax:

setup()
Arguments:
None
Return:
None
ntets
Number of tetrahedrons in the mesh.
ntris
Number of triangles in the mesh.
nverts
Number of vertices in the mesh.
class steps.geom.TmComp(*args, **kwargs)

Derived class from base steps.geom.Comp class. It provides the same functionality as the steps.geom.Comp class extended for annotation of a group of tetrahedrons in a Tetmesh. The volume is the total volume of the encapsulated tetrahedrons.

Construction:

tmcomp = steps.geom.Comp(id, container, tets)

Construct a TmComp object with identifier string id and assign container as the parent Tetmesh container. Set the group of tetrahedrons that describe this compartment with tets.

Arguments:
  • string id
  • steps.geom.Tetmesh container
  • list<uint> tets
addVolsys(*args)

Add volume system identifier string volsys_id to the compartment object.

Syntax:

addVolsys(volsys_id)
Arguments:
string volsys_id
Return:
None
countTets(*args)

Returns the number of tetrahedrons assigned to the compartment.

Syntax:

countTets()
Arguments:
None
Return:
uint
delVolsys(*args)

Removes volume system identifier string volsys_id from this compartment.

Syntax:

delVolsys(volsys_id)
Arguments:
string volsys_id
Return:
None
getAllTetIndices(*args)

Returns a list of indices of all tetrahedrons assigned to the compartment.

Syntax:

getAllTetIndices()
Arguments:
None
Return:
list<uint>
getBoundMax(*args)

Returns the maximal Cartesian coordinate of the rectangular bounding box of the compartment.

Syntax:

getBoundMax()
Arguments:
None
Return:
list<float, length = 3>
getBoundMin(*args)

Returns the minimal Cartesian coordinate of the rectangular bounding box of the compartment.

Syntax:

getBoundMin()
Arguments:
None
Return:
list<float, length = 3>
getContainer(*args)

Returns a reference to the parent steps.geom.Geom container object.

Syntax:

getContainer()
Arguments:
None
Return:
steps.geom.Geom
getID(*args)

Get the identifier string of the compartment.

Syntax:

getID()
Arguments:
None
Return:
string
getIPatches(*args)

Returns a list of references to steps.geom.Patch patch objects: the ‘inner’ patches.

Syntax:

getIPatches()
Arguments:
None
Return:
list<steps.geom.Patch>
getOPatches(*args)

Returns a list of references to steps.geom.Patch patch objects: the ‘outer’ patches.

Syntax:

getOPatches()
Arguments:
None
Return:
list<steps.geom.Patch>
getVol(*args)

Get the volume of the compartment (in m^3).

Syntax:

getVol()
Arguments:
None
Return:
float
getVolsys(*args)

Returns a list of the volume system identifier strings which have been added to the compartment.

Syntax:

getVolsys()
Arguments:
None
Return:
list<string>
isTetInside(*args)

Returns a list of Booleans describing if tetrahedrons tets are assigned to the compartment.

Syntax:

isTetInside(tets)
Arguments:
list<uint> tets
Return:
list<bool, length = length(tets)>
setID(*args)

Set the identifier string of the compartment.

Syntax:

setID(name)
Arguments:
string name
Return:
None
setVol(*args)
Obsolete
tets
List of indices of tetrahedrons associated to the compartment.
class steps.geom.TmPatch(*args, **kwargs)

Derived class from base steps.geom.Patch class. It provides the same functionality as the steps.geom.Patch class extended for annotation of a group of triangles in a Tetmesh. The area is the total area of the encapsulated triangles.

Construction:

tmpatch = steps.geom.Comp(id, container, tris, icomp, ocomp = None)

Construct a TmPatch object with identifier string id and assign container as the parent geometry container. Assign icomp as the “inner” compartment and assign also ocomp as the “outer” compartment (if required).

Arguments:
  • string id
  • steps.geom.Tetmesh container
  • list<uint> tris
  • steps.geom.TmComp icomp
  • steps.geom.TmComp ocomp (default = None)
addSurfsys(*args)

Add surface system identifier string surfsys_id to the patch object.

Syntax:

addSurfsys(surfsys_id)
Arguments:
string surfsys_id
Return:
None
delSurfsys(*args)

Removes surface system identifier string surfsys_id from this patch.

Syntax:

delSurfsys(surfsys_id)
Arguments:
string surfsys_id
Return:
None
getAllTriIndices(*args)

Returns a list of indices of all triangles assigned to the patch.

Syntax:

getAllTriIndices()
Arguments:
None
Return:
list<uint>
getArea(*args)

Get the area of the patch (in m^2).

Syntax:

getArea()
Arguments:
None
Return:
float
getContainer(*args)

Returns a reference to the parent steps.geom.Geom container object.

Syntax:

getContainer()
Arguments:
None
Return:
steps.geom.Geom
getIComp(*args)

Returns a reference to the steps.geom.Comp compartment object representing the inner compartment.

Syntax:

getIComp()
Arguments:
None
Return:
steps.geom.Comp
getID(*args)

Get the identifier string of the patch.

Syntax:

getID()
Arguments:
None
Return:
string
getOComp(*args)

Returns a reference to the steps.geom.Comp compartment object representing the outer compartment.

Syntax:

getOComp()
Arguments:
None
Return:
steps.geom.Comp
getSurfsys(*args)

Returns a list of the surface system identifier strings which have been added to the patch.

Syntax:

getSurfsys()
Arguments:
None
Return:
list<string>
isTriInside(*args)

Returns a list of Booleans describing if triangles tris are assigned to the patch.

Syntax:

isTriInside(tris)
Arguments:
list<uint> tris
Return:
list<bool, length = length(tris)>
setArea(*args)
Obsolete
setID(*args)

Set the identifier string of the patch.

Syntax:

setID(name)
Arguments:
string name
Return:
None
tris
List of indices of triangles associated to the patch.

Previous topic

6.1. steps.model

Next topic

6.3. steps.rng

This Page