def computeSurfaces(self): geometry = self.geometry oml0 = geometry.oml0 quad = self.quad premeshFaces = self.premeshFaces self.surfaceNames = [] B0 = [] quads0 = [] nnode0 = [0] iList = 0 for comp in geometry.comps.values(): for face in comp.faces.values(): verts,edges,edge_group,edgeLengths = premeshFaces[iList] iList += 1 nvert = verts.shape[0] nedge = edges.shape[0] ni, nj = face.num_surf idims, jdims = self.faceDims[comp.name][face.name] print 'Computing skin elements:', comp.name, face.name for i in range(ni): for j in range(nj): surf = face.surf_indices[i,j] if surf >= 0:# and oml0.visible[surf]: nedge1 = PSMlib.countsurfaceedges(nvert, nedge, idims[i], idims[i+1], jdims[j], jdims[j+1], verts, edges) edges1 = PSMlib.computesurfaceedges(nvert, nedge, nedge1, idims[i], idims[i+1], jdims[j], jdims[j+1], verts, edges) print comp.name, face.name, i, j quad.importEdges(edges1) output = False if comp.name=='lw' and face.name=='upp' and i==0 and j==2: output = True nodes, quads = quad.mesh(self.maxL, self.surfEdgeLengths[surf,:,:], output, output) 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() P0, Q = PSMlib.computesurfaceprojections(nodes.shape[0], nodes) s,u,v = oml0.evaluateProjection(P0, [surf], Q) B = oml0.evaluateBases(s,u,v) name = comp.name + ':' + str(face.name) + ':' + str(i) + ':' + str(j) self.surfaceNames.append(name) B0.append(B) nnode0.append(nnode0[-1] + P0.shape[0]) quads0.append(quads) B0 = scipy.sparse.vstack(B0) self.meshS = [B0, quads0, nnode0]
def computeSurfaces(self): geometry = self.geometry oml0 = geometry.oml0 quad = self.quad premeshFaces = self.premeshFaces self.surfaceNames = [] B0 = [] quads0 = [] nnode0 = [0] iList = 0 for k in range(len(geometry.comps)): comp = geometry.comps[geometry.keys[k]] for f in range(len(comp.Ks)): verts,edges,edge_group,edgeLengths = premeshFaces[iList] iList += 1 nvert = verts.shape[0] nedge = edges.shape[0] ni, nj = comp.Ks[f].shape idims, jdims = self.faceDims[k][f] print 'Computing skin elements:', geometry.keys[k], f for i in range(ni): for j in range(nj): surf = comp.Ks[f][i,j] if oml0.visible[surf]: nedge1 = PSMlib.countsurfaceedges(nvert, nedge, idims[i], idims[i+1], jdims[j], jdims[j+1], verts, edges) edges1 = PSMlib.computesurfaceedges(nvert, nedge, nedge1, idims[i], idims[i+1], jdims[j], jdims[j+1], verts, edges) print geometry.keys[k], f, i, j quad.importEdges(edges1) if geometry.keys[k]=='fu' and f==1 and i==0 and j==0: nodes, quads = quad.mesh(self.maxL, self.surfEdgeLengths[surf,:,:])#,True,True) else: nodes, quads = quad.mesh(self.maxL, self.surfEdgeLengths[surf,:,:]) 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() P0, Q = PSMlib.computesurfaceprojections(nodes.shape[0], nodes) s,u,v = oml0.evaluateProjection(P0, [surf], Q) B = oml0.evaluateBases(s,u,v) name = geometry.keys[k] + ':' + str(f) + '-' + str(i) + '-' + str(j) self.surfaceNames.append(name) B0.append(B) nnode0.append(nnode0[-1] + P0.shape[0]) quads0.append(quads) B0 = scipy.sparse.vstack(B0) self.meshS = [B0, quads0, nnode0]
def computeMembers(self): nmem = self.nmem geometry = self.geometry bse = geometry._bse groupIntPtr = self.groupIntPtr groupInts = self.groupInts groupSplitPtr = self.groupSplitPtr groupSplits = self.groupSplits quad = self.quad ngroup = self.ngroupS + self.ngroupM nint = groupIntPtr[-1, -1] nsplit = groupSplitPtr[-1, -1] nsurf = bse._num['surf'] ncp = bse._size['cp_str'] nodesInt0 = [] nodesFlt0 = [] quads0 = [] nnode0 = [0] mem0 = [] ucoord0 = [] vcoord0 = [] for imem in range(nmem): print 'Computing internal members:', self.memberNames[imem] edges, edge_group = PSMlib.computememberedges( imem + 1, nmem, self.mem_group) quad.importEdges(edges) verts, edges = quad.verts, quad.edges nvert = PSMlib.countintersectionverts(edges.shape[0], ngroup, edge_group, groupIntPtr, groupSplitPtr) verts = PSMlib.computeintersectionverts( verts.shape[0], edges.shape[0], ngroup, nint, nsplit, nvert + verts.shape[0], verts, edges, edge_group, groupIntPtr, groupInts, groupSplitPtr, groupSplits) quad.importVertsNEdges(verts, edges) nodes, quads = quad.mesh(self.maxL, self.memEdgeLengths[imem, :, :]) nodesInt, nodesFlt = PSMlib.computemembernodes( imem + 1, nmem, nodes.shape[0], self.membersInt, self.membersFlt, nodes) nodesInt0.append(nodesInt) nodesFlt0.append(nodesFlt) quads0.append(quads) nnode0.append(nnode0[-1] + nodes.shape[0]) P0, Q = PSMlib.computesurfaceprojections(nodes.shape[0], nodes) mem0.append(imem * numpy.ones(P0.shape[0])) ucoord0.append(P0[:, 0]) vcoord0.append(P0[:, 1]) nodesInt = numpy.array(numpy.vstack(nodesInt0), order='F') nodesFlt = numpy.array(numpy.vstack(nodesFlt0), order='F') nnode = nodesInt.shape[0] for comp in geometry.comps.values(): for face in comp.faces.values(): ni, nj = face._num_surf['u'], face._num_surf['v'] surf_indices = face._surf_indices idims, jdims = self.faceDims[comp._name][face._name] PSMlib.computememberlocalcoords(comp._num + 1, face._num + 1, ni, nj, nnode, idims, jdims, surf_indices + 1, nodesInt, nodesFlt) linW = numpy.linspace(0, nnode - 1, nnode, dtype='int') B0 = scipy.sparse.csr_matrix((nnode, ncp)) for src in range(4): W = scipy.sparse.csr_matrix((nodesFlt[:, src, 0], (linW, linW))) for surf in range(nsurf): npts = PSMlib.countmembers(surf + 1, src + 1, nnode, nodesInt) if npts is not 0: inds, P, Q = PSMlib.computememberproj( surf + 1, src + 1, nnode, npts, nodesInt, nodesFlt) Ta = numpy.ones(npts) Ti = inds - 1 Tj = numpy.linspace(0, npts - 1, npts) T = scipy.sparse.csr_matrix((Ta, (Ti, Tj)), shape=(nnode, 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') self.meshM = [B0, quads0, nnode0, mem0, ucoord0, vcoord0]
def computeSurfaces(self): geometry = self.geometry bse = geometry._bse quad = self.quad premeshFaces = self.premeshFaces self.surfaceNames = [] B0 = [] quads0 = [] nnode0 = [0] mem0 = [] ucoord0 = [] vcoord0 = [] iList = 0 imem = 0 for comp in geometry.comps.values(): for face in comp.faces.values(): verts, edges, edge_group, edgeLengths = premeshFaces[iList] iList += 1 nvert = verts.shape[0] nedge = edges.shape[0] ni, nj = face._num_surf['u'], face._num_surf['v'] idims, jdims = self.faceDims[comp._name][face._name] print 'Computing skin elements:', comp._name, face._name for i in range(ni): for j in range(nj): surf = face._surf_indices[i, j] if surf >= 0: nedge1 = PSMlib.countsurfaceedges( nvert, nedge, idims[i], idims[i + 1], jdims[j], jdims[j + 1], verts, edges) edges1 = PSMlib.computesurfaceedges( nvert, nedge, nedge1, idims[i], idims[i + 1], jdims[j], jdims[j + 1], verts, edges) print comp._name, face._name, i, j quad.importEdges(edges1) output = False if comp._name == 'lw' and face._name == 'upp' and i == 0 and j == 2: output = True nodes, quads = quad.mesh( self.maxL, self.surfEdgeLengths[surf, :, :], output, output) 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 ] P0, Q = PSMlib.computesurfaceprojections( nodes.shape[0], nodes) bse.compute_projection('temp', P0, [surf], ndim=3) B = bse.jac['d(temp)/d(cp_str)'] name = '{}:{}:{:03d}:{:03d}'.format( comp._name, face._name, i, j) self.surfaceNames.append(name) B0.append(B) nnode0.append(nnode0[-1] + P0.shape[0]) quads0.append(quads) mem0.append(imem * numpy.ones(P0.shape[0])) imem += 1 ucoord0.append(P0[:, 0]) vcoord0.append(P0[:, 1]) bse.apply_jacobian('cp_str', 'd(cp_str)/d(cp)', 'cp') B0 = scipy.sparse.vstack(B0) self.meshS = [B0, quads0, nnode0, mem0, ucoord0, vcoord0]
def computeSurfaces(self): geometry = self.geometry oml0 = geometry.oml0 quad = self.quad premeshFaces = self.premeshFaces self.surfaceNames = [] B0 = [] quads0 = [] nnode0 = [0] iList = 0 for comp in geometry.comps.values(): for face in comp.faces.values(): verts, edges, edge_group, edgeLengths = premeshFaces[iList] iList += 1 nvert = verts.shape[0] nedge = edges.shape[0] ni, nj = face.num_surf idims, jdims = self.faceDims[comp.name][face.name] print 'Computing skin elements:', comp.name, face.name for i in range(ni): for j in range(nj): surf = face.surf_indices[i, j] if surf >= 0: # and oml0.visible[surf]: nedge1 = PSMlib.countsurfaceedges( nvert, nedge, idims[i], idims[i + 1], jdims[j], jdims[j + 1], verts, edges) edges1 = PSMlib.computesurfaceedges( nvert, nedge, nedge1, idims[i], idims[i + 1], jdims[j], jdims[j + 1], verts, edges) print comp.name, face.name, i, j quad.importEdges(edges1) output = False if comp.name == 'lw' and face.name == 'upp' and i == 0 and j == 2: output = True nodes, quads = quad.mesh( self.maxL, self.surfEdgeLengths[surf, :, :], output, output) 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() P0, Q = PSMlib.computesurfaceprojections( nodes.shape[0], nodes) s, u, v = oml0.evaluateProjection(P0, [surf], Q) B = oml0.evaluateBases(s, u, v) name = comp.name + ':' + str( face.name) + ':' + str(i) + ':' + str(j) self.surfaceNames.append(name) B0.append(B) nnode0.append(nnode0[-1] + P0.shape[0]) quads0.append(quads) B0 = scipy.sparse.vstack(B0) self.meshS = [B0, quads0, nnode0]
def computeMembers(self): nmem = self.nmem geometry = self.geometry bse = geometry._bse groupIntPtr = self.groupIntPtr groupInts = self.groupInts groupSplitPtr = self.groupSplitPtr groupSplits = self.groupSplits quad = self.quad ngroup = self.ngroupS + self.ngroupM nint = groupIntPtr[-1,-1] nsplit = groupSplitPtr[-1,-1] nsurf = bse._num['surf'] ncp = bse._size['cp_str'] nodesInt0 = [] nodesFlt0 = [] quads0 = [] nnode0 = [0] mem0 = [] ucoord0 = [] vcoord0 = [] for imem in range(nmem): print 'Computing internal members:', self.memberNames[imem] edges, edge_group = PSMlib.computememberedges(imem+1, nmem, self.mem_group) quad.importEdges(edges) verts, edges = quad.verts, quad.edges nvert = PSMlib.countintersectionverts(edges.shape[0], ngroup, edge_group, groupIntPtr, groupSplitPtr) verts = PSMlib.computeintersectionverts(verts.shape[0], edges.shape[0], ngroup, nint, nsplit, nvert + verts.shape[0], verts, edges, edge_group, groupIntPtr, groupInts, groupSplitPtr, groupSplits) quad.importVertsNEdges(verts, edges) nodes, quads = quad.mesh(self.maxL, self.memEdgeLengths[imem,:,:]) nodesInt, nodesFlt = PSMlib.computemembernodes(imem+1, nmem, nodes.shape[0], self.membersInt, self.membersFlt, nodes) nodesInt0.append(nodesInt) nodesFlt0.append(nodesFlt) quads0.append(quads) nnode0.append(nnode0[-1] + nodes.shape[0]) P0, Q = PSMlib.computesurfaceprojections(nodes.shape[0], nodes) mem0.append(imem*numpy.ones(P0.shape[0])) ucoord0.append(P0[:,0]) vcoord0.append(P0[:,1]) nodesInt = numpy.array(numpy.vstack(nodesInt0),order='F') nodesFlt = numpy.array(numpy.vstack(nodesFlt0),order='F') nnode = nodesInt.shape[0] for comp in geometry.comps.values(): for face in comp.faces.values(): ni, nj = face._num_surf['u'], face._num_surf['v'] surf_indices = face._surf_indices idims, jdims = self.faceDims[comp._name][face._name] PSMlib.computememberlocalcoords(comp._num+1, face._num+1, ni, nj, nnode, idims, jdims, surf_indices+1, nodesInt, nodesFlt) linW = numpy.linspace(0,nnode-1,nnode) B0 = scipy.sparse.csr_matrix((nnode,ncp)) for src in range(4): W = scipy.sparse.csr_matrix((nodesFlt[:,src,0],(linW,linW))) for surf in range(nsurf): npts = PSMlib.countmembers(surf+1, src+1, nnode, nodesInt) if npts is not 0: inds, P, Q = PSMlib.computememberproj(surf+1, src+1, nnode, npts, nodesInt, nodesFlt) Ta = numpy.ones(npts) Ti = inds - 1 Tj = numpy.linspace(0,npts-1,npts) T = scipy.sparse.csr_matrix((Ta,(Ti,Tj)),shape=(nnode,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') self.meshM = [B0, quads0, nnode0, mem0, ucoord0, vcoord0]
def computeSurfaces(self): geometry = self.geometry bse = geometry._bse quad = self.quad premeshFaces = self.premeshFaces self.surfaceNames = [] B0 = [] quads0 = [] nnode0 = [0] mem0 = [] ucoord0 = [] vcoord0 = [] iList = 0 imem = 0 for comp in geometry.comps.values(): for face in comp.faces.values(): verts,edges,edge_group,edgeLengths = premeshFaces[iList] iList += 1 nvert = verts.shape[0] nedge = edges.shape[0] ni, nj = face._num_surf['u'], face._num_surf['v'] idims, jdims = self.faceDims[comp._name][face._name] print 'Computing skin elements:', comp._name, face._name for i in range(ni): for j in range(nj): surf = face._surf_indices[i,j] if surf >= 0: nedge1 = PSMlib.countsurfaceedges(nvert, nedge, idims[i], idims[i+1], jdims[j], jdims[j+1], verts, edges) edges1 = PSMlib.computesurfaceedges(nvert, nedge, nedge1, idims[i], idims[i+1], jdims[j], jdims[j+1], verts, edges) print comp._name, face._name, i, j quad.importEdges(edges1) output = False if comp._name=='lw' and face._name=='upp' and i==0 and j==2: output = True nodes, quads = quad.mesh(self.maxL, self.surfEdgeLengths[surf,:,:], output, output) 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] P0, Q = PSMlib.computesurfaceprojections(nodes.shape[0], nodes) bse.compute_projection('temp', P0, [surf], ndim=3) B = bse.jac['d(temp)/d(cp_str)'] name = comp._name + ':' + str(face._name) + ':' + str(i) + ':' + str(j) self.surfaceNames.append(name) B0.append(B) nnode0.append(nnode0[-1] + P0.shape[0]) quads0.append(quads) mem0.append(imem*numpy.ones(P0.shape[0])) imem += 1 ucoord0.append(P0[:,0]) vcoord0.append(P0[:,1]) bse.apply_jacobian('cp_str', 'd(cp_str)/d(cp)', 'cp') B0 = scipy.sparse.vstack(B0) self.meshS = [B0, quads0, nnode0, mem0, ucoord0, vcoord0]