Geometry Class

class plask.geometry.Geometry

Base class for all geometries

Methods

get_matching_objects(cond)

Get list of the geometry tree objects matching condition.

get_material_field(mesh)

Distribution of materials for a given geometry on a mesh.

get_role_objects(role)

Get list of the geometry tree objects that have the specified role.

modify_objects(callable)

Modify all objects in the geometry tree.

validate()

Check if the object is complete and ready for calculations.

Attributes

axes

Names of axes for this geometry.

dims

Number of object's dimensions (int, 2 or 3).

steps

Step info for mesh generation for non-uniform objects.

Descriptions

Method Details

Geometry.get_matching_objects(cond)

Get list of the geometry tree objects matching condition.

This method returns all the objects in the geometry tree that match the specified condition.

Parameters:

cond – Python callable that accepts a geometry object and returns Boolean indicating whether the object should be returned by this method or not.

Returns:

List of objects matching your condition.

Return type:

sequence

Geometry.get_material_field(mesh)

Distribution of materials for a given geometry on a mesh.

This class creates a ‘field’ of material.Material objects and provides getters to easily obtain its properties as Data object.

Parameters:
  • geometry – Geometry for which the materials a retrieved

  • mesh – Mesh at which the parameters are retrieved

Example

>>> material_field = this_geometry.get_material_field(your_mesh)
>>> plot_field(material_field.thermk(300.), comp=0)
Geometry.get_role_objects(role)

Get list of the geometry tree objects that have the specified role.

This method returns all the objects in the geometry tree that have the specified role.

Warning

This method will return the very object with the role specified and not its items, which is against the normal behavior of the roles.

Parameters:

role (str) – Role to search objects with.

Returns:

List of objects matching your condition.

Return type:

sequence

Geometry.modify_objects(callable)

Modify all objects in the geometry tree.

This method calls callable on every object in the geometry tree. The callable takes a single geometry object as an argument and should return None (in which case nothing happens), a new object to replace the original one, or an empty tuple (which will result in the removal of the original object).

Parameters:

callable – a callable filtering each object in the tree

Returns:

modified geometry

Return type:

GeometryObject

Geometry.validate()

Check if the object is complete and ready for calculations.

This method is specific for a particular object. It raises an exception if the object definition is somehow incomplete.

Attribute Details

Geometry.axes = <property object>

Names of axes for this geometry.

Geometry.dims = <property object>

Number of object’s dimensions (int, 2 or 3).

Geometry.steps = <property object>

Step info for mesh generation for non-uniform objects.

This parameter is considered only for the non-uniform leafs in the geometry tree. It has two attributes that can be changed:

num

Maximum number of the mesh steps in each direction the object is divided into.

dist

Minimum step size.

The exact meaning of these attributes depend on the mesh generator, however in general they indicate how densely should the non-uniform object be subdivided.

It is possible to assign simply an integer number to this parameter, in which case it changes its num attribute.