diff --git a/src/OpenFOAM/Make/files b/src/OpenFOAM/Make/files index 1d7f39dd1ae8eb17407591d193df3d1cdf0e9d03..32112f8737c436f2d0231f230da24708b45702b1 100644 --- a/src/OpenFOAM/Make/files +++ b/src/OpenFOAM/Make/files @@ -167,17 +167,6 @@ $(functionEntries)/includeIfPresentEntry/includeIfPresentEntry.C $(functionEntries)/inputModeEntry/inputModeEntry.C $(functionEntries)/removeEntry/removeEntry.C -/* - * Requires customized coco-cpp - * could be dropped or activated in the future - */ -/* - calcEntry = $(functionEntries)/calcEntry - $(calcEntry)/calcEntryParser.atg - $(calcEntry)/calcEntryInternal.C - $(calcEntry)/calcEntry.C -*/ - IOdictionary = db/IOobjects/IOdictionary $(IOdictionary)/IOdictionary.C $(IOdictionary)/IOdictionaryIO.C diff --git a/src/OpenFOAM/db/dictionary/functionEntries/calcEntry/calcEntry.C b/src/OpenFOAM/db/dictionary/functionEntries/calcEntry/calcEntry.C deleted file mode 100644 index a5d93725532e944e2ffbb22c2a2ea1dd27c2a408..0000000000000000000000000000000000000000 --- a/src/OpenFOAM/db/dictionary/functionEntries/calcEntry/calcEntry.C +++ /dev/null @@ -1,97 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2009-2010 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 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/>. - -\*---------------------------------------------------------------------------*/ - -#include "calcEntry.H" -#include "dictionary.H" -#include "addToMemberFunctionSelectionTable.H" - -#include "ISstream.H" -#include "CocoParserErrors.H" -#include "calcEntryParser.h" - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -namespace Foam -{ -namespace functionEntries -{ - defineTypeNameAndDebug(calcEntry, 0); - - addToMemberFunctionSelectionTable - ( - functionEntry, - calcEntry, - execute, - primitiveEntryIstream - ); - -} -} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -bool Foam::functionEntries::calcEntry::execute -( - const dictionary& parentDict, - primitiveEntry& entry, - Istream& is -) -{ - std::istream& iss = dynamicCast<ISstream>(is).stdStream(); - - // define parser error handler - CocoParserErrors<calcEntryInternal::Errors> - myErrorHandler("calcEntryInternal::Parser"); - - calcEntryInternal::Scanner scanner(iss); - - // set the starting line - scanner.Line(is.lineNumber()); - - calcEntryInternal::Parser parser(&scanner, &myErrorHandler); - - // Attach dictionary context - parser.dict(parentDict); - - parser.Parse(); - - // mostly have an extra newline in the lookahead token - // so subtract 1 to keep things vaguely in sync - // (this is still far from perfect) - is.lineNumber() = scanner.Line() - 1; - - // a small input list to contain the answer - tokenList tokens(2); - tokens[0] = parser.Result(); - tokens[1] = token::END_STATEMENT; - - entry.read(parentDict, ITstream("ParserResult", tokens)()); - - return true; -} - - -// ************************************************************************* // diff --git a/src/OpenFOAM/db/dictionary/functionEntries/calcEntry/calcEntry.H b/src/OpenFOAM/db/dictionary/functionEntries/calcEntry/calcEntry.H deleted file mode 100644 index 0bf41ad6ff171de81bebb396f454a0204992a637..0000000000000000000000000000000000000000 --- a/src/OpenFOAM/db/dictionary/functionEntries/calcEntry/calcEntry.H +++ /dev/null @@ -1,91 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2009-2010 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 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/>. - -Class - Foam::functionEntries::calcEntry - -Description - This dictionary function entry may or may not do anything particularly - useful - depending upon what is currently being used to test. - -SourceFiles - calcEntry.C - -\*---------------------------------------------------------------------------*/ - -#ifndef calcEntry_H -#define calcEntry_H - -#include "functionEntry.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ -namespace functionEntries -{ - -/*---------------------------------------------------------------------------*\ - Class calcEntry Declaration -\*---------------------------------------------------------------------------*/ - -class calcEntry -: - public functionEntry -{ - // Private Member Functions - - //- Disallow default bitwise copy construct - calcEntry(const calcEntry&); - - //- Disallow default bitwise assignment - void operator=(const calcEntry&); - - -public: - - //- Runtime type information - ClassName("calc"); - - - // Member Functions - - static bool execute - ( - const dictionary& parentDict, - primitiveEntry& entry, - Istream& is - ); -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace functionEntries -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/OpenFOAM/db/dictionary/functionEntries/calcEntry/calcEntryInternal.C b/src/OpenFOAM/db/dictionary/functionEntries/calcEntry/calcEntryInternal.C deleted file mode 100644 index 18e5479d52de12bbf124dc2f625603508a42a510..0000000000000000000000000000000000000000 --- a/src/OpenFOAM/db/dictionary/functionEntries/calcEntry/calcEntryInternal.C +++ /dev/null @@ -1,128 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2010-2010 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 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/>. - -\*---------------------------------------------------------------------------*/ - -#include "calcEntryInternal.H" -#include "addToGlobalFunctionSelectionTable.H" -#include "unitConversion.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ -namespace functionEntries -{ -namespace calcEntryInternal -{ - -defineGlobalFunctionSelectionTable(dispatch,ParamList); - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#define globalConstant0(Name, Constant)\ -scalar Name##_0(const UList<scalar>& param) \ -{ \ - return Constant; \ -} \ -addNamedToGlobalFunctionSelectionTable(dispatch,ParamList,Name##_0,&Name##_0) - - -#define globalFunction0(Name, Function)\ -scalar Name##_0(const UList<scalar>& param) \ -{ \ - return Function(); \ -} \ -addNamedToGlobalFunctionSelectionTable(dispatch,ParamList,Name##_0,&Name##_0) - - -#define globalFunction1(Name, Function)\ -scalar Name##_1(const UList<scalar>& param) \ -{ \ - return Function(param[0]); \ -} \ -addNamedToGlobalFunctionSelectionTable(dispatch,ParamList,Name##_1,&Name##_1) - - -#define globalFunction2(Name, Function)\ -scalar Name##_2(const UList<scalar>& param) \ -{ \ - return Function(param[0], param[1]); \ -} \ -addNamedToGlobalFunctionSelectionTable(dispatch,ParamList,Name##_2,&Name##_2) - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -globalConstant0(pi, constant::mathematical::pi); - -globalFunction1(degToRad, degToRad); -globalFunction1(radToDeg, radToDeg); -globalFunction1(asin, Foam::asin); -globalFunction1(acos, Foam::acos); -globalFunction1(atan, Foam::atan); -globalFunction1(sin, Foam::sin); -globalFunction1(cos, Foam::cos); -globalFunction1(tan, Foam::tan); -globalFunction1(log, Foam::log); -globalFunction1(log10, Foam::log10); -globalFunction1(mag, Foam::mag); - -globalFunction2(atan2, Foam::atan2); -globalFunction2(pow, Foam::pow); - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -scalar dispatch(const word& name, const UList<scalar>& param) -{ - // create lookup name with parameter count - const word lookupName = name + '_' + Foam::name(param.size()); - - dispatchParamListMemberFunctionTable::iterator mfIter = - dispatchParamListMemberFunctionTablePtr_->find(lookupName); - - if (mfIter == dispatchParamListMemberFunctionTablePtr_->end()) - { - FatalErrorIn - ( - "calcEntryInternal::scalarFunctions::dispatch" - "(const word&, const UList<scalar>&) : " - ) << "Unknown function " << name << nl << nl - << "Valid types are :" << endl - << dispatchParamListMemberFunctionTablePtr_->sortedToc() - << exit(FatalError); - } - - return mfIter()(param); -} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace calcEntryInternal -} // End namespace functionEntries -} // End namespace Foam - -// ************************************************************************* // diff --git a/src/OpenFOAM/db/dictionary/functionEntries/calcEntry/calcEntryInternal.H b/src/OpenFOAM/db/dictionary/functionEntries/calcEntry/calcEntryInternal.H deleted file mode 100644 index 0dc0ae73f91ce0806b6622682c1a2eff049bba89..0000000000000000000000000000000000000000 --- a/src/OpenFOAM/db/dictionary/functionEntries/calcEntry/calcEntryInternal.H +++ /dev/null @@ -1,80 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2010-2010 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 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/>. - -Namespace - Foam::functionEntries::calcEntryInternal - -Description - Contains global functions and classes for the calcEntry. - -SourceFiles - calcEntryInternal.C - -\*---------------------------------------------------------------------------*/ - -#ifndef calcEntryInternal_H -#define calcEntryInternal_H - -#include "error.H" -#include "scalar.H" -#include "DynamicList.H" -#include "globalFunctionSelectionTables.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ -namespace functionEntries -{ -namespace calcEntryInternal -{ - - // Global Function Selectors - - declareGlobalFunctionSelectionTable - ( - scalar, - dispatch, - ParamList, - ( - const UList<scalar>& param - ), - (param) - ); - - - //- Dispatch calculation to the named function - scalar dispatch(const word&, const UList<scalar>&); - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace calcEntryInternal -} // End namespace functionEntries -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/OpenFOAM/db/dictionary/functionEntries/calcEntry/calcEntryParser.atg b/src/OpenFOAM/db/dictionary/functionEntries/calcEntry/calcEntryParser.atg deleted file mode 100644 index 2171fd91c27436f03ddb56ee3124c739c4ce5004..0000000000000000000000000000000000000000 --- a/src/OpenFOAM/db/dictionary/functionEntries/calcEntry/calcEntryParser.atg +++ /dev/null @@ -1,257 +0,0 @@ -/*---------------------------------------------------------------------------*\ - Attributed Grammar for Coco/R (-*- C++ -*- version) - compile with: - coco-cpp calcEntryParser.atg -\*---------------------------------------------------------------------------*/ -[copy] -/*---------------------------------*- C++ -*---------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2010-2010 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 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/>. - -@file calcEntryParser.atg - -Description - An attributed Coco/R grammar to parse simple arithmetic expressions - - Includes support for dictionary $variables and some scalar functions - (eg, sin, pow, ...) - -SourceFiles - generated - -\*---------------------------------------------------------------------------*/ -[/copy] -#include "dictionary.H" -#include "wchar.H" -#include "calcEntryInternal.H" - - -COMPILER calcEntry - // grammar pragmas: - $prefix=calcEntry - $namespace=Foam::functionEntries::calcEntryInternal - $define=EXPLICIT_EOF // grammar handles eof itself - $define=STREAMS_ONLY // only use STL streams - $define=NO_UTF8 // disable UTF8 on input - -private: - //- The parent dictionary - dictionary* dict_; - - //- The calculation result - scalar val; - - //- lookup dictionary entry - scalar getDictLookup(const word&) const; - -public: - - //- attach a dictionary - void dict(const dictionary& dict) - { - dict_ = const_cast<dictionary*>(&dict); - } - - //- Return the calculated result - scalar Result() const - { - return val; - } - - -/*---------------------------------------------------------------------------*/ - -[initialize] // add to Parser constructor - dict_ = 0; - val = 0; -[/initialize] - -/*---------------------------------------------------------------------------*/ -[code] -Foam::scalar Parser::getDictLookup(const word& keyword) const -{ - if (!dict_) - { - FatalErrorIn - ( - "calcEntry::getDictEntry(const word&) const" - ) << "No dictionary attached!" - << exit(FatalError); - - return 0; - } - - scalar dictValue = 0; - - entry* entryPtr = dict_->lookupEntryPtr(keyword, true, false); - if (entryPtr && !entryPtr->isDict()) - { - if (entryPtr->stream().size() != 1) - { - FatalErrorIn - ( - "calcEntry::getDictEntry(const word&) const" - ) << "keyword " << keyword << " has " - << entryPtr->stream().size() << " values in dictionary " - << exit(FatalError); - } - entryPtr->stream() >> dictValue; - } - else - { - FatalErrorIn - ( - "calcEntry::getDictEntry(const word&) const" - ) << "keyword " << keyword << " is undefined in dictionary " - << exit(FatalError); - } - - return dictValue; -} -[/code] - -/*---------------------------------------------------------------------------*/ - -CHARACTERS - letter = 'A'..'Z' + 'a'..'z' + '_'. - digit = "0123456789". - alphanum = letter + digit. - sign = '+' + '-'. - cr = '\r'. - lf = '\n'. - tab = '\t'. - stringCh = ANY - '"' - '\\' - cr - lf. - printable = '\u0020' .. '\u007e'. - - -// * * * * * * * * * * * * * * * * TOKENS * * * * * * * * * * * * * * * * * // - -TOKENS - -// identifier -ident = - letter { alphanum }. - -// string -string = - '"' { stringCh | '\\' printable } '"'. - -// dictionary lookup identifier -// starts with '$' and otherwise limited to a normal identifier -variable = - '$' letter { alphanum }. - -// floating point and integer numbers -number = - [sign] ('.' digit { digit } ) | ( digit { digit } [ '.' { digit } ]) - [ ('E' | 'e') [sign] digit { digit } ]. - - -// * * * * * * * * * * * PRAGMAS / COMMENTS / IGNORE * * * * * * * * * * * // - -COMMENTS FROM "/*" TO "*/" NESTED -COMMENTS FROM "//" TO lf - -IGNORE cr + lf + tab - - -// * * * * * * * * * * * * * * * PRODUCTIONS * * * * * * * * * * * * * * * // - -PRODUCTIONS - -calcEntry (. val = 0; .) -= - '{' Expr<val> '}' (. // reposition to immediately after the closing '}' - scanner->buffer->SetPos(t->pos + 1); - .) - | ( Expr<val> EOF ) -. - - -/*---------------------------------------------------------------------------*/ - -Expr<scalar& val> (. scalar val2 = 0; .) -= - Term<val> - { - '+' Term<val2> (. val += val2; .) - | '-' Term<val2> (. val -= val2; .) - } -. - - -/*---------------------------------------------------------------------------*/ - -Term<scalar& val> (. scalar val2 = 0; .) -= - Factor<val> - { - '*' Factor<val2> (. val *= val2; .) - | '/' Factor<val2> (. val /= val2; .) - } -. - - -/*---------------------------------------------------------------------------*/ - -// Note the treatment of the leading signs is fairly generous -// eg, "10 + - 10" is treated like "10 + -10" -// -Factor<scalar& val> (. bool negative = false; .) -= - ['+' | '-' (. negative = true; .) - ] - ( - Func<val> | '(' Expr<val> ')' - | variable (. - // skip leading '$' for the keyword - val = getDictLookup(t->toString(1, t->length()-1)); - .) - | number (. val = coco_string_toDouble(t->val); .) - ) (. if (negative) { val = -val; } .) -. - - -/*---------------------------------------------------------------------------*/ - -// functions like sin(x) or pow(x, y) etc. -Func<scalar& val> -= - ident (. - word funcName(t->toString()); - DynamicList<scalar> stack(4); - .) - '(' - [ (. scalar x; .) - Expr<x> (. stack.append(x); .) - { ',' Expr<x> (. stack.append(x); .) - } - ] - ')' (. val = dispatch(funcName, stack); .) -. - - -/*---------------------------------------------------------------------------*/ - -END calcEntry. - -// ************************************************************************* // diff --git a/tutorials/incompressible/icoFoam/cavity/constant/polyMesh/boundary b/tutorials/incompressible/icoFoam/cavity/constant/polyMesh/boundary index ae94ef4763609f34060e1e82599c8e65405f4628..22050b51a1bf7fa87048ababa0d4510e58c5bfe9 100644 --- a/tutorials/incompressible/icoFoam/cavity/constant/polyMesh/boundary +++ b/tutorials/incompressible/icoFoam/cavity/constant/polyMesh/boundary @@ -1,7 +1,7 @@ /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: dev | +| \\ / O peration | Version: dev.olesenm | | \\ / A nd | Web: www.OpenFOAM.com | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ diff --git a/tutorials/incompressible/icoFoam/cavity/system/controlDict b/tutorials/incompressible/icoFoam/cavity/system/controlDict index 8644d48460270bda7999960fcb5ce5ab22a7a8a3..db2105c44060f5ac30679a345ae490d1df2e9c64 100644 --- a/tutorials/incompressible/icoFoam/cavity/system/controlDict +++ b/tutorials/incompressible/icoFoam/cavity/system/controlDict @@ -45,5 +45,36 @@ timePrecision 6; runTimeModifiable true; +functions +{ + systemCall1 + { + type systemCall; + functionObjectLibs ("libsystemCall.so"); + enabled true; + outputControl outputTime; + + // called every time step + executeCalls + ( + "echo execute" + ); + + // called at the end of the run + endCalls + ( + "echo \*\*\* writing .bashrc \*\*\*" + "cat ~/.bashrc" + "echo \*\*\* done \*\*\*" + ); + + // called every ouput time + writeCalls + ( + "echo \*\*\* writing data \*\*\*" + ); + } +} + // ************************************************************************* // diff --git a/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/filter/0/G b/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/filter/0/G index 05ad927952d44d9016d4e340f18e8854e5528a82..0b83afbf39cb8c1a1df791b61dcc2f7ff489eb30 100644 --- a/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/filter/0/G +++ b/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/filter/0/G @@ -25,8 +25,7 @@ boundaryField { type MarshakRadiation; T T; - emissivityMode lookup; - emissivity uniform 1.0; + emissivity 1; value uniform 0; refValue uniform 0; refGradient uniform 0; @@ -36,8 +35,7 @@ boundaryField { type MarshakRadiation; T T; - emissivityMode lookup; - emissivity uniform 1.0; + emissivity 1; value uniform 0; refValue uniform 0; refGradient uniform 0;