CellNetwork
- class compas.datastructures.CellNetwork[source]
Bases:
HalfFace
Geometric implementation of a data structure for a collection of mixed topologic entities such as cells, faces, edges and nodes.
- Parameters:
- name: str, optional
The name of the data structure.
- 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.
Examples
>>> from compas.datastructures import CellNetwork >>> cell_network = CellNetwork() >>> vertices = [(0, 0, 0), (0, 1, 0), (1, 1, 0), (1, 0, 0), (0, 0, 1), (1, 0, 1), (1, 1, 1), (0, 1, 1)] >>> faces = [[0, 1, 2, 3], [0, 3, 5, 4],[3, 2, 6, 5], [2, 1, 7, 6],[1, 0, 4, 7],[4, 5, 6, 7]] >>> cells = [[0, 1, 2, 3, 4, 5]] >>> [network.add_vertex(x=x, y=y, z=z) for x, y, z in vertices] >>> [cell_network.add_face(fverts) for fverts in faces] >>> [cell_network.add_cell(fkeys) for fkeys in cells] >>> cell_network
Methods
Add a cell to the cell network object.
Add an edge and specify its attributes.
Add a face to the cell network.
Add a vertex and specify its attributes.
Compute the point at the center of mass of a cell.
Compute the point at the centroid of a cell.
Compute the points of the vertices of a cell.
Construct a polyhedron from the vertices and faces of a cell.
Construct a mesh object from from a cell of a cell network.
Return the vertices and faces of a cell.
Return the normal vector at the vertex of a boundary cell as the weighted average of the normals of the neighboring faces.
Find the cells on the boundary.
Get or set an attribute of an edge.
Return the coordinates of the start and end point of an edge.
Return the direction vector of an edge.
Return the end point of an edge.
Returns an adjacency where adjacency[edge] = {face1, face2}.
Return the faces adjacent to an edge.
Return the length of an edge.
Return the line representation of an edge.
Return the start point of an edge.
Return the vector of an edge.
Iterate over the edges of the cell network.
Find the edges that are not part of a face.
Construct a face adjacency dictionary from a list of faces.
Compute the oriented area of a face.
Get or set an attribute of a face.
Returns an adjacency where adjacency[face] = [cell1, cell2].
Return the cells connected to a face.
Compute the point at the center of mass of a face.
Compute the point at the centroid of a face.
Compute the coordinates of the vertices of a face.
Return the neighbors of a face across its edges.
Compute the oriented normal of a face.
Compute the points of the vertices of a face.
Compute the polygon of a face.
The vertices of a face.
Find the faces that are not part of a cell.
Construct an object of this type from the provided data.
Compute the oriented area of a face.
Compute the point at the center of mass of a face.
Compute the point at the centroid of a face.
Compute the coordinates of the vertices of a face.
Compute the oriented normal of a face.
Verify that a face is on the boundary.
Verify that a face is on the boundary.
Construct a mesh from a list of faces.
Returns the edges that belong to more than two faces.
Convert the cell network to a network.
Return the coordinates of a vertex.
Return the point representation of a vertex.
Return the coordinates of multiple vertices.
Returns the point representation of multiple vertices.
Inherited Methods
Converts the instance to a string.
Add a face to the volmesh object.
Get or set an attribute of a cell.
Get or set multiple attributes of a cell.
Return all edges of a cell.
Find the faces adjacent to a given face of a cell.
The faces of a cell.
Find the face corresponding to a specific halfedge of a cell.
Find the opposite face corresponding to a specific halfedge of a cell.
The halfedges of a cell.
Find the neighbors of a given cell.
Get the identifiers of a set of random cells.
Ordered faces connected to a vertex of a cell.
Ordered vertex neighbors of a vertex of a cell.
The vertices of a cell.
Iterate over the cells of the volmesh.
Get or set an attribute of multiple cells.
Get or set multiple attributes of multiple cells.
Get cells for which a certain condition or set of conditions is true.
Get cells for which a certain condition or set of conditions is true using a lambda function.
Clear all the volmesh data.
Make an independent copy of the data object.
Remove all unused vertices from the volmesh object.
Delete a cell from the volmesh.
Delete a vertex from the volmesh and everything that is attached to it.
Get or set multiple attributes of an edge.
Ordered cells around edge (u, v).
Ordered halffaces around edge (u, v).
Get the identifiers of a set of random edges.
Get or set an attribute of multiple edges.
Get or set multiple attributes of multiple edges.
Get edges for which a certain condition or set of conditions is true.
Get edges for which a certain condition or set of conditions is true using a lambda function.
Get or set multiple attributes of a face.
Get the identifiers of a set of random faces.
"Iterate over the halffaces of the volmesh and yield faces.
Get or set an attribute of multiple faces.
Get or set multiple attributes of multiple faces.
Get faces for which a certain condition or set of conditions is true.
Get faces for which a certain condition or set of conditions is true using a lambda function.
Construct an object of this type from a JSON file.
Construct an object of this type from a JSON string.
Return the halfface adjacent to the halfface across the halfedge.
The cell to which the halfface belongs to.
The halfedges of a halfface.
Return the halfface neighborhood of a halfface across their edges.
Return the halfface neighbors of a halfface that are on the same manifold.
The cell to which the opposite halfface belongs to.
The opposite face of a face.
Return the vertex before the specified vertex in a specific face.
Return the vertex after the specified vertex in a specific face.
The vertices of a halfface.
Iterate over the halffaces of the volmesh.
Find the faces on the boundary.
Verify that the volmesh contains a directed edge (u, v).
Verify that a face is part of the volmesh.
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.
Verify that a cell is on the boundary.
Verify that an edge is on the boundary.
Verify that the volmesh is valid.
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.
Compute a hash of the data for comparison during version control using the sha256 algorithm.
Convert an object to its native data representation.
Convert an object to its native data representation and save it to a JSON file.
Convert an object to its native data representation and save it to a JSON string.
Unset the attribute of a cell.
Unset the attribute of an edge.
Unset the attribute of a face.
Unset the attribute of a vertex.
Update the default cell attributes.
Update the default edge attributes.
Update the default face attributes.
Update the default vertex attributes.
Validate the data against the object's data schema.
Get or set an attribute of a vertex.
Get or set multiple attributes of a vertex.
Return all cells connected to a vertex.
Count the neighbors of a 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.
Return the vertices in the neighborhood of a vertex.
Return the vertex neighbors of a vertex.
Get the identifiers of a set of random vertices.
Iterate over the vertices of the volmesh.
Get or set an attribute of multiple vertices.
Get or set multiple attributes of multiple vertices.
Find the vertices on the boundary.
Get vertices for which a certain condition or set of conditions is true.
Get vertices for which a certain condition or set of conditions is true using a lambda function.