ddg.datastructures.indexedfaceset.ifs module
Module ‘ifs’ defines the indexed face set
- class ddg.datastructures.indexedfaceset.ifs.GeneralizedIndexedFaceSet(faces=[])[source]
Bases:
objectImplementation of a combinatorial indexed face set data structure with a list of faces and some utility functions.
- Parameters:
- faces: list
List of face tuples that will generate the indexed face set.
- set_attribute(attr_name, cell_type, attribute, cell_subset=None)[source]
Method to add attributes to cells of an ifs. If the attribute already exists, it changes it. If only a subset is specified, it only updates the subset values.
- Parameters:
- cell_type: str
Type of cell to which the attribute must be added
- attr_namestr
Name of the attribute
- attributeSubscriptable object
A subscriptable object of the attributes to be assigned to each vertex
- cell_subset: set or list depending on the cell type
if the cells in question are not the whole cells of the ifs but a subset of it, they must be given as input in this parameter
- Returns:
- dict
A nested dictionary of all attributes of vertices
- delete_attribute(attr_name, cell_type)[source]
Deletes the attribute given by its name
- Parameters:
- attr_namestr
Name of the attribute
- cell_type: str
Type of cell to which the attribute must be added
- get_attribute(attr_name, cell_type, cell)[source]
get cell attribute
- Parameters:
- attr_namestr
Name of the attribute. Represents keys for the attribute dictionaries
- cell_typestr
Type of cell from which the attribute is to be retrieved
- cellfloat or int for verts, tuples for edges and faces
The cell to which the attribute is assigned. Type depends on the type of the inputs given to create the class.
- Returns:
- The attribute in the specified position. Type depends on the attribute type.
- adjacent_faces_with_orientation(edge)[source]
Get a list of oriented faces adjacent to an given edge.
The resulting faces are of the class OrientedFace with self.orientation = 1 if they contain the edge in the given orientation or self.orientation = -1 if they contain the edge in reversed orientation.
- Parameters:
- edgetuple
Tuple of two integers.
- Returns:
- list
List of instances of the class OrientedFace that are adjacent to the input edge.
- adjacent_faces(edge)[source]
Get a list of faces, i.e. tuples adjacent to an given edge.
- Parameters:
- edgetuple
Tuple of two integers.
- Returns:
- list
List of tuples that represent all adjacent faces despite of orientation.
- opposite_face(face, edge)[source]
Get the other face adjacent to a given edge of a face.
If the edge is adjacent to only one or more than two faces return None.
- Parameters:
- edgetuple
Tuple of two integers.
- facetuple
The input face incuding the edge from which the other face will be determined.
- Returns:
- tuple
The other face incident to the given edge.
- None
If edge is adjacent to only one or more than two faces.
- opposite_face_with_orientation(face, edge)[source]
Get the other oriented face adjacent to a given edge of a face.
If the edge is adjacent to only one or more than two faces return None.
- Parameters:
- edgetuple
Tuple of two integers.
- facetuple
The input face incuding the edge from which the other face will be determined.
- Returns:
- OrientedFace
The other face incident to the given edge.
- NoneFace
If edge is adjacent to only one or more than two faces.
- neighboring_faces(face)[source]
Get all faces that are adjacent to a given a face.
If an edge has none or more than one other neighbouring faces, None will be returned.
- Parameters:
- facetuple
The input face whose neighbouring faces will be determined.
- Returns:
- list
List of neighbouring faces in cyclic order. ..Includes ..tuple ..If there exist exactly one neighbouring face to an edge. ..None ..If edge is adjacent to only one or more than two faces. ..
- neighboring_faces_with_orientation(face)[source]
Get all oriented faces that are adjacent to a given a face.
If an edge has none or more than one other neighbouring faces, None will be returned.
- Parameters:
- facetuple
The input face whose neighbouring faces will be determined.
- Returns:
- list
List of neighbouring faces in cyclic order. ..Includes ..OrientedFace ..If there exist exactly one neighbouring face to an edge. ..NoneFace ..If edge is adjacent to only one or more than two faces. ..
- face_list()[source]
Get all faces of the indexed face set.
- Returns:
- list
List of tuples representing the faces of the indexed face set.
- number_of_faces()[source]
Get the number of faces of the indexed face set.
- Returns:
- int
Number of faces of the indexed face set.
- edge_set()[source]
Get all edges of the indexed face set.
- Returns:
- set
Unordered set of tuples of two integers representing all edges.
- face_boundary(face)[source]
Returns a set of edges bounding the face.
The edges are tuples orded by the orientation of the face.
- Parameters:
- facetuple
The face to be investigated.
- Returns:
- tuple
tuple with ordered edge tuples
Examples
>>> from ddg.datastructures.indexedfaceset.ifs import GeneralizedIndexedFaceSet >>> faceSet = GeneralizedIndexedFaceSet([(1, 2, 4), (2, 3, 4)]) >>> faceSet.face_boundary((1, 2, 4)) ((1, 2), (2, 4), (4, 1))
- class ddg.datastructures.indexedfaceset.ifs.OrientedIndexedFaceSet(face_list=[])[source]
Bases:
GeneralizedIndexedFaceSet- adjacent_faces(edge)[source]
Get a list of faces adjacent to an edge given as a tuple of integers. The faces are ordered such that they contain the given edge in the given orientation.
- add_face(face)[source]
Adds face to the indexed face set.
Simply adds the face without paying attention to the maifold property.
- Parameters:
- facetuple
The face to be investigated.
- adjacent_faces_with_orientation(edge)
Get a list of oriented faces adjacent to an given edge.
The resulting faces are of the class OrientedFace with self.orientation = 1 if they contain the edge in the given orientation or self.orientation = -1 if they contain the edge in reversed orientation.
- Parameters:
- edgetuple
Tuple of two integers.
- Returns:
- list
List of instances of the class OrientedFace that are adjacent to the input edge.
- delete_attribute(attr_name, cell_type)
Deletes the attribute given by its name
- Parameters:
- attr_namestr
Name of the attribute
- cell_type: str
Type of cell to which the attribute must be added
- edge_set()
Get all edges of the indexed face set.
- Returns:
- set
Unordered set of tuples of two integers representing all edges.
- face_boundary(face)
Returns a set of edges bounding the face.
The edges are tuples orded by the orientation of the face.
- Parameters:
- facetuple
The face to be investigated.
- Returns:
- tuple
tuple with ordered edge tuples
Examples
>>> from ddg.datastructures.indexedfaceset.ifs import GeneralizedIndexedFaceSet >>> faceSet = GeneralizedIndexedFaceSet([(1, 2, 4), (2, 3, 4)]) >>> faceSet.face_boundary((1, 2, 4)) ((1, 2), (2, 4), (4, 1))
- face_list()
Get all faces of the indexed face set.
- Returns:
- list
List of tuples representing the faces of the indexed face set.
- get_attribute(attr_name, cell_type, cell)
get cell attribute
- Parameters:
- attr_namestr
Name of the attribute. Represents keys for the attribute dictionaries
- cell_typestr
Type of cell from which the attribute is to be retrieved
- cellfloat or int for verts, tuples for edges and faces
The cell to which the attribute is assigned. Type depends on the type of the inputs given to create the class.
- Returns:
- The attribute in the specified position. Type depends on the attribute type.
- get_vertex_set()
Returns the set of vertices of an indexed face set
- neighboring_faces(face)
Get all faces that are adjacent to a given a face.
If an edge has none or more than one other neighbouring faces, None will be returned.
- Parameters:
- facetuple
The input face whose neighbouring faces will be determined.
- Returns:
- list
List of neighbouring faces in cyclic order. ..Includes ..tuple ..If there exist exactly one neighbouring face to an edge. ..None ..If edge is adjacent to only one or more than two faces. ..
- neighboring_faces_with_orientation(face)
Get all oriented faces that are adjacent to a given a face.
If an edge has none or more than one other neighbouring faces, None will be returned.
- Parameters:
- facetuple
The input face whose neighbouring faces will be determined.
- Returns:
- list
List of neighbouring faces in cyclic order. ..Includes ..OrientedFace ..If there exist exactly one neighbouring face to an edge. ..NoneFace ..If edge is adjacent to only one or more than two faces. ..
- number_of_faces()
Get the number of faces of the indexed face set.
- Returns:
- int
Number of faces of the indexed face set.
- opposite_face(face, edge)
Get the other face adjacent to a given edge of a face.
If the edge is adjacent to only one or more than two faces return None.
- Parameters:
- edgetuple
Tuple of two integers.
- facetuple
The input face incuding the edge from which the other face will be determined.
- Returns:
- tuple
The other face incident to the given edge.
- None
If edge is adjacent to only one or more than two faces.
- opposite_face_with_orientation(face, edge)
Get the other oriented face adjacent to a given edge of a face.
If the edge is adjacent to only one or more than two faces return None.
- Parameters:
- edgetuple
Tuple of two integers.
- facetuple
The input face incuding the edge from which the other face will be determined.
- Returns:
- OrientedFace
The other face incident to the given edge.
- NoneFace
If edge is adjacent to only one or more than two faces.
- set_attribute(attr_name, cell_type, attribute, cell_subset=None)
Method to add attributes to cells of an ifs. If the attribute already exists, it changes it. If only a subset is specified, it only updates the subset values.
- Parameters:
- cell_type: str
Type of cell to which the attribute must be added
- attr_namestr
Name of the attribute
- attributeSubscriptable object
A subscriptable object of the attributes to be assigned to each vertex
- cell_subset: set or list depending on the cell type
if the cells in question are not the whole cells of the ifs but a subset of it, they must be given as input in this parameter
- Returns:
- dict
A nested dictionary of all attributes of vertices
- class ddg.datastructures.indexedfaceset.ifs.OrientedFace(index_tuple, orientation=1)[source]
Bases:
object
- class ddg.datastructures.indexedfaceset.ifs.IndexedFaceSet(faces=[])[source]
Bases:
GeneralizedIndexedFaceSetAn indexed face set whose vertices must be integers of indices 0 to n-1 only. The attributes of cells for this class are also restricted to numpy arrays only.
- cell_index(cell_type, cell)[source]
Method to get the index of the given cell. Vertices are already indices. Mostly used to get the cell of edges and faces
- Parameters:
- cell_typestr
type of cells to be indiced. “verts”, “edges” or “faces” are the proper values.
- cellint for verts, tuples for edges and faces
the cell to be indiced.
- Returns:
- The index of the cell
- get_attribute(attr_name, cell_type, cell)[source]
‘Get’ method corresponding the attribute structure of the subclass to override the same method in the parent class
- Parameters:
- cell_typestr
Type of cell from which the attribute are to be recalled
- cell_typestr
Type of cell from which the attribute is to be retrieved
- cellint for verts, int or tuples for edges and faces
The cell or its index. For vertices, these two are the same. For edges and faces these are different. Both form are accepted.
- Returns:
- numpy.ndarray
The attribute in the specified position.
- set_attribute(attr_name, cell_type, attribute, dtype=<class 'float'>)[source]
Method to create a dictionary of attributes for a given cell type.
- Parameters:
- attr_namestr
Name of the attribute to get in string
- attributenp.ndarray
An array of the attributes to be set
- Returns:
- Attribute dictionary
- edge_vertex_list(vertex_index)[source]
Method to find the edges which share a specific vertex.
- Parameters:
- vertex_indexint
The index of the vertex to be found (0,…, n-1)
- Returns:
- numpy.ndarray
2D array of edges as tuples
- face_vertex_list(vertex_index)[source]
Method to find the faces which share a specific vertex
- Parameters:
- vertex_indexint
The index of the vertex to be found (0,…, n-1)
- Returns:
- numpy.ndarray
returns indices of faces
- face_vertex_dict(vertex_index)[source]
Method to create a dictionary which has as values the arrays of faces with which they share a specific vertex and as keys the number of edges of the faces
- Parameters:
- vertex_indexint
The index of the vertex to be found (0,…, n-1)
- Returns:
- dict
Keys : the number of edges of faces Values : thoses faces with the key number of edges which share the input vertex
- face_edge_list(edge_index)[source]
Method to find the faces which share a specific edge
- Parameters:
- edge_indexint
The index of the edge
- Returns:
- numpy.ndarray
For non-uniform meshes the return value is a 1D array of faces as tuples For uniform meshes the return value is a 2D array
- is_boundary_vertex(vertex_index)[source]
checks if a vertex is a boundary vertex or not
- Parameters:
- vertex_index1D list or array
the index of the vertex in question
- Returns:
- True if the the vertex is a boundary vertex, otherwise False
- property boundary_vertices
Method to create a set of boundary vertices of the ifs
- add_face(face)
Adds face to the indexed face set.
Simply adds the face without paying attention to the maifold property.
- Parameters:
- facetuple
The face to be investigated.
- adjacent_faces(edge)
Get a list of faces, i.e. tuples adjacent to an given edge.
- Parameters:
- edgetuple
Tuple of two integers.
- Returns:
- list
List of tuples that represent all adjacent faces despite of orientation.
- adjacent_faces_with_orientation(edge)
Get a list of oriented faces adjacent to an given edge.
The resulting faces are of the class OrientedFace with self.orientation = 1 if they contain the edge in the given orientation or self.orientation = -1 if they contain the edge in reversed orientation.
- Parameters:
- edgetuple
Tuple of two integers.
- Returns:
- list
List of instances of the class OrientedFace that are adjacent to the input edge.
- delete_attribute(attr_name, cell_type)
Deletes the attribute given by its name
- Parameters:
- attr_namestr
Name of the attribute
- cell_type: str
Type of cell to which the attribute must be added
- edge_set()
Get all edges of the indexed face set.
- Returns:
- set
Unordered set of tuples of two integers representing all edges.
- face_boundary(face)
Returns a set of edges bounding the face.
The edges are tuples orded by the orientation of the face.
- Parameters:
- facetuple
The face to be investigated.
- Returns:
- tuple
tuple with ordered edge tuples
Examples
>>> from ddg.datastructures.indexedfaceset.ifs import GeneralizedIndexedFaceSet >>> faceSet = GeneralizedIndexedFaceSet([(1, 2, 4), (2, 3, 4)]) >>> faceSet.face_boundary((1, 2, 4)) ((1, 2), (2, 4), (4, 1))
- face_list()
Get all faces of the indexed face set.
- Returns:
- list
List of tuples representing the faces of the indexed face set.
- get_vertex_set()
Returns the set of vertices of an indexed face set
- neighboring_faces(face)
Get all faces that are adjacent to a given a face.
If an edge has none or more than one other neighbouring faces, None will be returned.
- Parameters:
- facetuple
The input face whose neighbouring faces will be determined.
- Returns:
- list
List of neighbouring faces in cyclic order. ..Includes ..tuple ..If there exist exactly one neighbouring face to an edge. ..None ..If edge is adjacent to only one or more than two faces. ..
- neighboring_faces_with_orientation(face)
Get all oriented faces that are adjacent to a given a face.
If an edge has none or more than one other neighbouring faces, None will be returned.
- Parameters:
- facetuple
The input face whose neighbouring faces will be determined.
- Returns:
- list
List of neighbouring faces in cyclic order. ..Includes ..OrientedFace ..If there exist exactly one neighbouring face to an edge. ..NoneFace ..If edge is adjacent to only one or more than two faces. ..
- number_of_faces()
Get the number of faces of the indexed face set.
- Returns:
- int
Number of faces of the indexed face set.
- opposite_face(face, edge)
Get the other face adjacent to a given edge of a face.
If the edge is adjacent to only one or more than two faces return None.
- Parameters:
- edgetuple
Tuple of two integers.
- facetuple
The input face incuding the edge from which the other face will be determined.
- Returns:
- tuple
The other face incident to the given edge.
- None
If edge is adjacent to only one or more than two faces.
- opposite_face_with_orientation(face, edge)
Get the other oriented face adjacent to a given edge of a face.
If the edge is adjacent to only one or more than two faces return None.
- Parameters:
- edgetuple
Tuple of two integers.
- facetuple
The input face incuding the edge from which the other face will be determined.
- Returns:
- OrientedFace
The other face incident to the given edge.
- NoneFace
If edge is adjacent to only one or more than two faces.
- class ddg.datastructures.indexedfaceset.ifs.NgonalIndexedFaceSet(faces=array([], dtype=float64))[source]
Bases:
IndexedFaceSetAn indexed face set whose faces are of constant valency of k.
- face_vertex_array(vertex_index)[source]
Method to find the faces which share a specific vertex. Overrides the method in parent class.
- Parameters:
- vertex_indexint
The index of the vertex to be found (0,…, n-1)
- Returns:
- numpy.ndarray
returns indices of faces
- face_vertex_incidence()[source]
Method to create the valencies.
- Returns:
- list
the list of valencies in the same order of vertex index
- face_edge_incidence()[source]
Method to create the valency for edge-face.
- Returns:
- list
the list of face-edge-valency in the same order of edge index
- add_face(face)
Adds face to the indexed face set.
Simply adds the face without paying attention to the maifold property.
- Parameters:
- facetuple
The face to be investigated.
- adjacent_faces(edge)
Get a list of faces, i.e. tuples adjacent to an given edge.
- Parameters:
- edgetuple
Tuple of two integers.
- Returns:
- list
List of tuples that represent all adjacent faces despite of orientation.
- adjacent_faces_with_orientation(edge)
Get a list of oriented faces adjacent to an given edge.
The resulting faces are of the class OrientedFace with self.orientation = 1 if they contain the edge in the given orientation or self.orientation = -1 if they contain the edge in reversed orientation.
- Parameters:
- edgetuple
Tuple of two integers.
- Returns:
- list
List of instances of the class OrientedFace that are adjacent to the input edge.
- property boundary_vertices
Method to create a set of boundary vertices of the ifs
- cell_index(cell_type, cell)
Method to get the index of the given cell. Vertices are already indices. Mostly used to get the cell of edges and faces
- Parameters:
- cell_typestr
type of cells to be indiced. “verts”, “edges” or “faces” are the proper values.
- cellint for verts, tuples for edges and faces
the cell to be indiced.
- Returns:
- The index of the cell
- delete_attribute(attr_name, cell_type)
Deletes the attribute given by its name
- Parameters:
- attr_namestr
Name of the attribute
- cell_type: str
Type of cell to which the attribute must be added
- edge_set()
Get all edges of the indexed face set.
- Returns:
- set
Unordered set of tuples of two integers representing all edges.
- edge_vertex_list(vertex_index)
Method to find the edges which share a specific vertex.
- Parameters:
- vertex_indexint
The index of the vertex to be found (0,…, n-1)
- Returns:
- numpy.ndarray
2D array of edges as tuples
- face_boundary(face)
Returns a set of edges bounding the face.
The edges are tuples orded by the orientation of the face.
- Parameters:
- facetuple
The face to be investigated.
- Returns:
- tuple
tuple with ordered edge tuples
Examples
>>> from ddg.datastructures.indexedfaceset.ifs import GeneralizedIndexedFaceSet >>> faceSet = GeneralizedIndexedFaceSet([(1, 2, 4), (2, 3, 4)]) >>> faceSet.face_boundary((1, 2, 4)) ((1, 2), (2, 4), (4, 1))
- face_edge_list(edge_index)
Method to find the faces which share a specific edge
- Parameters:
- edge_indexint
The index of the edge
- Returns:
- numpy.ndarray
For non-uniform meshes the return value is a 1D array of faces as tuples For uniform meshes the return value is a 2D array
- face_list()
Get all faces of the indexed face set.
- Returns:
- list
List of tuples representing the faces of the indexed face set.
- face_vertex_dict(vertex_index)
Method to create a dictionary which has as values the arrays of faces with which they share a specific vertex and as keys the number of edges of the faces
- Parameters:
- vertex_indexint
The index of the vertex to be found (0,…, n-1)
- Returns:
- dict
Keys : the number of edges of faces Values : thoses faces with the key number of edges which share the input vertex
- face_vertex_list(vertex_index)
Method to find the faces which share a specific vertex
- Parameters:
- vertex_indexint
The index of the vertex to be found (0,…, n-1)
- Returns:
- numpy.ndarray
returns indices of faces
- get_attribute(attr_name, cell_type, cell)
‘Get’ method corresponding the attribute structure of the subclass to override the same method in the parent class
- Parameters:
- cell_typestr
Type of cell from which the attribute are to be recalled
- cell_typestr
Type of cell from which the attribute is to be retrieved
- cellint for verts, int or tuples for edges and faces
The cell or its index. For vertices, these two are the same. For edges and faces these are different. Both form are accepted.
- Returns:
- numpy.ndarray
The attribute in the specified position.
- get_vertex_set()
Returns the set of vertices of an indexed face set
- is_boundary_vertex(vertex_index)
checks if a vertex is a boundary vertex or not
- Parameters:
- vertex_index1D list or array
the index of the vertex in question
- Returns:
- True if the the vertex is a boundary vertex, otherwise False
- neighboring_faces(face)
Get all faces that are adjacent to a given a face.
If an edge has none or more than one other neighbouring faces, None will be returned.
- Parameters:
- facetuple
The input face whose neighbouring faces will be determined.
- Returns:
- list
List of neighbouring faces in cyclic order. ..Includes ..tuple ..If there exist exactly one neighbouring face to an edge. ..None ..If edge is adjacent to only one or more than two faces. ..
- neighboring_faces_with_orientation(face)
Get all oriented faces that are adjacent to a given a face.
If an edge has none or more than one other neighbouring faces, None will be returned.
- Parameters:
- facetuple
The input face whose neighbouring faces will be determined.
- Returns:
- list
List of neighbouring faces in cyclic order. ..Includes ..OrientedFace ..If there exist exactly one neighbouring face to an edge. ..NoneFace ..If edge is adjacent to only one or more than two faces. ..
- number_of_faces()
Get the number of faces of the indexed face set.
- Returns:
- int
Number of faces of the indexed face set.
- opposite_face(face, edge)
Get the other face adjacent to a given edge of a face.
If the edge is adjacent to only one or more than two faces return None.
- Parameters:
- edgetuple
Tuple of two integers.
- facetuple
The input face incuding the edge from which the other face will be determined.
- Returns:
- tuple
The other face incident to the given edge.
- None
If edge is adjacent to only one or more than two faces.
- opposite_face_with_orientation(face, edge)
Get the other oriented face adjacent to a given edge of a face.
If the edge is adjacent to only one or more than two faces return None.
- Parameters:
- edgetuple
Tuple of two integers.
- facetuple
The input face incuding the edge from which the other face will be determined.
- Returns:
- OrientedFace
The other face incident to the given edge.
- NoneFace
If edge is adjacent to only one or more than two faces.
- set_attribute(attr_name, cell_type, attribute, dtype=<class 'float'>)
Method to create a dictionary of attributes for a given cell type.
- Parameters:
- attr_namestr
Name of the attribute to get in string
- attributenp.ndarray
An array of the attributes to be set
- Returns:
- Attribute dictionary
- class ddg.datastructures.indexedfaceset.ifs.Grid(shape, periodicity=None, default_coordinates=False)[source]
Bases:
NgonalIndexedFaceSetA grid of either \(\mathbb{Z}^2\) or \(\mathbb{Z}^3\) combinatorics.
- Parameters:
- shapetuple or list
The shape of the grid. The shape consists of the number of vertices in each axis of the grid.
- periodicitytuple (default=None)
Periodicity of the grid. For more information, see “Attributes”.
- default_coordinatesboolean (default=True)
Indicator for assigining default coordinates to the grid.
- Attributes:
- mint
Number of vertices in the first coordinate direction
- nint
Number of vertices in the second coordinate direction
- lint (default=None)
Number of vertices in the third coordinate direction only in 3D case
- periodicitytuple (default = None)
The periodicity of the grid. This is only meaningful in case of 2D grid. For 3D shape the attribute remains default value which is None.
In the following cases, m and n would be the resolution of vertices on each axis AFTER the gluing. E.g. a cylinder of shape shape glued along the first axis would have 4 vertices around the circle.
Periodicity
Topology
Gluing Axis
(0, 0)
Disk
None
(1, 0)
Cylinder
along the first axis
(0, 1)
Cylinder
along the second axis
(1, 1)
Torus
along both axes
(-1, 0)
Moebius Band
along the first axis in reversed orientation
(0, -1)
Moebius Band
along the second axis in reversed orientation
- add_face(face)
Adds face to the indexed face set.
Simply adds the face without paying attention to the maifold property.
- Parameters:
- facetuple
The face to be investigated.
- adjacent_faces(edge)
Get a list of faces, i.e. tuples adjacent to an given edge.
- Parameters:
- edgetuple
Tuple of two integers.
- Returns:
- list
List of tuples that represent all adjacent faces despite of orientation.
- adjacent_faces_with_orientation(edge)
Get a list of oriented faces adjacent to an given edge.
The resulting faces are of the class OrientedFace with self.orientation = 1 if they contain the edge in the given orientation or self.orientation = -1 if they contain the edge in reversed orientation.
- Parameters:
- edgetuple
Tuple of two integers.
- Returns:
- list
List of instances of the class OrientedFace that are adjacent to the input edge.
- property boundary_vertices
Method to create a set of boundary vertices of the ifs
- cell_index(cell_type, cell)
Method to get the index of the given cell. Vertices are already indices. Mostly used to get the cell of edges and faces
- Parameters:
- cell_typestr
type of cells to be indiced. “verts”, “edges” or “faces” are the proper values.
- cellint for verts, tuples for edges and faces
the cell to be indiced.
- Returns:
- The index of the cell
- delete_attribute(attr_name, cell_type)
Deletes the attribute given by its name
- Parameters:
- attr_namestr
Name of the attribute
- cell_type: str
Type of cell to which the attribute must be added
- edge_set()
Get all edges of the indexed face set.
- Returns:
- set
Unordered set of tuples of two integers representing all edges.
- edge_vertex_list(vertex_index)
Method to find the edges which share a specific vertex.
- Parameters:
- vertex_indexint
The index of the vertex to be found (0,…, n-1)
- Returns:
- numpy.ndarray
2D array of edges as tuples
- face_boundary(face)
Returns a set of edges bounding the face.
The edges are tuples orded by the orientation of the face.
- Parameters:
- facetuple
The face to be investigated.
- Returns:
- tuple
tuple with ordered edge tuples
Examples
>>> from ddg.datastructures.indexedfaceset.ifs import GeneralizedIndexedFaceSet >>> faceSet = GeneralizedIndexedFaceSet([(1, 2, 4), (2, 3, 4)]) >>> faceSet.face_boundary((1, 2, 4)) ((1, 2), (2, 4), (4, 1))
- face_edge_incidence()
Method to create the valency for edge-face.
- Returns:
- list
the list of face-edge-valency in the same order of edge index
- face_edge_list(edge_index)
Method to find the faces which share a specific edge
- Parameters:
- edge_indexint
The index of the edge
- Returns:
- numpy.ndarray
For non-uniform meshes the return value is a 1D array of faces as tuples For uniform meshes the return value is a 2D array
- face_list()
Get all faces of the indexed face set.
- Returns:
- list
List of tuples representing the faces of the indexed face set.
- face_vertex_array(vertex_index)
Method to find the faces which share a specific vertex. Overrides the method in parent class.
- Parameters:
- vertex_indexint
The index of the vertex to be found (0,…, n-1)
- Returns:
- numpy.ndarray
returns indices of faces
- face_vertex_dict(vertex_index)
Method to create a dictionary which has as values the arrays of faces with which they share a specific vertex and as keys the number of edges of the faces
- Parameters:
- vertex_indexint
The index of the vertex to be found (0,…, n-1)
- Returns:
- dict
Keys : the number of edges of faces Values : thoses faces with the key number of edges which share the input vertex
- face_vertex_incidence()
Method to create the valencies.
- Returns:
- list
the list of valencies in the same order of vertex index
- face_vertex_list(vertex_index)
Method to find the faces which share a specific vertex
- Parameters:
- vertex_indexint
The index of the vertex to be found (0,…, n-1)
- Returns:
- numpy.ndarray
returns indices of faces
- get_attribute(attr_name, cell_type, cell)
‘Get’ method corresponding the attribute structure of the subclass to override the same method in the parent class
- Parameters:
- cell_typestr
Type of cell from which the attribute are to be recalled
- cell_typestr
Type of cell from which the attribute is to be retrieved
- cellint for verts, int or tuples for edges and faces
The cell or its index. For vertices, these two are the same. For edges and faces these are different. Both form are accepted.
- Returns:
- numpy.ndarray
The attribute in the specified position.
- get_vertex_set()
Returns the set of vertices of an indexed face set
- is_boundary_vertex(vertex_index)
checks if a vertex is a boundary vertex or not
- Parameters:
- vertex_index1D list or array
the index of the vertex in question
- Returns:
- True if the the vertex is a boundary vertex, otherwise False
- neighboring_faces(face)
Get all faces that are adjacent to a given a face.
If an edge has none or more than one other neighbouring faces, None will be returned.
- Parameters:
- facetuple
The input face whose neighbouring faces will be determined.
- Returns:
- list
List of neighbouring faces in cyclic order. ..Includes ..tuple ..If there exist exactly one neighbouring face to an edge. ..None ..If edge is adjacent to only one or more than two faces. ..
- neighboring_faces_with_orientation(face)
Get all oriented faces that are adjacent to a given a face.
If an edge has none or more than one other neighbouring faces, None will be returned.
- Parameters:
- facetuple
The input face whose neighbouring faces will be determined.
- Returns:
- list
List of neighbouring faces in cyclic order. ..Includes ..OrientedFace ..If there exist exactly one neighbouring face to an edge. ..NoneFace ..If edge is adjacent to only one or more than two faces. ..
- number_of_faces()
Get the number of faces of the indexed face set.
- Returns:
- int
Number of faces of the indexed face set.
- opposite_face(face, edge)
Get the other face adjacent to a given edge of a face.
If the edge is adjacent to only one or more than two faces return None.
- Parameters:
- edgetuple
Tuple of two integers.
- facetuple
The input face incuding the edge from which the other face will be determined.
- Returns:
- tuple
The other face incident to the given edge.
- None
If edge is adjacent to only one or more than two faces.
- opposite_face_with_orientation(face, edge)
Get the other oriented face adjacent to a given edge of a face.
If the edge is adjacent to only one or more than two faces return None.
- Parameters:
- edgetuple
Tuple of two integers.
- facetuple
The input face incuding the edge from which the other face will be determined.
- Returns:
- OrientedFace
The other face incident to the given edge.
- NoneFace
If edge is adjacent to only one or more than two faces.
- set_attribute(attr_name, cell_type, attribute, dtype=<class 'float'>)
Method to create a dictionary of attributes for a given cell type.
- Parameters:
- attr_namestr
Name of the attribute to get in string
- attributenp.ndarray
An array of the attributes to be set
- Returns:
- Attribute dictionary