Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import numpy
from .base import _base_mesh, compute_tri_areas, compute_triangle_circumcenters
__all__ = ["MeshTetra"]
# pylint: disable=too-many-instance-attributes
class MeshTetra(_base_mesh):
"""Class for handling tetrahedral meshes.
"""
def __init__(self, node_coords, cells):
"""Initialization.
"""
# Sort cells and nodes, first every row, then the rows themselves. This helps in
# many downstream applications, e.g., when constructing linear systems with the
# cells/edges. (When converting to CSR format, the I/J entries must be sorted.)
# Don't use cells.sort(axis=1) to avoid
# ```
# ValueError: sort array is read-only
# ```
cells = numpy.sort(cells, axis=1)
cells = cells[cells[:, 0].argsort()]
import os
import numpy
from .base import (
_base_mesh,
compute_ce_ratios,
compute_tri_areas,
compute_triangle_circumcenters,
)
from .helpers import grp_start_len, unique_rows
__all__ = ["MeshTri"]
class MeshTri(_base_mesh):
"""Class for handling triangular meshes.
"""
def __init__(self, nodes, cells, sort_cells=False):
"""Initialization.
"""
if sort_cells:
# Sort cells and nodes, first every row, then the rows themselves. This
# helps in many downstream applications, e.g., when constructing linear
# systems with the cells/edges. (When converting to CSR format, the I/J
# entries must be sorted.) Don't use cells.sort(axis=1) to avoid
# ```
# ValueError: sort array is read-only
# ```
cells = numpy.sort(cells, axis=1)
cells = cells[cells[:, 0].argsort()]