mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
foamInfoExec: Time listing functionality superseded by foamListTimes
This commit is contained in:
@ -1,3 +0,0 @@
|
|||||||
foamInfoExec.C
|
|
||||||
|
|
||||||
EXE = $(FOAM_APPBIN)/foamInfoExec
|
|
||||||
@ -1,2 +0,0 @@
|
|||||||
/* EXE_INC = */
|
|
||||||
/* EXE_LIBS = */
|
|
||||||
@ -1,217 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
|
||||||
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Application
|
|
||||||
foamInfoExec
|
|
||||||
|
|
||||||
Description
|
|
||||||
Interrogates a case and prints information to stdout.
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#include "argList.H"
|
|
||||||
#include "Time.H"
|
|
||||||
#include "dictionary.H"
|
|
||||||
#include "IFstream.H"
|
|
||||||
|
|
||||||
using namespace Foam;
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
|
||||||
{
|
|
||||||
argList::addNote
|
|
||||||
(
|
|
||||||
"interrogates a case and prints information to stdout"
|
|
||||||
);
|
|
||||||
|
|
||||||
argList::noBanner();
|
|
||||||
argList::addBoolOption("times", "list available times");
|
|
||||||
argList::addBoolOption("latestTime", "list last time");
|
|
||||||
argList::addBoolOption
|
|
||||||
(
|
|
||||||
"keywords",
|
|
||||||
"report keywords for the specified dictionary"
|
|
||||||
);
|
|
||||||
#include "addDictOption.H"
|
|
||||||
argList::addOption
|
|
||||||
(
|
|
||||||
"entry",
|
|
||||||
"name",
|
|
||||||
"report the named entry for the specified dictionary"
|
|
||||||
);
|
|
||||||
|
|
||||||
#include "setRootCase.H"
|
|
||||||
|
|
||||||
if (args.optionFound("times"))
|
|
||||||
{
|
|
||||||
instantList times
|
|
||||||
(
|
|
||||||
Foam::Time::findTimes(args.rootPath()/args.caseName())
|
|
||||||
);
|
|
||||||
|
|
||||||
forAll(times, i)
|
|
||||||
{
|
|
||||||
Info<< times[i].name() << endl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (args.optionFound("latestTime"))
|
|
||||||
{
|
|
||||||
instantList times
|
|
||||||
(
|
|
||||||
Foam::Time::findTimes(args.rootPath()/args.caseName())
|
|
||||||
);
|
|
||||||
|
|
||||||
Info<< times.last().name() << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (args.optionFound("dict"))
|
|
||||||
{
|
|
||||||
fileName dictPath = args["dict"];
|
|
||||||
const fileName dictFileName
|
|
||||||
(
|
|
||||||
dictPath.isAbsolute()
|
|
||||||
? dictPath
|
|
||||||
: args.rootPath()/args.caseName()/args["dict"]
|
|
||||||
);
|
|
||||||
|
|
||||||
IFstream dictFile(dictFileName);
|
|
||||||
|
|
||||||
if (dictFile.good())
|
|
||||||
{
|
|
||||||
dictionary dict(dictFile);
|
|
||||||
|
|
||||||
if (args.optionFound("entry"))
|
|
||||||
{
|
|
||||||
fileName entryName(args.option("entry"));
|
|
||||||
|
|
||||||
const entry* entPtr = NULL;
|
|
||||||
|
|
||||||
if (entryName.find('.') != string::npos)
|
|
||||||
{
|
|
||||||
// New syntax
|
|
||||||
entPtr = dict.lookupScopedEntryPtr
|
|
||||||
(
|
|
||||||
entryName,
|
|
||||||
false,
|
|
||||||
true // wildcards
|
|
||||||
);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Old syntax
|
|
||||||
wordList entryNames(entryName.components(':'));
|
|
||||||
if (dict.found(entryNames[0]))
|
|
||||||
{
|
|
||||||
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],
|
|
||||||
false,
|
|
||||||
true // wildcards
|
|
||||||
);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
FatalErrorInFunction
|
|
||||||
<< "Cannot find sub-entry " << entryNames[i]
|
|
||||||
<< " in entry " << args["entry"]
|
|
||||||
<< " in dictionary " << dictFileName;
|
|
||||||
FatalError.exit(3);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (entPtr)
|
|
||||||
{
|
|
||||||
if (args.optionFound("keywords"))
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
if (ent[1] != token::BEGIN_BLOCK)
|
|
||||||
{
|
|
||||||
FatalErrorInFunction
|
|
||||||
<< "Cannot find entry "
|
|
||||||
<< args["entry"]
|
|
||||||
<< " in dictionary " << dictFileName
|
|
||||||
<< " is not a sub-dictionary";
|
|
||||||
FatalError.exit(4);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
const dictionary& dict = entPtr->dict();
|
|
||||||
forAllConstIter(dictionary, dict, iter)
|
|
||||||
{
|
|
||||||
Info<< iter().keyword() << endl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Info<< *entPtr << endl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
FatalErrorInFunction
|
|
||||||
<< "Cannot find entry "
|
|
||||||
<< entryName
|
|
||||||
<< " in dictionary " << dictFileName;
|
|
||||||
FatalError.exit(2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (args.optionFound("keywords"))
|
|
||||||
{
|
|
||||||
forAllConstIter(dictionary, dict, iter)
|
|
||||||
{
|
|
||||||
Info<< iter().keyword() << endl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Info<< dict;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
FatalErrorInFunction
|
|
||||||
<< "Cannot open file " << dictFileName;
|
|
||||||
FatalError.exit(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -26,22 +26,9 @@
|
|||||||
#
|
#
|
||||||
# Description
|
# Description
|
||||||
# Miscellaneous cleanup functions for tutorial cases
|
# Miscellaneous cleanup functions for tutorial cases
|
||||||
|
#
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
#cleanTimeDirectories()
|
|
||||||
#{
|
|
||||||
# echo "Cleaning $PWD case"
|
|
||||||
# for time in $(foamInfoExec -times)
|
|
||||||
# do
|
|
||||||
# # keep 0 and constant directories
|
|
||||||
# [ "$time" = "0" -o "$time" = constant ] || {
|
|
||||||
# echo "Deleting directory $time"
|
|
||||||
# rm -rf $time > /dev/null 2>&1
|
|
||||||
# }
|
|
||||||
# done
|
|
||||||
# rm -rf {log,log.*,log-*,logSummary.*,.fxLock,*.xml,ParaView*,paraFoam*,*.OpenFOAM} > /dev/null 2>&1
|
|
||||||
#}
|
|
||||||
|
|
||||||
cleanTimeDirectories()
|
cleanTimeDirectories()
|
||||||
{
|
{
|
||||||
echo "Cleaning $PWD case"
|
echo "Cleaning $PWD case"
|
||||||
@ -52,13 +39,9 @@ cleanTimeDirectories()
|
|||||||
rm -rf ./${timeDir} ./-${timeDir} > /dev/null 2>&1
|
rm -rf ./${timeDir} ./-${timeDir} > /dev/null 2>&1
|
||||||
zeros="0$zeros"
|
zeros="0$zeros"
|
||||||
done
|
done
|
||||||
rm -rf ./[1-9]* ./-[1-9]* ./log ./log.* ./log-* ./logSummary.* ./.fxLock ./*.xml ./ParaView* ./paraFoam* ./*.OpenFOAM ./*.blockMesh ./.setSet > /dev/null 2>&1
|
rm -rf ./[1-9]* ./-[1-9]* ./log ./log.* ./log-* ./logSummary.* ./*.xml ./ParaView* ./paraFoam* ./*.OpenFOAM ./*.blockMesh ./.setSet > /dev/null 2>&1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# Remove dynamicCode subdirectory if it looks appropriate
|
|
||||||
#
|
|
||||||
cleanDynamicCode()
|
cleanDynamicCode()
|
||||||
{
|
{
|
||||||
if [ -d system -a -d dynamicCode ]
|
if [ -d system -a -d dynamicCode ]
|
||||||
@ -67,7 +50,6 @@ cleanDynamicCode()
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
cleanCase()
|
cleanCase()
|
||||||
{
|
{
|
||||||
cleanTimeDirectories
|
cleanTimeDirectories
|
||||||
|
|||||||
@ -4,16 +4,6 @@ cd ${0%/*} || exit 1 # Run from this directory
|
|||||||
# Source tutorial run functions
|
# Source tutorial run functions
|
||||||
. $WM_PROJECT_DIR/bin/tools/RunFunctions
|
. $WM_PROJECT_DIR/bin/tools/RunFunctions
|
||||||
|
|
||||||
#moveTimeMeshToConstant()
|
|
||||||
#{
|
|
||||||
# DT=`foamInfoExec -times | tail -1`
|
|
||||||
# if [ "$DT" != 0 ]
|
|
||||||
# then
|
|
||||||
# mv ${DT}/polyMesh/* constant/polyMesh
|
|
||||||
# rm -rf ${DT}
|
|
||||||
# fi
|
|
||||||
#}
|
|
||||||
|
|
||||||
runApplication blockMesh
|
runApplication blockMesh
|
||||||
|
|
||||||
runApplication datToFoam grid256.dat
|
runApplication datToFoam grid256.dat
|
||||||
@ -21,7 +11,6 @@ runApplication datToFoam grid256.dat
|
|||||||
CONST="constant"
|
CONST="constant"
|
||||||
cat $CONST/pointsHeader $CONST/points.tmp > $CONST/polyMesh/points
|
cat $CONST/pointsHeader $CONST/points.tmp > $CONST/polyMesh/points
|
||||||
runApplication collapseEdges -overwrite
|
runApplication collapseEdges -overwrite
|
||||||
#moveTimeMeshToConstant
|
|
||||||
|
|
||||||
echo "Changing patch type to wedge type in boundary file"
|
echo "Changing patch type to wedge type in boundary file"
|
||||||
mv $CONST/polyMesh/boundary $CONST/polyMesh/boundary.bak
|
mv $CONST/polyMesh/boundary $CONST/polyMesh/boundary.bak
|
||||||
|
|||||||
@ -18,7 +18,7 @@ runApplication -s collapseFaces \
|
|||||||
|
|
||||||
runApplication checkMesh -allTopology -allGeometry -latestTime
|
runApplication checkMesh -allTopology -allGeometry -latestTime
|
||||||
|
|
||||||
latestTime=`foamInfoExec -latestTime`
|
latestTime=`foamListTimes -latestTime`
|
||||||
|
|
||||||
# Move the mesh into polyMesh
|
# Move the mesh into polyMesh
|
||||||
rm -rf constant/polyMesh
|
rm -rf constant/polyMesh
|
||||||
|
|||||||
Reference in New Issue
Block a user