|
CoastalME (Coastal Modelling Environment)
Simulates the long-term behaviour of complex coastlines
|
Globally-available utility routines. More...
Go to the source code of this file.
Data Structures | |
| class | istringstream |
| STL class. More... | |
Functions | |
| double | dRound (double const d) |
| Correctly rounds doubles. | |
| int | nRound (double const d) |
| Correctly rounds doubles, returns an int. | |
| bool | bIsStringValidDouble (string &str) |
| Checks to see if a string can be read as a valid double number. Does not find trailing (i.e.post-number) rubbish, but then neither does strtod(). From https://stackoverflow.com/questions/392981/how-can-i-convert-string-to-double-in-c. | |
| bool | bIsStringValidInt (string &str) |
| Checks to see if a string can be read as a valid integer, from https://stackoverflow.com/questions/2844817/how-do-i-check-if-a-c-string-is-an-int. | |
| ostream & | operator<< (ostream &ostr, const FillToWidth &args) |
| Operator that inserts a given fill character, to a given width, into an output stream. From http://stackoverflow.com/questions/2839592/equivalent-of-02d-with-stdstringstream. | |
| string | strDblRight (double const dX, int const nDigits, int const nWidth, bool const bShowDash) |
| Converts double to string with specified number of decimal places, within a field of given width, pads with blank spaces to enforce right alignment. Modified from https://stackoverflow.com/questions/14765155/how-can-i-easily-format-my-data-table-in-c. | |
| string | strIntRight (int const nX, int const nWidth) |
| Converts int to string within a field of given width, pads with blank spaces to enforce alignment.. From https://stackoverflow.com/questions/14765155/how-can-i-easily-format-my-data-table-in-c. | |
| string | strCentre (const char *pchIn, int const nWidth) |
| Centre-aligns char array within a field of given width, pads with blank spaces to enforce alignment. From https://stackoverflow.com/questions/14765155/how-can-i-easily-format-my-data-table-in-c. | |
| string | strCentre (const string &strIn, int const nWidth) |
| Centre-aligns string within a field of given width, pads with blank spaces to enforce alignment. From https://stackoverflow.com/questions/14765155/how-can-i-easily-format-my-data-table-in-c. | |
| string | strRight (const string &strIn, int const nWidth) |
| Right-aligns string within a field of given width, pads with blank spaces to enforce alignment. From https://stackoverflow.com/questions/14765155/how-can-i-easily-format-my-data-table-in-c. | |
| string | strRight (const char *pchIn, int const nWidth) |
| Right-aligns char array within a field of given width, pads with blank spaces to enforce alignment. From https://stackoverflow.com/questions/14765155/how-can-i-easily-format-my-data-table-in-c. | |
| string | strLeft (const string &strIn, int const nWidth) |
| Left-aligns string within a field of given width, pads with blank spaces to enforce alignment. From https://stackoverflow.com/questions/14765155/how-can-i-easily-format-my-data-table-in-c. | |
| string | strLeft (const char *pchIn, int const nWidth) |
| Left-aligns char array within a field of given width, pads with blank spaces to enforce alignment. From https://stackoverflow.com/questions/14765155/how-can-i-easily-format-my-data-table-in-c. | |
| string | strRightPerCent (double const d1, double const d2, int const nWidth, int const nDigits, bool const bShowDash) |
| Calculates a percentage from two numbers then, if the result is non-zero, right-aligns the result as a string within a field of given width, pads with blank spaces to enforce alignment. Modified from https://stackoverflow.com/questions/14765155/how-can-i-easily-format-my-data-table-in-c. | |
Globally-available utility routines.
TODO 001 A more detailed description of these routines.
Definition in file utils_global.cpp.
| bool bIsStringValidDouble | ( | string & | str | ) |
Checks to see if a string can be read as a valid double number. Does not find trailing (i.e.post-number) rubbish, but then neither does strtod(). From https://stackoverflow.com/questions/392981/how-can-i-convert-string-to-double-in-c.
Definition at line 62 of file utils_global.cpp.
Referenced by CSimulation::bApplyConfiguration(), CSimulation::bReadRunDataFile(), CSimulation::nReadSedimentInputEventFile(), CSimulation::nReadShapeFunctionFile(), CSimulation::nReadTideDataFile(), and CSimulation::nReadWaveStationInputFile().
| bool bIsStringValidInt | ( | string & | str | ) |
Checks to see if a string can be read as a valid integer, from https://stackoverflow.com/questions/2844817/how-do-i-check-if-a-c-string-is-an-int.
Definition at line 76 of file utils_global.cpp.
Referenced by CSimulation::bParseDate(), CSimulation::bParseTime(), CSimulation::bReadRunDataFile(), CSimulation::nReadSedimentInputEventFile(), CSimulation::nReadWaveStationInputFile(), and CSimulation::ulConvertToTimestep().
| double dRound | ( | double const | d | ) |
Correctly rounds doubles.
Definition at line 38 of file utils_global.cpp.
Referenced by CSimulation::bTimeToQuit(), CSimulation::bWriteRasterGISFile(), CSimulation::strDispTime(), and CSimulation::ulConvertToTimestep().
| int nRound | ( | double const | d | ) |
Correctly rounds doubles, returns an int.
Definition at line 47 of file utils_global.cpp.
Referenced by CGeom2DIPoint::AddXAddY(), CSimulation::AppendEnsureNoGap(), CSimulation::CalcMHWElevation(), CSimulation::CreateRasterizedProfile(), CGeom2DIPoint::DivXDivY(), CSimulation::DoShadowZoneAndDownDriftZone(), CSimulation::InterpolateWavePropertiesBetweenProfiles(), CSimulation::KeepWithinValidGrid(), CSimulation::nConvertMetresToNumCells(), CSimulation::nDoAllShadowZones(), CSimulation::nDoSedimentInputEvent(), CSimulation::nDoSimulation(), CSimulation::nGetCoastNormalEndPoint(), CSimulation::nLocateAndCreateGridEdgeProfile(), CSimulation::nTruncateProfileHitDifferentCoast(), CSimulation::nTruncateProfilesDifferentCoasts(), CSimulation::PtiExtCRSToGridRound(), CGeomCoastPolygon::PtiGetFillStartPoint(), CSimulation::PtiGetPerpendicular(), CSimulation::PtiGetPerpendicular(), CSimulation::PtiWeightedAverage(), and CSimulation::RasterizePolygonJoiningLine().
Operator that inserts a given fill character, to a given width, into an output stream. From http://stackoverflow.com/questions/2839592/equivalent-of-02d-with-stdstringstream.
Definition at line 95 of file utils_global.cpp.
| string strCentre | ( | const char * | pchIn, |
| int const | nWidth ) |
Centre-aligns char array within a field of given width, pads with blank spaces to enforce alignment. From https://stackoverflow.com/questions/14765155/how-can-i-easily-format-my-data-table-in-c.
Definition at line 161 of file utils_global.cpp.
Referenced by CSimulation::DoEndOfTimestepTotals(), CSimulation::WritePolygonActualMovement(), CSimulation::WritePolygonCliffCollapseErosion(), CSimulation::WritePolygonInfoTable(), CSimulation::WritePolygonPotentialErosion(), CSimulation::WritePolygonPreExistingSedimentTable(), CSimulation::WritePolygonSedimentBeforeMovement(), CSimulation::WritePolygonSedimentInputEventTable(), CSimulation::WritePolygonShorePlatformErosion(), CSimulation::WritePolygonSortedSequence(), and CSimulation::WritePolygonUnsortedSequence().
Centre-aligns string within a field of given width, pads with blank spaces to enforce alignment. From https://stackoverflow.com/questions/14765155/how-can-i-easily-format-my-data-table-in-c.
Definition at line 181 of file utils_global.cpp.
| string strDblRight | ( | double const | dX, |
| int const | nDigits, | ||
| int const | nWidth, | ||
| bool const | bShowDash ) |
Converts double to string with specified number of decimal places, within a field of given width, pads with blank spaces to enforce right alignment. Modified from https://stackoverflow.com/questions/14765155/how-can-i-easily-format-my-data-table-in-c.
Definition at line 118 of file utils_global.cpp.
Referenced by CSimulation::DoEndOfTimestepTotals(), CSimulation::WritePolygonActualMovement(), CSimulation::WritePolygonCliffCollapseErosion(), CSimulation::WritePolygonInfoTable(), CSimulation::WritePolygonPotentialErosion(), CSimulation::WritePolygonPreExistingSedimentTable(), CSimulation::WritePolygonSedimentBeforeMovement(), CSimulation::WritePolygonSedimentInputEventTable(), and CSimulation::WritePolygonShorePlatformErosion().
| string strIntRight | ( | int const | nX, |
| int const | nWidth ) |
Converts int to string within a field of given width, pads with blank spaces to enforce alignment.. From https://stackoverflow.com/questions/14765155/how-can-i-easily-format-my-data-table-in-c.
Definition at line 147 of file utils_global.cpp.
Referenced by CSimulation::WritePolygonActualMovement(), CSimulation::WritePolygonCliffCollapseErosion(), CSimulation::WritePolygonInfoTable(), CSimulation::WritePolygonPotentialErosion(), CSimulation::WritePolygonPreExistingSedimentTable(), CSimulation::WritePolygonSedimentBeforeMovement(), CSimulation::WritePolygonSedimentInputEventTable(), CSimulation::WritePolygonShorePlatformErosion(), CSimulation::WritePolygonSortedSequence(), and CSimulation::WritePolygonUnsortedSequence().
| string strLeft | ( | const char * | pchIn, |
| int const | nWidth ) |
Left-aligns char array within a field of given width, pads with blank spaces to enforce alignment. From https://stackoverflow.com/questions/14765155/how-can-i-easily-format-my-data-table-in-c.
Definition at line 248 of file utils_global.cpp.
Left-aligns string within a field of given width, pads with blank spaces to enforce alignment. From https://stackoverflow.com/questions/14765155/how-can-i-easily-format-my-data-table-in-c.
Definition at line 233 of file utils_global.cpp.
Referenced by CSimulation::DoEndOfTimestepTotals(), and CSimulation::WritePolygonActualMovement().
| string strRight | ( | const char * | pchIn, |
| int const | nWidth ) |
Right-aligns char array within a field of given width, pads with blank spaces to enforce alignment. From https://stackoverflow.com/questions/14765155/how-can-i-easily-format-my-data-table-in-c.
Definition at line 216 of file utils_global.cpp.
Right-aligns string within a field of given width, pads with blank spaces to enforce alignment. From https://stackoverflow.com/questions/14765155/how-can-i-easily-format-my-data-table-in-c.
Definition at line 200 of file utils_global.cpp.
Referenced by CSimulation::WritePolygonSortedSequence(), and CSimulation::WritePolygonUnsortedSequence().
| string strRightPerCent | ( | double const | d1, |
| double const | d2, | ||
| int const | nWidth, | ||
| int const | nDigits, | ||
| bool const | bShowDash ) |
Calculates a percentage from two numbers then, if the result is non-zero, right-aligns the result as a string within a field of given width, pads with blank spaces to enforce alignment. Modified from https://stackoverflow.com/questions/14765155/how-can-i-easily-format-my-data-table-in-c.
Definition at line 264 of file utils_global.cpp.
Referenced by CSimulation::DoEndOfTimestepTotals().