Lines Matching refs:tj
49 PetscErrorCode TSTrajectoryReconstruct_Private(TSTrajectory tj, TS ts, PetscReal t, Vec U, Vec Udot) in TSTrajectoryReconstruct_Private() argument
51 TSHistory tsh = tj->tsh; in TSTrajectoryReconstruct_Private()
62 …SETERRQ(PetscObjectComm((PetscObject)tj), PETSC_ERR_PLIB, "Requested time %g is outside the histor… in TSTrajectoryReconstruct_Private()
64 …if (tj->monitor) PetscCall(PetscViewerASCIIPrintf(tj->monitor, "Reconstructing at time %g, order %… in TSTrajectoryReconstruct_Private()
65 if (!tj->lag.T) { in TSTrajectoryReconstruct_Private()
66 PetscInt o = tj->lag.order + 1; in TSTrajectoryReconstruct_Private()
67 …PetscCall(PetscMalloc5(o, &tj->lag.L, o, &tj->lag.T, o, &tj->lag.WW, 2 * o, &tj->lag.TT, o, &tj->l… in TSTrajectoryReconstruct_Private()
68 for (i = 0; i < o; i++) tj->lag.T[i] = PETSC_MAX_REAL; in TSTrajectoryReconstruct_Private()
69 PetscCall(VecDuplicateVecs(U ? U : Udot, o, &tj->lag.W)); in TSTrajectoryReconstruct_Private()
72 PetscCall(PetscArrayzero(tj->lag.TT, 2 * (tj->lag.order + 1))); in TSTrajectoryReconstruct_Private()
76 PetscInt up = PetscMin(nid + tj->lag.order / 2 + 1, tshn); in TSTrajectoryReconstruct_Private()
77 PetscInt low = PetscMax(up - tj->lag.order - 1, 0); in TSTrajectoryReconstruct_Private()
78 up = PetscMin(PetscMax(low + tj->lag.order + 1, up), tshn); in TSTrajectoryReconstruct_Private()
79 if (tj->monitor) PetscCall(PetscViewerASCIIPushTab(tj->monitor)); in TSTrajectoryReconstruct_Private()
84 PetscInt tid = LagrangeGetId(t, tj->lag.order + 1, tj->lag.T, tj->lag.TT); in TSTrajectoryReconstruct_Private()
86 …if (tj->monitor) PetscCall(PetscViewerASCIIPrintf(tj->monitor, "Reusing snapshot %" PetscInt_FMT "… in TSTrajectoryReconstruct_Private()
87 tj->lag.TT[tid] = PETSC_TRUE; in TSTrajectoryReconstruct_Private()
88 tj->lag.WW[cnt] = tj->lag.W[tid]; in TSTrajectoryReconstruct_Private()
89 tj->lag.TW[cnt] = t; in TSTrajectoryReconstruct_Private()
90 tj->lag.TT[tj->lag.order + 1 + s - low] = PETSC_TRUE; /* tell the next loop to skip it */ in TSTrajectoryReconstruct_Private()
99 if (tj->lag.TT[tj->lag.order + 1 + s - low]) continue; in TSTrajectoryReconstruct_Private()
100 tid = LagrangeGetId(t, tj->lag.order + 1, tj->lag.T, tj->lag.TT); in TSTrajectoryReconstruct_Private()
101 … PetscCheck(tid < 0, PetscObjectComm((PetscObject)tj), PETSC_ERR_PLIB, "This should not happen"); in TSTrajectoryReconstruct_Private()
103 if (tj->monitor) { in TSTrajectoryReconstruct_Private()
104 if (tj->lag.T[tid] < PETSC_MAX_REAL) { in TSTrajectoryReconstruct_Private()
105 …PetscCall(PetscViewerASCIIPrintf(tj->monitor, "Discarding snapshot %" PetscInt_FMT " at time %g\n"… in TSTrajectoryReconstruct_Private()
107 PetscCall(PetscViewerASCIIPrintf(tj->monitor, "New snapshot %" PetscInt_FMT "\n", tid)); in TSTrajectoryReconstruct_Private()
109 PetscCall(PetscViewerASCIIPushTab(tj->monitor)); in TSTrajectoryReconstruct_Private()
111 PetscCall(TSTrajectoryGetVecs(tj, ts, tshhist_id[s], &t, tj->lag.W[tid], NULL)); in TSTrajectoryReconstruct_Private()
112 tj->lag.T[tid] = t; in TSTrajectoryReconstruct_Private()
113 if (tj->monitor) PetscCall(PetscViewerASCIIPopTab(tj->monitor)); in TSTrajectoryReconstruct_Private()
114 tj->lag.TT[tid] = PETSC_TRUE; in TSTrajectoryReconstruct_Private()
115 tj->lag.WW[cnt] = tj->lag.W[tid]; in TSTrajectoryReconstruct_Private()
116 tj->lag.TW[cnt] = t; in TSTrajectoryReconstruct_Private()
117 tj->lag.TT[tj->lag.order + 1 + s - low] = PETSC_TRUE; in TSTrajectoryReconstruct_Private()
120 if (tj->monitor) PetscCall(PetscViewerASCIIPopTab(tj->monitor)); in TSTrajectoryReconstruct_Private()
122 PetscCall(PetscArrayzero(tj->lag.TT, tj->lag.order + 1)); in TSTrajectoryReconstruct_Private()
124 PetscInt tid = LagrangeGetId(t, tj->lag.order + 1, tj->lag.T, tj->lag.TT); in TSTrajectoryReconstruct_Private()
125 if (tj->monitor) { in TSTrajectoryReconstruct_Private()
126 PetscCall(PetscViewerASCIIPrintf(tj->monitor, "Retrieving solution from exact step\n")); in TSTrajectoryReconstruct_Private()
127 PetscCall(PetscViewerASCIIPushTab(tj->monitor)); in TSTrajectoryReconstruct_Private()
131 if (tj->monitor) { in TSTrajectoryReconstruct_Private()
132 if (tj->lag.T[tid] < PETSC_MAX_REAL) { in TSTrajectoryReconstruct_Private()
133 …PetscCall(PetscViewerASCIIPrintf(tj->monitor, "Discarding snapshot %" PetscInt_FMT " at time %g\n"… in TSTrajectoryReconstruct_Private()
135 PetscCall(PetscViewerASCIIPrintf(tj->monitor, "New snapshot %" PetscInt_FMT "\n", tid)); in TSTrajectoryReconstruct_Private()
137 PetscCall(PetscViewerASCIIPushTab(tj->monitor)); in TSTrajectoryReconstruct_Private()
139 PetscCall(TSTrajectoryGetVecs(tj, ts, tshhist_id[id], &t, tj->lag.W[tid], NULL)); in TSTrajectoryReconstruct_Private()
140 if (tj->monitor) PetscCall(PetscViewerASCIIPopTab(tj->monitor)); in TSTrajectoryReconstruct_Private()
141 tj->lag.T[tid] = t; in TSTrajectoryReconstruct_Private()
142 } else if (tj->monitor) { in TSTrajectoryReconstruct_Private()
143 …PetscCall(PetscViewerASCIIPrintf(tj->monitor, "Reusing snapshot %" PetscInt_FMT " step %" PetscInt… in TSTrajectoryReconstruct_Private()
145 PetscCall(VecCopy(tj->lag.W[tid], U)); in TSTrajectoryReconstruct_Private()
146 PetscCall(PetscObjectStateGet((PetscObject)U, &tj->lag.Ucached.state)); in TSTrajectoryReconstruct_Private()
147 PetscCall(PetscObjectGetId((PetscObject)U, &tj->lag.Ucached.id)); in TSTrajectoryReconstruct_Private()
148 tj->lag.Ucached.time = t; in TSTrajectoryReconstruct_Private()
149 tj->lag.Ucached.step = tshhist_id[id]; in TSTrajectoryReconstruct_Private()
150 if (tj->monitor) PetscCall(PetscViewerASCIIPopTab(tj->monitor)); in TSTrajectoryReconstruct_Private()
153 …if (tj->monitor) PetscCall(PetscViewerASCIIPrintf(tj->monitor, "Interpolating solution with %" Pet… in TSTrajectoryReconstruct_Private()
154 LagrangeBasisVals(cnt, t, tj->lag.TW, tj->lag.L); in TSTrajectoryReconstruct_Private()
156 PetscCall(VecMAXPY(U, cnt, tj->lag.L, tj->lag.WW)); in TSTrajectoryReconstruct_Private()
157 PetscCall(PetscObjectStateGet((PetscObject)U, &tj->lag.Ucached.state)); in TSTrajectoryReconstruct_Private()
158 PetscCall(PetscObjectGetId((PetscObject)U, &tj->lag.Ucached.id)); in TSTrajectoryReconstruct_Private()
159 tj->lag.Ucached.time = t; in TSTrajectoryReconstruct_Private()
160 tj->lag.Ucached.step = PETSC_INT_MIN; in TSTrajectoryReconstruct_Private()
163 …if (tj->monitor) PetscCall(PetscViewerASCIIPrintf(tj->monitor, "Interpolating derivative with %" P… in TSTrajectoryReconstruct_Private()
164 LagrangeBasisDers(cnt, t, tj->lag.TW, tj->lag.L); in TSTrajectoryReconstruct_Private()
166 PetscCall(VecMAXPY(Udot, cnt, tj->lag.L, tj->lag.WW)); in TSTrajectoryReconstruct_Private()
167 PetscCall(PetscObjectStateGet((PetscObject)Udot, &tj->lag.Udotcached.state)); in TSTrajectoryReconstruct_Private()
168 PetscCall(PetscObjectGetId((PetscObject)Udot, &tj->lag.Udotcached.id)); in TSTrajectoryReconstruct_Private()
169 tj->lag.Udotcached.time = t; in TSTrajectoryReconstruct_Private()
170 tj->lag.Udotcached.step = PETSC_INT_MIN; in TSTrajectoryReconstruct_Private()