BUG: UListIO: byteSize overflowing on really big faceLists
[OpenFOAM-2.0.x.git] / src / postProcessing / functionObjects / systemCall / systemCall.C
blob90a5c20257c246f9fc7fad353c1541542e0d378b
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
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 \*---------------------------------------------------------------------------*/
26 #include "systemCall.H"
27 #include "Time.H"
28 #include "dynamicCode.H"
30 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
32 defineTypeNameAndDebug(Foam::systemCall, 0);
35 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
37 Foam::systemCall::systemCall
39     const word& name,
40     const objectRegistry&,
41     const dictionary& dict,
42     const bool
45     name_(name),
46     executeCalls_(),
47     endCalls_(),
48     writeCalls_()
50     read(dict);
54 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
56 Foam::systemCall::~systemCall()
60 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
62 void Foam::systemCall::read(const dictionary& dict)
64     dict.readIfPresent("executeCalls", executeCalls_);
65     dict.readIfPresent("endCalls", endCalls_);
66     dict.readIfPresent("writeCalls", writeCalls_);
68     if (executeCalls_.empty() && endCalls_.empty() && writeCalls_.empty())
69     {
70         WarningIn("Foam::system::read(const dictionary&)")
71             << "no executeCalls, endCalls or writeCalls defined."
72             << endl;
73     }
74     else if (!dynamicCode::allowSystemOperations)
75     {
76         FatalErrorIn
77         (
78             "systemCall::read(const dictionary&)"
79         )   <<  "Executing user-supplied system calls is not"
80             << " enabled by default" << endl
81             << "because of security issues. If you trust the case you can"
82             << " enable this" << endl
83             << "facility be adding to the InfoSwitches setting in the system"
84             << " controlDict:" << endl
85             << endl
86             << "    allowSystemOperations 1" << endl
87             << endl
88             << "The system controlDict is either" << endl
89             << endl
90             << "    ~/.OpenFOAM/$WM_PROJECT_VERSION/controlDict" << endl
91             << endl
92             << "or" << endl
93             << endl
94             << "    $WM_PROJECT_DIR/etc/controlDict" << endl
95             << endl
96             << exit(FatalError);
97     }
101 void Foam::systemCall::execute()
103     forAll(executeCalls_, callI)
104     {
105         Foam::system(executeCalls_[callI]);
106     }
110 void Foam::systemCall::end()
112     forAll(endCalls_, callI)
113     {
114         Foam::system(endCalls_[callI]);
115     }
119 void Foam::systemCall::write()
121     forAll(writeCalls_, callI)
122     {
123         Foam::system(writeCalls_[callI]);
124     }
128 // ************************************************************************* //