Lines Matching refs:ctx
98 ZoomCtx *ctx = (ZoomCtx *)dctx; in PetscDrawTensorContour_Zoom() local
101 …PetscCall(PetscDrawTensorContourPatch(win, ctx->m, ctx->n, ctx->x, ctx->y, ctx->min, ctx->max, ctx… in PetscDrawTensorContour_Zoom()
102 if (ctx->showgrid) { in PetscDrawTensorContour_Zoom()
103 …for (i = 0; i < ctx->m; i++) PetscCall(PetscDrawLine(win, ctx->x[i], ctx->y[0], ctx->x[i], ctx->y[… in PetscDrawTensorContour_Zoom()
104 …for (i = 0; i < ctx->n; i++) PetscCall(PetscDrawLine(win, ctx->x[0], ctx->y[i], ctx->x[ctx->m - 1]… in PetscDrawTensorContour_Zoom()
138 ZoomCtx ctx; in PetscDrawTensorContour() local
148 ctx.v = v; in PetscDrawTensorContour()
149 ctx.m = m; in PetscDrawTensorContour()
150 ctx.n = n; in PetscDrawTensorContour()
151 ctx.max = ctx.min = v[0]; in PetscDrawTensorContour()
153 if (ctx.max < ctx.v[i]) ctx.max = ctx.v[i]; in PetscDrawTensorContour()
154 if (ctx.min > ctx.v[i]) ctx.min = ctx.v[i]; in PetscDrawTensorContour()
156 if (ctx.max - ctx.min < 1.e-7) { in PetscDrawTensorContour()
157 ctx.min -= 5.e-8; in PetscDrawTensorContour()
158 ctx.max += 5.e-8; in PetscDrawTensorContour()
163 PetscCall(PetscDrawScalePopup(popup, ctx.min, ctx.max)); in PetscDrawTensorContour()
165 ctx.showgrid = PETSC_FALSE; in PetscDrawTensorContour()
166 …PetscCall(PetscOptionsGetBool(((PetscObject)draw)->options, NULL, "-draw_contour_grid", &ctx.showg… in PetscDrawTensorContour()
171 PetscCall(PetscMalloc1(ctx.m, &ctx.x)); in PetscDrawTensorContour()
172 h = 1.0 / (ctx.m - 1); in PetscDrawTensorContour()
173 ctx.x[0] = 0.0; in PetscDrawTensorContour()
174 for (i = 1; i < ctx.m; i++) ctx.x[i] = ctx.x[i - 1] + h; in PetscDrawTensorContour()
175 } else ctx.x = (PetscReal *)xi; in PetscDrawTensorContour()
179 PetscCall(PetscMalloc1(ctx.n, &ctx.y)); in PetscDrawTensorContour()
180 h = 1.0 / (ctx.n - 1); in PetscDrawTensorContour()
181 ctx.y[0] = 0.0; in PetscDrawTensorContour()
182 for (i = 1; i < ctx.n; i++) ctx.y[i] = ctx.y[i - 1] + h; in PetscDrawTensorContour()
183 } else ctx.y = (PetscReal *)yi; in PetscDrawTensorContour()
185 PetscCall(PetscDrawZoom(draw, PetscDrawTensorContour_Zoom, &ctx)); in PetscDrawTensorContour()
187 if (!xin) PetscCall(PetscFree(ctx.x)); in PetscDrawTensorContour()
188 if (!yin) PetscCall(PetscFree(ctx.y)); in PetscDrawTensorContour()