def computePreviewMembers(self): nmem = self.nmem oml0 = self.geometry.oml0 quads, Wa = PSMlib.computepreviewmemberweights(nmem, 4*nmem, self.membersFlt) linW = numpy.linspace(0,4*nmem-1,4*nmem) B0 = scipy.sparse.csr_matrix((4*nmem,oml0.C.shape[0])) for src in range(4): W = scipy.sparse.csr_matrix((Wa[:,src],(linW,linW))) for surf in range(oml0.nsurf): npts = PSMlib.countpreviewmembers(surf+1, src+1, nmem, self.membersFlt) if npts is not 0: inds, P, Q = PSMlib.computepreviewmemberproj(surf+1, src+1, nmem, npts, self.membersFlt) Ta = numpy.ones(npts) Ti = inds - 1 Tj = numpy.linspace(0,npts-1,npts) T = scipy.sparse.csr_matrix((Ta,(Ti,Tj)),shape=(4*nmem,npts)) mu, mv = oml0.edgeProperty(surf,1) for u in range(mu): for v in range(mv): oml0.C[oml0.getIndex(surf,u,v,1),:3] = [u/(mu-1), v/(mv-1), 0] oml0.computePointsC() s,u,v = oml0.evaluateProjection(P, [surf], Q) B = oml0.evaluateBases(s, u, v) B0 = B0 + W.dot(T.dot(B)) oml0.computePoints() nodes = B0.dot(oml0.C) self.memEdgeLengths = PSMlib.computeedgelengths(nodes.shape[1],nmem,nodes,quads) self.preview.append(['members', nodes, quads])
def computePreviewSurfaces(self): oml0 = self.geometry.oml0 nsurf = oml0.nsurf quads,s,u,v = PSMlib.computepreviewsurfaces(4*nsurf,nsurf) B = oml0.evaluateBases(s,u,v) nodes = B.dot(oml0.C) self.surfEdgeLengths = PSMlib.computeedgelengths(nodes.shape[1],nsurf,nodes,quads) self.preview.append(['surfs', nodes, quads])
def computePreviewSurfaces(self): oml0 = self.geometry.oml0 nsurf = oml0.nsurf quads, s, u, v = PSMlib.computepreviewsurfaces(4 * nsurf, nsurf) B = oml0.evaluateBases(s, u, v) nodes = B.dot(oml0.C) self.surfEdgeLengths = PSMlib.computeedgelengths( nodes.shape[1], nsurf, nodes, quads) self.preview.append(['surfs', nodes, quads])
def computePreviewSurfaces(self): bse = self.geometry._bse nsurf = bse._num['surf'] quads,s,u,v = PSMlib.computepreviewsurfaces(4*nsurf,nsurf) bse.add_jacobian('temp', s, u, v, ndim=3) bse.apply_jacobian('temp', 'd(temp)/d(cp_str)', 'cp_str') nodes = bse.vec['temp'].array self.surfEdgeLengths = PSMlib.computeedgelengths(nodes.shape[1],nsurf,nodes,quads) self.preview.append(['surfs', nodes, quads])
def computePreviewMembers(self): nmem = self.nmem bse = self.geometry._bse nsurf = bse._num['surf'] ncp = bse._size['cp_str'] quads, Wa = PSMlib.computepreviewmemberweights(nmem, 4 * nmem, self.membersFlt) linW = numpy.linspace(0, 4 * nmem - 1, 4 * nmem, dtype='int') B0 = scipy.sparse.csr_matrix((4 * nmem, ncp)) for src in range(4): W = scipy.sparse.csr_matrix((Wa[:, src], (linW, linW))) for surf in range(nsurf): npts = PSMlib.countpreviewmembers(surf + 1, src + 1, nmem, self.membersFlt) if npts is not 0: inds, P, Q = PSMlib.computepreviewmemberproj( surf + 1, src + 1, nmem, npts, self.membersFlt) Ta = numpy.ones(npts) Ti = inds - 1 Tj = numpy.linspace(0, npts - 1, npts) T = scipy.sparse.csr_matrix((Ta, (Ti, Tj)), shape=(4 * nmem, npts)) mu = bse.get_bspline_option('num_cp', surf, 'u') mv = bse.get_bspline_option('num_cp', surf, 'v') nu = bse.get_bspline_option('num_pt', surf, 'u') nv = bse.get_bspline_option('num_pt', surf, 'v') for u in range(mu): for v in range(mv): bse.vec['cp_str'](surf)[u, v, :] = [ u / (mu - 1), v / (mv - 1), 0 ] for u in range(nu): for v in range(nv): bse.vec['pt_str'](surf)[u, v, :] = [ u / (nu - 1), v / (nv - 1), 0 ] bse.compute_projection('temp', P, [surf], ndim=3) B = bse.jac['d(temp)/d(cp_str)'] B0 = B0 + W * T * B bse.apply_jacobian('cp_str', 'd(cp_str)/d(cp)', 'cp') nodes = B0 * bse.vec['cp_str'].array self.memEdgeLengths = PSMlib.computeedgelengths( nodes.shape[1], nmem, nodes, quads) self.preview.append(['members', nodes, quads])
def computePreviewMembers(self): nmem = self.nmem bse = self.geometry._bse nsurf = bse._num['surf'] ncp = bse._size['cp_str'] quads, Wa = PSMlib.computepreviewmemberweights(nmem, 4*nmem, self.membersFlt) linW = numpy.linspace(0,4*nmem-1,4*nmem) B0 = scipy.sparse.csr_matrix((4*nmem,ncp)) for src in range(4): W = scipy.sparse.csr_matrix((Wa[:,src],(linW,linW))) for surf in range(nsurf): npts = PSMlib.countpreviewmembers(surf+1, src+1, nmem, self.membersFlt) if npts is not 0: inds, P, Q = PSMlib.computepreviewmemberproj(surf+1, src+1, nmem, npts, self.membersFlt) Ta = numpy.ones(npts) Ti = inds - 1 Tj = numpy.linspace(0,npts-1,npts) T = scipy.sparse.csr_matrix((Ta,(Ti,Tj)),shape=(4*nmem,npts)) mu = bse.get_bspline_option('num_cp', surf, 'u') mv = bse.get_bspline_option('num_cp', surf, 'v') nu = bse.get_bspline_option('num_pt', surf, 'u') nv = bse.get_bspline_option('num_pt', surf, 'v') for u in range(mu): for v in range(mv): bse.vec['cp_str'](surf)[u, v, :] = [u/(mu-1), v/(mv-1), 0] for u in range(nu): for v in range(nv): bse.vec['pt_str'](surf)[u, v, :] = [u/(nu-1), v/(nv-1), 0] bse.compute_projection('temp', P, [surf], ndim=3) B = bse.jac['d(temp)/d(cp_str)'] B0 = B0 + W * T * B bse.apply_jacobian('cp_str', 'd(cp_str)/d(cp)', 'cp') nodes = B0 * bse.vec['cp_str'].array self.memEdgeLengths = PSMlib.computeedgelengths(nodes.shape[1],nmem,nodes,quads) self.preview.append(['members', nodes, quads])
def computePreviewMembers(self): nmem = self.nmem oml0 = self.geometry.oml0 quads, Wa = PSMlib.computepreviewmemberweights(nmem, 4 * nmem, self.membersFlt) linW = numpy.linspace(0, 4 * nmem - 1, 4 * nmem) B0 = scipy.sparse.csr_matrix((4 * nmem, oml0.C.shape[0])) for src in range(4): W = scipy.sparse.csr_matrix((Wa[:, src], (linW, linW))) for surf in range(oml0.nsurf): npts = PSMlib.countpreviewmembers(surf + 1, src + 1, nmem, self.membersFlt) if npts is not 0: inds, P, Q = PSMlib.computepreviewmemberproj( surf + 1, src + 1, nmem, npts, self.membersFlt) Ta = numpy.ones(npts) Ti = inds - 1 Tj = numpy.linspace(0, npts - 1, npts) T = scipy.sparse.csr_matrix((Ta, (Ti, Tj)), shape=(4 * nmem, npts)) mu, mv = oml0.edgeProperty(surf, 1) for u in range(mu): for v in range(mv): oml0.C[oml0.getIndex(surf, u, v, 1), :3] = [ u / (mu - 1), v / (mv - 1), 0 ] oml0.computePointsC() s, u, v = oml0.evaluateProjection(P, [surf], Q) B = oml0.evaluateBases(s, u, v) B0 = B0 + W.dot(T.dot(B)) oml0.computePoints() nodes = B0.dot(oml0.C) self.memEdgeLengths = PSMlib.computeedgelengths( nodes.shape[1], nmem, nodes, quads) self.preview.append(['members', nodes, quads])