diff --git a/applications/utilities/mesh/advanced/collapseEdges/collapseEdges.C b/applications/utilities/mesh/advanced/collapseEdges/collapseEdges.C index bc25b97012c68681a0e19d0d3e7455e0ce96eecf..9890f63dfda325361919472fcb9741916b6d033a 100644 --- a/applications/utilities/mesh/advanced/collapseEdges/collapseEdges.C +++ b/applications/utilities/mesh/advanced/collapseEdges/collapseEdges.C @@ -462,6 +462,7 @@ int main(int argc, char *argv[]) # include "setRootCase.H" # include "createTime.H" + runTime.functionObjects().off(); # include "createPolyMesh.H" scalar minLen(readScalar(IStringStream(args.additionalArgs()[0])())); diff --git a/applications/utilities/mesh/advanced/combinePatchFaces/combinePatchFaces.C b/applications/utilities/mesh/advanced/combinePatchFaces/combinePatchFaces.C index 5412ef5b1c1bd0f3a684d7bc14bff9cf38c2afc7..ac7eac71c17d22f0fc0088ddc3409a8d103f65fa 100644 --- a/applications/utilities/mesh/advanced/combinePatchFaces/combinePatchFaces.C +++ b/applications/utilities/mesh/advanced/combinePatchFaces/combinePatchFaces.C @@ -439,6 +439,7 @@ int main(int argc, char *argv[]) # include "setRootCase.H" # include "createTime.H" + runTime.functionObjects().off(); # include "createPolyMesh.H" scalar featureAngle(readScalar(IStringStream(args.additionalArgs()[0])())); diff --git a/applications/utilities/mesh/advanced/modifyMesh/modifyMesh.C b/applications/utilities/mesh/advanced/modifyMesh/modifyMesh.C index 207d3d9cbc77f8a69b5c174da79400cd71ccc369..68ea711a06313363a53f00a00e3a1a4a881603b8 100644 --- a/applications/utilities/mesh/advanced/modifyMesh/modifyMesh.C +++ b/applications/utilities/mesh/advanced/modifyMesh/modifyMesh.C @@ -332,6 +332,7 @@ int main(int argc, char *argv[]) # include "setRootCase.H" # include "createTime.H" + runTime.functionObjects().off(); # include "createPolyMesh.H" bool overwrite = args.options().found("overwrite"); diff --git a/applications/utilities/mesh/advanced/refineHexMesh/refineHexMesh.C b/applications/utilities/mesh/advanced/refineHexMesh/refineHexMesh.C index 33d9ba71aff5d82ccc9326f44a275c13258060c7..0fcea92bfef17d64242a903c6c4766d7dc162ea2 100644 --- a/applications/utilities/mesh/advanced/refineHexMesh/refineHexMesh.C +++ b/applications/utilities/mesh/advanced/refineHexMesh/refineHexMesh.C @@ -56,6 +56,7 @@ int main(int argc, char *argv[]) argList::validArgs.append("cellSet"); # include "setRootCase.H" # include "createTime.H" + runTime.functionObjects().off(); # include "createMesh.H" pointMesh pMesh(mesh); diff --git a/applications/utilities/mesh/advanced/refineWallLayer/refineWallLayer.C b/applications/utilities/mesh/advanced/refineWallLayer/refineWallLayer.C index f4336bce92fe9da6d322c4ff1108b6fd8be6dce8..6f476206fbc742abbdf48d7a8d9ff9bc43ece387 100644 --- a/applications/utilities/mesh/advanced/refineWallLayer/refineWallLayer.C +++ b/applications/utilities/mesh/advanced/refineWallLayer/refineWallLayer.C @@ -54,6 +54,7 @@ int main(int argc, char *argv[]) # include "setRootCase.H" # include "createTime.H" + runTime.functionObjects().off(); # include "createPolyMesh.H" word patchName(args.additionalArgs()[0]); diff --git a/applications/utilities/mesh/advanced/removeFaces/removeFaces.C b/applications/utilities/mesh/advanced/removeFaces/removeFaces.C index 5cf8473b5dba9e39bff786784e55d4c51ab75ec2..b1b5695c7072e61346c32c2db5b9e5f1f452b056 100644 --- a/applications/utilities/mesh/advanced/removeFaces/removeFaces.C +++ b/applications/utilities/mesh/advanced/removeFaces/removeFaces.C @@ -53,6 +53,7 @@ int main(int argc, char *argv[]) # include "setRootCase.H" # include "createTime.H" + runTime.functionObjects().off(); # include "createMesh.H" bool overwrite = args.options().found("overwrite"); diff --git a/applications/utilities/mesh/advanced/splitCells/splitCells.C b/applications/utilities/mesh/advanced/splitCells/splitCells.C index b5a67074e63952a46a1ea00b5c31c69ddd5c0d51..be28bf68930f8e916b17782eb79be41331bbf45f 100644 --- a/applications/utilities/mesh/advanced/splitCells/splitCells.C +++ b/applications/utilities/mesh/advanced/splitCells/splitCells.C @@ -532,6 +532,7 @@ int main(int argc, char *argv[]) # include "setRootCase.H" # include "createTime.H" + runTime.functionObjects().off(); # include "createPolyMesh.H" scalar featureAngle(readScalar(IStringStream(args.additionalArgs()[0])())); diff --git a/applications/utilities/mesh/conversion/polyDualMesh/polyDualMeshApp.C b/applications/utilities/mesh/conversion/polyDualMesh/polyDualMeshApp.C index e982206e6150d31b1c7df6a5f3a0885dbe4f3bcb..ffa83149528d13d447f0179ca5c9997bf99f7611 100644 --- a/applications/utilities/mesh/conversion/polyDualMesh/polyDualMeshApp.C +++ b/applications/utilities/mesh/conversion/polyDualMesh/polyDualMeshApp.C @@ -47,6 +47,7 @@ int main(int argc, char *argv[]) # include "setRootCase.H" # include "createTime.H" + runTime.functionObjects().off(); # include "createPolyMesh.H" scalar featureAngle(readScalar(IStringStream(args.additionalArgs()[0])())); diff --git a/applications/utilities/mesh/conversion/writeMeshObj/writeMeshObj.C b/applications/utilities/mesh/conversion/writeMeshObj/writeMeshObj.C index 1d2eaae78b222b364a569e402d955410e0c28a31..59423a9d04c8c5b914ad4af97c6be4f1f63c96fc 100644 --- a/applications/utilities/mesh/conversion/writeMeshObj/writeMeshObj.C +++ b/applications/utilities/mesh/conversion/writeMeshObj/writeMeshObj.C @@ -346,6 +346,7 @@ int main(int argc, char *argv[]) # include "addTimeOptions.H" # include "setRootCase.H" # include "createTime.H" + runTime.functionObjects().off(); bool patchFaces = args.options().found("patchFaces"); bool doCell = args.options().found("cell"); diff --git a/applications/utilities/mesh/generation/extrude2DMesh/doExtrude2DMesh.C b/applications/utilities/mesh/generation/extrude2DMesh/doExtrude2DMesh.C index d974dc8da292bcf9617c1d73f5b354f4a4812126..30a8bce0fcdf8b094f3fd3efea18b2cee9e92944 100644 --- a/applications/utilities/mesh/generation/extrude2DMesh/doExtrude2DMesh.C +++ b/applications/utilities/mesh/generation/extrude2DMesh/doExtrude2DMesh.C @@ -61,6 +61,7 @@ int main(int argc, char *argv[]) argList::validOptions.insert("overwrite", ""); # include "setRootCase.H" # include "createTime.H" + runTime.functionObjects().off(); # include "createPolyMesh.H" scalar thickness(readScalar(IStringStream(args.additionalArgs()[0])())); diff --git a/applications/utilities/mesh/manipulation/attachMesh/attachMesh.C b/applications/utilities/mesh/manipulation/attachMesh/attachMesh.C index b808dd7521772ef4b316a27e73ccfe4c2ebfae3e..2b0f894e98643721d1a1379e1ae2958e089a71bb 100644 --- a/applications/utilities/mesh/manipulation/attachMesh/attachMesh.C +++ b/applications/utilities/mesh/manipulation/attachMesh/attachMesh.C @@ -46,6 +46,7 @@ int main(int argc, char *argv[]) # include "setRootCase.H" # include "createTime.H" + runTime.functionObjects().off(); # include "createPolyMesh.H" bool overwrite = args.options().found("overwrite"); diff --git a/applications/utilities/mesh/manipulation/autoPatch/autoPatch.C b/applications/utilities/mesh/manipulation/autoPatch/autoPatch.C index 3ea6a2a02b53e169abf3fda98c6997842f176155..f7cea3d4a0a763244a91df072107fdd8951c8d6e 100644 --- a/applications/utilities/mesh/manipulation/autoPatch/autoPatch.C +++ b/applications/utilities/mesh/manipulation/autoPatch/autoPatch.C @@ -75,6 +75,7 @@ int main(int argc, char *argv[]) # include "setRootCase.H" # include "createTime.H" + runTime.functionObjects().off(); # include "createPolyMesh.H" Info<< "Mesh read in = " diff --git a/applications/utilities/mesh/manipulation/createBaffles/createBaffles.C b/applications/utilities/mesh/manipulation/createBaffles/createBaffles.C index 2f1fd57634f8be21a62c62e432b61a5628a94745..882b7461e5afe8c30e9bf3d44fd32087662365b9 100644 --- a/applications/utilities/mesh/manipulation/createBaffles/createBaffles.C +++ b/applications/utilities/mesh/manipulation/createBaffles/createBaffles.C @@ -58,6 +58,7 @@ int main(int argc, char *argv[]) # include "setRootCase.H" # include "createTime.H" + runTime.functionObjects().off(); # include "createMesh.H" const polyBoundaryMesh& patches = mesh.boundaryMesh(); diff --git a/applications/utilities/mesh/manipulation/createPatch/createPatch.C b/applications/utilities/mesh/manipulation/createPatch/createPatch.C index 9ba825083ff51b896bdaac5db3f1914a3da7dce5..a44966198217a88a5169c38d1fbd0b3e149fa1c5 100644 --- a/applications/utilities/mesh/manipulation/createPatch/createPatch.C +++ b/applications/utilities/mesh/manipulation/createPatch/createPatch.C @@ -308,6 +308,7 @@ int main(int argc, char *argv[]) # include "setRootCase.H" # include "createTime.H" + runTime.functionObjects().off(); const bool overwrite = args.options().found("overwrite"); diff --git a/applications/utilities/mesh/manipulation/mergeOrSplitBaffles/mergeOrSplitBaffles.C b/applications/utilities/mesh/manipulation/mergeOrSplitBaffles/mergeOrSplitBaffles.C index 8ec01e2920bc3484513cd18854f5750002b4a6cc..cbd2d9e4191ccceac1505046fc5b468abbf20cd8 100644 --- a/applications/utilities/mesh/manipulation/mergeOrSplitBaffles/mergeOrSplitBaffles.C +++ b/applications/utilities/mesh/manipulation/mergeOrSplitBaffles/mergeOrSplitBaffles.C @@ -160,6 +160,7 @@ int main(int argc, char *argv[]) argList::validOptions.insert("overwrite", ""); # include "setRootCase.H" # include "createTime.H" + runTime.functionObjects().off(); # include "createMesh.H" bool split = args.options().found("split"); diff --git a/applications/utilities/mesh/manipulation/refineMesh/refineMesh.C b/applications/utilities/mesh/manipulation/refineMesh/refineMesh.C index 33bb0e00d9f492e7477ae826b2a8362f83864a03..8cde78ceb4092860013bc9066593c0776c71f5e6 100644 --- a/applications/utilities/mesh/manipulation/refineMesh/refineMesh.C +++ b/applications/utilities/mesh/manipulation/refineMesh/refineMesh.C @@ -298,6 +298,7 @@ int main(int argc, char *argv[]) # include "setRootCase.H" # include "createTime.H" + runTime.functionObjects().off(); # include "createPolyMesh.H" printEdgeStats(mesh); diff --git a/applications/utilities/mesh/manipulation/renumberMesh/renumberMesh.C b/applications/utilities/mesh/manipulation/renumberMesh/renumberMesh.C index be3a2debb7194a5c8acc33b3fed2e3972d5678f9..c7e85f0a6efc8ad27a670c743bbc8252f1571c15 100644 --- a/applications/utilities/mesh/manipulation/renumberMesh/renumberMesh.C +++ b/applications/utilities/mesh/manipulation/renumberMesh/renumberMesh.C @@ -374,6 +374,7 @@ int main(int argc, char *argv[]) # include "setRootCase.H" # include "createTime.H" + runTime.functionObjects().off(); // Get times list instantList Times = runTime.times(); diff --git a/applications/utilities/mesh/manipulation/splitMesh/splitMesh.C b/applications/utilities/mesh/manipulation/splitMesh/splitMesh.C index d902303bcae6147fba733637a875b4077ebdee73..38a09fe2e1ba1e81fd32d207664e5f93544774dc 100644 --- a/applications/utilities/mesh/manipulation/splitMesh/splitMesh.C +++ b/applications/utilities/mesh/manipulation/splitMesh/splitMesh.C @@ -122,6 +122,7 @@ int main(int argc, char *argv[]) # include "setRootCase.H" # include "createTime.H" + runTime.functionObjects().off(); # include "createPolyMesh.H" word setName(args.additionalArgs()[0]); diff --git a/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C b/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C index 511141ac66f8c5a6fb7023a8799564f771be26f1..eb116fc23150a6f5b910388ddd38a37bf04a3dbf 100644 --- a/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C +++ b/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C @@ -1122,6 +1122,7 @@ int main(int argc, char *argv[]) # include "setRootCase.H" # include "createTime.H" + runTime.functionObjects().off(); # include "createMesh.H" word blockedFacesName; diff --git a/applications/utilities/mesh/manipulation/stitchMesh/stitchMesh.C b/applications/utilities/mesh/manipulation/stitchMesh/stitchMesh.C index e3c558ce5022229e260540766661b0c73a874e36..4452bf46ca2f28a81d3db39d6dfa393a10d23dbe 100644 --- a/applications/utilities/mesh/manipulation/stitchMesh/stitchMesh.C +++ b/applications/utilities/mesh/manipulation/stitchMesh/stitchMesh.C @@ -135,6 +135,7 @@ int main(int argc, char *argv[]) # include "setRootCase.H" # include "createTime.H" + runTime.functionObjects().off(); # include "createMesh.H" diff --git a/applications/utilities/mesh/manipulation/subsetMesh/subsetMesh.C b/applications/utilities/mesh/manipulation/subsetMesh/subsetMesh.C index d49fd4c6b5e5d7129a698745c6bf51c675c33c6c..b245f0bd0b7546278e7be80aa95c5bc40f8cc927 100644 --- a/applications/utilities/mesh/manipulation/subsetMesh/subsetMesh.C +++ b/applications/utilities/mesh/manipulation/subsetMesh/subsetMesh.C @@ -157,6 +157,7 @@ int main(int argc, char *argv[]) # include "setRootCase.H" # include "createTime.H" + runTime.functionObjects().off(); # include "createMesh.H" word setName(args.additionalArgs()[0]); diff --git a/applications/utilities/miscellaneous/foamInfoExec/foamInfoExec.C b/applications/utilities/miscellaneous/foamInfoExec/foamInfoExec.C index 50bf81035fac657552a0f55b8096aaa9670e9d7b..7bff5f4c237ca718db35eec765765e5b3c18bc07 100644 --- a/applications/utilities/miscellaneous/foamInfoExec/foamInfoExec.C +++ b/applications/utilities/miscellaneous/foamInfoExec/foamInfoExec.C @@ -100,13 +100,23 @@ int main(int argc, char *argv[]) if (dict.found(entryNames[0])) { - const entry* entPtr = &dict.lookupEntry(entryNames[0]); + const entry* entPtr = &dict.lookupEntry + ( + entryNames[0], + false, + true // wildcards + ); for (int i=1; i<entryNames.size(); i++) { if (entPtr->dict().found(entryNames[i])) { - entPtr = &entPtr->dict().lookupEntry(entryNames[i]); + entPtr = &entPtr->dict().lookupEntry + ( + entryNames[i], + false, + true // wildcards + ); } else { diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamI.H b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamI.H index 8f9f682cdc083f92f1456c0d597704c467fbf022..427c0a6fdef14a98f1ad515c1078b09e247429d2 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamI.H +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamI.H @@ -37,7 +37,7 @@ inline Foam::word Foam::vtkPV3Foam::getFirstWord(const char* str) { ++n; } - return word(str, n); + return word(str, n, true); } else { diff --git a/applications/utilities/postProcessing/miscellaneous/postChannel/postChannelDict b/applications/utilities/postProcessing/miscellaneous/postChannel/postChannelDict index 4c528ea24303edeb7b3d0e8f9abd296a1303be56..e69c0386ef95781462a1b01424c2d8eee53f1e2c 100644 --- a/applications/utilities/postProcessing/miscellaneous/postChannel/postChannelDict +++ b/applications/utilities/postProcessing/miscellaneous/postChannel/postChannelDict @@ -22,6 +22,7 @@ Ny 25 ); Nz 30; - + +symmetric true; // ************************************************************************* // diff --git a/applications/utilities/preProcessing/changeDictionary/changeDictionary.C b/applications/utilities/preProcessing/changeDictionary/changeDictionary.C index f24729da976cb9eb4692f72812ecb01a36e719f9..ec5d0193103e08d7c5bc9b1235f3061d57b61725 100644 --- a/applications/utilities/preProcessing/changeDictionary/changeDictionary.C +++ b/applications/utilities/preProcessing/changeDictionary/changeDictionary.C @@ -164,7 +164,16 @@ int main(int argc, char *argv[]) forAll(dictList, i) { doneKeys[i] = dictList[i].keyword(); - dictList.set(i, fieldDict.lookupEntry(doneKeys[i]).clone()); + dictList.set + ( + i, + fieldDict.lookupEntry + ( + doneKeys[i], + false, + true + ).clone() + ); fieldDict.remove(doneKeys[i]); } // Add remaining entries diff --git a/applications/utilities/surface/surfaceSubset/surfaceSubset.C b/applications/utilities/surface/surfaceSubset/surfaceSubset.C index aa30790b5caba2ad74e4ca0548abfdb3e2537236..f6312b32a4ddff7a4212dbc59bdc2f8ac0e08cfc 100644 --- a/applications/utilities/surface/surfaceSubset/surfaceSubset.C +++ b/applications/utilities/surface/surfaceSubset/surfaceSubset.C @@ -100,6 +100,11 @@ int main(int argc, char *argv[]) meshSubsetDict.lookup("addFaceNeighbours") ); + Switch invertSelection + ( + meshSubsetDict.lookup("invertSelection") + ); + // Mark the cells for the subset // Faces to subset @@ -337,6 +342,27 @@ int main(int argc, char *argv[]) << " faces because of addFaceNeighbours" << endl; } + + if (invertSelection) + { + Info<< "Inverting selection." << endl; + boolList newFacesToSubset(facesToSubset.size()); + + forAll(facesToSubset, i) + { + if (facesToSubset[i]) + { + newFacesToSubset[i] = false; + } + else + { + newFacesToSubset[i] = true; + } + } + facesToSubset.transfer(newFacesToSubset); + } + + // Create subsetted surface labelList pointMap; labelList faceMap; diff --git a/bin/mpirunDebug b/bin/mpirunDebug index 013a63997fb00b09004726d0183314f8deb4d40c..8d0be2375c4beda9ca56943fef8f2308e8816448 100755 --- a/bin/mpirunDebug +++ b/bin/mpirunDebug @@ -70,15 +70,17 @@ if [ ! -x "$exec" ]; then exit 1 fi +if [ ! "$PWD" ]; then + PWD=`pwd` +fi +echo "run $args" > $PWD/gdbCommands +echo "where" >> $PWD/gdbCommands +echo "Constructed gdb initialization file $PWD/gdbCommands" -echo "run $args" > $HOME/gdbCommands -echo "where" >> $HOME/gdbCommands -echo "Constructed gdb initialization file $HOME/gdbCommands" - -$ECHO "Choose running method: 1)gdb+xterm 2)gdb 3)log 4)log+xterm 5)xterm+valgrind: \c" +$ECHO "Choose running method: 0)normal 1)gdb+xterm 2)gdb 3)log 4)log+xterm 5)xterm+valgrind: \c" read method -if [ "$method" -ne 1 -a "$method" -ne 2 -a "$method" -ne 3 -a "$method" -ne 4 -a "$method" -ne 5 ]; then +if [ "$method" -ne 0 -a "$method" -ne 1 -a "$method" -ne 2 -a "$method" -ne 3 -a "$method" -ne 4 -a "$method" -ne 5 ]; then printUsage exit 1 fi @@ -119,15 +121,15 @@ fi echo "**sourceFoam:$sourceFoam" -rm -f $HOME/mpirun.schema -touch $HOME/mpirun.schema +rm -f $PWD/mpirun.schema +touch $PWD/mpirun.schema proc=0 xpos=0 ypos=0 for ((proc=0; proc<$nProcs; proc++)) do - procCmdFile="$HOME/processor${proc}.sh" + procCmdFile="$PWD/processor${proc}.sh" procLog="processor${proc}.log" geom="-geometry 120x20+$xpos+$ypos" node="" @@ -141,22 +143,25 @@ do fi echo "#!/bin/sh" > $procCmdFile - if [ "$method" -eq 1 ]; then - echo "$sourceFoam; cd $PWD; gdb -command $HOME/gdbCommands $exec 2>&1 | tee $procLog; read dummy" >> $procCmdFile + if [ "$method" -eq 0 ]; then + echo "$sourceFoam; cd $PWD; $exec $args | tee $procLog" >> $procCmdFile + echo "${node}$procCmdFile" >> $PWD/mpirun.schema + elif [ "$method" -eq 1 ]; then + echo "$sourceFoam; cd $PWD; gdb -command $PWD/gdbCommands $exec 2>&1 | tee $procLog; read dummy" >> $procCmdFile #echo "$sourceFoam; cd $PWD; $exec $args; read dummy" >> $procCmdFile - echo "${node}xterm -font fixed -title 'processor'$proc $geom -e $procCmdFile" >> $HOME/mpirun.schema + echo "${node}xterm -font fixed -title 'processor'$proc $geom -e $procCmdFile" >> $PWD/mpirun.schema elif [ "$method" -eq 2 ]; then - echo "$sourceFoam; cd $PWD; gdb -command $HOME/gdbCommands >& $procLog" >> $procCmdFile - echo "${node}$procCmdFile" >> $HOME/mpirun.schema + echo "$sourceFoam; cd $PWD; gdb -command $PWD/gdbCommands >& $procLog" >> $procCmdFile + echo "${node}$procCmdFile" >> $PWD/mpirun.schema elif [ "$method" -eq 3 ]; then echo "$sourceFoam; cd $PWD; $exec $args >& $procLog" >> $procCmdFile - echo "${node}$procCmdFile" >> $HOME/mpirun.schema + echo "${node}$procCmdFile" >> $PWD/mpirun.schema elif [ "$method" -eq 4 ]; then echo "$sourceFoam; cd $PWD; $exec $args 2>&1 | tee $procLog; read dummy" >> $procCmdFile - echo "${node}xterm -font fixed -title 'processor'$proc $geom -e $procCmdFile" >> $HOME/mpirun.schema + echo "${node}xterm -font fixed -title 'processor'$proc $geom -e $procCmdFile" >> $PWD/mpirun.schema elif [ "$method" -eq 5 ]; then echo "$sourceFoam; cd $PWD; valgrind $exec $args; read dummy" >> $procCmdFile - echo "${node}xterm -font fixed -title 'processor'$proc $geom -e $procCmdFile" >> $HOME/mpirun.schema + echo "${node}xterm -font fixed -title 'processor'$proc $geom -e $procCmdFile" >> $PWD/mpirun.schema fi chmod +x $procCmdFile @@ -176,10 +181,17 @@ do echo " tail -f $procLog" done -$ECHO "Constructed $HOME/mpirun.schema file. Press return to execute.\c" -read dummy +cmd="" if [ .$WM_MPLIB = .OPENMPI ]; then - mpirun -app $HOME/mpirun.schema </dev/null + cmd="mpirun -app $PWD/mpirun.schema </dev/null" elif [ .$WM_MPLIB = .LAM ]; then - mpirun $HOME/mpirun.schema </dev/null + cmd="mpirun $PWD/mpirun.schema </dev/null" fi + +echo "Constructed $PWD/mpirun.schema file." +echo "" +echo " $cmd" +echo "" +$ECHO "Press return to execute.\c" +read dummy +exec $cmd diff --git a/src/OSspecific/Unix/regularExpression.H b/src/OSspecific/Unix/regularExpression.H index dc574a4c9fc1419dec6395d1ee2ffd090dfb0799..9924caef28fb7ecec52a9d272a91aa3328b8e6ba 100644 --- a/src/OSspecific/Unix/regularExpression.H +++ b/src/OSspecific/Unix/regularExpression.H @@ -100,7 +100,7 @@ public: // Member functions //- Matches? - inline bool matches(const string& s) + inline bool matches(const string& s) const { size_t nmatch = 0; regmatch_t *pmatch = NULL; diff --git a/src/OpenFOAM/Make/files b/src/OpenFOAM/Make/files index cf4e331e25bda351419fcf253fdcdb57f4ae9f33..e24fd6b5ec4411c30138924dd05fdb3eb94a3959 100644 --- a/src/OpenFOAM/Make/files +++ b/src/OpenFOAM/Make/files @@ -39,6 +39,7 @@ $(strings)/word/word.C $(strings)/word/wordIO.C $(strings)/fileName/fileName.C $(strings)/fileName/fileNameIO.C +$(strings)/keyType/keyTypeIO.C primitives/random/Random.C diff --git a/src/OpenFOAM/db/IOstreams/IOstreams/Ostream.C b/src/OpenFOAM/db/IOstreams/IOstreams/Ostream.C index f0d3f8fd1ae85b726d6d295a4f35ca459bf21140..577494aa1cf435019fb43d7d770e5f511e31e987 100644 --- a/src/OpenFOAM/db/IOstreams/IOstreams/Ostream.C +++ b/src/OpenFOAM/db/IOstreams/IOstreams/Ostream.C @@ -22,15 +22,31 @@ License along with OpenFOAM; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -Description - \*---------------------------------------------------------------------------*/ +#include "word.H" #include "Ostream.H" #include "token.H" +#include "keyType.H" +#include "IOstreams.H" // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +//- Write keyType +Foam::Ostream& Foam::Ostream::write(const keyType& s) +{ + // Write as word? + if (s.isWildCard()) + { + return write(static_cast<const string&>(s)); + } + else + { + return write(static_cast<const word&>(s)); + } +} + + //- Decrememt the indent level void Foam::Ostream::decrIndent() { @@ -47,7 +63,7 @@ void Foam::Ostream::decrIndent() // Write the keyword to the Ostream followed by appropriate indentation -Foam::Ostream& Foam::Ostream::writeKeyword(const Foam::word& keyword) +Foam::Ostream& Foam::Ostream::writeKeyword(const Foam::keyType& keyword) { indent(); write(keyword); diff --git a/src/OpenFOAM/db/IOstreams/IOstreams/Ostream.H b/src/OpenFOAM/db/IOstreams/IOstreams/Ostream.H index bcd081df56d0a5076205a6d24804470d0938e67b..6dc7df259aef54ecbc44da928f4f99f0f89883f7 100644 --- a/src/OpenFOAM/db/IOstreams/IOstreams/Ostream.H +++ b/src/OpenFOAM/db/IOstreams/IOstreams/Ostream.H @@ -35,6 +35,7 @@ Description #define Ostream_H #include "IOstream.H" +#include "keyType.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -105,6 +106,9 @@ public: //- Write word virtual Ostream& write(const word&) = 0; + //- Write keyType + virtual Ostream& write(const keyType&); + //- Write string virtual Ostream& write(const string&) = 0; @@ -146,7 +150,7 @@ public: //- Write the keyword to the Ostream followed by // appropriate indentation - Ostream& writeKeyword(const word& keyword); + Ostream& writeKeyword(const keyType& keyword); // Stream state functions diff --git a/src/OpenFOAM/db/dictionary/dictionary.C b/src/OpenFOAM/db/dictionary/dictionary.C index 8a38ff9ba24ca1092d4563f1ef62338eb5d0afa1..ad960e7405779f5cfb38063d6f246dbd84d7bc56 100644 --- a/src/OpenFOAM/db/dictionary/dictionary.C +++ b/src/OpenFOAM/db/dictionary/dictionary.C @@ -34,6 +34,72 @@ defineTypeNameAndDebug(Foam::dictionary, 0); const Foam::dictionary Foam::dictionary::null; + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +bool Foam::dictionary::findInWildcards +( + const bool wildCardMatch, + const word& Keyword, + DLList<entry*>::const_iterator& wcLink, + DLList<autoPtr<regularExpression> >::const_iterator& reLink +) const +{ + if (wildCardEntries_.size() > 0) + { + //wcLink = wildCardEntries_.begin(); + //reLink = wildCardRegexps_.end(); + + while (wcLink != wildCardEntries_.end()) + { + if (!wildCardMatch && wcLink()->keyword() == Keyword) + { + return true; + } + else if (wildCardMatch && reLink()->matches(Keyword)) + { + return true; + } + + ++reLink; + ++wcLink; + } + } + + return false; +} + + +bool Foam::dictionary::findInWildcards +( + const bool wildCardMatch, + const word& Keyword, + DLList<entry*>::iterator& wcLink, + DLList<autoPtr<regularExpression> >::iterator& reLink +) +{ + if (wildCardEntries_.size() > 0) + { + while (wcLink != wildCardEntries_.end()) + { + if (!wildCardMatch && wcLink()->keyword() == Keyword) + { + return true; + } + else if (wildCardMatch && reLink()->matches(Keyword)) + { + return true; + } + + ++reLink; + ++wcLink; + } + } + + return false; +} + + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::dictionary::dictionary() @@ -60,6 +126,18 @@ Foam::dictionary::dictionary ) { hashedEntries_.insert(iter().keyword(), &iter()); + + if (iter().keyword().isWildCard()) + { + wildCardEntries_.insert(&iter()); + wildCardRegexps_.insert + ( + autoPtr<regularExpression> + ( + new regularExpression(iter().keyword()) + ) + ); + } } } @@ -81,6 +159,18 @@ Foam::dictionary::dictionary ) { hashedEntries_.insert(iter().keyword(), &iter()); + + if (iter().keyword().isWildCard()) + { + wildCardEntries_.insert(&iter()); + wildCardRegexps_.insert + ( + autoPtr<regularExpression> + ( + new regularExpression(iter().keyword()) + ) + ); + } } } @@ -133,13 +223,29 @@ bool Foam::dictionary::found(const word& keyword, bool recursive) const { return true; } - else if (recursive && &parent_ != &dictionary::null) - { - return parent_.found(keyword, recursive); - } else { - return false; + if (wildCardEntries_.size() > 0) + { + DLList<entry*>::const_iterator wcLink = wildCardEntries_.begin(); + DLList<autoPtr<regularExpression> >::const_iterator reLink = + wildCardRegexps_.begin(); + + // Find in wildcards using regular expressions only + if (findInWildcards(true, keyword, wcLink, reLink)) + { + return true; + } + } + + if (recursive && &parent_ != &dictionary::null) + { + return parent_.found(keyword, recursive); + } + else + { + return false; + } } } @@ -147,16 +253,31 @@ bool Foam::dictionary::found(const word& keyword, bool recursive) const const Foam::entry* Foam::dictionary::lookupEntryPtr ( const word& keyword, - bool recursive + bool recursive, + bool wildCardMatch ) const { HashTable<entry*>::const_iterator iter = hashedEntries_.find(keyword); if (iter == hashedEntries_.end()) { + if (wildCardMatch && wildCardEntries_.size() > 0) + { + DLList<entry*>::const_iterator wcLink = + wildCardEntries_.begin(); + DLList<autoPtr<regularExpression> >::const_iterator reLink = + wildCardRegexps_.begin(); + + // Find in wildcards using regular expressions only + if (findInWildcards(wildCardMatch, keyword, wcLink, reLink)) + { + return wcLink(); + } + } + if (recursive && &parent_ != &dictionary::null) { - return parent_.lookupEntryPtr(keyword, recursive); + return parent_.lookupEntryPtr(keyword, recursive, wildCardMatch); } else { @@ -171,19 +292,34 @@ const Foam::entry* Foam::dictionary::lookupEntryPtr Foam::entry* Foam::dictionary::lookupEntryPtr ( const word& keyword, - bool recursive + bool recursive, + bool wildCardMatch ) { HashTable<entry*>::iterator iter = hashedEntries_.find(keyword); if (iter == hashedEntries_.end()) { + if (wildCardMatch && wildCardEntries_.size() > 0) + { + DLList<entry*>::iterator wcLink = + wildCardEntries_.begin(); + DLList<autoPtr<regularExpression> >::iterator reLink = + wildCardRegexps_.begin(); + // Find in wildcards using regular expressions only + if (findInWildcards(wildCardMatch, keyword, wcLink, reLink)) + { + return wcLink(); + } + } + if (recursive && &parent_ != &dictionary::null) { return const_cast<dictionary&>(parent_).lookupEntryPtr ( keyword, - recursive + recursive, + wildCardMatch ); } else @@ -199,16 +335,17 @@ Foam::entry* Foam::dictionary::lookupEntryPtr const Foam::entry& Foam::dictionary::lookupEntry ( const word& keyword, - bool recursive + bool recursive, + bool wildCardMatch ) const { - const entry* entryPtr = lookupEntryPtr(keyword, recursive); + const entry* entryPtr = lookupEntryPtr(keyword, recursive, wildCardMatch); if (entryPtr == NULL) { FatalIOErrorIn ( - "dictionary::lookupEntry(const word& keyword) const", + "dictionary::lookupEntry(const word&, bool, bool) const", *this ) << "keyword " << keyword << " is undefined in dictionary " << name() @@ -222,16 +359,18 @@ const Foam::entry& Foam::dictionary::lookupEntry Foam::ITstream& Foam::dictionary::lookup ( const word& keyword, - bool recursive + bool recursive, + bool wildCardMatch ) const { - return lookupEntry(keyword, recursive).stream(); + return lookupEntry(keyword, recursive, wildCardMatch).stream(); } bool Foam::dictionary::isDict(const word& keyword) const { - const entry* entryPtr = lookupEntryPtr(keyword); + // Find non-recursive with wildcards + const entry* entryPtr = lookupEntryPtr(keyword, false, true); if (entryPtr) { @@ -246,7 +385,7 @@ bool Foam::dictionary::isDict(const word& keyword) const const Foam::dictionary* Foam::dictionary::subDictPtr(const word& keyword) const { - const entry* entryPtr = lookupEntryPtr(keyword); + const entry* entryPtr = lookupEntryPtr(keyword, false, true); if (entryPtr) { @@ -261,7 +400,8 @@ const Foam::dictionary* Foam::dictionary::subDictPtr(const word& keyword) const const Foam::dictionary& Foam::dictionary::subDict(const word& keyword) const { - const entry* entryPtr = lookupEntryPtr(keyword); + const entry* entryPtr = lookupEntryPtr(keyword, false, true); + if (entryPtr == NULL) { FatalIOErrorIn @@ -278,7 +418,8 @@ const Foam::dictionary& Foam::dictionary::subDict(const word& keyword) const Foam::dictionary& Foam::dictionary::subDict(const word& keyword) { - entry* entryPtr = lookupEntryPtr(keyword); + entry* entryPtr = lookupEntryPtr(keyword, false, true); + if (entryPtr == NULL) { FatalIOErrorIn @@ -314,7 +455,10 @@ Foam::wordList Foam::dictionary::toc() const bool Foam::dictionary::add(entry* entryPtr, bool mergeEntry) { - HashTable<entry*>::iterator iter = hashedEntries_.find(entryPtr->keyword()); + HashTable<entry*>::iterator iter = hashedEntries_.find + ( + entryPtr->keyword() + ); if (mergeEntry && iter != hashedEntries_.end()) { @@ -336,6 +480,19 @@ bool Foam::dictionary::add(entry* entryPtr, bool mergeEntry) if (hashedEntries_.insert(entryPtr->keyword(), entryPtr)) { entryPtr->name() = name_ + "::" + entryPtr->keyword(); + + if (entryPtr->keyword().isWildCard()) + { + wildCardEntries_.insert(entryPtr); + wildCardRegexps_.insert + ( + autoPtr<regularExpression> + ( + new regularExpression(entryPtr->keyword()) + ) + ); + } + return true; } else @@ -356,6 +513,18 @@ bool Foam::dictionary::add(entry* entryPtr, bool mergeEntry) entryPtr->name() = name_ + "::" + entryPtr->keyword(); IDLList<entry>::append(entryPtr); + if (entryPtr->keyword().isWildCard()) + { + wildCardEntries_.insert(entryPtr); + wildCardRegexps_.insert + ( + autoPtr<regularExpression> + ( + new regularExpression(entryPtr->keyword()) + ) + ); + } + return true; } else @@ -376,27 +545,37 @@ void Foam::dictionary::add(const entry& e, bool mergeEntry) add(e.clone(*this).ptr(), mergeEntry); } -void Foam::dictionary::add(const word& k, const word& w, bool overwrite) +void Foam::dictionary::add(const keyType& k, const word& w, bool overwrite) { add(new primitiveEntry(k, token(w)), overwrite); } -void Foam::dictionary::add(const word& k, const Foam::string& s, bool overwrite) +void Foam::dictionary::add +( + const keyType& k, + const Foam::string& s, + bool overwrite +) { add(new primitiveEntry(k, token(s)), overwrite); } -void Foam::dictionary::add(const word& k, const label l, bool overwrite) +void Foam::dictionary::add(const keyType& k, const label l, bool overwrite) { add(new primitiveEntry(k, token(l)), overwrite); } -void Foam::dictionary::add(const word& k, const scalar s, bool overwrite) +void Foam::dictionary::add(const keyType& k, const scalar s, bool overwrite) { add(new primitiveEntry(k, token(s)), overwrite); } -void Foam::dictionary::add(const word& k, const dictionary& d, bool mergeEntry) +void Foam::dictionary::add +( + const keyType& k, + const dictionary& d, + bool mergeEntry +) { add(new dictionaryEntry(k, *this, d), mergeEntry); } @@ -404,7 +583,7 @@ void Foam::dictionary::add(const word& k, const dictionary& d, bool mergeEntry) void Foam::dictionary::set(entry* entryPtr) { - entry* existingPtr = lookupEntryPtr(entryPtr->keyword()); + entry* existingPtr = lookupEntryPtr(entryPtr->keyword(), false, true); // clear dictionary so merge acts like overwrite if (existingPtr && existingPtr->isDict()) @@ -420,7 +599,7 @@ void Foam::dictionary::set(const entry& e) set(e.clone(*this).ptr()); } -void Foam::dictionary::set(const word& k, const dictionary& d) +void Foam::dictionary::set(const keyType& k, const dictionary& d) { set(new dictionaryEntry(k, *this, d)); } @@ -432,6 +611,19 @@ bool Foam::dictionary::remove(const word& Keyword) if (iter != hashedEntries_.end()) { + // Delete from wildcards first + DLList<entry*>::iterator wcLink = + wildCardEntries_.begin(); + DLList<autoPtr<regularExpression> >::iterator reLink = + wildCardRegexps_.begin(); + + // Find in wildcards using exact match only + if (findInWildcards(false, Keyword, wcLink, reLink)) + { + wildCardEntries_.remove(wcLink); + wildCardRegexps_.remove(reLink); + } + IDLList<entry>::remove(iter()); delete iter(); hashedEntries_.erase(iter); @@ -447,8 +639,8 @@ bool Foam::dictionary::remove(const word& Keyword) bool Foam::dictionary::changeKeyword ( - const word& oldKeyword, - const word& newKeyword, + const keyType& oldKeyword, + const keyType& newKeyword, bool forceOverwrite ) { @@ -466,6 +658,18 @@ bool Foam::dictionary::changeKeyword return false; } + if (iter()->keyword().isWildCard()) + { + FatalErrorIn + ( + "dictionary::changeKeyword(const word&, const word&, bool)" + ) << "Old keyword "<< oldKeyword + << " is a wildcard." + << "Wildcard replacement not yet implemented." + << exit(FatalError); + } + + HashTable<entry*>::iterator iter2 = hashedEntries_.find(newKeyword); // newKeyword already exists @@ -473,14 +677,33 @@ bool Foam::dictionary::changeKeyword { if (forceOverwrite) { + if (iter2()->keyword().isWildCard()) + { + // Delete from wildcards first + DLList<entry*>::iterator wcLink = + wildCardEntries_.begin(); + DLList<autoPtr<regularExpression> >::iterator reLink = + wildCardRegexps_.begin(); + + // Find in wildcards using exact match only + if (findInWildcards(false, iter2()->keyword(), wcLink, reLink)) + { + wildCardEntries_.remove(wcLink); + wildCardRegexps_.remove(reLink); + } + } + IDLList<entry>::replace(iter2(), iter()); delete iter2(); hashedEntries_.erase(iter2); + } else { - WarningIn("dictionary::changeKeyword(const word&, const word&)") - << "cannot rename keyword "<< oldKeyword + WarningIn + ( + "dictionary::changeKeyword(const word&, const word&, bool)" + ) << "cannot rename keyword "<< oldKeyword << " to existing keyword " << newKeyword << " in dictionary " << name() << endl; return false; @@ -493,6 +716,18 @@ bool Foam::dictionary::changeKeyword hashedEntries_.erase(oldKeyword); hashedEntries_.insert(newKeyword, iter()); + if (newKeyword.isWildCard()) + { + wildCardEntries_.insert(iter()); + wildCardRegexps_.insert + ( + autoPtr<regularExpression> + ( + new regularExpression(newKeyword) + ) + ); + } + return true; } @@ -579,6 +814,7 @@ void Foam::dictionary::operator=(const dictionary& dict) // Create clones of the entries in the given dictionary // resetting the parentDict to this dictionary + for ( IDLList<entry>::const_iterator iter = dict.begin(); @@ -586,17 +822,7 @@ void Foam::dictionary::operator=(const dictionary& dict) ++iter ) { - IDLList<entry>::append(iter().clone(*this).ptr()); - } - - for - ( - IDLList<entry>::iterator iter = begin(); - iter != end(); - ++iter - ) - { - hashedEntries_.insert(iter().keyword(), &iter()); + add(iter().clone(*this).ptr()); } } diff --git a/src/OpenFOAM/db/dictionary/dictionary.H b/src/OpenFOAM/db/dictionary/dictionary.H index 05872cce61d82729ba4da8c3df60775b693de950..ac6ca6538968f56524931d0d6a84e2bf4c1f6370 100644 --- a/src/OpenFOAM/db/dictionary/dictionary.H +++ b/src/OpenFOAM/db/dictionary/dictionary.H @@ -27,7 +27,12 @@ Class Description A list of keyword definitions, which are a keyword followed by any number - of values (e.g. words and numbers). + of values (e.g. words and numbers). The keywords can represent wildcards + which are matched using Posix regular expressions. The general order for + searching is + - exact match + - wildcard match (in reverse order) + - optional recursion into subdictionaries The dictionary class is the base class for IOdictionary. It also serves as a bootstrap dictionary for the objectRegistry data @@ -49,11 +54,13 @@ SourceFiles #include "entry.H" #include "IDLList.H" +#include "DLList.H" #include "fileName.H" #include "ITstream.H" #include "HashTable.H" #include "wordList.H" #include "className.H" +#include "regularExpression.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -80,12 +87,40 @@ class dictionary //- Dictionary name fileName name_; - //- HashTable of the enries held on the DL-list for quick lookup + //- HashTable of the entries held on the DL-list for quick lookup HashTable<entry*> hashedEntries_; //- Parent dictionary const dictionary& parent_; + //- Wildcard entries + DLList<entry*> wildCardEntries_; + + //- Wildcard precompiled regex + DLList<autoPtr<regularExpression> > wildCardRegexps_; + + // Private Member Functions + + //- Search wildcard table either for exact match or for regular + // expression match. + bool findInWildcards + ( + const bool wildCardMatch, + const word& Keyword, + DLList<entry*>::const_iterator& wcLink, + DLList<autoPtr<regularExpression> >::const_iterator& reLink + ) const; + + //- Search wildcard table either for exact match or for regular + // expression match. + bool findInWildcards + ( + const bool wildCardMatch, + const word& Keyword, + DLList<entry*>::iterator& wcLink, + DLList<autoPtr<regularExpression> >::iterator& reLink + ); + public: @@ -181,24 +216,44 @@ public: //- Find and return an entry data stream pointer if present // otherwise return NULL. - // If recursive search parent dictionaries + // If recursive search parent dictionaries. If wildCardMatch + // use wildcards. const entry* lookupEntryPtr ( - const word&, bool recursive=false + const word&, + bool recursive, + bool wildCardMatch ) const; //- Find and return an entry data stream pointer for manipulation // if present otherwise return NULL. - // If recursive search parent dictionaries - entry* lookupEntryPtr(const word&, bool recursive=false); + // If recursive search parent dictionaries. If wildCardMatch + // use wildcards. + entry* lookupEntryPtr + ( + const word&, + bool recursive, + bool wildCardMatch + ); //- Find and return an entry data stream if present otherwise error. - // If recursive search parent dictionaries - const entry& lookupEntry(const word&, bool recursive=false) const; + // If recursive search parent dictionaries. If wildCardMatch + // use wildcards. + const entry& lookupEntry + ( + const word&, + bool recursive, + bool wildCardMatch + ) const; //- Find and return an entry data stream // If recursive search parent dictionaries - ITstream& lookup(const word&, bool recursive=false) const; + ITstream& lookup + ( + const word&, + bool recursive=false, + bool wildCardMatch=true + ) const; //- Find and return a T, // if not found return the given default value @@ -208,7 +263,8 @@ public: ( const word&, const T&, - bool recursive=false + bool recursive=false, + bool wildCardMatch=true ) const; //- Find and return a T, if not found return the given @@ -219,7 +275,8 @@ public: ( const word&, const T&, - bool recursive=false + bool recursive=false, + bool wildCardMatch=true ); //- Find an entry if present, and assign to T @@ -229,7 +286,8 @@ public: ( const word&, T&, - bool recursive=false + bool recursive=false, + bool wildCardMatch=true ) const; //- Check if entry is a sub-dictionary @@ -248,7 +306,6 @@ public: //- Return the table of contents wordList toc() const; - // Editing //- Add a new entry @@ -263,25 +320,25 @@ public: //- Add a word entry // optionally overwrite an existing entry - void add(const word& keyword, const word&, bool overwrite=false); + void add(const keyType&, const word&, bool overwrite=false); //- Add a string entry // optionally overwrite an existing entry - void add(const word& keyword, const string&, bool overwrite=false); + void add(const keyType&, const string&, bool overwrite=false); //- Add a label entry // optionally overwrite an existing entry - void add(const word& keyword, const label, bool overwrite=false); + void add(const keyType&, const label, bool overwrite=false); //- Add a scalar entry // optionally overwrite an existing entry - void add (const word& keyword, const scalar, bool overwrite=false); + void add (const keyType&, const scalar, bool overwrite=false); //- Add a dictionary entry // optionally merge with an existing sub-dictionary void add ( - const word& keyword, + const keyType& keyword, const dictionary&, bool mergeEntry=false ); @@ -289,7 +346,7 @@ public: //- Add a T entry // optionally overwrite an existing entry template<class T> - void add(const word& keyword, const T&, bool overwrite=false); + void add(const keyType& keyword, const T&, bool overwrite=false); //- Assign a new entry, overwrite any existing entry void set(entry*); @@ -298,11 +355,11 @@ public: void set(const entry&); //- Assign a dictionary entry, overwrite any existing entry - void set(const word& keyword, const dictionary&); + void set(const keyType& keyword, const dictionary&); //- Assign a T entry, overwrite any existing entry template<class T> - void set(const word& keyword, const T&); + void set(const keyType& keyword, const T&); //- Remove an entry specified by keyword bool remove(const word& keyword); @@ -311,8 +368,8 @@ public: // optionally forcing overwrite of an existing entry bool changeKeyword ( - const word& oldKeyword, - const word& newKeyword, + const keyType& oldKeyword, + const keyType& newKeyword, bool forceOverwrite = false ); @@ -361,11 +418,13 @@ public: // Global Operators -//- Combine dictionaries starting from the entries in dict1 and then including those from dict2. +//- Combine dictionaries starting from the entries in dict1 and then including +// those from dict2. // Warn, but do not overwrite the entries from dict1. dictionary operator+(const dictionary& dict1, const dictionary& dict2); -//- Combine dictionaries starting from the entries in dict1 and then including those from dict2. +//- Combine dictionaries starting from the entries in dict1 and then including +// those from dict2. // Do not overwrite the entries from dict1. dictionary operator|(const dictionary& dict1, const dictionary& dict2); diff --git a/src/OpenFOAM/db/dictionary/dictionaryEntry/dictionaryEntry.C b/src/OpenFOAM/db/dictionary/dictionaryEntry/dictionaryEntry.C index 9beb835bcb0e301acc27c1fde181dc228ed7db80..6dea21250787246728b1e44c7e3d9d4ce5503278 100644 --- a/src/OpenFOAM/db/dictionary/dictionaryEntry/dictionaryEntry.C +++ b/src/OpenFOAM/db/dictionary/dictionaryEntry/dictionaryEntry.C @@ -30,7 +30,7 @@ License Foam::dictionaryEntry::dictionaryEntry ( - const word& key, + const keyType& key, const dictionary& parentDict, const dictionary& dict ) diff --git a/src/OpenFOAM/db/dictionary/dictionaryEntry/dictionaryEntry.H b/src/OpenFOAM/db/dictionary/dictionaryEntry/dictionaryEntry.H index 2812c1b0bb47efcf73d4b08feaaf3d07bb0c4091..1909f4851ddc4bbdae66a9586965102ef613d7a9 100644 --- a/src/OpenFOAM/db/dictionary/dictionaryEntry/dictionaryEntry.H +++ b/src/OpenFOAM/db/dictionary/dictionaryEntry/dictionaryEntry.H @@ -79,7 +79,7 @@ public: //- Construct from the keyword, parent dictionary and a Istream dictionaryEntry ( - const word& keyword, + const keyType& keyword, const dictionary& parentDict, Istream& is ); @@ -87,7 +87,7 @@ public: //- Construct from the keyword, parent dictionary and a dictionary dictionaryEntry ( - const word& keyword, + const keyType& keyword, const dictionary& parentDict, const dictionary& dict ); diff --git a/src/OpenFOAM/db/dictionary/dictionaryEntry/dictionaryEntryIO.C b/src/OpenFOAM/db/dictionary/dictionaryEntry/dictionaryEntryIO.C index b6c2c2ebceecee7598b3948e7190d871375e8fb4..9cce3eb7de2879926bba9a9d7aa6de2767a3d11a 100644 --- a/src/OpenFOAM/db/dictionary/dictionaryEntry/dictionaryEntryIO.C +++ b/src/OpenFOAM/db/dictionary/dictionaryEntry/dictionaryEntryIO.C @@ -27,7 +27,9 @@ Description \*---------------------------------------------------------------------------*/ +#include "keyType.H" #include "dictionaryEntry.H" +#include "IOstreams.H" // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -43,14 +45,14 @@ Foam::dictionaryEntry::dictionaryEntry is.fatalCheck ( "dictionaryEntry::dictionaryEntry" - "(Istream& is, const dictionary& parentDict)" + "(const dictionary& parentDict, Istream& is)" ); } Foam::dictionaryEntry::dictionaryEntry ( - const word& key, + const keyType& key, const dictionary& parentDict, Istream& is ) @@ -63,7 +65,7 @@ Foam::dictionaryEntry::dictionaryEntry is.fatalCheck ( "dictionaryEntry::dictionaryEntry" - "(const word& keyword, const dictionary& parentDict, Istream& is)" + "(const keyType& keyword, const dictionary& parentDict, Istream& is)" ); } diff --git a/src/OpenFOAM/db/dictionary/dictionaryIO.C b/src/OpenFOAM/db/dictionary/dictionaryIO.C index 53069af0b096b8c83624b3d7c2cb7618f51d9279..b1d5fbcbc452f760e8d7805a4764fdd0e7240fa2 100644 --- a/src/OpenFOAM/db/dictionary/dictionaryIO.C +++ b/src/OpenFOAM/db/dictionary/dictionaryIO.C @@ -71,7 +71,7 @@ bool Foam::dictionary::substituteKeyword(const word& keyword) word varName = keyword(1, keyword.size()-1); // lookup the variable name in the given dictionary.... - const entry* ePtr = lookupEntryPtr(varName, true); + const entry* ePtr = lookupEntryPtr(varName, true, true); // ...if defined insert its entries into this dictionary... if (ePtr != NULL) @@ -137,6 +137,8 @@ Foam::Istream& Foam::operator>>(Istream& is, dictionary& dict) dict.clear(); dict.hashedEntries_.clear(); + dict.wildCardEntries_.clear(); + dict.wildCardRegexps_.clear(); dict.read(is); return is; diff --git a/src/OpenFOAM/db/dictionary/dictionaryTemplates.C b/src/OpenFOAM/db/dictionary/dictionaryTemplates.C index 3dc32a7b51502641bba9b1410f4d5d3874084c0c..a47a97681472c2d47d42b035f7504c9171a5ffa7 100644 --- a/src/OpenFOAM/db/dictionary/dictionaryTemplates.C +++ b/src/OpenFOAM/db/dictionary/dictionaryTemplates.C @@ -34,10 +34,11 @@ T Foam::dictionary::lookupOrDefault ( const word& keyword, const T& deflt, - bool recursive + bool recursive, + bool wildCardMatch ) const { - const entry* entryPtr = lookupEntryPtr(keyword, recursive); + const entry* entryPtr = lookupEntryPtr(keyword, recursive, wildCardMatch); if (entryPtr == NULL) { @@ -55,10 +56,11 @@ T Foam::dictionary::lookupOrAddDefault ( const word& keyword, const T& deflt, - bool recursive + bool recursive, + bool wildCardMatch ) { - const entry* entryPtr = lookupEntryPtr(keyword, recursive); + const entry* entryPtr = lookupEntryPtr(keyword, recursive, wildCardMatch); if (entryPtr == NULL) { @@ -77,10 +79,11 @@ bool Foam::dictionary::readIfPresent ( const word& k, T& val, - bool recursive + bool recursive, + bool wildCardMatch ) const { - const entry* entryPtr = lookupEntryPtr(k, recursive); + const entry* entryPtr = lookupEntryPtr(k, recursive, wildCardMatch); if (entryPtr == NULL) { @@ -95,16 +98,17 @@ bool Foam::dictionary::readIfPresent template<class T> -void Foam::dictionary::add(const word& k, const T& t, bool overwrite) +void Foam::dictionary::add(const keyType& k, const T& t, bool overwrite) { add(new primitiveEntry(k, t), overwrite); } template<class T> -void Foam::dictionary::set(const word& k, const T& t) +void Foam::dictionary::set(const keyType& k, const T& t) { set(new primitiveEntry(k, t)); } + // ************************************************************************* // diff --git a/src/OpenFOAM/db/dictionary/entry/entry.C b/src/OpenFOAM/db/dictionary/entry/entry.C index 93cf677b0b74304e24aa5dc5e56f9fe825422943..54581d869b38a8ff60b554ff445ffabebd5de00f 100644 --- a/src/OpenFOAM/db/dictionary/entry/entry.C +++ b/src/OpenFOAM/db/dictionary/entry/entry.C @@ -30,7 +30,7 @@ License // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::entry::entry(const word& keyword) +Foam::entry::entry(const keyType& keyword) : keyword_(keyword) {} diff --git a/src/OpenFOAM/db/dictionary/entry/entry.H b/src/OpenFOAM/db/dictionary/entry/entry.H index 5afab95b5ad4e69083711f76b58ca404004d61e6..5ed8b929b6993d64db10a3ebce69047bdb83c64f 100644 --- a/src/OpenFOAM/db/dictionary/entry/entry.H +++ b/src/OpenFOAM/db/dictionary/entry/entry.H @@ -42,6 +42,7 @@ SourceFiles #ifndef entry_H #define entry_H +#include "keyType.H" #include "IDLList.H" #include "fileName.H" #include "autoPtr.H" @@ -70,13 +71,13 @@ class entry // Private data //- Keyword of entry - word keyword_; + keyType keyword_; // Private Member Functions //- Get the next valid keyword otherwise return false - static bool getKeyword(word& keyword, Istream& is); + static bool getKeyword(keyType& keyword, Istream& is); public: @@ -84,7 +85,7 @@ public: // Constructors //- Construct from keyword - entry(const word& keyword); + entry(const keyType& keyword); //- Construct as copy entry(const entry&); @@ -116,13 +117,13 @@ public: // Member functions //- Return keyword - const word& keyword() const + const keyType& keyword() const { return keyword_; } //- Return non-const access to keyword - word& keyword() + keyType& keyword() { return keyword_; } diff --git a/src/OpenFOAM/db/dictionary/entry/entryIO.C b/src/OpenFOAM/db/dictionary/entry/entryIO.C index 830c21cf8a7cf759cc6b00a4c10b35a2e961b098..0142b302adcdfb272245bd4d17ab9121c1a7f456 100644 --- a/src/OpenFOAM/db/dictionary/entry/entryIO.C +++ b/src/OpenFOAM/db/dictionary/entry/entryIO.C @@ -32,7 +32,7 @@ License // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -bool Foam::entry::getKeyword(word& keyword, Istream& is) +bool Foam::entry::getKeyword(keyType& keyword, Istream& is) { token keywordToken; @@ -57,6 +57,12 @@ bool Foam::entry::getKeyword(word& keyword, Istream& is) keyword = keywordToken.wordToken(); return true; } + else if (keywordToken.isString()) + { + // Enable wildcards + keyword = keywordToken.stringToken(); + return true; + } // If it is the end of the dictionary or file return false... else if (keywordToken == token::END_BLOCK || is.eof()) { @@ -67,7 +73,7 @@ bool Foam::entry::getKeyword(word& keyword, Istream& is) { cerr<< "--> FOAM Warning : " << std::endl << " From function " - << "entry::getKeyword(word& keyword, Istream& is)" << std::endl + << "entry::getKeyword(keyType& keyword, Istream& is)" << std::endl << " in file " << __FILE__ << " at line " << __LINE__ << std::endl << " Reading " << is.name().c_str() << std::endl @@ -84,7 +90,7 @@ bool Foam::entry::New(dictionary& parentDict, Istream& is) { is.fatalCheck("entry::New(const dictionary& parentDict, Istream& is)"); - word keyword; + keyType keyword; // Get the next keyword and if invalid return false if (!getKeyword(keyword, is)) @@ -115,7 +121,13 @@ bool Foam::entry::New(dictionary& parentDict, Istream& is) // Deal with duplicate entries bool mergeEntry = false; - entry* existingPtr = parentDict.lookupEntryPtr(keyword); + // See (using exact match) if entry already present + entry* existingPtr = parentDict.lookupEntryPtr + ( + keyword, + false, + false + ); if (existingPtr) { if (functionEntries::inputModeEntry::overwrite()) @@ -158,7 +170,7 @@ Foam::autoPtr<Foam::entry> Foam::entry::New(Istream& is) { is.fatalCheck("entry::New(Istream& is)"); - word keyword; + keyType keyword; // Get the next keyword and if invalid return false if (!getKeyword(keyword, is)) diff --git a/src/OpenFOAM/db/dictionary/primitiveEntry/primitiveEntry.C b/src/OpenFOAM/db/dictionary/primitiveEntry/primitiveEntry.C index df888cd064ae85cd61aea636b6dcf33180135fba..bc77cefef3e8afc2b15d334e19f305281eddd1fe 100644 --- a/src/OpenFOAM/db/dictionary/primitiveEntry/primitiveEntry.C +++ b/src/OpenFOAM/db/dictionary/primitiveEntry/primitiveEntry.C @@ -29,7 +29,7 @@ License // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::primitiveEntry::primitiveEntry(const word& key, const ITstream& tokens) +Foam::primitiveEntry::primitiveEntry(const keyType& key, const ITstream& tokens) : entry(key), ITstream(tokens) @@ -38,7 +38,7 @@ Foam::primitiveEntry::primitiveEntry(const word& key, const ITstream& tokens) } -Foam::primitiveEntry::primitiveEntry(const word& keyword, const token& t) +Foam::primitiveEntry::primitiveEntry(const keyType& keyword, const token& t) : entry(keyword), ITstream(keyword, tokenList(1, t)) @@ -47,7 +47,7 @@ Foam::primitiveEntry::primitiveEntry(const word& keyword, const token& t) Foam::primitiveEntry::primitiveEntry ( - const word& keyword, + const keyType& keyword, const tokenList& tokens ) : diff --git a/src/OpenFOAM/db/dictionary/primitiveEntry/primitiveEntry.H b/src/OpenFOAM/db/dictionary/primitiveEntry/primitiveEntry.H index b97452818a3091e457526664789d185871e3cbf3..86d8afd61daad8a3d4a1dce09fabd93fd0f1a75a 100644 --- a/src/OpenFOAM/db/dictionary/primitiveEntry/primitiveEntry.H +++ b/src/OpenFOAM/db/dictionary/primitiveEntry/primitiveEntry.H @@ -108,23 +108,23 @@ public: // Constructors //- Construct from keyword and a Istream - primitiveEntry(const word& keyword, Istream&); + primitiveEntry(const keyType& keyword, Istream&); //- Construct from keyword, parent dictionary and a Istream - primitiveEntry(const word& keyword, const dictionary&, Istream&); + primitiveEntry(const keyType& keyword, const dictionary&, Istream&); //- Construct from keyword and a ITstream - primitiveEntry(const word& keyword, const ITstream&); + primitiveEntry(const keyType& keyword, const ITstream&); //- Construct from keyword and a token - primitiveEntry(const word&, const token&); + primitiveEntry(const keyType&, const token&); //- Construct from keyword and a tokenList - primitiveEntry(const word&, const tokenList&); + primitiveEntry(const keyType&, const tokenList&); //- Construct from keyword and a T template<class T> - primitiveEntry(const word&, const T&); + primitiveEntry(const keyType&, const T&); autoPtr<entry> clone(const dictionary&) const { diff --git a/src/OpenFOAM/db/dictionary/primitiveEntry/primitiveEntryIO.C b/src/OpenFOAM/db/dictionary/primitiveEntry/primitiveEntryIO.C index 10bc3c78c8b9bed0dffa1b947c085cfe9cf58bf1..58cf475303aa3babe486e87773d33311fdbc580d 100644 --- a/src/OpenFOAM/db/dictionary/primitiveEntry/primitiveEntryIO.C +++ b/src/OpenFOAM/db/dictionary/primitiveEntry/primitiveEntryIO.C @@ -81,7 +81,7 @@ bool Foam::primitiveEntry::expandVariable word varName = w(1, w.size()-1); // lookup the variable name in the given dictionary.... - const entry* ePtr = dict.lookupEntryPtr(varName, true); + const entry* ePtr = dict.lookupEntryPtr(varName, true, true); // ...if defined insert its tokens into this if (ePtr != NULL) @@ -218,7 +218,7 @@ void Foam::primitiveEntry::readEntry(const dictionary& dict, Istream& is) Foam::primitiveEntry::primitiveEntry ( - const word& key, + const keyType& key, const dictionary& dict, Istream& is ) @@ -236,7 +236,7 @@ Foam::primitiveEntry::primitiveEntry } -Foam::primitiveEntry::primitiveEntry(const word& key, Istream& is) +Foam::primitiveEntry::primitiveEntry(const keyType& key, Istream& is) : entry(key), ITstream diff --git a/src/OpenFOAM/db/dictionary/primitiveEntry/primitiveEntryTemplates.C b/src/OpenFOAM/db/dictionary/primitiveEntry/primitiveEntryTemplates.C index fce303173be1eb62ca1cf36e495ebdc4ea0c1d62..38e35b054ae4b5e42955ee5ccf6042e44daf9b20 100644 --- a/src/OpenFOAM/db/dictionary/primitiveEntry/primitiveEntryTemplates.C +++ b/src/OpenFOAM/db/dictionary/primitiveEntry/primitiveEntryTemplates.C @@ -30,7 +30,7 @@ License // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template<class T> -Foam::primitiveEntry::primitiveEntry(const word& keyword, const T& t) +Foam::primitiveEntry::primitiveEntry(const keyType& keyword, const T& t) : entry(keyword), ITstream(keyword, tokenList(10)) diff --git a/src/OpenFOAM/primitives/strings/keyType/keyType.H b/src/OpenFOAM/primitives/strings/keyType/keyType.H new file mode 100644 index 0000000000000000000000000000000000000000..4d4c358d5d172f3cb831884246d9411872d0721c --- /dev/null +++ b/src/OpenFOAM/primitives/strings/keyType/keyType.H @@ -0,0 +1,142 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + Foam::keyType + +Description + A class for handling keywords in dictionaries. + + A keyType is the keyword of a dictionary. It differs from word in that + it accepts wildcards. + +SourceFiles + keyType.C + keyTypeIO.C + +\*---------------------------------------------------------------------------*/ + +#ifndef keyType_H +#define keyType_H + +#include "word.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// Forward declaration of classes +class Istream; +class Ostream; + + +/*---------------------------------------------------------------------------*\ + Class keyType Declaration +\*---------------------------------------------------------------------------*/ + +class keyType +: + public word +{ + // Private member data + + bool isWildCard_; + + // Private Member Functions + + //- Disallow assignments where we cannot determine string/word type + void operator=(const std::string&); + +public: + + + // Constructors + + //- Construct null + inline keyType(); + + //- Construct as copy + inline keyType(const keyType& s); + + //- Construct as copy of word + inline keyType(const word& s); + + //- Construct as copy of string. Expect it to be regular expression. + inline keyType(const string& s); + + //- Construct as copy of character array + inline keyType(const char* s); + + //- Construct as copy of std::string + inline keyType(const std::string& s, const bool isWildCard); + + //- Construct from Istream + keyType(Istream& is); + + + // Member functions + + //- Is this character valid for a keyType + inline static bool valid(char c); + + //- Is the type a wildcard? + inline bool isWildCard() const; + + + // Member operators + + // Assignment + + inline void operator=(const keyType& s); + + //- Assign from regular expression. + inline void operator=(const string& s); + + inline void operator=(const word& s); + + inline void operator=(const char*); + + + // IOstream operators + + friend Istream& operator>>(Istream& is, keyType& w); + + friend Ostream& operator<<(Ostream& os, const keyType& w); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "keyTypeI.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/OpenFOAM/primitives/strings/keyType/keyTypeI.H b/src/OpenFOAM/primitives/strings/keyType/keyTypeI.H new file mode 100644 index 0000000000000000000000000000000000000000..f3785ebbffe68b68d0093a79cc55f7e70d2e47c8 --- /dev/null +++ b/src/OpenFOAM/primitives/strings/keyType/keyTypeI.H @@ -0,0 +1,132 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +//- Construct null +inline Foam::keyType::keyType() +: + word(), + isWildCard_(false) +{} + + +//- Construct as copy +inline Foam::keyType::keyType(const keyType& s) +: + word(s, false), + isWildCard_(s.isWildCard()) +{} + + +//- Construct as copy of word +inline Foam::keyType::keyType(const word& s) +: + word(s, false), + isWildCard_(false) +{} + + +//- Construct as copy of string. Expect it to be regular expression +inline Foam::keyType::keyType(const string& s) +: + word(s, false), + isWildCard_(true) +{} + + +//- Construct as copy of character array +inline Foam::keyType::keyType(const char* s) +: + word(s, false), + isWildCard_(false) +{} + + +//- Construct as copy of std::string +inline Foam::keyType::keyType +( + const std::string& s, + const bool isWildCard +) +: + word(s, false), + isWildCard_(isWildCard) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +inline bool Foam::keyType::valid(char c) +{ + return c != '"'; +} + + +bool Foam::keyType::isWildCard() const +{ + return isWildCard_; +} + + +// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // + +inline void Foam::keyType::operator=(const keyType& s) +{ + // Bypass checking + string::operator=(s); + isWildCard_ = s.isWildCard(); +} + + +inline void Foam::keyType::operator=(const word& s) +{ + word::operator=(s); + isWildCard_ = false; +} + + +inline void Foam::keyType::operator=(const string& s) +{ + // Bypass checking + string::operator=(s); + isWildCard_ = true; +} + + +inline void Foam::keyType::operator=(const char* s) +{ + // Bypass checking + string::operator=(s); + isWildCard_ = false; +} + + +// ************************************************************************* // diff --git a/src/OpenFOAM/primitives/strings/keyType/keyTypeIO.C b/src/OpenFOAM/primitives/strings/keyType/keyTypeIO.C new file mode 100644 index 0000000000000000000000000000000000000000..11232282f912a2488fc1e21833ff3dd849e8c956 --- /dev/null +++ b/src/OpenFOAM/primitives/strings/keyType/keyTypeIO.C @@ -0,0 +1,88 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Description + Istream constructor and IOstream operators for word. + +\*---------------------------------------------------------------------------*/ + +#include "keyType.H" +#include "IOstreams.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +Foam::keyType::keyType(Istream& is) +: + word() +{ + is >> *this; +} + + +Foam::Istream& Foam::operator>>(Istream& is, keyType& w) +{ + token t(is); + + if (!t.good()) + { + is.setBad(); + return is; + } + + if (t.isWord()) + { + w = t.wordToken(); + } + else if (t.isString()) + { + // Assign from string. Sets regular expression. + w = t.stringToken(); + } + else + { + is.setBad(); + FatalIOErrorIn("operator>>(Istream&, keyType&)", is) + << "wrong token type - expected word or string found " + << t.info() + << exit(FatalIOError); + + return is; + } + + // Check state of IOstream + is.check("Istream& operator>>(Istream&, keyType&)"); + + return is; +} + + +Foam::Ostream& Foam::operator<<(Ostream& os, const keyType& w) +{ + os.write(w); + os.check("Ostream& operator<<(Ostream&, const keyType&)"); + return os; +} + + +// ************************************************************************* // diff --git a/src/OpenFOAM/primitives/strings/word/word.H b/src/OpenFOAM/primitives/strings/word/word.H index 3e61275164b1fdc735ee9bd15c7cc73df84913db..6565c28b4f8ede3a084ac9c56fc67513e8ac6052 100644 --- a/src/OpenFOAM/primitives/strings/word/word.H +++ b/src/OpenFOAM/primitives/strings/word/word.H @@ -87,16 +87,21 @@ public: inline word(const word&); //- Construct as copy of character array - inline word(const char*); + inline word(const char*, const bool doStripInvalid = true); //- Construct as copy with a maximum number of characters - inline word(const char*, const size_type); + inline word + ( + const char*, + const size_type, + const bool doStripInvalid + ); //- Construct as copy of string - inline word(const string&); + inline word(const string&, const bool doStripInvalid = true); //- Construct as copy of std::string - inline word(const std::string&); + inline word(const std::string&, const bool doStripInvalid = true); //- Construct from Istream word(Istream&); diff --git a/src/OpenFOAM/primitives/strings/word/wordI.H b/src/OpenFOAM/primitives/strings/word/wordI.H index c31208fd7b8584cc7ed27f8ccc7876f2b75ac7da..d71eff2f9aad9a1cc54b9a662b56fedc09be68f0 100644 --- a/src/OpenFOAM/primitives/strings/word/wordI.H +++ b/src/OpenFOAM/primitives/strings/word/wordI.H @@ -65,34 +65,51 @@ inline Foam::word::word() {} -inline Foam::word::word(const string& s) +inline Foam::word::word(const string& s, const bool doStripInvalid) : string(s) { - stripInvalid(); + if (doStripInvalid) + { + stripInvalid(); + } } -inline Foam::word::word(const std::string& s) +inline Foam::word::word(const std::string& s, const bool doStripInvalid) : string(s) { - stripInvalid(); + if (doStripInvalid) + { + stripInvalid(); + } } -inline Foam::word::word(const char* s) +inline Foam::word::word(const char* s, const bool doStripInvalid) : string(s) { - stripInvalid(); + if (doStripInvalid) + { + stripInvalid(); + } } -inline Foam::word::word(const char* s, const size_type n) +inline Foam::word::word +( + const char* s, + const size_type n, + const bool doStripInvalid +) : string(s, n) { - stripInvalid(); + if (doStripInvalid) + { + stripInvalid(); + } } diff --git a/src/autoMesh/autoHexMesh/refinementSurfaces/refinementSurfaces.C b/src/autoMesh/autoHexMesh/refinementSurfaces/refinementSurfaces.C index 9629b53bdc133c7d8f364f5e82af274b3e46771a..5f5d89c29a75b55c160584cc38607be77b50cab9 100644 --- a/src/autoMesh/autoHexMesh/refinementSurfaces/refinementSurfaces.C +++ b/src/autoMesh/autoHexMesh/refinementSurfaces/refinementSurfaces.C @@ -826,6 +826,19 @@ void Foam::refinementSurfaces::findNearestIntersection } } } + + + // Make sure that if hit1 has hit something, hit2 will have at least the + // same point (due to tolerances it might miss its end point) + forAll(hit1, pointI) + { + if (hit1[pointI].hit() && !hit2[pointI].hit()) + { + hit2[pointI] = hit1[pointI]; + surface2[pointI] = surface1[pointI]; + region2[pointI] = region1[pointI]; + } + } } diff --git a/src/thermophysicalModels/barotropicCompressibilityModel/Chung/Chung.C b/src/thermophysicalModels/barotropicCompressibilityModel/Chung/Chung.C index 36df9e74005fa0e5ea7d9c52d28f515c4c26f4f6..7e6caf6ad94cd62a03752f0e241fc5311769a4f6 100644 --- a/src/thermophysicalModels/barotropicCompressibilityModel/Chung/Chung.C +++ b/src/thermophysicalModels/barotropicCompressibilityModel/Chung/Chung.C @@ -31,13 +31,16 @@ License namespace Foam { -namespace compressibilityModels -{ - -defineTypeNameAndDebug(Chung, 0); -addToRunTimeSelectionTable(barotropicCompressibilityModel, Chung, dictionary); - -} + namespace compressibilityModels + { + defineTypeNameAndDebug(Chung, 0); + addToRunTimeSelectionTable + ( + barotropicCompressibilityModel, + Chung, + dictionary + ); + } } // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -45,10 +48,11 @@ addToRunTimeSelectionTable(barotropicCompressibilityModel, Chung, dictionary); Foam::compressibilityModels::Chung::Chung ( const dictionary& compressibilityProperties, - const volScalarField& gamma + const volScalarField& gamma, + const word& psiName ) : - barotropicCompressibilityModel(compressibilityProperties, gamma), + barotropicCompressibilityModel(compressibilityProperties, gamma, psiName), psiv_(compressibilityProperties_.lookup("psiv")), psil_(compressibilityProperties_.lookup("psil")), rhovSat_(compressibilityProperties_.lookup("rhovSat")), diff --git a/src/thermophysicalModels/barotropicCompressibilityModel/Chung/Chung.H b/src/thermophysicalModels/barotropicCompressibilityModel/Chung/Chung.H index 56419ecbe991dea9362686938fa977c42a4b2521..97da534bcda62bf57f8a664f670b947edae5107d 100644 --- a/src/thermophysicalModels/barotropicCompressibilityModel/Chung/Chung.H +++ b/src/thermophysicalModels/barotropicCompressibilityModel/Chung/Chung.H @@ -75,7 +75,8 @@ public: Chung ( const dictionary& compressibilityProperties, - const volScalarField& gamma + const volScalarField& gamma, + const word& psiName = "psi" ); diff --git a/src/thermophysicalModels/barotropicCompressibilityModel/Wallis/Wallis.C b/src/thermophysicalModels/barotropicCompressibilityModel/Wallis/Wallis.C index 5c7e7f753f733a458ab5e8d7317ca9e336cd9c87..2e497b314c06ebae2a565073ae925a0ef46a2444 100644 --- a/src/thermophysicalModels/barotropicCompressibilityModel/Wallis/Wallis.C +++ b/src/thermophysicalModels/barotropicCompressibilityModel/Wallis/Wallis.C @@ -31,13 +31,16 @@ License namespace Foam { -namespace compressibilityModels -{ - -defineTypeNameAndDebug(Wallis, 0); -addToRunTimeSelectionTable(barotropicCompressibilityModel, Wallis, dictionary); - -} + namespace compressibilityModels + { + defineTypeNameAndDebug(Wallis, 0); + addToRunTimeSelectionTable + ( + barotropicCompressibilityModel, + Wallis, + dictionary + ); + } } // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -45,10 +48,11 @@ addToRunTimeSelectionTable(barotropicCompressibilityModel, Wallis, dictionary); Foam::compressibilityModels::Wallis::Wallis ( const dictionary& compressibilityProperties, - const volScalarField& gamma + const volScalarField& gamma, + const word& psiName ) : - barotropicCompressibilityModel(compressibilityProperties, gamma), + barotropicCompressibilityModel(compressibilityProperties, gamma, psiName), psiv_(compressibilityProperties_.lookup("psiv")), psil_(compressibilityProperties_.lookup("psil")), rhovSat_(compressibilityProperties_.lookup("rhovSat")), @@ -62,8 +66,9 @@ Foam::compressibilityModels::Wallis::Wallis void Foam::compressibilityModels::Wallis::correct() { - psi_ = (gamma_*rhovSat_ + (scalar(1) - gamma_)*rholSat_) - *(gamma_*psiv_/rhovSat_ + (scalar(1) - gamma_)*psil_/rholSat_); + psi_ = + (gamma_*rhovSat_ + (scalar(1) - gamma_)*rholSat_) + *(gamma_*psiv_/rhovSat_ + (scalar(1) - gamma_)*psil_/rholSat_); } diff --git a/src/thermophysicalModels/barotropicCompressibilityModel/Wallis/Wallis.H b/src/thermophysicalModels/barotropicCompressibilityModel/Wallis/Wallis.H index 71f4db027428d6996c9383ecb6c4e7dd1d534d94..27c69c899f4cd19157f048f729a35cc2e0e8cd48 100644 --- a/src/thermophysicalModels/barotropicCompressibilityModel/Wallis/Wallis.H +++ b/src/thermophysicalModels/barotropicCompressibilityModel/Wallis/Wallis.H @@ -75,7 +75,8 @@ public: Wallis ( const dictionary& compressibilityProperties, - const volScalarField& gamma + const volScalarField& gamma, + const word& psiName = "psi" ); diff --git a/src/thermophysicalModels/barotropicCompressibilityModel/barotropicCompressibilityModel/barotropicCompressibilityModel.C b/src/thermophysicalModels/barotropicCompressibilityModel/barotropicCompressibilityModel/barotropicCompressibilityModel.C index 21706f524a55b29ac26b94cc061a52537cd7155d..eeb7a8484d48c7dd2185d8d5de035a7c53c8a013 100644 --- a/src/thermophysicalModels/barotropicCompressibilityModel/barotropicCompressibilityModel/barotropicCompressibilityModel.C +++ b/src/thermophysicalModels/barotropicCompressibilityModel/barotropicCompressibilityModel/barotropicCompressibilityModel.C @@ -42,7 +42,8 @@ namespace Foam Foam::barotropicCompressibilityModel::barotropicCompressibilityModel ( const dictionary& compressibilityProperties, - const volScalarField& gamma + const volScalarField& gamma, + const word& psiName ) : compressibilityProperties_(compressibilityProperties), @@ -50,12 +51,12 @@ Foam::barotropicCompressibilityModel::barotropicCompressibilityModel ( IOobject ( - "psi", + psiName, gamma.mesh().time().timeName(), gamma.mesh() ), gamma.mesh(), - dimensionedScalar("psi", dimensionSet(0, -2, 2, 0, 0), 0) + dimensionedScalar(psiName, dimensionSet(0, -2, 2, 0, 0), 0) ), gamma_(gamma) {} diff --git a/src/thermophysicalModels/barotropicCompressibilityModel/barotropicCompressibilityModel/barotropicCompressibilityModel.H b/src/thermophysicalModels/barotropicCompressibilityModel/barotropicCompressibilityModel/barotropicCompressibilityModel.H index 71b5e5d423c9b872c9f619786ae96319413b8882..776df971d871085d7456c30c90481cd7f89f5125 100644 --- a/src/thermophysicalModels/barotropicCompressibilityModel/barotropicCompressibilityModel/barotropicCompressibilityModel.H +++ b/src/thermophysicalModels/barotropicCompressibilityModel/barotropicCompressibilityModel/barotropicCompressibilityModel.H @@ -97,9 +97,10 @@ public: dictionary, ( const dictionary& compressibilityProperties, - const volScalarField& gamma + const volScalarField& gamma, + const word& psiName ), - (compressibilityProperties, gamma) + (compressibilityProperties, gamma, psiName) ); @@ -109,7 +110,8 @@ public: static autoPtr<barotropicCompressibilityModel> New ( const dictionary& compressibilityProperties, - const volScalarField& gamma + const volScalarField& gamma, + const word& psiName = "psi" ); @@ -119,7 +121,8 @@ public: barotropicCompressibilityModel ( const dictionary& compressibilityProperties, - const volScalarField& gamma + const volScalarField& gamma, + const word& psiName = "psi" ); diff --git a/src/thermophysicalModels/barotropicCompressibilityModel/barotropicCompressibilityModel/newBarotropicCompressibilityModel.C b/src/thermophysicalModels/barotropicCompressibilityModel/barotropicCompressibilityModel/newBarotropicCompressibilityModel.C index 83db0208f58d58f431ad2526c7d20c0d51f8931e..ea38016be6d20c8ac43cd55f6dac4d1aa4c7467b 100644 --- a/src/thermophysicalModels/barotropicCompressibilityModel/barotropicCompressibilityModel/newBarotropicCompressibilityModel.C +++ b/src/thermophysicalModels/barotropicCompressibilityModel/barotropicCompressibilityModel/newBarotropicCompressibilityModel.C @@ -32,7 +32,8 @@ Foam::autoPtr<Foam::barotropicCompressibilityModel> Foam::barotropicCompressibilityModel::New ( const dictionary& compressibilityProperties, - const volScalarField& gamma + const volScalarField& gamma, + const word& psiName ) { word bcModelTypeName @@ -60,7 +61,7 @@ Foam::barotropicCompressibilityModel::New return autoPtr<barotropicCompressibilityModel> ( - cstrIter()(compressibilityProperties, gamma) + cstrIter()(compressibilityProperties, gamma, psiName) ); } diff --git a/src/thermophysicalModels/barotropicCompressibilityModel/linear/linear.C b/src/thermophysicalModels/barotropicCompressibilityModel/linear/linear.C index dbf584d4c939a0928d7a46061031ccc99cfb35dd..3daf0dd37d9a1c425b30c81e53d3e461ead2459e 100644 --- a/src/thermophysicalModels/barotropicCompressibilityModel/linear/linear.C +++ b/src/thermophysicalModels/barotropicCompressibilityModel/linear/linear.C @@ -31,13 +31,16 @@ License namespace Foam { -namespace compressibilityModels -{ - -defineTypeNameAndDebug(linear, 0); -addToRunTimeSelectionTable(barotropicCompressibilityModel, linear, dictionary); - -} + namespace compressibilityModels + { + defineTypeNameAndDebug(linear, 0); + addToRunTimeSelectionTable + ( + barotropicCompressibilityModel, + linear, + dictionary + ); + } } // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -45,10 +48,11 @@ addToRunTimeSelectionTable(barotropicCompressibilityModel, linear, dictionary); Foam::compressibilityModels::linear::linear ( const dictionary& compressibilityProperties, - const volScalarField& gamma + const volScalarField& gamma, + const word& psiName ) : - barotropicCompressibilityModel(compressibilityProperties, gamma), + barotropicCompressibilityModel(compressibilityProperties, gamma, psiName), psiv_(compressibilityProperties_.lookup("psiv")), psil_(compressibilityProperties_.lookup("psil")) { diff --git a/src/thermophysicalModels/barotropicCompressibilityModel/linear/linear.H b/src/thermophysicalModels/barotropicCompressibilityModel/linear/linear.H index 2162f0b9fd46f3fb9390347685a3c3e11680f6b6..cc83a8cbe4c99ee4aba36484ec58f7be85a1f9ee 100644 --- a/src/thermophysicalModels/barotropicCompressibilityModel/linear/linear.H +++ b/src/thermophysicalModels/barotropicCompressibilityModel/linear/linear.H @@ -72,7 +72,8 @@ public: linear ( const dictionary& compressibilityProperties, - const volScalarField& gamma + const volScalarField& gamma, + const word& psiName = "psi" ); diff --git a/src/turbulenceModels/LES/compressible/Make/files b/src/turbulenceModels/LES/compressible/Make/files index 06e7b76d4512f94bb16c8c2fca3ca50270fd4ebe..dc31f55cae3e86d6e502de718939006c26372208 100644 --- a/src/turbulenceModels/LES/compressible/Make/files +++ b/src/turbulenceModels/LES/compressible/Make/files @@ -14,6 +14,6 @@ SpalartAllmaras/SpalartAllmaras.C wallFunctions=derivedFvPatchFields/wallFunctions muSgsWallFunctions=$(wallFunctions)/muSgsWallFunctions -$(muSgsWallFunctions)/muSgsWallFunction/muSgsWallFunctionFvPatchScalarField.C +$(muSgsWallFunctions)/muSgsSpalartAllmarasWallFunction/muSgsSpalartAllmarasWallFunctionFvPatchScalarField.C LIB = $(FOAM_LIBBIN)/libcompressibleLESModels diff --git a/src/turbulenceModels/LES/compressible/derivedFvPatchFields/wallFunctions/muSgsWallFunctions/muSgsWallFunction/muSgsWallFunctionFvPatchScalarField.C b/src/turbulenceModels/LES/compressible/derivedFvPatchFields/wallFunctions/muSgsWallFunctions/muSgsSpalartAllmarasWallFunction/muSgsSpalartAllmarasWallFunctionFvPatchScalarField.C similarity index 81% rename from src/turbulenceModels/LES/compressible/derivedFvPatchFields/wallFunctions/muSgsWallFunctions/muSgsWallFunction/muSgsWallFunctionFvPatchScalarField.C rename to src/turbulenceModels/LES/compressible/derivedFvPatchFields/wallFunctions/muSgsWallFunctions/muSgsSpalartAllmarasWallFunction/muSgsSpalartAllmarasWallFunctionFvPatchScalarField.C index fb493237bf529a236192d40faa990b7aefd8a642..e210c32c730e46e1c51eafe64f9b67d9287d96d4 100644 --- a/src/turbulenceModels/LES/compressible/derivedFvPatchFields/wallFunctions/muSgsWallFunctions/muSgsWallFunction/muSgsWallFunctionFvPatchScalarField.C +++ b/src/turbulenceModels/LES/compressible/derivedFvPatchFields/wallFunctions/muSgsWallFunctions/muSgsSpalartAllmarasWallFunction/muSgsSpalartAllmarasWallFunctionFvPatchScalarField.C @@ -24,7 +24,7 @@ License \*---------------------------------------------------------------------------*/ -#include "muSgsWallFunctionFvPatchScalarField.H" +#include "muSgsSpalartAllmarasWallFunctionFvPatchScalarField.H" #include "LESModel.H" #include "fvPatchFieldMapper.H" #include "volFields.H" @@ -41,7 +41,8 @@ namespace LESModels // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -muSgsWallFunctionFvPatchScalarField::muSgsWallFunctionFvPatchScalarField +muSgsSpalartAllmarasWallFunctionFvPatchScalarField:: +muSgsSpalartAllmarasWallFunctionFvPatchScalarField ( const fvPatch& p, const DimensionedField<scalar, volMesh>& iF @@ -51,9 +52,10 @@ muSgsWallFunctionFvPatchScalarField::muSgsWallFunctionFvPatchScalarField {} -muSgsWallFunctionFvPatchScalarField::muSgsWallFunctionFvPatchScalarField +muSgsSpalartAllmarasWallFunctionFvPatchScalarField:: +muSgsSpalartAllmarasWallFunctionFvPatchScalarField ( - const muSgsWallFunctionFvPatchScalarField& ptf, + const muSgsSpalartAllmarasWallFunctionFvPatchScalarField& ptf, const fvPatch& p, const DimensionedField<scalar, volMesh>& iF, const fvPatchFieldMapper& mapper @@ -63,7 +65,8 @@ muSgsWallFunctionFvPatchScalarField::muSgsWallFunctionFvPatchScalarField {} -muSgsWallFunctionFvPatchScalarField::muSgsWallFunctionFvPatchScalarField +muSgsSpalartAllmarasWallFunctionFvPatchScalarField:: +muSgsSpalartAllmarasWallFunctionFvPatchScalarField ( const fvPatch& p, const DimensionedField<scalar, volMesh>& iF, @@ -74,7 +77,8 @@ muSgsWallFunctionFvPatchScalarField::muSgsWallFunctionFvPatchScalarField {} -muSgsWallFunctionFvPatchScalarField::muSgsWallFunctionFvPatchScalarField +muSgsSpalartAllmarasWallFunctionFvPatchScalarField:: +muSgsSpalartAllmarasWallFunctionFvPatchScalarField ( const fvPatch& p, const DimensionedField<scalar, volMesh>& iF, @@ -85,18 +89,20 @@ muSgsWallFunctionFvPatchScalarField::muSgsWallFunctionFvPatchScalarField {} -muSgsWallFunctionFvPatchScalarField::muSgsWallFunctionFvPatchScalarField +muSgsSpalartAllmarasWallFunctionFvPatchScalarField:: +muSgsSpalartAllmarasWallFunctionFvPatchScalarField ( - const muSgsWallFunctionFvPatchScalarField& tppsf + const muSgsSpalartAllmarasWallFunctionFvPatchScalarField& tppsf ) : fixedValueFvPatchScalarField(tppsf) {} -muSgsWallFunctionFvPatchScalarField::muSgsWallFunctionFvPatchScalarField +muSgsSpalartAllmarasWallFunctionFvPatchScalarField:: +muSgsSpalartAllmarasWallFunctionFvPatchScalarField ( - const muSgsWallFunctionFvPatchScalarField& tppsf, + const muSgsSpalartAllmarasWallFunctionFvPatchScalarField& tppsf, const DimensionedField<scalar, volMesh>& iF ) : @@ -106,7 +112,7 @@ muSgsWallFunctionFvPatchScalarField::muSgsWallFunctionFvPatchScalarField // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -void muSgsWallFunctionFvPatchScalarField::evaluate +void muSgsSpalartAllmarasWallFunctionFvPatchScalarField::evaluate ( const Pstream::commsTypes ) @@ -184,7 +190,11 @@ void muSgsWallFunctionFvPatchScalarField::evaluate // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -makePatchTypeField(fvPatchScalarField, muSgsWallFunctionFvPatchScalarField); +makePatchTypeField +( + fvPatchScalarField, + muSgsSpalartAllmarasWallFunctionFvPatchScalarField +); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/turbulenceModels/LES/compressible/derivedFvPatchFields/wallFunctions/muSgsWallFunctions/muSgsWallFunction/muSgsWallFunctionFvPatchScalarField.H b/src/turbulenceModels/LES/compressible/derivedFvPatchFields/wallFunctions/muSgsWallFunctions/muSgsSpalartAllmarasWallFunction/muSgsSpalartAllmarasWallFunctionFvPatchScalarField.H similarity index 72% rename from src/turbulenceModels/LES/compressible/derivedFvPatchFields/wallFunctions/muSgsWallFunctions/muSgsWallFunction/muSgsWallFunctionFvPatchScalarField.H rename to src/turbulenceModels/LES/compressible/derivedFvPatchFields/wallFunctions/muSgsWallFunctions/muSgsSpalartAllmarasWallFunction/muSgsSpalartAllmarasWallFunctionFvPatchScalarField.H index 76f6aca405667ac3527f7fb28cebf54d2cdf5f4d..9d3210c1d41d280cd2a4b0022f8e92de8786dd6b 100644 --- a/src/turbulenceModels/LES/compressible/derivedFvPatchFields/wallFunctions/muSgsWallFunctions/muSgsWallFunction/muSgsWallFunctionFvPatchScalarField.H +++ b/src/turbulenceModels/LES/compressible/derivedFvPatchFields/wallFunctions/muSgsWallFunctions/muSgsSpalartAllmarasWallFunction/muSgsSpalartAllmarasWallFunctionFvPatchScalarField.H @@ -23,18 +23,19 @@ License Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Class - Foam::compressible::LESModels::muSgsWallFunctionFvPatchScalarField + Foam::compressible::LESModels:: + muSgsSpalartAllmarasWallFunctionFvPatchScalarField Description - wall function boundary condition for compressible flows + Spalart Allmaas wall function boundary condition for compressible flows SourceFiles - muSgsWallFunctionFvPatchScalarField.C + muSgsSpalartAllmarasWallFunctionFvPatchScalarField.C \*---------------------------------------------------------------------------*/ -#ifndef muSgsWallFunctionFvPatchScalarField_H -#define muSgsWallFunctionFvPatchScalarField_H +#ifndef muSgsSpalartAllmarasWallFunctionFvPatchScalarField_H +#define muSgsSpalartAllmarasWallFunctionFvPatchScalarField_H #include "fixedValueFvPatchFields.H" @@ -48,10 +49,10 @@ namespace LESModels { /*---------------------------------------------------------------------------*\ - Class muSgsWallFunctionFvPatch Declaration + Class muSgsSpalartAllmarasWallFunctionFvPatchScalarField Declaration \*---------------------------------------------------------------------------*/ -class muSgsWallFunctionFvPatchScalarField +class muSgsSpalartAllmarasWallFunctionFvPatchScalarField : public fixedValueFvPatchScalarField { @@ -61,20 +62,20 @@ class muSgsWallFunctionFvPatchScalarField public: //- Runtime type information - TypeName("muSgsWallFunction"); + TypeName("muSgsSpalartAllmarasWallFunction"); // Constructors //- Construct from patch and internal field - muSgsWallFunctionFvPatchScalarField + muSgsSpalartAllmarasWallFunctionFvPatchScalarField ( const fvPatch&, const DimensionedField<scalar, volMesh>& ); //- Construct from patch, internal field and Istream - muSgsWallFunctionFvPatchScalarField + muSgsSpalartAllmarasWallFunctionFvPatchScalarField ( const fvPatch&, const DimensionedField<scalar, volMesh>&, @@ -82,27 +83,28 @@ public: ); //- Construct from patch, internal field and dictionary - muSgsWallFunctionFvPatchScalarField + muSgsSpalartAllmarasWallFunctionFvPatchScalarField ( const fvPatch&, const DimensionedField<scalar, volMesh>&, const dictionary& ); - //- Construct by mapping given muSgsWallFunctionFvPatchScalarField + //- Construct by mapping given + // muSgsSpalartAllmarasWallFunctionFvPatchScalarField // onto a new patch - muSgsWallFunctionFvPatchScalarField + muSgsSpalartAllmarasWallFunctionFvPatchScalarField ( - const muSgsWallFunctionFvPatchScalarField&, + const muSgsSpalartAllmarasWallFunctionFvPatchScalarField&, const fvPatch&, const DimensionedField<scalar, volMesh>&, const fvPatchFieldMapper& ); //- Construct as copy - muSgsWallFunctionFvPatchScalarField + muSgsSpalartAllmarasWallFunctionFvPatchScalarField ( - const muSgsWallFunctionFvPatchScalarField& + const muSgsSpalartAllmarasWallFunctionFvPatchScalarField& ); //- Construct and return a clone @@ -110,14 +112,14 @@ public: { return tmp<fvPatchScalarField> ( - new muSgsWallFunctionFvPatchScalarField(*this) + new muSgsSpalartAllmarasWallFunctionFvPatchScalarField(*this) ); } //- Construct as copy setting internal field reference - muSgsWallFunctionFvPatchScalarField + muSgsSpalartAllmarasWallFunctionFvPatchScalarField ( - const muSgsWallFunctionFvPatchScalarField&, + const muSgsSpalartAllmarasWallFunctionFvPatchScalarField&, const DimensionedField<scalar, volMesh>& ); @@ -129,7 +131,11 @@ public: { return tmp<fvPatchScalarField> ( - new muSgsWallFunctionFvPatchScalarField(*this, iF) + new muSgsSpalartAllmarasWallFunctionFvPatchScalarField + ( + *this, + iF + ) ); } diff --git a/src/turbulenceModels/LES/incompressible/Make/files b/src/turbulenceModels/LES/incompressible/Make/files index 0661520a6c7ab9da20eb4a9f80d55e1f7bf143a3..796bbee6a0070d16a9464befb7a318d71a676899 100644 --- a/src/turbulenceModels/LES/incompressible/Make/files +++ b/src/turbulenceModels/LES/incompressible/Make/files @@ -29,7 +29,7 @@ dynMixedSmagorinsky/dynMixedSmagorinsky.C wallFunctions=derivedFvPatchFields/wallFunctions nuSgsWallFunctions=$(wallFunctions)/nuSgsWallFunctions -$(nuSgsWallFunctions)/nuSgsWallFunction/nuSgsWallFunctionFvPatchScalarField.C +$(nuSgsWallFunctions)/nuSgsSpalartAllmarasWallFunction/nuSgsSpalartAllmarasWallFunctionFvPatchScalarField.C LIB = $(FOAM_LIBBIN)/libincompressibleLESModels diff --git a/src/turbulenceModels/LES/incompressible/derivedFvPatchFields/wallFunctions/nuSgsWallFunctions/nuSgsWallFunction/nuSgsWallFunctionFvPatchScalarField.C b/src/turbulenceModels/LES/incompressible/derivedFvPatchFields/wallFunctions/nuSgsWallFunctions/nuSgsSpalartAllmarasWallFunction/nuSgsSpalartAllmarasWallFunctionFvPatchScalarField.C similarity index 81% rename from src/turbulenceModels/LES/incompressible/derivedFvPatchFields/wallFunctions/nuSgsWallFunctions/nuSgsWallFunction/nuSgsWallFunctionFvPatchScalarField.C rename to src/turbulenceModels/LES/incompressible/derivedFvPatchFields/wallFunctions/nuSgsWallFunctions/nuSgsSpalartAllmarasWallFunction/nuSgsSpalartAllmarasWallFunctionFvPatchScalarField.C index d7be3cf9f0dd75170373026df325589bf7f6a88c..ab02061c5d29eb93dd1953fde247ef48e313a8d2 100644 --- a/src/turbulenceModels/LES/incompressible/derivedFvPatchFields/wallFunctions/nuSgsWallFunctions/nuSgsWallFunction/nuSgsWallFunctionFvPatchScalarField.C +++ b/src/turbulenceModels/LES/incompressible/derivedFvPatchFields/wallFunctions/nuSgsWallFunctions/nuSgsSpalartAllmarasWallFunction/nuSgsSpalartAllmarasWallFunctionFvPatchScalarField.C @@ -24,7 +24,7 @@ License \*---------------------------------------------------------------------------*/ -#include "nuSgsWallFunctionFvPatchScalarField.H" +#include "nuSgsSpalartAllmarasWallFunctionFvPatchScalarField.H" #include "LESModel.H" #include "fvPatchFieldMapper.H" #include "volFields.H" @@ -41,7 +41,8 @@ namespace LESModels // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -nuSgsWallFunctionFvPatchScalarField::nuSgsWallFunctionFvPatchScalarField +nuSgsSpalartAllmarasWallFunctionFvPatchScalarField:: +nuSgsSpalartAllmarasWallFunctionFvPatchScalarField ( const fvPatch& p, const DimensionedField<scalar, volMesh>& iF @@ -51,9 +52,10 @@ nuSgsWallFunctionFvPatchScalarField::nuSgsWallFunctionFvPatchScalarField {} -nuSgsWallFunctionFvPatchScalarField::nuSgsWallFunctionFvPatchScalarField +nuSgsSpalartAllmarasWallFunctionFvPatchScalarField:: +nuSgsSpalartAllmarasWallFunctionFvPatchScalarField ( - const nuSgsWallFunctionFvPatchScalarField& ptf, + const nuSgsSpalartAllmarasWallFunctionFvPatchScalarField& ptf, const fvPatch& p, const DimensionedField<scalar, volMesh>& iF, const fvPatchFieldMapper& mapper @@ -63,7 +65,8 @@ nuSgsWallFunctionFvPatchScalarField::nuSgsWallFunctionFvPatchScalarField {} -nuSgsWallFunctionFvPatchScalarField::nuSgsWallFunctionFvPatchScalarField +nuSgsSpalartAllmarasWallFunctionFvPatchScalarField:: +nuSgsSpalartAllmarasWallFunctionFvPatchScalarField ( const fvPatch& p, const DimensionedField<scalar, volMesh>& iF, @@ -74,18 +77,20 @@ nuSgsWallFunctionFvPatchScalarField::nuSgsWallFunctionFvPatchScalarField {} -nuSgsWallFunctionFvPatchScalarField::nuSgsWallFunctionFvPatchScalarField +nuSgsSpalartAllmarasWallFunctionFvPatchScalarField:: +nuSgsSpalartAllmarasWallFunctionFvPatchScalarField ( - const nuSgsWallFunctionFvPatchScalarField& tppsf + const nuSgsSpalartAllmarasWallFunctionFvPatchScalarField& tppsf ) : fixedValueFvPatchScalarField(tppsf) {} -nuSgsWallFunctionFvPatchScalarField::nuSgsWallFunctionFvPatchScalarField +nuSgsSpalartAllmarasWallFunctionFvPatchScalarField:: +nuSgsSpalartAllmarasWallFunctionFvPatchScalarField ( - const nuSgsWallFunctionFvPatchScalarField& tppsf, + const nuSgsSpalartAllmarasWallFunctionFvPatchScalarField& tppsf, const DimensionedField<scalar, volMesh>& iF ) : @@ -95,7 +100,7 @@ nuSgsWallFunctionFvPatchScalarField::nuSgsWallFunctionFvPatchScalarField // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -void nuSgsWallFunctionFvPatchScalarField::evaluate +void nuSgsSpalartAllmarasWallFunctionFvPatchScalarField::evaluate ( const Pstream::commsTypes ) @@ -166,7 +171,11 @@ void nuSgsWallFunctionFvPatchScalarField::evaluate // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -makePatchTypeField(fvPatchScalarField, nuSgsWallFunctionFvPatchScalarField); +makePatchTypeField +( + fvPatchScalarField, + nuSgsSpalartAllmarasWallFunctionFvPatchScalarField +); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/turbulenceModels/LES/incompressible/derivedFvPatchFields/wallFunctions/nuSgsWallFunctions/nuSgsWallFunction/nuSgsWallFunctionFvPatchScalarField.H b/src/turbulenceModels/LES/incompressible/derivedFvPatchFields/wallFunctions/nuSgsWallFunctions/nuSgsSpalartAllmarasWallFunction/nuSgsSpalartAllmarasWallFunctionFvPatchScalarField.H similarity index 71% rename from src/turbulenceModels/LES/incompressible/derivedFvPatchFields/wallFunctions/nuSgsWallFunctions/nuSgsWallFunction/nuSgsWallFunctionFvPatchScalarField.H rename to src/turbulenceModels/LES/incompressible/derivedFvPatchFields/wallFunctions/nuSgsWallFunctions/nuSgsSpalartAllmarasWallFunction/nuSgsSpalartAllmarasWallFunctionFvPatchScalarField.H index 687e30a6a6f36781eab3ae033ec1f7925aa3be76..ecb1830757e6d5ba29993a4c6480472734813593 100644 --- a/src/turbulenceModels/LES/incompressible/derivedFvPatchFields/wallFunctions/nuSgsWallFunctions/nuSgsWallFunction/nuSgsWallFunctionFvPatchScalarField.H +++ b/src/turbulenceModels/LES/incompressible/derivedFvPatchFields/wallFunctions/nuSgsWallFunctions/nuSgsSpalartAllmarasWallFunction/nuSgsSpalartAllmarasWallFunctionFvPatchScalarField.H @@ -23,18 +23,19 @@ License Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Class - Foam::incompressible::LESModels::nuSgsWallFunctionFvPatchScalarField + Foam::incompressible::LESModels:: + nuSgsSpalartAllmarasWallFunctionFvPatchScalarField Description - wall function boundary condition for incompressible flows + Spalart Allmaras wall function boundary condition for incompressible flows SourceFiles - nuSgsWallFunctionFvPatchScalarField.C + nuSgsSpalartAllmarasWallFunctionFvPatchScalarField.C \*---------------------------------------------------------------------------*/ -#ifndef nuSgsWallFunctionFvPatchScalarField_H -#define nuSgsWallFunctionFvPatchScalarField_H +#ifndef nuSgsSpalartAllmarasWallFunctionFvPatchScalarField_H +#define nuSgsSpalartAllmarasWallFunctionFvPatchScalarField_H #include "fixedValueFvPatchFields.H" @@ -48,10 +49,10 @@ namespace LESModels { /*---------------------------------------------------------------------------*\ - Class nuSgsWallFunctionFvPatch Declaration + Class nuSgsSpalartAllmarasWallFunctionFvPatchScalarField Declaration \*---------------------------------------------------------------------------*/ -class nuSgsWallFunctionFvPatchScalarField +class nuSgsSpalartAllmarasWallFunctionFvPatchScalarField : public fixedValueFvPatchScalarField { @@ -61,40 +62,41 @@ class nuSgsWallFunctionFvPatchScalarField public: //- Runtime type information - TypeName("nuSgsWallFunction"); + TypeName("nuSgsSpalartAllmarasWallFunction"); // Constructors //- Construct from patch and internal field - nuSgsWallFunctionFvPatchScalarField + nuSgsSpalartAllmarasWallFunctionFvPatchScalarField ( const fvPatch&, const DimensionedField<scalar, volMesh>& ); //- Construct from patch, internal field and dictionary - nuSgsWallFunctionFvPatchScalarField + nuSgsSpalartAllmarasWallFunctionFvPatchScalarField ( const fvPatch&, const DimensionedField<scalar, volMesh>&, const dictionary& ); - //- Construct by mapping given nuSgsWallFunctionFvPatchScalarField + //- Construct by mapping given + // nuSgsSpalartAllmarasWallFunctionFvPatchScalarField // onto a new patch - nuSgsWallFunctionFvPatchScalarField + nuSgsSpalartAllmarasWallFunctionFvPatchScalarField ( - const nuSgsWallFunctionFvPatchScalarField&, + const nuSgsSpalartAllmarasWallFunctionFvPatchScalarField&, const fvPatch&, const DimensionedField<scalar, volMesh>&, const fvPatchFieldMapper& ); //- Construct as copy - nuSgsWallFunctionFvPatchScalarField + nuSgsSpalartAllmarasWallFunctionFvPatchScalarField ( - const nuSgsWallFunctionFvPatchScalarField& + const nuSgsSpalartAllmarasWallFunctionFvPatchScalarField& ); //- Construct and return a clone @@ -102,14 +104,14 @@ public: { return tmp<fvPatchScalarField> ( - new nuSgsWallFunctionFvPatchScalarField(*this) + new nuSgsSpalartAllmarasWallFunctionFvPatchScalarField(*this) ); } //- Construct as copy setting internal field reference - nuSgsWallFunctionFvPatchScalarField + nuSgsSpalartAllmarasWallFunctionFvPatchScalarField ( - const nuSgsWallFunctionFvPatchScalarField&, + const nuSgsSpalartAllmarasWallFunctionFvPatchScalarField&, const DimensionedField<scalar, volMesh>& ); @@ -121,7 +123,11 @@ public: { return tmp<fvPatchScalarField> ( - new nuSgsWallFunctionFvPatchScalarField(*this, iF) + new nuSgsSpalartAllmarasWallFunctionFvPatchScalarField + ( + *this, + iF + ) ); } diff --git a/tutorials/channelOodles/channel395/constant/postChannelDict b/tutorials/channelOodles/channel395/constant/postChannelDict index b8f3c3e0480747bdb4e53b09cb2ccbbd72e899b4..e69c0386ef95781462a1b01424c2d8eee53f1e2c 100644 --- a/tutorials/channelOodles/channel395/constant/postChannelDict +++ b/tutorials/channelOodles/channel395/constant/postChannelDict @@ -12,11 +12,17 @@ FoamFile class dictionary; object postChannelDict; } + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -Nx 40; -Ny (50); -Nz 30; +Nx 40; +Ny +( + 25 + 25 +); +Nz 30; + symmetric true; // ************************************************************************* //