2727
2828#pragma once
2929
30- #include " ../../../Common/include/geometry/elements/CElement.hpp"
3130#include " ../../../Common/include/linear_algebra/CMatrixVectorProduct.hpp"
3231#include " ../../../Common/include/toolboxes/CSquareMatrixCM.hpp"
33- #include " ../../../SU2_CFD/include/solvers/CSolver .hpp"
32+ #include " ../../../SU2_CFD/include/solvers/CFEASolverBase .hpp"
3433
3534/* ! \class CGradientSmoothingSolver
3635 * \brief Main class for defining a gradient smoothing.
3736 * \author T. Dick.
3837 * \date March 25, 2019.
3938 */
40- class CGradientSmoothingSolver : public CSolver {
39+ class CGradientSmoothingSolver final : public CFEASolverBase {
4140public:
42- enum : size_t {MAXNNODE_2D = 4 };
43- enum : size_t {MAXNNODE_3D = 8 };
44- enum : size_t {MAXNDIM = 3 };
4541
4642/* * Introduction of a new alias for the data type to allow compilation with forward mode.
4743 *
@@ -57,32 +53,18 @@ class CGradientSmoothingSolver : public CSolver {
5753 using MatrixType = C2DContainer<unsigned long , su2double, StorageType::RowMajor, 64 , DynamicSize, DynamicSize>;
5854
5955 private:
60- unsigned long nElement;
61- CElement*** element_container = nullptr ; /* !< \brief Container which stores the element information. */
56+ unsigned int curDim; /* !< \brief If we separate dimensions this tells us in what dimension we currently are. */
6257
63- unsigned int dir; /* !< \brief If we separate dimensions this tells us in what dimension we currently are. */
64-
65- CSysVector<su2double> auxVec; /* !< \brief Auxiliar vectors for output and debugging */
6658 CSysVector<su2double> activeCoord; /* !< \brief Auxiliar vector to keep the indeces of geometry->vertex->Coord */
6759
6860 CSysVector<su2matvecscalar> helperVecIn; /* !< \brief Helper vectors for projection and matrix vector product (must be su2mixedfloat) */
6961 CSysVector<su2matvecscalar> helperVecOut; /* !< \brief Helper vectors for projection and matrix vector product (must be su2mixedfloat) */
70- CSysVector<su2matvecscalar> helperVecAux; /* !< \brief Helper vectors for matrix vector product if working on surface (smaller dim) */
71-
72- CVariable* nodes = nullptr ; /* !< \brief The highest level in the variable hierarchy this solver can safely use. */
62+ CSysVector<su2matvecscalar> helperVecAux; /* !< \brief Helper vectors for matrix vector product if working on surface (smaller dim) */
7363
7464 std::vector<su2double> deltaP; /* !< \brief The smoothed gradient with respect to the design variables. */
7565
7666 CSquareMatrixCM hessian; /* !< \brief The approximated Hessian with respect to the design variables. */
7767
78- /* --- Extra vertices for row/column elimination, see Set_VertexEliminationSchedule. ---*/
79- vector<unsigned long > ExtraVerticesToEliminate;
80-
81- /* !
82- * \brief Return nodes to allow CSolver::base_nodes to be set.
83- */
84- inline CVariable* GetBaseClassPointerToNodes () override { return nodes; }
85-
8668 public:
8769 /* !
8870 * \brief Constructor of the class.
@@ -244,26 +226,24 @@ class CGradientSmoothingSolver : public CSolver {
244226 /* !
245227 * \brief Write the content of sensitivity in the nodes to the sensitivity in the geometry
246228 * \param[in] geometry - Geometrical definition of the problem.
247- * \param[in] config - Definition of the particular problem.
248229 */
249- void WriteSens2Geometry (CGeometry* geometry, const CConfig* config) ;
230+ void WriteSensToGeometry (CGeometry* geometry) const override ;
250231
251232 /* !
252233 * \brief Read the sensitivity for the geometry into the nodes
253234 * \param[in] geometry - Geometrical definition of the problem.
254- * \param[in] config - Definition of the particular problem.
255235 */
256- void ReadSens2Geometry (CGeometry* geometry, const CConfig* config) ;
236+ void ReadSensFromGeometry ( const CGeometry *geometry) override ;
257237
258238 /* !
259239 * \brief Copy sensitivities from a vector into the geometry
260240 */
261- void WriteVector2Geometry (CGeometry* geometry, const CConfig* config, CSysVector<su2matvecscalar>& vector);
241+ void WriteVectorToGeometry (CGeometry* geometry, const CSysVector<su2matvecscalar>& vector) const ;
262242
263243 /* !
264244 * \brief Copy sensitivities from the geometry into a vector
265245 */
266- void ReadVector2Geometry (CGeometry* geometry, const CConfig* config , CSysVector<su2matvecscalar>& vector);
246+ void ReadVectorToGeometry ( const CGeometry* geometry , CSysVector<su2matvecscalar>& vector);
267247
268248 /* !
269249 * \brief Get the value of the reference coordinate to set on the element structure.
@@ -309,4 +289,14 @@ class CGradientSmoothingSolver : public CSolver {
309289 }
310290 }
311291
292+ private:
293+
294+ inline void SetCurrentDim (unsigned int iDim) {
295+ curDim=iDim;
296+ }
297+
298+ inline const unsigned int & GetCurrentDim () const {
299+ return curDim;
300+ }
301+
312302};
0 commit comments