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.

Inherited Attributes

DATASCHEMA

The schema of the data of this object.

JSONSCHEMA

The schema of the JSON representation of the data of this object.

JSONSCHEMANAME

data

A data dict representing the volmesh data structure for serialization.

dtype

The type of the object in the form of a '2-level' import and a class name.

guid

The globally unique identifier of the object.

jsondefinitions

Reusable schema definitions.

jsonstring

The representation of the object data in JSON format.

jsonvalidator

JSON schema validator for draft 7.

name

The name of the data structure.

Methods

bounding_box

Compute the (axis aligned) bounding box of a volmesh.

cell_center

Compute the location of the center of mass of a cell.

cell_centroid

Compute the location of the centroid of a cell.

cell_to_mesh

Construct a mesh object from from a cell of a volmesh.

cell_to_vertices_and_faces

Return the vertices and faces of a cell.

cell_vertex_normal

Return the normal vector at the vertex of a boundary cell as the weighted average of the normals of the neighboring faces.

centroid

Compute the centroid of the volmesh.

edge_coordinates

Return the coordinates of the start and end point of an edge.

edge_direction

Return the direction vector of an edge.

edge_length

Return the length of an edge.

edge_point

Return the location of a point along an edge.

edge_vector

Return the vector of an edge.

face_area

Compute the oriented area of a face.

face_aspect_ratio

Face aspect ratio as the ratio between the lengths of the maximum and minimum face edges.

face_center

Compute the location of the center of mass of a face.

face_centroid

Compute the location of the centroid of a face.

face_coordinates

Compute the coordinates of the vertices of a face.

face_flatness

Compute the flatness of a face.

face_normal

Compute the oriented normal of a face.

face_vertices

The vertices of a face.

from_obj

Construct a volmesh object from the data described in an OBJ file.

from_vertices_and_cells

Construct a volmesh object from vertices and cells.

gkey_vertex

Returns a dictionary that maps geometric keys of a certain precision to the keys of the corresponding vertices.

halfface_area

Compute the oriented area of a face.

halfface_aspect_ratio

Face aspect ratio as the ratio between the lengths of the maximum and minimum face edges.

halfface_center

Compute the location of the center of mass of a face.

halfface_centroid

Compute the location of the centroid of a face.

halfface_coordinates

Compute the coordinates of the vertices of a face.

halfface_flatness

Compute the flatness of a face.

halfface_normal

Compute the oriented normal of a face.

to_obj

Write the volmesh to an OBJ file.

to_vertices_and_cells

Return the vertices and cells of a volmesh.

transform

Transform a mesh.

transformed

Transform a copy of volmesh.

vertex_coordinates

Return the coordinates of a vertex.

vertex_gkey

Returns a dictionary that maps vertex dictionary keys to the corresponding geometric key up to a certain precision.

vertex_laplacian

Compute the vector from a vertex to the centroid of its neighbors.

vertex_neighborhood_centroid

Compute the centroid of the neighbors of a vertex.

Inherited Methods

add_cell

Add a cell to the volmesh object.

add_halfface

Add a face to the volmesh object.

add_vertex

Add a vertex to the volmesh object.

cell_attribute

Get or set an attribute of a cell.

cell_attributes

Get or set multiple attributes of a cell.

cell_edges

cell_face_neighbors

cell_faces

The faces of a cell.

cell_halfedge_face

cell_halfedge_opposite_face

cell_halfedges

The halfedges of a cell.

cell_neighbors

cell_sample

Get the identifiers of a set of random cells.

cell_vertex_faces

Ordered faces connected to a vertex of a cell.

cell_vertex_neighbors

Ordered vertex neighbors of a vertex of a cell.

cell_vertices

The vertices of a cell.

cells

Iterate over the cells of the volmesh.

cells_attribute

Get or set an attribute of multiple cells.

cells_attributes

Get or set multiple attributes of multiple cells.

cells_on_boundaries

Find the cells on the boundary.

cells_where

clear

Clear all the volmesh data.

copy

Make an independent copy of the data object.

cull_vertices

Remove all unused vertices from the volmesh object.

delete_cell

Delete a cell from the volmesh.

delete_vertex

Delete a vertex from the volmesh and everything that is attached to it.

edge_attribute

Get or set an attribute of an edge.

edge_attributes

Get or set multiple attributes of an edge.

edge_cells

Ordered cells around edge (u, v).

edge_halffaces

Ordered halffaces around edge (u, v).

edge_sample

Get the identifiers of a set of random edges.

edges

Iterate over the edges of the volmesh.

edges_attribute

Get or set an attribute of multiple edges.

edges_attributes

Get or set multiple attributes of multiple edges.

edges_where

face_attribute

Get or set an attribute of a face.

face_attributes

Get or set multiple attributes of a face.

face_sample

Get the identifiers of a set of random faces.

faces

"Iterate over the halffaces of the volmesh and yield faces.

faces_attribute

Get or set an attribute of multiple faces.

faces_attributes

Get or set multiple attributes of multiple faces.

faces_where

from_data

Construct an object of this type from the provided data.

from_json

Construct an object from serialized data contained in a JSON file.

from_jsonstring

Construct an object from serialized data contained in a JSON string.

get_any_face

Get the identifier of a random face.

get_any_face_vertex

Get the identifier of a random vertex of a specific face.

get_any_vertex

Get the identifier of a random vertex.

halfface_adjacent_halfface

Return the halfface adjacent to the halfface across the halfedge.

halfface_cell

The cell to which the halfface belongs to.

halfface_halfedges

The halfedges of a halfface.

halfface_manifold_neighborhood

Return the halfface neighborhood of a halfface across their edges.

halfface_manifold_neighbors

halfface_opposite_cell

The cell to which the opposite halfface belongs to.

halfface_opposite_halfface

The opposite face of a face.

halfface_vertex_ancestor

Return the vertex before the specified vertex in a specific face.

halfface_vertex_descendent

Return the vertex after the specified vertex in a specific face.

halfface_vertices

The vertices of a halfface.

halffaces

Iterate over the halffaces of the volmesh.

halffaces_on_boundaries

Find the faces on the boundary.

has_edge

Verify that the volmesh contains a directed edge (u, v).

has_halfface

Verify that a face is part of the volmesh.

has_vertex

Verify that a vertex is in the volmesh.

index_vertex

Returns a dictionary that maps the indices of a vertex list to keys in the vertex dictionary.

is_cell_on_boundary

Verify that a cell is on the boundary.

is_edge_on_boundary

Verify that an edge is on the boundary.

is_halfface_on_boundary

Verify that a face is on the boundary.

is_valid

is_vertex_on_boundary

Verify that a vertex is on a boundary.

number_of_cells

Count the number of faces in the volmesh.

number_of_edges

Count the number of edges in the volmesh.

number_of_faces

Count the number of faces in the volmesh.

number_of_vertices

Count the number of vertices in the volmesh.

remove_unused_vertices

Remove all unused vertices from the volmesh object.

to_data

Convert an object to its native data representation.

to_json

Serialize the data representation of an object to a JSON file.

to_jsonstring

Serialize the data representation of an object to a JSON string.

unset_cell_attribute

Unset the attribute of a cell.

unset_edge_attribute

Unset the attribute of an edge.

unset_face_attribute

Unset the attribute of a face.

unset_vertex_attribute

Unset the attribute of a vertex.

update_default_cell_attributes

Update the default cell attributes.

update_default_edge_attributes

Update the default edge attributes.

update_default_face_attributes

Update the default face attributes.

update_default_vertex_attributes

Update the default vertex attributes.

validate_data

Validate the object's data against its data schema (self.DATASCHEMA).

validate_json

Validate the object's data against its json schema (self.JSONSCHEMA).

vertex_attribute

Get or set an attribute of a vertex.

vertex_attributes

Get or set multiple attributes of a vertex.

vertex_cells

Return all cells connected to a vertex.

vertex_degree

Count the neighbors of a vertex.

vertex_halffaces

Return all halffaces connected to a vertex.

vertex_index

Returns a dictionary that maps vertex dictionary keys to the corresponding index in a vertex list or array.

vertex_max_degree

Compute the maximum degree of all vertices.

vertex_min_degree

Compute the minimum degree of all vertices.

vertex_neighborhood

Return the vertices in the neighborhood of a vertex.

vertex_neighbors

Return the vertex neighbors of a vertex.

vertex_sample

Get the identifiers of a set of random vertices.

vertices

Iterate over the vertices of the volmesh.

vertices_attribute

Get or set an attribute of multiple vertices.

vertices_attributes

Get or set multiple attributes of multiple vertices.

vertices_on_boundaries

Find the vertices on the boundary.

vertices_where