Ejemplo n.º 1
0
    def computeMembers(self):
        nmem = self.nmem
        geometry = self.geometry
        oml0 = geometry.oml0
        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]

        nodesInt0 = []
        nodesFlt0 = []
        quads0 = []
        nnode0 = [0]
        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])

        nodesInt = numpy.array(numpy.vstack(nodesInt0),order='F')
        nodesFlt = numpy.array(numpy.vstack(nodesFlt0),order='F')
        nnode = nodesInt.shape[0]

        for k in range(len(geometry.comps)):
            comp = geometry.comps[geometry.keys[k]]
            for f in range(len(comp.Ks)):
                ni, nj = comp.Ks[f].shape
                idims, jdims = self.faceDims[k][f]
                PSMlib.computememberlocalcoords(k+1, f+1, ni, nj, nnode, idims, jdims, comp.Ks[f]+1, nodesInt, nodesFlt)

        linW = numpy.linspace(0,nnode-1,nnode)
        B0 = scipy.sparse.csr_matrix((nnode,oml0.C.shape[0]))
        for src in range(4):
            W = scipy.sparse.csr_matrix((nodesFlt[:,src,0],(linW,linW)))
            for surf in range(oml0.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, 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))

        self.meshM = [B0, quads0, nnode0]
Ejemplo n.º 2
0
    def computeMembers(self):
        nmem = self.nmem
        geometry = self.geometry
        oml0 = geometry.oml0
        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]

        nodesInt0 = []
        nodesFlt0 = []
        quads0 = []
        nnode0 = [0]
        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])

        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
                idims, jdims = self.faceDims[comp.name][face.name]
                PSMlib.computememberlocalcoords(comp.num + 1, face.num + 1, ni,
                                                nj, nnode, idims, jdims,
                                                face.surf_indices + 1,
                                                nodesInt, nodesFlt)

        linW = numpy.linspace(0, nnode - 1, nnode)
        B0 = scipy.sparse.csr_matrix((nnode, oml0.C.shape[0]))
        for src in range(4):
            W = scipy.sparse.csr_matrix((nodesFlt[:, src, 0], (linW, linW)))
            for surf in range(oml0.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, 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))

        self.meshM = [B0, quads0, nnode0]
Ejemplo n.º 3
0
    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]
Ejemplo n.º 4
0
    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]