Commit f6e779d5 authored by Andrew Heather's avatar Andrew Heather
Browse files

MRG: merged develop line back into integration branch

parents 8f5f41ef 2d769428
......@@ -62,6 +62,7 @@ doc/Doxygen/DTAGS
/etc/prefs.sh
/etc/config.csh/prefs.csh
/etc/config.sh/prefs.sh
/wmake/rules/General/mplibUSER*
# Source packages - anywhere
*.tar.bz2
......
......@@ -5,8 +5,8 @@ cd ${0%/*} && wmakeCheckPwd "$WM_PROJECT_DIR" 2>/dev/null || {
echo " Check your OpenFOAM environment and installation"
exit 1
}
[ -n "$FOAM_EXT_LIBBIN" ] || {
echo "Error (${0##*/}) : FOAM_EXT_LIBBIN not set"
[ -d "$WM_PROJECT_DIR" -a -f "$WM_PROJECT_DIR/etc/bashrc" ] || {
echo "Error (${0##*/}) : WM_PROJECT_DIR appears to be incorrect"
echo " Check your OpenFOAM environment and installation"
exit 1
}
......@@ -22,8 +22,8 @@ echo " $WM_COMPILER $WM_COMPILER_TYPE compiler"
echo " ${WM_OPTIONS}, with ${WM_MPLIB} ${FOAM_MPI}"
echo
# Compile wmake support applications
(cd wmake/src && make)
# Compile wmake tools
(cd "${WM_DIR:-wmake}/src" && make)
# Compile ThirdParty libraries and applications
if [ -d "$WM_THIRD_PARTY_DIR" ]
......
# About OpenFOAM
OpenFOAM is a free, open source CFD software [released and developed primarily by OpenCFD Ltd](http://www.openfoam.com) since 2004released and developed primarily by. It has a large user base across most areas of engineering and science, from both commercial and academic organisations. OpenFOAM has an extensive range of features to solve anything from complex fluid flows involving chemical reactions, turbulence and heat transfer, to acoustics, solid mechanics and electromagnetics. [More...](http://www.openfoam.com/documentation)
OpenFOAM is a free, open source CFD software [released and developed primarily by OpenCFD Ltd](http://www.openfoam.com) since 2004. It has a large user base across most areas of engineering and science, from both commercial and academic organisations. OpenFOAM has an extensive range of features to solve anything from complex fluid flows involving chemical reactions, turbulence and heat transfer, to acoustics, solid mechanics and electromagnetics. [More...](http://www.openfoam.com/documentation)
OpenFOAM+ is professionally released every six months to include customer sponsored developments and contributions from the community, including the OpenFOAM Foundation. Releases designated OpenFOAM+ contain several man years of client-sponsored developments of which much has been transferred to, but not released in the OpenFOAM Foundation branch.
......@@ -23,4 +23,4 @@ Violations of the Trademark are continuously monitored, and will be duly prosecu
- [OpenFOAM Community](http://www.openfoam.com/community/)
- [Contacting OpenCFD](http://www.openfoam.com/contact/)
Copyright 2016 OpenCFD Ltd
Copyright 2016-2017 OpenCFD Ltd
......@@ -5,8 +5,8 @@ cd ${0%/*} && wmakeCheckPwd "$WM_PROJECT_DIR/applications" 2>/dev/null || {
echo " Check your OpenFOAM environment and installation"
exit 1
}
[ -n "$FOAM_EXT_LIBBIN" ] || {
echo "Error (${0##*/}) : FOAM_EXT_LIBBIN not set"
[ -d "$WM_PROJECT_DIR" -a -f "$WM_PROJECT_DIR/etc/bashrc" ] || {
echo "Error (${0##*/}) : WM_PROJECT_DIR appears to be incorrect"
echo " Check your OpenFOAM environment and installation"
exit 1
}
......
......@@ -108,6 +108,11 @@
);
}
alphaPhi1 = alphaPhi1BD + lambda*alphaPhi1;
// Reset allLambda to 1.0
allLambda = 1.0;
// Create the complete flux for alpha2
surfaceScalarField alphaPhi2
(
......@@ -172,7 +177,6 @@
}
// Construct the limited fluxes
alphaPhi1 = alphaPhi1BD + lambda*alphaPhi1;
alphaPhi2 = alphaPhi2BD + lambda*alphaPhi2;
// Solve for alpha1
......
......@@ -46,7 +46,7 @@ int main(int argc, char *argv[])
scalarField samples(10000000);
forAll(samples, i)
{
samples[i] = rndGen.scalar01();
samples[i] = rndGen.sample01<scalar>();
}
const scalar min = 0;
......
......@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -41,6 +41,8 @@ int main(int argc, char *argv[])
{
DLList<scalar> myList;
Info<< "DLList<scalar>" << nl;
for (int i = 0; i<10; i++)
{
myList.append(1.3*i);
......@@ -49,17 +51,14 @@ int main(int argc, char *argv[])
myList.append(100.3);
myList.append(500.3);
Info<< nl << "And again using STL iterator: " << nl << endl;
forAllIter(DLList<scalar>, myList, iter)
forAllConstIters(myList, iter)
{
Info<< "element:" << *iter << endl;
}
Info<< nl << "And again using the same STL iterator: " << nl << endl;
forAllIter(DLList<scalar>, myList, iter)
forAllIters(myList, iter)
{
Info<< "Removing " << myList.remove(iter) << endl;
}
......@@ -68,13 +67,10 @@ int main(int argc, char *argv[])
myList.append(200.3);
myList.append(100.3);
Info<< nl << "And again using STL const_iterator: " << nl << endl;
forAllConstIter(DLList<scalar>, myList, iter)
Info<< nl << "Using range-based for: " << nl << endl;
for (auto val : myList)
{
Info<< "element:" << *iter << endl;
Info<< "element:" << val << endl;
}
Info<< nl << "Testing swapUp and swapDown: " << endl;
......@@ -84,9 +80,9 @@ int main(int argc, char *argv[])
myList.swapUp(myList.DLListBase::first());
myList.swapUp(myList.DLListBase::last());
forAllIter(DLList<scalar>, myList, iter)
for (auto val : myList)
{
Info<< "element:" << *iter << endl;
Info<< "element:" << val << endl;
}
Info<< nl << "swapDown" << endl;
......@@ -94,12 +90,11 @@ int main(int argc, char *argv[])
myList.swapDown(myList.DLListBase::first());
myList.swapDown(myList.DLListBase::last());
forAllIter(DLList<scalar>, myList, iter)
for (auto val : myList)
{
Info<< "element:" << *iter << endl;
Info<< "element:" << val << endl;
}
Info<< nl << "Testing transfer: " << nl << nl
<< "original: " << myList << endl;
......
......@@ -168,9 +168,24 @@ int main(int argc, char *argv[])
Info<< nl << "scalarDict2: " << endl;
forAllConstIter(PtrDictionary<Scalar>, scalarDict2, iter)
{
std::cout<< "iter: " << typeid(*iter).name() << '\n';
Info<< "elem = " << *iter << endl;
}
// FIXME: the deduction seems to be different here.
// - returns pointer (as perhaps actually expected) not the
// underlying value.
forAllConstIters(scalarDict2, iter)
{
std::cout<< "iter: " << typeid(*iter).name() << '\n';
Info<< "elem = " << *(*iter) << endl;
}
std::cout<< "iter type: "
<< typeid(stdFoam::begin(scalarDict2)).name() << '\n';
scalarDict.transfer(scalarDict2);
......
......@@ -71,7 +71,7 @@ int main(int argc, char *argv[])
for (label i = 0; i < randomDistributionTestSize; i++)
{
dS.add(2.5*R.GaussNormal() + 8.5);
dS.add(2.5*R.GaussNormal<scalar>() + 8.5);
}
Info<< "Mean " << dS.mean() << nl
......@@ -90,7 +90,7 @@ int main(int argc, char *argv[])
for (label i = 0; i < randomDistributionTestSize; i++)
{
dS2.add(1.5*R.GaussNormal() -6.0);
dS2.add(1.5*R.GaussNormal<scalar>() -6.0);
}
Info<< "Mean " << dS2.mean() << nl
......@@ -121,7 +121,7 @@ int main(int argc, char *argv[])
for (label i = 0; i < randomDistributionTestSize; i++)
{
dS.add(R.scalar01() + 10*Pstream::myProcNo());
dS.add(R.sample01<scalar>() + 10*Pstream::myProcNo());
}
Pout<< "Mean " << dS.mean() << nl
......@@ -155,7 +155,7 @@ int main(int argc, char *argv[])
for (label i = 0; i < randomDistributionTestSize; i++)
{
dV.add(R.vector01());
dV.add(R.sample01<vector>());
// Adding separate GaussNormal components with component
// weights
......@@ -164,9 +164,9 @@ int main(int argc, char *argv[])
(
vector
(
R.GaussNormal()*3.0 + 1.5,
R.GaussNormal()*0.25 + 4.0,
R.GaussNormal()*3.0 - 1.5
R.GaussNormal<scalar>()*3.0 + 1.5,
R.GaussNormal<scalar>()*0.25 + 4.0,
R.GaussNormal<scalar>()*3.0 - 1.5
),
vector(1.0, 2.0, 5.0)
);
......@@ -225,7 +225,7 @@ int main(int argc, char *argv[])
for (label i = 0; i < randomDistributionTestSize; i++)
{
dT.add(R.tensor01());
dT.add(R.sample01<tensor>());
}
Info<< "Mean " << dT.mean() << nl
......@@ -249,7 +249,7 @@ int main(int argc, char *argv[])
for (label i = 0; i < randomDistributionTestSize; i++)
{
dSyT.add(R.symmTensor01());
dSyT.add(R.sample01<symmTensor>());
}
Info<< "Mean " << dSyT.mean() << nl
......@@ -273,7 +273,7 @@ int main(int argc, char *argv[])
for (label i = 0; i < randomDistributionTestSize; i++)
{
dSpT.add(R.sphericalTensor01());
dSpT.add(R.sample01<sphericalTensor>());
}
Info<< "Mean " << dSpT.mean() << nl
......
......@@ -33,7 +33,6 @@ See also
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "IOstreams.H"
#include "FixedList.H"
#include "IFstream.H"
#include "OFstream.H"
......@@ -64,6 +63,15 @@ int main(int argc, char *argv[])
Info<< "list2:" << list2
<< " hash:" << FixedList<label, 4>::Hash<>()(list2) << endl;
// Using FixedList for content too
{
List<FixedList<label, 4>> twolists{list, list2};
Info<<"List of FixedList: " << flatOutput(twolists) << endl;
sort(twolists);
// outer-sort only
Info<<"sorted FixedList : " << flatOutput(twolists) << endl;
}
Info<< "list: " << list << nl
<< "list2: " << list2 << endl;
list.swap(list2);
......
......@@ -36,14 +36,9 @@ void printTable(const HashPtrTable<T>& table)
{
Info<< table.size() << nl << "(" << nl;
for
(
typename HashPtrTable<T>::const_iterator iter = table.cbegin();
iter != table.cend();
++iter
)
forAllConstIters(table, iter)
{
const T* ptr = *iter;
const T* ptr = iter.object();
Info<< iter.key() << " = ";
if (ptr)
{
......@@ -57,6 +52,22 @@ void printTable(const HashPtrTable<T>& table)
}
Info<< ")" << endl;
// Values only, with for-range
Info<< "values (";
for (auto val : table)
{
Info<< ' ';
if (val)
{
Info<< *val;
}
else
{
Info<< "nullptr";
}
}
Info<< " )" << nl;
}
......@@ -68,7 +79,9 @@ int main()
HashPtrTable<double> myTable;
myTable.insert("abc", new double(42.1));
myTable.insert("def", nullptr);
myTable.insert("ghi", new double(3.14159));
myTable.insert("pi", new double(3.14159));
myTable.insert("natlog", new double(2.718282));
myTable.insert("sqrt2", new double(1.414214));
// Info<< myTable << endl;
printTable(myTable);
......@@ -79,8 +92,20 @@ int main()
printTable(copy);
Info<< copy << endl;
Info<<"\nerase some existing and non-existing entries" << nl;
auto iter = myTable.find("pi");
myTable.erase(iter);
iter = myTable.find("unknownKey");
myTable.erase(iter);
myTable.erase("abc");
myTable.erase("unknownKey");
printTable(myTable);
return 0;
}
// ************************************************************************* //
......@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -28,6 +28,8 @@ Description
#include "hashedWordList.H"
#include "HashSet.H"
#include "Map.H"
#include "labelPairHashes.H"
#include "FlatOutput.H"
using namespace Foam;
......@@ -65,6 +67,14 @@ int main(int argc, char *argv[])
tableB.insert("value5", nil());
tableB.insert("value6", nil());
Info<< "tableA keys: "; tableA.writeKeys(Info) << endl;
auto keyIterPair = tableA.keys();
for (const auto& i : keyIterPair)
{
Info<<" keys: " << i << endl;
}
Map<label> mapA
{
{ 1, 1 },
......@@ -122,13 +132,22 @@ int main(int argc, char *argv[])
<< (wordHashSet(setA) | wordHashSet(tableA) | wordHashSet(tableB))
<< nl;
labelHashSet setB
{
1, 11, 42
};
setB = FixedList<label, 4>({1, 2, 3, 4});
setB = {1, 2, 4};
setB = List<label>({1, 2, 4});
Info<< "setB : " << setB << endl;
labelPair pair(12, 15);
setB.set(pair);
Info<< "setB : " << setB << endl;
setB.unset(pair);
labelHashSet setC(1);
setC.insert(2008);
......@@ -139,7 +158,7 @@ int main(int argc, char *argv[])
labelHashSet setD(1);
setD.insert({11, 100, 49, 36, 2008});
Info<< "setD : " << setD << endl;
Info<< "setD : " << flatOutput(setD) << endl;
Info<< "setB == setC: " << (setB == setC) << endl;
Info<< "setC != setD: " << (setC != setD) << endl;
......@@ -178,9 +197,13 @@ int main(int argc, char *argv[])
Info<< "setD has no 11" << endl;
}
Info<< "setD : " << setD << endl;
Info<< "setB : " << flatOutput(setB) << endl;
Info<< "setD : " << flatOutput(setD) << endl;
setD -= setB;
Info<< "setD -= setB : " << flatOutput(setD) << endl;
// this doesn't work (yet?)
// This should not work (yet?)
// setD[12] = true;
List<label> someLst(10);
......@@ -191,8 +214,14 @@ int main(int argc, char *argv[])
label added = setD.set(someLst);
Info<< "added " << added << " from " << someLst.size() << endl;
Info<< "setD : " << setD << endl;
Info<< "setD : " << flatOutput(setD) << endl;
Info<< "setD for-range()" << nl;
for (auto i : setD)
{
Info << i << endl;
}
return 0;
}
......
......@@ -24,6 +24,10 @@ License
\*---------------------------------------------------------------------------*/
#include "HashTable.H"
#include "List.H"
#include "SortableList.H"
#include "DynamicList.H"
#include "FlatOutput.H"
#include "IOstreams.H"
#include "IStringStream.H"
#include "OStringStream.H"
......@@ -62,7 +66,7 @@ int main()
Info<< "\ntable1 sortedToc: " << table1.sortedToc() << endl;
table1.printInfo(Info)
<< "table1 [" << table1.size() << "] " << endl;
forAllConstIter(HashTable<scalar>, table1, iter)
forAllConstIters(table1, iter)
{
Info<< iter.key() << " => " << iter() << nl;
}
......@@ -106,7 +110,7 @@ int main()
<< "\ntable3" << table3 << nl;
Info<< "\nerase table2 by iterator" << nl;
forAllIter(HashTable<scalar>, table2, iter)
forAllIters(table2, iter)
{
Info<< "erasing " << iter.key() << " => " << iter.object() << " ... ";
table2.erase(iter);
......@@ -162,21 +166,74 @@ int main()
<< "\ntable2" << table2 << nl;
Info<< "\ntable3" << table3
<< "\nclearStorage table3 ... ";
table3.clearStorage();
Info<< table3 << nl;
Info<< "\ntable3" << table2
<< "\nclearStorage table2 ... ";
table2.clearStorage();
Info<< table2 << nl;
table1 =
{
{"aca", 3.0},
{"aaw", 6.0},
{"abc", 3.0},
{"def", 6.0},
{"acr", 8.0},
{"aec", 10.0}
};
Info<< "\ntable1" << table1 << nl;
Info<< "\nrange-for(table1) - returns values" << nl;
for (const auto& it : table1)
{
Info<< "val:" << it << nl;
}
Info<< "\nrange-for(table1.keys()) - returns keys" << nl;
for (const auto& k : table1.keys())
{
Info<< "key:" << k << nl;
}
// These do not yet work. Issues resolving the distance.
//
// List<scalar> table1vals(table1.begin(), table1.end());
{
Info<<"distance/size: "
<< std::distance(table1.begin(), table1.end())
<< "/" << table1.size()
<< " and "
<< std::distance(table1.keys().begin(), table1.keys().end())
<< "/" << table1.keys().size()
<< nl;
SortableList<word> sortKeys
// DynamicList<word> sortKeys
(
table1.keys().begin(),
table1.keys().end()
);
Info<<"sortKeys: " << flatOutput(sortKeys) << nl;
}
Info<< "\nFrom table1: " << flatOutput(table1.sortedToc()) << nl
<< "retain keys: " << flatOutput(table3.sortedToc()) << nl;
table1.retain(table3);
Info<< "-> " << flatOutput(table1.sortedToc()) << nl;
Info<< "Lookup non-existent" << nl;
Info<< table1.lookup("missing-const", 1.2345e+6)
<< " // const-access" << nl;
Info<< table1("missing-inadvertent", 3.14159)
<< " // (inadvertent?) non-const access" << nl;
Info<< table1("missing-autovivify")
<< " // Known auto-vivification (non-const access)" << nl;
Info<<"\ntable1: " << table1 << endl;
Info<< "\nDone\n";
return 0;
......
......@@ -78,7 +78,7 @@ int main(int argc, char *argv[])
Info<< nl << "And again using STL iterator: " << nl << endl;
forAllIter(SLList<scalar>, myList, iter)
forAllIters(myList, iter)
{
Info<< "element:" << *iter << endl;
}
......@@ -87,7 +87,7 @@ int main(int argc, char *argv[])
const ISLList<Scalar>& const_myList = myList;
forAllConstIter(SLList<scalar>, const_myList, iter)
forAllConstIters(const_myList, iter)
{
Info<< "element:" << *iter << endl;
}
......
......@@ -42,6 +42,7 @@ See also
#include "vector.H"
#include "labelRange.H"
#include "scalarList.H"
#include "ListOps.H"
#include "SubList.H"
......@@ -76,7 +77,6 @@ int main(int argc, char *argv[])
Info<<"is >>: " << intlist << endl;
}
List<vector> list1(IStringStream("1 ((0 1 2))")());
Info<< "list1: " << list1 << endl;
......@@ -145,12 +145,23 @@ int main(int argc, char *argv[])
labelList longLabelList = identity(15);
// This does not work:
// scalarList slist = identity(15);
//