How to use the pyansys._binary_reader function in pyansys

To help you get started, we’ve selected a few pyansys examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github akaszynski / pyansys / pyansys / rst.py View on Github external
def _store_geometry(self):
        """Store the geometry from the result file"""
        # read geometry header
        table = self.read_record(self._resultheader['ptrGEO'])
        geometry_header = parse_header(table, geometry_header_keys)
        self._geometry_header = geometry_header

        # Node information
        nnod = geometry_header['nnod']
        nnum = np.empty(nnod, np.int32)
        nodes = np.empty((nnod, 6), np.float)
        _binary_reader.load_nodes(self.filename, geometry_header['ptrLOC'],
                                  nnod, nodes, nnum)

        # Element information
        nelm = geometry_header['nelm']
        maxety = geometry_header['maxety']

        # pointer to the element type index table
        e_type_table = self.read_record(geometry_header['ptrETY'])

        # store information for each element type
        # make these arrays large so you can reference a value via element
        # type numbering

        # number of nodes for this element type
        nodelm = np.empty(10000, np.int32)
github akaszynski / pyansys / pyansys / common.py View on Github external
def midside_mask(grid):
    """Returns a mask of midside nodes

    Parameters
    ----------
    grid : pyvista.UnstructuredGrid
        Grid to check.

    Returns
    -------
    mask : bool np.ndarray
        True when a midside node.
    """
    return _binary_reader.midside_mask(grid.celltypes,
                                       grid.cells,
                                       grid.offset,
                                       grid.number_of_points)
github akaszynski / pyansys / pyansys / rst.py View on Github external
# the element description table
        # must view this record as int64, even though ansys reads
        # it in as a 32 bit int
        ptr_eid = geometry_header['ptrEID']
        e_disp_table = self.read_record(ptr_eid).view(np.int64)

        # get pointer to start of element table and adjust element pointers
        ptr_elem = geometry_header['ptrEID'] + e_disp_table[0]
        e_disp_table -= e_disp_table[0]

        # read in coordinate systems, material properties, and sections
        self._c_systems = self.parse_coordinate_system()

        # load elements
        elem, elem_off = _binary_reader.load_elements(self.filename, ptr_elem,
                                                      nelm, e_disp_table)

        # Store geometry and parse to VTK quadradic and null unallowed
        ncomp, ecomp = self._read_components()
        self.geometry = Geometry(nnum, nodes, elem, elem_off, np.array(ekey),
                                 node_comps=ncomp, elem_comps=ecomp)
        self.quadgrid = self.geometry._parse_vtk(null_unallowed=True,
                                                 fix_midside=False)
        self.grid = self.quadgrid.linear_copy()

        # identify nodes that are actually in the solution
        self._insolution = np.in1d(self.geometry.nnum, self._resultheader['neqv'],
                                   assume_unique=True)