@@ -356,6 +356,58 @@ class CDriver : public CDriverBase {
356356 */
357357 void Print_DirectResidual (RECORDING kind_recording);
358358
359+ /* !
360+ * \brief Set the solution of all solvers (adjoint or primal) in a zone.
361+ * \param[in] iZone - Index of the zone.
362+ * \param[in] adjoint - True to consider adjoint solvers instead of primal.
363+ * \param[in] solution - Solution object with interface (iPoint,iVar).
364+ * \tparam Old - If true set "old solutions" instead.
365+ */
366+ template <class Container , bool Old = false >
367+ void SetAllSolutions (unsigned short iZone, bool adjoint, const Container& solution) {
368+ const auto nPoint = geometry_container[iZone][INST_0][MESH_0]->GetnPoint ();
369+ for (auto iSol = 0u , offset = 0u ; iSol < MAX_SOLS; ++iSol) {
370+ auto solver = solver_container[iZone][INST_0][MESH_0][iSol];
371+ if (!(solver && (solver->GetAdjoint () == adjoint))) continue ;
372+ for (auto iPoint = 0ul ; iPoint < nPoint; ++iPoint)
373+ for (auto iVar = 0ul ; iVar < solver->GetnVar (); ++iVar)
374+ if (!Old) {
375+ solver->GetNodes ()->SetSolution (iPoint, iVar, solution (iPoint, offset + iVar));
376+ } else {
377+ solver->GetNodes ()->SetSolution_Old (iPoint, iVar, solution (iPoint, offset + iVar));
378+ }
379+ offset += solver->GetnVar ();
380+ }
381+ }
382+
383+ /* !
384+ * \brief Set the "old solution" of all solvers (adjoint or primal) in a zone.
385+ */
386+ template <class Container >
387+ void SetAllSolutionsOld (unsigned short iZone, bool adjoint, const Container& solution) {
388+ SetAllSolutions<Container, true >(iZone, adjoint, solution);
389+ }
390+
391+ /* !
392+ * \brief Get the solution of all solvers (adjoint or primal) in a zone.
393+ * \param[in] iZone - Index of the zone.
394+ * \param[in] adjoint - True to consider adjoint solvers instead of primal.
395+ * \param[out] solution - Solution object with interface (iPoint,iVar).
396+ */
397+ template <class Container >
398+ void GetAllSolutions (unsigned short iZone, bool adjoint, Container& solution) const {
399+ const auto nPoint = geometry_container[iZone][INST_0][MESH_0]->GetnPoint ();
400+ for (auto iSol = 0u , offset = 0u ; iSol < MAX_SOLS; ++iSol) {
401+ auto solver = solver_container[iZone][INST_0][MESH_0][iSol];
402+ if (!(solver && (solver->GetAdjoint () == adjoint))) continue ;
403+ const auto & sol = solver->GetNodes ()->GetSolution ();
404+ for (auto iPoint = 0ul ; iPoint < nPoint; ++iPoint)
405+ for (auto iVar = 0ul ; iVar < solver->GetnVar (); ++iVar)
406+ solution (iPoint, offset + iVar) = SU2_TYPE::GetValue (sol (iPoint, iVar));
407+ offset += solver->GetnVar ();
408+ }
409+ }
410+
359411 public:
360412 /* !
361413 * \brief Launch the computation for all zones and all physics.
@@ -413,56 +465,14 @@ class CDriver : public CDriverBase {
413465 void BoundaryConditionsUpdate ();
414466
415467 /* !
416- * \brief Get the total drag.
417- * \return Total drag.
418- */
419- passivedouble Get_Drag () const ;
420-
421- /* !
422- * \brief Get the total lift.
423- * \return Total lift.
424- */
425- passivedouble Get_Lift () const ;
426-
427- /* !
428- * \brief Get the total x moment.
429- * \return Total x moment.
430- */
431- passivedouble Get_Mx () const ;
432-
433- /* !
434- * \brief Get the total y moment.
435- * \return Total y moment.
436- */
437- passivedouble Get_My () const ;
438-
439- /* !
440- * \brief Get the total z moment.
441- * \return Total z moment.
442- */
443- passivedouble Get_Mz () const ;
444-
445- /* !
446- * \brief Get the total drag coefficient.
447- * \return Total drag coefficient.
448- */
449- passivedouble Get_DragCoeff () const ;
450-
451- /* !
452- * \brief Get the total lift coefficient.
453- * \return Total lift coefficient.
454- */
455- passivedouble Get_LiftCoeff () const ;
456-
457- /* !
458- * \brief Get the number of external iterations.
459- * \return Number of external iterations.
468+ * \brief Get the number of time iterations.
469+ * \return Number of time iterations.
460470 */
461471 unsigned long GetNumberTimeIter () const ;
462472
463473 /* !
464- * \brief Get the current external iteration.
465- * \return Current external iteration.
474+ * \brief Get the current time iteration.
475+ * \return Current time iteration.
466476 */
467477 unsigned long GetTimeIter () const ;
468478
@@ -518,58 +528,6 @@ class CDriver : public CDriverBase {
518528 }
519529 return nVar;
520530 }
521-
522- /* !
523- * \brief Set the solution of all solvers (adjoint or primal) in a zone.
524- * \param[in] iZone - Index of the zone.
525- * \param[in] adjoint - True to consider adjoint solvers instead of primal.
526- * \param[in] solution - Solution object with interface (iPoint,iVar).
527- * \tparam Old - If true set "old solutions" instead.
528- */
529- template <class Container , bool Old = false >
530- void SetAllSolutions (unsigned short iZone, bool adjoint, const Container& solution) {
531- const auto nPoint = geometry_container[iZone][INST_0][MESH_0]->GetnPoint ();
532- for (auto iSol = 0u , offset = 0u ; iSol < MAX_SOLS; ++iSol) {
533- auto solver = solver_container[iZone][INST_0][MESH_0][iSol];
534- if (!(solver && (solver->GetAdjoint () == adjoint))) continue ;
535- for (auto iPoint = 0ul ; iPoint < nPoint; ++iPoint)
536- for (auto iVar = 0ul ; iVar < solver->GetnVar (); ++iVar)
537- if (!Old) {
538- solver->GetNodes ()->SetSolution (iPoint, iVar, solution (iPoint, offset + iVar));
539- } else {
540- solver->GetNodes ()->SetSolution_Old (iPoint, iVar, solution (iPoint, offset + iVar));
541- }
542- offset += solver->GetnVar ();
543- }
544- }
545-
546- /* !
547- * \brief Set the "old solution" of all solvers (adjoint or primal) in a zone.
548- */
549- template <class Container >
550- void SetAllSolutionsOld (unsigned short iZone, bool adjoint, const Container& solution) {
551- SetAllSolutions<Container, true >(iZone, adjoint, solution);
552- }
553-
554- /* !
555- * \brief Get the solution of all solvers (adjoint or primal) in a zone.
556- * \param[in] iZone - Index of the zone.
557- * \param[in] adjoint - True to consider adjoint solvers instead of primal.
558- * \param[out] solution - Solution object with interface (iPoint,iVar).
559- */
560- template <class Container >
561- void GetAllSolutions (unsigned short iZone, bool adjoint, Container& solution) const {
562- const auto nPoint = geometry_container[iZone][INST_0][MESH_0]->GetnPoint ();
563- for (auto iSol = 0u , offset = 0u ; iSol < MAX_SOLS; ++iSol) {
564- auto solver = solver_container[iZone][INST_0][MESH_0][iSol];
565- if (!(solver && (solver->GetAdjoint () == adjoint))) continue ;
566- const auto & sol = solver->GetNodes ()->GetSolution ();
567- for (auto iPoint = 0ul ; iPoint < nPoint; ++iPoint)
568- for (auto iVar = 0ul ; iVar < solver->GetnVar (); ++iVar)
569- solution (iPoint, offset + iVar) = SU2_TYPE::GetValue (sol (iPoint, iVar));
570- offset += solver->GetnVar ();
571- }
572- }
573531};
574532
575533/* !
0 commit comments