ENH: patchCloud: return pTraits<Type>::max for unfound points
[OpenFOAM-1.7.x.git] / applications / utilities / postProcessing / foamCalc / foamCalc.C
blob1f3a32b6f676ae6f8f2773163f0091761b909ad1
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2010 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
9     This file is part of OpenFOAM.
11     OpenFOAM is free software: you can redistribute it and/or modify it
12     under the terms of the GNU General Public License as published by
13     the Free Software Foundation, either version 3 of the License, or
14     (at your option) any later version.
16     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
19     for more details.
21     You should have received a copy of the GNU General Public License
22     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
24 Application
25     foamCalc
27 Description
28     Generic wrapper for calculating a quantity at each time. Split into four
29     phases:
30         1. Intialise
31         2. Pre-time calculation loop
32         3. Calculation loop
33         4. Post-calculation loop
35 \*---------------------------------------------------------------------------*/
37 #include "timeSelector.H"
38 #include "calcType.H"
40 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42 int main(int argc, char *argv[])
44     Foam::timeSelector::addOptions();
45     Foam::argList::validOptions.insert("noWrite", "");
46     Foam::argList::validOptions.insert("dict", "dictionary name");
48     if (argc < 2)
49     {
50         FatalError
51             << "No utility has been supplied" << nl
52             << exit(FatalError);
53     }
55     word utilityName = argv[1];
57     Foam::autoPtr<Foam::calcType> utility
58     (
59         calcType::New(utilityName)
60     );
62     utility().tryInit();
64 #   include "setRootCase.H"
65 #   include "createTime.H"
66     Foam::instantList timeDirs = Foam::timeSelector::select0(runTime, args);
67 #   include "createMesh.H"
69     utility().tryPreCalc(args, runTime, mesh);
71     forAll(timeDirs, timeI)
72     {
73         runTime.setTime(timeDirs[timeI], timeI);
75         Foam::Info<< "Time = " << runTime.timeName() << Foam::endl;
77         mesh.readUpdate();
79         utility().tryCalc(args, runTime, mesh);
81         Foam::Info<< Foam::endl;
82     }
84     utility().tryPostCalc(args, runTime, mesh);
86     Info<< "End\n" << endl;
88     return 0;
92 // ************************************************************************* //