• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Golang plt.Reset函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中github.com/cpmech/gosl/plt.Reset函数的典型用法代码示例。如果您正苦于以下问题:Golang Reset函数的具体用法?Golang Reset怎么用?Golang Reset使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了Reset函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。

示例1: Test_fun12

func Test_fun12(tst *testing.T) {

	//verbose()
	chk.PrintTitle("fun12. mul")

	cos, err := New("cos", []*Prm{
		&Prm{N: "a", V: 1},
		&Prm{N: "b/pi", V: 2},
		&Prm{N: "c", V: 1},
	})
	if err != nil {
		tst.Errorf("test failed: %v\n", err)
		return
	}

	lin, err := New("lin", []*Prm{
		&Prm{N: "m", V: 0.5},
		&Prm{N: "ts", V: 0},
	})
	if err != nil {
		tst.Errorf("test failed: %v\n", err)
		return
	}

	mul, err := New("mul", []*Prm{
		&Prm{N: "fa", Fcn: cos},
		&Prm{N: "fb", Fcn: lin},
	})
	if err != nil {
		tst.Errorf("test failed: %v\n", err)
		return
	}

	tmin := 0.0
	tmax := 1.0
	xcte := []float64{0, 0, 0}
	//if true {
	if false {
		withG, withH, save, show := true, true, false, true
		plt.Reset()
		PlotT(cos, "/tmp/gosl", "fun-cos-12.png", tmin, tmax, xcte, 41, "", withG, withH, save, show, nil)
		plt.Reset()
		PlotT(lin, "/tmp/gosl", "fun-lin-12.png", tmin, tmax, xcte, 41, "", withG, withH, save, show, nil)
		plt.Reset()
		PlotT(mul, "/tmp/gosl", "fun-mul-12.png", tmin, tmax, xcte, 41, "", withG, withH, save, show, nil)
	}

	sktol := 1e-10
	dtol := 1e-9
	dtol2 := 1e-8
	ver := chk.Verbose
	tskip := []float64{tmin, tmax}
	CheckDerivT(tst, cos, tmin, tmax, xcte, 11, nil, sktol, dtol, dtol2, ver)
	io.Pf("\n")
	CheckDerivT(tst, lin, tmin, tmax, xcte, 11, tskip, sktol, dtol, dtol2, ver)
	io.Pf("\n")
	CheckDerivT(tst, mul, tmin, tmax, xcte, 11, tskip, sktol, dtol, dtol2, ver)
}
开发者ID:PaddySchmidt,项目名称:gosl,代码行数:58,代码来源:t_fun_test.go


示例2: Test_fun03

func Test_fun03(tst *testing.T) {

	//verbose()
	chk.PrintTitle("fun03. add, cte, srmps")

	cte, err := New("cte", []*Prm{&Prm{N: "C", V: 30}})
	if err != nil {
		tst.Errorf("test failed: %v\n", err)
		return
	}

	srmps, err := New("srmps", []*Prm{
		&Prm{N: "ca", V: 0},
		&Prm{N: "cb", V: 1},
		&Prm{N: "ta", V: 0},
		&Prm{N: "tb", V: 1},
	})
	if err != nil {
		tst.Errorf("test failed: %v\n", err)
		return
	}

	add, err := New("add", []*Prm{
		&Prm{N: "a", V: 1},
		&Prm{N: "b", V: 1},
		&Prm{N: "fa", Fcn: cte},
		&Prm{N: "fb", Fcn: srmps},
	})
	if err != nil {
		tst.Errorf("test failed: %v\n", err)
		return
	}

	tmin := 0.0
	tmax := 1.0
	xcte := []float64{0, 0, 0}
	if false {
		withG, withH, save, show := true, true, false, true
		plt.Reset()
		PlotT(cte, "/tmp/gosl", "fun-cte-01.png", tmin, tmax, xcte, 41, "", withG, withH, save, show, nil)
		plt.Reset()
		PlotT(srmps, "/tmp/gosl", "fun-srmps-01.png", tmin, tmax, xcte, 41, "", withG, withH, save, show, nil)
		plt.Reset()
		PlotT(add, "/tmp/gosl", "fun-add-01.png", tmin, tmax, xcte, 41, "", withG, withH, save, show, nil)
	}

	sktol := 1e-10
	dtol := 1e-10
	dtol2 := 1e-9
	ver := chk.Verbose
	tskip := []float64{tmin, tmax}
	CheckDerivT(tst, cte, tmin, tmax, xcte, 11, nil, sktol, dtol, dtol2, ver)
	io.Pf("\n")
	CheckDerivT(tst, srmps, tmin, tmax, xcte, 11, tskip, sktol, dtol, dtol2, ver)
	io.Pf("\n")
	CheckDerivT(tst, add, tmin, tmax, xcte, 11, tskip, sktol, dtol, dtol2, ver)
}
开发者ID:PaddySchmidt,项目名称:gosl,代码行数:57,代码来源:t_fun_test.go


示例3: PlotTwoNurbs

// PlotTwoNurbs plots two NURBS for comparison
func PlotTwoNurbs(dirout, fn string, b, c *Nurbs, npts int, ids bool, extra func()) {
	plt.Reset()
	if io.FnExt(fn) == ".eps" {
		plt.SetForEps(1.5, 500)
	} else {
		plt.SetForPng(1.5, 500, 150)
	}

	plt.Subplot(3, 1, 1)
	b.DrawCtrl2d(ids, "", "")
	b.DrawElems2d(npts, ids, "", "")
	if extra != nil {
		extra()
	}
	plt.Equal()

	plt.Subplot(3, 1, 2)
	c.DrawCtrl2d(ids, "", "")
	c.DrawElems2d(npts, ids, "", "")
	plt.Equal()

	plt.Subplot(3, 1, 3)
	b.DrawElems2d(npts, ids, ", lw=3", "")
	c.DrawElems2d(npts, ids, ", color='red', marker='+', markevery=10", "color='green', size=7, va='bottom'")
	plt.Equal()

	plt.SaveD(dirout, fn)
}
开发者ID:PaddySchmidt,项目名称:gosl,代码行数:29,代码来源:plotnurbs.go


示例4: PlotAll

// PlotAll plot all functions
func (o FuncsData) PlotAll(pd *PlotFdata, dirout, fnkey string) {
	ext := "png"
	if pd.Eps {
		ext = "eps"
	}
	fn := io.Sf("functions-%s.%s", fnkey, ext)
	plt.Reset()
	for k, f := range o {
		if utl.StrIndexSmall(pd.Skip, f.Name) >= 0 {
			continue
		}
		save := (k == len(o)-1)
		args := io.Sf("label='%s', clip_on=0", f.Name)
		ff := o.Get(f.Name)
		if ff != nil {
			if pd.WithTxt {
				x := pd.Ti
				y := ff.F(x, nil)
				plt.Text(x, y, io.Sf("%g", y), "fontsize=8")
				x = pd.Tf
				y = ff.F(x, nil)
				plt.Text(x, y, io.Sf("%g", y), "fontsize=8, ha='right'")
			}
			fun.PlotT(ff, dirout, fn, pd.Ti, pd.Tf, nil, pd.Np, args, pd.WithG, pd.WithH, save, false, nil)
		}
	}
}
开发者ID:PatrickSchm,项目名称:gofem,代码行数:28,代码来源:func.go


示例5: Test_fun11

func Test_fun11(tst *testing.T) {

	//verbose()
	chk.PrintTitle("fun11. ref-inc-rl1")

	fun, err := New("ref-inc-rl1", []*Prm{
		&Prm{N: "lam0", V: 0.001},
		&Prm{N: "lam1", V: 1.2},
		&Prm{N: "alp", V: 0.01},
		&Prm{N: "bet", V: 10},
	})
	if err != nil {
		tst.Errorf("test failed: %v\n", err)
		return
	}

	tmin := 0.0
	tmax := 1.0
	xcte := []float64{0, 0, 0}
	if false {
		plt.Reset()
		withG, withH, save, show := true, true, false, true
		PlotT(fun, "/tmp/gosl", "fun-ref-inc-rl1-01.png", tmin, tmax, xcte, 41, "'.-'", withG, withH, save, show, nil)
	}

	sktol := 1e-10
	dtol := 1e-10
	dtol2 := 1e-10
	ver := chk.Verbose
	CheckDerivT(tst, fun, tmin, tmax, xcte, 11, nil, sktol, dtol, dtol2, ver)
}
开发者ID:PaddySchmidt,项目名称:gosl,代码行数:31,代码来源:t_fun_test.go


示例6: Test_fun10

func Test_fun10(tst *testing.T) {

	//verbose()
	chk.PrintTitle("fun10. rmp")

	fun, err := New("rmp", []*Prm{
		&Prm{N: "ta", V: 1},
		&Prm{N: "tb", V: 2},
		&Prm{N: "ca", V: 0.5},
		&Prm{N: "cb", V: -1.5},
	})
	if err != nil {
		tst.Errorf("test failed: %v\n", err)
		return
	}

	tmin := 0.0
	tmax := 3.0
	xcte := []float64{0, 0, 0}
	if false {
		plt.Reset()
		withG, withH, save, show := true, true, false, true
		PlotT(fun, "/tmp/gosl", "fun-rmp-01.png", tmin, tmax, xcte, 4, "'.-'", withG, withH, save, show, nil)
	}

	sktol := 1e-10
	dtol := 1e-12
	dtol2 := 1e-17
	ver := chk.Verbose
	CheckDerivT(tst, fun, tmin, tmax, xcte, 11, nil, sktol, dtol, dtol2, ver)
}
开发者ID:PaddySchmidt,项目名称:gosl,代码行数:31,代码来源:t_fun_test.go


示例7: Test_fun09

func Test_fun09(tst *testing.T) {

	//verbose()
	chk.PrintTitle("fun09. cos")

	fun, err := New("cos", []*Prm{
		&Prm{N: "a", V: 10},
		&Prm{N: "b", V: math.Pi},
		&Prm{N: "c", V: 1.0},
	})
	if err != nil {
		tst.Errorf("test failed: %v\n", err)
		return
	}

	tmin := 0.0
	tmax := 2.0
	xcte := []float64{0, 0, 0}
	if false {
		plt.Reset()
		withG, withH, save, show := true, true, false, true
		PlotT(fun, "/tmp/gosl", "fun-cos-01.png", tmin, tmax, xcte, 41, "'.-'", withG, withH, save, show, nil)
	}

	sktol := 1e-10
	dtol := 1e-8
	dtol2 := 1e-7
	ver := chk.Verbose
	CheckDerivT(tst, fun, tmin, tmax, xcte, 11, nil, sktol, dtol, dtol2, ver)
}
开发者ID:PaddySchmidt,项目名称:gosl,代码行数:30,代码来源:t_fun_test.go


示例8: Test_fun13

func Test_fun13(tst *testing.T) {

	//verbose()
	chk.PrintTitle("fun13. mul")

	pulse, err := New("pulse", []*Prm{
		&Prm{N: "ca", V: 0.2},
		&Prm{N: "cb", V: 2.0},
		&Prm{N: "ta", V: 1.0},
		&Prm{N: "tb", V: 2.5},
	})
	if err != nil {
		tst.Errorf("test failed: %v\n", err)
		return
	}

	tmin := 0.0
	tmax := 5.0
	xcte := []float64{0, 0, 0}
	//if true {
	if false {
		withG, withH, save, show := true, true, false, true
		plt.Reset()
		PlotT(pulse, "/tmp/gosl", "fun-pulse-13.png", tmin, tmax, xcte, 61, "", withG, withH, save, show, nil)
	}

	sktol := 1e-17
	dtol := 1e-10
	dtol2 := 1e-10
	ver := chk.Verbose
	tskip := []float64{1, 4}
	CheckDerivT(tst, pulse, tmin, tmax, xcte, 11, tskip, sktol, dtol, dtol2, ver)
}
开发者ID:PaddySchmidt,项目名称:gosl,代码行数:33,代码来源:t_fun_test.go


示例9: Test_fun06c

func Test_fun06c(tst *testing.T) {

	//verbose()
	chk.PrintTitle("fun06c. pts")

	fun, err := New("pts", []*Prm{
		// T =                     0 0.05 0.1 0.2 0.3 0.5  0.75 1
		&Prm{N: "y=dt", Extra: "0.05 0.05 0.1 0.1 0.2 0.25 0.25 0"},
	})
	if err != nil {
		tst.Errorf("test failed: %v\n", err)
		return
	}

	tmin := 0.0
	tmax := 1.0
	xcte := []float64{0, 0, 0}
	//if true {
	if false {
		plt.Reset()
		withG, withH, save, show := true, true, true, false
		PlotT(fun, "/tmp/gosl", "fun-ptsC-01.png", tmin, tmax, xcte, 8, "'o-', clip_on=0", withG, withH, save, show, nil)
	}

	tmin = 0.01
	tmax = 0.99
	sktol := 1e-10
	dtol := 1e-10
	dtol2 := 1e-10
	ver := chk.Verbose
	CheckDerivT(tst, fun, tmin, tmax, xcte, 10, nil, sktol, dtol, dtol2, ver)
}
开发者ID:PaddySchmidt,项目名称:gosl,代码行数:32,代码来源:t_fun_test.go


示例10: Test_fun08

func Test_fun08(tst *testing.T) {

	//verbose()
	chk.PrintTitle("fun08. exc2")

	fun, err := New("exc2", []*Prm{
		&Prm{N: "ta", V: 5},
		&Prm{N: "A", V: 3},
		&Prm{N: "b", V: 0.2},
	})
	if err != nil {
		tst.Errorf("test failed: %v\n", err)
		return
	}

	tmin := 0.0
	tmax := 7.0
	xcte := []float64{0, 0, 0}
	if false {
		plt.Reset()
		withG, withH, save, show := true, true, false, true
		PlotT(fun, "/tmp/gosl", "fun-exc2-01.png", tmin, tmax, xcte, 41, "'o-'", withG, withH, save, show, nil)
	}

	sktol := 1e-10
	dtol := 1e-10
	dtol2 := 1e-10
	ver := chk.Verbose
	CheckDerivT(tst, fun, tmin, tmax, xcte, 11, nil, sktol, dtol, dtol2, ver)
}
开发者ID:PaddySchmidt,项目名称:gosl,代码行数:30,代码来源:t_fun_test.go


示例11: Test_fun04

func Test_fun04(tst *testing.T) {

	//verbose()
	chk.PrintTitle("fun04. lin")

	lin, err := New("lin", []*Prm{
		&Prm{N: "m", V: 0.5},
		&Prm{N: "ts", V: 0},
	})
	if err != nil {
		tst.Errorf("test failed: %v\n", err)
		return
	}

	tmin := 0.0
	tmax := 1.0
	xcte := []float64{0, 0, 0}
	if false {
		plt.Reset()
		withG, withH, save, show := true, true, false, true
		PlotT(lin, "/tmp/gosl", "fun-lin-01.png", tmin, tmax, xcte, 11, "", withG, withH, save, show, nil)
	}

	sktol := 1e-10
	dtol := 1e-10
	dtol2 := 1e-10
	ver := chk.Verbose
	CheckDerivT(tst, lin, tmin, tmax, xcte, 11, nil, sktol, dtol, dtol2, ver)
}
开发者ID:PaddySchmidt,项目名称:gosl,代码行数:29,代码来源:t_fun_test.go


示例12: Test_bc01

func Test_bc01(tst *testing.T) {

	doplot := false
	//doplot := true
	chk.PrintTitle("bc01")

	mdl := GetModel("testsim", "mat1", "bc", false)
	mdl.Init(mdl.GetPrms(true))

	pc0 := -1.0
	sl0 := 1.0
	pcf := 3.0
	nptsA := 11
	nptsB := 11

	if doplot {
		plt.Reset()
		Plot(mdl, pc0, sl0, pcf, nptsA, "'b.-'", "'r+-'", "bc")
	}

	tolCc := 1e-11
	tolD1a, tolD1b := 1e-10, 1e-17
	tolD2a, tolD2b := 1e-10, 1e-17
	Check(tst, mdl, pc0, sl0, pcf, nptsB, tolCc, tolD1a, tolD1b, tolD2a, tolD2b, chk.Verbose, []float64{0.2}, 1e-7, doplot)

	if doplot {
		PlotEnd(true)
	}
}
开发者ID:PatrickSchm,项目名称:gofem,代码行数:29,代码来源:t_bc_test.go


示例13: PlotTwoVarsContour

// PlotTwoVarsContour plots contour for two variables problem. len(x) == 2
//  Input
//   dirout  -- directory to save files
//   fnkey   -- file name key for eps figure
//   x       -- solution. can be <nil>
//   np      -- number of points for contour
//   extra   -- called just before saving figure
//   axequal -- axis.equal
//   vmin    -- min 0 values
//   vmax    -- max 1 values
//   f       -- function to plot filled contour. can be <nil>
//   gs      -- functions to plot contour @ level 0. can be <nil>
func PlotTwoVarsContour(dirout, fnkey string, x []float64, np int, extra func(), axequal bool,
	vmin, vmax []float64, f TwoVarsFunc_t, gs ...TwoVarsFunc_t) {
	if fnkey == "" {
		return
	}
	chk.IntAssert(len(vmin), 2)
	chk.IntAssert(len(vmax), 2)
	V0, V1 := utl.MeshGrid2D(vmin[0], vmax[0], vmin[1], vmax[1], np, np)
	var Zf [][]float64
	var Zg [][][]float64
	if f != nil {
		Zf = la.MatAlloc(np, np)
	}
	if len(gs) > 0 {
		Zg = utl.Deep3alloc(len(gs), np, np)
	}
	xtmp := make([]float64, 2)
	for i := 0; i < np; i++ {
		for j := 0; j < np; j++ {
			xtmp[0], xtmp[1] = V0[i][j], V1[i][j]
			if f != nil {
				Zf[i][j] = f(xtmp)
			}
			for k, g := range gs {
				Zg[k][i][j] = g(xtmp)
			}
		}
	}
	plt.Reset()
	plt.SetForEps(0.8, 350)
	if f != nil {
		cmapidx := 0
		plt.Contour(V0, V1, Zf, io.Sf("fsz=7, cmapidx=%d", cmapidx))
	}
	for k, _ := range gs {
		plt.ContourSimple(V0, V1, Zg[k], false, 8, "zorder=5, levels=[0], colors=['yellow'], linewidths=[2], clip_on=0")
	}
	if x != nil {
		plt.PlotOne(x[0], x[1], "'r*', label='optimum', zorder=10")
	}
	if extra != nil {
		extra()
	}
	if dirout == "" {
		dirout = "."
	}
	plt.Cross("clr='grey'")
	plt.SetXnticks(11)
	plt.SetYnticks(11)
	if axequal {
		plt.Equal()
	}
	plt.AxisRange(vmin[0], vmax[0], vmin[1], vmax[1])
	args := "leg_out='1', leg_ncol=4, leg_hlen=1.5"
	plt.Gll("$x_0$", "$x_1$", args)
	plt.SaveD(dirout, fnkey+".eps")
}
开发者ID:yunpeng1,项目名称:gosl,代码行数:69,代码来源:plotting.go


示例14: Test_invs05

func Test_invs05(tst *testing.T) {

	//verbose()
	chk.PrintTitle("invs05")

	if SAVEPLOT {
		plt.Reset()
		plt.SetForPng(1, 500, 125)
		PlotRosette(1.1, true, true, true, 7)
	}

	addtoplot := func(σa, σb float64, σ []float64) {
		plt.PlotOne(σa, σb, "'ro', ms=5")
		plt.Text(σa, σb, io.Sf("$\\sigma_{123}=(%g,%g,%g)$", σ[0], σ[1], σ[2]), "size=8")
	}

	dotest := func(σ []float64, σacor, σbcor, σccor, θcor, tolσ float64) {
		w := M_w(σ)
		θ2 := math.Asin(w) * 180.0 / (3.0 * math.Pi)
		θ3 := M_θ(σ)
		σa, σb, σc := L2O(σ[0], σ[1], σ[2])
		σ0, σ1, σ2 := O2L(σa, σb, σc)
		σI, σA := make([]float64, 3), []float64{σa, σb, σc}
		la.MatVecMul(σI, 1, O2Lmat(), σA) // σI := L * σA
		io.Pf("σa σb σc = %v %v %v\n", σa, σb, σc)
		io.Pf("w        = %v\n", w)
		io.Pf("θ2, θ3   = %v, %v\n", θ2, θ3)
		chk.Scalar(tst, "σa", 1e-17, σa, σacor)
		chk.Scalar(tst, "σb", 1e-17, σb, σbcor)
		chk.Scalar(tst, "σc", 1e-17, σc, σccor)
		chk.Scalar(tst, "σ0", tolσ, σ0, σ[0])
		chk.Scalar(tst, "σ1", tolσ, σ1, σ[1])
		chk.Scalar(tst, "σ2", tolσ, σ2, σ[2])
		chk.Scalar(tst, "σI0", tolσ, σI[0], σ[0])
		chk.Scalar(tst, "σI1", tolσ, σI[1], σ[1])
		chk.Scalar(tst, "σI2", tolσ, σI[2], σ[2])
		chk.Scalar(tst, "θ2", 1e-6, θ2, θcor)
		chk.Scalar(tst, "θ3", 1e-17, θ3, θ2)
		addtoplot(σa, σb, σ)
	}

	dotest([]float64{-1, 0, 0, 0}, 0, 2.0/SQ6, 1.0/SQ3, 30, 1e-15)
	dotest([]float64{0, -1, 0, 0}, 1.0/SQ2, -1.0/SQ6, 1.0/SQ3, 30, 1e-15)
	dotest([]float64{0, 0, -1, 0}, -1.0/SQ2, -1.0/SQ6, 1.0/SQ3, 30, 1e-15)

	if SAVEPLOT {
		plt.Gll("$\\sigma_a$", "$\\sigma_b$", "")
		plt.Equal()
		plt.SaveD("/tmp/gosl", "fig_invs05.png")
	}
}
开发者ID:yunpeng1,项目名称:gosl,代码行数:51,代码来源:t_invariants_test.go


示例15: PlotNurbsBasis

// PlotNurbsBasis plots basis functions la and lb
func PlotNurbsBasis(dirout, fn string, b *Nurbs, la, lb int) {
	npts := 41
	plt.Reset()
	if io.FnExt(fn) == ".eps" {
		plt.SetForEps(1.5, 500)
	} else {
		plt.SetForPng(1.5, 600, 150)
	}

	plt.Subplot(3, 2, 1)
	b.DrawCtrl2d(false, "", "")
	b.DrawElems2d(npts, false, "", "")
	t0 := time.Now()
	b.PlotBasis(la, "", 11, 0) // 0 => CalcBasis
	io.Pfcyan("time elapsed (calcbasis) = %v\n", time.Now().Sub(t0))
	plt.Equal()

	plt.Subplot(3, 2, 2)
	b.DrawCtrl2d(false, "", "")
	b.DrawElems2d(npts, false, "", "")
	b.PlotBasis(lb, "", 11, 0) // 0 => CalcBasis
	plt.Equal()

	plt.Subplot(3, 2, 3)
	b.DrawCtrl2d(false, "", "")
	b.DrawElems2d(npts, false, "", "")
	b.PlotBasis(la, "", 11, 1) // 1 => CalcBasisAndDerivs
	plt.Equal()

	plt.Subplot(3, 2, 4)
	b.DrawCtrl2d(false, "", "")
	b.DrawElems2d(npts, false, "", "")
	b.PlotBasis(lb, "", 11, 1) // 1 => CalcBasisAndDerivs
	plt.Equal()

	plt.Subplot(3, 2, 5)
	b.DrawCtrl2d(false, "", "")
	b.DrawElems2d(npts, false, "", "")
	t0 = time.Now()
	b.PlotBasis(la, "", 11, 2) // 2 => RecursiveBasis
	io.Pfcyan("time elapsed (recursive) = %v\n", time.Now().Sub(t0))
	plt.Equal()

	plt.Subplot(3, 2, 6)
	b.DrawCtrl2d(false, "", "")
	b.DrawElems2d(npts, false, "", "")
	b.PlotBasis(lb, "", 11, 2) // 2 => RecursiveBasis
	plt.Equal()

	plt.SaveD(dirout, fn)
}
开发者ID:PaddySchmidt,项目名称:gosl,代码行数:52,代码来源:plotnurbs.go


示例16: PlotNurbs

// PlotNurbs plots a NURBS
func PlotNurbs(dirout, fn string, b *Nurbs, npts int, ids bool, extra func()) {
	plt.Reset()
	if io.FnExt(fn) == ".eps" {
		plt.SetForEps(1.0, 500)
	} else {
		plt.SetForPng(1.0, 500, 150)
	}
	b.DrawCtrl2d(ids, "", "")
	b.DrawElems2d(npts, ids, "", "")
	if extra != nil {
		extra()
	}
	plt.Equal()
	plt.SaveD(dirout, fn)
}
开发者ID:PaddySchmidt,项目名称:gosl,代码行数:16,代码来源:plotnurbs.go


示例17: PlotNurbsDerivs

// PlotNurbsDerivs plots derivatives of basis functions la and lb
func PlotNurbsDerivs(dirout, fn string, b *Nurbs, la, lb int) {
	npts := 41
	plt.Reset()
	if io.FnExt(fn) == ".eps" {
		plt.SetForEps(1.5, 500)
	} else {
		plt.SetForPng(1.5, 600, 150)
	}

	plt.Subplot(4, 2, 1)
	t0 := time.Now()
	b.PlotDeriv(la, 0, "", npts, 0) // 0 => CalcBasisAndDerivs
	io.Pfcyan("time elapsed (calcbasis) = %v\n", time.Now().Sub(t0))
	plt.Equal()

	plt.Subplot(4, 2, 2)
	t0 = time.Now()
	b.PlotDeriv(la, 0, "", npts, 1) // 1 => NumericalDeriv
	io.Pfcyan("time elapsed (numerical) = %v\n", time.Now().Sub(t0))
	plt.Equal()

	plt.Subplot(4, 2, 3)
	b.PlotDeriv(la, 1, "", npts, 0) // 0 => CalcBasisAndDerivs
	plt.Equal()

	plt.Subplot(4, 2, 4)
	b.PlotDeriv(la, 1, "", npts, 1) // 0 => NumericalDeriv
	plt.Equal()

	plt.Subplot(4, 2, 5)
	b.PlotDeriv(lb, 0, "", npts, 0) // 0 => CalcBasisAndDerivs
	plt.Equal()

	plt.Subplot(4, 2, 6)
	b.PlotDeriv(lb, 0, "", npts, 1) // 0 => NumericalDeriv
	plt.Equal()

	plt.Subplot(4, 2, 7)
	b.PlotDeriv(lb, 1, "", npts, 0) // 0 => CalcBasisAndDerivs
	plt.Equal()

	plt.Subplot(4, 2, 8)
	b.PlotDeriv(lb, 1, "", npts, 1) // 0 => NumericalDeriv
	plt.Equal()

	plt.SaveD(dirout, fn)
}
开发者ID:PaddySchmidt,项目名称:gosl,代码行数:48,代码来源:plotnurbs.go


示例18: SetFig

// SetFig sets figure space for plotting
// Note: this method is optional
func (o *Plotter) SetFig(split, epsfig bool, prop, width float64, savedir, savefnk string) {
	plt.Reset()
	if o.PngRes < 150 {
		o.PngRes = 150
	}
	o.Split = split
	o.UseEps = epsfig
	if o.UseEps {
		plt.SetForEps(prop, width)
	} else {
		plt.SetForPng(prop, width, o.PngRes)
	}
	o.SaveDir = savedir
	o.SaveFnk = io.FnKey(savefnk)
	o.maxR = -1
	// colors and markers
	o.set_default_clr_mrk()
}
开发者ID:PatrickSchm,项目名称:gofem,代码行数:20,代码来源:plotter.go


示例19: Test_refm1a

func Test_refm1a(tst *testing.T) {

	doplot := false
	//doplot := true
	chk.PrintTitle("refm1a")

	mdl := GetModel("testsim", "mat1", "ref-m1", false)
	mdl.Init(mdl.GetPrms(true))

	pc0 := -5.0
	sl0 := 1.0
	pcf := 20.0
	nptsA := 41
	nptsB := 11

	if doplot {
		plt.Reset()
		Plot(mdl, pc0, sl0, pcf, nptsA, "'b.-'", "'r+-'", "ref-m1_drying")
	}

	tolCc := 1e-17
	tolD1a, tolD1b := 1e-11, 1e-11
	tolD2a, tolD2b := 1e-12, 1e-10
	Check(tst, mdl, pc0, sl0, pcf, nptsB, tolCc, tolD1a, tolD1b, tolD2a, tolD2b, chk.Verbose, []float64{0}, 1e-7, doplot)

	slf, err := Update(mdl, pc0, sl0, pcf-pc0)
	if err != nil {
		tst.Errorf("update failed: %v\n", err)
		return
	}

	if doplot {
		Plot(mdl, pcf, slf, pc0, nptsA, "'b*-'", "'r+:'", "ref-m1_wetting")
	}

	tolD1b = 1e-4
	tolD2a, tolD2b = 1e-11, 1e-10
	Check(tst, mdl, pcf, slf, pc0, nptsB, tolCc, tolD1a, tolD1b, tolD2a, tolD2b, chk.Verbose, []float64{0}, 1e-7, doplot)

	if doplot {
		PlotEnd(true)
	}
}
开发者ID:PatrickSchm,项目名称:gofem,代码行数:43,代码来源:t_refm1_test.go


示例20: Test_vg01

func Test_vg01(tst *testing.T) {

	doplot := false
	//doplot := true
	chk.PrintTitle("vg01")

	mdl := GetModel("testsim", "mat1", "vg", false)
	err := mdl.Init(mdl.GetPrms(true))
	if err != nil {
		tst.Errorf("test failed: %v\n", err)
		return
	}

	ref := GetModel("testsim", "mat1", "ref-m1", false)
	err = ref.Init(ref.GetPrms(true))
	if err != nil {
		tst.Errorf("test failed: %v\n", err)
		return
	}

	pc0 := -5.0
	sl0 := 1.0
	pcf := 20.0
	nptsA := 41
	nptsB := 11

	if doplot {
		plt.Reset()
		Plot(ref, pc0, sl0, pcf, nptsA, "'k--'", "'k--'", "ref-m1")
		Plot(mdl, pc0, sl0, pcf, nptsA, "'b.-'", "'r+-'", "vg")
	}

	tolCc := 1e-10
	tolD1a, tolD1b := 1e-10, 1e-17
	tolD2a, tolD2b := 1e-10, 1e-17
	Check(tst, mdl, pc0, sl0, pcf, nptsB, tolCc, tolD1a, tolD1b, tolD2a, tolD2b, chk.Verbose, []float64{}, 1e-7, doplot)

	if doplot {
		PlotEnd(true)
	}
}
开发者ID:PatrickSchm,项目名称:gofem,代码行数:41,代码来源:t_vg_test.go



注:本文中的github.com/cpmech/gosl/plt.Reset函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang plt.SaveD函数代码示例发布时间:2022-05-23
下一篇:
Golang plt.PlotOne函数代码示例发布时间:2022-05-23
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap