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

Method cacheLocalIndices

ibtk/src/lagrangian/LIndexSetData.cpp:54–141  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

52
53template <class T>
54void
55LIndexSetData<T>::cacheLocalIndices(Pointer<Patch<NDIM>> patch, const IntVector<NDIM>& periodic_shift)
56{
57 d_lag_indices.clear();
58 d_interior_lag_indices.clear();
59 d_ghost_lag_indices.clear();
60 d_global_petsc_indices.clear();
61 d_interior_global_petsc_indices.clear();
62 d_ghost_global_petsc_indices.clear();
63 d_local_petsc_indices.clear();
64 d_interior_local_petsc_indices.clear();
65 d_ghost_local_petsc_indices.clear();
66 d_periodic_shifts.clear();
67 d_interior_periodic_shifts.clear();
68 d_ghost_periodic_shifts.clear();
69
70 const Box<NDIM>& patch_box = patch->getBox();
71 const hier::Index<NDIM>& ilower = patch_box.lower();
72 const hier::Index<NDIM>& iupper = patch_box.upper();
73
74 const Pointer<CartesianPatchGeometry<NDIM>> pgeom = patch->getPatchGeometry();
75 const double* const dx = pgeom->getDx();
76 std::array<bool, NDIM> patch_touches_lower_periodic_bdry, patch_touches_upper_periodic_bdry;
77 for (unsigned int axis = 0; axis < NDIM; ++axis)
78 {
79 patch_touches_lower_periodic_bdry[axis] = pgeom->getTouchesPeriodicBoundary(axis, 0);
80 patch_touches_upper_periodic_bdry[axis] = pgeom->getTouchesPeriodicBoundary(axis, 1);
81 }
82
83 for (typename LSetData<T>::SetIterator it(*this); it; it++)
84 {
85 const CellIndex<NDIM>& i = it.getIndex();
86 std::array<int, NDIM> offset;
87 for (unsigned int d = 0; d < NDIM; ++d)
88 {
89 if (patch_touches_lower_periodic_bdry[d] && i(d) < ilower(d))
90 {
91 offset[d] = -periodic_shift(d); // X is ABOVE the top of the patch --- need
92 // to shift DOWN
93 }
94 else if (patch_touches_upper_periodic_bdry[d] && i(d) > iupper(d))
95 {
96 offset[d] = +periodic_shift(d); // X is BELOW the bottom of the patch --- need to shift UP
97 }
98 else
99 {
100 offset[d] = 0;
101 }
102 }
103 const LSet<T>& idx_set = *it;
104 const bool patch_owns_idx_set = patch_box.contains(i);
105 for (auto n = idx_set.begin(); n != idx_set.end(); ++n)
106 {
107 const typename LSet<T>::value_type& idx = *n;
108 const int lag_idx = idx->getLagrangianIndex();
109 const int global_petsc_idx = idx->getGlobalPETScIndex();
110 const int local_petsc_idx = idx->getLocalPETScIndex();
111 d_lag_indices.push_back(lag_idx);

Callers 2

endDataRedistributionMethod · 0.80
initializeLevelDataMethod · 0.80

Calls 8

getLagrangianIndexMethod · 0.80
getGlobalPETScIndexMethod · 0.80
getLocalPETScIndexMethod · 0.80
clearMethod · 0.45
containsMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected