| /petsc/src/dm/dt/tests/ |
| H A D | ex3.c | 5 static void func1(const PetscReal a[], void *unused, PetscReal *val) in func1() argument 8 *val = x * PetscLogReal(1 + x); in func1() 11 static void func2(const PetscReal a[], void *unused, PetscReal *val) in func2() argument 14 *val = x * x * PetscAtanReal(x); in func2() 17 static void func3(const PetscReal a[], void *unused, PetscReal *val) in func3() argument 20 *val = PetscExpReal(x) * PetscCosReal(x); in func3() 23 static void func4(const PetscReal a[], void *unused, PetscReal *val) in func4() argument 27 *val = PetscAtanReal(u) / ((1.0 + x * x) * u); in func4() 30 static void func5(const PetscReal a[], void *unused, PetscReal *val) in func5() argument 33 if (x == 0.0) *val = 0.0; in func5() [all …]
|
| /petsc/src/vec/vec/tests/output/ |
| H A D | ex36_1.out | 2 0: idx[0] == 0; val[0] == 0.000000 3 0: idx[1] == 1; val[1] == 2.000000 4 0: idx[2] == -2; val[2] == 4.000000 6 1: idx[0] == 3; val[0] == 12.000000 7 1: idx[1] == -4; val[1] == 16.000000 8 1: idx[2] == 5; val[2] == 20.000000 18 0: idx[0] == 0; val[0] == 0.000000 19 0: idx[1] == 1; val[1] == 2.000000 20 0: idx[2] == -2; val[2] == -1.000000 22 1: idx[0] == 3; val[0] == 12.000000 [all …]
|
| /petsc/share/petsc/saws/js/ |
| H A D | listLogic.js | 8 var pcValue = $(this).val(); 31 $("#pc_mg_levels" + endtag).val(defaultMgLevels); 32 $("#pc_mg_type" + endtag).val(defaults.pc_mg_type); 61 $("#ksp_type" + childEndtag).val(defaults.sub_ksp_type); 62 $("#pc_type" + childEndtag).val(defaults.sub_pc_type); 83 $("#pc_gamg_levels" + endtag).val(defaultGamgLevels); 84 $("#pc_gamg_type" + endtag).val(defaults.pc_gamg_type); 113 $("#ksp_type" + childEndtag).val(defaults.sub_ksp_type); 114 $("#pc_type" + childEndtag).val(defaults.sub_pc_type); 131 $("#pc_redundant_number" + endtag).val(defaultRedundantNumber); [all …]
|
| H A D | treeInterface.js | 21 var selectedPc = $("#temp_pc_type").val(); 61 var blocks = $("#temp_pc_fieldsplit_blocks").val(); 72 var levels = $("#temp_pc_mg_levels").val(); 79 var levels = $("#temp_pc_gamg_levels").val(); 86 var blocks = $("#temp_pc_bjacobi_blocks").val(); 93 var number = $("#temp_pc_redundant_number").val(); 100 var blocks = $("#temp_pc_asm_blocks").val(); 105 var overlap = $("#temp_pc_asm_overlap").val(); 115 var newPc = $("#temp_pc_type").val(); 125 matInfo[endtag].pc_type = $("#temp_pc_type").val(); [all …]
|
| /petsc/src/ksp/ksp/tests/ |
| H A D | ex17.c | 121 PetscScalar val[5]; in FormTestMatrix() local 127 val[0] = 1.0; in FormTestMatrix() 128 val[1] = 4.0; in FormTestMatrix() 129 val[2] = -2.0; in FormTestMatrix() 134 PetscCall(MatSetValues(A, 1, &i, 3, col, val, INSERT_VALUES)); in FormTestMatrix() 139 PetscCall(MatSetValues(A, 1, &i, 2, col, val, INSERT_VALUES)); in FormTestMatrix() 143 val[0] = 4.0; in FormTestMatrix() 144 val[1] = -2.0; in FormTestMatrix() 145 PetscCall(MatSetValues(A, 1, &i, 2, col, val, INSERT_VALUES)); in FormTestMatrix() 147 val[0] = 1.0; in FormTestMatrix() [all …]
|
| H A D | ex57.c | 14 PetscScalar val; in main() local 27 val = 1.0; in main() 29 PetscCall(MatSetValues(subA[0], 1, &row, 1, &col, &val, INSERT_VALUES)); in main() 38 val = 0.0; in main() 39 PetscCall(MatSetValues(subA[1], 1, &row, 1, &col, &val, INSERT_VALUES)); in main() 48 val = 0.0; in main() 49 PetscCall(MatSetValues(subA[2], 1, &row, 1, &col, &val, INSERT_VALUES)); in main() 58 val = 0.0; in main() 59 PetscCall(MatSetValues(subA[3], 1, &row, 1, &col, &val, INSERT_VALUES)); in main() 68 val = 4.0; in main() [all …]
|
| /petsc/include/petsc/private/ |
| H A D | cupmatomics.hpp | 42 __device__ static double atomicExch(double *address, double val) in atomicExch() argument 44 return __longlong_as_double(atomicExch((ullint *)address, __double_as_longlong(val))); in atomicExch() 47 __device__ static llint atomicExch(llint *address, llint val) in atomicExch() argument 49 return (llint)(atomicExch((ullint *)address, (ullint)val)); in atomicExch() 109 __device__ static llint atomicAdd(llint *address, llint val) in atomicAdd() argument 111 return (llint)atomicAdd((ullint *)address, (ullint)val); in atomicAdd() 126 double *address = &x, val = y; in operator ()() 131 …old = atomicCAS(address_as_ull, assumed, __double_as_longlong(val + __longlong_as_double(assum… in operator ()() 146 float *address = &x, val = y; in operator ()() 151 old = atomicCAS(address_as_int, assumed, __float_as_int(val + __int_as_float(assumed))); in operator ()() [all …]
|
| H A D | hashmap.h | 110 ValType val; \ 118 kh_foreach(ht, key, val, { \ 122 kh_val(*hd, i) = val; \ 173 … inline PETSC_UNUSED PetscErrorCode Petsc##HashT##Get(Petsc##HashT ht, KeyType key, ValType *val) \ 178 PetscAssertPointer(val, 3); \ 180 *val = (iter != kh_end(ht)) ? kh_val(ht, iter) : (DefaultValue); \ 184 …ode Petsc##HashT##GetWithDefault(Petsc##HashT ht, KeyType key, ValType default_val, ValType *val) \ 191 PetscAssertPointer(val, 4); \ 194 PetscHashIterGetVal(ht, it, *val); \ 196 *val = default_val; \ [all …]
|
| /petsc/src/dm/impls/stag/tests/ |
| H A D | ex40.c | 34 PetscScalar x_val, val; in FormFunction1DNoCoupling() local 40 val = (10.0 + c) * x_val * x_val * x_val; // f_i = (10 +c) * x_i^3 in FormFunction1DNoCoupling() 41 PetscCall(DMStagVecSetValuesStencil(dm, f, 1, &row, &val, INSERT_VALUES)); in FormFunction1DNoCoupling() 46 PetscScalar x_val, val; in FormFunction1DNoCoupling() local 52 val = (20.0 + c) * x_val * x_val * x_val; // f_i = (20 + c) * x_i^3 in FormFunction1DNoCoupling() 53 PetscCall(DMStagVecSetValuesStencil(dm, f, 1, &row, &val, INSERT_VALUES)); in FormFunction1DNoCoupling() 80 PetscScalar x_val, val; in FormJacobian1DNoCoupling() local 86 val = 3.0 * (10.0 + c) * x_val * x_val; in FormJacobian1DNoCoupling() 87 …PetscCall(DMStagMatSetValuesStencil(dm, Amat, 1, &row_vertex, 1, &row_vertex, &val, INSERT_VALUES)… in FormJacobian1DNoCoupling() 92 PetscScalar x_val, val; in FormJacobian1DNoCoupling() local [all …]
|
| H A D | ex13.c | 128 static PetscErrorCode CompareValues(PetscInt i, PetscInt j, PetscInt k, PetscInt c, PetscScalar val… in CompareValues() argument 131 …val == valRef || PetscAbsScalar(val - valRef) / PetscAbsScalar(valRef) <= 10 * PETSC_MACHINE_EPSIL… in CompareValues() 172 const PetscScalar val = arr[i][idxLeft + c]; in Test2_1d() local 173 PetscCall(CompareValues(i, j, k, c, val, valRef)); in Test2_1d() 178 const PetscScalar val = arr[i][idxElement + c]; in Test2_1d() local 179 PetscCall(CompareValues(i, j, k, c, val, valRef)); in Test2_1d() 184 const PetscScalar val = arr[i][idxElement + c]; in Test2_1d() local 185 PetscCall(CompareValues(i, j, k, c, val, valRef)); in Test2_1d() 252 const PetscScalar val = arr[j][i][idxDownLeft + c]; in Test2_2d() local 253 PetscCall(CompareValues(i, j, k, c, val, valRef)); in Test2_2d() [all …]
|
| /petsc/src/sys/classes/random/impls/sprng/ |
| H A D | sprng.c | 16 static PetscErrorCode PetscRandomGetValue_Sprng(PetscRandom r, PetscScalar *val) in PetscRandomGetValue_Sprng() argument 21 …*val = PetscRealPart(r->width) * sprng() + PetscRealPart(r->low) + (PetscImaginaryPart(r->width) *… in PetscRandomGetValue_Sprng() 23 *val = sprng() + sprng() * PETSC_i; in PetscRandomGetValue_Sprng() 26 if (r->iset) *val = r->width * sprng() + r->low; in PetscRandomGetValue_Sprng() 27 else *val = sprng(); in PetscRandomGetValue_Sprng() 32 static PetscErrorCode PetscRandomGetValueReal_Sprng(PetscRandom r, PetscReal *val) in PetscRandomGetValueReal_Sprng() argument 36 if (r->iset) *val = PetscRealPart(r->width) * sprng() + PetscRealPart(r->low); in PetscRandomGetValueReal_Sprng() 37 else *val = sprng(); in PetscRandomGetValueReal_Sprng() 39 if (r->iset) *val = r->width * sprng() + r->low; in PetscRandomGetValueReal_Sprng() 40 else *val = sprng(); in PetscRandomGetValueReal_Sprng()
|
| /petsc/src/sys/classes/random/impls/rand/ |
| H A D | rand.c | 11 static PetscErrorCode PetscRandomGetValue_Rand(PetscRandom r, PetscScalar *val) in PetscRandomGetValue_Rand() argument 15 …if (r->iset) *val = PetscRealPart(r->width) * RAND_WRAP + PetscRealPart(r->low) + (PetscImaginaryP… in PetscRandomGetValue_Rand() 16 else *val = RAND_WRAP + RAND_WRAP * PETSC_i; in PetscRandomGetValue_Rand() 18 if (r->iset) *val = r->width * RAND_WRAP + r->low; in PetscRandomGetValue_Rand() 19 else *val = RAND_WRAP; in PetscRandomGetValue_Rand() 24 static PetscErrorCode PetscRandomGetValueReal_Rand(PetscRandom r, PetscReal *val) in PetscRandomGetValueReal_Rand() argument 28 if (r->iset) *val = PetscRealPart(r->width) * RAND_WRAP + PetscRealPart(r->low); in PetscRandomGetValueReal_Rand() 29 else *val = RAND_WRAP; in PetscRandomGetValueReal_Rand() 31 if (r->iset) *val = r->width * RAND_WRAP + r->low; in PetscRandomGetValueReal_Rand() 32 else *val = RAND_WRAP; in PetscRandomGetValueReal_Rand()
|
| /petsc/src/sys/classes/random/impls/rand48/ |
| H A D | rand48.c | 11 static PetscErrorCode PetscRandomGetValue_Rand48(PetscRandom r, PetscScalar *val) in PetscRandomGetValue_Rand48() argument 16 …*val = PetscRealPart(r->width) * (PetscReal)drand48() + PetscRealPart(r->low) + (PetscImaginaryPar… in PetscRandomGetValue_Rand48() 18 *val = (PetscReal)drand48() + (PetscReal)drand48() * PETSC_i; in PetscRandomGetValue_Rand48() 21 if (r->iset) *val = r->width * drand48() + r->low; in PetscRandomGetValue_Rand48() 22 else *val = drand48(); in PetscRandomGetValue_Rand48() 27 static PetscErrorCode PetscRandomGetValueReal_Rand48(PetscRandom r, PetscReal *val) in PetscRandomGetValueReal_Rand48() argument 31 if (r->iset) *val = PetscRealPart(r->width) * drand48() + PetscRealPart(r->low); in PetscRandomGetValueReal_Rand48() 32 else *val = drand48(); in PetscRandomGetValueReal_Rand48() 34 if (r->iset) *val = r->width * (PetscReal)drand48() + r->low; in PetscRandomGetValueReal_Rand48() 35 else *val = (PetscReal)drand48(); in PetscRandomGetValueReal_Rand48()
|
| /petsc/src/dm/impls/plex/tests/ |
| H A D | ex6.c | 45 PetscInt val; in TestSetup() local 48 PetscCall(DMLabelGetValue(label, (PetscInt)p, &val)); in TestSetup() 49 if (val < 0) { in TestSetup() 68 PetscInt val; in TestLookup() local 71 PetscCall(DMLabelGetValue(label, p, &val)); in TestLookup() 73 …val < 0 || has) && (val >= 0 || !has), PETSC_COMM_SELF, PETSC_ERR_PLIB, "Label value %" PetscInt_F… in TestLookup() 89 PetscInt val; in TestClear() local 92 PetscCall(DMLabelGetValue(label, p, &val)); in TestClear() 93 if (val != defaultValue) PetscCall(DMLabelClearValue(label, p, val)); in TestClear() 94 PetscCall(DMLabelGetValue(label, p, &val)); in TestClear() [all …]
|
| /petsc/src/sys/classes/random/interface/ |
| H A D | random.c | 51 PetscErrorCode PetscRandomGetValue(PetscRandom r, PetscScalar *val) in PetscRandomGetValue() argument 56 if (!r->ops->getvalue) PetscUseTypeMethod(r, getvalues, 1, val); in PetscRandomGetValue() 57 else PetscUseTypeMethod(r, getvalue, val); in PetscRandomGetValue() 90 PetscErrorCode PetscRandomGetValueReal(PetscRandom r, PetscReal *val) in PetscRandomGetValueReal() argument 95 if (!r->ops->getvaluereal) PetscUseTypeMethod(r, getvaluesreal, 1, val); in PetscRandomGetValueReal() 96 else PetscUseTypeMethod(r, getvaluereal, val); in PetscRandomGetValueReal() 124 PetscErrorCode PetscRandomGetValues(PetscRandom r, PetscInt n, PetscScalar *val) in PetscRandomGetValues() argument 132 for (PetscInt i = 0; i < n; ++i) PetscCall(getvalue(r, val + i)); in PetscRandomGetValues() 133 } else PetscUseTypeMethod(r, getvalues, n, val); in PetscRandomGetValues() 158 PetscErrorCode PetscRandomGetValuesReal(PetscRandom r, PetscInt n, PetscReal *val) in PetscRandomGetValuesReal() argument [all …]
|
| /petsc/src/sys/tests/ |
| H A D | ex35.c | 8 PetscReal val; in main() local 42 val = 44; in main() 43 PetscCall(PetscFindReal(val, 10, x3, PETSC_SMALL, &loc)); in main() 44 …PetscCall(PetscPrintf(PETSC_COMM_SELF, " %g in array: loc %" PetscInt_FMT "\n", (double)val, loc)); in main() 45 val = 309.2; in main() 46 PetscCall(PetscFindReal(val, 10, x3, PETSC_SMALL, &loc)); in main() 47 …PetscCall(PetscPrintf(PETSC_COMM_SELF, " %g in array: loc %" PetscInt_FMT "\n", (double)val, loc)); in main() 48 val = 309.2; in main() 49 PetscCall(PetscFindReal(val, 10, x3, 0.21, &loc)); in main() 50 …PetscCall(PetscPrintf(PETSC_COMM_SELF, " %g in array: loc %" PetscInt_FMT "\n", (double)val, loc)); in main()
|
| H A D | ex6.c | 9 const char *val; in main() local 119 PetscCall(PetscOptionsFindPair(NULL, NULL, "-abc_xyz", &val, &has)); in main() 120 PetscTestCheck(has == PETSC_TRUE && !strcmp(val, "123")); in main() 121 PetscCall(PetscOptionsFindPair(NULL, NULL, "-abc_42_xyz", &val, &has)); in main() 122 PetscTestCheck(has == PETSC_TRUE && !strcmp(val, "123")); in main() 123 PetscCall(PetscOptionsFindPair(NULL, NULL, "-abc_42_1_xyz", &val, &has)); in main() 124 PetscTestCheck(has == PETSC_TRUE && !strcmp(val, "123")); in main() 125 PetscCall(PetscOptionsFindPair(NULL, NULL, "-abc_42_1_23_xyz", &val, &has)); in main() 126 PetscTestCheck(has == PETSC_TRUE && !strcmp(val, "123")); in main() 127 PetscCall(PetscOptionsFindPair(NULL, NULL, "-abc_42_1_23_456_xyz", &val, &has)); in main() [all …]
|
| /petsc/src/mat/utils/ |
| H A D | pheap.c | 37 PetscInt id, val; in Swap() local 39 val = Value(h, loc); in Swap() 43 h->base[loc2].value = val; in Swap() 53 PetscInt val = Value(h, left); in MinChild() local 54 if (val < min) { in MinChild() 55 min = val; in MinChild() 79 PetscErrorCode PetscHeapAdd(PetscHeap h, PetscInt id, PetscInt val) in PetscHeapAdd() argument 88 h->base[loc].value = val; in PetscHeapAdd() 91 while ((void)(par = Parent(loc)), Value(h, par) > val) { in PetscHeapAdd() 98 PetscErrorCode PetscHeapPop(PetscHeap h, PetscInt *id, PetscInt *val) in PetscHeapPop() argument [all …]
|
| /petsc/src/sys/classes/random/impls/rander48/ |
| H A D | rander48.c | 50 static PetscErrorCode PetscRandomGetValue_Rander48(PetscRandom r, PetscScalar *val) in PetscRandomGetValue_Rander48() argument 57 *val = PetscRealPart(r->low) + PetscImaginaryPart(r->low) * PETSC_i; in PetscRandomGetValue_Rander48() 58 if (PetscRealPart(r->width)) *val += PetscRealPart(r->width) * _dorander48(r48); in PetscRandomGetValue_Rander48() 59 …if (PetscImaginaryPart(r->width)) *val += PetscImaginaryPart(r->width) * _dorander48(r48) * PETSC_… in PetscRandomGetValue_Rander48() 61 *val = _dorander48(r48) + _dorander48(r48) * PETSC_i; in PetscRandomGetValue_Rander48() 64 if (r->iset) *val = r->width * _dorander48(r48) + r->low; in PetscRandomGetValue_Rander48() 65 else *val = _dorander48(r48); in PetscRandomGetValue_Rander48() 70 static PetscErrorCode PetscRandomGetValueReal_Rander48(PetscRandom r, PetscReal *val) in PetscRandomGetValueReal_Rander48() argument 76 if (r->iset) *val = PetscRealPart(r->width) * _dorander48(r48) + PetscRealPart(r->low); in PetscRandomGetValueReal_Rander48() 77 else *val = _dorander48(r48); in PetscRandomGetValueReal_Rander48() [all …]
|
| /petsc/src/mat/tests/ |
| H A D | ex29.c | 9 PetscInt id, val, cnt, *values; in main() local 26 PetscCall(PetscHeapPop(h, &id, &val)); in main() 27 PetscCall(PetscHeapStash(h, id, val + 10)); in main() 28 PetscCall(PetscHeapPop(h, &id, &val)); in main() 29 PetscCall(PetscHeapStash(h, id, val + 10)); in main() 38 PetscCall(PetscHeapPop(h, &id, &val)); in main() 41 values[cnt++] = val; in main() 42 PetscCall(PetscHeapPop(h, &id, &val)); in main()
|
| H A D | mmio.c | 22 double *val; in mm_read_unsymmetric_sparse() local 54 val = (double *)malloc(nz * sizeof(double)); in mm_read_unsymmetric_sparse() 56 *val_ = val; in mm_read_unsymmetric_sparse() 65 if (fscanf(f, "%d %d %lg\n", &ia[i], &ja[i], &val[i]) != 3) { in mm_read_unsymmetric_sparse() 205 int mm_read_mtx_crd_data(FILE *f, int M, int N, int nz, int ia[], int ja[], double val[], MM_typeco… in mm_read_mtx_crd_data() argument 210 …if (fscanf(f, "%d %d %lg %lg", &ia[i], &ja[i], &val[2 * i], &val[2 * i + 1]) != 4) return MM_PREMA… in mm_read_mtx_crd_data() 213 if (fscanf(f, "%d %d %lg\n", &ia[i], &ja[i], &val[i]) != 3) return MM_PREMATURE_EOF; in mm_read_mtx_crd_data() 249 int mm_read_mtx_crd(char *fname, int *M, int *N, int *nz, int **ia, int **ja, double **val, MM_type… in mm_read_mtx_crd() argument 265 *val = NULL; in mm_read_mtx_crd() 268 *val = (double *)malloc(*nz * 2 * sizeof(double)); in mm_read_mtx_crd() [all …]
|
| /petsc/src/dm/impls/stag/tutorials/ |
| H A D | ex1.c | 187 PetscScalar val[3]; in main() local 194 val[idxLoc] = 0.0; /* p - u'(x) = 0 */ in main() 202 val[idxLoc] = a; /* u(0) = a */ in main() 215 val[idxLoc] = fVal; /* p'(x) = f, in interior */ in main() 223 val[idxLoc] = b; /* u(1) = b */ in main() 226 PetscCall(DMStagVecSetValuesStencil(dmSol, rhs, idxLoc, pos, val, INSERT_VALUES)); in main() 239 PetscScalar val; in main() local 244 val = 1.0; in main() 245 PetscCall(DMStagMatSetValuesStencil(dmSol, A, 1, &row, 1, &row, &val, INSERT_VALUES)); in main() 248 PetscScalar val[3], xp[2]; in main() local [all …]
|
| H A D | ex8.c | 87 PetscScalar val; in AssembleSystem1DVertexCentered() local 89 val = 1.0; in AssembleSystem1DVertexCentered() 90 PetscCall(DMStagMatSetValuesStencil(dm, A, 1, &row, 1, &row, &val, INSERT_VALUES)); in AssembleSystem1DVertexCentered() 94 PetscScalar val; in AssembleSystem1DVertexCentered() local 99 val = 1.0; in AssembleSystem1DVertexCentered() 101 … PetscCall(DMStagMatSetValuesStencil(dm, A, 1, &row_extra, 1, &row_extra, &val, INSERT_VALUES)); in AssembleSystem1DVertexCentered() 105 PetscScalar val[3]; in AssembleSystem1DVertexCentered() local 110 val[0] = 1.0; in AssembleSystem1DVertexCentered() 114 val[1] = -2.0; in AssembleSystem1DVertexCentered() 118 val[2] = 1.0; in AssembleSystem1DVertexCentered() [all …]
|
| /petsc/src/ts/tutorials/power_grid/stability_9bus/ |
| H A D | ex9busadj.c | 439 PetscScalar val[10]; in ResidualJacobian() local 477 val[0] = 1 / Td0p[i]; in ResidualJacobian() 478 val[1] = (Xd[i] - Xdp[i]) / Td0p[i]; in ResidualJacobian() 479 val[2] = -1 / Td0p[i]; in ResidualJacobian() 481 PetscCall(MatSetValues(J, 1, row, 3, col, val, INSERT_VALUES)); in ResidualJacobian() 487 val[0] = 1 / Tq0p[i]; in ResidualJacobian() 488 val[1] = -(Xq[i] - Xqp[i]) / Tq0p[i]; in ResidualJacobian() 489 PetscCall(MatSetValues(J, 1, row, 2, col, val, INSERT_VALUES)); in ResidualJacobian() 495 val[0] = 0; in ResidualJacobian() 496 val[1] = -1; in ResidualJacobian() [all …]
|
| /petsc/src/snes/tests/ |
| H A D | ex21f.F90 | 49 PetscScalar val 58 val = 2.0; PetscCallA(MatSetValues(user%A, one, [zero], one, [zero], [val], INSERT_VALUES, ierr)) 59 val = -1.0; PetscCallA(MatSetValues(user%A, one, [zero], one, [one], [val], INSERT_VALUES, ierr)) 60 val = -1.0; PetscCallA(MatSetValues(user%A, one, [one], one, [zero], [val], INSERT_VALUES, ierr)) 61 val = 1.0; PetscCallA(MatSetValues(user%A, one, [one], one, [one], [val], INSERT_VALUES, ierr))
|