Commit aaf5d7be authored by sergio's avatar sergio Committed by Andrew Heather
Browse files

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

parents 2793cc65 c8cf4b21
......@@ -118,34 +118,4 @@ your `~/.spack/packages.yaml` file:
It appears that spack will otherwise ignore any paraview+qt version
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.
--
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2018-2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -30,6 +30,9 @@ License
#if defined WM_SP
# define PRECISION "SP"
# define SCALAR_SIZE (8*sizeof(float))
#elif defined(WM_SPDP)
# define PRECISION "SPDP"
# define SCALAR_SIZE (8*sizeof(float))
#elif defined WM_DP
# define PRECISION "DP"
# define SCALAR_SIZE (8*sizeof(double))
......@@ -38,9 +41,23 @@ License
# define SCALAR_SIZE (8*sizeof(long double))
#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 * * * * * * * * * * * * * //
// 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::compiler(WM_COMPILER);
......
This diff is collapsed.
......@@ -24,11 +24,12 @@ License
Application
Description
Some tests for complex numbers
Tests for complex numbers
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "complex.H"
#include "complexFields.H"
#include "ops.H"
#include "ListOps.H"
......@@ -41,15 +42,14 @@ void print1(const complex& z)
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Main program:
// * * * * * * * * * * * * * * * Main Program * * * * * * * * * * * * * * * //
int main(int argc, char *argv[])
{
Info<< "complex() : " << complex() << nl
<< "complex(zero) : " << complex(Zero) << nl
<< "complex::zero : " << complex::zero << nl
<< "complex::one : " << complex::one << nl
<< "pTraits<complex>::zero : " << pTraits<complex>::zero << nl
<< "pTraits<complex>::one : " << pTraits<complex>::one << nl
<< "complex(scalar) : " << complex(3.14519) << nl
<< nl;
......@@ -57,7 +57,6 @@ int main(int argc, char *argv[])
Info<< "std::complex : " << c1 << nl;
Info<< "sin: " << std::sin(c1) << nl;
Info<< "complexVector::zero : " << complexVector::zero << nl
<< "complexVector::one : " << complexVector::one << nl
<< nl;
......@@ -98,6 +97,7 @@ int main(int argc, char *argv[])
c.Im() *= 5;
}
Info<< "sumProd: " << sumProd(fld1, fld2) << nl;
fld1 *= 10;
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 / 2) << nl;
// Info<< "operator / : " << (fld1 / 2) << nl;
// Info<< "operator / : " << (fld1 / fld2) << nl;
Info<< "sqrt : " << sqrt(fld1) << nl;
// Info<< "sqrt : " << sqrt(fld1) << 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
{
......@@ -150,6 +279,7 @@ int main(int argc, char *argv[])
// Info<< "min/max = " << MinMax<complex>(fld1) << nl;
Info<< "\nEnd\n" << endl;
return 0;
}
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2017-2018 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2017-2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -34,6 +34,8 @@ Description
#include "IOobject.H"
#include "IFstream.H"
#include "dictionary.H"
#include "ops.H"
#include "scalarRange.H"
#include "stringOps.H"
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>
scalar try_getScalar(const entry* eptr, const word& k)
{
......@@ -311,6 +349,7 @@ int main(int argc, char *argv[])
IStringStream
(
"good 3.14159;\n"
"negative -3.14159;\n"
"empty;\n"
// "bad text;\n" // always fails
// "bad 3.14159 1234;\n" // fails for readScalar
......@@ -338,6 +377,26 @@ int main(int argc, char *argv[])
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>
{
Info<< nl
......
......@@ -27,12 +27,16 @@ Description
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "IOobject.H"
#include "IOstreams.H"
#include "IFstream.H"
#include "Switch.H"
#include "SubStrings.H"
#include "regExpCxx.H"
#ifndef _WIN32
#include "regExpPosix.H"
#endif
using namespace Foam;
......@@ -83,6 +87,7 @@ static Ostream& operator<<(Ostream& os, const regExpCxx::results_type& sm)
// Simple output of match groups
#ifndef _WIN32
static Ostream& operator<<(Ostream& os, const regExpPosix::results_type& sm)
{
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;
}
#endif
template<class RegexType>
......@@ -209,7 +215,6 @@ void generalTests()
}
template<class RegexType>
void testExpressions(const UList<regexTest>& tests)
{
......@@ -293,11 +298,13 @@ int main(int argc, char *argv[])
"Test C++11 regular expressions"
);
#ifndef _WIN32
argList::addBoolOption
(
"posix",
"Test POSIX regular expressions"
);
#endif
argList::addArgument("file");
argList::addArgument("...");
......@@ -306,6 +313,17 @@ int main(int argc, char *argv[])
#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"}))
{
Info<< "Specified one or more of -cxx, -posix" << nl;
......@@ -321,10 +339,12 @@ int main(int argc, char *argv[])
generalTests<regExpCxx>();
}
#ifndef _WIN32
if (args.found("posix"))
{
generalTests<regExpPosix>();
}
#endif
}
for (label argi = 1; argi < args.size(); ++argi)
......@@ -339,10 +359,12 @@ int main(int argc, char *argv[])
testExpressions<regExpCxx>(tests);
}
#ifndef _WIN32
if (args.found("posix"))
{
testExpressions<regExpPosix>(tests);
}
#endif
}
Info<< "\nDone" << nl << endl;
......
/*--------------------------------*- 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)" )
)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......@@ -36,6 +36,8 @@ Description
#include "FlatOutput.H"
#include "Tuple2.H"
#include "StringStream.H"
#include "ops.H"
#include "bitSet.H"
using namespace Foam;
......@@ -44,7 +46,7 @@ void doTest(const scalarList& values, const predicates::scalars& accept)
{
// Also tests that output is suppressed
Info<<"Have: " << accept.size() << " predicates" << accept << endl;
Info<<"values: " << flatOutput(values) << endl;
Info<<"values: " << flatOutput(values) << endl;
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:
......@@ -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;
return 0;
......
......@@ -47,6 +47,12 @@ int main(int argc, char *argv[])
{
printTest();
#ifdef FULLDEBUG
Info<< nl << "Compiled with FULLDEBUG" << nl;
#else
Info<< nl << "Regular compilation" << nl;
#endif
Info<< "\nEnd\n" << nl;
return 0;
......
......@@ -779,7 +779,7 @@ int main(int argc, char *argv[])
const bool overwrite = args.found("overwrite");
const bool checkGeometry = args.found("checkGeometry");
const bool surfaceSimplify = args.found("surfaceSimplify");
const bool dryRun = args.optionFound("dry-run");
const bool dryRun = args.found("dry-run");
if (dryRun)
{
......@@ -788,7 +788,6 @@ int main(int argc, char *argv[])
}
#include "createNamedMesh.H"
Info<< "Read mesh in = "
<< runTime.cpuTimeIncrement() << " s" << endl;
......
......@@ -2307,7 +2307,9 @@ int main(int argc, char *argv[])
// ~~~~~~~~~~~~~~~~
// (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 writeCellDist = args.found("cellDist");
const bool dryrun = args.found("dry-run");
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd |
\\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2011-2016 OpenFOAM Foundation
......@@ -313,7 +313,7 @@ void rewriteField
if
(
boundaryField.found(patchName)
&& !boundaryField.found(newName, false, false)
&& !boundaryField.found(newName, keyType::LITERAL)
)