Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
# 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
if ntermM:
mrow, mcol, mdata = _binary_reader.read_array(self.filename,
ptrMAS,
ntermM,
neqn,
const)
else:
warnings.warn('Missing mass matrix')
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
if ntermM:
mrow, mcol, mdata = _binary_reader.read_array(self.filename,
ptrMAS,
ntermM,
neqn,
const)
else:
warnings.warn('Missing mass matrix')
mdata = None
# remove constrained entries
if np.any(const < 0):
if kdata is not None:
remove = np.nonzero(const < 0)[0]
mask = ~np.logical_or(np.in1d(krow, remove), np.in1d(kcol, remove))
krow = krow[mask]
kcol = kcol[mask]
kdata = kdata[mask]