Exemplo n.º 1
0
func (g *Grid2D) Init(lx, ly float64, nx, ny int) {
	g.Lx, g.Ly = lx, ly
	g.Nx, g.Ny, g.N = nx, ny, nx*ny
	g.Dx, g.Dy = g.Lx/float64(nx-1), g.Ly/float64(ny-1)
	g.Dxx, g.Dyy = g.Dx*g.Dx, g.Dy*g.Dy

	g.L = utl.IntRange3(0, g.N, g.Nx)
	g.R = utl.IntAddScalar(g.L, g.Nx-1)
	g.B = utl.IntRange(g.Nx)
	g.T = utl.IntAddScalar(g.B, (g.Ny-1)*g.Nx)
}
Exemplo n.º 2
0
// ElemBryLocalInds returns the local (element) indices of control points @ boundaries
// (if element would have all surfaces @ boundaries)
func (o *Nurbs) ElemBryLocalInds() (I [][]int) {
	switch o.gnd {
	case 1:
		return
	case 2:
		I = make([][]int, 2*o.gnd)
		nx, ny := o.p[0]+1, o.p[1]+1
		I[3] = utl.IntRange3(0, nx*ny, nx)
		I[1] = utl.IntAddScalar(I[3], nx-1)
		I[0] = utl.IntRange(nx)
		I[2] = utl.IntAddScalar(I[0], (ny-1)*nx)
	case 3:
		I = make([][]int, 2*o.gnd)
		chk.Panic("3D NURBS: ElemBryLocalInds: TODO") // TODO
	}
	return
}