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);
|
setEnv("FOAM_CASE", fullCasePath, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// get the caseName, and look for '=regionName' in it
|
// look for 'case{region}.OpenFOAM'
|
||||||
// we could also be more stringent and insist that the
|
// could be stringent and insist the prefix match the directory name...
|
||||||
// prefix match the directory name, etc ..
|
// Note: cannot use fileName::name() due to the embedded '{}'
|
||||||
fileName caseName(fileName(FileName).lessExt());
|
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
|
||||||
if (delimiter != string::npos)
|
(
|
||||||
|
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
|
// some safety
|
||||||
if (!meshRegion_.size())
|
if (!meshRegion_.size())
|
||||||
|
@ -81,12 +81,12 @@ caseName=${PWD##*/}
|
|||||||
caseFile="$caseName.OpenFOAM"
|
caseFile="$caseName.OpenFOAM"
|
||||||
if [ -n "$regionName" ]
|
if [ -n "$regionName" ]
|
||||||
then
|
then
|
||||||
caseFile="$caseName=$regionName.OpenFOAM"
|
caseFile="$caseName{$regionName}.OpenFOAM"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$touchOnly" ];
|
if [ -n "$touchOnly" ];
|
||||||
then
|
then
|
||||||
touch $caseFile
|
touch "$caseFile"
|
||||||
echo "created '$caseFile'"
|
echo "created '$caseFile'"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
@ -120,10 +120,11 @@ case "$ParaView_VERSION" in
|
|||||||
# only create/remove caseFile if it doesn't exist
|
# only create/remove caseFile if it doesn't exist
|
||||||
[ -e $caseFile ] || {
|
[ -e $caseFile ] || {
|
||||||
trap "rm -f $caseFile 2>/dev/null; exit 0" EXIT TERM INT
|
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
|
esac
|
||||||
|
Loading…
Reference in New Issue
Block a user