def createBilinear(self): wk = self.workGroup list_P = wk.viewer.MarkerPoints if len(list_P) != 4 : print("You have to specify 4 markers.") return A = list_P[0] B = list_P[1] C = list_P[2] D = list_P[3] points = np.zeros((2,2,3)) points[0,0,:] = A[:3] points[1,0,:] = B[:3] points[0,1,:] = C[:3] points[1,1,:] = D[:3] # weights[0,0] = A[3] # weights[1,0] = B[3] # weights[0,1] = C[3] # weights[1,1] = D[3] from caid.cad_geometry import bilinear nrb = bilinear(points=points)[0] wk.viewer.CleanMarkerPoints() geo = cad_geometry() geo.append(nrb) wk.add_geometry(geometry(geo)) wk.Refresh()
def createBilinear(self): wk = self.workGroup list_P = wk.viewer.MarkerPoints if len(list_P) != 4: print("You have to specify 4 markers.") return A = list_P[0] B = list_P[1] C = list_P[2] D = list_P[3] points = np.zeros((2, 2, 3)) points[0, 0, :] = A[:3] points[1, 0, :] = B[:3] points[0, 1, :] = C[:3] points[1, 1, :] = D[:3] # weights[0,0] = A[3] # weights[1,0] = B[3] # weights[0,1] = C[3] # weights[1,1] = D[3] from caid.cad_geometry import bilinear nrb = bilinear(points=points)[0] wk.viewer.CleanMarkerPoints() geo = cad_geometry() geo.append(nrb) wk.add_geometry(geometry(geo)) wk.Refresh()
def geometry_2D(nx, ny, px, py): # ... # points = np.asarray([[[0.,0.],[0.,1.]],[[1.,0.],[1.,1.]]]) points = np.asarray([[[0., 0.], [0., 1.]], [[2., 0.], [1., 1.]]]) nrb = bilinear(points) geo = cg.cad_geometry(geo=nrb) geo.refine(id=0, list_p=[px - 1, py - 1]) tx = np.linspace(0., 1., nx + 2)[1:-1] ty = np.linspace(0., 1., ny + 2)[1:-1] geo.refine(id=0, list_t=[tx, ty]) # ... return geo
def test3(): from . import fem as fem from caid.cad_geometry import line, circle, bilinear import caid.cad_geometry as cg fe = fem.fem() geo1 = cg.cad_geometry(geo=line()) geo2 = cg.cad_geometry(geo=circle()) geo3 = cg.cad_geometry(geo=bilinear()) PDE1 = pigasus(fem=fe, geometry=geo1) PDE2 = pigasus(fem=fe, geometry=geo2) PDE3 = pigasus(fem=fe, geometry=geo3)
def OnDrawSelectionRectangle(self, x1, y1, x2, y2): # glClear(GL_COLOR_BUFFER_BIT) # glBegin(GL_QUADS) # col = self.theme.color_viewer("selection") + [self.theme.alpha] # glColor4f(*col) # glVertex2f(x1, y1) # glVertex2f(x2, y1) # glVertex2f(x2, y2) # glVertex2f(x1, y2) # glEnd() points = np.asarray([[[x1,y1],[x1,y2]],[[x2,y1],[x2,y2]]]) geo_selection = geometry(bilinear(points=points)) col = self.theme.color_viewer("selection") geo_selection.Draw(alpha=self.beta, blend=self.enableBlend, NurbsColor=col)
# exact solution # ... u = lambda x,y : sin ( kx * x ) * sin ( ky * y ) testcase['u'] = u # ... # ... # rhs # ... f = lambda x,y : ( kx**2 + ky**2 ) * sin ( kx * x ) * sin ( ky * y ) testcase['f'] = f # ... # ... points = np.asarray([[[0.,0.],[0.,1.]],[[1.,0.],[1.,1.]]]) nrb = bilinear(points) geo = cg.cad_geometry(geo=nrb) geo.refine(id=0,list_p=[2, 2]) tx = np.linspace(0.,1.,7)[1:-1] ty = np.linspace(0.,1.,7)[1:-1] geo.refine(id=0, list_t=[tx, ty]) # ... PDE = EllipticPDE(geometry=geo, testcase=testcase) PDE.assembly() # ... sl = spsolve(matrix=PDE.S_V) print(sl)