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

Method initializeOperatorState

src/adv_diff/AdvDiffWavePropConvectiveOperator.cpp:266–332  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

264} // end applyConvectiveOperator
265
266void
267AdvDiffWavePropConvectiveOperator::initializeOperatorState(const SAMRAIVectorReal<NDIM, double>& in,
268 const SAMRAIVectorReal<NDIM, double>& out)
269{
270 if (d_is_initialized) deallocateOperatorState();
271 // Get Hierarchy Information
272 d_hierarchy = in.getPatchHierarchy();
273 d_coarsest_ln = in.getCoarsestLevelNumber();
274 d_finest_ln = in.getFinestLevelNumber();
275#if !defined(NDEBUG)
276 TBOX_ASSERT(d_hierarchy == out.getPatchHierarchy());
277 TBOX_ASSERT(d_coarsest_ln == out.getCoarsestLevelNumber());
278 TBOX_ASSERT(d_finest_ln == out.getFinestLevelNumber());
279#else
280 NULL_USE(out);
281#endif
282 /* Set up the coasen operations. These COARSEN the data (i.e. fills data at
283 * coarse interfaces)
284 * General process:
285 * 1) Set up a coarsen algorithm
286 * 2) Register a coarsen operator with the algorithm
287 * 3) Fill a coarsen schedule with the coarsen algorithm
288 * 4) To actually coarsen data, use coarsen schedule -> coarsen data()
289 */
290 Pointer<CartesianGridGeometry<NDIM>> grid_geom = d_hierarchy->getGridGeometry();
291 Pointer<CoarsenOperator<NDIM>> coarsen_op_Q = grid_geom->lookupCoarsenOperator(d_Q_var, "CONSERVATIVE_COARSEN");
292 // Step 1) and 2)
293 d_coarsen_alg_Q = new CoarsenAlgorithm<NDIM>();
294 d_coarsen_alg_Q->registerCoarsen(d_Q_scratch_idx, d_Q_scratch_idx, coarsen_op_Q);
295 d_coarsen_scheds_Q.resize(d_finest_ln + 1);
296 // Step 3)
297 for (int ln = d_coarsest_ln + 1; ln <= d_finest_ln; ++ln)
298 {
299 Pointer<PatchLevel<NDIM>> level = d_hierarchy->getPatchLevel(ln);
300 Pointer<PatchLevel<NDIM>> coarser_level = d_hierarchy->getPatchLevel(ln - 1);
301 d_coarsen_scheds_Q[ln] = d_coarsen_alg_Q->createSchedule(coarser_level, level);
302 }
303 /* Set Refine Algorithms. This interpolates data onto finer grid
304 * General process:
305 * 1) Set up a refine algorithm
306 * 2) Register a refine operation with the algorithm
307 * 3) Fill a refine schedule with the refine algorithm
308 * 4) Invoke fill data() inside refine schedule
309 */
310 // Note we only set up refine algorithms for Q here because u has not been set
311 // yet.
312 Pointer<RefineOperator<NDIM>> refine_op_Q = grid_geom->lookupRefineOperator(d_Q_var, "CONSERVATIVE_LINEAR_REFINE");
313 d_ghostfill_alg_Q = new RefineAlgorithm<NDIM>();
314 d_ghostfill_alg_Q->registerRefine(d_Q_scratch_idx, in.getComponentDescriptorIndex(0), d_Q_scratch_idx, refine_op_Q);
315 if (d_outflow_bdry_extrap_type != "NONE")
316 d_ghostfill_strategy_Q = new CartExtrapPhysBdryOp(d_Q_scratch_idx, d_outflow_bdry_extrap_type);
317 d_ghostfill_scheds_Q.resize(d_finest_ln + 1);
318 for (int ln = d_coarsest_ln; ln <= d_finest_ln; ++ln)
319 {
320 Pointer<PatchLevel<NDIM>> level = d_hierarchy->getPatchLevel(ln);
321 d_ghostfill_scheds_Q[ln] =
322 d_ghostfill_alg_Q->createSchedule(level, ln - 1, d_hierarchy, d_ghostfill_strategy_Q);
323 }

Calls 6

getPatchLevelMethod · 0.80
allocatePatchDataMethod · 0.80
getPatchHierarchyMethod · 0.45
getFinestLevelNumberMethod · 0.45
resizeMethod · 0.45

Tested by

no test coverage detected