Lines Matching full:n

7   PetscCount n;       /* current number of steps registered */  member
13 PetscErrorCode TSHistoryGetNumSteps(TSHistory tsh, PetscInt *n) in TSHistoryGetNumSteps() argument
16 PetscAssertPointer(n, 2); in TSHistoryGetNumSteps()
17 PetscCall(PetscIntCast(tsh->n, n)); in TSHistoryGetNumSteps()
24 if (tsh->n == tsh->c) { /* reallocation */ in TSHistoryUpdate()
29 …tsh->sorted = (PetscBool)(tsh->sorted && (tsh->n ? (PetscBool)(time >= tsh->hist[tsh->n - 1]) : PE… in TSHistoryUpdate()
31 if (tsh->n) { /* id should be unique */ in TSHistoryUpdate()
34 PetscCall(PetscMalloc1(tsh->n, &ids)); in TSHistoryUpdate()
35 PetscCall(PetscArraycpy(ids, tsh->hist_id, tsh->n)); in TSHistoryUpdate()
36 PetscCall(PetscSortInt(tsh->n, ids)); in TSHistoryUpdate()
37 PetscCall(PetscFindInt(id, tsh->n, ids, &loc)); in TSHistoryUpdate()
42 tsh->hist[tsh->n] = time; in TSHistoryUpdate()
43 tsh->hist_id[tsh->n] = id; in TSHistoryUpdate()
44 tsh->n += 1; in TSHistoryUpdate()
54 PetscCall(PetscSortRealWithArrayInt(tsh->n, tsh->hist, tsh->hist_id)); in TSHistoryGetTime()
57 …< tsh->n, PETSC_COMM_SELF, PETSC_ERR_PLIB, "Given time step %" PetscInt_FMT " does not match any i… in TSHistoryGetTime()
59 else *t = tsh->hist[tsh->n - step - 1]; in TSHistoryGetTime()
69 PetscCall(PetscSortRealWithArrayInt(tsh->n, tsh->hist, tsh->hist_id)); in TSHistoryGetTimeStep()
72 …= tsh->n, PETSC_COMM_SELF, PETSC_ERR_PLIB, "Given time step %" PetscInt_FMT " does not match any i… in TSHistoryGetTimeStep()
73 …if (!backward) *dt = tsh->hist[PetscMin(step + 1, tsh->n - 1)] - tsh->hist[PetscMin(step, tsh->n -… in TSHistoryGetTimeStep()
74 else *dt = tsh->hist[PetscMax(tsh->n - step - 1, 0)] - tsh->hist[PetscMax(tsh->n - step - 2, 0)]; in TSHistoryGetTimeStep()
83 PetscCall(PetscSortRealWithArrayInt(tsh->n, tsh->hist, tsh->hist_id)); in TSHistoryGetLocFromTime()
86 PetscCall(PetscFindReal(time, tsh->n, tsh->hist, PETSC_SMALL, loc)); in TSHistoryGetLocFromTime()
90 PetscErrorCode TSHistorySetHistory(TSHistory tsh, PetscInt n, PetscReal hist[], PetscInt hist_id[],… in TSHistorySetHistory() argument
93 PetscValidLogicalCollectiveIntComm(tsh->comm, n, 2); in TSHistorySetHistory()
94 …PetscCheck(n >= 0, tsh->comm, PETSC_ERR_ARG_OUTOFRANGE, "Cannot request a negative size for histor… in TSHistorySetHistory()
95 if (n) PetscAssertPointer(hist, 3); in TSHistorySetHistory()
98 tsh->n = (size_t)n; in TSHistorySetHistory()
99 tsh->c = (size_t)n; in TSHistorySetHistory()
100 PetscCall(PetscMalloc1(tsh->n, &tsh->hist)); in TSHistorySetHistory()
101 PetscCall(PetscMalloc1(tsh->n, &tsh->hist_id)); in TSHistorySetHistory()
102 for (PetscInt i = 0; i < n; i++) { in TSHistorySetHistory()
106 if (!sorted) PetscCall(PetscSortRealWithArrayInt(tsh->n, tsh->hist, tsh->hist_id)); in TSHistorySetHistory()
111 PetscErrorCode TSHistoryGetHistory(TSHistory tsh, PetscInt *n, const PetscReal *hist[], const Petsc… in TSHistoryGetHistory() argument
114 if (n) PetscCall(PetscIntCast(tsh->n, n)); in TSHistoryGetHistory()