How to use the pyansys.common.read_table 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 / emat.py View on Github external
nrkey - newton-raphson(restoring) load 
            0 - vector not used
            1 - vector used

        ikey - imaginary load vector key (for complex analyses)
            0 - vector not used
            1 - vector used 

        nmrow - numbers/columns in matrices. 
            If the number is negative, the matrices will be written in
            lower triangular form.

        """
        with open(self.filename, 'rb') as f:
            f.seek(4*f_index)
            return parse_header(read_table(f), ELEMENT_HEADER_KEYS)
github akaszynski / pyansys / pyansys / emat.py View on Github external
stress_entries = read_table(fobj, 'd', nread)
                    element_data['stress'] = stress_entries
                else:  # skip
                    fobj.seek(nread*8 + 12, 1)

            # read mass matrix
            if element_header['mkey']:  # if entry even exists
                if mass:
                    mass_entries = read_table(fobj, 'd', nread)
                    element_data['mass'] = mass_entries
                else:  # skip
                    fobj.seek(nread*8 + 12, 1)

            if element_header['dkey']:
                if damping:
                    damping_entries = read_table(fobj, 'd', nread)
                    element_data['damping'] = damping_entries
                else:  # skip
                    fobj.seek(nread*8 + 12, 1)

            if element_header['sskey']:
                if stress_stiff:
                    stress_stiff_entries = read_table(fobj, 'd', nread)
                    element_data['stress_stiff'] = stress_stiff_entries
                else:  # skip
                    fobj.seek(nread*8 + 12, 1)

            if element_header['akey']:
                if applied_force:
                    applied_force_vector = read_table(fobj, 'd', nmrow)
                    element_data['applied_force'] = applied_force_vector
                else:  # skip
github akaszynski / pyansys / pyansys / emat.py View on Github external
def element_matrices_index_table(self):
        """Return element matrices index table"""
        if self._element_matrices_index_table is None:
            with open(self.filename, 'rb') as f:
                f.seek(self.header['ptrIDX']*4)
                self._element_matrices_index_table = read_table(f)
        return self._element_matrices_index_table
github akaszynski / pyansys / pyansys / full.py View on Github external
neqn = self._header['neqn']  # Number of equations

        # number of terms in stiffness matrix
        ntermK = two_ints_to_long(self._header['ntermKl'], self._header['ntermKh'])

        ptrSTF = self._header['ptrSTF']  # Location of stiffness matrix
        ptrMAS = self._header['ptrMAS']  # Location in file to mass matrix

        # number of terms in mass matrix
        ntermM = two_ints_to_long(self._header['ntermMl'], self._header['ntermMh'])
        ptrDOF = self._header['ptrDOF']  # pointer to DOF info

        # DOF information
        with open(self.filename, 'rb') as f:
            read_table(f, skip=True)  # standard header
            read_table(f, skip=True)  # full header
            read_table(f, skip=True)  # number of degrees of freedom

            # Nodal equivalence table
            neqv = read_table(f, cython=True)

            # read number of degrees of freedom for each node and constant tables
            f.seek(ptrDOF*4)
            ndof = read_table(f, cython=True)
            const = read_table(f, cython=True)

        # degree of freedom reference and number of degress of freedom per node
        dof_ref = [ndof, neqv]
        self.ndof = ndof

        # Read k and m blocks (see help(ReadArray) for block description)
        if ntermK:
github akaszynski / pyansys / pyansys / full.py View on Github external
ntermM = two_ints_to_long(self._header['ntermMl'], self._header['ntermMh'])
        ptrDOF = self._header['ptrDOF']  # pointer to DOF info

        # DOF information
        with open(self.filename, 'rb') as f:
            read_table(f, skip=True)  # standard header
            read_table(f, skip=True)  # full header
            read_table(f, skip=True)  # number of degrees of freedom

            # Nodal equivalence table
            neqv = read_table(f, cython=True)

            # read number of degrees of freedom for each node and constant tables
            f.seek(ptrDOF*4)
            ndof = read_table(f, cython=True)
            const = read_table(f, cython=True)

        # degree of freedom reference and number of degress of freedom per node
        dof_ref = [ndof, neqv]
        self.ndof = ndof

        # Read k and m blocks (see help(ReadArray) for block description)
        if ntermK:
            krow, kcol, kdata = _binary_reader.read_array(self.filename,
                                                          ptrSTF,
                                                          ntermK,
                                                          neqn,
                                                          const)
        else:
            warnings.warn('Missing stiffness matrix')
            kdata = None
github akaszynski / pyansys / pyansys / full.py View on Github external
# number of terms in mass matrix
        ntermM = two_ints_to_long(self._header['ntermMl'], self._header['ntermMh'])
        ptrDOF = self._header['ptrDOF']  # pointer to DOF info

        # DOF information
        with open(self.filename, 'rb') as f:
            read_table(f, skip=True)  # standard header
            read_table(f, skip=True)  # full header
            read_table(f, skip=True)  # number of degrees of freedom

            # Nodal equivalence table
            neqv = read_table(f, cython=True)

            # read number of degrees of freedom for each node and constant tables
            f.seek(ptrDOF*4)
            ndof = read_table(f, cython=True)
            const = read_table(f, cython=True)

        # degree of freedom reference and number of degress of freedom per node
        dof_ref = [ndof, neqv]
        self.ndof = ndof

        # Read k and m blocks (see help(ReadArray) for block description)
        if ntermK:
            krow, kcol, kdata = _binary_reader.read_array(self.filename,
                                                          ptrSTF,
                                                          ntermK,
                                                          neqn,
                                                          const)
        else:
            warnings.warn('Missing stiffness matrix')
            kdata = None
github akaszynski / pyansys / pyansys / emat.py View on Github external
def neqv(self):
        """Nodal equivalence table. This table equates the number used
        for storage to the actual node number.
        """
        if self._neqv is None:
            with open(self.filename, 'rb') as f:
                f.seek(self.header['ptrBAC']*4)
                self._neqv = read_table(f)
        return self._neqv
github akaszynski / pyansys / pyansys / emat.py View on Github external
if damping:
                    damping_entries = read_table(fobj, 'd', nread)
                    element_data['damping'] = damping_entries
                else:  # skip
                    fobj.seek(nread*8 + 12, 1)

            if element_header['sskey']:
                if stress_stiff:
                    stress_stiff_entries = read_table(fobj, 'd', nread)
                    element_data['stress_stiff'] = stress_stiff_entries
                else:  # skip
                    fobj.seek(nread*8 + 12, 1)

            if element_header['akey']:
                if applied_force:
                    applied_force_vector = read_table(fobj, 'd', nmrow)
                    element_data['applied_force'] = applied_force_vector
                else:  # skip
                    fobj.seek(nmrow*8 + 12, 1)

            if element_header['nrkey']:
                if newton_raphson:
                    newton_raphson_vector = read_table(fobj, 'd', nmrow)
                    element_data['newton_raphson'] = newton_raphson_vector
                else:  # skip
                    fobj.seek(nmrow*8 + 12, 1)

            if element_header['ikey']:
                if imaginary_load:
                    imaginary_load_vector = read_table(fobj, 'd', nmrow)
                    element_data['imaginary_load'] = imaginary_load_vector
                else:  # skip