Skip to content

Commit 00c2ec4

Browse files
committed
fixes
1 parent ab34d20 commit 00c2ec4

4 files changed

Lines changed: 21 additions & 21 deletions

File tree

Common/include/grid_movement/CGridMovement.hpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,12 @@ class CGridMovement {
5555
virtual ~CGridMovement(void);
5656

5757
/*!
58-
* \brief A pure virtual member.
58+
* \brief Set the surface/boundary deformation.
5959
* \param[in] geometry - Geometrical definition of the problem.
6060
* \param[in] config - Definition of the particular problem.
61+
* \return Total deformation applied, which may be less than target if intersection prevention is used.
6162
*/
62-
inline virtual void SetSurface_Deformation(CGeometry *geometry, CConfig *config, vector<vector<su2double> >& totalDeformation) { }
63-
63+
inline virtual vector<vector<su2double> > SetSurface_Deformation(CGeometry *geometry, CConfig *config) {
64+
return vector<vector<su2double> >();
65+
}
6466
};

Common/include/grid_movement/CSurfaceMovement.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,9 @@ class CSurfaceMovement : public CGridMovement {
210210
* \brief Set the surface/boundary deformation.
211211
* \param[in] geometry - Geometrical definition of the problem.
212212
* \param[in] config - Definition of the particular problem.
213+
* \return Total deformation applied, which may be less than target if intersection prevention is used.
213214
*/
214-
void SetSurface_Deformation(CGeometry *geometry, CConfig *config, vector<vector<su2double> >& totaldeformation) override;
215+
vector<vector<su2double> > SetSurface_Deformation(CGeometry *geometry, CConfig *config) override;
215216

216217
/*!
217218
* \brief Compute the parametric coordinates of a grid point using a point inversion strategy

Common/src/grid_movement/CSurfaceMovement.cpp

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,20 +39,21 @@ CSurfaceMovement::CSurfaceMovement(void) : CGridMovement() {
3939

4040
CSurfaceMovement::~CSurfaceMovement(void) {}
4141

42-
void CSurfaceMovement::SetSurface_Deformation(CGeometry *geometry, CConfig *config,
43-
vector<vector<su2double> >& totaldeformation) {
42+
vector<vector<su2double> > CSurfaceMovement::SetSurface_Deformation(CGeometry *geometry, CConfig *config) {
4443

4544
unsigned short iFFDBox, iDV, iLevel, iChild, iParent, jFFDBox, iMarker;
4645
unsigned short Degree_Unitary [] = {1,1,1}, BSpline_Unitary [] = {2,2,2};
4746
su2double MaxDiff, Current_Scale, Ratio, New_Scale;
4847
string FFDBoxTag;
4948
bool allmoving;
5049

51-
bool cylindrical = (config->GetFFD_CoordSystem() == CYLINDRICAL);
52-
bool spherical = (config->GetFFD_CoordSystem() == SPHERICAL);
53-
bool polar = (config->GetFFD_CoordSystem() == POLAR);
54-
bool cartesian = (config->GetFFD_CoordSystem() == CARTESIAN);
55-
su2double BoundLimit = config->GetOpt_LineSearch_Bound();
50+
const bool cylindrical = (config->GetFFD_CoordSystem() == CYLINDRICAL);
51+
const bool spherical = (config->GetFFD_CoordSystem() == SPHERICAL);
52+
const bool polar = (config->GetFFD_CoordSystem() == POLAR);
53+
const bool cartesian = (config->GetFFD_CoordSystem() == CARTESIAN);
54+
const su2double BoundLimit = config->GetOpt_LineSearch_Bound();
55+
56+
vector<vector<su2double> > totaldeformation;
5657

5758
/*--- Setting the Free Form Deformation ---*/
5859

@@ -323,7 +324,9 @@ void CSurfaceMovement::SetSurface_Deformation(CGeometry *geometry, CConfig *conf
323324
/*--- Set total deformation values in config ---*/
324325
if (config->GetKind_SU2() == SU2_DEF) {
325326

327+
totaldeformation.resize(config->GetnDV());
326328
for (iDV = 0; iDV < config->GetnDV(); iDV++) {
329+
totaldeformation[iDV].resize(config->GetnDV_Value(iDV));
327330
for (auto iDV_Value = 0u; iDV_Value < config->GetnDV_Value(iDV); iDV_Value++) {
328331
totaldeformation[iDV][iDV_Value] = config->GetDV_Value(iDV, iDV_Value);
329332
}
@@ -675,6 +678,7 @@ void CSurfaceMovement::SetSurface_Deformation(CGeometry *geometry, CConfig *conf
675678
cout << "Design Variable not implemented yet" << endl;
676679
}
677680

681+
return totaldeformation;
678682
}
679683

680684

@@ -705,8 +709,7 @@ void CSurfaceMovement::SetSurface_Derivative(CGeometry *geometry, CConfig *confi
705709

706710
/*--- Run the surface deformation with DV_Value = 0.0 (no deformation at all) ---*/
707711

708-
auto dummy = vector<vector<su2double> >();
709-
SetSurface_Deformation(geometry, config, dummy);
712+
SetSurface_Deformation(geometry, config);
710713
}
711714

712715
void CSurfaceMovement::CopyBoundary(CGeometry *geometry, CConfig *config) {

SU2_DEF/src/SU2_DEF.cpp

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -230,12 +230,6 @@ int main(int argc, char *argv[]) {
230230

231231
for (iZone = 0; iZone < nZone; iZone++){
232232

233-
/*--- Initialize total deformation of design variables to zero ---*/
234-
vector<vector<su2double> > TotalDeformation(config_container[iZone]->GetnDV());
235-
for (size_t iDV = 0; iDV < TotalDeformation.size(); iDV++) {
236-
TotalDeformation[iDV].resize(config_container[iZone]->GetnDV_Value(iDV), 0.0);
237-
}
238-
239233
if (config_container[iZone]->GetDesign_Variable(0) != NO_DEFORMATION) {
240234

241235
/*--- Definition of the Class for grid movement ---*/
@@ -283,7 +277,7 @@ int main(int argc, char *argv[]) {
283277
/*--- Surface grid deformation ---*/
284278

285279
if (rank == MASTER_NODE) cout << "Performing the deformation of the surface grid." << endl;
286-
surface_movement[iZone]->SetSurface_Deformation(geometry_container[iZone], config_container[iZone], TotalDeformation);
280+
auto TotalDeformation = surface_movement[iZone]->SetSurface_Deformation(geometry_container[iZone], config_container[iZone]);
287281

288282
if (config_container[iZone]->GetDesign_Variable(0) != FFD_SETTING) {
289283

@@ -353,7 +347,7 @@ int main(int argc, char *argv[]) {
353347
/*--- Surface grid deformation ---*/
354348
if (rank == MASTER_NODE) cout << "Performing the deformation of the surface grid." << endl;
355349

356-
surface_movement[iZone]->SetSurface_Deformation(geometry_container[iZone], config_container[iZone], TotalDeformation);
350+
TotalDeformation = surface_movement[iZone]->SetSurface_Deformation(geometry_container[iZone], config_container[iZone]);
357351

358352
if (rank == MASTER_NODE)
359353
cout << endl << "------------------- Volumetric grid deformation (ZONE " << iZone <<") ----------------" << endl;

0 commit comments

Comments
 (0)