Skip to content

Commit 661d5fa

Browse files
authored
Merge pull request #993 from su2code/fix_const_members
Adds Missing Const Specifiers to Member Functions
2 parents 34d48d6 + 38803d8 commit 661d5fa

45 files changed

Lines changed: 391 additions & 391 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Common/include/CConfig.hpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1322,13 +1322,13 @@ class CConfig {
13221322
* \brief Print the header to screen
13231323
* \param val_software - Kind of software component
13241324
*/
1325-
void SetHeader(unsigned short val_software);
1325+
void SetHeader(unsigned short val_software) const;
13261326

13271327
/*!
13281328
* \brief Get the MPI communicator of SU2.
13291329
* \return MPI communicator of SU2.
13301330
*/
1331-
SU2_MPI::Comm GetMPICommunicator();
1331+
SU2_MPI::Comm GetMPICommunicator() const;
13321332

13331333
/*!
13341334
* \brief Set the MPI communicator for SU2.
@@ -3937,7 +3937,7 @@ class CConfig {
39373937
* \brief Get flag for whether a second gradient calculation is required for upwind reconstruction alone.
39383938
* \return <code>TRUE</code> means that a second gradient will be calculated for upwind reconstruction.
39393939
*/
3940-
bool GetReconstructionGradientRequired(void) { return ReconstructionGradientRequired; }
3940+
bool GetReconstructionGradientRequired(void) const { return ReconstructionGradientRequired; }
39413941

39423942
/*!
39433943
* \brief Get flag for whether a least-squares gradient method is being applied.
@@ -5403,13 +5403,13 @@ class CConfig {
54035403
* \brief Append the zone index to the restart or the solution files.
54045404
* \return Name of the restart file for the flow variables.
54055405
*/
5406-
string GetMultizone_FileName(string val_filename, int val_iZone, string ext);
5406+
string GetMultizone_FileName(string val_filename, int val_iZone, string ext) const;
54075407

54085408
/*!
54095409
* \brief Append the zone index to the restart or the solution files.
54105410
* \return Name of the restart file for the flow variables.
54115411
*/
5412-
string GetMultizone_HistoryFileName(string val_filename, int val_iZone, string ext);
5412+
string GetMultizone_HistoryFileName(string val_filename, int val_iZone, string ext) const;
54135413

54145414
/*!
54155415
* \brief Append the instance index to the restart or the solution files.
@@ -5483,7 +5483,7 @@ class CConfig {
54835483
* \param[in] val_iter - Unsteady iteration number or time instance.
54845484
* \return Name of the file with the iteration number for an unsteady solution file.
54855485
*/
5486-
string GetUnsteady_FileName(string val_filename, int val_iter, string ext);
5486+
string GetUnsteady_FileName(string val_filename, int val_iter, string ext) const;
54875487

54885488
/*!
54895489
* \brief Append the input filename string with the appropriate objective function extension.
@@ -5688,7 +5688,7 @@ class CConfig {
56885688
* \param[in] val - new value of the origin
56895689
* \return The mesh motion origin.
56905690
*/
5691-
void SetMotion_Origin(su2double* val) { for (int iDim = 0; iDim < 3; iDim++) Motion_Origin[iDim] = val[iDim]; }
5691+
void SetMotion_Origin(const su2double* val) { for (int iDim = 0; iDim < 3; iDim++) Motion_Origin[iDim] = val[iDim]; }
56925692

56935693
/*!
56945694
* \brief Get the mesh motion origin.
@@ -5703,7 +5703,7 @@ class CConfig {
57035703
* \param[in] val - new value of the origin
57045704
* \param[in] iMarkerMoving - Index of the moving marker (as specified in Marker_Moving)
57055705
*/
5706-
void SetMarkerMotion_Origin(su2double* val, unsigned short iMarkerMoving) {
5706+
void SetMarkerMotion_Origin(const su2double* val, unsigned short iMarkerMoving) {
57075707
for (int iDim = 0; iDim < 3; iDim++) MarkerMotion_Origin[3*iMarkerMoving + iDim] = val[iDim];
57085708
}
57095709

@@ -8338,7 +8338,7 @@ class CConfig {
83388338
* \brief Get the current number of non-physical reconstructions for 2nd-order upwinding.
83398339
* \return Current number of non-physical reconstructions for 2nd-order upwinding.
83408340
*/
8341-
unsigned long GetNonphysical_Reconstr(void) { return Nonphys_Reconstr; }
8341+
unsigned long GetNonphysical_Reconstr(void) const { return Nonphys_Reconstr; }
83428342

83438343
/*!
83448344
* \brief Given arrays x[1..n] and y[1..n] containing a tabulated function, i.e., yi = f(xi), with
@@ -8401,7 +8401,7 @@ class CConfig {
84018401
*
84028402
* \brief Set freestream turbonormal for initializing solution.
84038403
*/
8404-
void SetFreeStreamTurboNormal(su2double* turboNormal);
8404+
void SetFreeStreamTurboNormal(const su2double* turboNormal);
84058405

84068406
/*!
84078407
*

Common/include/fem_gauss_jacobi_quadrature.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,15 +175,15 @@ class CGaussJacobiQuadrature {
175175
* \brief Function in the original implementation of John Burkardt to compute
176176
the integration points of the Gauss-Jacobi quadrature rule.
177177
*/
178-
void scqf(int nt, passivedouble t[], int mlt[], passivedouble wts[], int nwts, int ndx[],
178+
void scqf(int nt, const passivedouble t[], const int mlt[], const passivedouble wts[], int nwts, int ndx[],
179179
passivedouble swts[], passivedouble st[], int kind, passivedouble alpha,
180180
passivedouble beta, passivedouble a, passivedouble b);
181181

182182
/*!
183183
* \brief Function in the original implementation of John Burkardt to compute
184184
the integration points of the Gauss-Jacobi quadrature rule.
185185
*/
186-
void sgqf(int nt, passivedouble aj[], passivedouble bj[], passivedouble zemu, passivedouble t[],
186+
void sgqf(int nt, const passivedouble aj[], passivedouble bj[], passivedouble zemu, passivedouble t[],
187187
passivedouble wts[]);
188188
};
189189

Common/include/fem_geometry_structure.hpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,26 +109,26 @@ class CReorderElements {
109109
* \brief Function to make available the variable commSolution.
110110
* \return Whether or not the solution of the element must be communicated.
111111
*/
112-
bool GetCommSolution(void);
112+
bool GetCommSolution(void) const;
113113

114114
/*!
115115
* \brief Function to make available the element type of the element.
116116
* \return The value of elemType, which stores the VTK type, polynomial degree
117117
and whether or not the Jacobian is constant.
118118
*/
119-
unsigned short GetElemType(void);
119+
unsigned short GetElemType(void) const;
120120

121121
/*!
122122
* \brief Function to make available the global element ID.
123123
* \return The global element ID of the element.
124124
*/
125-
unsigned long GetGlobalElemID(void);
125+
unsigned long GetGlobalElemID(void) const;
126126

127127
/*!
128128
* \brief Function to make available the time level.
129129
* \return The time level of the element.
130130
*/
131-
unsigned short GetTimeLevel(void);
131+
unsigned short GetTimeLevel(void) const;
132132

133133
/*!
134134
* \brief Function, which sets the value of commSolution.
@@ -675,13 +675,13 @@ class CMeshFEM: public CGeometry {
675675
* \brief Function, which makes available the number of owned volume elements in the local FEM mesh.
676676
* \return Number of owned volume elements of the local FEM mesh.
677677
*/
678-
unsigned long GetNVolElemOwned(void);
678+
unsigned long GetNVolElemOwned(void) const;
679679

680680
/*!
681681
* \brief Function, which makes available the total number of volume elements in the local FEM mesh.
682682
* \return Total number of volume elements of the local FEM mesh.
683683
*/
684-
unsigned long GetNVolElemTot(void);
684+
unsigned long GetNVolElemTot(void) const;
685685

686686
/*!
687687
* \brief Function, which makes available the volume elements in the local FEM mesh.

Common/include/fem_geometry_structure.inl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,13 @@ inline CReorderElements::CReorderElements(const CReorderElements &other) { Copy(
4343

4444
inline CReorderElements& CReorderElements::operator=(const CReorderElements &other) { Copy(other); return (*this); }
4545

46-
inline bool CReorderElements::GetCommSolution(void) { return commSolution; }
46+
inline bool CReorderElements::GetCommSolution(void) const { return commSolution; }
4747

48-
inline unsigned short CReorderElements::GetElemType(void) { return elemType; }
48+
inline unsigned short CReorderElements::GetElemType(void) const { return elemType; }
4949

50-
inline unsigned long CReorderElements::GetGlobalElemID(void) { return globalElemID; }
50+
inline unsigned long CReorderElements::GetGlobalElemID(void) const { return globalElemID; }
5151

52-
inline unsigned short CReorderElements::GetTimeLevel(void) { return timeLevel; }
52+
inline unsigned short CReorderElements::GetTimeLevel(void) const { return timeLevel; }
5353

5454
inline void CReorderElements::SetCommSolution(const bool val_CommSolution) { commSolution = val_CommSolution; }
5555

@@ -108,9 +108,9 @@ inline CPointFEM* CMeshFEM::GetMeshPoints(void) {return meshPoints.data();}
108108

109109
inline unsigned long CMeshFEM::GetNMeshPoints(void) {return meshPoints.size();}
110110

111-
inline unsigned long CMeshFEM::GetNVolElemOwned(void) {return nVolElemOwned;}
111+
inline unsigned long CMeshFEM::GetNVolElemOwned(void) const {return nVolElemOwned;}
112112

113-
inline unsigned long CMeshFEM::GetNVolElemTot(void) {return nVolElemTot;}
113+
inline unsigned long CMeshFEM::GetNVolElemTot(void) const {return nVolElemTot;}
114114

115115
inline CVolumeElementFEM* CMeshFEM::GetVolElem(void) {return volElem.data();}
116116

Common/include/fem_standard_element.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ class CFEMStandardElementBase {
119119
* \brief Function, which makes available the polynomial order that must be integrated exactly.
120120
* \return The polynomial order that must be integrated exactly.
121121
*/
122-
unsigned short GetOrderExact(void);
122+
unsigned short GetOrderExact(void) const;
123123

124124
/*!
125125
* \brief Static function, which computes the inverse of the given square matrix.
@@ -698,7 +698,7 @@ class CFEMStandardElementBase {
698698
* \return The value of the viscous penalty parameter.
699699
*/
700700
su2double ViscousPenaltyParameter(const unsigned short VTK_TypeElem,
701-
const unsigned short nPolyElem);
701+
const unsigned short nPolyElem) const;
702702
private:
703703
/*!
704704
* \brief Function, which determines the 1D Gauss Legendre integration points and weights.
@@ -1127,7 +1127,7 @@ class CFEMStandardElement : public CFEMStandardElementBase {
11271127
unsigned short vert0,
11281128
unsigned short vert1,
11291129
unsigned short vert2,
1130-
unsigned short vert3);
1130+
unsigned short vert3) const;
11311131

11321132
/*!
11331133
* \brief Function, which changes the given triangular connectivity, such that the direction coincides
@@ -1140,7 +1140,7 @@ class CFEMStandardElement : public CFEMStandardElementBase {
11401140
void ChangeDirectionTriangleConn(vector<unsigned short> &connTriangle,
11411141
unsigned short vert0,
11421142
unsigned short vert1,
1143-
unsigned short vert2);
1143+
unsigned short vert2) const;
11441144

11451145
/*!
11461146
* \brief Function, which copies the data of the given object into the current object.

Common/include/fem_standard_element.inl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ inline const su2double* CFEMStandardElementBase::GetWeightsIntegration(void) con
3737

3838
inline unsigned short CFEMStandardElementBase::GetNIntegration(void) const {return nIntegration;}
3939

40-
inline unsigned short CFEMStandardElementBase::GetOrderExact(void){return orderExact;}
40+
inline unsigned short CFEMStandardElementBase::GetOrderExact(void) const{return orderExact;}
4141

4242
inline CFEMStandardElement::CFEMStandardElement(){}
4343

Common/include/geometry/CGeometry.hpp

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ class CGeometry {
295295
* \param[in] commType - Enumerated type for the quantity to be communicated.
296296
* \param[in] val_reverse - Boolean controlling forward or reverse communication between neighbors.
297297
*/
298-
void PostP2PRecvs(CGeometry *geometry, CConfig *config, unsigned short commType, bool val_reverse);
298+
void PostP2PRecvs(CGeometry *geometry, CConfig *config, unsigned short commType, bool val_reverse) const;
299299

300300
/*!
301301
* \brief Routine to launch a single non-blocking send once the buffer is loaded for a point-to-point commucation.
@@ -306,7 +306,7 @@ class CGeometry {
306306
* \param[in] val_iMessage - Index of the message in the order they are stored.
307307
* \param[in] val_reverse - Boolean controlling forward or reverse communication between neighbors.
308308
*/
309-
void PostP2PSends(CGeometry *geometry, CConfig *config, unsigned short commType, int val_iMessage, bool val_reverse);
309+
void PostP2PSends(CGeometry *geometry, CConfig *config, unsigned short commType, int val_iMessage, bool val_reverse) const;
310310

311311
/*!
312312
* \brief Routine to set up persistent data structures for periodic communications.
@@ -338,7 +338,7 @@ class CGeometry {
338338
* \param[in] commType - Enumerated type for the quantity to be communicated.
339339
* \param[in] val_iMessage - Index of the message in the order they are stored.
340340
*/
341-
void PostPeriodicSends(CGeometry *geometry, CConfig *config, unsigned short commType, int val_iMessage);
341+
void PostPeriodicSends(CGeometry *geometry, CConfig *config, unsigned short commType, int val_iMessage) const;
342342

343343
/*!
344344
* \brief Routine to load a geometric quantity into the data structures for MPI point-to-point communication and to
@@ -347,7 +347,7 @@ class CGeometry {
347347
* \param[in] config - Definition of the particular problem.
348348
* \param[in] commType - Enumerated type for the quantity to be communicated.
349349
*/
350-
void InitiateComms(CGeometry *geometry, CConfig *config, unsigned short commType);
350+
void InitiateComms(CGeometry *geometry, CConfig *config, unsigned short commType) const;
351351

352352
/*!
353353
* \brief Routine to complete the set of non-blocking communications launched by InitiateComms() and unpacking of the data into the geometry class.
@@ -473,15 +473,15 @@ class CGeometry {
473473
* \param[in] second_point - Second point of the edge.
474474
* \return Index of the edge.
475475
*/
476-
long FindEdge(unsigned long first_point, unsigned long second_point);
476+
long FindEdge(unsigned long first_point, unsigned long second_point) const;
477477

478478
/*!
479479
* \brief Get the edge index from using the nodes of the edge.
480480
* \param[in] first_point - First point of the edge.
481481
* \param[in] second_point - Second point of the edge.
482482
* \return Index of the edge.
483483
*/
484-
bool CheckEdge(unsigned long first_point, unsigned long second_point);
484+
bool CheckEdge(unsigned long first_point, unsigned long second_point) const;
485485

486486
/*!
487487
* \brief Get the distance between a plane (defined by three point) and a point.
@@ -491,12 +491,12 @@ class CGeometry {
491491
* \param[in] kCoord - Coordinates of the third point that defines the plane.
492492
* \return Signed distance.
493493
*/
494-
su2double Point2Plane_Distance(su2double *Coord, su2double *iCoord, su2double *jCoord, su2double *kCoord);
494+
su2double Point2Plane_Distance(const su2double *Coord, const su2double *iCoord, const su2double *jCoord, const su2double *kCoord);
495495

496496
/*!
497497
* \brief Create a file for testing the geometry.
498498
*/
499-
void TestGeometry(void);
499+
void TestGeometry(void) const;
500500

501501
/*!
502502
* \brief A virtual member.
@@ -919,7 +919,7 @@ class CGeometry {
919919
su2double MinXCoord, su2double MaxXCoord,
920920
su2double MinYCoord, su2double MaxYCoord,
921921
su2double MinZCoord, su2double MaxZCoord,
922-
su2double *FlowVariable,
922+
const su2double *FlowVariable,
923923
vector<su2double> &Xcoord_Airfoil, vector<su2double> &Ycoord_Airfoil,
924924
vector<su2double> &Zcoord_Airfoil, vector<su2double> &Variable_Airfoil,
925925
bool original_surface, CConfig *config);
@@ -1219,38 +1219,38 @@ class CGeometry {
12191219
* \param[in] Intersection - Definition of the particular problem.
12201220
* \return If the intersection has has been successful.
12211221
*/
1222-
bool SegmentIntersectsPlane(su2double *Segment_P0, su2double *Segment_P1, su2double Variable_P0, su2double Variable_P1,
1223-
su2double *Plane_P0, su2double *Plane_Normal, su2double *Intersection, su2double &Variable_Interp);
1222+
bool SegmentIntersectsPlane(const su2double *Segment_P0, const su2double *Segment_P1, su2double Variable_P0, su2double Variable_P1,
1223+
const su2double *Plane_P0, const su2double *Plane_Normal, su2double *Intersection, su2double &Variable_Interp);
12241224

12251225
/*!
12261226
* \brief Ray Intersects Triangle (Moller and Trumbore algorithm)
12271227
*/
1228-
bool RayIntersectsTriangle(su2double orig[3], su2double dir[3],
1229-
su2double vert0[3], su2double vert1[3], su2double vert2[3],
1228+
bool RayIntersectsTriangle(const su2double orig[3], const su2double dir[3],
1229+
const su2double vert0[3], const su2double vert1[3], const su2double vert2[3],
12301230
su2double *intersect);
12311231

12321232
/*!
12331233
* \brief Segment Intersects Triangle
12341234
*/
1235-
bool SegmentIntersectsTriangle(su2double point0[3], su2double point1[3],
1235+
bool SegmentIntersectsTriangle(su2double point0[3], const su2double point1[3],
12361236
su2double vert0[3], su2double vert1[3], su2double vert2[3]);
12371237

12381238
/*!
12391239
* \brief Segment Intersects Line (for 2D FFD Intersection)
12401240
*/
1241-
bool SegmentIntersectsLine(su2double point0[2], su2double point1[2], su2double vert0[2], su2double vert1[2]);
1241+
bool SegmentIntersectsLine(const su2double point0[2], const su2double point1[2], const su2double vert0[2], const su2double vert1[2]);
12421242

12431243
/*!
12441244
* \brief Register the coordinates of the mesh nodes.
12451245
* \param[in] config
12461246
*/
1247-
void RegisterCoordinates(CConfig *config);
1247+
void RegisterCoordinates(CConfig *config) const;
12481248

12491249
/*!
12501250
* \brief Register the coordinates of the mesh nodes as output.
12511251
* \param[in] config
12521252
*/
1253-
void RegisterOutput_Coordinates(CConfig *config);
1253+
void RegisterOutput_Coordinates(CConfig *config) const;
12541254

12551255
/*!
12561256
* \brief Update the multi-grid structure and the wall-distance.

Common/include/geometry/CPhysicalGeometry.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,10 +232,10 @@ class CPhysicalGeometry final : public CGeometry {
232232
* \param[in] countPerElem - Pieces of data per element communicated.
233233
*/
234234
void InitiateCommsAll(void *bufSend,
235-
int *nElemSend,
235+
const int *nElemSend,
236236
SU2_MPI::Request *sendReq,
237237
void *bufRecv,
238-
int *nElemRecv,
238+
const int *nElemRecv,
239239
SU2_MPI::Request *recvReq,
240240
unsigned short countPerElem,
241241
unsigned short commType);

Common/include/geometry/meshreader/CCGNSMeshReaderFVM.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,10 @@ class CCGNSMeshReaderFVM: public CMeshReaderFVM {
126126
* \param[in] countPerElem - Pieces of data per element communicated.
127127
*/
128128
void InitiateCommsAll(void *bufSend,
129-
int *nElemSend,
129+
const int *nElemSend,
130130
SU2_MPI::Request *sendReq,
131131
void *bufRecv,
132-
int *nElemRecv,
132+
const int *nElemRecv,
133133
SU2_MPI::Request *recvReq,
134134
unsigned short countPerElem,
135135
unsigned short commType);

0 commit comments

Comments
 (0)