| 153 | namespace LevelSetUtilities |
| 154 | { |
| 155 | void |
| 156 | tagLSCells(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 | |
| 210 | LevelSetMassLossFixer::LevelSetMassLossFixer(std::string object_name, |
| 211 | Pointer<AdvDiffHierarchyIntegrator> adv_diff_integrator, |
nothing calls this directly
no test coverage detected