Decided upon the format case{region}.OpenFOAM for denoting regions (paraview)

Pro: Good delimitation. Good visual distinction. No confusion with normal
       cases, since '{}' characters are excluded by !word::valid()
  Con: Possible quoting issues when creating directly instead of via paraFoam,
       but seemed to work fine with bash TAB completion.
This commit is contained in:
Mark Olesen
2008-08-10 16:54:55 +02:00
parent 7be206a5f3
commit 120e32a58d
2 changed files with 17 additions and 11 deletions

View File

@ -247,15 +247,20 @@ Foam::vtkPV3Foam::vtkPV3Foam
setEnv("FOAM_CASE", fullCasePath, true);
}
// get the caseName, and look for '=regionName' in it
// we could also be more stringent and insist that the
// prefix match the directory name, etc ..
fileName caseName(fileName(FileName).lessExt());
// look for 'case{region}.OpenFOAM'
// could be stringent and insist the prefix match the directory name...
// Note: cannot use fileName::name() due to the embedded '{}'
string caseName(fileName(FileName).lessExt());
string::size_type beg = caseName.find_last_of("/{");
string::size_type end = caseName.find('}', beg);
string::size_type delimiter = caseName.find("=");
if (delimiter != string::npos)
if
(
beg != string::npos && caseName[beg] == '{'
&& end != string::npos && end == caseName.size()-1
)
{
meshRegion_ = caseName.substr(delimiter+1);
meshRegion_ = caseName.substr(beg+1, end-beg-1);
// some safety
if (!meshRegion_.size())