Home
last modified time | relevance | path

Searched refs:appctx (Results 1 – 25 of 40) sorted by relevance

12

/petsc/src/ts/tutorials/
H A Dex50.c85 AppCtx appctx; /* user-defined application context */ in main() local
98 appctx.param.N = 10; /* order of the spectral element */ in main()
99 appctx.param.E = 10; /* number of elements */ in main()
100 appctx.param.L = 4.0; /* length of the domain */ in main()
101 appctx.param.mu = 0.01; /* diffusion coefficient */ in main()
102 appctx.initial_dt = 5e-3; in main()
103 appctx.param.steps = PETSC_INT_MAX; in main()
104 appctx.param.Tend = 4; in main()
106 PetscCall(PetscOptionsGetInt(NULL, NULL, "-N", &appctx.param.N, NULL)); in main()
107 PetscCall(PetscOptionsGetInt(NULL, NULL, "-E", &appctx.param.E, NULL)); in main()
[all …]
H A Dex4.c84 AppCtx appctx; /* user-defined application context */ in main() local
103 appctx.comm = PETSC_COMM_WORLD; in main()
107 PetscCall(PetscOptionsHasName(NULL, NULL, "-debug", &appctx.debug)); in main()
108 appctx.m = m; in main()
109 appctx.h = 1.0 / (m - 1.0); in main()
110 appctx.norm_2 = 0.0; in main()
111 appctx.norm_max = 0.0; in main()
125 PetscCall(DMDACreate1d(PETSC_COMM_WORLD, DM_BOUNDARY_NONE, m, 1, 1, NULL, &appctx.da)); in main()
126 PetscCall(DMSetFromOptions(appctx.da)); in main()
127 PetscCall(DMSetUp(appctx.da)); in main()
[all …]
H A Dex2.c69 AppCtx appctx; /* user-defined application context */ in main() local
87 appctx.comm = PETSC_COMM_WORLD; in main()
88 appctx.m = 60; in main()
90 PetscCall(PetscOptionsGetInt(NULL, NULL, "-M", &appctx.m, NULL)); in main()
91 PetscCall(PetscOptionsHasName(NULL, NULL, "-debug", &appctx.debug)); in main()
94 appctx.h = 1.0 / (appctx.m - 1.0); in main()
105 PetscCall(DMDACreate1d(PETSC_COMM_WORLD, DM_BOUNDARY_NONE, appctx.m, 1, 1, NULL, &appctx.da)); in main()
106 PetscCall(DMSetFromOptions(appctx.da)); in main()
107 PetscCall(DMSetUp(appctx.da)); in main()
114 PetscCall(DMCreateGlobalVector(appctx.da, &u)); in main()
[all …]
H A Dex3.c81 AppCtx appctx; /* user-defined application context */ in main() local
104 PetscCall(PetscOptionsHasName(NULL, NULL, "-debug", &appctx.debug)); in main()
108 appctx.m = m; in main()
109 appctx.h = 1.0 / (m - 1.0); in main()
110 appctx.norm_2 = 0.0; in main()
111 appctx.norm_max = 0.0; in main()
123 PetscCall(VecDuplicate(u, &appctx.solution)); in main()
129 PetscCall(PetscViewerDrawOpen(PETSC_COMM_SELF, 0, "", 80, 380, 400, 160, &appctx.viewer1)); in main()
130 PetscCall(PetscViewerDrawGetDraw(appctx.viewer1, 0, &draw)); in main()
132 PetscCall(PetscViewerDrawOpen(PETSC_COMM_SELF, 0, "", 80, 0, 400, 160, &appctx.viewer2)); in main()
[all …]
H A Dex5.c75 AppCtx appctx; /* user-defined application context */ in main() local
98 PetscCall(PetscOptionsHasName(NULL, NULL, "-debug", &appctx.debug)); in main()
99 appctx.m = m; in main()
100 appctx.h = 1.0 / (m - 1.0); in main()
101 appctx.norm_2 = 0.0; in main()
102 appctx.norm_max = 0.0; in main()
114 PetscCall(VecDuplicate(u, &appctx.solution)); in main()
120 PetscCall(PetscViewerDrawOpen(PETSC_COMM_SELF, 0, "", 80, 380, 400, 160, &appctx.viewer1)); in main()
121 PetscCall(PetscViewerDrawGetDraw(appctx.viewer1, 0, &draw)); in main()
123 PetscCall(PetscViewerDrawOpen(PETSC_COMM_SELF, 0, "", 80, 0, 400, 160, &appctx.viewer2)); in main()
[all …]
H A Dex6.c77 AppCtx appctx; /* user-defined application context */ in main() local
100 PetscCall(PetscOptionsHasName(NULL, NULL, "-debug", &appctx.debug)); in main()
102 appctx.m = m; in main()
103 appctx.h = 1.0 / (m - 1.0); in main()
104 appctx.norm_2 = 0.0; in main()
105 appctx.norm_max = 0.0; in main()
117 PetscCall(VecDuplicate(u, &appctx.solution)); in main()
123 PetscCall(PetscViewerDrawOpen(PETSC_COMM_SELF, 0, "", 80, 380, 400, 160, &appctx.viewer1)); in main()
124 PetscCall(PetscViewerDrawGetDraw(appctx.viewer1, 0, &draw)); in main()
126 PetscCall(PetscViewerDrawOpen(PETSC_COMM_SELF, 0, "", 80, 0, 400, 160, &appctx.viewer2)); in main()
[all …]
H A Dex21.c71 AppCtx appctx; /* user-defined application context */ in main() local
92 appctx.comm = PETSC_COMM_WORLD; in main()
93 appctx.m = 60; in main()
94 PetscCall(PetscOptionsGetInt(NULL, NULL, "-M", &appctx.m, NULL)); in main()
97 PetscCall(PetscOptionsHasName(NULL, NULL, "-debug", &appctx.debug)); in main()
99 appctx.h = 1.0 / (appctx.m - 1.0); in main()
110 PetscCall(DMDACreate1d(PETSC_COMM_WORLD, DM_BOUNDARY_NONE, appctx.m, 1, 1, NULL, &appctx.da)); in main()
111 PetscCall(DMSetFromOptions(appctx.da)); in main()
112 PetscCall(DMSetUp(appctx.da)); in main()
119 PetscCall(DMCreateGlobalVector(appctx.da, &u)); in main()
[all …]
/petsc/src/tao/unconstrained/tutorials/
H A Dspectraladjointassimilation.c108 AppCtx appctx; /* user-defined application context */ in main() local
122 appctx.param.N = 10; /* order of the spectral element */ in main()
123 appctx.param.E = 8; /* number of elements */ in main()
124 appctx.param.L = 1.0; /* length of the domain */ in main()
125 appctx.param.mu = 0.00001; /* diffusion coefficient */ in main()
126 appctx.param.a = 0.0; /* advection speed */ in main()
127 appctx.initial_dt = 1e-4; in main()
128 appctx.param.steps = PETSC_INT_MAX; in main()
129 appctx.param.Tend = 0.01; in main()
130 appctx.ncoeff = 2; in main()
[all …]
H A Dburgers_spectral.c97 AppCtx appctx; /* user-defined application context */ in main() local
112 appctx.param.N = 10; /* order of the spectral element */ in main()
113 appctx.param.E = 10; /* number of elements */ in main()
114 appctx.param.L = 4.0; /* length of the domain */ in main()
115 appctx.param.mu = 0.01; /* diffusion coefficient */ in main()
116 appctx.initial_dt = 5e-3; in main()
117 appctx.param.steps = PETSC_INT_MAX; in main()
118 appctx.param.Tend = 4; in main()
120 PetscCall(PetscOptionsGetInt(NULL, NULL, "-N", &appctx.param.N, NULL)); in main()
121 PetscCall(PetscOptionsGetInt(NULL, NULL, "-E", &appctx.param.E, NULL)); in main()
[all …]
/petsc/src/ts/tests/
H A Dex12.c63 AppCtx appctx; /* user-defined application context */ in main() local
84 appctx.comm = PETSC_COMM_WORLD; in main()
85 appctx.m = 60; in main()
87 PetscCall(PetscOptionsGetInt(options, NULL, "-M", &appctx.m, NULL)); in main()
89 appctx.h = 1.0 / (appctx.m - 1.0); in main()
100 PetscCall(DMDACreate1d(PETSC_COMM_WORLD, DM_BOUNDARY_NONE, appctx.m, 1, 1, NULL, &appctx.da)); in main()
101 PetscCall(PetscObjectSetOptions((PetscObject)appctx.da, options)); in main()
102 PetscCall(DMSetFromOptions(appctx.da)); in main()
103 PetscCall(DMSetUp(appctx.da)); in main()
110 PetscCall(DMCreateGlobalVector(appctx.da, &u)); in main()
[all …]
H A Dex3.c51 AppCtx appctx; /* user-defined application context */ in main() local
65 appctx.nz = nz; in main()
68 appctx.m = m; in main()
69 appctx.max_probsz = nz; in main()
70 appctx.debug = PETSC_FALSE; in main()
71 appctx.useAlhs = PETSC_FALSE; in main()
74 PetscCall(PetscOptionsName("-debug", NULL, NULL, &appctx.debug)); in main()
75 PetscCall(PetscOptionsName("-useAlhs", NULL, NULL, &appctx.useAlhs)); in main()
87 PetscCall(VecDuplicate(init_sol, &appctx.solution)); in main()
91 PetscCall(MatCreateSeqAIJ(PETSC_COMM_WORLD, m, m, 3, NULL, &appctx.Amat)); in main()
[all …]
H A Dex24.c18 AppCtx *appctx = (AppCtx *)ctx; /* user-defined application context */ in RHSJacobian() local
89 entries[0] = appctx->D1 * sy; in RHSJacobian()
92 entries[1] = appctx->D1 * sy; in RHSJacobian()
95 entries[2] = appctx->D1 * sx; in RHSJacobian()
98 entries[3] = appctx->D1 * sx; in RHSJacobian()
101 entries[4] = -2.0 * appctx->D1 * (sx + sy) - vc * vc - appctx->gamma; in RHSJacobian()
110 entries[0] = appctx->D2 * sy; in RHSJacobian()
112 entries[1] = appctx->D2 * sy; in RHSJacobian()
114 entries[2] = appctx->D2 * sx; in RHSJacobian()
116 entries[3] = appctx->D2 * sx; in RHSJacobian()
[all …]
/petsc/src/ts/tutorials/advection-diffusion-reaction/
H A Dex5opt_ic.c29 PetscErrorCode InitializeLambda(DM da, Vec lambda, Vec U, AppCtx *appctx) in InitializeLambda() argument
64 PetscErrorCode GenerateOBs(TS ts, Vec U, AppCtx *appctx) in GenerateOBs() argument
212 AppCtx appctx; in main() local
222 appctx.D1 = 8.0e-5; in main()
223 appctx.D2 = 4.0e-5; in main()
224 appctx.gamma = .024; in main()
225 appctx.kappa = .06; in main()
226 appctx.aijpc = PETSC_FALSE; in main()
237 PetscCall(DMCreateGlobalVector(da, &appctx.U)); in main()
240 PetscCall(TSCreate(PETSC_COMM_WORLD, &appctx.ts)); in main()
[all …]
H A Dex4.c47 AppCtx appctx; in main() local
55 appctx.epsilon = 1.0e-3; in main()
56 appctx.delta = 1.0; in main()
57 appctx.alpha = 10.0; in main()
58 appctx.beta = 4.0; in main()
59 appctx.gamma = 1.0; in main()
60 appctx.kappa = .75; in main()
61 appctx.lambda = 1.0; in main()
62 appctx.mu = 100.; in main()
63 appctx.cstar = .2; in main()
[all …]
H A Dex3.c50 AppCtx appctx; /* user-defined application context */ in main() local
63 appctx.a = 1.0; in main()
64 appctx.d = 0.0; in main()
65 PetscCall(PetscOptionsGetScalar(NULL, NULL, "-a", &appctx.a, NULL)); in main()
66 PetscCall(PetscOptionsGetScalar(NULL, NULL, "-d", &appctx.d, NULL)); in main()
67 appctx.upwind = PETSC_TRUE; in main()
68 PetscCall(PetscOptionsGetBool(NULL, NULL, "-upwind", &appctx.upwind, NULL)); in main()
94 PetscCall(TSSetRHSFunction(ts, NULL, TSComputeRHSFunctionLinear, &appctx)); in main()
95 PetscCall(TSSetRHSJacobian(ts, NULL, NULL, RHSMatrixHeat, &appctx)); in main()
96 …Call(TSSetSolutionFunction(ts, (PetscErrorCode (*)(TS, PetscReal, Vec, void *))Solution, &appctx)); in main()
[all …]
H A Dreaction_diffusion.c29 AppCtx *appctx = (AppCtx *)ptr; in RHSFunction() local
77 f[j][i].u = appctx->D1 * (uxx + uyy) - uc * vc * vc + appctx->gamma * (1.0 - uc); in RHSFunction()
78 f[j][i].v = appctx->D2 * (vxx + vyy) + uc * vc * vc - (appctx->gamma + appctx->kappa) * vc; in RHSFunction()
94 AppCtx *appctx = (AppCtx *)ctx; /* user-defined application context */ in RHSJacobian() local
165 entries[0] = appctx->D1 * sy; in RHSJacobian()
168 entries[1] = appctx->D1 * sy; in RHSJacobian()
171 entries[2] = appctx->D1 * sx; in RHSJacobian()
174 entries[3] = appctx->D1 * sx; in RHSJacobian()
177 entries[4] = -2.0 * appctx->D1 * (sx + sy) - vc * vc - appctx->gamma; in RHSJacobian()
185 …if (appctx->aijpc) PetscCall(MatSetValuesStencil(BB, 1, &rowstencil, 6, stencil, entries, INSERT_V… in RHSJacobian()
[all …]
H A Dex5adj_mf.c25 AppCtx *appctx; member
61 AppCtx *appctx; in MyRHSMatMultTranspose() local
71 appctx = mctx->appctx; in MyRHSMatMultTranspose()
106 y[j][i].u = appctx->D1 * (uxx + uyy) - ucb * (vc * vc + appctx->gamma) + vc * vc * vcb; in MyRHSMatMultTranspose()
107 …y[j][i].v = appctx->D2 * (vxx + vyy) - 2.0 * uc * vc * ucb + (2.0 * uc * vc - appctx->gamma - appc… in MyRHSMatMultTranspose()
120 AppCtx *appctx; in MyIMatMultTranspose() local
130 appctx = mctx->appctx; in MyIMatMultTranspose()
165 y[j][i].u = appctx->D1 * (uxx + uyy) - ucb * (vc * vc + appctx->gamma) + vc * vc * vcb; in MyIMatMultTranspose()
166 …y[j][i].v = appctx->D2 * (vxx + vyy) - 2.0 * uc * vc * ucb + (2.0 * uc * vc - appctx->gamma - appc… in MyIMatMultTranspose()
181 AppCtx *appctx; in MyIMatMult() local
[all …]
H A Dex5adj.c47 AppCtx appctx; in main() local
55 appctx.aijpc = PETSC_FALSE; in main()
56 PetscCall(PetscOptionsGetBool(NULL, NULL, "-aijpc", &appctx.aijpc, NULL)); in main()
58 appctx.D1 = 8.0e-5; in main()
59 appctx.D2 = 4.0e-5; in main()
60 appctx.gamma = .024; in main()
61 appctx.kappa = .06; in main()
87 PetscCall(TSSetRHSFunction(ts, NULL, RHSFunction, &appctx)); in main()
88 PetscCall(TSSetRHSJacobian(ts, NULL, NULL, RHSJacobian, &appctx)); in main()
91 PetscCall(TSSetIFunction(ts, NULL, IFunction, &appctx)); in main()
[all …]
H A Dex5.c91 AppCtx appctx; in main() local
98 appctx.D1 = 8.0e-5; in main()
99 appctx.D2 = 4.0e-5; in main()
100 appctx.gamma = .024; in main()
101 appctx.kappa = .06; in main()
102 appctx.aijpc = PETSC_FALSE; in main()
126 PetscCall(TSSetRHSFunction(ts, NULL, RHSFunction, &appctx)); in main()
127 PetscCall(TSSetRHSJacobian(ts, NULL, NULL, RHSJacobian, &appctx)); in main()
H A Dex6.c36 AppCtx appctx; /* user-defined application context */ in main() local
50 appctx.a = -1.0; in main()
51 PetscCall(PetscOptionsGetReal(NULL, NULL, "-a", &appctx.a, NULL)); in main()
68 PetscCall(TSSetIFunction(ts, NULL, IFunction_LaxWendroff, &appctx)); in main()
71 PetscCall(TSSetIFunction(ts, NULL, IFunction_LaxFriedrichs, &appctx)); in main()
76 dt = 1.0 / (PetscAbsReal(appctx.a) * M); in main()
85 PetscCall(InitialConditions(ts, U, &appctx)); in main()
88 …Call(TSSetSolutionFunction(ts, (PetscErrorCode (*)(TS, PetscReal, Vec, void *))Solution, &appctx)); in main()
112 PetscErrorCode InitialConditions(TS ts, Vec U, AppCtx *appctx) in InitialConditions() argument
160 PetscErrorCode Solution(TS ts, PetscReal t, Vec U, AppCtx *appctx) in Solution() argument
[all …]
/petsc/src/binding/petsc4py/src/petsc4py/PETSc/
H A Dpetscpyappctx.pxi3 cdef inline object registerAppCtx(void *appctx): argument
4 cdef object key = <Py_uintptr_t> appctx
7 cdef inline object toAppCtx(void *appctx): argument
8 cdef object key = <Py_uintptr_t> appctx
10 return <object> appctx
12 if appctx != NULL:
13 return PyLong_FromVoidPtr(appctx)
/petsc/src/ts/tutorials/autodiff/
H A Dadr_ex5adj.cxx77 AppCtx appctx; in main() local
91appctx.aijpc = PETSC_FALSE, adctx->no_an = PETSC_FALSE, adctx->sparse = PETSC_FALSE, adctx->sparse… in main()
93 PetscCall(PetscOptionsGetBool(NULL, NULL, "-aijpc", &appctx.aijpc, NULL)); in main()
98 appctx.D1 = 8.0e-5; in main()
99 appctx.D2 = 4.0e-5; in main()
100 appctx.gamma = .024; in main()
101 appctx.kappa = .06; in main()
102 appctx.adctx = adctx; in main()
129 PetscCall(TSSetRHSFunction(ts, NULL, RHSFunctionPassive, &appctx)); in main()
131 …ATSSetIFunctionLocal(da, INSERT_VALUES, (DMDATSIFunctionLocalFn *)IFunctionLocalPassive, &appctx)); in main()
[all …]
H A Dadr_ex5adj_mf.cxx47 AppCtx appctx; /* Application context */ in main() local
60 appctx.D1 = 8.0e-5; in main()
61 appctx.D2 = 4.0e-5; in main()
62 appctx.gamma = .024; in main()
63 appctx.kappa = .06; in main()
104 …ATSSetIFunctionLocal(da, INSERT_VALUES, (DMDATSIFunctionLocalFn *)IFunctionLocalPassive, &appctx)); in main()
118 PetscCall(PetscNew(&appctx.adctx)); in main()
119 PetscCall(IFunctionActive(ts, 1., x, matctx.Xdot, r, &appctx)); in main()
120 PetscCall(PetscFree(appctx.adctx)); in main()
126 PetscCall(TSSetIJacobian(ts, A, A, IJacobianMatFree, &appctx)); in main()
[all …]
/petsc/src/snes/tutorials/network/water/
H A Dwater.c13 AppCtx_Water appctx; in main() local
32 …orkRegisterComponent(networkdm, "edgestruct", sizeof(struct _p_EDGE_Water), &appctx.compkey_edge)); in main()
33 …orkRegisterComponent(networkdm, "busstruct", sizeof(struct _p_VERTEX_Water), &appctx.compkey_vtx)); in main()
66 …for (i = 0; i < ne; i++) PetscCall(DMNetworkAddComponent(networkdm, edges[i], appctx.compkey_edge,… in main()
68 …for (i = 0; i < nv; i++) PetscCall(DMNetworkAddComponent(networkdm, vtx[i], appctx.compkey_vtx, &w… in main()
/petsc/src/snes/tutorials/network/power/
H A Dpower2.c11 …lX, Vec localF, PetscInt nv, PetscInt ne, const PetscInt *vtx, const PetscInt *edges, void *appctx) in FormFunction_Subnet() argument
13 UserCtx_Power *User = (UserCtx_Power *)appctx; in FormFunction_Subnet()
123 PetscErrorCode FormFunction(SNES snes, Vec X, Vec F, void *appctx) in FormFunction() argument
144 PetscCall(FormFunction_Subnet(networkdm, localX, localF, nv, ne, vtx, edges, appctx)); in FormFunction()
148 PetscCall(FormFunction_Subnet(networkdm, localX, localF, nv, ne, vtx, edges, appctx)); in FormFunction()
158 …at J, Mat Jpre, PetscInt nv, PetscInt ne, const PetscInt *vtx, const PetscInt *edges, void *appctx) in FormJacobian_Subnet() argument
160 UserCtx_Power *User = (UserCtx_Power *)appctx; in FormJacobian_Subnet()
339 PetscErrorCode FormJacobian(SNES snes, Vec X, Mat J, Mat Jpre, void *appctx) in FormJacobian() argument
357 PetscCall(FormJacobian_Subnet(networkdm, localX, J, Jpre, nv, ne, vtx, edges, appctx)); in FormJacobian()
361 PetscCall(FormJacobian_Subnet(networkdm, localX, J, Jpre, nv, ne, vtx, edges, appctx)); in FormJacobian()
[all …]

12