VolMesh
- class compas.datastructures.VolMesh(name=None, default_vertex_attributes=None, default_edge_attributes=None, default_face_attributes=None, default_cell_attributes=None)[source]
Bases:
compas.datastructures.halfface.halfface.HalfFace
Geometric implementation of a face data structure for 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.
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.
Compute the (axis aligned) bounding box of a volmesh.
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_center
(cell)Compute the location of the center of mass of a cell.
cell_centroid
(cell)Compute the location of the centroid 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_sample
([size])Get the identifiers of a set of random cells.
cell_to_mesh
(cell)Construct a mesh object from from a cell of a volmesh.
Return the vertices and faces of a 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_vertex_normal
(cell, vertex)Return the normal vector at the vertex of a boundary cell as the weighted average of the normals of the neighboring faces.
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.
centroid
()Compute the centroid of the volmesh.
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_coordinates
(edge[, axes])Return the coordinates of the start and end point of an edge.
edge_direction
(edge)Return the direction vector of an edge.
edge_halffaces
(edge)Ordered halffaces around edge (u, v).
edge_length
(edge)Return the length of an edge.
edge_point
(edge[, t])Return the location of a point along an edge.
edge_sample
([size])Get the identifiers of a set of random edges.
edge_vector
(edge)Return the vector of an edge.
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_area
(face)Compute the oriented area of a face.
face_aspect_ratio
(face)Face aspect ratio as the ratio between the lengths of the maximum and minimum face 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.
face_center
(face)Compute the location of the center of mass of a face.
face_centroid
(face)Compute the location of the centroid of a face.
face_coordinates
(face)Compute the coordinates of the vertices of a face.
face_flatness
(face[, maxdev])Compute the flatness of a face.
face_normal
(face[, unitized])Compute the oriented normal of a face.
face_sample
([size])Get the identifiers of a set of random faces.
face_vertices
(face)The vertices 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.
from_obj
(filepath[, precision])Construct a volmesh object from the data described in an OBJ file.
from_vertices_and_cells
(vertices, cells)Construct a volmesh object from vertices and cells.
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.
gkey_vertex
([precision])Returns a dictionary that maps geometric keys of a certain precision to the keys of the corresponding vertices.
halfface_adjacent_halfface
(halfface, halfedge)Return the halfface adjacent to the halfface across the halfedge.
halfface_area
(face)Compute the oriented area of a face.
halfface_aspect_ratio
(face)Face aspect ratio as the ratio between the lengths of the maximum and minimum face edges.
halfface_cell
(halfface)The cell to which the halfface belongs to.
halfface_center
(face)Compute the location of the center of mass of a face.
halfface_centroid
(face)Compute the location of the centroid of a face.
halfface_coordinates
(face)Compute the coordinates of the vertices of a face.
halfface_flatness
(face[, maxdev])Compute the flatness of a face.
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_normal
(face[, unitized])Compute the oriented normal of a face.
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.
to_obj
(filepath[, precision])Write the volmesh to an OBJ file.
Return the vertices and cells of a volmesh.
transform
(transformation)Transform a mesh.
transformed
(transformation)Transform a copy of
volmesh
.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_coordinates
(vertex[, axes])Return the coordinates of a vertex.
vertex_degree
(vertex)Count the neighbors of a vertex.
vertex_gkey
([precision])Returns a dictionary that maps vertex dictionary keys to the corresponding geometric key up to a certain precision.
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.
vertex_laplacian
(vertex)Compute the vector from a vertex to the centroid of its neighbors.
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_neighborhood_centroid
(vertex)Compute the centroid of the neighbors of a vertex.
vertex_neighbors
(vertex)Return the vertex neighbors of a vertex.
vertex_sample
([size])Get the identifiers of a set of random vertices.
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.