def elements_std(self,nodesold,nodesnew):
     elements = []
     for nodesoldchunk, nodesnewchunk in zip(pairwise(nodesold),pairwise(nodesnew)):
         node1old, node2old = nodesoldchunk
         node1new, node2new = nodesnewchunk
         elements.append([node1new,node2new,node2old,node1old])
     return elements
 def elements_extend(self,nodesold,nodesnew):
     elements = []
     for nodesoldchunk, nodesnewchunk in zip(pairwise(nodesold),pairwise(nodesnew[1:-1])): # first and last will be taken care of in spare elements
         node1old, node2old = nodesoldchunk
         node1new, node2new = nodesnewchunk
         elements.append([node1new,node2new,node2old,node1old])
     return elements
 def elements_extend(self,nodesold,nodesnew):
     elements = []
     for nodesoldchunk, nodesnewchunk in zip(pairwise(nodesold),pairwise(nodesnew[1:-1])):
         node1old, node2old = nodesoldchunk
         node1new, node2new = nodesnewchunk
         elements.append([node1new,node2new,node1old])
         elements.append([node2new,node2old,node1old])
     # corners
     elements.append([nodesnew[0],nodesnew[1],nodesold[0]])
     elements.append([nodesnew[-2],nodesnew[-1],nodesold[-1]])
     return elements
 def elements_collapse(self,nodesold,nodesnew):
     elements = []
     for nodesoldchunk, nodenew in zip(threewise(nodesold),nodesnew[1:-1]):
         node1old, node2old, node3old = nodesoldchunk
         elements.append([node1old,node2old,nodenew])
         elements.append([node2old,node3old,nodenew])
     for nodeold, nodesnewchunk in zip(nodesold[::2],pairwise(nodesnew)):
         node1new, node2new = nodesnewchunk
         elements.append([node1new,node2new,nodeold])
     return elements
 def gen_rectangle_mesh(self,bounds,nnodesvec):
     xmin, xmax, ymin, ymax = bounds
     nx, ny = nnodesvec
     lines = []
     for ycoord in np.linspace(ymin,ymax,ny):
         startpoint = np.array([xmin,ycoord])
         endpoint = np.array([xmax,ycoord])
         line = Line(startpoint,endpoint)
         line.nodenums = self.nodes.gen_fe_nodes_along_line(line,nx)
         lines.append(line)
     for lineprev, linenext in pairwise(lines): # iterate over prev, current
         elements = self.elements_std(lineprev.nodenums,linenext.nodenums)
         self.add_elements_from_list(elements)
        def crack_edges(interfacenode):
            def atom_edges():
                pos = self.mesh.nodes.xy[interfacenode, :]
                crackline = cdmesh.Line(pos, [0.0, pos[1]])
                return self.mesh.nodes.search_for_nodes_along_line(crackline)

            def fe_edges():
                xposint, yposint = self.mesh.nodes.xy[interfacenode, :]
                xposfe = self.outerbox.bounds[0]
                xposfe, yposfe = self.mesh.nodes.closest_point(np.array([xposfe, yposint]))
                xposleft = xposint - fac * self.r0
                crackline = cdmesh.Line([xposleft, yposfe], [xposint, yposfe])
                return self.mesh.nodes.search_for_nodes_along_line(crackline)

            cracknodes = np.append(fe_edges(), atom_edges()) + 1  # offset by 1 (Python vs. Fortran indexing)
            return np.array(list(Mmath.pairwise(cracknodes)))
Beispiel #7
0
        def crack_edges(interfacenode):
            def atom_edges():
                pos = self.mesh.nodes.xy[interfacenode, :]
                crackline = cdmesh.Line(pos, [0.0, pos[1]])
                return self.mesh.nodes.search_for_nodes_along_line(crackline)

            def fe_edges():
                xposint, yposint = self.mesh.nodes.xy[interfacenode, :]
                xposfe = self.outerbox.bounds[0]
                xposfe, yposfe = self.mesh.nodes.closest_point(
                    np.array([xposfe, yposint]))
                xposleft = xposint - fac * self.r0
                crackline = cdmesh.Line([xposleft, yposfe], [xposint, yposfe])
                return self.mesh.nodes.search_for_nodes_along_line(crackline)

            cracknodes = np.append(
                fe_edges(),
                atom_edges()) + 1  # offset by 1 (Python vs. Fortran indexing)
            return np.array(list(Mmath.pairwise(cracknodes)))