@@ -980,12 +980,8 @@ void DerivativeTreatment_MeshSensitivity(CGeometry *geometry, CConfig *config, C
980980
981981 /* -- Construct the smoothing solver and numerics ---*/
982982 std::unique_ptr<CSolver> solver (new CGradientSmoothingSolver (geometry, config));
983- CNumerics* numerics;
984- if (config->GetSmoothOnSurface ()) {
985- numerics = new CGradSmoothing (geometry->GetnDim ()-1 , config);
986- } else {
987- numerics = new CGradSmoothing (geometry->GetnDim (), config);
988- }
983+ unsigned dim = (config->GetSmoothOnSurface () ? geometry->GetnDim () - 1 : geometry->GetnDim ());
984+ std::unique_ptr<CNumerics> numerics (new CGradSmoothing (dim, config));
989985
990986 if (rank == MASTER_NODE) cout << " Sobolev Smoothing of derivatives is active." << endl;
991987
@@ -1003,7 +999,7 @@ void DerivativeTreatment_MeshSensitivity(CGeometry *geometry, CConfig *config, C
1003999 solver->ReadSensFromGeometry (geometry);
10041000
10051001 /* --- Perform the smoothing procedure on all boundaries marked as DV marker. ---*/
1006- solver->ApplyGradientSmoothingSurface (geometry, numerics, config);
1002+ solver->ApplyGradientSmoothingSurface (geometry, numerics. get () , config);
10071003
10081004 /* --- After appling the solver write the results back ---*/
10091005 solver->WriteSensToGeometry (geometry);
@@ -1014,7 +1010,7 @@ void DerivativeTreatment_MeshSensitivity(CGeometry *geometry, CConfig *config, C
10141010 /* --- Get the sensitivities from the geometry class to work with. ---*/
10151011 solver->ReadSensFromGeometry (geometry);
10161012
1017- solver->ApplyGradientSmoothingVolume (geometry, numerics, config);
1013+ solver->ApplyGradientSmoothingVolume (geometry, numerics. get () , config);
10181014
10191015 /* --- After appling the solver write the results back ---*/
10201016 solver->WriteSensToGeometry (geometry);
@@ -1025,8 +1021,6 @@ void DerivativeTreatment_MeshSensitivity(CGeometry *geometry, CConfig *config, C
10251021
10261022 }
10271023
1028- delete numerics;
1029-
10301024}
10311025
10321026void DerivativeTreatment_Gradient (CGeometry *geometry, CConfig *config, CVolumetricMovement* grid_movement, CSurfaceMovement *surface_movement, su2double** Gradient) {
@@ -1041,12 +1035,8 @@ void DerivativeTreatment_Gradient(CGeometry *geometry, CConfig *config, CVolumet
10411035
10421036 /* -- Construct the smoothing solver and numerics ---*/
10431037 std::unique_ptr<CSolver> solver (new CGradientSmoothingSolver (geometry, config));
1044- CNumerics* numerics;
1045- if (config->GetSmoothOnSurface ()) {
1046- numerics = new CGradSmoothing (geometry->GetnDim ()-1 , config);
1047- } else {
1048- numerics = new CGradSmoothing (geometry->GetnDim (), config);
1049- }
1038+ unsigned dim = (config->GetSmoothOnSurface () ? geometry->GetnDim () - 1 : geometry->GetnDim ());
1039+ std::unique_ptr<CNumerics> numerics (new CGradSmoothing (dim, config));
10501040
10511041 if (rank == MASTER_NODE) cout << " Sobolev Smoothing of derivatives is active." << endl;
10521042
@@ -1055,14 +1045,12 @@ void DerivativeTreatment_Gradient(CGeometry *geometry, CConfig *config, CVolumet
10551045
10561046 /* --- Apply the smoothing procedure on the DV level. ---*/
10571047 if (config->GetSobMode () == ENUM_SOBOLEV_MODUS::PARAM_LEVEL_COMPLETE) {
1058- solver->ApplyGradientSmoothingDV (geometry, numerics, surface_movement, grid_movement, config, Gradient);
1048+ solver->ApplyGradientSmoothingDV (geometry, numerics. get () , surface_movement, grid_movement, config, Gradient);
10591049
10601050 /* --- If smoothing already took place on the mesh level, or none is requested, just do standard projection. ---*/
10611051 } else if (config->GetSobMode () == ENUM_SOBOLEV_MODUS::ONLY_GRAD ||
10621052 config->GetSobMode () == ENUM_SOBOLEV_MODUS::MESH_LEVEL) {
10631053 solver->RecordTapeAndCalculateOriginalGradient (geometry, surface_movement, grid_movement, config, Gradient);
10641054 }
10651055
1066- delete numerics;
1067-
10681056}
0 commit comments