Wrapper class that represents a point of any supported coordinate system and dimension.
Define a new point specifying its coordinate system, dimension and, optionally, coordinates.
Return the coordinate system tag of the point as seen in viennagrid.config.
If the requested attribute is not present in this class, try to get it from the low-level point class. This serves the purpose of calling the methods for coordinate system conversion and norm computation:
Please, notice that not of all these methods are present in all point classes, but only the applicable ones. Refer to the API reference of viennagrid.wrapper for more information on what methods each low-level class provides.
Wrapper class that represents a domain of any supported domain configuration.
Create a new domain with the given configuration.
Parameters: | config (viennagrid.config.Configuration) – Configuration on which the new domain should be based. |
---|
Return the configuration object of this domain (instance of viennagrid.config.Configuration).
Return an object that allows you to access the list of all vertices contained in the domain.
This object provides the following methods:
This returns a Python list containing all the vertices of the domain, in ascending order of indices:
vertex_list = domain.vertices()
This allows you to get the number of vertices in the domain as though it were a Python list:
num_vertices = len(domain.vertices)
This allows you to get an iterator over the vertices of the domain like this:
iterator = iter(domain.vertices)
This allows you to access each vertex by its index using bracket notation:
v0 = domain.vertices[0]
Return an object that allows you to access the list of all cells contained in the domain.
This object provides the following methods:
This returns a Python list containing all the cells of the domain, in ascending order of indices:
cell_list = domain.cells()
This allows you to get the number of cells in the domain as though it were a Python list:
num_cells = len(domain.cells)
This allows you to get an iterator over the cells of the domain like this:
iterator = iter(domain.cells)
This allows you to access each cell by its index using bracket notation:
s0 = domain.cells[0]
Create a new vertex in the domain with the coordinates of the given point. This method doesn’t return the newly created vertex.
The point and its coordinates will be copied, the point will not be referenced itself.
Parameters: | point (viennagrid.Point) – Point on which to base the vertex. |
---|
Create a new cell in the domain and return it.
As positional parameters you must pass as many vertices (Vertex objects) as needed to define a cell of the type and dimension of the domain.
Returns: | A Cell object — the newly created cell |
---|
Return a generator object to iterate over all the vertices contained in the domain.
Returns: | A generator over all the vertices of the domain |
---|
Wrapper class that represents a segmentation of a wrapped domain.
Create a new segmentation of the given domain.
Parameters: | domain (viennagrid.Domain) – Domain on which to base the segmentation. |
---|
Return an object that allows you to access the list of all segments contained in the segmentation.
This object provides the following methods:
This returns a Python list containing all the segments of the segmentation, in ascending order of indices:
segment_list = segmentation.segments()
This allows you to get the number of segments in the segmentation as though it were a Python list:
num_segments = len(segmentation.segments)
This allows you to get an iterator over the segments of the segmentation like this:
iterator = iter(segmentation.segments)
This allows you to access each segment by its index using bracket notation:
s0 = segmentation.segments[0]
Create a new segment in the segmentation and return it.
Returns: | A Segment object — the newly created segment |
---|
Return a generator object to iterate over all the segments contained in the segmentation.
Returns: | A generator over all the segments of the segmentation |
---|
Wrapper class that represents a segment contained in a segmentation.
Create a new segment based on the given low-level ViennaGrid segment.
Parameters: | segment (Low-level segment type from viennagrid.wrapper) – Low-level ViennaGrid segment to be wrapped in this high-level object. |
---|
Return an object that allows you to access the list of all cells contained in the segment.
This object provides the following methods:
This returns a Python list containing all the cells of the segment, in ascending order of indices:
cell_list = segment.cells()
This allows you to get the number of cells in the segment as though it were a Python list:
num_cells = len(segment.cells)
This allows you to get an iterator over the cells of the segment like this:
iterator = iter(segment.cells)
This allows you to access each cell by its index using bracket notation:
s0 = segment.cells[0]
Create a new cell in the segment and return it.
As positional parameters you must pass as many vertices (Vertex objects) as needed to define a cell of the type and dimension of the domain.
Returns: | A Cell object — the newly created cell |
---|
Return a generator object to iterate over all the cells contained in the segment.
Returns: | A generator over all the cells of the segment |
---|
Wrapper class that represents a cell.
Create a new cell based on the given low-level ViennaGrid cell.
Parameters: | cell (Low-level cell type from viennagrid.wrapper) – Low-level ViennaGrid cell to be wrapped in this high-level object. |
---|
Return an object that allows you to access the list of all vertices that form the cell.
This object provides the following methods:
This returns a Python list containing all the vertices of the cell, in ascending order of indices:
vertex_list = cell.vertices()
This allows you to get the number of vertices in the cell as though it were a Python list:
num_vertices = len(cell.vertices)
This allows you to get an iterator over the vertices of the cell like this:
iterator = iter(cell.vertices)
This allows you to access each vertex by its index using bracket notation:
s0 = cell.vertices[0]
Return a generator object to iterate over all the vertices that form the cell.
Returns: | A generator over all the vertices of the cell |
---|
Wrapper class that represents a vertex.
Create a new vertex based on the given low-level ViennaGrid vertex.
Parameters: | vertex (Low-level vertex type from viennagrid.wrapper) – Low-level ViennaGrid vertex to be wrapped in this high-level object. |
---|
Convert this vertex to a point.
Returns: | viennagrid.Point |
---|
Wrapper class that represents a facet of a cell.
Create a new facet based on the given low-level ViennaGrid facet.
Parameters: | facet (Low-level facet type from viennagrid.wrapper) – Low-level ViennaGrid facet to be wrapped in this high-level object. |
---|
Wrapper class that represents an edge of a cell.
Create a new edge based on the given low-level ViennaGrid edge.
Parameters: | edge (Low-level edge type from viennagrid.wrapper) – Low-level ViennaGrid edge to be wrapped in this high-level object. |
---|
This class stores the necessary information to characterize the configuration of a domain:
and provides useful functions for retrieving the appropriate types for points, domains and segmentations.
Return appropriate domain type based on this configuration
Returns: | Low-level domain type |
---|
Create a new low-level (viennagrid.wrapper) accessor or field based on this configuration.
Parameters: | domain (A domain class from viennagrid.wrapper which matches this configuration class) – Domain on which to base the segmentation. |
---|---|
Returns: | Low-level accessors or field |
Create a new low-level (viennagrid.wrapper) domain based on this configuration
Returns: | Low-level domain |
---|
Create a new low-level (viennagrid.wrapper) point based on this configuration
As arguments you can pass the coordinates of the point to create, or nothing at all. If you specify the coordinates of the point, the number of arguments must match the dimension of the space (i.e. the number of coordinates that the are needed to describe the location of the point in the space).
Returns: | Low-level point |
---|
Create a new low-level (viennagrid.wrapper) segmentation based on this configuration.
Parameters: | domain (A domain class from viennagrid.wrapper which matches this configuration class) – Domain on which to base the segmentation. |
---|---|
Returns: | Low-level segmentation |
Return the data type used for number representation (this is always the string ‘double’).
String that identifies the cartesian coordinate system. Its value is the string ‘cartesian’.
String that identifies the polar coordinate system. Its value is the string ‘polar’.
String that identifies the spherical coordinate system. Its value is the string ‘spherical’.
String that identifies the cylindrical coordinate system. Its value is the string ‘cylindrical’.
Tuple that contains all the supported coordinate system tags. The definition is as follows.
COORD_SYSTEM_TAGS = (CARTESIAN, POLAR, SPHERICAL, CYLINDRICAL)
Dictionary where the key is a coordinate system tag and the value is a tuple containing all supported dimensions for the given coordinate system. The definition is as follows.
SUPPORTED_DIMENSIONS = {
CARTESIAN: (1, 2, 3),
CYLINDRICAL: (3,),
POLAR: (2,),
SPHERICAL: (3,),
}
String that identifies the given cell. Its value is the string ‘linear’.
String that identifies the given cell. Its value is the string ‘triangular’.
String that identifies the given cell. Its value is the string ‘tetrahedral’.
String that identifies the given cell. Its value is the string ‘quadrilateral’.
String that identifies the given cell. Its value is the string ‘hexahedral’.
Tuple that contains all the supported cell tags. The definition is as follows.
CELL_TAGS = (LINE_TAG, TRIANGLE_TAG, TETRAHEDRON_TAG, QUADRILATERAL_TAG, HEXAHEDRON_TAG)
Instance of class Configuration that holds the configuration of a linear domain of cartesian 1D points. This is exactly the same as:
Configuration(LINE_TAG, CARTESIAN, 1)
Instance of class Configuration that holds the configuration of a linear domain of cartesian 2D points. This is exactly the same as:
Configuration(LINE_TAG, CARTESIAN, 2)
Instance of class Configuration that holds the configuration of a linear domain of cartesian 3D points. This is exactly the same as:
Configuration(LINE_TAG, CARTESIAN, 3)
Instance of class Configuration that holds the configuration of a triangular domain of cartesian 2D points. This is exactly the same as:
Configuration(TRIANGLE_TAG, CARTESIAN, 2)
Instance of class Configuration that holds the configuration of a triangular domain of cartesian 3D points. This is exactly the same as:
Configuration(TRIANGLE_TAG, CARTESIAN, 3)
Instance of class Configuration that holds the configuration of a tetrahedral domain of cartesian 3D points. This is exactly the same as:
Configuration(TETRAHEDRON_TAG, CARTESIAN, 3)
Instance of class Configuration that holds the configuration of a quadrilateral domain of cartesian 2D points. This is exactly the same as:
Configuration(QUADRILATERAL_TAG, CARTESIAN, 2)
Instance of class Configuration that holds the configuration of a quadrilateral domain of cartesian 3D points. This is exactly the same as:
Configuration(QUADRILATERAL_TAG, CARTESIAN, 3)
Instance of class Configuration that holds the configuration of a hexahedral domain of cartesian 3D points. This is exactly the same as:
Configuration(HEXAHEDRON_TAG, CARTESIAN, 3)
Compute Voronoi information of the given domain.
Parameters: | dom (viennagrid.Domain) – Domain |
---|---|
Raises : | TypeError |
Refine all cells of the given domain and segmentation which match a given predicate.
Parameters: |
|
---|---|
Returns: | A two-element tuple containing the output domain and segmentation after the refinement. |
Raises : | TypeError |
Compute the centroid of the given cell.
Parameters: | cell (viennagrid.Cell) – Cell whose centroid should be computed |
---|---|
Returns: | viennagrid.Point — the centroid of the cell |
Raises : | TypeError |
Compute the circumcenter of the given cell.
Parameters: | cell (viennagrid.Cell) – Cell whose circumcenter should be computed |
---|---|
Returns: | viennagrid.Point — the circumcenter of the cell |
Raises : | TypeError |
Compute the cross product of two vectors (represented by points).
Parameters: |
|
---|---|
Returns: | viennagrid.Point — the result of the cross product |
Raises : | TypeError |
Compute the inner product of two vectors (represented by points).
Parameters: |
|
---|---|
Returns: | float — the result of the inner product |
Raises : | TypeError |
Check if the given element is a boundary element of the given domain or segment.
Parameters: |
|
---|---|
Returns: | bool — True if the given element is a boundary element of the given domain or segment; False otherwise. |
Raises : | TypeError |
Check if the given element is an interface element of the two given segments.
Parameters: |
|
---|---|
Returns: | bool — True if the given element is an interface element of the given segments; False otherwise. |
Raises : | TypeError |
Compute the norm of a vector (represented by a point).
Parameters: |
|
---|---|
Returns: | float — the norm of the vector |
Raises : | ValueError, TypeError |
Refine all edges of the given domain and segmentation which match a given predicate.
Parameters: |
|
---|---|
Returns: | A two-element tuple containing the output domain and segmentation after the refinement. |
Raises : | TypeError |
Refine all edges of the given domain and segmentation.
Parameters: |
|
---|---|
Returns: | A two-element tuple containing the output domain and segmentation after the refinement. |
Raises : | TypeError |
Scale a domain by a given factor.
Parameters: |
|
---|---|
Raises : | TypeError |
Calculate the volume spanned by a set of points.
As arguments you have to pass an arbitrary number of points (viennagrid.Point objects).
Returns: | float — the volume spanned by the set of points |
---|---|
Raises : | TypeError |
Calculate the surface of the given element.
Parameters: | elem (viennagrid.Cell, viennagrid.Domain or viennagrid.Segment) – Element whose surface should be calculated. |
---|---|
Returns: | float — the surface of the cell, domain or segment |
Raises : | TypeError |
Calculate the volume of the given element.
Parameters: | elem (viennagrid.Cell, viennagrid.Domain or viennagrid.Segment) – Element whose volume should be calculated. |
---|---|
Returns: | float — the volume of the cell, domain or segment |
Raises : | TypeError |
Exception raised when the mesh file is not well-formatted and hence cannot be read.
Read mesh data from a Netgen file and save the read domain data into the given domain. If a segmentation is provided, also save segmentation data into the given segmentation.
Parameters: |
|
---|---|
Raises : | IOError, BadFileFormatError, TypeError |
Read mesh data from a VTK file and save the read domain data into the given domain. If a segmentation is provided, also save segmentation data into the given segmentation.
Parameters: |
|
---|---|
Raises : | IOError, BadFileFormatError, TypeError |
Write mesh data from the given domain to an OpenDX file.
Parameters: |
|
---|---|
Raises : | IOError, BadFileFormatError, TypeError |
Write mesh data from the given domain to a VTK file. If a segmentation is provided, also write the segmentation data to the file.
Parameters: |
|
---|---|
Raises : | IOError, BadFileFormatError, TypeError |
Wrapper class that represents an accessor for vertices or cells.
Get the value corresponding to the element (vertex or cell) associated with the accessor.
Parameters: | elem (viennagrid.Vertex or viennagrid.Cell (or any vertex or cell type from viennagrid.wrapper)) – the vertex or cell whose value should be returned |
---|---|
Returns: | float — the value corresponding to the element |
Set the value corresponding to the element (vertex or cell) associated with the accessor.
Parameters: |
|
---|
Wrapper class that represents a field accessor for vertices or cells.
Get the value corresponding to the element (vertex or cell) associated with the field accessor.
Parameters: | elem (viennagrid.Vertex or viennagrid.Cell (or any vertex or cell type from viennagrid.wrapper)) – the vertex or cell whose value should be returned |
---|---|
Returns: | float — the value corresponding to the element |
Set the value corresponding to the element (vertex or cell) associated with the field accessor.
Parameters: |
|
---|