MCPcopy Create free account
hub / github.com/InteractiveComputerGraphics/SPlisHSPlasH / convertFileName

Function convertFileName

Tools/FoamGenerator/main.cpp:983–998  ·  view source on GitHub ↗

Substitute the placeholder in the file name with the current frame number. */

Source from the content-addressed store, hash-verified

981/** Substitute the placeholder in the file name with the current frame number.
982*/
983std::string convertFileName(const std::string &inputFileName, const unsigned int currentFrame)
984{
985 std::string fileName = inputFileName;
986 std::string::size_type pos1 = fileName.find_first_of("#", 0);
987 if (pos1 == std::string::npos)
988 {
989 LOG_ERR << "# missing in file name.";
990 exit(1);
991 }
992 std::string::size_type pos2 = fileName.find_first_not_of("#", pos1);
993 std::string::size_type length = pos2 - pos1;
994
995 std::string numberStr = zeroPadding(currentFrame, (unsigned int)length);
996 fileName.replace(pos1, length, numberStr);
997 return fileName;
998}
999
1000/** Read fluid particles of current frame.
1001*/

Callers 3

readCurrentFrameFunction · 0.70
writeCurrentFrame_bgeoFunction · 0.70
writeCurrentFrame_vtkFunction · 0.70

Calls 1

zeroPaddingFunction · 0.70

Tested by

no test coverage detected