@@ -1916,14 +1916,12 @@ void CFEASolver::Postprocessing(CGeometry *geometry, CConfig *config, CNumerics
19161916 /* --- Compute the objective function. ---*/
19171917
19181918 const auto kindObjFunc = config->GetKind_ObjFunc ();
1919-
1920- if (((kindObjFunc == REFERENCE_GEOMETRY) || (kindObjFunc == REFERENCE_NODE)) &&
1921- ((config->GetDV_FEA () == YOUNG_MODULUS) || (config->GetDV_FEA () == DENSITY_VAL))) {
1922-
1923- Stiffness_Penalty (geometry, numerics, config);
1924- }
1919+ const bool penalty = ((kindObjFunc == REFERENCE_GEOMETRY) || (kindObjFunc == REFERENCE_NODE)) &&
1920+ ((config->GetDV_FEA () == YOUNG_MODULUS) || (config->GetDV_FEA () == DENSITY_VAL));
19251921
19261922 if (of_comp_mode) {
1923+ if (penalty) Stiffness_Penalty (geometry, numerics, config);
1924+
19271925 switch (kindObjFunc) {
19281926 case REFERENCE_GEOMETRY: Compute_OFRefGeom (geometry, config); break ;
19291927 case REFERENCE_NODE: Compute_OFRefNode (geometry, config); break ;
@@ -1939,6 +1937,7 @@ void CFEASolver::Postprocessing(CGeometry *geometry, CConfig *config, CNumerics
19391937 Compute_NodalStress (geometry, numerics, config);
19401938
19411939 /* --- Compute functions for monitoring and output. ---*/
1940+ if (penalty) Stiffness_Penalty (geometry, numerics, config);
19421941 Compute_OFRefNode (geometry, config);
19431942 Compute_OFCompliance (geometry, config);
19441943 if (config->GetRefGeom ()) Compute_OFRefGeom (geometry, config);
0 commit comments