11 #include <boost/algorithm/string.hpp>
68 template <
typename propagator_state_t,
typename stepper_t>
69 void operator()(propagator_state_t& state,
const stepper_t& ,
75 state.navigation.nextSurfaceIter =
76 state.navigation.surfaceSequence.begin();
82 template <
typename propagator_state_t,
typename stepper_t>
84 const stepper_t& )
const {}
126 template <
typename propagator_state_t,
typename stepper_t>
129 debugLog(state, [&] {
return std::string(
"Entering navigator::status."); });
132 state.navigation.currentSurface =
nullptr;
135 std::stringstream dstream;
136 dstream << std::distance(state.navigation.nextSurfaceIter,
137 state.navigation.surfaceSequence.end());
138 dstream <<
" out of " << state.navigation.surfaceSequence.size();
139 dstream <<
" surfaces remain to try.";
140 return dstream.str();
143 if (state.navigation.nextSurfaceIter !=
144 state.navigation.surfaceSequence.end()) {
146 auto surfaceStatus = stepper.updateSurfaceStatus(
147 state.stepping, **state.navigation.nextSurfaceIter,
false);
148 if (surfaceStatus == Intersection::Status::onSurface) {
150 state.navigation.currentSurface = *state.navigation.nextSurfaceIter;
152 std::stringstream dstream;
153 dstream <<
"Current surface set to "
154 << state.navigation.currentSurface->geoID();
155 return dstream.str();
158 ++state.navigation.nextSurfaceIter;
159 if (state.navigation.nextSurfaceIter !=
160 state.navigation.surfaceSequence.end()) {
162 std::stringstream dstream;
163 dstream <<
"Next surface candidate is "
164 << (*state.navigation.nextSurfaceIter)->geoID();
165 return dstream.str();
167 stepper.releaseStepSize(state.stepping);
169 }
else if (surfaceStatus == Intersection::Status::reachable) {
171 std::stringstream dstream;
172 dstream <<
"Next surface reachable at distance "
173 << stepper.outputStepSize(state.stepping);
174 return dstream.str();
187 template <
typename propagator_state_t,
typename stepper_t>
190 debugLog(state, [&] {
return std::string(
"Entering navigator::target."); });
193 state.navigation.currentSurface =
nullptr;
196 std::stringstream dstream;
197 dstream << std::distance(state.navigation.nextSurfaceIter,
198 state.navigation.surfaceSequence.end());
199 dstream <<
" out of " << state.navigation.surfaceSequence.size();
200 dstream <<
" surfaces remain to try.";
201 return dstream.str();
203 if (state.navigation.nextSurfaceIter !=
204 state.navigation.surfaceSequence.end()) {
206 auto surfaceStatus = stepper.updateSurfaceStatus(
207 state.stepping, **state.navigation.nextSurfaceIter,
false);
208 if (surfaceStatus == Intersection::Status::unreachable) {
210 std::stringstream dstream;
211 dstream <<
"Surface not reachable anymore, switching to next one in "
213 return dstream.str();
216 ++state.navigation.nextSurfaceIter;
219 std::stringstream dstream;
220 dstream <<
"Navigation stepSize set to ";
221 dstream << stepper.outputStepSize(state.stepping);
222 return dstream.str();
227 state.navigation.navigationBreak =
true;
229 if (state.navigation.targetSurface ==
nullptr) {
230 state.navigation.targetReached =
true;
233 [&] {
return std::string(
"No target Surface, job done."); });
251 template <
typename propagator_state_t>
254 if (state.options.debug) {
255 std::string vName =
"Direct Navigator";
256 std::vector<std::string> lines;
257 std::string input = logAction();
259 for (
const auto& line : lines) {
260 std::stringstream dstream;
261 dstream <<
">>>" << std::setw(state.options.debugPfxWidth) << vName
263 dstream << std::setw(state.options.debugMsgWidth) << line <<
'\n';
264 state.options.debugString += dstream.str();