Merge branch 'develop' of develop.openfoam.com:Development/OpenFOAM-plus into develop

This commit is contained in:
sergio
2019-06-04 11:06:35 -07:00
committed by Andrew Heather
307 changed files with 8005 additions and 4097 deletions

View File

@ -118,34 +118,4 @@ your `~/.spack/packages.yaml` file:
It appears that spack will otherwise ignore any paraview+qt version It appears that spack will otherwise ignore any paraview+qt version
and attempt to install a paraview~qt version instead. and attempt to install a paraview~qt version instead.
---------------------------
Building on Darwin (Mac-OS)
---------------------------
Support for Darwin is incomplete, but has been provisioned for.
The following are typical (as of yet) unresolved issues.
* Scotch, ptscotch:
- The librt linkage is required for Linux, but not for Darwin.
Current resolution:
Edit or patch
src/parallel/decompose/ptscotchDecomp/Make/options
src/parallel/decompose/scotchDecomp/Make/options
to remove the '-lrt' library
* CGAL:
- ThirdParty CGAL will normally need to be compiled without mpfr/gmp.
This should be done manually prior to building OpenFOAM or other
ThirdParty. Eg,
cd $WM_THIRD_PARTY_DIR
./makeCGAL gmp-none mpfr-none
The erroneous references to gmp/mpfr library can be directly removed
from the wmake/rules/General/CGAL, but it is more advisable to
override them instead in the wmake/rules/darwin64Clang/CGAL file.
-- --

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd. \\ / A nd | Copyright (C) 2018-2019 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -30,6 +30,9 @@ License
#if defined WM_SP #if defined WM_SP
# define PRECISION "SP" # define PRECISION "SP"
# define SCALAR_SIZE (8*sizeof(float)) # define SCALAR_SIZE (8*sizeof(float))
#elif defined(WM_SPDP)
# define PRECISION "SPDP"
# define SCALAR_SIZE (8*sizeof(float))
#elif defined WM_DP #elif defined WM_DP
# define PRECISION "DP" # define PRECISION "DP"
# define SCALAR_SIZE (8*sizeof(double)) # define SCALAR_SIZE (8*sizeof(double))
@ -38,9 +41,23 @@ License
# define SCALAR_SIZE (8*sizeof(long double)) # define SCALAR_SIZE (8*sizeof(long double))
#endif #endif
// Test additional exported symbols
#ifdef _WIN32
#define defineWindowsLibEntryPoint(libName) \
extern "C" void lib_##libName##_entry_point() {}
#else
#define defineWindowsLibEntryPoint(libName) /* Nothing */
#endif
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
// The 'extern C' export is independent of namespace
namespace Foam
{
defineWindowsLibEntryPoint(dummyLib);
}
const std::string Foam::Detail::dummyLib::arch(WM_ARCH); const std::string Foam::Detail::dummyLib::arch(WM_ARCH);
const std::string Foam::Detail::dummyLib::compiler(WM_COMPILER); const std::string Foam::Detail::dummyLib::compiler(WM_COMPILER);

File diff suppressed because it is too large Load Diff

View File

@ -24,11 +24,12 @@ License
Application Application
Description Description
Some tests for complex numbers Tests for complex numbers
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "argList.H" #include "argList.H"
#include "complex.H"
#include "complexFields.H" #include "complexFields.H"
#include "ops.H" #include "ops.H"
#include "ListOps.H" #include "ListOps.H"
@ -41,15 +42,14 @@ void print1(const complex& z)
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Main Program * * * * * * * * * * * * * * * //
// Main program:
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
Info<< "complex() : " << complex() << nl Info<< "complex() : " << complex() << nl
<< "complex(zero) : " << complex(Zero) << nl << "complex(zero) : " << complex(Zero) << nl
<< "complex::zero : " << complex::zero << nl << "pTraits<complex>::zero : " << pTraits<complex>::zero << nl
<< "complex::one : " << complex::one << nl << "pTraits<complex>::one : " << pTraits<complex>::one << nl
<< "complex(scalar) : " << complex(3.14519) << nl << "complex(scalar) : " << complex(3.14519) << nl
<< nl; << nl;
@ -57,7 +57,6 @@ int main(int argc, char *argv[])
Info<< "std::complex : " << c1 << nl; Info<< "std::complex : " << c1 << nl;
Info<< "sin: " << std::sin(c1) << nl; Info<< "sin: " << std::sin(c1) << nl;
Info<< "complexVector::zero : " << complexVector::zero << nl Info<< "complexVector::zero : " << complexVector::zero << nl
<< "complexVector::one : " << complexVector::one << nl << "complexVector::one : " << complexVector::one << nl
<< nl; << nl;
@ -98,6 +97,7 @@ int main(int argc, char *argv[])
c.Im() *= 5; c.Im() *= 5;
} }
Info<< "sumProd: " << sumProd(fld1, fld2) << nl;
fld1 *= 10; fld1 *= 10;
Info<< "scalar multiply: " << flatOutput(fld1) << nl; Info<< "scalar multiply: " << flatOutput(fld1) << nl;
@ -113,11 +113,140 @@ int main(int argc, char *argv[])
// Info<< "operator * : " << (fld1 * fld2) << nl; // Info<< "operator * : " << (fld1 * fld2) << nl;
// Info<< "operator / : " << (fld1 / fld2) << nl; // Info<< "operator / : " << (fld1 / fld2) << nl;
Info<< "operator / : " << (fld1 / 2) << nl; // Info<< "operator / : " << (fld1 / 2) << nl;
// Info<< "operator / : " << (fld1 / fld2) << nl; // Info<< "operator / : " << (fld1 / fld2) << nl;
Info<< "sqrt : " << sqrt(fld1) << nl; // Info<< "sqrt : " << sqrt(fld1) << nl;
// Info<< "pow(2) : " << pow(fld1, 2) << nl; // Info<< "pow(2) : " << pow(fld1, 2) << nl;
#if 1
Info<< nl << "## Elementary complex-complex arithmetic operations:" << nl;
{
const complex a(6, 1);
complex b = a;
Info << "# Compound assignment operations:" << nl;
Info<< "a = " << a << ", b = " << b << nl;
// Addition
b += a;
Info<< "b += a:" << tab << "b =" << b << nl;
// Subtraction
b -= a;
Info<< "b -= a:" << tab << "b =" << b << nl;
// Multiplication
b *= a;
Info<< "b *= a:" << tab << "b =" << b << nl;
// Division
b /= a;
Info<< "b /= a:" << tab << "b =" << b << nl;
}
#endif
#if 1
Info<< nl << "## Elementary complex-scalar arithmetic operations:" << nl;
{
const scalar a = 5;
complex b(6, 1);
Info << "# Non-assignment operations:" << nl;
Info<< "(scalar) a = " << a << ", b = " << b << nl;
// Addition
b = a + b;
Info<< "b = a + b: " << tab << b << nl;
b = b + a;
Info<< "b = b + a: " << tab << b << nl;
// Subtraction
b = a - b;
Info<< "b = a - b: " << tab << b << nl;
b = b - a;
Info<< "b = b - a: " << tab << b << nl;
// Multiplication
b = a*b;
Info<< "b = a*b: " << tab << b << nl;
b = b*a;
Info<< "b = b*a: " << tab << b << nl;
// Division
b = a/b;
Info<< "b = a/b = scalar(a)/b = complex(a)/b:" << tab << b << nl;
b = b/a;
Info<< "b = b/a: " << tab << b << nl;
Info << "# Compound assignment operations:" << nl;
Info<< "(scalar) a = " << a << ", b = " << b << nl;
// Addition: complex+scalar
b += a;
Info<< "b += a (only real part):" << tab << b << nl;
// Subtraction: complex-scalar
b -= a;
Info<< "b -= a (only real part):" << tab << b << nl;
// Multiplication: complex*scalar
b *= a;
Info<< "b *= a (real and imag parts):" << tab << b << nl;
// Division: complex/scalar
b /= a;
Info<< "b /= a (real and imag parts):" << tab << b << nl;
}
#endif
#if 1
Info<< nl << "## Other mathematical expressions:" << nl;
{
const complex a(4.3, -3.14);
const complex b(0, -4.3);
const complex c(-4.3, 0);
Info<< "a = " << a << ", b = " << b << ", c = " << c << nl;
// Square-root
Info<< "sqrt(a) = " << Foam::sqrt(a) << ", "
<< "sqrt(b) = " << Foam::sqrt(b) << ", "
<< "sqrt(c) = " << Foam::sqrt(c) << nl;
// Square
Info<< "sqr(a) = " << sqr(a) << ", "
<< "sqr(b) = " << sqr(b) << ", "
<< "sqr(c) = " << sqr(c) << nl;
// n^th power
Info<< "pow(a, -1) = " << pow(a, -1) << ", "
<< "pow(b, -1) = " << pow(b, -1) << ", "
<< "pow(c, -1) = " << pow(c, -1) << nl;
// Exponential
Info<< "exp(a) = " << exp(a) << ", "
<< "exp(b) = " << exp(b) << ", "
<< "exp(c) = " << exp(c) << nl;
// Natural logarithm
Info<< "log(a) = " << log(a) << ", "
<< "log(b) = " << log(b) << ", "
<< "log(c) = " << log(c) << nl;
}
#endif
// Make some changes // Make some changes
{ {
@ -150,6 +279,7 @@ int main(int argc, char *argv[])
// Info<< "min/max = " << MinMax<complex>(fld1) << nl; // Info<< "min/max = " << MinMax<complex>(fld1) << nl;
Info<< "\nEnd\n" << endl; Info<< "\nEnd\n" << endl;
return 0; return 0;
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2017-2018 OpenCFD Ltd. \\ / A nd | Copyright (C) 2017-2019 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -34,6 +34,8 @@ Description
#include "IOobject.H" #include "IOobject.H"
#include "IFstream.H" #include "IFstream.H"
#include "dictionary.H" #include "dictionary.H"
#include "ops.H"
#include "scalarRange.H"
#include "stringOps.H" #include "stringOps.H"
using namespace Foam; using namespace Foam;
@ -108,6 +110,42 @@ scalar try_getScalar(const dictionary& dict, const word& k)
} }
// Try with getCheck<scalar>
template<class Predicate>
scalar try_getCheckScalar
(
const dictionary& dict,
const word& k,
const Predicate& pred
)
{
scalar val(-GREAT);
const bool throwingIOError = FatalIOError.throwExceptions();
const bool throwingError = FatalError.throwExceptions();
try
{
val = dict.getCheck<scalar>(k, pred);
Info<< "getCheck<scalar>(" << k << ") = " << val << nl;
}
catch (const Foam::IOerror& err)
{
Info<< "getCheck<scalar>(" << k << ") Caught FatalIOError "
<< err << nl << endl;
}
catch (const Foam::error& err)
{
Info<< "getCheck<scalar>(" << k << ") Caught FatalError "
<< err << nl << endl;
}
FatalError.throwExceptions(throwingError);
FatalIOError.throwExceptions(throwingIOError);
return val;
}
// Try with *entry (from findEntry) and get<scalar> // Try with *entry (from findEntry) and get<scalar>
scalar try_getScalar(const entry* eptr, const word& k) scalar try_getScalar(const entry* eptr, const word& k)
{ {
@ -311,6 +349,7 @@ int main(int argc, char *argv[])
IStringStream IStringStream
( (
"good 3.14159;\n" "good 3.14159;\n"
"negative -3.14159;\n"
"empty;\n" "empty;\n"
// "bad text;\n" // always fails // "bad text;\n" // always fails
// "bad 3.14159 1234;\n" // fails for readScalar // "bad 3.14159 1234;\n" // fails for readScalar
@ -338,6 +377,26 @@ int main(int argc, char *argv[])
try_getScalar(dict2, "empty"); try_getScalar(dict2, "empty");
} }
// With getCheck<scalar>
{
Info<< nl << "Test some input with getCheck<scalar>()" << nl;
try_getCheckScalar(dict2, "good", scalarRange::gt0());
try_getCheckScalar(dict2, "negative", scalarRange::gt0());
try_getCheckScalar(dict2, "good", greaterOp1<scalar>(0));
try_getCheckScalar(dict2, "negative", greaterOp1<scalar>(0));
Info<< nl << "with lambda" << nl;
try_getCheckScalar
(
dict2,
"good",
[](const scalar x) { return x > 0; }
);
}
// With findEntry and get<scalar> // With findEntry and get<scalar>
{ {
Info<< nl Info<< nl

View File

@ -27,12 +27,16 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "argList.H" #include "argList.H"
#include "IOobject.H"
#include "IOstreams.H" #include "IOstreams.H"
#include "IFstream.H" #include "IFstream.H"
#include "Switch.H" #include "Switch.H"
#include "SubStrings.H"
#include "regExpCxx.H" #include "regExpCxx.H"
#ifndef _WIN32
#include "regExpPosix.H" #include "regExpPosix.H"
#endif
using namespace Foam; using namespace Foam;
@ -83,6 +87,7 @@ static Ostream& operator<<(Ostream& os, const regExpCxx::results_type& sm)
// Simple output of match groups // Simple output of match groups
#ifndef _WIN32
static Ostream& operator<<(Ostream& os, const regExpPosix::results_type& sm) static Ostream& operator<<(Ostream& os, const regExpPosix::results_type& sm)
{ {
for (std::smatch::size_type i = 1; i < sm.size(); ++i) for (std::smatch::size_type i = 1; i < sm.size(); ++i)
@ -92,6 +97,7 @@ static Ostream& operator<<(Ostream& os, const regExpPosix::results_type& sm)
return os; return os;
} }
#endif
template<class RegexType> template<class RegexType>
@ -209,7 +215,6 @@ void generalTests()
} }
template<class RegexType> template<class RegexType>
void testExpressions(const UList<regexTest>& tests) void testExpressions(const UList<regexTest>& tests)
{ {
@ -293,11 +298,13 @@ int main(int argc, char *argv[])
"Test C++11 regular expressions" "Test C++11 regular expressions"
); );
#ifndef _WIN32
argList::addBoolOption argList::addBoolOption
( (
"posix", "posix",
"Test POSIX regular expressions" "Test POSIX regular expressions"
); );
#endif
argList::addArgument("file"); argList::addArgument("file");
argList::addArgument("..."); argList::addArgument("...");
@ -306,6 +313,17 @@ int main(int argc, char *argv[])
#include "setRootCase.H" #include "setRootCase.H"
if (std::is_same<regExp, regExpCxx>::value)
{
Info<<"Foam::regExp uses C++11 regex" << nl << nl;
}
#ifndef _WIN32
if (std::is_same<regExp, regExpPosix>::value)
{
Info<<"Foam::regExp uses POSIX regex" << nl << nl;
}
#endif
if (!args.count({"cxx", "posix"})) if (!args.count({"cxx", "posix"}))
{ {
Info<< "Specified one or more of -cxx, -posix" << nl; Info<< "Specified one or more of -cxx, -posix" << nl;
@ -321,10 +339,12 @@ int main(int argc, char *argv[])
generalTests<regExpCxx>(); generalTests<regExpCxx>();
} }
#ifndef _WIN32
if (args.found("posix")) if (args.found("posix"))
{ {
generalTests<regExpPosix>(); generalTests<regExpPosix>();
} }
#endif
} }
for (label argi = 1; argi < args.size(); ++argi) for (label argi = 1; argi < args.size(); ++argi)
@ -339,10 +359,12 @@ int main(int argc, char *argv[])
testExpressions<regExpCxx>(tests); testExpressions<regExpCxx>(tests);
} }
#ifndef _WIN32
if (args.found("posix")) if (args.found("posix"))
{ {
testExpressions<regExpPosix>(tests); testExpressions<regExpPosix>(tests);
} }
#endif
} }
Info<< "\nDone" << nl << endl; Info<< "\nDone" << nl << endl;

View File

@ -0,0 +1,23 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1812 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Pattern, String
(
( true "(U|k|epsilon)" "U" )
( false "(U|k|epsilon)" "alpha" )
( true "ab.*" "abc" )
( true ".*" "abc" )
( true "div\(phi,alpha.*)" "div(phi,alpha.gas)" ) // quoting error
( true "div\(phi,alpha.*\)" "div(phi,alpha.gas)" )
( true "div\(phi,alpha\..*\)" "div(phi,alpha.gas)" )
)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -36,6 +36,8 @@ Description
#include "FlatOutput.H" #include "FlatOutput.H"
#include "Tuple2.H" #include "Tuple2.H"
#include "StringStream.H" #include "StringStream.H"
#include "ops.H"
#include "bitSet.H"
using namespace Foam; using namespace Foam;
@ -44,7 +46,7 @@ void doTest(const scalarList& values, const predicates::scalars& accept)
{ {
// Also tests that output is suppressed // Also tests that output is suppressed
Info<<"Have: " << accept.size() << " predicates" << accept << endl; Info<<"Have: " << accept.size() << " predicates" << accept << endl;
Info<<"values: " << flatOutput(values) << endl; Info<<"values: " << flatOutput(values) << endl;
for (const scalar& value : values) for (const scalar& value : values)
{ {
@ -60,6 +62,30 @@ void doTest(const scalarList& values, const predicates::scalars& accept)
} }
template<class Predicate>
void testPredicate(const scalarList& values, const Predicate& pred)
{
bitSet matches;
label i=0;
for (const scalar& value : values)
{
if (pred(value))
{
matches.set(i);
}
++i;
}
IndirectList<scalar> matched(values, matches.toc());
Info<< "matched: " << flatOutput(matched.addressing())
<< " = " << flatOutput(matched) << nl;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Main program: // Main program:
@ -149,6 +175,16 @@ int main(int argc, char *argv[])
} }
Info<< nl << "Test with ops" << nl;
Info<<"values: " << flatOutput(values) << endl;
{
testPredicate(values, lessOp1<scalar>(10));
testPredicate(values, greaterOp1<scalar>(100));
// Also with dissimilar type
testPredicate(values, lessEqOp1<label>(0));
}
Info<< "\nEnd\n" << endl; Info<< "\nEnd\n" << endl;
return 0; return 0;

View File

@ -47,6 +47,12 @@ int main(int argc, char *argv[])
{ {
printTest(); printTest();
#ifdef FULLDEBUG
Info<< nl << "Compiled with FULLDEBUG" << nl;
#else
Info<< nl << "Regular compilation" << nl;
#endif
Info<< "\nEnd\n" << nl; Info<< "\nEnd\n" << nl;
return 0; return 0;

View File

@ -779,7 +779,7 @@ int main(int argc, char *argv[])
const bool overwrite = args.found("overwrite"); const bool overwrite = args.found("overwrite");
const bool checkGeometry = args.found("checkGeometry"); const bool checkGeometry = args.found("checkGeometry");
const bool surfaceSimplify = args.found("surfaceSimplify"); const bool surfaceSimplify = args.found("surfaceSimplify");
const bool dryRun = args.optionFound("dry-run"); const bool dryRun = args.found("dry-run");
if (dryRun) if (dryRun)
{ {
@ -788,7 +788,6 @@ int main(int argc, char *argv[])
} }
#include "createNamedMesh.H" #include "createNamedMesh.H"
Info<< "Read mesh in = " Info<< "Read mesh in = "
<< runTime.cpuTimeIncrement() << " s" << endl; << runTime.cpuTimeIncrement() << " s" << endl;

View File

@ -2307,7 +2307,9 @@ int main(int argc, char *argv[])
// ~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~
// (replacement for setRootCase that does not abort) // (replacement for setRootCase that does not abort)
Foam::argList args(argc, argv); argList args(argc, argv);
#include "foamDlOpenLibs.H"
const bool reconstruct = args.found("reconstruct"); const bool reconstruct = args.found("reconstruct");
const bool writeCellDist = args.found("cellDist"); const bool writeCellDist = args.found("cellDist");
const bool dryrun = args.found("dry-run"); const bool dryrun = args.found("dry-run");

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | \\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
| Copyright (C) 2011-2016 OpenFOAM Foundation | Copyright (C) 2011-2016 OpenFOAM Foundation
@ -313,7 +313,7 @@ void rewriteField
if if
( (
boundaryField.found(patchName) boundaryField.found(patchName)
&& !boundaryField.found(newName, false, false) && !boundaryField.found(newName, keyType::LITERAL)
) )
{ {
Info<< " Changing entry " << patchName << " to " << newName Info<< " Changing entry " << patchName << " to " << newName

View File

@ -276,11 +276,11 @@ int main(int argc, char *argv[])
argList args(argc, argv); argList args(argc, argv);
if (!args.check()) if (!args.check())
{ {
FatalError.exit(); FatalError.exit();
} }
#include "foamDlOpenLibs.H"
fileName rootDirTarget(args.rootPath()); fileName rootDirTarget(args.rootPath());
fileName caseDirTarget(args.globalCaseName()); fileName caseDirTarget(args.globalCaseName());

View File

@ -208,6 +208,7 @@ int main(int argc, char *argv[])
); );
argList args(argc, argv); argList args(argc, argv);
#include "foamDlOpenLibs.H"
fileName rootDirTarget(args.rootPath()); fileName rootDirTarget(args.rootPath());
fileName caseDirTarget(args.globalCaseName()); fileName caseDirTarget(args.globalCaseName());

1
bin/Co
View File

@ -1 +0,0 @@
deprecated/Co

View File

@ -1 +0,0 @@
deprecated/Lambda2

View File

@ -1 +0,0 @@
deprecated/Mach

1
bin/Pe
View File

@ -1 +0,0 @@
deprecated/Pe

1
bin/Q
View File

@ -1 +0,0 @@
deprecated/Q

1
bin/R
View File

@ -1 +0,0 @@
deprecated/R

View File

@ -1 +0,0 @@
deprecated/createTurbulenceFields

View File

@ -1,41 +0,0 @@
#!/bin/sh
#------------------------------------------------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd |
# \\/ M anipulation |
#-------------------------------------------------------------------------------
# | Copyright (C) 2016 OpenFOAM Foundation
#------------------------------------------------------------------------------
# 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/>.
#
# Script
# Co
#
# Description
# Script to suggest using the new "-postProcess" solver option.
#
#------------------------------------------------------------------------------
Script=${0##*/}
echo $Script "has been superceded by the -postProcess solver option:"
echo "<solverName> -func CourantNo"
echo "e.g."
echo "pimpleFoam -postProcess -func CourantNo"
#------------------------------------------------------------------------------

View File

@ -1 +0,0 @@
supercededByPostProcess

View File

@ -1,41 +0,0 @@
#!/bin/sh
#------------------------------------------------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd |
# \\/ M anipulation |
#-------------------------------------------------------------------------------
# | Copyright (C) 2016 OpenFOAM Foundation
#------------------------------------------------------------------------------
# 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/>.
#
# Script
# Mach
#
# Description
# Script to suggest using the new "-postProcess" solver option.
#
#------------------------------------------------------------------------------
Script=${0##*/}
echo $Script "has been superceded by the -postProcess solver option:"
echo "<solverName> -func MachNo"
echo "e.g."
echo "sonicFoam -postProcess -func MachNo"
#------------------------------------------------------------------------------

View File

@ -1,41 +0,0 @@
#!/bin/sh
#------------------------------------------------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd |
# \\/ M anipulation |
#-------------------------------------------------------------------------------
# | Copyright (C) 2016 OpenFOAM Foundation
#------------------------------------------------------------------------------
# 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/>.
#
# Script
# Pe
#
# Description
# Script to suggest using the new "-postProcess" solver option.
#
#------------------------------------------------------------------------------
Script=${0##*/}
echo $Script "has been superceded by the -postProcess solver option:"
echo "<solverName> -func PecletNo"
echo "e.g."
echo "pimpleFoam -postProcess -func PecletNo"
#------------------------------------------------------------------------------

View File

@ -1 +0,0 @@
supercededByPostProcess

View File

@ -1 +0,0 @@
supercededByPostProcessOption

View File

@ -1,42 +0,0 @@
#!/bin/sh
#------------------------------------------------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd |
# \\/ M anipulation |
#-------------------------------------------------------------------------------
# | Copyright (C) 2016 OpenFOAM Foundation
#------------------------------------------------------------------------------
# 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/>.
#
# Script
# createTurbulenceFields
#
# Description
# Replacement script to suggest using the new "-postProcess"
# solver command-line option.
#
#------------------------------------------------------------------------------
Script=${0##*/}
echo $Script "has been superceded by the \
'-postProcess' solver command-line option, e.g."
echo "simpleFoam -postProcess -func 'turbulenceFields(R, omega)'"
#------------------------------------------------------------------------------

View File

@ -1 +0,0 @@
supercededByPostProcess

View File

@ -1,42 +0,0 @@
#!/bin/sh
#------------------------------------------------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd |
# \\/ M anipulation |
#-------------------------------------------------------------------------------
# | Copyright (C) 2016 OpenFOAM Foundation
#------------------------------------------------------------------------------
# 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/>.
#
# Script
# execFlowFunctionObjects
#
# Description
# Replacement execFlowFunctionObjects to suggest using the "-postProcess"
# solver command-line option.
#
#------------------------------------------------------------------------------
echo "execFlowFunctionObjects has been superceded by the \
'-postProcess' solver command-line option, e.g."
echo "simpleFoam -help -postProcess"
simpleFoam -help -postProcess
#------------------------------------------------------------------------------

View File

@ -1 +0,0 @@
supercededByPostProcess

View File

@ -1,39 +0,0 @@
#!/bin/sh
#------------------------------------------------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd |
# \\/ M anipulation |
#-------------------------------------------------------------------------------
# | Copyright (C) 2016 OpenFOAM Foundation
#------------------------------------------------------------------------------
# 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/>.
#
# Script
# foamCalc
#
# Description
# Replacement foamCalc to suggest using the new "postProcess" utility.
#
#------------------------------------------------------------------------------
echo "foamCalc has been superceded by the postProcess utility:"
echo " postProcess -help"
postProcess -help
#------------------------------------------------------------------------------

View File

@ -1,39 +0,0 @@
#!/bin/sh
#------------------------------------------------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd |
# \\/ M anipulation |
#-------------------------------------------------------------------------------
# | Copyright (C) 2016 OpenFOAM Foundation
#------------------------------------------------------------------------------
# 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/>.
#
# Script
# foamDebugSwitches
#
# Description
# Script to suggest using the new "foamList" utility.
#
#------------------------------------------------------------------------------
Script=${0##*/}
echo $Script "has been superceded by the foamList utility:"
echo "foamList -debug"
#------------------------------------------------------------------------------

View File

@ -1,54 +0,0 @@
#!/bin/sh
#------------------------------------------------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd |
# \\/ M anipulation |
#-------------------------------------------------------------------------------
# | Copyright (C) 2011-2017 OpenFOAM Foundation
#------------------------------------------------------------------------------
# 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/>.
#
# Script
# foamGraphExecTime
#
# Description
# Deprecated script extract the 'ExecutionTime' for each time-step from a
# log file for graphing.
#
# Superseded by the more general foamLog script.
#------------------------------------------------------------------------------
Script=${0##*/}
if [ ! -f "$1" ]; then
echo "$Script: $1 is not a valid filename"
exit 1
fi
tmpTime=newTime$$.dat
cat $1 | \
grep "ExecutionTime = " | \
awk 'BEGIN { NENTRIES = 0 ; TPREV = 0.0 }{NENTRIES++; printf("%f %e\n", NENTRIES, $3 - TPREV); TPREV = $3}' - > $tmpTime
if [ "$(cat $tmpTime | wc -l)" -gt 1 ]; then
mv $tmpTime executionTime.dat
fi
rm -f $tmpTime
#------------------------------------------------------------------------------

View File

@ -1,66 +0,0 @@
#!/bin/sh
#------------------------------------------------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd |
# \\/ M anipulation |
#-------------------------------------------------------------------------------
# | Copyright (C) 2011-2017 OpenFOAM Foundation
#------------------------------------------------------------------------------
# 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/>.
#
# Script
# foamGraphResKE
#
# Description
# Deprecated script extract initial turbulence residuals for each time-step
# from a log file for graphing.
#
# Superseded by the more general foamLog script.
#------------------------------------------------------------------------------
Script=${0##*/}
if [ ! -f "$1" ]; then
echo "$Script: $1 is not a valid filename"
exit 1
fi
scan()
{
tmpFile=new$1$$.dat
cat $2 | \
grep "Solving for $1" | \
grep -v "solution singularity" | \
sed s/,//g | \
awk 'BEGIN { NENTRIES = 0 }{NENTRIES++; printf("%d %e\n", NENTRIES, $8)}' - > $tmpFile
if [ "$(cat $tmpFile | wc -l)" -gt 1 ]; then
echo >> residualKE.dat
cat $tmpFile >> residualKE.dat
fi
rm $tmpFile
}
rm -f residualKE.dat
scan "k" $1
scan "epsilon" $1
scan "omega" $1
scan "nuTilda" $1
#------------------------------------------------------------------------------

View File

@ -1,66 +0,0 @@
#!/bin/sh
#------------------------------------------------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd |
# \\/ M anipulation |
#-------------------------------------------------------------------------------
# | Copyright (C) 2011-2017 OpenFOAM Foundation
#------------------------------------------------------------------------------
# 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/>.
#
# Script
# foamGraphResUVWP
#
# Description
# Deprecated script extract initial velocity and pressure residuals for each
# time-step from a log file for graphing.
#
# Superseded by the more general foamLog script.
#------------------------------------------------------------------------------
Script=${0##*/}
if [ ! -f "$1" ]; then
echo "$Script: $1 is not a valid filename"
exit 1
fi
scan()
{
tmpFile=new$1$$.dat
cat $2 | \
grep "Solving for $1" | \
grep -v "solution singularity" | \
sed s/,//g | \
awk 'BEGIN { NENTRIES = 0 }{NENTRIES++; printf("%d %e\n", NENTRIES, $8)}' - > $tmpFile
if [ "$(cat $tmpFile | wc -l)" -gt 1 ]; then
echo >> residualUVWP.dat
cat $tmpFile >> residualUVWP.dat
fi
rm $tmpFile
}
rm -f residualUVWP.dat
scan "Ux" $1
scan "Uy" $1
scan "Uz" $1
scan "p" $1
#------------------------------------------------------------------------------

View File

@ -1,39 +0,0 @@
#!/bin/sh
#------------------------------------------------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd |
# \\/ M anipulation |
#-------------------------------------------------------------------------------
# | Copyright (C) 2016 OpenFOAM Foundation
#------------------------------------------------------------------------------
# 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/>.
#
# Script
# patchAverage
#
# Description
# Script to suggest using the new "postProcess" utility.
#
#------------------------------------------------------------------------------
Script=${0##*/}
echo $Script "has been superceded by the postProcess utility:"
echo " postProcess -func '"$Script"(name=inlet,p)'"
#------------------------------------------------------------------------------

View File

@ -1,39 +0,0 @@
#!/bin/sh
#------------------------------------------------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd |
# \\/ M anipulation |
#-------------------------------------------------------------------------------
# | Copyright (C) 2016 OpenFOAM Foundation
#------------------------------------------------------------------------------
# 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/>.
#
# Script
# patchIntegrate
#
# Description
# Script to suggest using the new "postProcess" utility.
#
#------------------------------------------------------------------------------
Script=${0##*/}
echo $Script "has been superceded by the postProcess utility:"
echo " postProcess -func '"$Script"(name=inlet,p)'"
#------------------------------------------------------------------------------

View File

@ -1,41 +0,0 @@
#!/bin/sh
#------------------------------------------------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd |
# \\/ M anipulation |
#-------------------------------------------------------------------------------
# | Copyright (C) 2016 OpenFOAM Foundation
#------------------------------------------------------------------------------
# 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/>.
#
# Script
# probeLocations
#
# Description
# Script to suggest using the new "postProcess" utility.
#
#------------------------------------------------------------------------------
Script=${0##*/}
echo $Script "has been superceded by the postProcess utility:"
echo " postProcess -func probes"
echo "or"
echo " postProcess -func 'probes(p, U)'"
#------------------------------------------------------------------------------

View File

@ -1,41 +0,0 @@
#!/bin/sh
#------------------------------------------------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd |
# \\/ M anipulation |
#-------------------------------------------------------------------------------
# | Copyright (C) 2016 OpenFOAM Foundation
#------------------------------------------------------------------------------
# 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/>.
#
# Script
# ptot
#
# Description
# Script to suggest using the new "postProcess" utility.
#
#------------------------------------------------------------------------------
Script=${0##*/}
echo $Script "has been superceded by the postProcess utility:"
echo " postProcess -func 'totalPressureIncompressible(U,p)'"
echo "or"
echo " postProcess -func 'totalPressureCompressible(rho,U,p)'"
#------------------------------------------------------------------------------

View File

@ -1,45 +0,0 @@
#!/bin/sh
#------------------------------------------------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd |
# \\/ M anipulation |
#-------------------------------------------------------------------------------
# | Copyright (C) 2016 OpenFOAM Foundation
#------------------------------------------------------------------------------
# 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/>.
#
# Script
# probeLocations
#
# Description
# Script to suggest using the new "postProcess" utility.
#
#------------------------------------------------------------------------------
Script=${0##*/}
echo $Script "has been superceded by the postProcess utility:"
echo " postProcess -func $Script"
echo
echo "To re-use existing 'sampleDict' files simply add the following entries:"
echo " type sets;"
echo " libs (\"libsampling.so\");"
echo "and run"
echo " postProcess -func sampleDict"
#------------------------------------------------------------------------------

View File

@ -1 +0,0 @@
supercededByPostProcess

View File

@ -1,41 +0,0 @@
#!/bin/sh
#------------------------------------------------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd |
# \\/ M anipulation |
#-------------------------------------------------------------------------------
# | Copyright (C) 2016-2017 OpenFOAM Foundation
#------------------------------------------------------------------------------
# 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/>.
#
# Script
# stressComponents
#
# Description
# Script to suggest using the new "-postProcess" solver option.
#
#------------------------------------------------------------------------------
Script=${0##*/}
echo $Script "has been superseded by the -postProcess solver option:"
echo "<solverName> -funcs '(R components(turbulenceProperties:R))'"
echo "e.g."
echo "simpleFoam -postProcess -funcs '(R components(turbulenceProperties:R))'"
#------------------------------------------------------------------------------

View File

@ -1,39 +0,0 @@
#!/bin/sh
#------------------------------------------------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd |
# \\/ M anipulation |
#-------------------------------------------------------------------------------
# | Copyright (C) 2016 OpenFOAM Foundation
#------------------------------------------------------------------------------
# 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/>.
#
# Script
# supercededByPostProcess
#
# Description
# Script to suggest using the new "postProcess" utility.
#
#------------------------------------------------------------------------------
Script=${0##*/}
echo $Script "has been superceded by the postProcess utility:"
echo " postProcess -func" $Script
#------------------------------------------------------------------------------

View File

@ -1,42 +0,0 @@
#!/bin/sh
#------------------------------------------------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd |
# \\/ M anipulation |
#-------------------------------------------------------------------------------
# | Copyright (C) 2016 OpenFOAM Foundation
#------------------------------------------------------------------------------
# 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/>.
#
# Script
# supercededByPostProcessOption
#
# Description
# Replacement script to suggest using the new "-postProcess"
# solver command-line option.
#
#------------------------------------------------------------------------------
Script=${0##*/}
echo $Script "has been superceded by the \
'-postProcess' solver command-line option, e.g."
echo "simpleFoam -postProcess -func" $Script
#------------------------------------------------------------------------------

View File

@ -1 +0,0 @@
supercededByPostProcess

View File

@ -1,39 +0,0 @@
#!/bin/sh
#------------------------------------------------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd |
# \\/ M anipulation |
#-------------------------------------------------------------------------------
# | Copyright (C) 2017 OpenFOAM Foundation
#------------------------------------------------------------------------------
# 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/>.
#
# Script
# wallGradU
#
# Description
# Script to suggest using the new "postProcess" utility.
#
#------------------------------------------------------------------------------
Script=${0##*/}
echo $Script "has been superseded by the postProcess utility:"
echo " postProcess -func 'grad(U)'"
#------------------------------------------------------------------------------

View File

@ -1 +0,0 @@
supercededByPostProcessOption

View File

@ -1 +0,0 @@
supercededByPostProcessOption

View File

@ -1,39 +0,0 @@
#!/bin/sh
#------------------------------------------------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd |
# \\/ M anipulation |
#-------------------------------------------------------------------------------
# | Copyright (C) 2017 OpenFOAM Foundation
#------------------------------------------------------------------------------
# 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/>.
#
# Script
# wdot
#
# Description
# Script to suggest using the new "postProcess" utility.
#
#------------------------------------------------------------------------------
Script=${0##*/}
echo $Script "has been superseded by the postProcess utility:"
echo "postProcess -func XiReactionRate"
#------------------------------------------------------------------------------

View File

@ -1 +0,0 @@
supercededByPostProcess

View File

@ -1 +0,0 @@
supercededByPostProcessOption

View File

@ -1 +0,0 @@
deprecated/enstrophy

View File

@ -1 +0,0 @@
deprecated/execFlowFunctionObjects

View File

@ -1 +0,0 @@
deprecated/flowType

View File

@ -1 +0,0 @@
deprecated/foamCalc

View File

@ -45,6 +45,7 @@ options:
-case <dir> Alternative case directory, default is the cwd -case <dir> Alternative case directory, default is the cwd
-ext <ext> File extension -ext <ext> File extension
-cfg Same as '-e cfg' for '.cfg' files -cfg Same as '-e cfg' for '.cfg' files
-f | -force Force overwrite of existing files
-no-ext Files without extension -no-ext Files without extension
-target <dir> Target directory (default: system, or auto-detected) -target <dir> Target directory (default: system, or auto-detected)
-with-api=NUM Alternative api value for searching -with-api=NUM Alternative api value for searching
@ -86,7 +87,7 @@ projectApi="$FOAM_API"
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
searchExt="<any>" searchExt="<any>"
unset targetDir unset targetDir optForce
while [ "$#" -gt 0 ] while [ "$#" -gt 0 ]
do do
@ -113,6 +114,9 @@ do
-cfg) -cfg)
searchExt="cfg" searchExt="cfg"
;; ;;
-f | -force)
optForce=true
;;
-target) -target)
[ "$#" -ge 2 ] || die "'$1' option requires an argument" [ "$#" -ge 2 ] || die "'$1' option requires an argument"
targetDir="$2" targetDir="$2"
@ -221,12 +225,27 @@ findFiles()
} }
# Slightly dressed up version of 'cp -v' # Slightly dressed up version of 'cp -v' that does not clobber existing files
copyFile() copyFile()
{ {
local targetFile="$2"
[ -d "$2" ] && targetFile="$targetFile/${1##*/}"
echo 1>&2 echo 1>&2
echo "Copying $1 to $2" 1>&2 if [ -f "$targetFile" ]
\cp "$1" "$2" then
if [ "$optForce" = true ]
then
echo "Overwrite $1 to $2" 1>&2
\cp "$1" "$2"
else
echo "Skip copy $1 to $2" 1>&2
fi
else
echo "Copying $1 to $2" 1>&2
\cp "$1" "$2"
fi
echo 1>&2 echo 1>&2
} }

View File

@ -1 +0,0 @@
deprecated/foamGraphExecTime

View File

@ -1 +0,0 @@
deprecated/foamGraphResKE

View File

@ -1 +0,0 @@
deprecated/foamGraphResUVWP

View File

@ -1 +0,0 @@
deprecated/patchAverage

View File

@ -1 +0,0 @@
deprecated/patchIntegrate

View File

@ -1 +0,0 @@
deprecated/probeLocations

View File

@ -1 +0,0 @@
deprecated/ptot

View File

@ -1 +0,0 @@
deprecated/sample

View File

@ -1 +0,0 @@
deprecated/streamFunction

View File

@ -1 +0,0 @@
deprecated/stressComponents

View File

@ -39,7 +39,7 @@ cleanTimeDirectories()
cleanDynamicCode() cleanDynamicCode()
{ {
if [ -d system -a -d dynamicCode ] if [ -d dynamicCode ] && [ -d system ]
then then
rm -rf dynamicCode > /dev/null 2>&1 rm -rf dynamicCode > /dev/null 2>&1
fi fi
@ -73,22 +73,28 @@ cleanSnappyFiles()
} }
cleanPostProcessing()
{
rm -rf Ensight EnSight ensightWrite insitu VTK > /dev/null 2>&1
rm -rf postProcessing > /dev/null 2>&1
rm -rf cuttingPlane > /dev/null 2>&1
rm -rf surfaceSampling > /dev/null 2>&1
}
cleanCase() cleanCase()
{ {
cleanTimeDirectories cleanTimeDirectories
cleanPostProcessing
cleanDynamicCode cleanDynamicCode
rm -rf processor* > /dev/null 2>&1 rm -rf processor* > /dev/null 2>&1
rm -rf postProcessing > /dev/null 2>&1
rm -rf TDAC > /dev/null 2>&1 rm -rf TDAC > /dev/null 2>&1
rm -rf probes* > /dev/null 2>&1 rm -rf probes* > /dev/null 2>&1
rm -rf forces* > /dev/null 2>&1 rm -rf forces* > /dev/null 2>&1
rm -rf graphs* > /dev/null 2>&1 rm -rf graphs* > /dev/null 2>&1
rm -rf sets > /dev/null 2>&1 rm -rf sets > /dev/null 2>&1
rm -rf surfaceSampling > /dev/null 2>&1
rm -rf cuttingPlane > /dev/null 2>&1
rm -rf system/machines > /dev/null 2>&1 rm -rf system/machines > /dev/null 2>&1
rm -rf Ensight EnSight ensightWrite insitu VTK > /dev/null 2>&1
# From mpirunDebug # From mpirunDebug
rm -f gdbCommands mpirun.schema rm -f gdbCommands mpirun.schema
@ -149,7 +155,7 @@ removeCase()
cleanSamples() cleanSamples()
{ {
rm -rf ./sets ./samples ./sampleSurfaces > /dev/null 2>&1 rm -rf sets samples sampleSurfaces > /dev/null 2>&1
} }

View File

@ -241,6 +241,12 @@ runParallel()
# Any additional parsed arguments (eg, decomposeParDict) # Any additional parsed arguments (eg, decomposeParDict)
local appArgs="-parallel" local appArgs="-parallel"
local mpirun="mpirun"
if [ "$FOAM_MPI" = msmpi ]
then
mpirun="mpiexec"
fi
# Parse options until executable is encountered # Parse options until executable is encountered
while [ $# -gt 0 -a -z "$appRun" ] while [ $# -gt 0 -a -z "$appRun" ]
do do
@ -287,11 +293,11 @@ runParallel()
if [ "$logMode" = append ] if [ "$logMode" = append ]
then then
( (
mpirun -np $nProcs $appRun $appArgs "$@" </dev/null >> $logFile 2>&1 $mpirun -np $nProcs $appRun $appArgs "$@" </dev/null >> $logFile 2>&1
) )
else else
( (
mpirun -np $nProcs $appRun $appArgs "$@" </dev/null > $logFile 2>&1 $mpirun -np $nProcs $appRun $appArgs "$@" </dev/null > $logFile 2>&1
) )
fi fi
fi fi

View File

@ -1 +0,0 @@
deprecated/vorticity

View File

@ -1 +0,0 @@
deprecated/wallGradU

View File

@ -1 +0,0 @@
deprecated/wallHeatFlux

View File

@ -1 +0,0 @@
deprecated/wallShearStress

View File

@ -1 +0,0 @@
deprecated/wdot

View File

@ -1 +0,0 @@
deprecated/writeCellCentres

View File

@ -1 +0,0 @@
deprecated/yPlus

View File

@ -1,539 +0,0 @@
# -*- mode: org; -*-
#
#+TITLE: OpenFOAM C++ Style Guide
#+AUTHOR: OpenFOAM Foundation
#+DATE: 2011-2016
#+LINK: http://OpenFOAM.com
#+OPTIONS: author:nil ^:{}
#+STARTUP: hidestars
#+STARTUP: odd
* Code
*** General
+ 80 character lines max
+ The normal indentation is 4 spaces per logical level.
+ Use spaces for indentation, not tab characters.
+ Avoid trailing whitespace.
+ The body of control statements (eg, =if=, =else=, =while=, /etc./). is
always delineated with braces. A possible exception can be
made in conjunction with =break= or =continue= as part of a control
structure.
+ The body of =case= statements is usually delineated with braces.
+ Stream output
+ =<<= is always four characters after the start of the stream,
so that the =<<= symbols align, i.e.
#+begin_src C++
Info<< ...
os << ...
#+end_src
so
#+begin_src C++
WarningInFunction
<< "Warning message"
#+end_src
*not*
#+begin_src C++
WarningInFunction
<< "Warning message"
#+end_src
+ Remove unnecessary class section headers, i.e. remove
#+begin_src C++
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// Check
// Edit
// Write
#+end_src
if they contain nothing, even if planned for 'future use'
+ Class titles should be centred
#+begin_src C++
/*---------------------------------------------------------------------------*\
Class exampleClass Declaration
\*---------------------------------------------------------------------------*/
#+end_src
*not*
#+begin_src C++
/*---------------------------------------------------------------------------*\
Class exampleClass Declaration
\*---------------------------------------------------------------------------*/
#+end_src
*** The /.H/ Header Files
+ Header file spacing
+ Leave two empty lines between sections
(as per functions in the /.C/ file /etc./)
+ Use =//- Comment= comments in header file to add descriptions to class
data and functions do be included in the Doxygen documentation:
+ Text on the line starting with =//-= becomes the Doxygen brief
description;
+ Text on subsequent lines becomes the Doxygen detailed description /e.g./
#+begin_src C++
//- A function which returns a thing
// This is a detailed description of the function
// which processes stuff and returns other stuff
// depending on things.
thing function(stuff1, stuff2);
#+end_src
+ List entries start with =-= or =-#= for numbered lists but cannot start
on the line immediately below the brief description so
#+begin_src C++
//- Compare triFaces
// Returns:
// - 0: different
// - +1: identical
// - -1: same face, but different orientation
static int compare(const triFace&, const triFace&);
#+end_src
or
#+begin_src C++
//- Compare triFaces returning 0, +1 or -1
//
// - 0: different
// - +1: identical
// - -1: same face, but different orientation
static int compare(const triFace&, const triFace&);
#+end_src
*not*
#+begin_src C++
//- Compare triFaces returning 0, +1 or -1
// - 0: different
// - +1: identical
// - -1: same face, but different orientation
static int compare(const triFace&, const triFace&);
#+end_src
+ List can be nested for example
#+begin_src C++
//- Search for \em name
// in the following hierarchy:
// -# user settings
// - ~/.OpenFOAM/\<VERSION\>/
// <em>for version-specific files</em>
// - ~/.OpenFOAM/
// <em>for version-independent files</em>
// -# group settings
// - $WM_PROJECT_DIR/site/\<VERSION\>
// <em>for version-specific files</em>
// - $WM_PROJECT_DIR/site/
// <em>for version-independent files</em>
// -# other (shipped) settings
// - $WM_PROJECT_DIR/etc/
//
// \return the full path name or fileName() if the name cannot be found
// Optionally abort if the file cannot be found
fileName findEtcFile(const fileName&, bool mandatory=false);
#+end_src
+ For more details see the Doxygen documentation.
+ Destructor
+ When adding a comment to the destructor use =//-= and code as a normal
function:
#+begin_src C++
//- Destructor
~className();
#+end_src
+ Inline functions
+ Use inline functions where appropriate in a separate /classNameI.H/
file. Avoid cluttering the header file with function bodies.
*** The /.C/ Source Files
+ Do not open/close namespaces in a /.C/ file
+ Fully scope the function name, i.e.
#+begin_src C++
Foam::returnType Foam::className::functionName()
#+end_src
*not*
#+begin_src C++
namespace Foam
{
...
returnType className::functionName()
...
}
#+end_src
*Exception*
When there are multiple levels of namespace, they may be used in the
/.C/ file to avoid excessive clutter, i.e.
#+begin_src C++
namespace Foam
{
namespace compressible
{
namespace RASModels
{
...
} // End namespace RASModels
} // End namespace compressible
} // End namespace Foam
#+end_src
+ Use two empty lines between functions
*** Coding Practice
+ Passing data as arguments or return values:
+ Pass bool, label, scalar and other primitive types as copy,
anything larger by reference.
+ =const=
+ Use everywhere it is applicable.
+ Variable initialisation using
#+begin_src C++
const className& variableName = otherClass.data();
#+end_src
*not*
#+begin_src C++
const className& variableName(otherClass.data());
#+end_src
+ Virtual functions
+ If a class is virtual, make all derived classes virtual.
*** Conditional Statements
#+begin_src C++
if (condition)
{
code;
}
#+end_src
OR
#+begin_src C++
if
(
long condition
)
{
code;
}
#+end_src
*not* (no space between =if= and =(= used)
#+begin_src C++
if(condition)
{
code;
}
#+end_src
*** =for= and =while= Loops
#+begin_src C++
for (i = 0; i < maxI; ++i)
{
code;
}
#+end_src
OR
#+begin_src C++
for
(
i = 0;
i < maxI;
++i
)
{
code;
}
#+end_src
*not* this (no space between =for= and =(= used)
#+begin_src C++
for(i = 0; i < maxI; ++i)
{
code;
}
#+end_src
Range-base for should have a space surrounding the ':'
#+begin_src C++
for (auto i : range)
{
code;
}
#+end_src
Note that when indexing through iterators, it is often more efficient
to use the pre-increment form. Eg, =++iter= instead of =iter++=
*** =forAll=, =forAllIters=, =forAllConstIters=, /etc./ loops
Like =for= loops, but
#+begin_src C++
forAll(
#+end_src
*not*
#+begin_src C++
forAll (
#+end_src
In many cases, the new =forAllIters= and =forAllConstIters= macros
provide a good means of cycling through iterators (when a range-base
for doesn't apply). These use the C++11 decltype and work without
explicitly specifying the container class:
#+begin_src C++
forAllIters(myEdgeHash, iter)
#+end_src
Using the older =forAllIter= and =forAllConstIter= macros will
still be seen. However, since they are macros, they will fail if
the iterated object contains any commas /e.g./ following will FAIL!:
#+begin_src C++
forAllIter(HashTable<labelPair, edge, Hash<edge>>, myEdgeHash, iter)
#+end_src
These convenience macros are also generally avoided in other
container classes and OpenFOAM primitive classes.
In certain cases, the range-based for can also be used.
*** Splitting Over Multiple Lines
***** Splitting return type and function name
+ Split initially after the function return type and left align
+ Do not put =const= onto its own line - use a split to keep it with
the function name and arguments.
#+begin_src C++
const Foam::longReturnTypeName&
Foam::longClassName::longFunctionName const
#+end_src
*not*
#+begin_src C++
const Foam::longReturnTypeName&
Foam::longClassName::longFunctionName const
#+end_src
*nor*
#+begin_src C++
const Foam::longReturnTypeName& Foam::longClassName::longFunctionName
const
#+end_src
*nor*
#+begin_src C++
const Foam::longReturnTypeName& Foam::longClassName::
longFunctionName const
#+end_src
+ If it needs to be split again, split at the function name (leaving
behind the preceding scoping =::=s), and again, left align, i.e.
#+begin_src C++
const Foam::longReturnTypeName&
Foam::veryveryveryverylongClassName::
veryveryveryverylongFunctionName const
#+end_src
***** Splitting long lines at an "="
Indent after split
#+begin_src C++
variableName =
longClassName.longFunctionName(longArgument);
#+end_src
OR (where necessary)
#+begin_src C++
variableName =
longClassName.longFunctionName
(
longArgument1,
longArgument2
);
#+end_src
*not*
#+begin_src C++
variableName =
longClassName.longFunctionName(longArgument);
#+end_src
*nor*
#+begin_src C++
variableName = longClassName.longFunctionName
(
longArgument1,
longArgument2
);
#+end_src
*** Maths and Logic
+ Operator spacing
#+begin_src C++
a + b, a - b
a*b, a/b
a & b, a ^ b
a = b, a != b
a < b, a > b, a >= b, a <= b
a || b, a && b
#+end_src
+ Splitting formulae over several lines:
Split and indent as per "splitting long lines at an ="
with the operator on the lower line. Align operator so that first
variable, function or bracket on the next line is 4 spaces indented i.e.
#+begin_src C++
variableName =
a*(a + b)
*exp(c/d)
*(k + t);
#+end_src
This is sometimes more legible when surrounded by extra parentheses:
#+begin_src C++
variableName =
(
a*(a + b)
*exp(c/d)
*(k + t)
);
#+end_src
+ Splitting logical tests over several lines:
outdent the operator so that the next variable to test is aligned with
the four space indentation, i.e.
#+begin_src C++
if
(
a == true
&& b == c
)
#+end_src
* Documentation
*** General
+ For readability in the comment blocks, certain tags are used that are
translated by pre-filtering the file before sending it to Doxygen.
+ The tags start in column 1, the contents follow on the next lines and
indented by 4 spaces. The filter removes the leading 4 spaces from the
following lines until the next tag that starts in column 1.
+ The 'Class' and 'Description' tags are the most important ones.
+ The first paragraph following the 'Description' will be used for the
brief description, the remaining paragraphs become the detailed
description. For example,
#+begin_example C++
Class
Foam::myClass
Description
A class for specifying the documentation style.
The class is implemented as a set of recommendations that may
sometimes be useful.
#+end_example
+ The class name must be qualified by its namespace, otherwise Doxygen
will think you are documenting some other class.
+ If you don't have anything to say about the class (at the moment), use
the namespace-qualified class name for the description. This aids with
finding these under-documented classes later.
#+begin_example C++
Class
Foam::myUnderDocumentedClass
Description
Foam::myUnderDocumentedClass
#+end_example
+ Use 'Class' and 'Namespace' tags in the header files.
The Description block then applies to documenting the class.
+ Use 'InClass' and 'InNamespace' in the source files.
The Description block then applies to documenting the file itself.
#+begin_example C++
InClass
Foam::myClass
Description
Implements the read and writing of files.
#+end_example
*** Doxygen Special Commands
Doxygen has a large number of special commands with a =\= prefix.
Since the filtering removes the leading spaces within the blocks, the
Doxygen commands can be inserted within the block without problems.
#+begin_example C++
InClass
Foam::myClass
Description
Implements the read and writing of files.
An example input file:
\verbatim
patchName
{
type patchType;
refValue 100;
value uniform 1;
}
\endverbatim
Within the implementation, a loop over all patches is done:
\code
forAll(patches, patchi)
{
... // some operation
}
\endcode
#+end_example
*** HTML Special Commands
Since Doxygen also handles HTML tags to a certain extent, the angle
brackets need quoting in the documentation blocks. Non-HTML tags cause
Doxygen to complain, but seem to work anyhow. /e.g./,
+ The template with type =<HR>= is a bad example.
+ The template with type =\<HR\>= is a better example.
+ The template with type =<Type>= causes Doxygen to complain about an
unknown html type, but it seems to work okay anyhow.
*** Documenting Namespaces
+ If namespaces are explicitly declared with the =Namespace()= macro,
they should be documented there.
+ If the namespaces is used to hold sub-models, the namespace can be
documented in the same file as the class with the model selector.
/e.g./,
#+begin_example C++
documented namespace 'Foam::functionEntries' within the
class 'Foam::functionEntry'
#+end_example
+ If nothing else helps, find some sensible header.
/e.g./,
#+begin_example C++
namespace 'Foam' is documented in the foamVersion.H file
#+end_example
*** Documenting Applications
Any number of classes might be defined by a particular application, but
these classes will not, however, be available to other parts of
OpenFOAM. At the moment, the sole purpose for running Doxygen on the
applications is to extract program usage information for the '-doc'
option.
The documentation for a particular application is normally contained
within the first comment block in a /.C/ source file. The solution is this
to invoke a special filter for the "/applications/{solver,utilities}/"
directories that only allows the initial comment block for the /.C/ files
through.
The layout of the application documentation has not yet been finalized,
but foamToVTK shows an initial attempt.
*** Orthography
Given the origins of OpenFOAM, the British spellings (/e.g./, neighbour and
not neighbor) are generally favoured.
Both '-ize' and the '-ise' variant are found in the code comments. If
used as a variable or class method name, it is probably better to use
'-ize', which is considered the main form by the Oxford University
Press. /e.g./,
#+begin_src C++
myClass.initialize()
#+end_src
*** References
References provided in the =Description= section of the class header files
should be formatted in the [[http://www.apastyle.org][APA (American
Psychological Association)]] style /e.g./ from =kEpsilon.H=
#+begin_example
Description
Standard k-epsilon turbulence model for incompressible and compressible
flows including rapid distortion theory (RDT) based compression term.
Reference:
\verbatim
Standard model:
Launder, B. E., & Spalding, D. B. (1972).
Lectures in mathematical models of turbulence.
Launder, B. E., & Spalding, D. B. (1974).
The numerical computation of turbulent flows.
Computer methods in applied mechanics and engineering,
3(2), 269-289.
For the RDT-based compression term:
El Tahry, S. H. (1983).
k-epsilon equation for compressible reciprocating engine flows.
Journal of Energy, 7(4), 345-353.
\endverbatim
#+end_example
The APA style is a commonly used standard and references are available in
this format from many sources including
[[http://www.citationmachine.net/apa/cite-a-book][Citation Machine]] and
[[http://scholar.google.com][Google Scholar]].

View File

@ -1,126 +0,0 @@
# Notes for cross-compiling with mingw
## Host setup
On openSUSE use the packages for compilation:
```
mingw64-cross-binutils
mingw64-cross-cpp
mingw64-cross-gcc
mingw64-cross-gcc-c++
mingw64-filesystem
mingw64-headers
mingw64-runtime
mingw64-libwinpthread1
mingw64-winpthreads-devel
mingw64-libfftw3
mingw64-fftw3-devel
```
This setup is missing `zlib`, so download that manually and compile as a
*static* library.
```
CC="$(wmake -show-c)" CFLAGS="$(wmake -show-cflags)" ./configure --static
make
```
The resulting output files (zconf.h zlib.h) and (libz.a) either need
to be installed in system locations where OpenFOAM can find them, or if
they are to be shipped directly with OpenFOAM, they can also be placed
in the `src/OpenFOAM/include` and `platforms/XXX/lib` paths.
If the header files are only needed during compilation, it can be a
fairly convenient hack to simply place copies of them in the
`src/OSspecific/MSwindows` directory.
Flex is used in a few locations within OpenFOAM for generating code.
The generated C++ code requires the `FlexLexer.h` header file, but
its `/usr/include` location will be ignored by the cross-compiler.
As another ugly hack, a copy of this file can be made in a standard
project include location. For example,
```
ln -s /usr/include/FlexLexer.h src/OSspecific/MSwindows
```
The last point to consider when cross-compiling is the behaviour of
the OpenFOAM tools used during compilation. These are found under
`wmake/src`. When these are compiled they will create executables that
work on the target platform (Windows), but *not* on the host platform.
The workaround:
1. Activate the native OpenFOAM environment (Linux with system gcc)
and use that to compile the build tools
```
wmake/src/Allmake
```
This can be skipped if you already have an existing OpenFOAM build.
2. Activate the OpenFOAM for cross-compiling (Linux with mingw)
and use that to compile the build tools
```
wmake/src/Allmake
```
3. Copy the contents of the native platform build tools into the
cross-compilation platform directory. For example,
```
cp wmake/platforms/linux64Gcc/* wmake/platforms/linux64Mingw/
```
The `wmake/platforms/linux64Mingw/` directory should now contain
native and cross-compiled tools:
```
dirToString dirToString.exe
wmkdep wmkdep.exe
wmkdepend wmkdepend.exe
```
The native tools are the one that will (automatically) be used
throughout the balance of the cross-compilation process.
The settings for cross-compilation are normally defined in the
`etc/pref.sh` file with contents like this:
```
# For mingw cross-compile
export WM_COMPILER=Mingw
export WM_MPLIB=MSMPI
export WM_LABEL_SIZE=32
# other settings...
```
Additional adjustments may be required in some other places. For example
in `etc/config.sh/FFTW`
```
fftw_version=fftw-system
export FFTW_ARCH_PATH=/usr/x86_64-w64-mingw32/sys-root/mingw
```
## Run-time setup
When using the cross-compiled executables and libraries, the
corresponding runtime libraries will be required.
These will need to be copied across from the Linux host system to the
target machine.
On openSUSE these runtime libraries are provided by the packages:
```
mingw64-libgcc_s_seh1
mingw64-libstdc++6
```
When running, the `WM_PROJECT_DIR` environment must be set.
OpenFOAM will otherwise not be able to locate its files.
## Known limitations (2019-05-01)
- kahip does not build
- boost should build ok, but no CGAL support (ie, no foamyHexMesh)
- no ParaView plugin, runTimePostProcessing
- reacting EulerFoam solvers have too many interdependencies and do
not yet compile cleanly.

View File

@ -81,7 +81,7 @@ export WM_COMPILER=Gcc
export WM_ARCH_OPTION=64 export WM_ARCH_OPTION=64
# [WM_PRECISION_OPTION] - Floating-point precision: # [WM_PRECISION_OPTION] - Floating-point precision:
# = DP | SP # = DP | SP | SPDP
export WM_PRECISION_OPTION=DP export WM_PRECISION_OPTION=DP
# [WM_LABEL_SIZE] - Label size in bits: # [WM_LABEL_SIZE] - Label size in bits:

View File

@ -19,15 +19,15 @@ FoamFile
type runTimePostProcessing; type runTimePostProcessing;
// Where to load it from // Where to load it from
libs ("librunTimePostProcessing.so"); libs ("runTimePostProcessing");
// Function object enabled flag // Function object enabled flag
enabled true; enabled true;
// When to output the average fields // When to output the images
writeControl writeTime; writeControl writeTime;
//- Optionally disable parallel VTK rendering, default = true //- Allow parallel rendering (default: true)
// parallel true; // parallel true;
//- The output characteristics //- The output characteristics
@ -45,27 +45,24 @@ output
//- The camera settings //- The camera settings
camera camera
{ {
// If camera is moving, optionally provide start and end times // If camera is moving, provide start and end times
// startPosition 0.2; // startPosition 0.2;
// endPosition 0.75; // endPosition 0.75;
// Total number of frames to generate //- Total number of frames to generate (default: 1)
nFrameTotal 1; nFrameTotal 1;
// Parallel projection flag //- Parallel projection flag (default: true)
parallelProjection yes; // parallelProjection yes;
// clipBox is optional
position (385 -560 650); position (385 -560 650);
focalPoint (160 90 60); focalPoint (160 90 60);
up (0.06 0.7 0.7); up (0.06 0.7 0.7);
position ( -41.95 -247.55 426.87 );
focalPoint ( 146 76 40 );
up ( 0.3646 0.6194 0.6953 );
zoom 1.5; zoom 1.5;
// clipBox is optional
// clipBox (-10 18 0)(280 160 76); // clipBox (-10 18 0)(280 160 76);
clipBox (-30 0 0)(300 200 80); clipBox (-30 0 0)(300 200 80);
} }
@ -146,6 +143,9 @@ surfaces
{ {
visible no; visible no;
} }
//- Allow parallel rendering (default: true)
// parallel true;
} }
patches patches
@ -183,8 +183,10 @@ surfaces
italic yes; italic yes;
shadow yes; shadow yes;
} }
}
//- Allow parallel rendering (default: true)
// parallel true;
}
cutting cutting
{ {
@ -243,15 +245,6 @@ surfaces
field U; field U;
range (0 20); range (0 20);
colourField k;
field k;
range (0 20);
colourBy field;
colourField U;
field U;
range (0 20);
opacity 1; opacity 1;
scalarBar scalarBar
{ {

View File

@ -25,8 +25,9 @@
alias wmSet 'source $WM_PROJECT_DIR/etc/cshrc' alias wmSet 'source $WM_PROJECT_DIR/etc/cshrc'
alias wmInt32 'wmSet WM_LABEL_SIZE=32' alias wmInt32 'wmSet WM_LABEL_SIZE=32'
alias wmInt64 'wmSet WM_LABEL_SIZE=64' alias wmInt64 'wmSet WM_LABEL_SIZE=64'
alias wmSP 'wmSet WM_PRECISION_OPTION=SP'
alias wmDP 'wmSet WM_PRECISION_OPTION=DP' alias wmDP 'wmSet WM_PRECISION_OPTION=DP'
alias wmSP 'wmSet WM_PRECISION_OPTION=SP'
alias wmSPDP 'wmSet WM_PRECISION_OPTION=SPDP'
# Clear env # Clear env
alias wmUnset 'source $WM_PROJECT_DIR/etc/config.csh/unset' alias wmUnset 'source $WM_PROJECT_DIR/etc/config.csh/unset'

View File

@ -162,8 +162,9 @@ endif
unalias wmSet unalias wmSet
unalias wmInt32 unalias wmInt32
unalias wmInt64 unalias wmInt64
unalias wmSP
unalias wmDP unalias wmDP
unalias wmSP
unalias wmSPDP
unalias wmUnset unalias wmUnset

View File

@ -25,8 +25,9 @@
alias wmSet='. $WM_PROJECT_DIR/etc/bashrc' alias wmSet='. $WM_PROJECT_DIR/etc/bashrc'
alias wmInt32='wmSet WM_LABEL_SIZE=32' alias wmInt32='wmSet WM_LABEL_SIZE=32'
alias wmInt64='wmSet WM_LABEL_SIZE=64' alias wmInt64='wmSet WM_LABEL_SIZE=64'
alias wmSP='wmSet WM_PRECISION_OPTION=SP'
alias wmDP='wmSet WM_PRECISION_OPTION=DP' alias wmDP='wmSet WM_PRECISION_OPTION=DP'
alias wmSP='wmSet WM_PRECISION_OPTION=SP'
alias wmSPDP='wmSet WM_PRECISION_OPTION=SPDP'
# Clear env # Clear env
alias wmUnset='. $WM_PROJECT_DIR/etc/config.sh/unset' alias wmUnset='. $WM_PROJECT_DIR/etc/config.sh/unset'

View File

@ -156,8 +156,9 @@ fi
unalias wmSet 2>/dev/null unalias wmSet 2>/dev/null
unalias wmInt32 2>/dev/null unalias wmInt32 2>/dev/null
unalias wmInt64 2>/dev/null unalias wmInt64 2>/dev/null
unalias wmSP 2>/dev/null
unalias wmDP 2>/dev/null unalias wmDP 2>/dev/null
unalias wmSP 2>/dev/null
unalias wmSPDP 2>/dev/null
unalias wmUnset 2>/dev/null unalias wmUnset 2>/dev/null

View File

@ -37,6 +37,8 @@ InfoSwitches
writePrecision 6; writePrecision 6;
writeDictionaries 0; writeDictionaries 0;
// Report optional dictionary entries. For value > 1, treat as fatal.
writeOptionalEntries 0; writeOptionalEntries 0;
// Write lagrangian "positions" file in v1706 format (and earlier) // Write lagrangian "positions" file in v1706 format (and earlier)
@ -218,7 +220,7 @@ DebugSwitches
FDIC 0; FDIC 0;
FaceCellWave 0; FaceCellWave 0;
GAMG 0; GAMG 0;
GAMGAgglomeration 1; GAMGAgglomeration 0;
GAMGInterface 0; GAMGInterface 0;
GAMGInterfaceField 0; GAMGInterfaceField 0;
Gamma 0; Gamma 0;

View File

@ -83,7 +83,7 @@ setenv WM_COMPILER Gcc
setenv WM_ARCH_OPTION 64 setenv WM_ARCH_OPTION 64
# [WM_PRECISION_OPTION] - Floating-point precision: # [WM_PRECISION_OPTION] - Floating-point precision:
# = DP | SP # = DP | SP | SPDP
setenv WM_PRECISION_OPTION DP setenv WM_PRECISION_OPTION DP
# [WM_LABEL_SIZE] - Label size in bits: # [WM_LABEL_SIZE] - Label size in bits:

View File

@ -47,6 +47,8 @@ License
#include <io.h> // For _close #include <io.h> // For _close
#include <windows.h> #include <windows.h>
#define EXT_SO "dll"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -350,12 +352,16 @@ Foam::string Foam::getEnv(const std::string& envName)
{ {
std::string env; std::string env;
const auto len = ::GetEnvironmentVariable(envName.c_str(), nullptr, 0); auto len = ::GetEnvironmentVariable(envName.c_str(), nullptr, 0);
// len [return] = size with trailing nul char, or zero on failure
if (len) if (len)
{ {
env.resize(len+1); env.resize(len);
::GetEnvironmentVariable(envName.c_str(), &(env[0]), len+1);
// len [in] = size with trailing nul char
// len [return] = size without trailing nul char
len = ::GetEnvironmentVariable(envName.c_str(), &(env[0]), len);
env.resize(len); env.resize(len);
return fileName::validate(env); return fileName::validate(env);
@ -442,16 +448,18 @@ Foam::fileName Foam::home(const std::string& userName)
Foam::fileName Foam::cwd() Foam::fileName Foam::cwd()
{ {
string path; string path;
const DWORD len = ::GetCurrentDirectory(0, nullptr); auto len = ::GetCurrentDirectory(0, nullptr);
// len [return] = size with trailing nul char, or zero on failure
if (len) if (len)
{ {
path.resize(len+1);
::GetCurrentDirectory(len+1, &(path[0]));
path.resize(len); path.resize(len);
// len [in] = size with trailing nul char
// len [return] = size without trailing nul char
len = ::GetCurrentDirectory(len, &(path[0]));
path.resize(len);
return fileName::validate(path); return fileName::validate(path);
} }
@ -1184,14 +1192,21 @@ void* Foam::dlOpen(const fileName& libName, const bool check)
<< " : dlopen of " << libName << std::endl; << " : dlopen of " << libName << std::endl;
} }
// Map "libXX.so" and "libXX" to "libXX.dll" // Always remap "libXX.so" and "libXX" to "libXX.dll"
fileName libso(libName.lessExt().ext(EXT_SO));
fileName winLibName(libName.lessExt().ext("dll")); void* handle = ::LoadLibrary(libso.c_str());
void* handle = ::LoadLibrary(winLibName.c_str());
if (!handle && !libso.startsWith("lib"))
{
// Try with 'lib' prefix
libso = "lib" + libso;
handle = ::LoadLibrary(libso.c_str());
}
if (handle) if (handle)
{ {
libsLoaded[handle] = libName.lessExt(); libsLoaded[handle] = libso.lessExt();
} }
else if (check) else if (check)
{ {
@ -1212,6 +1227,26 @@ void* Foam::dlOpen(const fileName& libName, const bool check)
} }
Foam::label Foam::dlOpen
(
std::initializer_list<fileName> libNames,
const bool check
)
{
label nLoaded = 0;
for (const fileName& libName : libNames)
{
if (Foam::dlOpen(libName, check))
{
++nLoaded;
}
}
return nLoaded;
}
bool Foam::dlClose(void* const handle) bool Foam::dlClose(void* const handle)
{ {
if (MSwindows::debug) if (MSwindows::debug)

View File

@ -61,8 +61,10 @@ Description
#include <dlfcn.h> #include <dlfcn.h>
#ifdef __APPLE__ #ifdef __APPLE__
#define EXT_SO "dylib"
#include <mach-o/dyld.h> #include <mach-o/dyld.h>
#else #else
#define EXT_SO "so"
// PGI does not have __int128_t // PGI does not have __int128_t
#ifdef __PGIC__ #ifdef __PGIC__
@ -1653,22 +1655,40 @@ int Foam::system(const Foam::UList<Foam::string>& command, const bool bg)
void* Foam::dlOpen(const fileName& libName, const bool check) void* Foam::dlOpen(const fileName& libName, const bool check)
{ {
constexpr int ldflags = (RTLD_LAZY|RTLD_GLOBAL);
if (POSIX::debug) if (POSIX::debug)
{ {
std::cout std::cout
<< "dlOpen(const fileName&)" << "dlOpen(const fileName&)"
<< " : dlopen of " << libName << std::endl; << " : dlopen of " << libName << std::endl;
} }
void* handle = ::dlopen(libName.c_str(), RTLD_LAZY|RTLD_GLOBAL);
#ifdef __APPLE__ void* handle = ::dlopen(libName.c_str(), ldflags);
// Re-try "libXX.so" as "libXX.dylib"
if (!handle && libName.hasExt("so")) if (!handle)
{ {
const fileName dylibName(libName.lessExt().ext("dylib")); fileName libso;
handle = ::dlopen(dylibName.c_str(), RTLD_LAZY|RTLD_GLOBAL);
if (!libName.startsWith("lib"))
{
// Try with 'lib' prefix
libso = "lib" + libName;
handle = ::dlopen(libso.c_str(), ldflags);
}
else
{
libso = libName;
}
// With canonical library extension ("so" or "dylib"), which remaps
// "libXX" to "libXX.so" as well as "libXX.so" -> "libXX.dylib"
if (!handle && !libso.hasExt(EXT_SO))
{
libso = libso.lessExt().ext(EXT_SO);
handle = ::dlopen(libso.c_str(), ldflags);
}
} }
#endif
if (!handle && check) if (!handle && check)
{ {
@ -1689,6 +1709,26 @@ void* Foam::dlOpen(const fileName& libName, const bool check)
} }
Foam::label Foam::dlOpen
(
std::initializer_list<fileName> libNames,
const bool check
)
{
label nLoaded = 0;
for (const fileName& libName : libNames)
{
if (Foam::dlOpen(libName, check))
{
++nLoaded;
}
}
return nLoaded;
}
bool Foam::dlClose(void* handle) bool Foam::dlClose(void* handle)
{ {
if (POSIX::debug) if (POSIX::debug)

View File

@ -32,6 +32,7 @@ Description
#ifndef regExp_H #ifndef regExp_H
#define regExp_H #define regExp_H
#include "regExpCxx.H"
#include "regExpPosix.H" #include "regExpPosix.H"
#include "regExpFwd.H" #include "regExpFwd.H"

View File

@ -39,7 +39,12 @@ namespace Foam
class regExpCxx; class regExpCxx;
class regExpPosix; class regExpPosix;
// Newer compilers support regex directly
#if (_GLIBCXX_RELEASE >= 7) || (__clang_major__ >= 7)
typedef regExpCxx regExp;
#else
typedef regExpPosix regExp; typedef regExpPosix regExp;
#endif
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -120,7 +120,7 @@ public:
inline ~regExpPosix(); inline ~regExpPosix();
// Member functions // Member Functions
// Access // Access

View File

@ -79,7 +79,7 @@ primitives/Vector/complexVector/complexVector.C
primitives/Vector/doubleVector/doubleVector.C primitives/Vector/doubleVector/doubleVector.C
primitives/Tensor/doubleTensor/doubleTensor.C primitives/Tensor/doubleTensor/doubleTensor.C
#endif #endif
#if !defined(WM_SP) #if !defined(WM_SP) && !defined(WM_SPDP)
primitives/Vector/floatVector/floatVector.C primitives/Vector/floatVector/floatVector.C
primitives/Tensor/floatTensor/floatTensor.C primitives/Tensor/floatTensor/floatTensor.C
#endif #endif

View File

@ -5,11 +5,13 @@ EXE_INC = \
-I$(OBJECTS_DIR) -I$(OBJECTS_DIR)
LIB_LIBS = \ LIB_LIBS = \
$(FOAM_LIBBIN)/libOSspecific.o \ $(FOAM_LIBBIN)/libOSspecific.o
-lz
ifeq ($(FOAM_LINK_DUMMY_PSTREAM),libo) ifeq ($(FOAM_LINK_DUMMY_PSTREAM),libo)
LIB_LIBS += $(FOAM_LIBBIN)/dummy/libPstream.o LIB_LIBS += $(FOAM_LIBBIN)/dummy/libPstream.o
else else
LIB_LIBS += -L$(FOAM_LIBBIN)/dummy -lPstream LIB_LIBS += -L$(FOAM_LIBBIN)/dummy -lPstream
endif endif
LIB_LIBS += \
-lz

View File

@ -243,8 +243,7 @@ public:
//- Deprecated(2019-01) Pointing at a valid storage node //- Deprecated(2019-01) Pointing at a valid storage node
// \deprecated(2019-01) - use good() method // \deprecated(2019-01) - use good() method
inline bool found() const bool FOAM_DEPRECATED_FOR(2019-01, "good() method") found() const
FOAM_DEPRECATED_FOR(2019-01, "good() method")
{ {
return this->good(); return this->good();
} }
@ -297,8 +296,7 @@ public:
//- Deprecated(2019-01) Pointing at a valid storage node //- Deprecated(2019-01) Pointing at a valid storage node
// \deprecated(2019-01) - use good() method // \deprecated(2019-01) - use good() method
inline bool found() const bool FOAM_DEPRECATED_FOR(2019-01, "good() method") found() const
FOAM_DEPRECATED_FOR(2019-01, "good() method")
{ {
return this->good(); return this->good();
} }

View File

@ -219,8 +219,7 @@ public:
//- Deprecated(2019-01) Pointing at a valid storage node //- Deprecated(2019-01) Pointing at a valid storage node
// \deprecated(2019-01) - use good() method // \deprecated(2019-01) - use good() method
inline bool found() const bool FOAM_DEPRECATED_FOR(2019-01, "good() method") found() const
FOAM_DEPRECATED_FOR(2019-01, "good() method")
{ {
return this->good(); return this->good();
} }
@ -271,8 +270,7 @@ public:
//- Deprecated(2019-01) Pointing at a valid storage node //- Deprecated(2019-01) Pointing at a valid storage node
// \deprecated(2019-01) - use good() method // \deprecated(2019-01) - use good() method
inline bool found() const bool FOAM_DEPRECATED_FOR(2019-01, "good() method") found() const
FOAM_DEPRECATED_FOR(2019-01, "good() method")
{ {
return this->good(); return this->good();
} }

View File

@ -160,10 +160,10 @@ bool Foam::IOobject::fileNameComponents
#endif #endif
) )
{ {
// Absolute path (starts with '/') // Absolute path (starts with '/' or 'd:/')
// => no local // => no local
instance = path.substr(first, last); instance = path.substr(0, last);
const std::string ending = path.substr(last+1); const std::string ending = path.substr(last+1);
nameLen = ending.size(); // The raw length of name nameLen = ending.size(); // The raw length of name

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2015-2018 OpenCFD Ltd. \\ / A nd | Copyright (C) 2015-2019 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
| Copyright (C) 2011-2017 OpenFOAM Foundation | Copyright (C) 2011-2017 OpenFOAM Foundation
@ -42,13 +42,12 @@ namespace Foam
const Foam::dictionary Foam::dictionary::null; const Foam::dictionary Foam::dictionary::null;
bool Foam::dictionary::writeOptionalEntries int Foam::dictionary::writeOptionalEntries
( (
Foam::debug::infoSwitch("writeOptionalEntries", 0) Foam::debug::infoSwitch("writeOptionalEntries", 0)
); );
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::dictionary::dictionary() Foam::dictionary::dictionary()
@ -311,13 +310,30 @@ void Foam::dictionary::checkITstream
} }
void Foam::dictionary::raiseBadInput(const word& keyword) const
{
// Can use FatalIOError instead of SafeFatalIOError
// since predicate checks are not used at the earliest stages
FatalIOError
(
"", // functionName
"", // sourceFileName
0, // sourceFileLineNumber
*this // ios
)
<< "Entry '" << keyword << "' with invalid input in dictionary "
<< name() << nl << nl
<< exit(FatalIOError);
}
bool Foam::dictionary::found bool Foam::dictionary::found
( (
const word& keyword, const word& keyword,
enum keyType::option matchOpt enum keyType::option matchOpt
) const ) const
{ {
return csearch(keyword, matchOpt).found(); return csearch(keyword, matchOpt).good();
} }
@ -359,11 +375,11 @@ const Foam::entry& Foam::dictionary::lookupEntry
{ {
const const_searcher finder(csearch(keyword, matchOpt)); const const_searcher finder(csearch(keyword, matchOpt));
if (!finder.found()) if (!finder.good())
{ {
FatalIOErrorInFunction(*this) FatalIOErrorInFunction(*this)
<< "Entry '" << keyword << "' not found in dictionary " << "Entry '" << keyword << "' not found in dictionary "
<< name() << name() << nl
<< exit(FatalIOError); << exit(FatalIOError);
} }
@ -395,7 +411,7 @@ bool Foam::dictionary::substituteKeyword(const word& keyword, bool mergeEntry)
const const_searcher finder(csearch(varName, keyType::REGEX_RECURSIVE)); const const_searcher finder(csearch(varName, keyType::REGEX_RECURSIVE));
// If defined insert its entries into this dictionary // If defined insert its entries into this dictionary
if (finder.found()) if (finder.good())
{ {
for (const entry& e : finder.dict()) for (const entry& e : finder.dict())
{ {
@ -427,7 +443,7 @@ bool Foam::dictionary::substituteScopedKeyword
const auto finder(csearchScoped(varName, keyType::REGEX_RECURSIVE)); const auto finder(csearchScoped(varName, keyType::REGEX_RECURSIVE));
// If defined insert its entries into this dictionary // If defined insert its entries into this dictionary
if (finder.found()) if (finder.good())
{ {
for (const entry& e : finder.dict()) for (const entry& e : finder.dict())
{ {
@ -473,11 +489,11 @@ const Foam::dictionary& Foam::dictionary::subDict(const word& keyword) const
// Allow patterns, non-recursive // Allow patterns, non-recursive
const const_searcher finder(csearch(keyword, keyType::REGEX)); const const_searcher finder(csearch(keyword, keyType::REGEX));
if (!finder.found()) if (!finder.good())
{ {
FatalIOErrorInFunction(*this) FatalIOErrorInFunction(*this)
<< "Entry '" << keyword << "' not found in dictionary " << "Entry '" << keyword << "' not found in dictionary "
<< name() << name() << nl
<< exit(FatalIOError); << exit(FatalIOError);
} }
@ -490,11 +506,11 @@ Foam::dictionary& Foam::dictionary::subDict(const word& keyword)
// Allow patterns, non-recursive // Allow patterns, non-recursive
searcher finder(search(keyword, keyType::REGEX)); searcher finder(search(keyword, keyType::REGEX));
if (!finder.found()) if (!finder.good())
{ {
FatalIOErrorInFunction(*this) FatalIOErrorInFunction(*this)
<< "Entry '" << keyword << "' not found in dictionary " << "Entry '" << keyword << "' not found in dictionary "
<< name() << name() << nl
<< exit(FatalIOError); << exit(FatalIOError);
} }
@ -526,7 +542,7 @@ Foam::dictionary Foam::dictionary::subOrEmptyDict
<< exit(FatalIOError); << exit(FatalIOError);
} }
if (finder.found()) if (finder.good())
{ {
IOWarningInFunction(*this) IOWarningInFunction(*this)
<< "Entry '" << keyword << "Entry '" << keyword
@ -552,7 +568,7 @@ const Foam::dictionary& Foam::dictionary::optionalSubDict
return finder.dict(); return finder.dict();
} }
if (finder.found()) if (finder.good())
{ {
IOWarningInFunction(*this) IOWarningInFunction(*this)
<< "Entry '" << keyword << "Entry '" << keyword
@ -611,7 +627,7 @@ Foam::entry* Foam::dictionary::add(entry* entryPtr, bool mergeEntry)
auto iter = hashedEntries_.find(entryPtr->keyword()); auto iter = hashedEntries_.find(entryPtr->keyword());
if (mergeEntry && iter.found()) if (mergeEntry && iter.good())
{ {
// Merge dictionary with dictionary // Merge dictionary with dictionary
if (iter()->isDict() && entryPtr->isDict()) if (iter()->isDict() && entryPtr->isDict())
@ -786,7 +802,7 @@ bool Foam::dictionary::merge(const dictionary& dict)
{ {
auto fnd = hashedEntries_.find(e.keyword()); auto fnd = hashedEntries_.find(e.keyword());
if (fnd.found()) if (fnd.good())
{ {
// Recursively merge sub-dictionaries // Recursively merge sub-dictionaries
// TODO: merge without copying // TODO: merge without copying

View File

@ -62,8 +62,8 @@ Note
key2 $..key1; // use key1 value from parent key2 $..key1; // use key1 value from parent
subdict2 subdict2
{ {
key2 val2; key2 val2;
key3 $...key1; // use key1 value from grandparent key3 $...key1; // use key1 value from grandparent
} }
} }
@ -285,8 +285,9 @@ private:
// Private Data // Private Data
//- Report optional keywords and values if not present in dictionary //- Report optional keywords and values if not present in dictionary
// For value greater than 1: fatal.
// Set/unset via an InfoSwitch // Set/unset via an InfoSwitch
static bool writeOptionalEntries; static int writeOptionalEntries;
//- The dictionary name //- The dictionary name
fileName name_; fileName name_;
@ -359,6 +360,10 @@ private:
) const; ) const;
//- Emit IOError about bad input for the entry
void raiseBadInput(const word& keyword) const;
public: public:
// Declare name of the class and its debug switch // Declare name of the class and its debug switch
@ -532,7 +537,6 @@ public:
enum keyType::option matchOpt = keyType::REGEX enum keyType::option matchOpt = keyType::REGEX
); );
//- Search for an entry (const access) with the given keyword.
//- Find and return a sub-dictionary pointer if present //- Find and return a sub-dictionary pointer if present
// (and a sub-dictionary) otherwise return nullptr. // (and a sub-dictionary) otherwise return nullptr.
// //
@ -543,6 +547,7 @@ public:
enum keyType::option matchOpt = keyType::REGEX enum keyType::option matchOpt = keyType::REGEX
) const; ) const;
//- Search for an entry (const access) with the given keyword.
// //
// \param matchOpt the default search is non-recursive with patterns // \param matchOpt the default search is non-recursive with patterns
// //
@ -553,6 +558,16 @@ public:
enum keyType::option matchOpt enum keyType::option matchOpt
) const; ) const;
//- Find and return an entry data stream.
//- FatalIOError if not found, or if the number of tokens is incorrect.
//
// \param matchOpt the default search is non-recursive with patterns
ITstream& lookup
(
const word& keyword,
enum keyType::option matchOpt = keyType::REGEX
) const;
//- Find and return a T. //- Find and return a T.
//- FatalIOError if not found, or if the number of tokens is incorrect. //- FatalIOError if not found, or if the number of tokens is incorrect.
// //
@ -564,22 +579,12 @@ public:
enum keyType::option matchOpt = keyType::REGEX enum keyType::option matchOpt = keyType::REGEX
) const; ) const;
//- Find and return an entry data stream.
//- FatalIOError if not found, or if the number of tokens is incorrect.
//
// \param matchOpt the default search is non-recursive with patterns
ITstream& lookup
(
const word& keyword,
enum keyType::option matchOpt = keyType::REGEX
) const;
//- Find and return a T, or return the given default value. //- Find and return a T, or return the given default value.
//- FatalIOError if it is found and the number of tokens is incorrect. //- FatalIOError if it is found and the number of tokens is incorrect.
// //
// \param matchOpt the default search is non-recursive with patterns // \param matchOpt the default search is non-recursive with patterns
template<class T> template<class T>
T lookupOrDefault T getOrDefault
( (
const word& keyword, const word& keyword,
const T& deflt, const T& deflt,
@ -592,7 +597,7 @@ public:
// //
// \param matchOpt the default search is non-recursive with patterns // \param matchOpt the default search is non-recursive with patterns
template<class T> template<class T>
T lookupOrAddDefault T getOrAdd
( (
const word& keyword, const word& keyword,
const T& deflt, const T& deflt,
@ -633,6 +638,86 @@ public:
enum keyType::option matchOpt = keyType::REGEX enum keyType::option matchOpt = keyType::REGEX
) const; ) const;
//- Find and return a T with additional checking
//- FatalIOError if not found, or if the number of tokens is incorrect.
//
// \param pred the value check predicate
// \param matchOpt the default search is non-recursive with patterns
template<class T, class Predicate>
T getCheck
(
const word& keyword,
const Predicate& pred,
enum keyType::option matchOpt = keyType::REGEX
) const;
//- Find and return a T, or return the given default value.
//- FatalIOError if it is found and the number of tokens is incorrect.
//
// \param pred the value check predicate
// \param matchOpt the default search is non-recursive with patterns
template<class T, class Predicate>
T getCheckOrDefault
(
const word& keyword,
const T& deflt,
const Predicate& pred,
enum keyType::option matchOpt = keyType::REGEX
) const;
//- Find and return a T, or return the given default value
//- and add it to dictionary.
//- FatalIOError if it is found and the number of tokens is incorrect.
//
// \param pred the value check predicate
// \param matchOpt the default search is non-recursive with patterns
template<class T, class Predicate>
T getCheckOrAdd
(
const word& keyword,
const T& deflt,
const Predicate& pred,
enum keyType::option matchOpt = keyType::REGEX
);
//- Find entry and assign to T val.
//- FatalIOError if it is found and the number of tokens is incorrect,
//- or it is mandatory and not found.
//
// \param val the value to read into
// \param pred the value check predicate
// \param matchOpt the default search is non-recursive with patterns
// \param mandatory the keyword is mandatory
//
// \return true if the entry was found.
template<class T, class Predicate>
bool readCheck
(
const word& keyword,
T& val,
const Predicate& pred,
enum keyType::option matchOpt = keyType::REGEX,
bool mandatory = true
) const;
//- Find an entry if present, and assign to T val.
//- FatalIOError if it is found and the number of tokens is incorrect.
// Default search: non-recursive with patterns.
//
// \param val the value to read into
// \param pred the value check predicate
// \param matchOpt the default search is non-recursive with patterns
//
// \return true if the entry was found.
template<class T, class Predicate>
bool readCheckIfPresent
(
const word& keyword,
T& val,
const Predicate& pred,
enum keyType::option matchOpt = keyType::REGEX
) const;
//- Check if entry is found and and is a sub-dictionary. //- Check if entry is found and and is a sub-dictionary.
// //
// Search type: non-recursive with patterns. // Search type: non-recursive with patterns.
@ -983,6 +1068,21 @@ public:
enum keyType::option enum keyType::option
) const; ) const;
//- Find and return an entry data stream,
//- using any compatibility names if needed.
// Default search: non-recursive with patterns.
//
// \param compat list of old compatibility keywords and the last
// OpenFOAM version for which they were used.
// \param recursive search parent dictionaries
// \param patternMatch use regular expressions
ITstream& lookupCompat
(
const word& keyword,
std::initializer_list<std::pair<const char*,int>> compat,
enum keyType::option = keyType::REGEX
) const;
//- Find and return a T //- Find and return a T
//- using any compatibility names if needed. //- using any compatibility names if needed.
//- FatalIOError if not found, or if there are excess tokens. //- FatalIOError if not found, or if there are excess tokens.
@ -1000,21 +1100,6 @@ public:
enum keyType::option = keyType::REGEX enum keyType::option = keyType::REGEX
) const; ) const;
//- Find and return an entry data stream,
//- using any compatibility names if needed.
// Default search: non-recursive with patterns.
//
// \param compat list of old compatibility keywords and the last
// OpenFOAM version for which they were used.
// \param recursive search parent dictionaries
// \param patternMatch use regular expressions
ITstream& lookupCompat
(
const word& keyword,
std::initializer_list<std::pair<const char*,int>> compat,
enum keyType::option = keyType::REGEX
) const;
//- Find and return a T, or return the given default value //- Find and return a T, or return the given default value
//- using any compatibility names if needed. //- using any compatibility names if needed.
// Default search: non-recursive with patterns. // Default search: non-recursive with patterns.
@ -1024,7 +1109,7 @@ public:
// \param recursive search parent dictionaries // \param recursive search parent dictionaries
// \param patternMatch use regular expressions // \param patternMatch use regular expressions
template<class T> template<class T>
T lookupOrDefaultCompat T getOrDefaultCompat
( (
const word& keyword, const word& keyword,
std::initializer_list<std::pair<const char*,int>> compat, std::initializer_list<std::pair<const char*,int>> compat,
@ -1105,10 +1190,63 @@ public:
// Housekeeping // Housekeeping
//- Find and return a T, or return the given default value.
//- FatalIOError if it is found and the number of tokens is incorrect.
//
// \param matchOpt the default search is non-recursive with patterns
template<class T>
T lookupOrDefault
(
const word& keyword,
const T& deflt,
enum keyType::option matchOpt = keyType::REGEX
) const
{
return getOrDefault<T>(keyword, deflt, matchOpt);
}
//- Find and return a T, or return the given default value
//- and add it to dictionary.
//- FatalIOError if it is found and the number of tokens is incorrect.
//
// \param matchOpt the default search is non-recursive with patterns
template<class T>
T lookupOrAddDefault
(
const word& keyword,
const T& deflt,
enum keyType::option matchOpt = keyType::REGEX
)
{
return getOrAdd<T>(keyword, deflt, matchOpt);
}
//- Find and return a T, or return the given default value
//- using any compatibility names if needed.
// Default search: non-recursive with patterns.
//
// \param compat list of old compatibility keywords and the last
// OpenFOAM version for which they were used.
// \param recursive search parent dictionaries
// \param patternMatch use regular expressions
template<class T>
T lookupOrDefaultCompat
(
const word& keyword,
std::initializer_list<std::pair<const char*,int>> compat,
const T& deflt,
enum keyType::option matchOpt = keyType::REGEX
) const
{
return getOrDefaultCompat<T>(keyword, compat, deflt, matchOpt);
}
//- Deprecated(2018-07) find and return an entry data stream //- Deprecated(2018-07) find and return an entry data stream
// //
// \deprecated(2018-07) - use lookup() method // \deprecated(2018-07) - use lookup() method
ITstream& operator[](const word& keyword) const ITstream& FOAM_DEPRECATED_FOR(2018-07, "lookup() method")
operator[](const word& keyword) const
{ {
return lookup(keyword); return lookup(keyword);
} }
@ -1116,7 +1254,8 @@ public:
//- Deprecated(2018-10) find and return a T. //- Deprecated(2018-10) find and return a T.
// \deprecated(2018-10) - use get() method // \deprecated(2018-10) - use get() method
template<class T> template<class T>
T lookupType T FOAM_DEPRECATED_FOR(2018-10, "get() method")
lookupType
( (
const word& keyword, const word& keyword,
bool recursive = false, bool recursive = false,
@ -1128,7 +1267,8 @@ public:
//- Deprecated(2018-10) //- Deprecated(2018-10)
// \deprecated(2018-10) - use keyType::option version // \deprecated(2018-10) - use keyType::option version
bool found bool FOAM_DEPRECATED_FOR(2018-10, "found(keyType::option)")
found
( (
const word& keyword, const word& keyword,
bool recursive, bool recursive,
@ -1140,7 +1280,9 @@ public:
//- Deprecated(2018-10) //- Deprecated(2018-10)
// \deprecated(2018-10) - use keyType::option version // \deprecated(2018-10) - use keyType::option version
entry* lookupEntryPtr entry*
FOAM_DEPRECATED_FOR(2018-10, "lookupEntryPtr(keyType::option)")
lookupEntryPtr
( (
const word& keyword, const word& keyword,
bool recursive, bool recursive,
@ -1152,7 +1294,9 @@ public:
//- Deprecated(2018-10) //- Deprecated(2018-10)
// \deprecated(2018-10) - use keyType::option version // \deprecated(2018-10) - use keyType::option version
const entry* lookupEntryPtr const entry*
FOAM_DEPRECATED_FOR(2018-10, "lookupEntryPtr(keyType::option)")
lookupEntryPtr
( (
const word& keyword, const word& keyword,
bool recursive, bool recursive,
@ -1164,7 +1308,9 @@ public:
//- Deprecated(2018-10) //- Deprecated(2018-10)
// \deprecated(2018-10) - use keyType::option version // \deprecated(2018-10) - use keyType::option version
const entry* lookupScopedEntryPtr const entry*
FOAM_DEPRECATED_FOR(2018-10, "lookupScopedEntryPtr(keyType::option)")
lookupScopedEntryPtr
( (
const word& keyword, const word& keyword,
bool recursive, bool recursive,
@ -1180,7 +1326,9 @@ public:
// //
// Search type: non-recursive with patterns. // Search type: non-recursive with patterns.
// \deprecated(2018-10) - use findDict() method // \deprecated(2018-10) - use findDict() method
const dictionary* subDictPtr(const word& keyword) const const dictionary*
FOAM_DEPRECATED_FOR(2018-10, "findDict() method")
subDictPtr(const word& keyword) const
{ {
return findDict(keyword, keyType::REGEX); return findDict(keyword, keyType::REGEX);
} }
@ -1191,14 +1339,18 @@ public:
// //
// Search type: non-recursive with patterns. // Search type: non-recursive with patterns.
// \deprecated(2018-10) - use findDict() method // \deprecated(2018-10) - use findDict() method
dictionary* subDictPtr(const word& keyword) dictionary*
FOAM_DEPRECATED_FOR(2018-10, "findDict() method")
subDictPtr(const word& keyword)
{ {
return findDict(keyword, keyType::REGEX); return findDict(keyword, keyType::REGEX);
} }
//- Deprecated(2018-10) //- Deprecated(2018-10)
// \deprecated(2018-10) - use keyType::option version // \deprecated(2018-10) - use keyType::option version
const entry& lookupEntry const entry&
FOAM_DEPRECATED_FOR(2018-10, "lookupEntry(keyType::option)")
lookupEntry
( (
const word& keyword, const word& keyword,
bool recursive, bool recursive,
@ -1210,7 +1362,9 @@ public:
//- Deprecated(2018-10) //- Deprecated(2018-10)
// \deprecated(2018-10) - use keyType::option version // \deprecated(2018-10) - use keyType::option version
ITstream& lookup ITstream&
FOAM_DEPRECATED_FOR(2018-10, "lookup(keyType::option)")
lookup
( (
const word& keyword, const word& keyword,
bool recursive, bool recursive,
@ -1223,7 +1377,8 @@ public:
//- Deprecated(2018-10) //- Deprecated(2018-10)
// \deprecated(2018-10) - use keyType::option version // \deprecated(2018-10) - use keyType::option version
template<class T> template<class T>
T lookupOrDefault T FOAM_DEPRECATED_FOR(2018-10, "lookupOrDefault(keyType::option)")
lookupOrDefault
( (
const word& keyword, const word& keyword,
const T& deflt, const T& deflt,
@ -1239,7 +1394,8 @@ public:
//- Deprecated(2018-10) //- Deprecated(2018-10)
// \deprecated(2018-10) - use keyType::option version // \deprecated(2018-10) - use keyType::option version
template<class T> template<class T>
T lookupOrAddDefault T FOAM_DEPRECATED_FOR(2018-10, "lookupOrAddDefault(keyType::option)")
lookupOrAddDefault
( (
const word& keyword, const word& keyword,
const T& deflt, const T& deflt,
@ -1255,7 +1411,9 @@ public:
//- Deprecated(2018-10) //- Deprecated(2018-10)
// \deprecated(2018-10) - use keyType::option version // \deprecated(2018-10) - use keyType::option version
template<class T> template<class T>
bool readIfPresent bool
FOAM_DEPRECATED_FOR(2018-10, "readIfPresent(keyType::option)")
readIfPresent
( (
const word& keyword, const word& keyword,
T& val, T& val,

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2017-2018 OpenCFD Ltd. \\ / A nd | Copyright (C) 2017-2019 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -54,7 +54,7 @@ Foam::dictionary::const_searcher Foam::dictionary::csearchCompat
{ {
const_searcher finder(csearch(keyword, matchOpt)); const_searcher finder(csearch(keyword, matchOpt));
if (finder.found()) if (finder.good())
{ {
return finder; return finder;
} }
@ -63,7 +63,7 @@ Foam::dictionary::const_searcher Foam::dictionary::csearchCompat
{ {
finder = csearch(word::validate(iter.first), matchOpt); finder = csearch(word::validate(iter.first), matchOpt);
if (finder.found()) if (finder.good())
{ {
// Only want a single warning (on master), but guard with a // Only want a single warning (on master), but guard with a
// parRun check to avoid Pstream::master() when Pstream has not // parRun check to avoid Pstream::master() when Pstream has not
@ -101,7 +101,7 @@ bool Foam::dictionary::foundCompat
enum keyType::option matchOpt enum keyType::option matchOpt
) const ) const
{ {
return csearchCompat(keyword, compat, matchOpt).found(); return csearchCompat(keyword, compat, matchOpt).good();
} }
@ -125,7 +125,7 @@ const Foam::entry& Foam::dictionary::lookupEntryCompat
{ {
const const_searcher finder(csearchCompat(keyword, compat, matchOpt)); const const_searcher finder(csearchCompat(keyword, compat, matchOpt));
if (!finder.found()) if (!finder.good())
{ {
FatalIOErrorInFunction(*this) FatalIOErrorInFunction(*this)
<< "Entry '" << keyword << "' not found in dictionary " << "Entry '" << keyword << "' not found in dictionary "

Some files were not shown because too many files have changed in this diff Show More