Skip to content

Commit

Permalink
[Display.h/cpp] Give a namespace for the functions.
Browse files Browse the repository at this point in the history
  • Loading branch information
wenqing committed Feb 1, 2019
1 parent 176ad8f commit 93dcbb3
Show file tree
Hide file tree
Showing 26 changed files with 483 additions and 479 deletions.
3 changes: 3 additions & 0 deletions Base/display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
extern FILE* OpenMsgFile(void);
extern void CloseMsgFile(FILE*);

namespace Display
{
/**************************************************************************/
/* ROCKFLOW - Funktion: DisplayMsg
*/
Expand Down Expand Up @@ -181,3 +183,4 @@ void DisplayErrorMsg(const char* s)
fprintf(f, "\n!!!!!!!! %s\n\n ", s);
CloseMsgFile(f);
}
} // End of name space.
17 changes: 9 additions & 8 deletions Base/display.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,22 @@
#include <cstring>
//#include <ctype.h>

namespace Display
{
/*JT: Send output message*/
extern void ScreenMessage(const char *format , ... );
void ScreenMessage(const char *format , ... );
/* Gibt Programm-Abspann aus */
extern void DisplayMsg(const char* s);
void DisplayMsg(const char* s);
/* Schreibt Zeichenkette ohne Zeilenvorschub auf Standardausgabe */
extern void DisplayMsgLn(const char* s);
void DisplayMsgLn(const char* s);
/* Schreibt Zeichenkette mit Zeilenruecklauf auf Standardausgabe */
extern void DisplayDouble(double x, int i, int j);
void DisplayDouble(double x, int i, int j);
/* Schreibt Double-Wert ohne Zeilenvorschub auf Standardausgabe */
extern void DisplayLong(long x);
void DisplayLong(long x);
/* Schreibt Vektor auf Standardausgabe */
// OK411 extern void DisplayDoubleMatrix ( double *mat, long m, long n, char
// *text );
/* Schreibt Matrix auf Standardausgabe */
extern void DisplayErrorMsg(const char* s);
/* Schreibt Fehlermeldung auf Standardausgabe */
/* Schreibt Laufzeitmeldung auf Standardausgabe */
void DisplayErrorMsg(const char* s);
}
#endif
6 changes: 3 additions & 3 deletions FEM/DUMUX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ int CDUMUXData::WriteInputForDuMux(CRFProcess* m_pcs,
DOScommand = "rm " + Folder + "/dataForDumux.dat";

if (system(DOScommand.c_str()))
DisplayMsgLn("Could not delete input file! ");
Display::DisplayMsgLn("Could not delete input file! ");

// Read length of current timestep and recalculate it to days
if (m_pcs->Tim->time_unit == "DAY")
Expand Down Expand Up @@ -1467,7 +1467,7 @@ void CDUMUXData::ExecuteDuMux(CRFProcess* m_pcs, string folder)
cout << tempstring << "\n";
if (system(tempstring.c_str()))
{
DisplayMsgLn("Warnung: DuMux doesn't run properly!!! ");
Display::DisplayMsgLn("Warnung: DuMux doesn't run properly!!! ");
exit(0);
}
}
Expand Down Expand Up @@ -1550,7 +1550,7 @@ int CDUMUXData::RunDuMux(long Timestep, CRFProcess* m_pcs)
DOScommand = "rm " + folder + "dataForGeoSys*.dat";

if (system(DOScommand.c_str()))
DisplayMsgLn("Could not delete input file! ");
Display::DisplayMsgLn("Could not delete input file! ");
}

// check if dumux folder is subfolder of the geosys folder
Expand Down
28 changes: 14 additions & 14 deletions FEM/Eclipse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5448,7 +5448,7 @@ std::string CECLIPSEData::ExecuteEclipse(long Timestep, CRFProcess* m_pcs,
// tempstring << "\n";
if (system(tempstring.c_str()))
{
DisplayMsgLn("Warnung: Eclipse doesn't run properly!!! ");
Display::DisplayMsgLn("Warnung: Eclipse doesn't run properly!!! ");
return 0;
}
}
Expand All @@ -5461,7 +5461,7 @@ std::string CECLIPSEData::ExecuteEclipse(long Timestep, CRFProcess* m_pcs,
// tempstring = EclipseExe + " " + projectname;
if (system(tempstring.c_str()))
{
DisplayMsgLn("Warnung: Eclipse doesn't run properly!!! ");
Display::DisplayMsgLn("Warnung: Eclipse doesn't run properly!!! ");
return 0;
}
}
Expand Down Expand Up @@ -5529,7 +5529,7 @@ std::string CECLIPSEData::ExecuteEclipse(long Timestep, CRFProcess* m_pcs,
// tempstring << "\n";
if (system(tempstring.c_str()))
{
DisplayMsgLn("Warnung: Eclipse doesn't run properly!!! ");
Display::DisplayMsgLn("Warnung: Eclipse doesn't run properly!!! ");
return 0;
}
}
Expand All @@ -5544,7 +5544,7 @@ std::string CECLIPSEData::ExecuteEclipse(long Timestep, CRFProcess* m_pcs,
// tempstring = EclipseExe + " " + projectname; //WTP
if (system(tempstring.c_str()))
{
DisplayMsgLn("Warnung: Eclipse doesn't run properly!!! ");
Display::DisplayMsgLn("Warnung: Eclipse doesn't run properly!!! ");
return 0;
}
}
Expand Down Expand Up @@ -5586,13 +5586,13 @@ bool CECLIPSEData::CleanUpEclipseFiles(std::string folder,
systemcommand = system_delete + folder + "TEMPORARYRESULTS.*";
if (system(systemcommand.c_str()))
{
DisplayMsgLn("Could not delete temporary result files! ");
Display::DisplayMsgLn("Could not delete temporary result files! ");
// SB why return return 0;
}

/* systemcommand = system_delete + projectname + ".FSAVE" + system_noquery;
if (system(systemcommand.c_str())){
// DisplayMsgLn("Could not delete result .FSAVE files! ");
// Display::DisplayMsgLn("Could not delete result .FSAVE files! ");
//SB ?? why return return 0;
} */

Expand Down Expand Up @@ -5623,52 +5623,52 @@ bool CECLIPSEData::CleanUpEclipseFiles(std::string folder,
}
if (system(systemcommand.c_str()))
{
DisplayMsgLn("Could not rename the temporary result files .F*! ");
Display::DisplayMsgLn("Could not rename the temporary result files .F*! ");
// return 0;
}
if (this->Windows_System == false)
{
systemcommand = "rm " + projectname + extension;
if (system(systemcommand.c_str()))
{
DisplayMsgLn(
Display::DisplayMsgLn(
"Could not delete the temporary result files basename.F*! ");
// return 0;
}
}
// systemcommand = system_delete + projectname + ".F*" + system_noquery;
// if (system(systemcommand.c_str())){
// DisplayMsgLn("Could not delete result files! ");
// Display::DisplayMsgLn("Could not delete result files! ");
// return 0;
//}
systemcommand = system_delete + projectname + ".A*" + system_noquery;
if (system(systemcommand.c_str()))
{
DisplayMsgLn("Could not delete result files .A*! ");
Display::DisplayMsgLn("Could not delete result files .A*! ");
// return 0;
}
systemcommand = system_delete + projectname + ".P*" + system_noquery;
if (system(systemcommand.c_str()))
{
DisplayMsgLn("Could not delete result files .P*! ");
Display::DisplayMsgLn("Could not delete result files .P*! ");
// return 0;
}
systemcommand = system_delete + projectname + ".R*" + system_noquery;
if (system(systemcommand.c_str()))
{
DisplayMsgLn("Could not delete result files .R*! ");
Display::DisplayMsgLn("Could not delete result files .R*! ");
// return 0;
}
systemcommand = system_delete + projectname + ".M*" + system_noquery;
if (system(systemcommand.c_str()))
{
DisplayMsgLn("Could not delete result files .M*! ");
Display::DisplayMsgLn("Could not delete result files .M*! ");
// return 0;
}
systemcommand = system_delete + projectname + ".DB*" + system_noquery;
if (system(systemcommand.c_str()))
{
DisplayMsgLn("Could not delete result files .DB*! ");
Display::DisplayMsgLn("Could not delete result files .DB*! ");
// return 0;
}

Expand Down
2 changes: 1 addition & 1 deletion FEM/Material/Solid/BGRaCreep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ void BGRaCreep::integrateStress(const double dt, const double T,

if (it == _max_iterations - 1)
{
ScreenMessage(
Display::ScreenMessage(
"The local Newton method did not converge within the given "
"number of iterations. Iteration: %d, residual norm: "
"%g",
Expand Down
4 changes: 2 additions & 2 deletions FEM/files0.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ int ReadData(const char* dateiname,
// Check line ending of input files
if (!checkFormatOfInputFiles(dateiname))
{
ScreenMessage("terminate this program");
Display::ScreenMessage("terminate this program");
exit(0);
}
//----------------------------------------------------------------------
Expand Down Expand Up @@ -340,7 +340,7 @@ void CloseMsgFile(FILE* f)
{
if (f != stdout)
if (fclose(f))
DisplayErrorMsg(
Display::DisplayErrorMsg(
"Fehler: Message-Protokolldatei konnte nicht geschlossen "
"werden !!");
}
Expand Down
20 changes: 10 additions & 10 deletions FEM/mathlib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -682,7 +682,7 @@ double* MMachVec(long g)
zwerg = (double*)Malloc(sizeof(double) * g);
#ifdef ERROR_CONTROL
if (zwerg == NULL)
DisplayErrorMsg("zuwenig Speicher in MMachVec");
Display::DisplayErrorMsg("zuwenig Speicher in MMachVec");
#endif
return zwerg;
} /* MMachVec */
Expand All @@ -708,7 +708,7 @@ void MNullVec(double* zwerg, long g)
zwerg = (double*)Malloc(sizeof(double) * g);
#ifdef ERROR_CONTROL
if (zwerg == NULL)
DisplayErrorMsg("Fehler in MNullVec");
Display::DisplayErrorMsg("Fehler in MNullVec");
#endif
#ifdef SX
#pragma cdir nodep
Expand Down Expand Up @@ -742,7 +742,7 @@ void MKopierVec(double* vecquelle, double* vecziel, long g)
register long i;
#ifdef ERROR_CONTROL
if ((vecquelle == NULL) || (vecziel == NULL))
DisplayErrorMsg("Fehler in MLoeschVec");
Display::DisplayErrorMsg("Fehler in MLoeschVec");
#endif
#ifdef SX
#pragma cdir nodep
Expand Down Expand Up @@ -861,10 +861,10 @@ int MMultVecVec(double* vec1, long gv1, double* vec2, long gv2, double* mato,
if (check_err)
{
if (gv1 != mo)
DisplayErrorMsg(
Display::DisplayErrorMsg(
"MMultVecVec: Groesse von Matrix und Vektor 1 passen nicht");
if (gv2 != no)
DisplayErrorMsg(
Display::DisplayErrorMsg(
"MMultVecVec: Groesse von Matrix und Vektor 2 passen nicht");
}

Expand Down Expand Up @@ -920,10 +920,10 @@ int MMultVecMat(double* vec, long gv, double* mat, long m, long n, double* veco,
if (check_err)
{
if (gv != m)
DisplayErrorMsg(
Display::DisplayErrorMsg(
"MMultVecMat: Groesse von Matrix und Vektor passen nicht");
if (go != n)
DisplayErrorMsg(
Display::DisplayErrorMsg(
"MMultVecMat: Groesse von Ergebnis-Vektor stimmt nicht");
}

Expand Down Expand Up @@ -982,10 +982,10 @@ int MMultMatVec(/* Matrix */
if (check_err)
{
if (g != n)
DisplayErrorMsg(
Display::DisplayErrorMsg(
"MMultMatVec: Groesse von Matrix und Vektor passen nicht");
if (r != m)
DisplayErrorMsg(
Display::DisplayErrorMsg(
"MMultMatVec: Groesse von Ergebnis-Vektor stimmt nicht");
}

Expand Down Expand Up @@ -1058,7 +1058,7 @@ int MMultMatMat(double* mat1, long m1, long n1, double* mat2, long m2, long n2,
#ifdef ERROR_CONTROL
if ((m1 != mo) || (n2 != no) || (n1 != m2))
{
DisplayErrorMsg("MMultMatMat:Die Matrizen passen nicht zueinander !");
Display::DisplayErrorMsg("MMultMatMat:Die Matrizen passen nicht zueinander !");
return 0;
}
#endif
Expand Down
Loading

0 comments on commit 93dcbb3

Please sign in to comment.