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

Function tagLSCells

src/level_set/LevelSetUtilities.cpp:155–208  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

153namespace LevelSetUtilities
154{
155void
156tagLSCells(Pointer<BasePatchHierarchy<NDIM>> hierarchy,
157 const int level_number,
158 const double /*error_data_time*/,
159 const int tag_index,
160 const bool initial_time,
161 const bool /*uses_richardson_extrapolation_too*/,
162 void* ctx)
163{
164 if (initial_time || level_number == hierarchy->getFinestLevelNumber()) return;
165
166 TagLSRefinementCells* ls_tagger = static_cast<TagLSRefinementCells*>(ctx);
167
168#if !defined(NDEBUG)
169 TBOX_ASSERT(ls_tagger);
170 TBOX_ASSERT(hierarchy);
171 TBOX_ASSERT(level_number >= 0);
172 TBOX_ASSERT(hierarchy->getPatchLevel(level_number));
173#endif
174
175 const LevelSetContainer& ls_container = ls_tagger->getLevelSetContainer();
176
177 // Get the level set information
178 VariableDatabase<NDIM>* var_db = VariableDatabase<NDIM>::getDatabase();
179 const int ls_idx = var_db->mapVariableAndContextToIndex(
180 ls_container.getLevelSetVariable(), ls_container.getAdvDiffHierarchyIntegrator()->getCurrentContext());
181
182 // Get the tagging criterion
183 const double& tag_min_val = ls_tagger->getTagMinValue();
184 const double& tag_max_val = ls_tagger->getTagMaxValue();
185
186 // Tag cells based on the value of the level set variable
187 Pointer<PatchLevel<NDIM>> level = hierarchy->getPatchLevel(level_number);
188 for (PatchLevel<NDIM>::Iterator p(level); p; p++)
189 {
190 Pointer<Patch<NDIM>> patch = level->getPatch(p());
191 const Box<NDIM>& patch_box = patch->getBox();
192 Pointer<CellData<NDIM, int>> tags_data = patch->getPatchData(tag_index);
193 Pointer<CellData<NDIM, double>> ls_data = patch->getPatchData(ls_idx);
194
195 for (CellIterator<NDIM> ic(patch_box); ic; ic++)
196 {
197 const hier::Index<NDIM>& i = ic();
198 const double dist = (*ls_data)(i);
199
200 if (dist >= tag_min_val && dist <= tag_max_val)
201 {
202 (*tags_data)(i) = 1;
203 }
204 }
205 }
206
207 return;
208} // tagLSCells
209
210LevelSetMassLossFixer::LevelSetMassLossFixer(std::string object_name,
211 Pointer<AdvDiffHierarchyIntegrator> adv_diff_integrator,

Callers

nothing calls this directly

Calls 7

getPatchLevelMethod · 0.80
getLevelSetVariableMethod · 0.80
getCurrentContextMethod · 0.80
getTagMinValueMethod · 0.80
getTagMaxValueMethod · 0.80
getFinestLevelNumberMethod · 0.45

Tested by

no test coverage detected