Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 9 additions & 22 deletions Common/include/CConfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,6 @@ class CConfig {
unsigned long OuterIter; /*!< \brief Current Outer iterations for multizone problems. */
unsigned long InnerIter; /*!< \brief Current inner iterations for multizone problems. */
unsigned long TimeIter; /*!< \brief Current time iterations for multizone problems. */
unsigned long Unst_nIntIter; /*!< \brief Number of internal iterations (Dual time Method). */
long Unst_RestartIter; /*!< \brief Iteration number to restart an unsteady simulation (Dual time Method). */
long Unst_AdjointIter; /*!< \brief Iteration number to begin the reverse time integration in the direct solver for the unsteady adjoint. */
long Iter_Avg_Objective; /*!< \brief Iteration the number of time steps to be averaged, counting from the back */
Expand Down Expand Up @@ -729,7 +728,6 @@ class CConfig {
RefElemLength, /*!< \brief Reference element length for computing the slope limiting epsilon. */
RefSharpEdges, /*!< \brief Reference coefficient for detecting sharp edges. */
RefLength, /*!< \brief Reference length for moment computation. */
*RefOriginMoment, /*!< \brief Origin for moment computation. */
*RefOriginMoment_X, /*!< \brief X Origin for moment computation. */
*RefOriginMoment_Y, /*!< \brief Y Origin for moment computation. */
*RefOriginMoment_Z, /*!< \brief Z Origin for moment computation. */
Expand Down Expand Up @@ -1370,7 +1368,8 @@ class CConfig {
* \param[in] val_marker - the marker we are monitoring.
* \return Reference origin (in cartesians coordinates) for moment computation.
*/
su2double *GetRefOriginMoment(unsigned short val_marker) {
std::array<su2double,3> GetRefOriginMoment(unsigned short val_marker) const {
std::array<su2double,3> RefOriginMoment{{0.0}};
if(val_marker < nMarker_Monitoring) {
RefOriginMoment[0] = RefOriginMoment_X[val_marker];
RefOriginMoment[1] = RefOriginMoment_Y[val_marker];
Expand Down Expand Up @@ -2937,12 +2936,6 @@ class CConfig {
*/
void SetnMarker_All(unsigned short val_nmarker) { nMarker_All = val_nmarker; }

/*!
* \brief Get the number of internal iterations.
* \return Number of internal iterations.
*/
unsigned long GetUnst_nIntIter(void) const { return Unst_nIntIter; }

/*!
* \brief Get the starting direct iteration number for the unsteady adjoint (reverse time integration).
* \return Starting direct iteration number for the unsteady adjoint.
Expand Down Expand Up @@ -5388,20 +5381,14 @@ class CConfig {
*/
string GetVolume_FileName(void) const { return Volume_FileName; }

/*!
* \brief Get the name of the restart file for the heat variables.
* \return Name of the restart file for the flow variables.
*/
string GetRestart_HeatFileName(void);

/*!
* \brief Add any numbers necessary to the filename (iteration number, zone ID ...)
* \param[in] config - Definition of the particular problem.
* \param[in] filename - the base filename.
* \param[in] ext - the extension to be added.
* \return The new filename
*/
string GetFilename(string filename, string ext, unsigned long Iter);
string GetFilename(string filename, string ext, unsigned long Iter) const;

/*!
* \brief Append the zone index to the restart or the solution files.
Expand All @@ -5419,13 +5406,13 @@ class CConfig {
* \brief Append the instance index to the restart or the solution files.
* \return Name of the restart file for the flow variables.
*/
string GetMultiInstance_FileName(string val_filename, int val_iInst, string ext);
string GetMultiInstance_FileName(string val_filename, int val_iInst, string ext) const;

/*!
* \brief Append the instance index to the restart or the solution files.
* \return Name of the restart file for the flow variables.
*/
string GetMultiInstance_HistoryFileName(string val_filename, int val_iInst);
string GetMultiInstance_HistoryFileName(string val_filename, int val_iInst) const;

/*!
* \brief Get the name of the restart file for the flow variables.
Expand Down Expand Up @@ -5494,7 +5481,7 @@ class CConfig {
* \param[in] val_filename - String value of the base filename.
* \return Name of the file with the appropriate objective function extension.
*/
string GetObjFunc_Extension(string val_filename);
string GetObjFunc_Extension(string val_filename) const;

/*!
* \brief Get the criteria for structural residual (relative/absolute).
Expand Down Expand Up @@ -6566,7 +6553,7 @@ class CConfig {
* \param[in] val_index - Index corresponding to the inlet boundary.
* \return The flow direction vector.
*/
su2double* GetInlet_FlowDir(string val_index);
const su2double* GetInlet_FlowDir(string val_index) const;

/*!
* \brief Get the back pressure (static) at an outlet boundary.
Expand Down Expand Up @@ -8367,14 +8354,14 @@ class CConfig {
* \brief Start the timer for profiling subroutines.
* \param[in] val_start_time - the value of the start time.
*/
void GEMM_Tick(double *val_start_time);
void GEMM_Tick(double *val_start_time) const;

/*!
* \brief Stop the timer for the GEMM profiling and store results.
* \param[in] val_start_time - The value of the start time.
* \param[in] M, N, K - Matrix size of the GEMM call.
*/
void GEMM_Tock(double val_start_time, int M, int N, int K);
void GEMM_Tock(double val_start_time, int M, int N, int K) const;

/*!
* \brief Write a CSV file containing the results of the profiling.
Expand Down
6 changes: 3 additions & 3 deletions Common/include/blas_structure.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@

#pragma once

#include "CConfig.hpp"

/* LIBXSMM include files, if supported. */
#ifdef HAVE_LIBXSMM
#include "libxsmm.h"
#endif

class CConfig;

/*!
* \class CBlasStructure
* \brief Class, which serves as an interface to the BLAS functionalities needed.
Expand Down Expand Up @@ -66,7 +66,7 @@ class CBlasStructure {
*/
void gemm(const int M, const int N, const int K,
const su2double *A, const su2double *B, su2double *C,
CConfig *config);
const CConfig *config);

/*!
* \brief Function, which carries out a dense matrix vector product
Expand Down
1 change: 1 addition & 0 deletions Common/include/omp_structure.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
#pragma once

#include <type_traits>
#include <cstdlib>

#if defined(_MSC_VER)
#define PRAGMIZE(X) __pragma(X)
Expand Down
2 changes: 2 additions & 0 deletions Common/include/toolboxes/geometry_toolbox.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@

#pragma once

#include <cmath>

namespace GeometryToolbox {

/*! \return ||a-b||^2 */
Expand Down
70 changes: 32 additions & 38 deletions Common/src/CConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -911,7 +911,6 @@ void CConfig::SetPointersNull(void) {
Velocity_FreeStream = nullptr;
Inc_Velocity_Init = nullptr;

RefOriginMoment = nullptr;
CFL_AdaptParam = nullptr;
CFL = nullptr;
HTP_Axis = nullptr;
Expand Down Expand Up @@ -3856,10 +3855,6 @@ void CConfig::SetPostprocessing(unsigned short val_software, unsigned short val_
}*/


/*--- Initialize the RefOriginMoment Pointer ---*/

RefOriginMoment = new su2double[3]();

/*--- In case the moment origin coordinates have not been declared in the
config file, set them equal to zero for safety. Also check to make sure
that for each marker, a value has been declared for the moment origin.
Expand Down Expand Up @@ -6216,28 +6211,28 @@ void CConfig::SetOutput(unsigned short val_software, unsigned short val_izone) {
case TIME_STEPPING:
cout << "Unsteady simulation using a time stepping strategy."<< endl;
if (Unst_CFL != 0.0) {
cout << "Time step computed by the code. Unsteady CFL number: " << Unst_CFL <<"."<< endl;
if (Delta_UnstTime != 0.0) {
cout << "Synchronization time provided by the user (s): "<< Delta_UnstTime << "." << endl;
}
}
cout << "Time step computed by the code. Unsteady CFL number: " << Unst_CFL <<"."<< endl;
if (Delta_UnstTime != 0.0) {
cout << "Synchronization time provided by the user (s): "<< Delta_UnstTime << "." << endl;
}
}
else cout << "Unsteady time step provided by the user (s): "<< Delta_UnstTime << "." << endl;
break;
case DT_STEPPING_1ST: case DT_STEPPING_2ND:
if (TimeMarching == DT_STEPPING_1ST) cout << "Unsteady simulation, dual time stepping strategy (first order in time)."<< endl;
if (TimeMarching == DT_STEPPING_2ND) cout << "Unsteady simulation, dual time stepping strategy (second order in time)."<< endl;
if (Unst_CFL != 0.0) cout << "Time step computed by the code. Unsteady CFL number: " << Unst_CFL <<"."<< endl;
else cout << "Unsteady time step provided by the user (s): "<< Delta_UnstTime << "." << endl;
cout << "Total number of internal Dual Time iterations: "<< Unst_nIntIter <<"." << endl;
cout << "Total number of internal Dual Time iterations: "<< InnerIter <<"." << endl;
break;
}
}
else {
if (Time_Domain) {
cout << "Dynamic structural analysis."<< endl;
cout << "Time step provided by the user for the dynamic analysis(s): "<< Delta_DynTime << "." << endl;
} else {
cout << "Static structural analysis." << endl;
cout << "Dynamic structural analysis."<< endl;
cout << "Time step provided by the user for the dynamic analysis(s): "<< Delta_DynTime << "." << endl;
} else {
cout << "Static structural analysis." << endl;
}
}

Expand Down Expand Up @@ -7296,7 +7291,6 @@ CConfig::~CConfig(void) {

/*--- reference origin for moments ---*/

delete [] RefOriginMoment;
delete [] RefOriginMoment_X;
delete [] RefOriginMoment_Y;
delete [] RefOriginMoment_Z;
Expand Down Expand Up @@ -7667,7 +7661,7 @@ CConfig::~CConfig(void) {

}

string CConfig::GetFilename(string filename, string ext, unsigned long Iter){
string CConfig::GetFilename(string filename, string ext, unsigned long Iter) const {

/*--- Remove any extension --- */

Expand Down Expand Up @@ -7755,33 +7749,33 @@ string CConfig::GetMultizone_HistoryFileName(string val_filename, int val_iZone,
return multizone_filename;
}

string CConfig::GetMultiInstance_FileName(string val_filename, int val_iInst, string ext) {
string CConfig::GetMultiInstance_FileName(string val_filename, int val_iInst, string ext) const {

string multizone_filename = val_filename;
char buffer[50];
string multizone_filename = val_filename;
char buffer[50];

unsigned short lastindex = multizone_filename.find_last_of(".");
multizone_filename = multizone_filename.substr(0, lastindex);
SPRINTF (buffer, "_%d", SU2_TYPE::Int(val_iInst));
multizone_filename.append(string(buffer));
multizone_filename += ext;
return multizone_filename;
unsigned short lastindex = multizone_filename.find_last_of(".");
multizone_filename = multizone_filename.substr(0, lastindex);
SPRINTF (buffer, "_%d", SU2_TYPE::Int(val_iInst));
multizone_filename.append(string(buffer));
multizone_filename += ext;
return multizone_filename;
}

string CConfig::GetMultiInstance_HistoryFileName(string val_filename, int val_iInst) {
string CConfig::GetMultiInstance_HistoryFileName(string val_filename, int val_iInst) const {

string multizone_filename = val_filename;
char buffer[50];
string multizone_filename = val_filename;
char buffer[50];

unsigned short lastindex = multizone_filename.find_last_of(".");
multizone_filename = multizone_filename.substr(0, lastindex);
SPRINTF (buffer, "_%d", SU2_TYPE::Int(val_iInst));
multizone_filename.append(string(buffer));
unsigned short lastindex = multizone_filename.find_last_of(".");
multizone_filename = multizone_filename.substr(0, lastindex);
SPRINTF (buffer, "_%d", SU2_TYPE::Int(val_iInst));
multizone_filename.append(string(buffer));

return multizone_filename;
return multizone_filename;
}

string CConfig::GetObjFunc_Extension(string val_filename) {
string CConfig::GetObjFunc_Extension(string val_filename) const {

string AdjExt, Filename = val_filename;

Expand Down Expand Up @@ -8359,7 +8353,7 @@ void CConfig::SetInlet_Ptotal(su2double val_pressure, string val_marker) {
Inlet_Ptotal[iMarker_Inlet] = val_pressure;
}

su2double* CConfig::GetInlet_FlowDir(string val_marker) {
const su2double* CConfig::GetInlet_FlowDir(string val_marker) const {
unsigned short iMarker_Inlet;
for (iMarker_Inlet = 0; iMarker_Inlet < nMarker_Inlet; iMarker_Inlet++)
if (Marker_Inlet[iMarker_Inlet] == val_marker) break;
Expand Down Expand Up @@ -9263,7 +9257,7 @@ void CConfig::SetProfilingCSV(void) {

}

void CConfig::GEMM_Tick(double *val_start_time) {
void CConfig::GEMM_Tick(double *val_start_time) const {

#ifdef PROFILE

Expand All @@ -9277,7 +9271,7 @@ void CConfig::GEMM_Tick(double *val_start_time) {

}

void CConfig::GEMM_Tock(double val_start_time, int M, int N, int K) {
void CConfig::GEMM_Tock(double val_start_time, int M, int N, int K) const {

#ifdef PROFILE

Expand Down
9 changes: 5 additions & 4 deletions Common/src/blas_structure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*
* SU2 Project Website: https://su2code.github.io
*
* The SU2 Project is maintained by the SU2 Foundation
* The SU2 Project is maintained by the SU2 Foundation
* (http://su2foundation.org)
*
* Copyright 2012-2020, SU2 Contributors (cf. AUTHORS.md)
Expand All @@ -26,6 +26,7 @@
* License along with SU2. If not, see <http://www.gnu.org/licenses/>.
*/

#include "../include/CConfig.hpp"
#include "../include/blas_structure.hpp"
#include <cstring>

Expand All @@ -46,7 +47,7 @@ extern "C" void dgemv_(char*, const int*, const int*, const passivedouble*,
/* Constructor. Initialize the const member variables, if needed. */
CBlasStructure::CBlasStructure(void)
#if !(defined(HAVE_LIBXSMM) || defined(HAVE_BLAS) || defined(HAVE_MKL)) || (defined(CODI_REVERSE_TYPE) || defined(CODI_FORWARD_TYPE))
: mc (256), kc (128), nc (128)
: mc (256), kc (128), nc (128)
#endif
{}

Expand All @@ -56,7 +57,7 @@ CBlasStructure::~CBlasStructure(void) {}
/* Dense matrix multiplication, gemm functionality. */
void CBlasStructure::gemm(const int M, const int N, const int K,
const su2double *A, const su2double *B, su2double *C,
CConfig *config) {
const CConfig *config) {

/* Initialize the variable for the timing, if profiling is active. */
#ifdef PROFILE
Expand Down Expand Up @@ -124,7 +125,7 @@ void CBlasStructure::gemv(const int M, const int N, const su2double *A,

/* Native implementation of the matix vector product.
Initialize the elements of y to zero. */
memset(y, 0, M*sizeof(su2double));
memset(y, 0, M*sizeof(su2double));

/* Carry out the matrix vector product. */
for(int k=0; k<M; ++k) {
Expand Down
8 changes: 4 additions & 4 deletions SU2_CFD/include/solvers/CAdjEulerSolver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ class CAdjEulerSolver : public CSolver {
* \param[in] geometry - Geometrical definition of the problem.
* \param[in] config - Definition of the particular problem.
*/
void Set_MPI_Nearfield(CGeometry *geometry, CConfig *config) final;
void Set_MPI_Nearfield(CGeometry *geometry, CConfig *config);

/*!
* \brief Parallelization of Undivided Laplacian.
Expand Down Expand Up @@ -236,7 +236,7 @@ class CAdjEulerSolver : public CSolver {
* \param[in] val_vertex - Vertex of the marker <i>val_marker</i> where the coefficient is evaluated.
* \return Value of the pressure coefficient.
*/
inline su2double *GetDonorAdjVar(unsigned short val_marker, unsigned long val_vertex) const final {
inline su2double *GetDonorAdjVar(unsigned short val_marker, unsigned long val_vertex) const {
return DonorAdjVar[val_marker][val_vertex];
}

Expand All @@ -249,7 +249,7 @@ class CAdjEulerSolver : public CSolver {
inline void SetDonorAdjVar(unsigned short val_marker,
unsigned long val_vertex,
unsigned short val_var,
su2double val_value) final {
su2double val_value) {
DonorAdjVar[val_marker][val_vertex][val_var] = val_value;
}

Expand All @@ -261,7 +261,7 @@ class CAdjEulerSolver : public CSolver {
*/
inline su2double GetDonorAdjVar(unsigned short val_marker,
unsigned long val_vertex,
unsigned short val_var) const final {
unsigned short val_var) const {
return DonorAdjVar[val_marker][val_vertex][val_var];
}

Expand Down
2 changes: 1 addition & 1 deletion SU2_CFD/include/solvers/CBaselineSolver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,4 @@ class CBaselineSolver final : public CSolver {
*/
void SetOutputVariables(CGeometry *geometry, CConfig *config);

};
};
Loading