| 1110 | } // initializeDataOnPatchLevel |
| 1111 | |
| 1112 | unsigned int |
| 1113 | IBRedundantInitializer::initializeMassDataOnPatchLevel(const unsigned int /*global_index_offset*/, |
| 1114 | const unsigned int local_index_offset, |
| 1115 | Pointer<LData> M_data, |
| 1116 | Pointer<LData> K_data, |
| 1117 | const Pointer<PatchHierarchy<NDIM>> hierarchy, |
| 1118 | const int level_number, |
| 1119 | const double /*init_data_time*/, |
| 1120 | const bool /*can_be_refined*/, |
| 1121 | const bool /*initial_time*/, |
| 1122 | LDataManager* const /*l_data_manager*/) |
| 1123 | { |
| 1124 | #if !defined(NDEBUG) |
| 1125 | TBOX_ASSERT(d_data_processed); |
| 1126 | #endif |
| 1127 | |
| 1128 | // Loop over all patches in the specified level of the patch level and |
| 1129 | // initialize the local vertices. |
| 1130 | boost::multi_array_ref<double, 1>& M_array = *M_data->getLocalFormArray(); |
| 1131 | boost::multi_array_ref<double, 1>& K_array = *K_data->getLocalFormArray(); |
| 1132 | int local_idx = invalid_index; |
| 1133 | int local_node_count = 0; |
| 1134 | Pointer<PatchLevel<NDIM>> level = hierarchy->getPatchLevel(level_number); |
| 1135 | for (PatchLevel<NDIM>::Iterator p(level); p; p++) |
| 1136 | { |
| 1137 | Pointer<Patch<NDIM>> patch = level->getPatch(p()); |
| 1138 | |
| 1139 | // Initialize the vertices whose initial locations will be within the |
| 1140 | // given patch. |
| 1141 | std::vector<std::pair<int, int>> patch_vertices; |
| 1142 | getPatchVertices(patch_vertices, patch, hierarchy); |
| 1143 | local_node_count += patch_vertices.size(); |
| 1144 | for (const auto& point_idx : patch_vertices) |
| 1145 | { |
| 1146 | const int local_petsc_idx = ++local_idx + local_index_offset; |
| 1147 | |
| 1148 | // Initialize the mass and penalty stiffness coefficient |
| 1149 | // corresponding to the present vertex. |
| 1150 | const BdryMassSpec& spec = getVertexBdryMassSpec(point_idx, level_number); |
| 1151 | const double M = spec.bdry_mass; |
| 1152 | const double K = spec.stiffness; |
| 1153 | |
| 1154 | // Avoid division by zero at massless nodes. |
| 1155 | if (IBTK::abs_equal_eps(M, 0.0)) |
| 1156 | { |
| 1157 | M_array[local_petsc_idx] = std::numeric_limits<double>::epsilon(); |
| 1158 | K_array[local_petsc_idx] = 0.0; |
| 1159 | } |
| 1160 | else |
| 1161 | { |
| 1162 | M_array[local_petsc_idx] = M; |
| 1163 | K_array[local_petsc_idx] = K; |
| 1164 | } |
| 1165 | } |
| 1166 | } |
| 1167 | M_data->restoreArrays(); |
| 1168 | K_data->restoreArrays(); |
| 1169 | return local_node_count; |
no test coverage detected