MCPcopy Create free account
hub / github.com/IBAMR/IBAMR / initializeSolverState

Method initializeSolverState

ibtk/src/solvers/impls/PETScKrylovLinearSolver.cpp:233–359  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

231} // solveSystem
232
233void
234PETScKrylovLinearSolver::initializeSolverState(const SAMRAIVectorReal<NDIM, double>& x,
235 const SAMRAIVectorReal<NDIM, double>& b)
236{
237 IBTK_TIMER_START(t_initialize_solver_state);
238
239 int ierr;
240
241// Rudimentary error checking.
242#if !defined(NDEBUG)
243 if (x.getNumberOfComponents() != b.getNumberOfComponents())
244 {
245 TBOX_ERROR(d_object_name << "::initializeSolverState()\n"
246 << " vectors must have the same number of components" << std::endl);
247 }
248
249 const Pointer<PatchHierarchy<NDIM>>& patch_hierarchy = x.getPatchHierarchy();
250 if (patch_hierarchy != b.getPatchHierarchy())
251 {
252 TBOX_ERROR(d_object_name << "::initializeSolverState()\n"
253 << " vectors must have the same hierarchy" << std::endl);
254 }
255
256 const int coarsest_ln = x.getCoarsestLevelNumber();
257 if (coarsest_ln < 0)
258 {
259 TBOX_ERROR(d_object_name << "::initializeSolverState()\n"
260 << " coarsest level number must not be negative" << std::endl);
261 }
262 if (coarsest_ln != b.getCoarsestLevelNumber())
263 {
264 TBOX_ERROR(d_object_name << "::initializeSolverState()\n"
265 << " vectors must have same coarsest level number" << std::endl);
266 }
267
268 const int finest_ln = x.getFinestLevelNumber();
269 if (finest_ln < coarsest_ln)
270 {
271 TBOX_ERROR(d_object_name << "::initializeSolverState()\n"
272 << " finest level number must be >= coarsest level number" << std::endl);
273 }
274 if (finest_ln != b.getFinestLevelNumber())
275 {
276 TBOX_ERROR(d_object_name << "::initializeSolverState()\n"
277 << " vectors must have same finest level number" << std::endl);
278 }
279
280 for (int ln = coarsest_ln; ln <= finest_ln; ++ln)
281 {
282 if (!patch_hierarchy->getPatchLevel(ln))
283 {
284 TBOX_ERROR(d_object_name << "::initializeSolverState()\n"
285 << " hierarchy level " << ln << " does not exist" << std::endl);
286 }
287 }
288#endif
289 // Deallocate the solver state if the solver is already initialized.
290 if (d_is_initialized)

Callers

nothing calls this directly

Calls 5

getPatchLevelMethod · 0.80
getPatchHierarchyMethod · 0.45
getFinestLevelNumberMethod · 0.45

Tested by

no test coverage detected