Home
last modified time | relevance | path

Searched refs:user (Results 1 – 25 of 385) sorted by relevance

12345678910>>...16

/petsc/src/tao/pde_constrained/tutorials/
H A Delliptic.c103 AppCtx user; in main() local
109 user.mx = 8; in main()
111 …PetscCall(PetscOptionsInt("-mx", "Number of grid points in each direction", "", user.mx, &user.mx,… in main()
112 user.ns = 6; in main()
113 …PetscCall(PetscOptionsInt("-ns", "Number of data samples (1<=ns<=8)", "", user.ns, &user.ns, NULL)… in main()
114 user.ndata = 64; in main()
115 …PetscCall(PetscOptionsInt("-ndata", "Numbers of data points per sample", "", user.ndata, &user.nda… in main()
116 user.alpha = 0.1; in main()
117 …PetscCall(PetscOptionsReal("-alpha", "Regularization parameter", "", user.alpha, &user.alpha, NULL… in main()
118 user.beta = 0.00001; in main()
[all …]
H A Dhyperbolic.c70 PetscErrorCode HyperbolicInitialize(AppCtx *user);
71 PetscErrorCode HyperbolicDestroy(AppCtx *user);
98 AppCtx user; in main() local
107 user.mx = 32; in main()
109 …PetscCall(PetscOptionsInt("-mx", "Number of grid points in each direction", "", user.mx, &user.mx,… in main()
110 user.nt = 16; in main()
111 PetscCall(PetscOptionsInt("-nt", "Number of time steps", "", user.nt, &user.nt, NULL)); in main()
112 user.ndata = 64; in main()
113 …PetscCall(PetscOptionsInt("-ndata", "Numbers of data points per sample", "", user.ndata, &user.nda… in main()
114 user.alpha = 10.0; in main()
[all …]
H A Dparabolic.c75 PetscErrorCode ParabolicInitialize(AppCtx *user);
76 PetscErrorCode ParabolicDestroy(AppCtx *user);
100 AppCtx user; in main() local
109 user.mx = 8; in main()
111 …PetscCall(PetscOptionsInt("-mx", "Number of grid points in each direction", "", user.mx, &user.mx,… in main()
112 user.nt = 8; in main()
113 PetscCall(PetscOptionsInt("-nt", "Number of time steps", "", user.nt, &user.nt, NULL)); in main()
114 user.ndata = 64; in main()
115 …PetscCall(PetscOptionsInt("-ndata", "Numbers of data points per sample", "", user.ndata, &user.nda… in main()
116 user.ns = 8; in main()
[all …]
/petsc/src/tao/constrained/tutorials/
H A DtomographyADMM.c37 AppCtx *user; in TaoShellSolve_SoftThreshold() local
42 user = NULL; in TaoShellSolve_SoftThreshold()
47 PetscCall(TaoShellGetContext(tao, &user)); in TaoShellSolve_SoftThreshold()
50 work = user->workN; in TaoShellSolve_SoftThreshold()
56 PetscCall(MatMult(user->D, x, work)); in TaoShellSolve_SoftThreshold()
68 AppCtx *user = (AppCtx *)ptr; in MisfitObjectiveAndGradient() local
72 PetscCall(MatMult(user->A, X, user->workM)); in MisfitObjectiveAndGradient()
73 PetscCall(VecAXPY(user->workM, -1, user->b)); in MisfitObjectiveAndGradient()
74 PetscCall(VecDot(user->workM, user->workM, f)); in MisfitObjectiveAndGradient()
77 PetscCall(MatMult(user->ATA, X, user->workN)); in MisfitObjectiveAndGradient()
[all …]
H A Dex1.c61 AppCtx user; /* application context */ in main() local
73 PetscCall(InitializeProblem(&user)); /* sets up problem, function below */ in main()
77 PetscCall(TaoSetSolution(tao, user.x)); in main()
78 if (!user.noboundflag) PetscCall(TaoSetVariableBounds(tao, user.xl, user.xu)); in main()
79 PetscCall(TaoSetObjectiveAndGradient(tao, NULL, FormFunctionGradient, (void *)&user)); in main()
85 if (!user.noeqflag) { in main()
86 … PetscCall(TaoSetEqualityConstraintsRoutine(tao, user.ce, FormEqualityConstraints, (void *)&user)); in main()
87 …PetscCall(TaoSetJacobianEqualityRoutine(tao, user.Ae, user.Ae, FormEqualityJacobian, (void *)&user in main()
89 …PetscCall(TaoSetInequalityConstraintsRoutine(tao, user.ci, FormInequalityConstraints, (void *)&use… in main()
90 …PetscCall(TaoSetJacobianInequalityRoutine(tao, user.Ai, user.Ai, FormInequalityJacobian, (void *)& in main()
[all …]
H A Dmaros.c60 AppCtx user; /* application context */ in main() local
67 PetscCall(PetscStrncpy(user.name, "HS21", sizeof(user.name))); in main()
68 PetscCall(PetscOptionsGetString(NULL, NULL, "-cutername", user.name, sizeof(user.name), &flg)); in main()
70 PetscCall(PetscPrintf(PETSC_COMM_WORLD, "\n---- MAROS Problem %s -----\n", user.name)); in main()
71 PetscCall(InitializeProblem(&user)); in main()
72 PetscCall(VecDuplicate(user.d, &x)); in main()
73 PetscCall(VecDuplicate(user.beq, &ceq)); in main()
74 PetscCall(VecDuplicate(user.bin, &cin)); in main()
80 PetscCall(TaoSetObjectiveAndGradient(tao, NULL, FormFunctionGradient, (void *)&user)); in main()
81 PetscCall(TaoSetEqualityConstraintsRoutine(tao, ceq, FormEqualityConstraints, (void *)&user)); in main()
[all …]
/petsc/src/ts/tutorials/power_grid/
H A Dex8.c63 AppCtx user; /* Application context */ in main() local
70 PetscCall(Parameter_settings(&user)); in main()
72 …te2d(PETSC_COMM_WORLD, user.bx, user.by, DMDA_STENCIL_STAR, 4, 4, PETSC_DECIDE, PETSC_DECIDE, 1, u… in main()
73 PetscCall(DMSetFromOptions(user.da)); in main()
74 PetscCall(DMSetUp(user.da)); in main()
76 PetscCall(DMDASetUniformCoordinates(user.da, user.xmin, user.xmax, user.ymin, user.ymax, 0, 0)); in main()
77 PetscCall(DMDASetCoordinateName(user.da, 0, "X - the angle")); in main()
78 PetscCall(DMDASetCoordinateName(user.da, 1, "Y - the speed")); in main()
81 PetscCall(DMCreateGlobalVector(user.da, &x)); in main()
83 PetscCall(ini_bou(x, &user)); in main()
[all …]
H A Dex5.c71 AppCtx *user; in SaveSolution() local
79 PetscCall(TSGetApplicationContext(ts, &user)); in SaveSolution()
82 idx = 3 * user->stepnum; in SaveSolution()
83 PetscCall(MatDenseGetArray(user->Sol, &mat)); in SaveSolution()
87 PetscCall(MatDenseRestoreArray(user->Sol, &mat)); in SaveSolution()
89 user->stepnum++; in SaveSolution()
94 PetscErrorCode WindSpeeds(AppCtx *user) in WindSpeeds() argument
100 user->cw = 5; in WindSpeeds()
101 user->kw = 2; /* Rayleigh distribution */ in WindSpeeds()
102 user->nsamples = 2000; in WindSpeeds()
[all …]
H A Dex6.c55 AppCtx user; /* Application context */ in main() local
62 PetscCall(Parameter_settings(&user)); in main()
64 …M_BOUNDARY_NONE, DMDA_STENCIL_STAR, 4, 4, PETSC_DECIDE, PETSC_DECIDE, 1, 1, NULL, NULL, &user.da)); in main()
65 PetscCall(DMSetFromOptions(user.da)); in main()
66 PetscCall(DMSetUp(user.da)); in main()
68 …PetscCall(DMDASetUniformCoordinates(user.da, user.xmin, user.xmax, user.ymin, user.ymax, 0.0, 1.0)… in main()
71 PetscCall(DMCreateGlobalVector(user.da, &x)); in main()
73 PetscCall(ini_bou(x, &user)); in main()
79 PetscCall(DMSetMatType(user.da, MATAIJ)); in main()
80 PetscCall(DMCreateMatrix(user.da, &J)); in main()
[all …]
H A Dex7.c57 AppCtx user; /* Application context */ in main() local
64 PetscCall(Parameter_settings(&user)); in main()
66 …te2d(PETSC_COMM_WORLD, user.bx, user.by, DMDA_STENCIL_STAR, 4, 4, PETSC_DECIDE, PETSC_DECIDE, 1, u… in main()
67 PetscCall(DMSetFromOptions(user.da)); in main()
68 PetscCall(DMSetUp(user.da)); in main()
70 PetscCall(DMDASetUniformCoordinates(user.da, user.xmin, user.xmax, user.ymin, user.ymax, 0, 0)); in main()
71 PetscCall(DMDASetCoordinateName(user.da, 0, "X - the angle")); in main()
72 PetscCall(DMDASetCoordinateName(user.da, 1, "Y - the speed")); in main()
75 PetscCall(DMCreateGlobalVector(user.da, &x)); in main()
77 PetscCall(ini_bou(x, &user)); in main()
[all …]
/petsc/src/ts/tutorials/
H A Dex23fwdadj.c31 User user = (User)ctx; in IFunction() local
39 f[0] = user->c * xdot[0] - user->b * x[0]; in IFunction()
48 User user = (User)ctx; in IJacobian() local
55 J[0][0] = user->c * a - user->b * 1.0; in IJacobian()
70 User user = (User)ctx; in IJacobianP() local
80 if (user->der == 1) J[0][0] = xdot[0]; in IJacobianP()
81 if (user->der == 2) J[0][0] = -x[0]; in IJacobianP()
95 struct _n_User user; in main() local
104 user.a = 2.0; in main()
105 user.b = 4.0; in main()
[all …]
H A Dex20adj.c72 User user = (User)ctx; in RHSFunction() local
80 if (user->imex) { in RHSFunction()
83 f[1] = user->mu * ((1. - u[0] * u[0]) * u[1] - u[0]); in RHSFunction()
92 User user = (User)ctx; in RHSJacobian() local
93 PetscReal mu = user->mu; in RHSJacobian()
102 if (user->imex) { in RHSJacobian()
124 User user = (User)ctx; in IFunction() local
132 if (user->imex) { in IFunction()
137 f[1] = udot[1] - user->mu * ((1.0 - u[0] * u[0]) * u[1] - u[0]); in IFunction()
146 User user = (User)ctx; in IJacobian() local
[all …]
H A Dex20td.c100 AppCtx *user = (AppCtx *)ctx; in RHSFunction() local
110 PetscCall(VecGetArrayRead(user->mu1, &mu1)); in RHSFunction()
111 PetscCall(VecGetArrayRead(user->mu2, &mu2)); in RHSFunction()
116 PetscCall(VecRestoreArrayRead(user->mu1, &mu1)); in RHSFunction()
117 PetscCall(VecRestoreArrayRead(user->mu2, &mu2)); in RHSFunction()
124 AppCtx *user = (AppCtx *)ctx; in RHSJacobian() local
134 PetscCall(VecGetArrayRead(user->mu1, &mu1)); in RHSJacobian()
135 PetscCall(VecGetArrayRead(user->mu2, &mu2)); in RHSJacobian()
145 PetscCall(VecRestoreArrayRead(user->mu1, &mu1)); in RHSJacobian()
146 PetscCall(VecRestoreArrayRead(user->mu2, &mu2)); in RHSJacobian()
[all …]
H A Dex20fwd.c37 User user = (User)ctx; in IFunction() local
46 f[1] = c21 * (xdot[0] - x[1]) + xdot[1] - user->mu * ((1.0 - x[0] * x[0]) * x[1] - x[0]); in IFunction()
55 User user = (User)ctx; in IJacobian() local
64 J[1][0] = c21 * a + user->mu * (1.0 + 2.0 * x[0] * x[1]); in IJacobian()
65 J[1][1] = -c21 + a - user->mu * (1.0 - x[0] * x[0]); in IJacobian()
80 User user = (User)ctx; in RHSJacobianP() local
86 if (user->combined) col[0] = 2; in RHSJacobianP()
103 User user = (User)ctx; in Monitor() local
110 while (user->next_output <= t && user->next_output <= tfinal) { in Monitor()
112 PetscCall(TSInterpolate(ts, user->next_output, interpolatedX)); in Monitor()
[all …]
/petsc/src/ksp/ksp/tests/
H A Dex19.c54 AppCtx user; in main() local
63 user.ratio = 2; in main()
64 user.coarse.mx = 5; in main()
65 user.coarse.my = 5; in main()
67 PetscCall(PetscOptionsGetInt(NULL, NULL, "-Mx", &user.coarse.mx, NULL)); in main()
68 PetscCall(PetscOptionsGetInt(NULL, NULL, "-My", &user.coarse.my, NULL)); in main()
69 PetscCall(PetscOptionsGetInt(NULL, NULL, "-ratio", &user.ratio, NULL)); in main()
71 user.fine.mx = user.ratio * (user.coarse.mx - 1) + 1; in main()
72 user.fine.my = user.ratio * (user.coarse.my - 1) + 1; in main()
74 …RLD, "Coarse grid size %" PetscInt_FMT " by %" PetscInt_FMT "\n", user.coarse.mx, user.coarse.my)); in main()
[all …]
/petsc/src/ksp/ksp/tutorials/
H A Dex35.cxx117 UserContext user; in main() local
125 PetscCall(InitializeOptions(&user)); in main()
128 if (user.use_extfile) { in main()
129 PetscCall(DMMoabLoadFromFile(PETSC_COMM_WORLD, user.dim, 1, user.filename, "", &dm)); in main()
131 …PetscCall(DMMoabCreateBoxMesh(PETSC_COMM_WORLD, user.dim, user.usetri, user.bounds, user.n, 1, &dm… in main()
139 PetscCall(DMSetApplicationContext(dm, &user)); in main()
142 PetscCall(KSPSetComputeRHS(ksp, ComputeRHS, &user)); in main()
143 PetscCall(KSPSetComputeOperators(ksp, ComputeMatrix, &user)); in main()
145 if (user.nlevels) { in main()
147 PetscCall(PetscMalloc(sizeof(DM) * (user.nlevels + 1), &dmhierarchy)); in main()
[all …]
H A Dex36.cxx92 static PetscErrorCode ComputeDiscreteL2Error(KSP ksp, Vec err, UserContext *user);
93 static PetscErrorCode InitializeOptions(UserContext *user);
99 UserContext user; in main() local
110 PetscCall(InitializeOptions(&user)); in main()
113 if (user.use_extfile) { in main()
114 PetscCall(DMMoabLoadFromFile(PETSC_COMM_WORLD, user.dim, 1, user.filename, "", &dm)); in main()
116 PetscCall(DMMoabCreateBoxMesh(PETSC_COMM_WORLD, user.dim, user.usetet, NULL, user.n, 1, &dm)); in main()
124 PetscCall(DMSetApplicationContext(dm, &user)); in main()
127 PetscCall(KSPSetComputeRHS(ksp, ComputeRHS_MOAB, &user)); in main()
128 PetscCall(KSPSetComputeOperators(ksp, ComputeMatrix_MOAB, &user)); in main()
[all …]
/petsc/src/tao/complementarity/tutorials/
H A Dblackscholes.c124 AppCtx user; /* user-defined work context */ in main() local
139 user.rate = 0.04; in main()
140 user.sigma = 0.40; in main()
141 user.alpha = 2.00; in main()
142 user.delta = 0.01; in main()
143 user.strike = 10.0; in main()
144 user.expiry = 1.0; in main()
145 user.mt = 10; in main()
146 user.ms = 150; in main()
147 user.es = 100.0; in main()
[all …]
/petsc/src/dm/impls/moab/tests/
H A Dex3.cxx51 PetscErrorCode CreateMesh(MPI_Comm comm, AppCtx *user) in CreateMesh() argument
57 PetscCall(PetscLogEventBegin(user->createMeshEvent, 0, 0, 0, 0)); in CreateMesh()
59 PetscCall(PetscStrlen(user->input_file, &len)); in CreateMesh()
61 …if (user->debug) PetscCall(PetscPrintf(comm, "Loading mesh from file: %s and creating the coarse l… in CreateMesh()
62 PetscCall(DMMoabLoadFromFile(comm, user->dim, user->nghost, user->input_file, "", &user->dm)); in CreateMesh()
64 if (user->debug) in CreateMesh()
65 …nt_FMT " in memory and creating a DM object.\n", user->dim, user->simplex ? "simplex" : "regular",… in CreateMesh()
66 user->nele, user->nele)); in CreateMesh()
67 …PetscCall(DMMoabCreateBoxMesh(comm, user->dim, user->simplex, NULL, user->nele, user->nghost, &use… in CreateMesh()
69 PetscCall(PetscObjectSetName((PetscObject)user->dm, "Coarse Mesh")); in CreateMesh()
[all …]
H A Dex2.cxx57 PetscErrorCode CreateMesh(MPI_Comm comm, AppCtx *user) in CreateMesh() argument
64 PetscCall(PetscLogEventBegin(user->createMeshEvent, 0, 0, 0, 0)); in CreateMesh()
66 PetscCall(PetscStrlen(user->input_file, &len)); in CreateMesh()
68 …if (user->debug) PetscCall(PetscPrintf(comm, "Loading mesh from file: %s and creating a DM object.… in CreateMesh()
69 PetscCall(DMMoabLoadFromFile(comm, user->dim, 1, user->input_file, "", &user->dm)); in CreateMesh()
71 if (user->debug) { in CreateMesh()
72 …nt_FMT " in memory and creating a DM object.\n", user->dim, user->simplex ? "simplex" : "regular",… in CreateMesh()
73 user->nele, user->nele)); in CreateMesh()
75 PetscCall(DMMoabCreateBoxMesh(comm, user->dim, user->simplex, NULL, user->nele, 1, &user->dm)); in CreateMesh()
78 if (user->debug) { in CreateMesh()
[all …]
/petsc/src/tao/leastsquares/tutorials/
H A Dtomography.c53 AppCtx user; /* user-defined work context */ in main() local
65 PetscCall(InitializeUserData(&user)); in main()
68 PetscCall(VecCreateSeq(PETSC_COMM_SELF, user.N, &x)); in main()
69 PetscCall(VecCreateSeq(PETSC_COMM_SELF, user.M, &res)); in main()
72 PetscCall(FormStartingPoint(x, &user)); in main()
77 PetscCall(TaoSetVariableBounds(tao, user.xlb, user.xub)); in main()
80 PetscCall(TaoBRGNSetDictionaryMatrix(tao, user.D)); in main()
83 PetscCall(TaoSetResidualRoutine(tao, res, EvaluateResidual, (void *)&user)); in main()
85 PetscCall(TaoSetJacobianResidualRoutine(tao, user.A, user.A, EvaluateJacobian, (void *)&user)); in main()
88 …gularizerObjectiveAndGradientRoutine(tao, EvaluateRegularizerObjectiveAndGradient, (void *)&user)); in main()
[all …]
/petsc/src/snes/tutorials/ex10d/
H A Dex10.c77 AppCtx user; /* user-defined application context */ in main() local
120 user.Nvglobal = 16; /* Global # of vertices */ in main()
121 user.Neglobal = 18; /* Global # of elements */ in main()
123 PetscCall(PetscOptionsGetInt(NULL, NULL, "-vert", &user.Nvglobal, NULL)); in main()
124 PetscCall(PetscOptionsGetInt(NULL, NULL, "-elem", &user.Neglobal, NULL)); in main()
126 user.non_lin_param = 0.06; in main()
128 PetscCall(PetscOptionsGetReal(NULL, NULL, "-nl_par", &user.non_lin_param, NULL)); in main()
130 user.lin_param = -1.0; in main()
132 PetscCall(PetscOptionsGetReal(NULL, NULL, "-lin_par", &user.lin_param, NULL)); in main()
134 user.Nvlocal = 0; in main()
[all …]
/petsc/src/ts/tutorials/autodiff/
H A Dex16opt_ic.cxx42 User user = (User)ctx; in RHSFunctionPassive() local
50 f[1] = user->mu * (1. - x[0] * x[0]) * x[1] - x[0]; in RHSFunctionPassive()
62 User user = (User)ctx; in RHSFunctionActive() local
63 PetscReal mu = user->mu; in RHSFunctionActive()
93 User user = (User)ctx; in RHSJacobian() local
98 PetscCall(PetscAdolcComputeRHSJacobian(1, A, x, user->adctx)); in RHSJacobian()
110 User user = (User)ctx; in Monitor() local
117 …%.1f] %" PetscInt_FMT " TS %.6f (dt = %.6f) X % 12.6e % 12.6e\n", (double)user->next_output, step,… in Monitor()
130 struct _n_User user; in main() local
148 user.mu = 1.0; in main()
[all …]
/petsc/src/tao/tutorials/
H A Dex3.c57 static PetscErrorCode CreateMesh(MPI_Comm comm, AppCtx *user, DM *dm) in CreateMesh() argument
64 user->use_riesz = PETSC_TRUE; in CreateMesh()
67 …esz", "Use the Riesz map to achieve mesh independence", "ex3.c", user->use_riesz, &user->use_riesz… in CreateMesh()
177 PetscErrorCode CreateCtx(DM dm, AppCtx *user) in CreateCtx() argument
199 PetscCall(DMCreateGlobalVector(dm, &user->data)); in CreateCtx()
205 PetscCall(DMProjectFunction(dm, 0.0, wtf, NULL, INSERT_VALUES, user->data)); in CreateCtx()
216 PetscCall(DMCreateMatrix(dm_mass, &user->mass)); in CreateCtx()
217 PetscCall(DMPlexSNESComputeJacobianFEM(dm_mass, user->data, user->mass, user->mass, NULL)); in CreateCtx()
218 PetscCall(MatSetOption(user->mass, MAT_SYMMETRIC, PETSC_TRUE)); in CreateCtx()
229 PetscCall(DMCreateMatrix(dm_laplace, &user->laplace)); in CreateCtx()
[all …]
/petsc/src/snes/tutorials/
H A Dex21.c54 UserCtx user; in main() local
60 PetscCall(DMCompositeCreate(PETSC_COMM_WORLD, &user.packer)); in main()
61 PetscCall(DMRedundantCreate(PETSC_COMM_WORLD, 0, 1, &user.red1)); in main()
62 PetscCall(DMCompositeAddDM(user.packer, user.red1)); in main()
63 PetscCall(DMDACreate1d(PETSC_COMM_WORLD, DM_BOUNDARY_NONE, 5, 1, 1, NULL, &user.da1)); in main()
64 PetscCall(DMSetFromOptions(user.da1)); in main()
65 PetscCall(DMSetUp(user.da1)); in main()
66 PetscCall(DMCompositeAddDM(user.packer, user.da1)); in main()
67 PetscCall(DMDACreate1d(PETSC_COMM_WORLD, DM_BOUNDARY_NONE, 5, 1, 1, NULL, &user.da2)); in main()
68 PetscCall(DMSetFromOptions(user.da2)); in main()
[all …]

12345678910>>...16