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

Method interpolateVariables

src/IB/IBFEPostProcessor.cpp:221–291  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

219/////////////////////////////// PROTECTED ////////////////////////////////////
220
221void
222IBFEPostProcessor::interpolateVariables(const double data_time)
223{
224 Pointer<PatchHierarchy<NDIM>> hierarchy = d_fe_data_manager->getPatchHierarchy();
225 const int coarsest_ln = d_fe_data_manager->getCoarsestPatchLevelNumber();
226 const int finest_ln = d_fe_data_manager->getFinestPatchLevelNumber();
227
228 const size_t num_eulerian_vars = d_scalar_interp_var_systems.size();
229
230 // Set up Eulerian scratch space and fill ghost cell values.
231 std::set<int> scratch_idxs;
232 for (unsigned int k = 0; k < num_eulerian_vars; ++k)
233 {
234 int& data_idx = d_scalar_interp_data_idxs[k];
235 int& scratch_idx = d_scalar_interp_scratch_idxs[k];
236 if (data_idx < 0 || scratch_idx < 0)
237 {
238 TBOX_ASSERT(data_idx < 0 || scratch_idx < 0);
239 VariableDatabase<NDIM>* var_db = VariableDatabase<NDIM>::getDatabase();
240 Pointer<hier::Variable<NDIM>> data_var = d_scalar_interp_vars[k];
241 Pointer<VariableContext> data_ctx = d_scalar_interp_ctxs[k];
242 data_idx = var_db->mapVariableAndContextToIndex(data_var, data_ctx);
243 TBOX_ASSERT(data_idx >= 0);
244 Pointer<VariableContext> scratch_ctx = var_db->getContext(d_name + "::SCRATCH");
245 const FEDataManager::InterpSpec& interp_spec = d_scalar_interp_specs[k];
246 const int ghost_width = LEInteractor::getMinimumGhostWidth(interp_spec.kernel_fcn) + 1;
247 scratch_idx = var_db->registerVariableAndContext(data_var, scratch_ctx, ghost_width);
248 scratch_idxs.insert(scratch_idx);
249 d_scalar_interp_fill_transactions[k].d_src_data_idx = data_idx;
250 d_scalar_interp_fill_transactions[k].d_dst_data_idx = scratch_idx;
251 }
252 }
253 for (int ln = coarsest_ln; ln <= finest_ln; ++ln)
254 {
255 Pointer<PatchLevel<NDIM>> level = hierarchy->getPatchLevel(ln);
256 for (unsigned int k = 0; k < num_eulerian_vars; ++k)
257 {
258 const int scratch_idx = d_scalar_interp_scratch_idxs[k];
259 if (!level->checkAllocated(scratch_idx)) level->allocatePatchData(scratch_idx, data_time);
260 }
261 }
262
263 HierarchyGhostCellInterpolation ghost_fill_op;
264 ghost_fill_op.initializeOperatorState(d_scalar_interp_fill_transactions, hierarchy);
265 ghost_fill_op.fillData(data_time);
266
267 // Interpolate variables.
268 std::unique_ptr<libMesh::PetscVector<double>> X_ghost_vec =
269 d_fe_data_manager->buildIBGhostedVector(d_fe_data_manager->getCurrentCoordinatesSystemName());
270 copy_and_synch(*d_fe_data_manager->getSolutionVector(d_fe_data_manager->getCurrentCoordinatesSystemName()),
271 *X_ghost_vec);
272 for (unsigned int k = 0; k < num_eulerian_vars; ++k)
273 {
274 System* system = d_scalar_interp_var_systems[k];
275 const std::string& system_name = system->name();
276 const int scratch_idx = d_scalar_interp_scratch_idxs[k];
277 d_fe_data_manager->interp(scratch_idx, *system->solution, *X_ghost_vec, system_name, d_scalar_interp_specs[k]);
278 }

Callers

nothing calls this directly

Calls 14

copy_and_synchFunction · 0.85
getPatchLevelMethod · 0.80
allocatePatchDataMethod · 0.80
fillDataMethod · 0.80
buildIBGhostedVectorMethod · 0.80
deallocatePatchDataMethod · 0.80
getPatchHierarchyMethod · 0.45
sizeMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected