| 2226 | } // eulerStep |
| 2227 | |
| 2228 | void |
| 2229 | ConstraintIBMethod::updateStructurePositionMidPointStep() |
| 2230 | { |
| 2231 | using StructureParameters = ConstraintIBKinematics::StructureParameters; |
| 2232 | const int coarsest_ln = 0; |
| 2233 | const int finest_ln = d_hierarchy->getFinestLevelNumber(); |
| 2234 | const double dt = d_FuRMoRP_new_time - d_FuRMoRP_current_time; |
| 2235 | |
| 2236 | calculateMidPointVelocity(); |
| 2237 | for (int ln = coarsest_ln; ln <= finest_ln; ++ln) |
| 2238 | { |
| 2239 | if (!d_l_data_manager->levelContainsLagrangianData(ln)) continue; |
| 2240 | |
| 2241 | boost::multi_array_ref<double, 2>& X_new_MidPoint_data = *d_l_data_X_new_MidPoint[ln]->getLocalFormVecArray(); |
| 2242 | const boost::multi_array_ref<double, 2>& X_current_data = |
| 2243 | *d_l_data_manager->getLData("X", ln)->getLocalFormVecArray(); |
| 2244 | const boost::multi_array_ref<double, 2>& U_half_data = *d_l_data_U_half[ln]->getLocalFormVecArray(); |
| 2245 | |
| 2246 | const Pointer<LMesh> mesh = d_l_data_manager->getLMesh(ln); |
| 2247 | const std::vector<LNode*>& local_nodes = mesh->getLocalNodes(); |
| 2248 | |
| 2249 | // Get structures on this level. |
| 2250 | const std::vector<int> structIDs = d_l_data_manager->getLagrangianStructureIDs(ln); |
| 2251 | const size_t structs_on_this_ln = structIDs.size(); |
| 2252 | |
| 2253 | for (size_t struct_no = 0; struct_no < structs_on_this_ln; ++struct_no) |
| 2254 | { |
| 2255 | std::pair<int, int> lag_idx_range = |
| 2256 | d_l_data_manager->getLagrangianStructureIndexRange(structIDs[struct_no], ln); |
| 2257 | const int offset = lag_idx_range.first; |
| 2258 | Pointer<ConstraintIBKinematics> ptr_ib_kinematics = |
| 2259 | *std::find_if(d_ib_kinematics.begin(), d_ib_kinematics.end(), find_struct_handle(lag_idx_range)); |
| 2260 | const int location_struct_handle = |
| 2261 | find_struct_handle_position(d_ib_kinematics.begin(), d_ib_kinematics.end(), ptr_ib_kinematics); |
| 2262 | const StructureParameters& struct_param = ptr_ib_kinematics->getStructureParameters(); |
| 2263 | const std::string position_update_method = struct_param.getPositionUpdateMethod(); |
| 2264 | const std::vector<std::vector<double>>& new_shape = ptr_ib_kinematics->getShape(ln); |
| 2265 | |
| 2266 | for (const auto& node_idx : local_nodes) |
| 2267 | { |
| 2268 | const int lag_idx = node_idx->getLagrangianIndex(); |
| 2269 | if (lag_idx_range.first <= lag_idx && lag_idx < lag_idx_range.second) |
| 2270 | { |
| 2271 | const int local_idx = node_idx->getLocalPETScIndex(); |
| 2272 | const double* const U_half = &U_half_data[local_idx][0]; |
| 2273 | const double* const X_current = &X_current_data[local_idx][0]; |
| 2274 | double* const X_new = &X_new_MidPoint_data[local_idx][0]; |
| 2275 | |
| 2276 | if (position_update_method == "CONSTRAINT_VELOCITY") |
| 2277 | { |
| 2278 | for (int d = 0; d < NDIM; ++d) |
| 2279 | { |
| 2280 | X_new[d] = X_current[d] + dt * U_half[d]; |
| 2281 | } |
| 2282 | } |
| 2283 | else if (position_update_method == "CONSTRAINT_POSITION") |
| 2284 | { |
| 2285 | for (int d = 0; d < NDIM; ++d) |
nothing calls this directly
no test coverage detected