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

This commit is contained in:
Andrew Heather
2016-10-04 14:49:34 +01:00
44 changed files with 532 additions and 280 deletions

View File

@ -48,14 +48,13 @@ int main(int argc, char *argv[])
{
dictionary dict;
dict.add("aaOPENMPIcc", 1);
dict.add(word("aa" + getEnv("WM_MPLIB") + "cc"), 16);
string s("DDD${aa${WM_MPLIB}cc}EEE");
stringOps::inplaceExpand(s, dict, true, false);
Info<< "variable expansion:" << s << endl;
}
Info<< nl
<< "FOAM_CASE=" << getEnv("FOAM_CASE") << nl
<< "FOAM_CASENAME=" << getEnv("FOAM_CASENAME") << nl
@ -65,7 +64,9 @@ int main(int argc, char *argv[])
{
{
dictionary dict1(IFstream("testDict")());
Info<< "dict1: " << dict1 << nl
dict1.writeEntry("dict1", Info);
Info<< nl
<< "toc: " << dict1.toc() << nl
<< "keys: " << dict1.keys() << nl
<< "patterns: " << dict1.keys(true) << endl;
@ -89,14 +90,14 @@ int main(int argc, char *argv[])
<< "no = " << dict4.name() << " " << dict4.toc() << endl;
}
IOobject::writeDivider(Info);
{
dictionary dict(IFstream("testDictRegex")());
dict.add(keyType("fooba[rz]", true), "anything");
Info<< "dict:" << dict << nl
dict.writeEntry("testDictRegex", Info);
Info<< nl
<< "toc: " << dict.toc() << nl
<< "keys: " << dict.keys() << nl
<< "patterns: " << dict.keys(true) << endl;

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -31,6 +31,10 @@ Description
#include "dictionary.H"
#include "IOstreams.H"
#include "int.H"
#include "uint.H"
#include "scalar.H"
using namespace Foam;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -118,6 +122,8 @@ int main(int argc, char *argv[])
Info<< "after replace: " << test2 << endl;
}
cout<< "\nEnter some string to test:\n";
string s;
Sin.getLine(s);
@ -126,7 +132,39 @@ int main(int argc, char *argv[])
cout<< "output string with " << s2.length() << " characters\n";
cout<< "ostream<< >" << s2 << "<\n";
Info<< "Ostream<< >" << s2 << "<\n";
Info<< "hash:" << hex << string::hash()(s2) << endl;
Info<< "hash:" << hex << string::hash()(s2) << dec << endl;
cout<< "\ntest Foam::name()\n";
Info<< "hash: = " << Foam::name("0x%012X", string::hash()(s2)) << endl;
// test formatting on int
{
label val = 25;
Info<<"val: " << val << "\n";
Info<< "int " << val << " as word >"
<< Foam::name(val) << "< or "
<< Foam::name("formatted >%08d<", val) << "\n";
}
// test formatting on scalar
{
scalar val = 3.1415926535897931;
Info<< "scalar " << val << " as word >"
<< Foam::name(val) << "< or "
<< Foam::name("formatted >%.9f<", val) << "\n";
}
// test formatting on uint
{
uint64_t val = 25000000ul;
Info<<"val: " << val << "\n";
Info<< "uint64 " << val << " as word >"
<< Foam::name(val) << "< or "
<< Foam::name("formatted >%08d<", val) << "\n";
}
Info<< "\nEnd\n" << endl;
return 0;