diff --git a/.gitignore b/.gitignore index 3ef3669242..db2777cdc7 100644 --- a/.gitignore +++ b/.gitignore @@ -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 diff --git a/Allwmake b/Allwmake index de7a288ec8..b9cfa95a5e 100755 --- a/Allwmake +++ b/Allwmake @@ -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" ] diff --git a/README.md b/README.md index 3aa2503b54..aec529e09f 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # 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 diff --git a/applications/Allwmake b/applications/Allwmake index e78e590f9c..88211f1306 100755 --- a/applications/Allwmake +++ b/applications/Allwmake @@ -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 } diff --git a/applications/solvers/multiphase/interFoam/interMixingFoam/alphaEqn.H b/applications/solvers/multiphase/interFoam/interMixingFoam/alphaEqn.H index d720aa97f6..3f75765dd7 100644 --- a/applications/solvers/multiphase/interFoam/interMixingFoam/alphaEqn.H +++ b/applications/solvers/multiphase/interFoam/interMixingFoam/alphaEqn.H @@ -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 diff --git a/applications/test/BinSum/Test-BinSum.C b/applications/test/BinSum/Test-BinSum.C index 873e7eb893..6d0abfff28 100644 --- a/applications/test/BinSum/Test-BinSum.C +++ b/applications/test/BinSum/Test-BinSum.C @@ -46,7 +46,7 @@ int main(int argc, char *argv[]) scalarField samples(10000000); forAll(samples, i) { - samples[i] = rndGen.scalar01(); + samples[i] = rndGen.sample01(); } const scalar min = 0; diff --git a/applications/test/DLList/Test-DLList.C b/applications/test/DLList/Test-DLList.C index d370348982..268c8b3ed1 100644 --- a/applications/test/DLList/Test-DLList.C +++ b/applications/test/DLList/Test-DLList.C @@ -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 myList; + Info<< "DLList" << 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, myList, iter) + forAllConstIters(myList, iter) { Info<< "element:" << *iter << endl; } - Info<< nl << "And again using the same STL iterator: " << nl << endl; - forAllIter(DLList, 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, 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, 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, myList, iter) + for (auto val : myList) { - Info<< "element:" << *iter << endl; + Info<< "element:" << val << endl; } - Info<< nl << "Testing transfer: " << nl << nl << "original: " << myList << endl; diff --git a/applications/test/Dictionary/Test-Dictionary.C b/applications/test/Dictionary/Test-Dictionary.C index f48845a36f..251cb2f841 100644 --- a/applications/test/Dictionary/Test-Dictionary.C +++ b/applications/test/Dictionary/Test-Dictionary.C @@ -168,9 +168,24 @@ int main(int argc, char *argv[]) Info<< nl << "scalarDict2: " << endl; forAllConstIter(PtrDictionary, 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); diff --git a/applications/test/Distribution/Test-Distribution.C b/applications/test/Distribution/Test-Distribution.C index f893e1e4bc..647c7a7d42 100644 --- a/applications/test/Distribution/Test-Distribution.C +++ b/applications/test/Distribution/Test-Distribution.C @@ -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() + 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() -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() + 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()); // 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()*3.0 + 1.5, + R.GaussNormal()*0.25 + 4.0, + R.GaussNormal()*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()); } 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()); } 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()); } Info<< "Mean " << dSpT.mean() << nl diff --git a/applications/test/FixedList/Test-FixedList.C b/applications/test/FixedList/Test-FixedList.C index ec496e1e03..9fd0fde37a 100644 --- a/applications/test/FixedList/Test-FixedList.C +++ b/applications/test/FixedList/Test-FixedList.C @@ -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::Hash<>()(list2) << endl; + // Using FixedList for content too + { + List> 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); diff --git a/applications/test/HashPtrTable/Test-hashPtrTable.C b/applications/test/HashPtrTable/Test-hashPtrTable.C index 5133d784b1..e62d596869 100644 --- a/applications/test/HashPtrTable/Test-hashPtrTable.C +++ b/applications/test/HashPtrTable/Test-hashPtrTable.C @@ -36,14 +36,9 @@ void printTable(const HashPtrTable& table) { Info<< table.size() << nl << "(" << nl; - for - ( - typename HashPtrTable::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& 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 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; } - // ************************************************************************* // diff --git a/applications/test/HashSet/Test-hashSet.C b/applications/test/HashSet/Test-hashSet.C index dcfa0aec7a..55640829fb 100644 --- a/applications/test/HashSet/Test-hashSet.C +++ b/applications/test/HashSet/Test-hashSet.C @@ -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