@@ -47,24 +47,19 @@ void CSlidingInterface::GetDonor_Variable(CSolver *donor_solution, CGeometry *do
4747 const CConfig *donor_config, unsigned long Marker_Donor,
4848 unsigned long Vertex_Donor, unsigned long Point_Donor) {
4949
50- unsigned short iVar, nDonorVar;
51- nDonorVar = donor_solution->GetnPrimVar ();
52-
53- /* --- the number of primitive variables is set to two by default for the turbulent solver ---*/
54- bool turbulent = (nDonorVar == 2 ) ;
55-
50+ const auto nDonorVar = donor_solution->GetnPrimVar ();
51+ // / TODO: Replace with approach compatible with any number of variables (e.g. encapsulate in a "solver info" object).
52+ const bool turbulent = nDonorVar <= 2 ;
5653 if (turbulent){
57-
58- /* --- for turbulent solver retrieve solution and set it as the donor variable ---*/
59- Donor_Variable[0 ] = donor_solution->GetNodes ()->GetSolution (Point_Donor,0 );
60- Donor_Variable[1 ] = donor_solution->GetNodes ()->GetSolution (Point_Donor,1 );
61-
62- } else {
63-
64- /* --- Retrieve primitive variables and set them as the donor variables ---*/
65- for (iVar = 0 ; iVar < nDonorVar; iVar++)
66- Donor_Variable[iVar] = donor_solution->GetNodes ()->GetPrimitive (Point_Donor,iVar);
67-
54+ /* --- For turbulent solver retrieve solution variables and set then as the donor variables. ---*/
55+ for (unsigned short iVar = 0 ; iVar < nDonorVar; iVar++) {
56+ Donor_Variable[iVar] = donor_solution->GetNodes ()->GetSolution (Point_Donor, iVar);
57+ }
58+ } else {
59+ /* --- For flow solver retrieve primitive variables and set them as the donor variables. ---*/
60+ for (unsigned short iVar = 0 ; iVar < nDonorVar; iVar++) {
61+ Donor_Variable[iVar] = donor_solution->GetNodes ()->GetPrimitive (Point_Donor, iVar);
62+ }
6863 }
6964}
7065
0 commit comments