| 2123 | } // applyProjection |
| 2124 | |
| 2125 | void |
| 2126 | ConstraintIBMethod::updateStructurePositionEulerStep() |
| 2127 | { |
| 2128 | using StructureParameters = ConstraintIBKinematics::StructureParameters; |
| 2129 | const int coarsest_ln = 0; |
| 2130 | const int finest_ln = d_hierarchy->getFinestLevelNumber(); |
| 2131 | const double dt = d_FuRMoRP_new_time - d_FuRMoRP_current_time; |
| 2132 | |
| 2133 | for (int ln = coarsest_ln; ln <= finest_ln; ++ln) |
| 2134 | { |
| 2135 | if (!d_l_data_manager->levelContainsLagrangianData(ln)) continue; |
| 2136 | |
| 2137 | boost::multi_array_ref<double, 2>& X_half_Euler_data = *d_l_data_X_half_Euler[ln]->getLocalFormVecArray(); |
| 2138 | const boost::multi_array_ref<double, 2>& X_current_data = |
| 2139 | *d_l_data_manager->getLData("X", ln)->getLocalFormVecArray(); |
| 2140 | const boost::multi_array_ref<double, 2>& U_current_data = *d_l_data_U_current[ln]->getLocalFormVecArray(); |
| 2141 | |
| 2142 | const Pointer<LMesh> mesh = d_l_data_manager->getLMesh(ln); |
| 2143 | const std::vector<LNode*>& local_nodes = mesh->getLocalNodes(); |
| 2144 | |
| 2145 | // Get structures on this level. |
| 2146 | const std::vector<int> structIDs = d_l_data_manager->getLagrangianStructureIDs(ln); |
| 2147 | const size_t structs_on_this_ln = structIDs.size(); |
| 2148 | |
| 2149 | for (size_t struct_no = 0; struct_no < structs_on_this_ln; ++struct_no) |
| 2150 | { |
| 2151 | std::pair<int, int> lag_idx_range = |
| 2152 | d_l_data_manager->getLagrangianStructureIndexRange(structIDs[struct_no], ln); |
| 2153 | const int offset = lag_idx_range.first; |
| 2154 | Pointer<ConstraintIBKinematics> ptr_ib_kinematics = |
| 2155 | *std::find_if(d_ib_kinematics.begin(), d_ib_kinematics.end(), find_struct_handle(lag_idx_range)); |
| 2156 | const int location_struct_handle = |
| 2157 | find_struct_handle_position(d_ib_kinematics.begin(), d_ib_kinematics.end(), ptr_ib_kinematics); |
| 2158 | const StructureParameters& struct_param = ptr_ib_kinematics->getStructureParameters(); |
| 2159 | const std::string position_update_method = struct_param.getPositionUpdateMethod(); |
| 2160 | const std::vector<std::vector<double>>& current_shape = ptr_ib_kinematics->getShape(ln); |
| 2161 | |
| 2162 | for (const auto& node_idx : local_nodes) |
| 2163 | { |
| 2164 | const int lag_idx = node_idx->getLagrangianIndex(); |
| 2165 | if (lag_idx_range.first <= lag_idx && lag_idx < lag_idx_range.second) |
| 2166 | { |
| 2167 | const int local_idx = node_idx->getLocalPETScIndex(); |
| 2168 | const double* const U_current = &U_current_data[local_idx][0]; |
| 2169 | const double* const X_current = &X_current_data[local_idx][0]; |
| 2170 | double* const X_half = &X_half_Euler_data[local_idx][0]; |
| 2171 | if (position_update_method == "CONSTRAINT_VELOCITY") |
| 2172 | { |
| 2173 | for (int d = 0; d < NDIM; ++d) |
| 2174 | { |
| 2175 | X_half[d] = X_current[d] + 0.5 * dt * U_current[d]; |
| 2176 | } |
| 2177 | } |
| 2178 | else if (position_update_method == "CONSTRAINT_POSITION") |
| 2179 | { |
| 2180 | for (int d = 0; d < NDIM; ++d) |
| 2181 | { |
| 2182 | X_half[d] = d_center_of_mass_current[location_struct_handle][d] + |
nothing calls this directly
no test coverage detected