MCPcopy Create free account
hub / github.com/Kitware/VTK / CreateCasePath

Method CreateCasePath

IO/Geometry/vtkOpenFOAMReader.cxx:11766–11812  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

11764
11765//------------------------------------------------------------------------------
11766void vtkOpenFOAMReader::CreateCasePath(vtkStdString& casePath, vtkStdString& controlDictPath)
11767{
11768#if defined(_WIN32)
11769 const std::string pathFindSeparator = "/\\", pathSeparator = "\\";
11770#else
11771 const std::string pathFindSeparator = "/", pathSeparator = "/";
11772#endif
11773 controlDictPath = this->FileName;
11774
11775 // determine the case directory and path to controlDict
11776 auto pos = controlDictPath.find_last_of(pathFindSeparator);
11777 if (pos == std::string::npos)
11778 {
11779 // if there's no prepending path, prefix with the current directory
11780 controlDictPath = "." + pathSeparator + controlDictPath;
11781 pos = 1;
11782 }
11783 if (controlDictPath.substr(pos + 1, 11) == "controlDict")
11784 {
11785 // remove trailing "/controlDict*"
11786 casePath = controlDictPath.substr(0, pos - 1);
11787 if (casePath == ".")
11788 {
11789 casePath = ".." + pathSeparator;
11790 }
11791 else
11792 {
11793 pos = casePath.find_last_of(pathFindSeparator);
11794 if (pos == std::string::npos)
11795 {
11796 casePath = "." + pathSeparator;
11797 }
11798 else
11799 {
11800 // remove trailing "system" (or any other directory name)
11801 casePath.erase(pos + 1); // preserve the last "/"
11802 }
11803 }
11804 }
11805 else
11806 {
11807 // if the file is named other than controlDict*, use the directory
11808 // containing the file as case directory
11809 casePath = controlDictPath.substr(0, pos + 1);
11810 controlDictPath = casePath + "system" + pathSeparator + "controlDict";
11811 }
11812}
11813
11814//------------------------------------------------------------------------------
11815void vtkOpenFOAMReader::AddSelectionNames(

Callers 1

MakeInformationVectorMethod · 0.95

Calls 1

eraseMethod · 0.45

Tested by

no test coverage detected