HalfFace
- class compas.datastructures.HalfFace(name=None, default_vertex_attributes=None, default_edge_attributes=None, default_face_attributes=None, default_cell_attributes=None)[source]
Bases:
compas.datastructures.datastructure.Datastructure
Base half-face data structure fore representing volumetric meshes.
- Parameters
name (str, optional) – The name of the graph. Defaults to “Graph”.
default_vertex_attributes (dict, optional) – Default values for vertex attributes.
default_edge_attributes (dict, optional) – Default values for edge attributes.
default_face_attributes (dict, optional) – Default values for face attributes.
default_cell_attributes (dict, optional) – Default values for cell attributes.
- Attributes
attributes (dict) – Named attributes related to the data structure as a whole.
default_vertex_attributes (dict) – Named attributes and default values of the vertices of the data structure.
default_edge_attributes (dict) – Named attributes and default values of the edges of the data structure.
default_face_attributes (dict) – Named attributes and default values of the faces of the data structure.
name (str) – Name of the data structure. Defaults to the value of self.__class__.__name__.
data (dict) – The data representation of the data structure.
Methods
add_cell
(faces[, ckey, attr_dict])Add a cell to the volmesh object.
add_halfface
(vertices[, fkey, attr_dict])Add a face to the volmesh object.
add_vertex
([key, attr_dict])Add a vertex to the volmesh object.
cell_attribute
(cell, name[, value])Get or set an attribute of a cell.
cell_attributes
(cell[, names, values])Get or set multiple attributes of a cell.
cell_edges
(cell)cell_face_neighbors
(cell, face)cell_faces
(cell)The faces of a cell.
cell_halfedge_face
(cell, halfedge)cell_halfedge_opposite_face
(cell, halfedge)cell_halfedges
(cell)The halfedges of a cell.
cell_neighbors
(cell)cell_vertex_faces
(cell, vertex)Ordered faces connected to a vertex of a cell.
cell_vertex_neighbors
(cell, vertex)Ordered vertex neighbors of a vertex of a cell.
cell_vertices
(cell)The vertices of a cell.
cells
([data])Iterate over the cells of the volmesh.
cells_attribute
(name[, value, cells])Get or set an attribute of multiple cells.
cells_attributes
([names, values, cells])Get or set multiple attributes of multiple cells.
Find the cells on the boundary.
clear
()Clear all the volmesh data.
copy
([cls])Make an independent copy of the data object.
Remove all unused vertices from the volmesh object.
delete_cell
(cell)Delete a cell from the volmesh.
delete_vertex
(vertex)Delete a vertex from the volmesh and everything that is attached to it.
edge_attribute
(edge, name[, value])Get or set an attribute of an edge.
edge_attributes
(edge[, names, values])Get or set multiple attributes of an edge.
edge_cells
(edge)Ordered cells around edge (u, v).
edge_halffaces
(edge)Ordered halffaces around edge (u, v).
edges
([data])Iterate over the edges of the volmesh.
edges_attribute
(name[, value, edges])Get or set an attribute of multiple edges.
edges_attributes
([names, values, edges])Get or set multiple attributes of multiple edges.
face_attribute
(face, name[, value])Get or set an attribute of a face.
face_attributes
(face[, names, values])Get or set multiple attributes of a face.
faces
([data])“Iterate over the halffaces of the volmesh and yield faces.
faces_attribute
(name[, value, faces])Get or set an attribute of multiple faces.
faces_attributes
([names, values, faces])Get or set multiple attributes of multiple faces.
from_data
(data)Construct an object of this type from the provided data.
from_json
(filepath)Construct an object from serialized data contained in a JSON file.
from_jsonstring
(string)Construct an object from serialized data contained in a JSON string.
Get the identifier of a random face.
get_any_face_vertex
(face)Get the identifier of a random vertex of a specific face.
Get the identifier of a random vertex.
halfface_adjacent_halfface
(halfface, halfedge)Return the halfface adjacent to the halfface across the halfedge.
halfface_cell
(halfface)The cell to which the halfface belongs to.
halfface_halfedges
(halfface)The halfedges of a halfface.
halfface_manifold_neighborhood
(hfkey[, ring])Return the halfface neighborhood of a halfface across their edges.
halfface_manifold_neighbors
(halfface)halfface_opposite_cell
(halfface)The cell to which the opposite halfface belongs to.
halfface_opposite_halfface
(halfface)The opposite face of a face.
halfface_vertex_ancestor
(halfface, vertex)Return the vertex before the specified vertex in a specific face.
halfface_vertex_descendent
(halfface, vertex)Return the vertex after the specified vertex in a specific face.
halfface_vertices
(halfface)The vertices of a halfface.
halffaces
([data])Iterate over the halffaces of the volmesh.
Find the faces on the boundary.
has_edge
(edge)Verify that the volmesh contains a directed edge (u, v).
has_halfface
(halfface)Verify that a face is part of the volmesh.
has_vertex
(vertex)Verify that a vertex is in the volmesh.
Returns a dictionary that maps the indices of a vertex list to keys in the vertex dictionary.
is_cell_on_boundary
(cell)Verify that a cell is on the boundary.
is_edge_on_boundary
(edge)Verify that an edge is on the boundary.
is_halfface_on_boundary
(halfface)Verify that a face is on the boundary.
is_valid
()is_vertex_on_boundary
(vertex)Verify that a vertex is on a boundary.
Count the number of faces in the volmesh.
Count the number of edges in the volmesh.
Count the number of faces in the volmesh.
Count the number of vertices in the volmesh.
Remove all unused vertices from the volmesh object.
to_data
()Convert an object to its native data representation.
to_json
(filepath[, pretty])Serialize the data representation of an object to a JSON file.
to_jsonstring
([pretty])Serialize the data representation of an object to a JSON string.
unset_cell_attribute
(cell, name)Unset the attribute of a cell.
unset_edge_attribute
(edge, name)Unset the attribute of an edge.
unset_face_attribute
(face, name)Unset the attribute of a face.
unset_vertex_attribute
(vertex, name)Unset the attribute of a vertex.
update_default_cell_attributes
([attr_dict])Update the default cell attributes.
update_default_edge_attributes
([attr_dict])Update the default edge attributes.
update_default_face_attributes
([attr_dict])Update the default face attributes.
update_default_vertex_attributes
([attr_dict])Update the default vertex attributes.
Validate the object’s data against its data schema (self.DATASCHEMA).
Validate the object’s data against its json schema (self.JSONSCHEMA).
vertex_attribute
(vertex, name[, value])Get or set an attribute of a vertex.
vertex_attributes
(vertex[, names, values])Get or set multiple attributes of a vertex.
vertex_cells
(vertex)Return all cells connected to a vertex.
vertex_degree
(vertex)Count the neighbors of a vertex.
vertex_halffaces
(vertex)Return all halffaces connected to a vertex.
Returns a dictionary that maps vertex dictionary keys to the corresponding index in a vertex list or array.
Compute the maximum degree of all vertices.
Compute the minimum degree of all vertices.
vertex_neighborhood
(vertex[, ring])Return the vertices in the neighborhood of a vertex.
vertex_neighbors
(vertex)Return the vertex neighbors of a vertex.
vertices
([data])Iterate over the vertices of the volmesh.
vertices_attribute
(name[, value, vertices])Get or set an attribute of multiple vertices.
vertices_attributes
([names, values, vertices])Get or set multiple attributes of multiple vertices.
Find the vertices on the boundary.