Example #1
0
// 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)
		}
	}
}
Example #2
0
// GetVertsWithCond gets all vertices with any of the given conditions
//  "seepH" => localVerts={1,2,3}
func GetVertsWithCond(fconds []*FaceCond, conds ...string) (verts []int) {
	for _, fc := range fconds {
		// check if fc has any of conds
		if utl.StrIndexSmall(conds, fc.Cond) < 0 {
			continue
		}

		// add local verts
		for _, lv := range fc.LocalVerts {
			// check if vert was added already
			if utl.IntIndexSmall(verts, lv) < 0 {
				verts = append(verts, lv) // add a vert
			}
		}
	}

	sort.Ints(verts)
	return
}
Example #3
0
// GetVerts gets all vertices with any of the given conditions
//  Example: "seepH" => localVerts={1,2,3}
func (o FaceConds) GetVerts(conds ...string) (verts []int) {

	// for each face condition
	for _, fc := range o {

		// check if fc has any of conds
		if utl.StrIndexSmall(conds, fc.Cond) < 0 {
			continue
		}

		// add local verts
		for _, lv := range fc.LocalVerts {

			// check if vert was added already
			if utl.IntIndexSmall(verts, lv) < 0 {
				verts = append(verts, lv) // add a vert
			}
		}
	}

	// results
	sort.Ints(verts)
	return
}