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:
parent
7be206a5f3
commit
120e32a58d
@ -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())
|
||||
|
@ -81,12 +81,12 @@ caseName=${PWD##*/}
|
||||
caseFile="$caseName.OpenFOAM"
|
||||
if [ -n "$regionName" ]
|
||||
then
|
||||
caseFile="$caseName=$regionName.OpenFOAM"
|
||||
caseFile="$caseName{$regionName}.OpenFOAM"
|
||||
fi
|
||||
|
||||
if [ -n "$touchOnly" ];
|
||||
then
|
||||
touch $caseFile
|
||||
touch "$caseFile"
|
||||
echo "created '$caseFile'"
|
||||
exit 0
|
||||
fi
|
||||
@ -120,10 +120,11 @@ case "$ParaView_VERSION" in
|
||||
# only create/remove caseFile if it doesn't exist
|
||||
[ -e $caseFile ] || {
|
||||
trap "rm -f $caseFile 2>/dev/null; exit 0" EXIT TERM INT
|
||||
touch $caseFile
|
||||
touch "$caseFile"
|
||||
echo "created temporary '$caseFile'"
|
||||
}
|
||||
|
||||
paraview --data=$caseFile
|
||||
paraview --data="$caseFile"
|
||||
;;
|
||||
|
||||
esac
|
||||
|
Loading…
Reference in New Issue
Block a user