BaseVolMesh

class compas.datastructures.BaseVolMesh[source]

Bases: compas.datastructures.volmesh.core.halfface.HalfFace

Geometric implementation of a face data structure for volumetric meshes.

Attributes
  • attributes (dict) – A dictionary of general volmesh attributes.

    • 'name': "VolMesh"

  • default_vertex_attributes (dict) – The names of pre-assigned vertex attributes and their default values.

    • 'x': 0.0

    • 'y': 0.0

    • 'z': 0.0

  • default_edge_attributes (dict) – The default data attributes assigned to every new edge.

  • default_face_attributes (dict) – The default data attributes assigned to every new face.

  • name (str) – The name of the volmesh. Shorthand for volmesh.attributes['name']

  • data (dict) – The data representing the mesh. The dict has the following structure:

    • ‘attributes’ => dict

    • ‘dva’ => dict

    • ‘dea’ => dict

    • ‘dfa’ => dict

    • ‘dca’ => dict

    • ‘vertex’ => dict

    • ‘halface’ => dict

    • ‘cell’ => dict

    • ‘plane’ => dict

    • ‘edgedata’ => dict

    • ‘facedata’ => dict

    • ‘celldata’ => dict

    • ‘max_int_key’ => int

    • ‘max_int_hfkey’ => int

    • ‘max_int_ckey’ => int

Methods

__init__()

Initialize self.

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_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_to_mesh(cell)

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

cell_to_vertices_and_faces(cell)

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.

cells_on_boundaries()

Find the cells on the boundary.

cells_where()

centroid()

Compute the centroid of the volmesh.

clear()

Clear all the volmesh data.

copy([cls])

Make an independent copy of the datastructure object.

cull_vertices()

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_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.

edges_where()

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_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.

faces_where()

from_data(data)

Construct a datastructure from structured data.

from_json(filepath)

Construct a datastructure from structured data contained in a json file.

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_any_face()

Get the identifier of a random face.

get_any_face_vertex(face)

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

get_any_vertex()

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.

halffaces_on_boundaries()

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.

index_vertex()

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.

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()

Returns a dictionary of structured data representing the data structure.

to_json(filepath[, pretty])

Serialise the structured data representing the datastructure to json.

to_obj(filepath[, precision])

Write the volmesh to an OBJ file.

to_vertices_and_cells()

Return the vertices and cells of a 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_data()

Validate the data of this object against its data schema (self.DATASCHEMA).

validate_json()

Validate the data loaded from a JSON representation of the data of this object against its data schema (self.DATASCHEMA).

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.

vertex_index()

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.

vertex_max_degree()

Compute the maximum degree of all vertices.

vertex_min_degree()

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.

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.

vertices_on_boundaries()

Find the vertices on the boundary.

vertices_where()