MRG: merged develop line back into integration branch

This commit is contained in:
Andrew Heather
2017-05-18 11:11:12 +01:00
514 changed files with 12134 additions and 16093 deletions

1
.gitignore vendored
View File

@ -62,6 +62,7 @@ doc/Doxygen/DTAGS
/etc/prefs.sh /etc/prefs.sh
/etc/config.csh/prefs.csh /etc/config.csh/prefs.csh
/etc/config.sh/prefs.sh /etc/config.sh/prefs.sh
/wmake/rules/General/mplibUSER*
# Source packages - anywhere # Source packages - anywhere
*.tar.bz2 *.tar.bz2

View File

@ -5,8 +5,8 @@ cd ${0%/*} && wmakeCheckPwd "$WM_PROJECT_DIR" 2>/dev/null || {
echo " Check your OpenFOAM environment and installation" echo " Check your OpenFOAM environment and installation"
exit 1 exit 1
} }
[ -n "$FOAM_EXT_LIBBIN" ] || { [ -d "$WM_PROJECT_DIR" -a -f "$WM_PROJECT_DIR/etc/bashrc" ] || {
echo "Error (${0##*/}) : FOAM_EXT_LIBBIN not set" echo "Error (${0##*/}) : WM_PROJECT_DIR appears to be incorrect"
echo " Check your OpenFOAM environment and installation" echo " Check your OpenFOAM environment and installation"
exit 1 exit 1
} }
@ -22,8 +22,8 @@ echo " $WM_COMPILER $WM_COMPILER_TYPE compiler"
echo " ${WM_OPTIONS}, with ${WM_MPLIB} ${FOAM_MPI}" echo " ${WM_OPTIONS}, with ${WM_MPLIB} ${FOAM_MPI}"
echo echo
# Compile wmake support applications # Compile wmake tools
(cd wmake/src && make) (cd "${WM_DIR:-wmake}/src" && make)
# Compile ThirdParty libraries and applications # Compile ThirdParty libraries and applications
if [ -d "$WM_THIRD_PARTY_DIR" ] if [ -d "$WM_THIRD_PARTY_DIR" ]

View File

@ -1,5 +1,5 @@
# About OpenFOAM # 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. 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/) - [OpenFOAM Community](http://www.openfoam.com/community/)
- [Contacting OpenCFD](http://www.openfoam.com/contact/) - [Contacting OpenCFD](http://www.openfoam.com/contact/)
Copyright 2016 OpenCFD Ltd Copyright 2016-2017 OpenCFD Ltd

View File

@ -5,8 +5,8 @@ cd ${0%/*} && wmakeCheckPwd "$WM_PROJECT_DIR/applications" 2>/dev/null || {
echo " Check your OpenFOAM environment and installation" echo " Check your OpenFOAM environment and installation"
exit 1 exit 1
} }
[ -n "$FOAM_EXT_LIBBIN" ] || { [ -d "$WM_PROJECT_DIR" -a -f "$WM_PROJECT_DIR/etc/bashrc" ] || {
echo "Error (${0##*/}) : FOAM_EXT_LIBBIN not set" echo "Error (${0##*/}) : WM_PROJECT_DIR appears to be incorrect"
echo " Check your OpenFOAM environment and installation" echo " Check your OpenFOAM environment and installation"
exit 1 exit 1
} }

View File

@ -108,6 +108,11 @@
); );
} }
alphaPhi1 = alphaPhi1BD + lambda*alphaPhi1;
// Reset allLambda to 1.0
allLambda = 1.0;
// Create the complete flux for alpha2 // Create the complete flux for alpha2
surfaceScalarField alphaPhi2 surfaceScalarField alphaPhi2
( (
@ -172,7 +177,6 @@
} }
// Construct the limited fluxes // Construct the limited fluxes
alphaPhi1 = alphaPhi1BD + lambda*alphaPhi1;
alphaPhi2 = alphaPhi2BD + lambda*alphaPhi2; alphaPhi2 = alphaPhi2BD + lambda*alphaPhi2;
// Solve for alpha1 // Solve for alpha1

View File

@ -46,7 +46,7 @@ int main(int argc, char *argv[])
scalarField samples(10000000); scalarField samples(10000000);
forAll(samples, i) forAll(samples, i)
{ {
samples[i] = rndGen.scalar01(); samples[i] = rndGen.sample01<scalar>();
} }
const scalar min = 0; const scalar min = 0;

View File

@ -3,7 +3,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) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -41,6 +41,8 @@ int main(int argc, char *argv[])
{ {
DLList<scalar> myList; DLList<scalar> myList;
Info<< "DLList<scalar>" << nl;
for (int i = 0; i<10; i++) for (int i = 0; i<10; i++)
{ {
myList.append(1.3*i); myList.append(1.3*i);
@ -49,17 +51,14 @@ int main(int argc, char *argv[])
myList.append(100.3); myList.append(100.3);
myList.append(500.3); myList.append(500.3);
Info<< nl << "And again using STL iterator: " << nl << endl; forAllConstIters(myList, iter)
forAllIter(DLList<scalar>, myList, iter)
{ {
Info<< "element:" << *iter << endl; Info<< "element:" << *iter << endl;
} }
Info<< nl << "And again using the same STL iterator: " << nl << 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; Info<< "Removing " << myList.remove(iter) << endl;
} }
@ -68,13 +67,10 @@ int main(int argc, char *argv[])
myList.append(200.3); myList.append(200.3);
myList.append(100.3); myList.append(100.3);
Info<< nl << "Using range-based for: " << nl << endl;
Info<< nl << "And again using STL const_iterator: " << nl << endl; for (auto val : myList)
forAllConstIter(DLList<scalar>, myList, iter)
{ {
Info<< "element:" << *iter << endl; Info<< "element:" << val << endl;
} }
Info<< nl << "Testing swapUp and swapDown: " << 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::first());
myList.swapUp(myList.DLListBase::last()); 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; Info<< nl << "swapDown" << endl;
@ -94,12 +90,11 @@ int main(int argc, char *argv[])
myList.swapDown(myList.DLListBase::first()); myList.swapDown(myList.DLListBase::first());
myList.swapDown(myList.DLListBase::last()); 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 Info<< nl << "Testing transfer: " << nl << nl
<< "original: " << myList << endl; << "original: " << myList << endl;

View File

@ -168,9 +168,24 @@ int main(int argc, char *argv[])
Info<< nl << "scalarDict2: " << endl; Info<< nl << "scalarDict2: " << endl;
forAllConstIter(PtrDictionary<Scalar>, scalarDict2, iter) forAllConstIter(PtrDictionary<Scalar>, scalarDict2, iter)
{ {
std::cout<< "iter: " << typeid(*iter).name() << '\n';
Info<< "elem = " << *iter << endl; 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); scalarDict.transfer(scalarDict2);

View File

@ -71,7 +71,7 @@ int main(int argc, char *argv[])
for (label i = 0; i < randomDistributionTestSize; i++) 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 Info<< "Mean " << dS.mean() << nl
@ -90,7 +90,7 @@ int main(int argc, char *argv[])
for (label i = 0; i < randomDistributionTestSize; i++) 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 Info<< "Mean " << dS2.mean() << nl
@ -121,7 +121,7 @@ int main(int argc, char *argv[])
for (label i = 0; i < randomDistributionTestSize; i++) 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 Pout<< "Mean " << dS.mean() << nl
@ -155,7 +155,7 @@ int main(int argc, char *argv[])
for (label i = 0; i < randomDistributionTestSize; i++) for (label i = 0; i < randomDistributionTestSize; i++)
{ {
dV.add(R.vector01()); dV.add(R.sample01<vector>());
// Adding separate GaussNormal components with component // Adding separate GaussNormal components with component
// weights // weights
@ -164,9 +164,9 @@ int main(int argc, char *argv[])
( (
vector vector
( (
R.GaussNormal()*3.0 + 1.5, R.GaussNormal<scalar>()*3.0 + 1.5,
R.GaussNormal()*0.25 + 4.0, R.GaussNormal<scalar>()*0.25 + 4.0,
R.GaussNormal()*3.0 - 1.5 R.GaussNormal<scalar>()*3.0 - 1.5
), ),
vector(1.0, 2.0, 5.0) vector(1.0, 2.0, 5.0)
); );
@ -225,7 +225,7 @@ int main(int argc, char *argv[])
for (label i = 0; i < randomDistributionTestSize; i++) for (label i = 0; i < randomDistributionTestSize; i++)
{ {
dT.add(R.tensor01()); dT.add(R.sample01<tensor>());
} }
Info<< "Mean " << dT.mean() << nl Info<< "Mean " << dT.mean() << nl
@ -249,7 +249,7 @@ int main(int argc, char *argv[])
for (label i = 0; i < randomDistributionTestSize; i++) for (label i = 0; i < randomDistributionTestSize; i++)
{ {
dSyT.add(R.symmTensor01()); dSyT.add(R.sample01<symmTensor>());
} }
Info<< "Mean " << dSyT.mean() << nl Info<< "Mean " << dSyT.mean() << nl
@ -273,7 +273,7 @@ int main(int argc, char *argv[])
for (label i = 0; i < randomDistributionTestSize; i++) for (label i = 0; i < randomDistributionTestSize; i++)
{ {
dSpT.add(R.sphericalTensor01()); dSpT.add(R.sample01<sphericalTensor>());
} }
Info<< "Mean " << dSpT.mean() << nl Info<< "Mean " << dSpT.mean() << nl

View File

@ -33,7 +33,6 @@ See also
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "argList.H" #include "argList.H"
#include "IOstreams.H"
#include "FixedList.H" #include "FixedList.H"
#include "IFstream.H" #include "IFstream.H"
#include "OFstream.H" #include "OFstream.H"
@ -64,6 +63,15 @@ int main(int argc, char *argv[])
Info<< "list2:" << list2 Info<< "list2:" << list2
<< " hash:" << FixedList<label, 4>::Hash<>()(list2) << endl; << " 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 Info<< "list: " << list << nl
<< "list2: " << list2 << endl; << "list2: " << list2 << endl;
list.swap(list2); list.swap(list2);

View File

@ -36,14 +36,9 @@ void printTable(const HashPtrTable<T>& table)
{ {
Info<< table.size() << nl << "(" << nl; Info<< table.size() << nl << "(" << nl;
for forAllConstIters(table, iter)
(
typename HashPtrTable<T>::const_iterator iter = table.cbegin();
iter != table.cend();
++iter
)
{ {
const T* ptr = *iter; const T* ptr = iter.object();
Info<< iter.key() << " = "; Info<< iter.key() << " = ";
if (ptr) if (ptr)
{ {
@ -57,6 +52,22 @@ void printTable(const HashPtrTable<T>& table)
} }
Info<< ")" << endl; 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; HashPtrTable<double> myTable;
myTable.insert("abc", new double(42.1)); myTable.insert("abc", new double(42.1));
myTable.insert("def", nullptr); 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; // Info<< myTable << endl;
printTable(myTable); printTable(myTable);
@ -79,8 +92,20 @@ int main()
printTable(copy); printTable(copy);
Info<< copy << endl; 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; return 0;
} }
// ************************************************************************* // // ************************************************************************* //

View File

@ -3,7 +3,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) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -28,6 +28,8 @@ Description
#include "hashedWordList.H" #include "hashedWordList.H"
#include "HashSet.H" #include "HashSet.H"
#include "Map.H" #include "Map.H"
#include "labelPairHashes.H"
#include "FlatOutput.H"
using namespace Foam; using namespace Foam;
@ -65,6 +67,14 @@ int main(int argc, char *argv[])
tableB.insert("value5", nil()); tableB.insert("value5", nil());
tableB.insert("value6", 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 Map<label> mapA
{ {
{ 1, 1 }, { 1, 1 },
@ -122,14 +132,23 @@ int main(int argc, char *argv[])
<< (wordHashSet(setA) | wordHashSet(tableA) | wordHashSet(tableB)) << (wordHashSet(setA) | wordHashSet(tableA) | wordHashSet(tableB))
<< nl; << nl;
labelHashSet setB labelHashSet setB
{ {
1, 11, 42 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; Info<< "setB : " << setB << endl;
labelPair pair(12, 15);
setB.set(pair);
Info<< "setB : " << setB << endl;
setB.unset(pair);
labelHashSet setC(1); labelHashSet setC(1);
setC.insert(2008); setC.insert(2008);
setC.insert(1984); setC.insert(1984);
@ -139,7 +158,7 @@ int main(int argc, char *argv[])
labelHashSet setD(1); labelHashSet setD(1);
setD.insert({11, 100, 49, 36, 2008}); setD.insert({11, 100, 49, 36, 2008});
Info<< "setD : " << setD << endl; Info<< "setD : " << flatOutput(setD) << endl;
Info<< "setB == setC: " << (setB == setC) << endl; Info<< "setB == setC: " << (setB == setC) << endl;
Info<< "setC != setD: " << (setC != setD) << 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 has no 11" << endl;
} }
Info<< "setD : " << setD << endl; Info<< "setB : " << flatOutput(setB) << endl;
Info<< "setD : " << flatOutput(setD) << endl;
// this doesn't work (yet?) setD -= setB;
Info<< "setD -= setB : " << flatOutput(setD) << endl;
// This should not work (yet?)
// setD[12] = true; // setD[12] = true;
List<label> someLst(10); List<label> someLst(10);
@ -191,8 +214,14 @@ int main(int argc, char *argv[])
label added = setD.set(someLst); label added = setD.set(someLst);
Info<< "added " << added << " from " << someLst.size() << endl; 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; return 0;
} }

View File

@ -24,6 +24,10 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "HashTable.H" #include "HashTable.H"
#include "List.H"
#include "SortableList.H"
#include "DynamicList.H"
#include "FlatOutput.H"
#include "IOstreams.H" #include "IOstreams.H"
#include "IStringStream.H" #include "IStringStream.H"
#include "OStringStream.H" #include "OStringStream.H"
@ -62,7 +66,7 @@ int main()
Info<< "\ntable1 sortedToc: " << table1.sortedToc() << endl; Info<< "\ntable1 sortedToc: " << table1.sortedToc() << endl;
table1.printInfo(Info) table1.printInfo(Info)
<< "table1 [" << table1.size() << "] " << endl; << "table1 [" << table1.size() << "] " << endl;
forAllConstIter(HashTable<scalar>, table1, iter) forAllConstIters(table1, iter)
{ {
Info<< iter.key() << " => " << iter() << nl; Info<< iter.key() << " => " << iter() << nl;
} }
@ -106,7 +110,7 @@ int main()
<< "\ntable3" << table3 << nl; << "\ntable3" << table3 << nl;
Info<< "\nerase table2 by iterator" << nl; Info<< "\nerase table2 by iterator" << nl;
forAllIter(HashTable<scalar>, table2, iter) forAllIters(table2, iter)
{ {
Info<< "erasing " << iter.key() << " => " << iter.object() << " ... "; Info<< "erasing " << iter.key() << " => " << iter.object() << " ... ";
table2.erase(iter); table2.erase(iter);
@ -162,21 +166,74 @@ int main()
<< "\ntable2" << table2 << nl; << "\ntable2" << table2 << nl;
Info<< "\ntable3" << table3 Info<< "\ntable3" << table2
<< "\nclearStorage table3 ... "; << "\nclearStorage table2 ... ";
table3.clearStorage(); table2.clearStorage();
Info<< table3 << nl; Info<< table2 << nl;
table1 = table1 =
{ {
{"aca", 3.0}, {"abc", 3.0},
{"aaw", 6.0}, {"def", 6.0},
{"acr", 8.0}, {"acr", 8.0},
{"aec", 10.0} {"aec", 10.0}
}; };
Info<< "\ntable1" << table1 << nl; 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"; Info<< "\nDone\n";
return 0; return 0;

View File

@ -78,7 +78,7 @@ int main(int argc, char *argv[])
Info<< nl << "And again using STL iterator: " << nl << endl; Info<< nl << "And again using STL iterator: " << nl << endl;
forAllIter(SLList<scalar>, myList, iter) forAllIters(myList, iter)
{ {
Info<< "element:" << *iter << endl; Info<< "element:" << *iter << endl;
} }
@ -87,7 +87,7 @@ int main(int argc, char *argv[])
const ISLList<Scalar>& const_myList = myList; const ISLList<Scalar>& const_myList = myList;
forAllConstIter(SLList<scalar>, const_myList, iter) forAllConstIters(const_myList, iter)
{ {
Info<< "element:" << *iter << endl; Info<< "element:" << *iter << endl;
} }

View File

@ -42,6 +42,7 @@ See also
#include "vector.H" #include "vector.H"
#include "labelRange.H" #include "labelRange.H"
#include "scalarList.H"
#include "ListOps.H" #include "ListOps.H"
#include "SubList.H" #include "SubList.H"
@ -76,7 +77,6 @@ int main(int argc, char *argv[])
Info<<"is >>: " << intlist << endl; Info<<"is >>: " << intlist << endl;
} }
List<vector> list1(IStringStream("1 ((0 1 2))")()); List<vector> list1(IStringStream("1 ((0 1 2))")());
Info<< "list1: " << list1 << endl; Info<< "list1: " << list1 << endl;
@ -145,12 +145,23 @@ int main(int argc, char *argv[])
labelList longLabelList = identity(15); labelList longLabelList = identity(15);
// This does not work:
// scalarList slist = identity(15);
//
// More writing, but does work:
scalarList slist
(
labelRange::null.begin(),
labelRange::identity(15).end()
);
Info<<"scalar identity:" << flatOutput(slist) << endl;
Info<< "labels (contiguous=" << contiguous<label>() << ")" << nl; Info<< "labels (contiguous=" << contiguous<label>() << ")" << nl;
Info<< "normal: " << longLabelList << nl; Info<< "normal: " << longLabelList << nl;
Info<< "flatOutput: " << flatOutput(longLabelList) << nl; Info<< "flatOutput: " << flatOutput(longLabelList) << nl;
// Info<< "flatOutput(14): " << flatOutput(longLabelList, 14) << nl; // Info<< "flatOutput(14): " << flatOutput(longLabelList, 14) << nl;
// Info<< "flatOutput(15): " << flatOutput(longLabelList, 15) << nl;
stringList longStringList(12); stringList longStringList(12);
forAll(longStringList, i) forAll(longStringList, i)
@ -165,6 +176,91 @@ int main(int argc, char *argv[])
// contiguous longStringList[i].resize(3, 'a' + i); // contiguous longStringList[i].resize(3, 'a' + i);
} }
// test SubList and labelRange
{
Info<< nl;
labelList longLabelList = identity(25);
reverse(longLabelList);
FixedList<label, 6> fixedLabelList{0,1,2,3,4,5};
const labelList constLabelList = identity(25);
Info<< "full-list: " << flatOutput(longLabelList) << nl;
labelRange range1(-15, 25);
Info<<"sub range:" << range1 << "=";
Info<< SubList<label>(longLabelList, range1) << nl;
labelRange range2(7, 8);
Info<<"sub range:" << range2 << "=";
Info<< SubList<label>(longLabelList, range2) << nl;
// labelRange range2(7, 8);
Info<<"use range " << range2 << " to set value";
SubList<label>(longLabelList, range2) = -15;
Info<< "=> " << flatOutput(longLabelList) << nl;
// This syntax looks even nicer:
// GOOD: does not compile
// > constLabelList[labelRange(23,5)] = 5;
// Check correct overlaps
longLabelList[labelRange(-10, 12)] = 200;
longLabelList[{18,3}] = 100;
longLabelList[{23,3}] = 400;
// and complete misses
longLabelList[{500,50}] = 100;
// labelRange automatically suppresses -ve size -> nop
longLabelList[{5,-5}] = 42;
longLabelList[{21,100}] = 42;
//Good: does not compile
//> longLabelList[labelRange(20,50)] = constLabelList;
//Good: does not compile
// longLabelList[labelRange(20,50)] = fixedLabelList;
Info<< "updated: " << constLabelList[labelRange(23,5)] << nl;
Info<< "updated: " << flatOutput(longLabelList) << nl;
//Nope: sort(longLabelList[labelRange(18,5)]);
{
// Instead
UList<label> sub = longLabelList[labelRange(0, 8)];
sort(sub);
}
Info<< "sub-sorted: " << flatOutput(longLabelList) << nl;
// construct from a label-range
labelRange range(25,15);
labelList ident(range.begin(), range.end());
Info<<"range-list (label)=" << ident << nl;
List<scalar> sident(range.begin(), range.end());
Info<<"range-list (scalar)=" << sident << nl;
// Sub-ranges also work
List<scalar> sident2(range(3), range(10));
Info<<"range-list (scalar)=" << sident2 << nl;
// VERY BAD IDEA: List<scalar> sident3(range(10), range(3));
// This doesn't work, and don't know what it should do anyhow
// List<vector> vident(range.begin(), range.end());
// Info<<"range-list (vector)=" << vident << nl;
// Even weird things like this
List<scalar> sident4
(
labelRange().begin(),
labelRange::identity(8).end()
);
Info<<"range-list (scalar)=" << sident4 << nl;
}
wordReList reLst; wordReList reLst;
wordList wLst; wordList wLst;
stringList sLst; stringList sLst;

View File

@ -22,10 +22,9 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Application Application
testMapIterators Test-Map
Description Description
For each time calculate the magnitude of velocity.
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -39,9 +38,7 @@ using namespace Foam;
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
Map<bool> banana; Map<bool> banana{{5, true}};
banana.insert(5, true);
// Taking a const iterator from find does not work! // Taking a const iterator from find does not work!
// Also, fails later on op== // Also, fails later on op==
@ -50,7 +47,7 @@ int main(int argc, char *argv[])
// This works but now I can change the value. // This works but now I can change the value.
//Map<bool>::iterator bananaIter = banana.find(5); //Map<bool>::iterator bananaIter = banana.find(5);
if (bananaIter == banana.end()) if (!bananaIter.found()) // same as (bananaIter == banana.end())
{ {
Info<< "not found" << endl; Info<< "not found" << endl;
} }
@ -62,8 +59,7 @@ int main(int argc, char *argv[])
// Same with STL // Same with STL
Info<< "Same with STL" << endl; Info<< "Same with STL" << endl;
std::map<label, bool> STLbanana; std::map<label, bool> STLbanana{{5, true}};
STLbanana[5] = true;
std::map<label, bool>::const_iterator STLbananaIter = STLbanana.find(5); std::map<label, bool>::const_iterator STLbananaIter = STLbanana.find(5);
if (STLbananaIter == STLbanana.end()) if (STLbananaIter == STLbanana.end())

View File

@ -77,24 +77,12 @@ int main(int argc, char *argv[])
<< "] = '" << namedEnumTest::namedEnum[opt] << "'" << nl; << "] = '" << namedEnumTest::namedEnum[opt] << "'" << nl;
} }
#if __cplusplus > 201100L
// C++11
Info<< "loop over enums (C++11 for range):" << nl; Info<< "loop over enums (C++11 for range):" << nl;
for (auto const& opt : options) for (const auto& opt : options)
{ {
Info<< "option[" << opt Info<< "option[" << opt
<< "] = '" << namedEnumTest::namedEnum[opt] << "'" << nl; << "] = '" << namedEnumTest::namedEnum[opt] << "'" << nl;
} }
#else
Info<< "loop over enums (via iterator):" << nl;
forAllConstIter(List<namedEnumTest::option>, options, iter)
{
const namedEnumTest::option& opt = *iter;
Info<< "option[" << opt
<< "] = '" << namedEnumTest::namedEnum[opt] << "'" << nl;
}
#endif
Info<< nl Info<< nl
<< namedEnumTest::namedEnum["a"] << nl << namedEnumTest::namedEnum["a"] << nl

View File

@ -152,7 +152,7 @@ int main(int argc, char *argv[])
Random rnd(123456); Random rnd(123456);
for (int i=0; i<10; i++) for (int i=0; i<10; i++)
{ {
scalar x = rnd.scalar01()*100; scalar x = rnd.sample01<scalar>()*100;
scalar px = polyValue(x); scalar px = polyValue(x);
scalar ipx = intPolyValue(x); scalar ipx = intPolyValue(x);

View File

@ -52,29 +52,29 @@ int main(int argc, char *argv[])
Info<< nl << "And again using STL iterator: " << nl << endl; Info<< nl << "And again using STL iterator: " << nl << endl;
forAllIter(SLList<scalar>, myList, iter) for (const auto& val : myList)
{ {
Info<< "element:" << *iter << endl; Info<< "element:" << val << endl;
} }
Info<< nl << "And again using STL const_iterator: " << nl << endl; Info<< nl << "And again using STL const_iterator: " << nl << endl;
const SLList<scalar>& const_myList = myList; const SLList<scalar>& const_myList = myList;
forAllConstIter(SLList<scalar>, const_myList, iter) forAllConstIters(const_myList, iter)
{ {
Info<< "element:" << *iter << endl; Info<< "element:" << *iter << endl;
} }
forAllIter(SLList<scalar>, myList, iter) forAllIters(myList, iter)
{ {
Info<< "Removing element:" << *iter << endl; Info<< "Removing element:" << *iter << endl;
myList.remove(iter); myList.remove(iter);
} }
forAllConstIter(SLList<scalar>, const_myList, iter) for (const auto& val : const_myList)
{ {
Info<< "element:" << *iter << endl; Info<< "element:" << val << endl;
} }

View File

@ -31,6 +31,7 @@ Description
#include "Tuple2.H" #include "Tuple2.H"
#include "label.H" #include "label.H"
#include "scalar.H" #include "scalar.H"
#include "List.H"
using namespace Foam; using namespace Foam;
@ -39,9 +40,25 @@ using namespace Foam;
int main() int main()
{ {
Tuple2<label, scalar> t2(1, 3.2); typedef Tuple2<label, scalar> indexedScalar;
Info<< t2 << " " << t2.first() << " " << t2.second() << endl; indexedScalar t2(1, 3.2);
Info<< "tuple: "
<< t2 << " "
<< t2.first() << " " << t2.second() << endl;
List<indexedScalar> list1(10);
forAll(list1, i)
{
list1[i] = indexedScalar(-i, i*i);
}
sort(list1);
Info<< "tuples:" << nl
<< list1
<< endl;
Info<< "End\n" << endl; Info<< "End\n" << endl;

View File

@ -0,0 +1,3 @@
Test-cpluplus1.C
EXE = $(FOAM_USER_APPBIN)/Test-cpluplus1

View File

@ -0,0 +1,2 @@
/* EXE_INC = -I$(LIB_SRC)/cfdTools/include */
/* EXE_LIBS = -lfiniteVolume */

View File

@ -0,0 +1,88 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
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/>.
Description
Test miscellaneous C++ templates/functionality.
\*---------------------------------------------------------------------------*/
#include "string.H"
#include "IOstreams.H"
#include "UList.H"
#include "HashSet.H"
#include <typeinfo>
#include <type_traits>
#include <utility>
using namespace Foam;
// Macros to stringify macro contents.
#define STRINGIFY(content) #content
#define STRING_QUOTE(input) STRINGIFY(input)
#define PRINT_TYPEID(arg) \
Info<< typeid(arg).name() << " <= typeid of " << STRING_QUOTE(arg) << nl
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Main program:
int main(int argc, char *argv[])
{
Info<< "various declaration types" << nl << nl;
PRINT_TYPEID(label);
PRINT_TYPEID(decltype(UList<label>::value_type()));
PRINT_TYPEID(decltype(std::declval<UList<label>>().cbegin()));
PRINT_TYPEID(decltype(*(std::declval<UList<label>>().cbegin())));
Info<< nl;
PRINT_TYPEID(decltype(HashTable<label>::key_type()));
PRINT_TYPEID(decltype(HashTable<label>::value_type()));
// Not yet: PRINT_TYPEID(decltype(HashTable<label>::mapped_type()));
PRINT_TYPEID(decltype(std::declval<HashTable<label>>().begin()));
PRINT_TYPEID(decltype(std::declval<const HashTable<label>>().begin()));
PRINT_TYPEID(decltype(*(std::declval<HashTable<label>>().begin())));
PRINT_TYPEID(decltype(*(std::declval<const HashTable<label>>().begin())));
PRINT_TYPEID(decltype(std::declval<const HashTable<label>>().keys()));
Info<< nl;
PRINT_TYPEID(decltype(HashSet<label>::key_type()));
PRINT_TYPEID(decltype(HashSet<label>::value_type()));
// Not yet: PRINT_TYPEID(decltype(HashSet<label>::mapped_type()));
PRINT_TYPEID(decltype(std::declval<HashSet<label>>().begin()));
PRINT_TYPEID(decltype(std::declval<const HashSet<label>>().begin()));
PRINT_TYPEID(decltype(*(std::declval<HashSet<label>>().begin())));
PRINT_TYPEID(decltype(*(std::declval<const HashSet<label>>().begin())));
Info<< nl;
Info << "\nEnd\n" << endl;
return 0;
}
// ************************************************************************* //

View File

@ -0,0 +1,53 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object testDict;
note "test with foamDictionary -expand";
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// #inputMode overwrite
key1 val1;
subdict
{
key1 a;
key2 b;
}
update
{
key1 val1b;
key2 val2;
subdict
{
key2 $key1;
key3 val3;
key2b ${..key2};
key3b $^key1;
}
}
$update
// Can a leading '^' or ':' as anchor for scoping
key3 $^subdict.key1;
key3 ${^update.subdict.key3};
key4 ${:update.subdict...subdict.key1};
// This is currently not working
#remove update.key1
// #remove update
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -1,3 +1,3 @@
EXE_INC = -I$(FOAM_SRC)/meshTools/lnInclude EXE_INC = -I$(LIB_SRC)/meshTools/lnInclude
EXE_LIBS = -lmeshTools EXE_LIBS = -lmeshTools

View File

@ -0,0 +1,3 @@
Test-edges.C
EXE = $(FOAM_USER_APPBIN)/Test-edges

View File

View File

@ -0,0 +1,148 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
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/>.
Application
Test-edges
Description
Simple tests for edges
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "edgeList.H"
#include "edgeHashes.H"
using namespace Foam;
void printInfo(const edge& e)
{
Info<< "edge: " << e << " count:" << e.count() << nl;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Main program:
int main(int argc, char *argv[])
{
edge e1;
printInfo(e1);
Info<<"has '2'? " << e1.found(2) << endl;
edge e2(1, 2);
printInfo(e2);
Info<<"has '2'? " << e2.found(2) << endl;
edge e3{2, 3};
printInfo(e3);
Info<<"has '2'? " << e3.found(2) << endl;
edge e4(4, 4);
printInfo(e4);
Info<<"has '2'? " << e4.found(2) << endl;
Info<<"collapse? -> " << e4.collapse() << endl;
printInfo(e4);
Info<< e3 << " connects " << e2 << " => " << e2.connects(e3) << endl;
labelPair labels(e3);
Info<< "as labelPair: " << labels << endl;
edge e5;
// Good: this fails (explicit constructor): printInfo(labels);
// Good: this also fails (no assignment operator): e5 = labels;
// OK: explicit
edge e6(labels);
Info<< nl << "hash-like functionality" << nl;
// doesn't work e4 = -1;
e4.start() = e4.end() = -1;
printInfo(e4);
for (label i : {2, -1, 2, 1, 4, 1, 2, 3})
{
bool ok = e4.insert(i);
Info<< "insert(" << i << ") = " << ok << " resulting ";
printInfo(e4);
}
e4.start() = e4.end() = -1;
Info<< "insert from list\n";
labelHashSet newIndices({2, -1, 2, 1, 4, 1, 2, 3});
e4.insert(newIndices.toc());
printInfo(e4);
e4.start() = e4.end() = -1;
Info<< "insert from list\n";
e4.insert({0, 5, 2, -1, 2, 1, 4, 1, 2, 3});
printInfo(e4);
FixedList<label, 8> otherIndices{12, 2, -1, 1, 4, 1, 2, 3};
e4.start() = e4.end() = -1;
Info<< "insert from list: " << otherIndices << nl;
e4.insert(otherIndices);
printInfo(e4);
e4.start() = e4.end();
Info<< "erase from list: " << otherIndices << nl;
Info<< "removed " << e4.erase(otherIndices) << " values" << nl;
printInfo(e4);
for (label i : {-1, 0, 1, 3})
{
bool ok = e4.erase(i);
Info<< "erase(" << i << ") = " << ok << " resulting ";
printInfo(e4);
}
for (label i : {-1, 0, 1, 3})
{
bool ok = e4.insert(i);
Info<< "insert(" << i << ") = " << ok << " resulting ";
printInfo(e4);
}
e4.flip();
Info<< "flipped ";
printInfo(e4);
for (label i : {-1, 0, 1, 3})
{
bool ok = e4.erase(i);
Info<< "erase(" << i << ") = " << ok << " resulting ";
printInfo(e4);
}
e4.sort();
Info<< "sorted ";
printInfo(e4);
return 0;
}
// ************************************************************************* //

View File

@ -0,0 +1,3 @@
Test-etcFiles.C
EXE = $(FOAM_USER_APPBIN)/Test-etcFiles

View File

View File

@ -0,0 +1,122 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
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/>.
Application
Test-etcFiles
Description
Test etcFiles functionality.
Similar to foamEtcFile script, but automatically prunes nonexistent
directories from the list.
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "etcFiles.H"
using namespace Foam;
void printList(const fileNameList& list)
{
forAll(list, i)
{
Info<< list[i].c_str() << nl;
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Main program:
int main(int argc, char *argv[])
{
argList::noBanner();
argList::noParallel();
argList::noFunctionObjects();
argList::removeOption("case");
argList::addBoolOption
(
"all",
"Return all files (otherwise stop after the first match)"
);
argList::addBoolOption
(
"list",
"List directories or files to be checked"
);
argList::validArgs.insert("file...");
argList::addNote
(
"Locate user/group/other file with semantics similar to the "
"~OpenFOAM/fileName expansion."
);
argList args(argc, argv, false, true);
// First handle no parameters
if (args.size() == 1)
{
if (args.optionFound("list"))
{
fileNameList results = findEtcDirs();
printList(results);
return 0;
}
else
{
Info<<"Error: Missing filename" << endl;
args.printUsage();
return 1;
}
}
const bool listAll = (args.optionFound("all") || args.optionFound("list"));
int error = 0;
for (int argi = 1; argi < args.size(); ++argi)
{
const std::string file = args[argi];
fileNameList results = findEtcFiles(file);
if (results.empty())
{
Info<<"Not found: " << file << nl;
error = 2;
}
else if (listAll)
{
printList(results);
}
else
{
Info<<results[0].c_str() << nl;
}
}
return error;
}
// ************************************************************************* //

View File

@ -28,10 +28,6 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "argList.H" #include "argList.H"
#include "IOobject.H"
#include "IOstreams.H"
#include "IFstream.H"
#include "IStringStream.H"
#include "labelRanges.H" #include "labelRanges.H"
using namespace Foam; using namespace Foam;
@ -42,6 +38,7 @@ using namespace Foam;
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
argList::noParallel(); argList::noParallel();
argList::noFunctionObjects();
argList::validArgs.insert("start size .. startN sizeN"); argList::validArgs.insert("start size .. startN sizeN");
argList::addOption("verbose"); argList::addOption("verbose");
argList::addNote argList::addNote
@ -57,6 +54,34 @@ int main(int argc, char *argv[])
labelRange::debug = 1; labelRange::debug = 1;
} }
{
Info<<"test sorting" << endl;
DynamicList<labelRange> list1(10);
list1.append(labelRange(25, 8));
list1.append(labelRange::identity(8));
list1.append(labelRange(15, 5));
list1.append(labelRange(50, -10));
sort(list1);
Info<<"sorted" << list1 << endl;
}
{
Info<<"test intersections" << endl;
labelRange range1(-15, 25);
labelRange range2(7, 8);
labelRange range3(-20, 8);
labelRange range4(50, 8);
Info<<range1 << " & " << range2
<< " = " << range1.subset(range2) << nl;
Info<< range1 << " & " << range3
<< " = " << range1.subset(range3) << nl;
Info<< range2 << " & " << range4
<< " = " << range2.subset(range4) << nl;
}
labelRange range; labelRange range;
labelRanges ranges; labelRanges ranges;
@ -76,12 +101,9 @@ int main(int argc, char *argv[])
} }
{ {
label start = 0; label start = args.argRead<label>(argI);
label size = 0; label size = args.argRead<label>(argI+1);
IStringStream(args[argI])() >> start;
++argI; ++argI;
IStringStream(args[argI])() >> size;
range.reset(start, size); range.reset(start, size);
} }
@ -90,9 +112,9 @@ int main(int argc, char *argv[])
if (removeMode) if (removeMode)
{ {
Info<< "del " << range << " :"; Info<< "del " << range << " :";
forAllConstIter(labelRange, range, iter) for (auto i : range)
{ {
Info<< " " << iter(); Info<< " " << i;
} }
Info<< nl; Info<< nl;
@ -101,9 +123,9 @@ int main(int argc, char *argv[])
else else
{ {
Info<< "add " << range << " :"; Info<< "add " << range << " :";
forAllConstIter(labelRange, range, iter) for (auto i : range)
{ {
Info<< " " << iter(); Info<< " " << i;
} }
Info<< nl; Info<< nl;

View File

@ -1,3 +1,3 @@
Test-nullObject.C Test-nullObject.C
EXE = $(FOAM_USER_APPBIN)/nullObject EXE = $(FOAM_USER_APPBIN)/Test-nullObject

View File

@ -21,6 +21,17 @@ int main()
SimpleClass* ptrToClass = new SimpleClass; SimpleClass* ptrToClass = new SimpleClass;
SimpleClass& refToClass(*ptrToClass); SimpleClass& refToClass(*ptrToClass);
typedef unsigned long ptrval;
Info<<"nullObject address=" << ptrval(&(nullObjectPtr)) << endl;
Info<<"sizeof(nullObject)" << " == "
<< sizeof(NullObject::nullObject)
<< " vs. sizeof(void*)" << " == " << sizeof(void*)
<< endl;
Info<<"nullObject pointer:" << ptrval(nullObjectPtr->pointer()) << endl;
Info<<"nullObject value:" << nullObjectPtr->value() << endl;
if (notNull(ptrToClass)) if (notNull(ptrToClass))
{ {
Info<< "Pass: ptrToClass is not null" << endl; Info<< "Pass: ptrToClass is not null" << endl;

View File

@ -29,6 +29,9 @@ Description
#include "pTraits.H" #include "pTraits.H"
#include "vector.H" #include "vector.H"
#include "tensor.H" #include "tensor.H"
#include "uLabel.H"
#include <type_traits>
using namespace Foam; using namespace Foam;
@ -40,7 +43,10 @@ void printTraits()
{ {
Info<< pTraits<T>::typeName Info<< pTraits<T>::typeName
<< ": zero=" << pTraits<T>::zero << ": zero=" << pTraits<T>::zero
<< " one=" << pTraits<T>::one << endl; << " one=" << pTraits<T>::one
<< " integral=" << std::is_integral<T>::value
<< " floating=" << std::is_floating_point<T>::value
<< endl;
} }
@ -51,6 +57,9 @@ void printTraits(const pTraits<T>& p)
} }
#pragma GCC diagnostic warning "-Wmaybe-uninitialized"
#pragma GCC diagnostic warning "-Wuninitialized"
int main() int main()
{ {
printTraits<bool>(); printTraits<bool>();
@ -71,6 +80,27 @@ int main()
printTraits(pTraits<scalar>(3.14159)); printTraits(pTraits<scalar>(3.14159));
label abc;
Info<< "unintialized primitive:"<< abc << endl;
label def = label();
Info<< "intialized primitive:"<< def << endl;
Info<< nl << "some interesting label limits:" << nl;
std::cout<< "sizeof = " << sizeof(label) << nl;
std::cout<< "min = " << pTraits<label>::min << nl;
std::cout<< "max = " << pTraits<label>::max << nl;
std::cout<< "umax = " << pTraits<uLabel>::max << nl;
std::cout<< "max_2 = " << pTraits<label>::max/2 << " == "
<< (1 << (sizeof(label)*8-2)) << nl;
std::cout<< "max_4 = " << pTraits<label>::max/4 << " == "
<< (1 << (sizeof(label)*8-3)) << nl;
std::cout<< "max_8 = " << pTraits<label>::max/8 << " == "
<< (1 << (sizeof(label)*8-4)) << nl;
Info<< "End\n" << endl; Info<< "End\n" << endl;
return 0; return 0;

View File

@ -1 +1 @@
EXE_INC = -I$(FOAM_APP)/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/vectorTools EXE_INC = -I$(FOAM_UTILITIES)/mesh/generation/foamyMesh/conformalVoronoiMesh/vectorTools

View File

@ -3,7 +3,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) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -62,7 +62,6 @@ using namespace Foam;
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
#include "addOverwriteOption.H" #include "addOverwriteOption.H"
argList::noParallel();
argList::validArgs.append("patches"); argList::validArgs.append("patches");
argList::validArgs.append("edgeFraction"); argList::validArgs.append("edgeFraction");

View File

@ -22,8 +22,11 @@ fi
# Build libccmio (.a|.so) - use static linkage for fewer issues # Build libccmio (.a|.so) - use static linkage for fewer issues
$WM_THIRD_PARTY_DIR/makeCCMIO lib $WM_THIRD_PARTY_DIR/makeCCMIO lib
: ${FOAM_EXT_LIBBIN:=/usr/lib$WM_COMPILER_LIB_ARCH} # Extra safety
export FOAM_EXT_LIBBIN
if [ -e $CCMIO_ARCH_PATH/include/libccmio/ccmio.h \ if [ -e $CCMIO_ARCH_PATH/include/libccmio/ccmio.h \
-a \( -e $CCMIO_ARCH_PATH/lib/libccmio.a -o $FOAM_EXT_LIBBIN/libccmio.so \) ] -a \( -e $CCMIO_ARCH_PATH/lib/libccmio.a -o -e $FOAM_EXT_LIBBIN/libccmio.so \) ]
then then
wmake $targetType ccm26ToFoam wmake $targetType ccm26ToFoam
else else

View File

@ -925,8 +925,8 @@ int main(int argc, char *argv[])
} }
} }
HashTable<labelList,word> cellZones; HashTable<labelList> cellZones;
HashTable<labelList,word> faceZones; HashTable<labelList> faceZones;
List<bool> isAPatch(patchNames.size(),true); List<bool> isAPatch(patchNames.size(),true);
if (dofVertIndices.size()) if (dofVertIndices.size())

View File

@ -62,7 +62,7 @@ Foam::tmp<Foam::Field<Type>> filterFarPoints
) )
{ {
tmp<Field<Type>> tNewField(new Field<Type>(field.size())); tmp<Field<Type>> tNewField(new Field<Type>(field.size()));
Field<Type>& newField = tNewField(); Field<Type>& newField = tNewField.ref();
label added = 0; label added = 0;
label count = 0; label count = 0;
@ -160,7 +160,7 @@ Foam::tmp<Foam::triadField> buildAlignmentField(const T& mesh)
( (
new triadField(mesh.vertexCount(), triad::unset) new triadField(mesh.vertexCount(), triad::unset)
); );
triadField& alignments = tAlignments(); triadField& alignments = tAlignments.ref();
for for
( (
@ -188,7 +188,7 @@ Foam::tmp<Foam::pointField> buildPointField(const T& mesh)
( (
new pointField(mesh.vertexCount(), point(GREAT, GREAT, GREAT)) new pointField(mesh.vertexCount(), point(GREAT, GREAT, GREAT))
); );
pointField& points = tPoints(); pointField& points = tPoints.ref();
for for
( (

View File

@ -24,7 +24,8 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "DelaunayMesh.H" #include "DelaunayMesh.H"
#include "labelPair.H" #include "polyMesh.H"
#include "labelPairHashes.H"
#include "PrintTable.H" #include "PrintTable.H"
#include "pointIOField.H" #include "pointIOField.H"
#include "scalarIOField.H" #include "scalarIOField.H"

View File

@ -37,9 +37,7 @@ SourceFiles
#ifndef DelaunayMesh_H #ifndef DelaunayMesh_H
#define DelaunayMesh_H #define DelaunayMesh_H
#include "Pair.H" #include "labelPairHashes.H"
#include "HashSet.H"
#include "FixedList.H"
#include "boundBox.H" #include "boundBox.H"
#include "indexedVertex.H" #include "indexedVertex.H"
#include "CGALTriangulation3Ddefs.H" #include "CGALTriangulation3Ddefs.H"
@ -77,20 +75,6 @@ public:
typedef typename Triangulation::Finite_facets_iterator typedef typename Triangulation::Finite_facets_iterator
Finite_facets_iterator; Finite_facets_iterator;
typedef HashSet
<
Pair<label>,
FixedList<label, 2>::Hash<>
> labelPairHashSet;
typedef HashTable
<
label,
labelPair,
FixedList<label, 2>::Hash<>
> labelTolabelPairHashTable;
private: private:
// Private data // Private data
@ -263,7 +247,7 @@ public:
autoPtr<polyMesh> createMesh autoPtr<polyMesh> createMesh
( (
const fileName& name, const fileName& name,
labelTolabelPairHashTable& vertexMap, labelPairLookup& vertexMap,
labelList& cellMap, labelList& cellMap,
const bool writeDelaunayData = true const bool writeDelaunayData = true
) const; ) const;

View File

@ -337,7 +337,7 @@ Foam::autoPtr<Foam::polyMesh>
Foam::DelaunayMesh<Triangulation>::createMesh Foam::DelaunayMesh<Triangulation>::createMesh
( (
const fileName& name, const fileName& name,
labelTolabelPairHashTable& vertexMap, labelPairLookup& vertexMap,
labelList& cellMap, labelList& cellMap,
const bool writeDelaunayData const bool writeDelaunayData
) const ) const

View File

@ -31,9 +31,6 @@ License
#include "indexedVertexEnum.H" #include "indexedVertexEnum.H"
#include "IOmanip.H" #include "IOmanip.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
// * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * * //
template<class Triangulation> template<class Triangulation>
@ -539,13 +536,7 @@ Foam::label Foam::DistributedDelaunayMesh<Triangulation>::referVertices
if (!pointsNotInserted.empty()) if (!pointsNotInserted.empty())
{ {
for forAllConstIters(pointsNotInserted, iter)
(
typename labelPairHashSet::const_iterator iter
= pointsNotInserted.begin();
iter != pointsNotInserted.end();
++iter
)
{ {
if (receivedVertices.found(iter.key())) if (receivedVertices.found(iter.key()))
{ {
@ -863,7 +854,7 @@ void Foam::DistributedDelaunayMesh<Triangulation>::sync(const boundBox& bb)
template<class Triangulation> template<class Triangulation>
template<class PointIterator> template<class PointIterator>
typename Foam::DistributedDelaunayMesh<Triangulation>::labelPairHashSet Foam::labelPairHashSet
Foam::DistributedDelaunayMesh<Triangulation>::rangeInsertReferredWithInfo Foam::DistributedDelaunayMesh<Triangulation>::rangeInsertReferredWithInfo
( (
PointIterator begin, PointIterator begin,

View File

@ -71,10 +71,6 @@ public:
typedef typename Triangulation::All_cells_iterator typedef typename Triangulation::All_cells_iterator
All_cells_iterator; All_cells_iterator;
typedef typename DelaunayMesh<Triangulation>::labelPairHashSet
labelPairHashSet;
private: private:
autoPtr<List<boundBox>> allBackgroundMeshBounds_; autoPtr<List<boundBox>> allBackgroundMeshBounds_;
@ -193,12 +189,6 @@ public:
bool printErrors = true bool printErrors = true
); );
// distributeField();
// Queries
}; };

View File

@ -635,7 +635,7 @@ void Foam::cellShapeControlMesh::write() const
} }
} }
DelaunayMesh<CellSizeDelaunay>::labelTolabelPairHashTable vertexMap; labelPairLookup vertexMap;
labelList cellMap; labelList cellMap;
autoPtr<polyMesh> meshPtr = DelaunayMesh<CellSizeDelaunay>::createMesh autoPtr<polyMesh> meshPtr = DelaunayMesh<CellSizeDelaunay>::createMesh

View File

@ -35,7 +35,7 @@ Foam::tmp<Foam::Field<Type>> Foam::smoothAlignmentSolver::filterFarPoints
) )
{ {
tmp<Field<Type>> tNewField(new Field<Type>(field.size())); tmp<Field<Type>> tNewField(new Field<Type>(field.size()));
Field<Type>& newField = tNewField(); Field<Type>& newField = tNewField.ref();
label added = 0; label added = 0;
label count = 0; label count = 0;

View File

@ -105,7 +105,7 @@ public:
typedef Delaunay::Facet Facet; typedef Delaunay::Facet Facet;
typedef Delaunay::Point Point; typedef Delaunay::Point Point;
typedef List<DynamicList<Pair<labelPair>>> labelPairPairDynListList; typedef List<DynamicList<labelPairPair>> labelPairPairDynListList;
typedef Tuple2<pointIndexHit, label> pointIndexHitAndFeature; typedef Tuple2<pointIndexHit, label> pointIndexHitAndFeature;
typedef List<pointIndexHitAndFeature> pointIndexHitAndFeatureList; typedef List<pointIndexHitAndFeature> pointIndexHitAndFeatureList;
@ -706,7 +706,7 @@ private:
( (
labelList& owner, labelList& owner,
labelList& neighbour, labelList& neighbour,
const HashSet<labelPair, labelPair::Hash<>>& deferredCollapseFaces const labelPairHashSet& deferredCollapseFaces
) const; ) const;
//- Check whether the cell sizes are fine enough. Creates a polyMesh. //- Check whether the cell sizes are fine enough. Creates a polyMesh.

View File

@ -673,7 +673,7 @@ void Foam::conformalVoronoiMesh::deferredCollapseFaceSet
( (
labelList& owner, labelList& owner,
labelList& neighbour, labelList& neighbour,
const HashSet<labelPair, labelPair::Hash<>>& deferredCollapseFaces const labelPairHashSet& deferredCollapseFaces
) const ) const
{ {
DynamicList<label> faceLabels; DynamicList<label> faceLabels;
@ -2131,14 +2131,14 @@ void Foam::conformalVoronoiMesh::createFacesOwnerNeighbourAndPatches
// Use this processor's vertex index as the master // Use this processor's vertex index as the master
// for sorting // for sorting
DynamicList<Pair<labelPair>>& sortingIndex = DynamicList<labelPairPair>& sortingIndex =
procPatchSortingIndex[patchIndex]; procPatchSortingIndex[patchIndex];
if (vB->internalOrBoundaryPoint() && vB->referred()) if (vB->internalOrBoundaryPoint() && vB->referred())
{ {
sortingIndex.append sortingIndex.append
( (
Pair<labelPair> labelPairPair
( (
labelPair(vA->index(), vA->procIndex()), labelPair(vA->index(), vA->procIndex()),
labelPair(vB->index(), vB->procIndex()) labelPair(vB->index(), vB->procIndex())
@ -2149,7 +2149,7 @@ void Foam::conformalVoronoiMesh::createFacesOwnerNeighbourAndPatches
{ {
sortingIndex.append sortingIndex.append
( (
Pair<labelPair> labelPairPair
( (
labelPair(vB->index(), vB->procIndex()), labelPair(vB->index(), vB->procIndex()),
labelPair(vA->index(), vA->procIndex()) labelPair(vA->index(), vA->procIndex())
@ -2162,14 +2162,14 @@ void Foam::conformalVoronoiMesh::createFacesOwnerNeighbourAndPatches
// Use the other processor's vertex index as the // Use the other processor's vertex index as the
// master for sorting // master for sorting
DynamicList<Pair<labelPair>>& sortingIndex = DynamicList<labelPairPair>& sortingIndex =
procPatchSortingIndex[patchIndex]; procPatchSortingIndex[patchIndex];
if (vA->internalOrBoundaryPoint() && vA->referred()) if (vA->internalOrBoundaryPoint() && vA->referred())
{ {
sortingIndex.append sortingIndex.append
( (
Pair<labelPair> labelPairPair
( (
labelPair(vA->index(), vA->procIndex()), labelPair(vA->index(), vA->procIndex()),
labelPair(vB->index(), vB->procIndex()) labelPair(vB->index(), vB->procIndex())
@ -2180,7 +2180,7 @@ void Foam::conformalVoronoiMesh::createFacesOwnerNeighbourAndPatches
{ {
sortingIndex.append sortingIndex.append
( (
Pair<labelPair> labelPairPair
( (
labelPair(vB->index(), vB->procIndex()), labelPair(vB->index(), vB->procIndex()),
labelPair(vA->index(), vA->procIndex()) labelPair(vA->index(), vA->procIndex())
@ -2463,7 +2463,7 @@ void Foam::conformalVoronoiMesh::sortProcPatches
faceList& faces = patchFaces[patchi]; faceList& faces = patchFaces[patchi];
labelList& owner = patchOwners[patchi]; labelList& owner = patchOwners[patchi];
DynamicList<label>& slaves = patchPointPairSlaves[patchi]; DynamicList<label>& slaves = patchPointPairSlaves[patchi];
DynamicList<Pair<labelPair>>& sortingIndices DynamicList<labelPairPair>& sortingIndices
= patchSortingIndices[patchi]; = patchSortingIndices[patchi];
if (!sortingIndices.empty()) if (!sortingIndices.empty())

View File

@ -293,9 +293,9 @@ inline Foam::point Foam::conformalVoronoiMesh::perturbPoint
scalar pert = 1e-12*defaultCellSize(); scalar pert = 1e-12*defaultCellSize();
perturbedPt.x() += pert*(rndGen_.scalar01() - 0.5); perturbedPt.x() += pert*(rndGen_.sample01<scalar>() - 0.5);
perturbedPt.y() += pert*(rndGen_.scalar01() - 0.5); perturbedPt.y() += pert*(rndGen_.sample01<scalar>() - 0.5);
perturbedPt.z() += pert*(rndGen_.scalar01() - 0.5); perturbedPt.z() += pert*(rndGen_.sample01<scalar>() - 0.5);
return perturbedPt; return perturbedPt;
} }

View File

@ -199,7 +199,7 @@ void Foam::conformalVoronoiMesh::writeMesh(const fileName& instance)
Info<< nl << "Writing " << "tetDualMesh" << endl; Info<< nl << "Writing " << "tetDualMesh" << endl;
DistributedDelaunayMesh<Delaunay>::labelTolabelPairHashTable vertexMap; labelPairLookup vertexMap;
labelList cellMap; labelList cellMap;
autoPtr<polyMesh> tetMesh = autoPtr<polyMesh> tetMesh =
createMesh("tetDualMesh", vertexMap, cellMap); createMesh("tetDualMesh", vertexMap, cellMap);

View File

@ -553,11 +553,11 @@ bool Foam::autoDensity::fillBox
+ vector + vector
( (
delta.x() delta.x()
*(i + 0.5 + 0.1*(rndGen().scalar01() - 0.5)), *(i + 0.5 + 0.1*(rndGen().sample01<scalar>() - 0.5)),
delta.y() delta.y()
*(j + 0.5 + 0.1*(rndGen().scalar01() - 0.5)), *(j + 0.5 + 0.1*(rndGen().sample01<scalar>() - 0.5)),
delta.z() delta.z()
*(k + 0.5 + 0.1*(rndGen().scalar01() - 0.5)) *(k + 0.5 + 0.1*(rndGen().sample01<scalar>() - 0.5))
); );
} }
} }
@ -662,7 +662,7 @@ bool Foam::autoDensity::fillBox
// TODO - is there a lot of cost in the 1/density calc? Could // TODO - is there a lot of cost in the 1/density calc? Could
// assess on // assess on
// (1/maxDensity)/(1/localDensity) = minVolume/localVolume // (1/maxDensity)/(1/localDensity) = minVolume/localVolume
if (localDensity/maxDensity > rndGen().scalar01()) if (localDensity/maxDensity > rndGen().sample01<scalar>())
{ {
scalar localVolume = 1/localDensity; scalar localVolume = 1/localDensity;
@ -675,7 +675,7 @@ bool Foam::autoDensity::fillBox
scalar addProbability = scalar addProbability =
(totalVolume - volumeAdded)/localVolume; (totalVolume - volumeAdded)/localVolume;
scalar r = rndGen().scalar01(); scalar r = rndGen().sample01<scalar>();
if (debug) if (debug)
{ {
@ -729,7 +729,7 @@ bool Foam::autoDensity::fillBox
{ {
trialPoints++; trialPoints++;
point p = min + cmptMultiply(span, rndGen().vector01()); point p = min + cmptMultiply(span, rndGen().sample01<vector>());
scalar localSize = cellShapeControls().cellSize(p); scalar localSize = cellShapeControls().cellSize(p);
@ -785,7 +785,7 @@ bool Foam::autoDensity::fillBox
// Accept possible placements proportional to the relative local // Accept possible placements proportional to the relative local
// density // density
if (localDensity/maxDensity > rndGen().scalar01()) if (localDensity/maxDensity > rndGen().sample01<scalar>())
{ {
scalar localVolume = 1/localDensity; scalar localVolume = 1/localDensity;
@ -798,7 +798,7 @@ bool Foam::autoDensity::fillBox
scalar addProbability = scalar addProbability =
(totalVolume - volumeAdded)/localVolume; (totalVolume - volumeAdded)/localVolume;
scalar r = rndGen().scalar01(); scalar r = rndGen().sample01<scalar>();
if (debug) if (debug)
{ {

View File

@ -129,9 +129,9 @@ List<Vb::Point> bodyCentredCubic::initialPoints() const
if (randomiseInitialGrid_) if (randomiseInitialGrid_)
{ {
pA.x() += pert*(rndGen().scalar01() - 0.5); pA.x() += pert*(rndGen().sample01<scalar>() - 0.5);
pA.y() += pert*(rndGen().scalar01() - 0.5); pA.y() += pert*(rndGen().sample01<scalar>() - 0.5);
pA.z() += pert*(rndGen().scalar01() - 0.5); pA.z() += pert*(rndGen().sample01<scalar>() - 0.5);
} }
if (Pstream::parRun()) if (Pstream::parRun())
@ -150,9 +150,9 @@ List<Vb::Point> bodyCentredCubic::initialPoints() const
if (randomiseInitialGrid_) if (randomiseInitialGrid_)
{ {
pB.x() += pert*(rndGen().scalar01() - 0.5); pB.x() += pert*(rndGen().sample01<scalar>() - 0.5);
pB.y() += pert*(rndGen().scalar01() - 0.5); pB.y() += pert*(rndGen().sample01<scalar>() - 0.5);
pB.z() += pert*(rndGen().scalar01() - 0.5); pB.z() += pert*(rndGen().sample01<scalar>() - 0.5);
} }
if (Pstream::parRun()) if (Pstream::parRun())

View File

@ -127,9 +127,9 @@ List<Vb::Point> faceCentredCubic::initialPoints() const
if (randomiseInitialGrid_) if (randomiseInitialGrid_)
{ {
p.x() += pert*(rndGen().scalar01() - 0.5); p.x() += pert*(rndGen().sample01<scalar>() - 0.5);
p.y() += pert*(rndGen().scalar01() - 0.5); p.y() += pert*(rndGen().sample01<scalar>() - 0.5);
p.z() += pert*(rndGen().scalar01() - 0.5); p.z() += pert*(rndGen().sample01<scalar>() - 0.5);
} }
if (Pstream::parRun()) if (Pstream::parRun())
@ -155,9 +155,9 @@ List<Vb::Point> faceCentredCubic::initialPoints() const
if (randomiseInitialGrid_) if (randomiseInitialGrid_)
{ {
p.x() += pert*(rndGen().scalar01() - 0.5); p.x() += pert*(rndGen().sample01<scalar>() - 0.5);
p.y() += pert*(rndGen().scalar01() - 0.5); p.y() += pert*(rndGen().sample01<scalar>() - 0.5);
p.z() += pert*(rndGen().scalar01() - 0.5); p.z() += pert*(rndGen().sample01<scalar>() - 0.5);
} }
if (Pstream::parRun()) if (Pstream::parRun())
@ -183,9 +183,9 @@ List<Vb::Point> faceCentredCubic::initialPoints() const
if (randomiseInitialGrid_) if (randomiseInitialGrid_)
{ {
p.x() += pert*(rndGen().scalar01() - 0.5); p.x() += pert*(rndGen().sample01<scalar>() - 0.5);
p.y() += pert*(rndGen().scalar01() - 0.5); p.y() += pert*(rndGen().sample01<scalar>() - 0.5);
p.z() += pert*(rndGen().scalar01() - 0.5); p.z() += pert*(rndGen().sample01<scalar>() - 0.5);
} }
if (Pstream::parRun()) if (Pstream::parRun())
@ -211,9 +211,9 @@ List<Vb::Point> faceCentredCubic::initialPoints() const
if (randomiseInitialGrid_) if (randomiseInitialGrid_)
{ {
p.x() += pert*(rndGen().scalar01() - 0.5); p.x() += pert*(rndGen().sample01<scalar>() - 0.5);
p.y() += pert*(rndGen().scalar01() - 0.5); p.y() += pert*(rndGen().sample01<scalar>() - 0.5);
p.z() += pert*(rndGen().scalar01() - 0.5); p.z() += pert*(rndGen().sample01<scalar>() - 0.5);
} }
if (Pstream::parRun()) if (Pstream::parRun())

View File

@ -198,9 +198,15 @@ List<Vb::Point> pointFile::initialPoints() const
if (randomiseInitialGrid_) if (randomiseInitialGrid_)
{ {
p.x() += randomPerturbationCoeff_*(rndGen().scalar01() - 0.5); p.x() +=
p.y() += randomPerturbationCoeff_*(rndGen().scalar01() - 0.5); randomPerturbationCoeff_
p.z() += randomPerturbationCoeff_*(rndGen().scalar01() - 0.5); *(rndGen().sample01<scalar>() - 0.5);
p.y() +=
randomPerturbationCoeff_
*(rndGen().sample01<scalar>() - 0.5);
p.z() +=
randomPerturbationCoeff_
*(rndGen().sample01<scalar>() - 0.5);
} }
initialPoints.append(Vb::Point(p.x(), p.y(), p.z())); initialPoints.append(Vb::Point(p.x(), p.y(), p.z()));

View File

@ -86,9 +86,9 @@ void rayShooting::splitLine
{ {
Foam::point newPt Foam::point newPt
( (
midPoint.x() + pert*(rndGen().scalar01() - 0.5), midPoint.x() + pert*(rndGen().sample01<scalar>() - 0.5),
midPoint.y() + pert*(rndGen().scalar01() - 0.5), midPoint.y() + pert*(rndGen().sample01<scalar>() - 0.5),
midPoint.z() + pert*(rndGen().scalar01() - 0.5) midPoint.z() + pert*(rndGen().sample01<scalar>() - 0.5)
); );
if if

View File

@ -128,9 +128,9 @@ List<Vb::Point> uniformGrid::initialPoints() const
if (randomiseInitialGrid_) if (randomiseInitialGrid_)
{ {
p.x() += pert*(rndGen().scalar01() - 0.5); p.x() += pert*(rndGen().sample01<scalar>() - 0.5);
p.y() += pert*(rndGen().scalar01() - 0.5); p.y() += pert*(rndGen().sample01<scalar>() - 0.5);
p.z() += pert*(rndGen().scalar01() - 0.5); p.z() += pert*(rndGen().sample01<scalar>() - 0.5);
} }
if if

View File

@ -28,7 +28,7 @@ License
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
template<class Triangulation> template<class Triangulation>
inline Foam::Pair<Foam::labelPair> inline Foam::labelPairPair
Foam::pointPairs<Triangulation>::orderPointPair Foam::pointPairs<Triangulation>::orderPointPair
( (
const labelPair& vA, const labelPair& vA,
@ -38,8 +38,8 @@ Foam::pointPairs<Triangulation>::orderPointPair
return return
( (
(vA < vB) (vA < vB)
? Pair<labelPair>(vA, vB) ? labelPairPair(vA, vB)
: Pair<labelPair>(vB, vA) : labelPairPair(vB, vA)
); );
} }
@ -85,7 +85,7 @@ inline bool Foam::pointPairs<Triangulation>::insertPointPair
template<class Triangulation> template<class Triangulation>
Foam::pointPairs<Triangulation>::pointPairs(const Triangulation& triangulation) Foam::pointPairs<Triangulation>::pointPairs(const Triangulation& triangulation)
: :
ptPairTable(), StorageContainer(),
triangulation_(triangulation) triangulation_(triangulation)
{} {}
@ -181,7 +181,7 @@ void Foam::pointPairs<Triangulation>::reIndex(const Map<label>& oldToNewIndices)
forAllConstIter(pointPairs, *this, iter) forAllConstIter(pointPairs, *this, iter)
{ {
Pair<labelPair> e = iter.key(); labelPairPair e = iter.key();
labelPair& start = e.first(); labelPair& start = e.first();
labelPair& end = e.second(); labelPair& end = e.second();

View File

@ -39,20 +39,13 @@ Description
#ifndef pointPairs_H #ifndef pointPairs_H
#define pointPairs_H #define pointPairs_H
#include "labelPair.H" #include "labelPairHashes.H"
#include "HashSet.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam namespace Foam
{ {
typedef HashSet
<
Pair<labelPair>,
FixedList<labelPair, 2>::Hash<>
> ptPairTable;
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class pointPairs Declaration Class pointPairs Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -60,10 +53,11 @@ typedef HashSet
template<class Triangulation> template<class Triangulation>
class pointPairs class pointPairs
: :
public ptPairTable public HashSet<labelPairPair, labelPairPair::Hash<>>
{ {
// Private typedefs // Private typedefs
typedef HashSet<labelPairPair, labelPairPair::Hash<>> StorageContainer;
typedef typename Triangulation::Vertex_handle Vertex_handle; typedef typename Triangulation::Vertex_handle Vertex_handle;
@ -74,7 +68,7 @@ class pointPairs
// Private Member Functions // Private Member Functions
inline Pair<labelPair> orderPointPair inline labelPairPair orderPointPair
( (
const labelPair& vA, const labelPair& vA,
const labelPair& vB const labelPair& vB

View File

@ -264,8 +264,8 @@ void Foam::CV2D::insertGrid()
if (meshControls().randomiseInitialGrid()) if (meshControls().randomiseInitialGrid())
{ {
p.x() += pert*(rndGen.scalar01() - 0.5); p.x() += pert*(rndGen.sample01<scalar>() - 0.5);
p.y() += pert*(rndGen.scalar01() - 0.5); p.y() += pert*(rndGen.sample01<scalar>() - 0.5);
} }
if (qSurf_.wellInside(p, 0.5*meshControls().minCellSize2())) if (qSurf_.wellInside(p, 0.5*meshControls().minCellSize2()))

View File

@ -8,7 +8,7 @@ EXE_INC = \
${EXE_NDEBUG} \ ${EXE_NDEBUG} \
${CGAL_INC} \ ${CGAL_INC} \
${c++LESSWARN} \ ${c++LESSWARN} \
-I$(FOAM_APP)/utilities/mesh/generation/extrude2DMesh/extrude2DMesh/lnInclude \ -I$(FOAM_UTILITIES)/mesh/generation/extrude2DMesh/extrude2DMesh/lnInclude \
-I../conformalVoronoi2DMesh/lnInclude \ -I../conformalVoronoi2DMesh/lnInclude \
-I../conformalVoronoiMesh/lnInclude \ -I../conformalVoronoiMesh/lnInclude \
-I$(LIB_SRC)/parallel/decompose/decompositionMethods/lnInclude \ -I$(LIB_SRC)/parallel/decompose/decompositionMethods/lnInclude \

View File

@ -2,8 +2,8 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2015-2017 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -660,7 +660,7 @@ void writeMesh
Info<< "Writing mesh to time " << meshRefiner.timeName() << endl; Info<< "Writing mesh to time " << meshRefiner.timeName() << endl;
processorMeshes::removeFiles(mesh); processorMeshes::removeFiles(mesh);
if (!debugLevel) if (!debugLevel && !(writeLevel&meshRefinement::WRITELAYERSETS))
{ {
topoSet::removeFiles(mesh); topoSet::removeFiles(mesh);
} }

View File

@ -1,3 +1,4 @@
writeFields.C
checkTools.C checkTools.C
checkTopology.C checkTopology.C
checkGeometry.C checkGeometry.C

View File

@ -3,7 +3,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) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2015-2017 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -57,12 +57,18 @@ Usage
Reconstruct all cellSets and faceSets geometry and write to postProcessing/ Reconstruct all cellSets and faceSets geometry and write to postProcessing/
directory according to surfaceFormat (e.g. vtk or ensight) directory according to surfaceFormat (e.g. vtk or ensight)
\param -writeAllFields \n
Writes all mesh quality measures as fields.
\param -writeFields '(\<fieldName\>)' \n
Writes selected mesh quality measures as fields.
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "argList.H" #include "argList.H"
#include "timeSelector.H" #include "timeSelector.H"
#include "Time.H" #include "Time.H"
#include "polyMesh.H" #include "fvMesh.H"
#include "globalMeshData.H" #include "globalMeshData.H"
#include "surfaceWriter.H" #include "surfaceWriter.H"
#include "vtkSetWriter.H" #include "vtkSetWriter.H"
@ -71,6 +77,7 @@ Usage
#include "checkTopology.H" #include "checkTopology.H"
#include "checkGeometry.H" #include "checkGeometry.H"
#include "checkMeshQuality.H" #include "checkMeshQuality.H"
#include "writeFields.H"
using namespace Foam; using namespace Foam;
@ -96,6 +103,17 @@ int main(int argc, char *argv[])
"include extra topology checks" "include extra topology checks"
); );
argList::addBoolOption argList::addBoolOption
(
"writeAllFields",
"write volFields with mesh quality parameters"
);
argList::addOption
(
"writeFields",
"wordList",
"write volFields with selected mesh quality parameters"
);
argList::addBoolOption
( (
"meshQuality", "meshQuality",
"read user-defined mesh quality criterions from system/meshQualityDict" "read user-defined mesh quality criterions from system/meshQualityDict"
@ -110,7 +128,7 @@ int main(int argc, char *argv[])
#include "setRootCase.H" #include "setRootCase.H"
#include "createTime.H" #include "createTime.H"
instantList timeDirs = timeSelector::select0(runTime, args); instantList timeDirs = timeSelector::select0(runTime, args);
#include "createNamedPolyMesh.H" #include "createNamedMesh.H"
const bool noTopology = args.optionFound("noTopology"); const bool noTopology = args.optionFound("noTopology");
const bool allGeometry = args.optionFound("allGeometry"); const bool allGeometry = args.optionFound("allGeometry");
@ -119,6 +137,24 @@ int main(int argc, char *argv[])
word surfaceFormat; word surfaceFormat;
const bool writeSets = args.optionReadIfPresent("writeSets", surfaceFormat); const bool writeSets = args.optionReadIfPresent("writeSets", surfaceFormat);
HashSet<word> selectedFields;
bool writeFields = args.optionReadIfPresent
(
"writeFields",
selectedFields
);
if (!writeFields && args.optionFound("writeAllFields"))
{
selectedFields.insert("nonOrthoAngle");
selectedFields.insert("faceWeight");
selectedFields.insert("skewness");
selectedFields.insert("cellDeterminant");
selectedFields.insert("aspectRatio");
selectedFields.insert("cellShapes");
selectedFields.insert("cellVolume");
selectedFields.insert("cellVolumeRatio");
}
if (noTopology) if (noTopology)
{ {
@ -143,6 +179,11 @@ int main(int argc, char *argv[])
<< " representation" << " representation"
<< " of all faceSets and cellSets." << nl << endl; << " of all faceSets and cellSets." << nl << endl;
} }
if (selectedFields.size())
{
Info<< "Writing mesh quality as fields " << selectedFields << nl
<< endl;
}
autoPtr<IOdictionary> qualDict; autoPtr<IOdictionary> qualDict;
@ -234,6 +275,10 @@ int main(int argc, char *argv[])
Info<< "\nFailed " << nFailedChecks << " mesh checks.\n" Info<< "\nFailed " << nFailedChecks << " mesh checks.\n"
<< endl; << endl;
} }
// Write selected fields
Foam::writeFields(mesh, selectedFields);
} }
else if (state == polyMesh::POINTS_MOVED) else if (state == polyMesh::POINTS_MOVED)
{ {
@ -262,6 +307,10 @@ int main(int argc, char *argv[])
{ {
Info<< "\nMesh OK.\n" << endl; Info<< "\nMesh OK.\n" << endl;
} }
// Write selected fields
Foam::writeFields(mesh, selectedFields);
} }
} }

View File

@ -0,0 +1,360 @@
#include "writeFields.H"
#include "volFields.H"
#include "polyMeshTools.H"
#include "zeroGradientFvPatchFields.H"
#include "syncTools.H"
using namespace Foam;
void maxFaceToCell
(
const scalarField& faceData,
volScalarField& cellData
)
{
const cellList& cells = cellData.mesh().cells();
scalarField& cellFld = cellData.ref();
cellFld = -GREAT;
forAll(cells, cellI)
{
const cell& cFaces = cells[cellI];
forAll(cFaces, i)
{
cellFld[cellI] = max(cellFld[cellI], faceData[cFaces[i]]);
}
}
forAll(cellData.boundaryField(), patchI)
{
fvPatchScalarField& fvp = cellData.boundaryFieldRef()[patchI];
fvp = fvp.patch().patchSlice(faceData);
}
cellData.correctBoundaryConditions();
}
void minFaceToCell
(
const scalarField& faceData,
volScalarField& cellData
)
{
const cellList& cells = cellData.mesh().cells();
scalarField& cellFld = cellData.ref();
cellFld = GREAT;
forAll(cells, cellI)
{
const cell& cFaces = cells[cellI];
forAll(cFaces, i)
{
cellFld[cellI] = min(cellFld[cellI], faceData[cFaces[i]]);
}
}
forAll(cellData.boundaryField(), patchI)
{
fvPatchScalarField& fvp = cellData.boundaryFieldRef()[patchI];
fvp = fvp.patch().patchSlice(faceData);
}
cellData.correctBoundaryConditions();
}
void Foam::writeFields
(
const fvMesh& mesh,
const HashSet<word>& selectedFields
)
{
if (selectedFields.empty())
{
return;
}
Info<< "Writing fields with mesh quality parameters" << endl;
if (selectedFields.found("nonOrthoAngle"))
{
//- Face based orthogonality
const scalarField faceOrthogonality
(
polyMeshTools::faceOrthogonality
(
mesh,
mesh.faceAreas(),
mesh.cellCentres()
)
);
//- Face based angle
const scalarField nonOrthoAngle
(
radToDeg
(
Foam::acos(min(1.0, faceOrthogonality))
)
);
//- Cell field - max of either face
volScalarField cellNonOrthoAngle
(
IOobject
(
"nonOrthoAngle",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
mesh,
dimensionedScalar("angle", dimless, 0),
calculatedFvPatchScalarField::typeName
);
//- Take max
maxFaceToCell(nonOrthoAngle, cellNonOrthoAngle);
Info<< " Writing non-orthogonality (angle) to "
<< cellNonOrthoAngle.name() << endl;
cellNonOrthoAngle.write();
}
if (selectedFields.found("faceWeight"))
{
const scalarField faceWeights
(
polyMeshTools::faceWeights
(
mesh,
mesh.faceCentres(),
mesh.faceAreas(),
mesh.cellCentres()
)
);
volScalarField cellWeights
(
IOobject
(
"faceWeight",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
mesh,
dimensionedScalar("weight", dimless, 0),
calculatedFvPatchScalarField::typeName
);
//- Take min
minFaceToCell(faceWeights, cellWeights);
Info<< " Writing face interpolation weights (0..0.5) to "
<< cellWeights.name() << endl;
cellWeights.write();
}
// Skewness
// ~~~~~~~~
if (selectedFields.found("skewness"))
{
//- Face based skewness
const scalarField faceSkewness
(
polyMeshTools::faceSkewness
(
mesh,
mesh.points(),
mesh.faceCentres(),
mesh.faceAreas(),
mesh.cellCentres()
)
);
//- Cell field - max of either face
volScalarField cellSkewness
(
IOobject
(
"skewness",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
mesh,
dimensionedScalar("skewness", dimless, 0),
calculatedFvPatchScalarField::typeName
);
//- Take max
maxFaceToCell(faceSkewness, cellSkewness);
Info<< " Writing face skewness to " << cellSkewness.name() << endl;
cellSkewness.write();
}
// cellDeterminant
// ~~~~~~~~~~~~~~~
if (selectedFields.found("cellDeterminant"))
{
volScalarField cellDeterminant
(
IOobject
(
"cellDeterminant",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE,
false
),
mesh,
dimensionedScalar("cellDeterminant", dimless, 0),
zeroGradientFvPatchScalarField::typeName
);
cellDeterminant.primitiveFieldRef() =
primitiveMeshTools::cellDeterminant
(
mesh,
mesh.geometricD(),
mesh.faceAreas(),
syncTools::getInternalOrCoupledFaces(mesh)
);
cellDeterminant.correctBoundaryConditions();
Info<< " Writing cell determinant to "
<< cellDeterminant.name() << endl;
cellDeterminant.write();
}
// Aspect ratio
// ~~~~~~~~~~~~
if (selectedFields.found("aspectRatio"))
{
volScalarField aspectRatio
(
IOobject
(
"aspectRatio",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE,
false
),
mesh,
dimensionedScalar("aspectRatio", dimless, 0),
zeroGradientFvPatchScalarField::typeName
);
scalarField cellOpenness;
polyMeshTools::cellClosedness
(
mesh,
mesh.geometricD(),
mesh.faceAreas(),
mesh.cellVolumes(),
cellOpenness,
aspectRatio.ref()
);
aspectRatio.correctBoundaryConditions();
Info<< " Writing aspect ratio to " << aspectRatio.name() << endl;
aspectRatio.write();
}
// cell type
// ~~~~~~~~~
if (selectedFields.found("cellShapes"))
{
volScalarField shape
(
IOobject
(
"cellShapes",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE,
false
),
mesh,
dimensionedScalar("cellShapes", dimless, 0),
zeroGradientFvPatchScalarField::typeName
);
const cellShapeList& cellShapes = mesh.cellShapes();
forAll(cellShapes, cellI)
{
const cellModel& model = cellShapes[cellI].model();
shape[cellI] = model.index();
}
shape.correctBoundaryConditions();
Info<< " Writing cell shape (hex, tet etc.) to " << shape.name()
<< endl;
shape.write();
}
if (selectedFields.found("cellVolume"))
{
volScalarField V
(
IOobject
(
"cellVolume",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE,
false
),
mesh,
dimensionedScalar("cellVolume", dimVolume, 0),
calculatedFvPatchScalarField::typeName
);
V.ref() = mesh.V();
Info<< " Writing cell volume to " << V.name() << endl;
V.write();
}
if (selectedFields.found("cellVolumeRatio"))
{
const scalarField faceVolumeRatio
(
polyMeshTools::volRatio
(
mesh,
mesh.V()
)
);
volScalarField cellVolumeRatio
(
IOobject
(
"cellVolumeRatio",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
mesh,
dimensionedScalar("cellVolumeRatio", dimless, 0),
calculatedFvPatchScalarField::typeName
);
//- Take min
minFaceToCell(faceVolumeRatio, cellVolumeRatio);
Info<< " Writing cell volume ratio to "
<< cellVolumeRatio.name() << endl;
cellVolumeRatio.write();
}
Info<< endl;
}

View File

@ -0,0 +1,10 @@
#include "fvMesh.H"
namespace Foam
{
void writeFields
(
const fvMesh&,
const HashSet<word>& selectedFields
);
}

View File

@ -12,11 +12,27 @@ then
export LINK_FLAGS="${LINK_FLAGS} -lSloanRenumber" export LINK_FLAGS="${LINK_FLAGS} -lSloanRenumber"
fi fi
if [ -f "${ZOLTAN_ARCH_PATH}/lib/libzoltan.a" -a -f "${FOAM_LIBBIN}/libzoltanRenumber.so" ] if [ -f "${FOAM_LIBBIN}/libzoltanRenumber.so" ]
then then
echo " found libzoltanRenumber -- enabling sloan renumbering support." if [ -z "$ZOLTAN_ARCH_PATH" ]
then
# Optional: get ZOLTAN_ARCH_PATH
if settings=$($WM_PROJECT_DIR/bin/foamEtcFile config.sh/zoltan)
then
. $settings
fi
fi
for libdir in lib "lib${WM_COMPILER_LIB_ARCH}"
do
if [ -f "$ZOLTAN_ARCH_PATH/$libdir/libzoltan.a" ]
then
echo " found libzoltanRenumber -- enabling zoltan renumbering support."
export COMP_FLAGS="-DFOAM_USE_ZOLTAN" export COMP_FLAGS="-DFOAM_USE_ZOLTAN"
export LINK_FLAGS="${LINK_FLAGS} -lzoltanRenumber -L${ZOLTAN_ARCH_PATH}/lib -lzoltan" export LINK_FLAGS="${LINK_FLAGS} -lzoltanRenumber -L$ZOLTAN_ARCH_PATH/$libdir -lzoltan"
break
fi
done
fi fi
wmake $targetType wmake $targetType

View File

@ -15,7 +15,7 @@ FoamFile
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// For complete details on what this dictionary file should provide, see // For complete details on what this dictionary file should provide, see
// $FOAM_SRC/src/dynamicMesh/slidingInterface/slidingInterface.C // src/dynamicMesh/slidingInterface/slidingInterface.C
// method: Foam::slidingInterface::setTolerances // method: Foam::slidingInterface::setTolerances
//- Point merge tolerance //- Point merge tolerance

View File

@ -53,9 +53,9 @@ Usage
it will also read & transform vector & tensor fields. it will also read & transform vector & tensor fields.
Note: Note:
yaw (rotation about z)
pitch (rotation about y)
roll (rotation about x) roll (rotation about x)
pitch (rotation about y)
yaw (rotation about z)
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -143,6 +143,12 @@ void rotateFields(const argList& args, const Time& runTime, const tensor& T)
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
argList::addNote
(
"Transform (translate/rotate/scale) mesh points.\n"
"Note: roll=rotation about x, pitch=rotation about y, "
"yaw=rotation about z"
);
argList::addOption argList::addOption
( (
"translate", "translate",
@ -160,13 +166,13 @@ int main(int argc, char *argv[])
( (
"rollPitchYaw", "rollPitchYaw",
"vector", "vector",
"transform in terms of '(roll pitch yaw)' in degrees" "rotate by '(roll pitch yaw)' in degrees"
); );
argList::addOption argList::addOption
( (
"yawPitchRoll", "yawPitchRoll",
"vector", "vector",
"transform in terms of '(yaw pitch roll)' in degrees" "rotate by '(yaw pitch roll)' in degrees"
); );
argList::addBoolOption argList::addBoolOption
( (

View File

@ -112,6 +112,7 @@ Usage
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "argList.H" #include "argList.H"
#include "profiling.H"
#include "Time.H" #include "Time.H"
#include "IFstream.H" #include "IFstream.H"
#include "OFstream.H" #include "OFstream.H"
@ -241,6 +242,7 @@ int main(int argc, char *argv[])
argList::addNote("manipulates dictionaries"); argList::addNote("manipulates dictionaries");
argList::noBanner(); argList::noBanner();
argList::noJobInfo();
argList::validArgs.append("dictionary"); argList::validArgs.append("dictionary");
argList::addBoolOption("keywords", "list keywords"); argList::addBoolOption("keywords", "list keywords");
argList::addOption("entry", "name", "report/select the named entry"); argList::addOption("entry", "name", "report/select the named entry");
@ -288,6 +290,7 @@ int main(int argc, char *argv[])
"disableFunctionEntries", "disableFunctionEntries",
"Disable expansion of dictionary directives - #include, #codeStream etc" "Disable expansion of dictionary directives - #include, #codeStream etc"
); );
profiling::disable(); // Disable profiling (and its output)
argList args(argc, argv); argList args(argc, argv);

View File

@ -45,6 +45,7 @@ Usage
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "argList.H" #include "argList.H"
#include "profiling.H"
#include "timeSelector.H" #include "timeSelector.H"
#include "Time.H" #include "Time.H"
@ -59,6 +60,7 @@ int main(int argc, char *argv[])
timeSelector::addOptions(true, true); timeSelector::addOptions(true, true);
argList::noBanner(); argList::noBanner();
argList::noParallel(); argList::noParallel();
argList::noJobInfo();
argList::addBoolOption argList::addBoolOption
( (
"processor", "processor",
@ -69,6 +71,8 @@ int main(int argc, char *argv[])
"rm", "rm",
"remove selected time directories" "remove selected time directories"
); );
profiling::disable(); // Disable profiling (and its output)
#include "setRootCase.H" #include "setRootCase.H"
label nProcs = 0; label nProcs = 0;

View File

@ -7,7 +7,6 @@ include(${PARAVIEW_USE_FILE})
link_directories( link_directories(
$ENV{FOAM_LIBBIN} $ENV{FOAM_LIBBIN}
$ENV{FOAM_EXT_LIBBIN}
) )
include_directories( include_directories(

View File

@ -288,6 +288,9 @@ Foam::vtkPVFoam::vtkPVFoam
fullCasePath = cwd(); fullCasePath = cwd();
} }
// The name of the executable, unless already present in the environment
setEnv("FOAM_EXECUTABLE", "paraview", false);
// Set the case as an environment variable - some BCs might use this // Set the case as an environment variable - some BCs might use this
if (fullCasePath.name().find("processor", 0) == 0) if (fullCasePath.name().find("processor", 0) == 0)
{ {

View File

@ -233,21 +233,16 @@ void Foam::vtkPVFoam::updateInfoPatches
if (meshPtr_) if (meshPtr_)
{ {
const polyBoundaryMesh& patches = meshPtr_->boundaryMesh(); const polyBoundaryMesh& patches = meshPtr_->boundaryMesh();
const HashTable<labelList, word>& groups = patches.groupPatchIDs(); const HashTable<labelList>& groups = patches.groupPatchIDs();
const wordList allPatchNames = patches.names(); const wordList allPatchNames = patches.names();
// Add patch groups // Add patch groups
// ~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~
for forAllConstIters(groups, iter)
(
HashTable<labelList, word>::const_iterator iter = groups.begin();
iter != groups.end();
++iter
)
{ {
const word& groupName = iter.key(); const word& groupName = iter.key();
const labelList& patchIDs = iter(); const labelList& patchIDs = iter.object();
label nFaces = 0; label nFaces = 0;
forAll(patchIDs, i) forAll(patchIDs, i)
@ -349,7 +344,7 @@ void Foam::vtkPVFoam::updateInfoPatches
// Add (non-zero) patch groups to the list of mesh parts // Add (non-zero) patch groups to the list of mesh parts
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HashTable<labelList, word> groups(patchEntries.size()); HashTable<labelList> groups(patchEntries.size());
forAll(patchEntries, patchi) forAll(patchEntries, patchi)
{ {
@ -360,7 +355,7 @@ void Foam::vtkPVFoam::updateInfoPatches
forAll(groupNames, groupI) forAll(groupNames, groupI)
{ {
HashTable<labelList, word>::iterator iter = groups.find HashTable<labelList>::iterator iter = groups.find
( (
groupNames[groupI] groupNames[groupI]
); );
@ -375,16 +370,10 @@ void Foam::vtkPVFoam::updateInfoPatches
} }
} }
for forAllConstIters(groups, iter)
(
HashTable<labelList, word>::const_iterator iter =
groups.begin();
iter != groups.end();
++iter
)
{ {
const word& groupName = iter.key(); const word& groupName = iter.key();
const labelList& patchIDs = iter(); const labelList& patchIDs = iter.object();
label nFaces = 0; label nFaces = 0;
forAll(patchIDs, i) forAll(patchIDs, i)

View File

@ -7,7 +7,6 @@ include(${PARAVIEW_USE_FILE})
link_directories( link_directories(
$ENV{FOAM_LIBBIN} $ENV{FOAM_LIBBIN}
$ENV{FOAM_EXT_LIBBIN}
) )
include_directories( include_directories(

View File

@ -206,6 +206,9 @@ Foam::vtkPVblockMesh::vtkPVblockMesh
fullCasePath = cwd(); fullCasePath = cwd();
} }
// The name of the executable, unless already present in the environment
setEnv("FOAM_EXECUTABLE", "paraview", false);
// Set the case as an environment variable - some BCs might use this // Set the case as an environment variable - some BCs might use this
if (fullCasePath.name().find("processor", 0) == 0) if (fullCasePath.name().find("processor", 0) == 0)
{ {

View File

@ -45,7 +45,7 @@ Description
#include "timeSelector.H" #include "timeSelector.H"
#include "OFstream.H" #include "OFstream.H"
#include "passiveParticleCloud.H" #include "passiveParticleCloud.H"
#include "labelPairHashes.H"
#include "SortableList.H" #include "SortableList.H"
#include "IOobjectList.H" #include "IOobjectList.H"
#include "PtrList.H" #include "PtrList.H"
@ -133,8 +133,6 @@ int main(int argc, char *argv[])
fileName vtkPath(runTime.path()/"VTK"); fileName vtkPath(runTime.path()/"VTK");
mkDir(vtkPath); mkDir(vtkPath);
typedef HashTable<label, labelPair, labelPair::Hash<>> trackTableType;
forAll(timeDirs, timeI) forAll(timeDirs, timeI)
{ {
runTime.setTime(timeDirs[timeI], timeI); runTime.setTime(timeDirs[timeI], timeI);
@ -168,13 +166,14 @@ int main(int argc, char *argv[])
label nTracks = 0; label nTracks = 0;
{ {
trackTableType trackTable; labelPairLookup trackTable;
forAll(particles, i) forAll(particles, i)
{ {
const label origProc = particles[i].origProc(); const label origProc = particles[i].origProc();
const label origId = particles[i].origId(); const label origId = particles[i].origId();
const trackTableType::const_iterator& iter = labelPairLookup::const_iterator iter =
trackTable.find(labelPair(origProc, origId)); trackTable.find(labelPair(origProc, origId));
if (iter == trackTable.end()) if (iter == trackTable.end())

View File

@ -20,7 +20,7 @@
const fileName pdfPath = runTime.path()/"pdf"; const fileName pdfPath = runTime.path()/"pdf";
mkDir(pdfPath); mkDir(pdfPath);
cachedRandom rndGen(label(0), -1); Random rndGen;
autoPtr<distributionModel> p autoPtr<distributionModel> p
( (

View File

@ -13,8 +13,8 @@ EXE_INC = \
${CGAL_INC} \ ${CGAL_INC} \
${c++CGALWARN} \ ${c++CGALWARN} \
-I.. \ -I.. \
-I$(FOAM_SRC)/surfMesh/lnInclude \ -I$(LIB_SRC)/surfMesh/lnInclude \
-I$(FOAM_SRC)/triSurface/lnInclude \ -I$(LIB_SRC)/triSurface/lnInclude \
-I$(LIB_SRC)/edgeMesh/lnInclude \ -I$(LIB_SRC)/edgeMesh/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \
-I/usr/include/Qt -I/usr/include/Qt

View File

@ -783,7 +783,7 @@ labelPair edgeIntersectionsAndShuffleCGAL
const edge& e = edges[edgeI]; const edge& e = edges[edgeI];
forAll(e, eI) forAll(e, eI)
{ {
vector d = rndGen.vector01()-p05; vector d = rndGen.sample01<vector>() - p05;
surf1Points[mp[e[eI]]] += surf1PointTol[e[eI]]*d; surf1Points[mp[e[eI]]] += surf1PointTol[e[eI]]*d;
} }
} }

View File

@ -1,12 +1,9 @@
Polygon Reduction Demo
Polygon Reduction Demo By Stan Melax (c) 1998
By Stan Melax (c) 1998 mailto:melax@cs.ualberta.ca
mailto:melax@cs.ualberta.ca http://www.cs.ualberta.ca/~melax
http://www.cs.ualberta.ca/~melax
The PC executable bunnylod.exe should run The PC executable bunnylod.exe should run
on a standard PC. on a standard PC.
Just run it and enjoy. Just run it and enjoy.
Mouse dragging spins the rabbit. Mouse dragging spins the rabbit.

View File

@ -87,73 +87,6 @@ scalar calcVertexNormalWeight
} }
point randomPointInPlane(const plane& p)
{
// Perturb base point
const point& refPt = p.refPoint();
// ax + by + cz + d = 0
const FixedList<scalar, 4>& planeCoeffs = p.planeCoeffs();
const scalar perturbX = refPt.x() + 1e-3;
const scalar perturbY = refPt.y() + 1e-3;
const scalar perturbZ = refPt.z() + 1e-3;
if (mag(planeCoeffs[2]) < SMALL)
{
if (mag(planeCoeffs[1]) < SMALL)
{
const scalar x =
-1.0
*(
planeCoeffs[3]
+ planeCoeffs[1]*perturbY
+ planeCoeffs[2]*perturbZ
)/planeCoeffs[0];
return point
(
x,
perturbY,
perturbZ
);
}
const scalar y =
-1.0
*(
planeCoeffs[3]
+ planeCoeffs[0]*perturbX
+ planeCoeffs[2]*perturbZ
)/planeCoeffs[1];
return point
(
perturbX,
y,
perturbZ
);
}
else
{
const scalar z =
-1.0
*(
planeCoeffs[3]
+ planeCoeffs[0]*perturbX
+ planeCoeffs[1]*perturbY
)/planeCoeffs[2];
return point
(
perturbX,
perturbY,
z
);
}
}
triadField calcVertexCoordSys triadField calcVertexCoordSys
( (
const triSurface& surf, const triSurface& surf,
@ -178,8 +111,8 @@ triadField calcVertexCoordSys
plane p(pt, normal); plane p(pt, normal);
// Pick random point in plane // Pick arbitrary point in plane
vector dir1 = pt - randomPointInPlane(p); vector dir1 = pt - p.somePointInPlane(1e-3);
dir1 /= mag(dir1); dir1 /= mag(dir1);
vector dir2 = dir1 ^ normal; vector dir2 = dir1 ^ normal;

View File

@ -125,9 +125,9 @@ int main(int argc, char *argv[])
<< "No eigenValues found, shape may have symmetry, " << "No eigenValues found, shape may have symmetry, "
<< "perturbing inertia tensor diagonal" << endl; << "perturbing inertia tensor diagonal" << endl;
J.xx() *= 1.0 + SMALL*rand.scalar01(); J.xx() *= 1.0 + SMALL*rand.sample01<scalar>();
J.yy() *= 1.0 + SMALL*rand.scalar01(); J.yy() *= 1.0 + SMALL*rand.sample01<scalar>();
J.zz() *= 1.0 + SMALL*rand.scalar01(); J.zz() *= 1.0 + SMALL*rand.sample01<scalar>();
eVal = eigenValues(J); eVal = eigenValues(J);

View File

@ -1,8 +1,7 @@
EXE_INC = \ EXE_INC = \
-I$(FOAM_SRC)/triSurface/lnInclude \ -I$(LIB_SRC)/triSurface/lnInclude \
-I$(FOAM_SRC)/surfMesh/lnInclude \ -I$(LIB_SRC)/surfMesh/lnInclude \
-I$(FOAM_SRC)/meshTools/lnInclude -I$(LIB_SRC)/meshTools/lnInclude
EXE_LIBS = \ EXE_LIBS = \
-ltriSurface \ -ltriSurface \

View File

@ -62,6 +62,7 @@ Note
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "argList.H" #include "argList.H"
#include "profiling.H"
#include "Time.H" #include "Time.H"
#include "UnsortedMeshedSurfaces.H" #include "UnsortedMeshedSurfaces.H"
@ -98,6 +99,7 @@ int main(int argc, char *argv[])
"xml", "xml",
"write output in XML format" "write output in XML format"
); );
profiling::disable(); // Disable profiling (and its output)
argList args(argc, argv); argList args(argc, argv);
Time runTime(args.rootPath(), args.caseName()); Time runTime(args.rootPath(), args.caseName());

View File

@ -51,6 +51,7 @@ Description
#include "uindirectPrimitivePatch.H" #include "uindirectPrimitivePatch.H"
#include "globalMeshData.H" #include "globalMeshData.H"
#include "globalIndex.H" #include "globalIndex.H"
#include "timeSelector.H"
using namespace Foam; using namespace Foam;
@ -63,6 +64,8 @@ int main(int argc, char *argv[])
( (
"extract surface from a polyMesh" "extract surface from a polyMesh"
); );
timeSelector::addOptions();
argList::validArgs.append("output file"); argList::validArgs.append("output file");
#include "addRegionOption.H" #include "addRegionOption.H"
argList::addBoolOption argList::addBoolOption
@ -86,7 +89,14 @@ int main(int argc, char *argv[])
#include "setRootCase.H" #include "setRootCase.H"
#include "createTime.H" #include "createTime.H"
const fileName outFileName(args[1]); const fileName userOutFileName(args[1]);
if (!userOutFileName.hasExt())
{
FatalErrorInFunction
<< "Missing extension on output name " << userOutFileName
<< exit(FatalError);
}
Info<< "Extracting surface from boundaryMesh ..." Info<< "Extracting surface from boundaryMesh ..."
<< endl << endl; << endl << endl;
@ -106,10 +116,48 @@ int main(int argc, char *argv[])
Info<< "Excluding all processor patches." << nl << endl; Info<< "Excluding all processor patches." << nl << endl;
} }
Info<< "Reading mesh from time " << runTime.value() << endl; Info<< "Reading mesh from time " << runTime.value() << endl;
#include "createNamedPolyMesh.H" #include "createNamedPolyMesh.H"
// User specified times
instantList timeDirs = timeSelector::select0(runTime, args);
forAll(timeDirs, timeIndex)
{
runTime.setTime(timeDirs[timeIndex], timeIndex);
Info<< "Time [" << timeIndex << "] = " << runTime.timeName();
fileName outFileName;
if (timeDirs.size() == 1)
{
outFileName = userOutFileName;
Info<< nl;
}
else
{
polyMesh::readUpdateState meshState = mesh.readUpdate();
if (timeIndex && meshState == polyMesh::UNCHANGED)
{
Info<<" ... no mesh change." << nl;
continue;
}
else
{
Info<< nl;
}
// The filename based on the original, but with additional
// time information. The extension was previously checked that
// it exists
std::string::size_type dot = userOutFileName.rfind('.');
outFileName =
userOutFileName.substr(0, dot) + "_"
+ Foam::name(runTime.value()) + "."
+ userOutFileName.ext();
}
// Create local surface from: // Create local surface from:
// - explicitly named patches only (-patches (at your option) // - explicitly named patches only (-patches (at your option)
@ -144,7 +192,6 @@ int main(int argc, char *argv[])
} }
const faceZoneMesh& fzm = mesh.faceZones(); const faceZoneMesh& fzm = mesh.faceZones();
labelHashSet includeFaceZones(fzm.size()); labelHashSet includeFaceZones(fzm.size());
@ -172,7 +219,11 @@ int main(int argc, char *argv[])
} }
Info<< "Additionally triangulating faceZones " Info<< "Additionally triangulating faceZones "
<< UIndirectList<word>(allZoneNames, includeFaceZones.sortedToc()) << UIndirectList<word>
(
allZoneNames,
includeFaceZones.sortedToc()
)
<< endl; << endl;
} }
@ -305,7 +356,11 @@ int main(int argc, char *argv[])
gatheredFaces[Pstream::myProcNo()] = allBoundary.localFaces(); gatheredFaces[Pstream::myProcNo()] = allBoundary.localFaces();
forAll(gatheredFaces[Pstream::myProcNo()], i) forAll(gatheredFaces[Pstream::myProcNo()], i)
{ {
inplaceRenumber(pointToGlobal, gatheredFaces[Pstream::myProcNo()][i]); inplaceRenumber
(
pointToGlobal,
gatheredFaces[Pstream::myProcNo()][i]
);
} }
Pstream::gatherList(gatheredFaces); Pstream::gatherList(gatheredFaces);
@ -344,7 +399,8 @@ int main(int argc, char *argv[])
forAllConstIter(HashTable<label>, compactZoneID, iter) forAllConstIter(HashTable<label>, compactZoneID, iter)
{ {
surfZones[iter()] = surfZoneIdentifier(iter.key(), iter()); surfZones[iter()] = surfZoneIdentifier(iter.key(), iter());
Info<< "surfZone " << iter() << " : " << surfZones[iter()].name() Info<< "surfZone " << iter()
<< " : " << surfZones[iter()].name()
<< endl; << endl;
} }
@ -374,7 +430,7 @@ int main(int argc, char *argv[])
sortedFace.write(globalCasePath); sortedFace.write(globalCasePath);
} }
}
Info<< "End\n" << endl; Info<< "End\n" << endl;
return 0; return 0;

View File

@ -61,8 +61,10 @@ int main(int argc, char *argv[])
{ {
argList::addNote argList::addNote
( (
"Transform (scale/rotate) a surface. " "Transform (translate/rotate/scale) a surface. "
"Like transformPoints but for surfaces." "Like transformPoints but for surfaces.\n"
"Note: roll=rotation about x, pitch=rotation about y, "
"yaw=rotation about z"
); );
argList::noParallel(); argList::noParallel();
argList::validArgs.append("surfaceFile"); argList::validArgs.append("surfaceFile");
@ -91,13 +93,13 @@ int main(int argc, char *argv[])
( (
"rollPitchYaw", "rollPitchYaw",
"vector", "vector",
"transform in terms of '( roll pitch yaw )' in degrees" "rotate by '(roll pitch yaw)' in degrees"
); );
argList::addOption argList::addOption
( (
"yawPitchRoll", "yawPitchRoll",
"vector", "vector",
"transform in terms of '( yaw pitch roll )' in degrees" "rotate by '(yaw pitch roll)' in degrees"
); );
argList args(argc, argv); argList args(argc, argv);

View File

@ -55,7 +55,15 @@ typedef species::thermo<janafThermo<perfectGas<specie>>, absoluteEnthalpy>
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
argList::addNote
(
"Calculates the adiabatic flame temperature for a given fuel\n"
"over a range of unburnt temperatures and equivalence ratios."
);
argList::noParallel();
argList::noFunctionObjects();
argList::validArgs.append("controlFile"); argList::validArgs.append("controlFile");
argList args(argc, argv); argList args(argc, argv);
const fileName controlFileName = args[1]; const fileName controlFileName = args[1];

View File

@ -48,6 +48,13 @@ int main(int argc, char *argv[])
// Increase the precision of the output for JANAF coefficients // Increase the precision of the output for JANAF coefficients
Ostream::defaultPrecision(10); Ostream::defaultPrecision(10);
argList::addNote
(
"Converts CHEMKINIII thermodynamics and reaction data files into\n"
"OpenFOAM format."
);
argList::noParallel();
argList::noFunctionObjects();
argList::validArgs.append("CHEMKINFile"); argList::validArgs.append("CHEMKINFile");
argList::validArgs.append("CHEMKINThermodynamicsFile"); argList::validArgs.append("CHEMKINThermodynamicsFile");
argList::validArgs.append("CHEMKINTransport"); argList::validArgs.append("CHEMKINTransport");
@ -62,7 +69,7 @@ int main(int argc, char *argv[])
argList args(argc, argv); argList args(argc, argv);
bool newFormat = args.optionFound("newFormat"); const bool newFormat = args.optionFound("newFormat");
speciesTable species; speciesTable species;

View File

@ -56,6 +56,13 @@ typedef species::thermo<janafThermo<perfectGas<specie>>, absoluteEnthalpy>
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
argList::addNote
(
"Calculates the equilibrium level of carbon monoxide."
);
argList::noParallel();
argList::noFunctionObjects();
#include "setRootCase.H" #include "setRootCase.H"
#include "createTime.H" #include "createTime.H"

View File

@ -1,481 +0,0 @@
/*---------------------------------------------------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
Build : dev-27a117d1f441
Exec : equilibriumFlameT controlDict
Date : Jan 16 2013
Time : 15:40:39
Host : "dm"
PID : 4638
Case : /home/dm2/henry/OpenFOAM/OpenFOAM-dev/applications/utilities/thermophysical/equilibriumFlameT
nProcs : 1
sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).
SetNaN : Initialising allocated memory to NaN (FOAM_SETNAN).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster
allowSystemOperations : Allowing user-supplied system call operations
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Reading thermodynamic data dictionary
Reading thermodynamic data for relevant species
stoichiometricAirFuelMassRatio stoichiometricAirFuelMassRatio [0 0 0 0 0 0 0] 34.0741;
Equilibrium flame temperature data (1 bar)
Phi ft T0 Tad Teq Terror O2res (mole frac)
0.6 0.017304 300 1849.36 1848.92 0.441261 0.0746347
0.6 0.017304 400 1932.16 1931.28 0.879009 0.0746693
0.6 0.017304 500 2015.31 2013.66 1.6553 0.0747311
0.6 0.017304 600 2099.1 2096.14 2.96655 0.074836
0.6 0.017304 700 2183.84 2178.76 5.08632 0.0750065
0.6 0.017304 800 2269.77 2261.4 8.37223 0.0752722
0.6 0.017304 900 2356.97 2343.72 13.2521 0.0756689
0.6 0.017304 1000 2445.26 2425.09 20.1747 0.0762341
0.6 0.017304 1100 2534.41 2504.86 29.5499 0.077003
0.6 0.017304 1200 2624.41 2582.69 41.7235 0.0780054
0.6 0.017304 1300 2715.19 2658.28 56.9132 0.0792609
0.6 0.017304 1400 2806.69 2731.49 75.1966 0.0807775
0.6 0.017304 1500 2898.84 2802.32 96.5198 0.0825522
0.6 0.017304 1600 2991.6 2870.87 120.724 0.0845729
0.6 0.017304 1700 3084.9 2937.32 147.577 0.0868217
0.6 0.017304 1800 3178.71 3001.9 176.81 0.0892764
0.6 0.017304 1900 3272.98 3064.84 208.131 0.0919138
0.6 0.017304 2000 3367.66 3126.4 241.253 0.09471
0.6 0.017304 2100 3462.72 3186.82 275.903 0.0976445
0.6 0.017304 2200 3558.12 3246.2 311.925 0.100726
0.6 0.017304 2300 3653.84 3303.74 350.096 0.104207
0.6 0.017304 2400 3749.83 3350.89 398.934 0.110203
0.6 0.017304 2500 3846.07 3351.34 494.73 0.126061
0.6 0.017304 2600 3942.53 3291.95 650.58 0.151488
0.6 0.017304 2700 4039.19 3236.21 802.988 0.17406
0.6 0.017304 2800 4136.03 3245.34 890.687 0.186501
0.6 0.017304 2900 4233.03 3344.34 888.683 0.186501
0.6 0.017304 3000 4330.16 3443.39 886.77 0.186501
0.65 0.018719 300 1944.33 1943.23 1.10762 0.0647597
0.65 0.018719 400 2026.59 2024.53 2.05315 0.0648355
0.65 0.018719 500 2109.23 2105.61 3.62082 0.0649618
0.65 0.018719 600 2192.53 2186.42 6.10504 0.065163
0.65 0.018719 700 2276.78 2266.9 9.88012 0.0654705
0.65 0.018719 800 2362.23 2346.84 15.3867 0.0659212
0.65 0.018719 900 2448.96 2425.87 23.0886 0.0665545
0.65 0.018719 1000 2536.81 2503.41 33.3941 0.0674057
0.65 0.018719 1100 2625.53 2578.93 46.5953 0.0685004
0.65 0.018719 1200 2715.11 2652.24 62.8776 0.0698558
0.65 0.018719 1300 2805.51 2723.23 82.2781 0.0714767
0.65 0.018719 1400 2896.63 2791.92 104.71 0.0733571
0.65 0.018719 1500 2988.44 2858.44 129.993 0.0754833
0.65 0.018719 1600 3080.86 2922.97 157.886 0.0778362
0.65 0.018719 1700 3173.85 2985.73 188.117 0.0803935
0.65 0.018719 1800 3267.36 3046.95 220.404 0.0831323
0.65 0.018719 1900 3361.34 3106.87 254.469 0.0860297
0.65 0.018719 2000 3455.75 3165.68 290.067 0.0890703
0.65 0.018719 2100 3550.55 3223.35 327.196 0.0923026
0.65 0.018719 2200 3645.71 3278.01 367.698 0.0962479
0.65 0.018719 2300 3741.18 3314.72 426.463 0.104431
0.65 0.018719 2400 3836.94 3292.03 544.908 0.124389
0.65 0.018719 2500 3932.96 3229.29 703.673 0.149514
0.65 0.018719 2600 4029.21 3177.81 851.399 0.170937
0.65 0.018719 2700 4125.67 3175.22 950.445 0.184778
0.65 0.018719 2800 4222.31 3274.1 948.203 0.184778
0.65 0.018719 2900 4319.11 3373.04 946.07 0.184778
0.65 0.018719 3000 4416.05 3472.02 944.031 0.184778
0.7 0.0201299 300 2035.76 2033.25 2.51585 0.0551272
0.7 0.0201299 400 2117.53 2113.15 4.37823 0.0552783
0.7 0.0201299 500 2199.71 2192.43 7.27913 0.0555149
0.7 0.0201299 600 2282.56 2270.96 11.6037 0.0558696
0.7 0.0201299 700 2366.37 2348.58 17.7905 0.0563794
0.7 0.0201299 800 2451.38 2425.09 26.2928 0.0570833
0.7 0.0201299 900 2537.69 2500.17 37.5154 0.0580165
0.7 0.0201299 1000 2625.11 2573.39 51.7294 0.0592034
0.7 0.0201299 1100 2713.43 2644.39 69.0438 0.0606547
0.7 0.0201299 1200 2802.64 2713.17 89.4684 0.062373
0.7 0.0201299 1300 2892.67 2779.78 112.888 0.06435
0.7 0.0201299 1400 2983.45 2844.35 139.106 0.0665705
0.7 0.0201299 1500 3074.93 2907.05 167.878 0.0690147
0.7 0.0201299 1600 3167.04 2968.1 198.938 0.0716609
0.7 0.0201299 1700 3259.73 3027.72 232.012 0.0744866
0.7 0.0201299 1800 3352.96 3086.12 266.841 0.0774712
0.7 0.0201299 1900 3446.67 3143.43 303.236 0.0806124
0.7 0.0201299 2000 3540.82 3199.29 341.528 0.0840445
0.7 0.0201299 2100 3635.38 3249.5 385.874 0.0888593
0.7 0.0201299 2200 3730.29 3268.93 461.361 0.100608
0.7 0.0201299 2300 3825.54 3223.58 601.959 0.124079
0.7 0.0201299 2400 3921.08 3163.25 757.829 0.147885
0.7 0.0201299 2500 4016.89 3115.4 901.49 0.168314
0.7 0.0201299 2600 4112.93 3104.31 1008.62 0.183086
0.7 0.0201299 2700 4209.19 3203.06 1006.13 0.183086
0.7 0.0201299 2800 4305.63 3301.88 1003.76 0.183086
0.7 0.0201299 2900 4402.25 3400.75 1001.5 0.183086
0.7 0.0201299 3000 4499.01 3499.67 999.336 0.183086
0.75 0.0215368 300 2123.87 2118.6 5.26414 0.0457828
0.75 0.0215368 400 2205.19 2196.54 8.64652 0.0460605
0.75 0.0215368 500 2286.96 2273.35 13.6024 0.0464696
0.75 0.0215368 600 2369.39 2348.84 20.555 0.0470463
0.75 0.0215368 700 2452.79 2422.87 29.9229 0.0478271
0.75 0.0215368 800 2537.4 2495.33 42.0731 0.0488441
0.75 0.0215368 900 2623.32 2566.06 57.2623 0.0501209
0.75 0.0215368 1000 2710.36 2634.79 75.5739 0.0516661
0.75 0.0215368 1100 2798.31 2701.37 96.9358 0.0534755
0.75 0.0215368 1200 2887.16 2765.93 121.226 0.0555401
0.75 0.0215368 1300 2976.85 2828.61 148.241 0.0578437
0.75 0.0215368 1400 3067.31 2889.57 177.736 0.0603667
0.75 0.0215368 1500 3158.48 2949.02 209.456 0.063088
0.75 0.0215368 1600 3250.3 3007.15 243.145 0.0659865
0.75 0.0215368 1700 3342.71 3064.14 278.571 0.069047
0.75 0.0215368 1800 3435.67 3119.98 315.691 0.0723035
0.75 0.0215368 1900 3529.12 3173.54 355.588 0.0760823
0.75 0.0215368 2000 3623.03 3215.17 407.865 0.0827504
0.75 0.0215368 2100 3717.35 3207.15 510.202 0.0997809
0.75 0.0215368 2200 3812.04 3147 665.038 0.124757
0.75 0.0215368 2300 3907.07 3092.14 814.923 0.146832
0.75 0.0215368 2400 4002.4 3047.13 955.268 0.166424
0.75 0.0215368 2500 4098 3032.67 1065.33 0.181425
0.75 0.0215368 2600 4193.84 3131.28 1062.56 0.181425
0.75 0.0215368 2700 4289.91 3229.97 1059.94 0.181425
0.75 0.0215368 2800 4386.16 3328.72 1057.44 0.181425
0.75 0.0215368 2900 4482.59 3427.53 1055.06 0.181425
0.75 0.0215368 3000 4579.17 3526.39 1052.78 0.181425
0.8 0.0229397 300 2208.84 2198.55 10.2856 0.0368016
0.8 0.0229397 400 2289.76 2273.78 15.9817 0.0372748
0.8 0.0229397 500 2371.15 2347.32 23.8229 0.0379294
0.8 0.0229397 600 2453.21 2419.04 34.1694 0.0387973
0.8 0.0229397 700 2536.24 2488.92 47.3167 0.039905
0.8 0.0229397 800 2620.48 2557.01 63.4684 0.0412715
0.8 0.0229397 900 2706.03 2623.32 82.7038 0.0429054
0.8 0.0229397 1000 2792.71 2687.77 104.941 0.0448014
0.8 0.0229397 1100 2880.31 2750.32 129.984 0.0469441
0.8 0.0229397 1200 2968.83 2811.18 157.651 0.0493193
0.8 0.0229397 1300 3058.2 2870.49 187.709 0.0519078
0.8 0.0229397 1400 3148.36 2928.44 219.918 0.05469
0.8 0.0229397 1500 3239.24 2985.19 254.048 0.0576479
0.8 0.0229397 1600 3330.78 3040.84 289.946 0.0607847
0.8 0.0229397 1700 3422.93 3094.94 327.986 0.0642431
0.8 0.0229397 1800 3515.63 3144.62 371.018 0.0687801
0.8 0.0229397 1900 3608.84 3166.57 442.271 0.0796671
0.8 0.0229397 2000 3702.52 3123.82 578.694 0.102453
0.8 0.0229397 2100 3796.61 3062.37 734.239 0.126254
0.8 0.0229397 2200 3891.08 3012.82 878.258 0.146769
0.8 0.0229397 2300 3985.9 2969.95 1015.95 0.165648
0.8 0.0229397 2400 4081.02 2960.34 1120.68 0.179795
0.8 0.0229397 2500 4176.43 3058.81 1117.62 0.179795
0.8 0.0229397 2600 4272.08 3157.36 1114.72 0.179795
0.8 0.0229397 2700 4367.96 3255.99 1111.97 0.179795
0.8 0.0229397 2800 4464.03 3354.68 1109.35 0.179795
0.8 0.0229397 2900 4560.28 3453.43 1106.85 0.179795
0.8 0.0229397 3000 4656.69 3552.23 1104.46 0.179795
0.85 0.0243385 300 2290.86 2271.89 18.9685 0.0282998
0.85 0.0243385 400 2371.41 2343.55 27.8685 0.0290475
0.85 0.0243385 500 2452.45 2413.1 39.3563 0.0300172
0.85 0.0243385 600 2534.18 2480.55 53.6235 0.0312269
0.85 0.0243385 700 2616.86 2546.07 70.7851 0.0326882
0.85 0.0243385 800 2700.75 2609.87 90.8809 0.0344063
0.85 0.0243385 900 2785.96 2672.1 113.86 0.0363784
0.85 0.0243385 1000 2872.32 2732.77 139.549 0.0385908
0.85 0.0243385 1100 2959.59 2791.88 167.705 0.041024
0.85 0.0243385 1200 3047.8 2849.65 198.145 0.043663
0.85 0.0243385 1300 3136.87 2906.22 230.656 0.0464908
0.85 0.0243385 1400 3226.75 2961.68 265.07 0.0495028
0.85 0.0243385 1500 3317.35 3015.81 301.538 0.0527804
0.85 0.0243385 1600 3408.63 3066.84 341.787 0.0568065
0.85 0.0243385 1700 3500.53 3104.48 396.051 0.0640162
0.85 0.0243385 1800 3592.99 3084.34 508.645 0.0828878
0.85 0.0243385 1900 3685.97 3019.83 666.138 0.107717
0.85 0.0243385 2000 3779.41 2965.44 813.977 0.129098
0.85 0.0243385 2100 3873.29 2919.57 953.72 0.148417
0.85 0.0243385 2200 3967.55 2878.14 1089.41 0.166695
0.85 0.0243385 2300 4062.16 2887.39 1174.78 0.178193
0.85 0.0243385 2400 4157.09 2985.7 1171.39 0.178193
0.85 0.0243385 2500 4252.31 3084.1 1168.2 0.178193
0.85 0.0243385 2600 4347.77 3182.59 1165.18 0.178193
0.85 0.0243385 2700 4443.47 3281.16 1162.31 0.178193
0.85 0.0243385 2800 4539.37 3379.79 1159.58 0.178193
0.85 0.0243385 2900 4635.44 3478.48 1156.96 0.178193
0.85 0.0243385 3000 4731.69 3577.23 1154.46 0.178193
0.9 0.0257334 300 2370.09 2336.78 33.3173 0.0204491
0.9 0.0257334 400 2450.31 2404.16 46.1529 0.0215394
0.9 0.0257334 500 2531.04 2469.35 61.6865 0.0228649
0.9 0.0257334 600 2612.44 2532.52 79.921 0.0244277
0.9 0.0257334 700 2694.8 2593.97 100.836 0.0262275
0.9 0.0257334 800 2778.38 2653.99 124.39 0.0282621
0.9 0.0257334 900 2863.28 2712.78 150.491 0.030525
0.9 0.0257334 1000 2949.32 2770.36 178.952 0.0330009
0.9 0.0257334 1100 3036.28 2826.74 209.547 0.035672
0.9 0.0257334 1200 3124.2 2882.03 242.174 0.0385401
0.9 0.0257334 1300 3212.99 2935.98 277.011 0.0416893
0.9 0.0257334 1400 3302.6 2986.9 315.702 0.045578
0.9 0.0257334 1500 3392.94 3028.82 364.12 0.0515944
0.9 0.0257334 1600 3483.97 3019.41 464.567 0.068226
0.9 0.0257334 1700 3575.63 2951.2 624.433 0.0935821
0.9 0.0257334 1800 3667.86 2892.42 775.443 0.115391
0.9 0.0257334 1900 3760.61 2843.56 917.05 0.134916
0.9 0.0257334 2000 3853.85 2799.75 1054.09 0.153338
0.9 0.0257334 2100 3947.51 2759.06 1188.45 0.171094
0.9 0.0257334 2200 4041.57 2813.86 1227.71 0.176619
0.9 0.0257334 2300 4135.99 2912 1223.99 0.176619
0.9 0.0257334 2400 4230.73 3010.24 1220.48 0.176619
0.9 0.0257334 2500 4325.76 3108.59 1217.17 0.176619
0.9 0.0257334 2600 4421.04 3207.02 1214.03 0.176619
0.9 0.0257334 2700 4516.56 3305.52 1211.04 0.176619
0.9 0.0257334 2800 4612.29 3404.1 1208.19 0.176619
0.9 0.0257334 2900 4708.2 3502.73 1205.47 0.176619
0.9 0.0257334 3000 4804.28 3601.43 1202.85 0.176619
0.95 0.0271242 300 2446.69 2390.47 56.2165 0.0135013
0.95 0.0271242 400 2526.6 2453.56 73.0446 0.014947
0.95 0.0271242 500 2607.03 2514.76 92.2714 0.016606
0.95 0.0271242 600 2688.14 2574.31 113.833 0.0184742
0.95 0.0271242 700 2770.21 2632.51 137.7 0.0205501
0.95 0.0271242 800 2853.49 2689.64 163.85 0.0228334
0.95 0.0271242 900 2938.09 2745.85 192.246 0.0253261
0.95 0.0271242 1000 3023.84 2800.95 222.894 0.0280617
0.95 0.0271242 1100 3110.52 2854.04 256.478 0.0312581
0.95 0.0271242 1200 3198.16 2901.95 296.209 0.0357143
0.95 0.0271242 1300 3286.69 2937.18 349.506 0.0429733
0.95 0.0271242 1400 3376.04 2901.93 474.111 0.0635068
0.95 0.0271242 1500 3466.14 2818.66 647.478 0.0895965
0.95 0.0271242 1600 3556.93 2756.28 800.654 0.110895
0.95 0.0271242 1700 3648.36 2703.85 944.503 0.130251
0.95 0.0271242 1800 3740.37 2656.95 1083.42 0.148612
0.95 0.0271242 1900 3832.91 2615.22 1217.69 0.165993
0.95 0.0271242 2000 3925.93 2641.98 1283.95 0.175073
0.95 0.0271242 2100 4019.4 2739.8 1279.6 0.175073
0.95 0.0271242 2200 4113.26 2837.76 1275.51 0.175073
0.95 0.0271242 2300 4207.49 2935.83 1271.66 0.175073
0.95 0.0271242 2400 4302.04 3034.02 1268.03 0.175073
0.95 0.0271242 2500 4396.89 3132.3 1264.59 0.175073
0.95 0.0271242 2600 4492 3230.67 1261.33 0.175073
0.95 0.0271242 2700 4587.35 3329.12 1258.23 0.175073
0.95 0.0271242 2800 4682.91 3427.64 1255.27 0.175073
0.95 0.0271242 2900 4778.66 3526.22 1252.44 0.175073
0.95 0.0271242 3000 4874.58 3624.86 1249.72 0.175073
1 0.0285111 300 2520.79 2428.95 91.8415 0.00783223
1 0.0285111 400 2600.42 2489.16 111.262 0.00954474
1 0.0285111 500 2680.58 2547.46 133.116 0.0115427
1 0.0285111 600 2761.42 2603.06 158.358 0.0140645
1 0.0285111 700 2843.21 2656.82 186.389 0.0169302
1 0.0285111 800 2926.22 2705.82 220.398 0.0208555
1 0.0285111 900 3010.54 2717.47 293.073 0.031931
1 0.0285111 1000 3096.01 2308.21 787.803 0.102583
1 0.0285111 1100 3182.42 2231.26 951.156 0.118119
1 0.0285111 1200 3269.8 2192.08 1077.72 0.134773
1 0.0285111 1300 3358.08 2047.07 1311.01 0.173419
1 0.0285111 1400 3447.18 2082.4 1364.79 0.173554
1 0.0285111 1500 3537.05 2179.02 1358.03 0.173554
1 0.0285111 1600 3627.61 2275.87 1351.74 0.173554
1 0.0285111 1700 3718.82 2372.94 1345.88 0.173554
1 0.0285111 1800 3810.62 2470.21 1340.41 0.173554
1 0.0285111 1900 3902.95 2567.65 1335.3 0.173554
1 0.0285111 2000 3995.78 2665.26 1330.52 0.173554
1 0.0285111 2100 4089.05 2763.02 1326.03 0.173554
1 0.0285111 2200 4182.73 2860.91 1321.82 0.173554
1 0.0285111 2300 4276.77 2958.92 1317.85 0.173554
1 0.0285111 2400 4371.14 3057.05 1314.1 0.173554
1 0.0285111 2500 4465.82 3155.27 1310.54 0.173554
1 0.0285111 2600 4560.76 3253.59 1307.17 0.173554
1 0.0285111 2700 4655.94 3351.98 1303.96 0.173554
1 0.0285111 2800 4751.34 3450.45 1300.89 0.173554
1 0.0285111 2900 4846.93 3548.98 1297.95 0.173554
1 0.0285111 3000 4942.7 3647.57 1295.13 0.173554
1.05 0.029894 300 2492.46 2407.6 84.8585 0.00720339
1.05 0.029894 400 2572.23 2468.77 103.454 0.00882851
1.05 0.029894 500 2652.51 2528.16 124.356 0.0107005
1.05 0.029894 600 2733.46 2585.15 148.303 0.0130117
1.05 0.029894 700 2815.33 2639.93 175.395 0.0157578
1.05 0.029894 800 2898.38 2693.11 205.275 0.0188396
1.05 0.029894 900 2982.74 2723.45 259.288 0.0266549
1.05 0.029894 1000 3068.23 2622.42 445.805 0.0547019
1.05 0.029894 1100 3154.64 2157.67 996.976 0.129741
1.05 0.029894 1200 3242.02 2280.98 961.044 0.127053
1.05 0.029894 1300 3330.29 2050.85 1279.44 0.170376
1.05 0.029894 1400 3419.38 2125.13 1294.25 0.16278
1.05 0.029894 1500 3509.23 2169.74 1339.48 0.170593
1.05 0.029894 1600 3599.77 2266.59 1333.18 0.170593
1.05 0.029894 1700 3690.96 2363.65 1327.3 0.170593
1.05 0.029894 1800 3782.73 2460.91 1321.82 0.170593
1.05 0.029894 1900 3875.03 2558.35 1316.69 0.170593
1.05 0.029894 2000 3967.83 2655.94 1311.88 0.170593
1.05 0.029894 2100 4061.07 2753.69 1307.38 0.170593
1.05 0.029894 2200 4154.72 2851.57 1303.14 0.170593
1.05 0.029894 2300 4248.73 2949.58 1299.15 0.170593
1.05 0.029894 2400 4343.07 3047.69 1295.38 0.170593
1.05 0.029894 2500 4437.72 3145.91 1291.81 0.170593
1.05 0.029894 2600 4532.63 3244.21 1288.42 0.170593
1.05 0.029894 2700 4627.79 3342.6 1285.19 0.170593
1.05 0.029894 2800 4723.16 3441.06 1282.11 0.170593
1.05 0.029894 2900 4818.73 3539.58 1279.15 0.170593
1.05 0.029894 3000 4914.48 3638.16 1276.32 0.170593
1.1 0.031273 300 2464.87 2386.5 78.3786 0.00662398
1.1 0.031273 400 2544.79 2448.61 96.1825 0.00816896
1.1 0.031273 500 2625.2 2508.98 116.227 0.0099387
1.1 0.031273 600 2706.25 2567.32 138.926 0.0120454
1.1 0.031273 700 2788.2 2623.15 165.049 0.0146643
1.1 0.031273 800 2871.31 2677.34 193.962 0.017615
1.1 0.031273 900 2955.7 2719.78 235.92 0.0231087
1.1 0.031273 1000 3041.21 2693.5 347.71 0.0402781
1.1 0.031273 1100 3127.63 2167.25 960.385 0.125446
1.1 0.031273 1200 3215.01 2111.06 1103.96 0.14489
1.1 0.031273 1300 3303.28 2053.83 1249.45 0.167407
1.1 0.031273 1400 3392.36 2173.47 1218.89 0.15138
1.1 0.031273 1500 3482.19 2160.73 1321.46 0.167732
1.1 0.031273 1600 3572.72 2257.57 1315.15 0.167732
1.1 0.031273 1700 3663.88 2354.63 1309.25 0.167732
1.1 0.031273 1800 3755.63 2451.88 1303.75 0.167732
1.1 0.031273 1900 3847.91 2549.3 1298.61 0.167732
1.1 0.031273 2000 3940.68 2646.89 1293.79 0.167732
1.1 0.031273 2100 4033.89 2744.63 1289.26 0.167732
1.1 0.031273 2200 4127.51 2842.51 1285.01 0.167732
1.1 0.031273 2300 4221.5 2940.5 1281 0.167732
1.1 0.031273 2400 4315.82 3038.61 1277.21 0.167732
1.1 0.031273 2500 4410.43 3136.81 1273.62 0.167732
1.1 0.031273 2600 4505.32 3235.11 1270.21 0.167732
1.1 0.031273 2700 4600.46 3333.49 1266.97 0.167732
1.1 0.031273 2800 4695.81 3431.94 1263.87 0.167732
1.1 0.031273 2900 4791.36 3530.45 1260.9 0.167732
1.1 0.031273 3000 4887.08 3629.03 1258.05 0.167732
1.15 0.0326481 300 2438.01 2365.65 72.3675 0.00608988
1.15 0.0326481 400 2518.07 2428.67 89.4064 0.00755975
1.15 0.0326481 500 2598.61 2489.96 108.651 0.00924133
1.15 0.0326481 600 2679.76 2549.42 130.344 0.0112026
1.15 0.0326481 700 2761.79 2606.41 155.383 0.0136615
1.15 0.0326481 800 2844.96 2661.52 183.443 0.0165071
1.15 0.0326481 900 2929.39 2711.04 218.35 0.0205875
1.15 0.0326481 1000 3014.93 2720.02 294.911 0.0321946
1.15 0.0326481 1100 3101.36 2251.55 849.815 0.109583
1.15 0.0326481 1200 3188.75 2233.94 954.807 0.119285
1.15 0.0326481 1300 3277.01 2056.18 1220.83 0.164505
1.15 0.0326481 1400 3366.09 2095.8 1270.29 0.164884
1.15 0.0326481 1500 3455.91 2151.97 1303.94 0.164965
1.15 0.0326481 1600 3546.42 2248.81 1297.61 0.164965
1.15 0.0326481 1700 3637.57 2345.86 1291.71 0.164965
1.15 0.0326481 1800 3729.29 2443.1 1286.19 0.164965
1.15 0.0326481 1900 3821.55 2540.52 1281.03 0.164965
1.15 0.0326481 2000 3914.3 2638.1 1276.2 0.164965
1.15 0.0326481 2100 4007.49 2735.83 1271.66 0.164965
1.15 0.0326481 2200 4101.08 2833.69 1267.39 0.164965
1.15 0.0326481 2300 4195.04 2931.68 1263.36 0.164965
1.15 0.0326481 2400 4289.34 3029.78 1259.56 0.164965
1.15 0.0326481 2500 4383.93 3127.98 1255.95 0.164965
1.15 0.0326481 2600 4478.8 3226.27 1252.53 0.164965
1.15 0.0326481 2700 4573.91 3324.64 1249.27 0.164965
1.15 0.0326481 2800 4669.24 3423.08 1246.16 0.164965
1.15 0.0326481 2900 4764.77 3521.59 1243.18 0.164965
1.15 0.0326481 3000 4860.48 3620.16 1240.32 0.164965
1.2 0.0340193 300 2411.84 2345.05 66.7936 0.00559749
1.2 0.0340193 400 2492.05 2408.96 83.0903 0.00699607
1.2 0.0340193 500 2572.72 2471.14 101.574 0.00859836
1.2 0.0340193 600 2653.97 2531.58 122.394 0.010447
1.2 0.0340193 700 2736.08 2589.76 146.318 0.012734
1.2 0.0340193 800 2819.31 2645.91 173.4 0.0154441
1.2 0.0340193 900 2903.78 2699.56 204.22 0.0187
1.2 0.0340193 1000 2989.35 2727.81 261.538 0.0270303
1.2 0.0340193 1100 3075.8 2577.07 498.722 0.0617691
1.2 0.0340193 1200 3163.19 2290.04 873.153 0.105911
1.2 0.0340193 1300 3251.46 2053.86 1197.6 0.159385
1.2 0.0340193 1400 3340.53 2100.7 1239.83 0.162141
1.2 0.0340193 1500 3430.34 2143.45 1286.89 0.162287
1.2 0.0340193 1600 3520.84 2240.28 1280.56 0.162287
1.2 0.0340193 1700 3611.98 2337.33 1274.65 0.162287
1.2 0.0340193 1800 3703.68 2434.56 1269.12 0.162287
1.2 0.0340193 1900 3795.92 2531.98 1263.95 0.162287
1.2 0.0340193 2000 3888.65 2629.55 1259.1 0.162287
1.2 0.0340193 2100 3981.82 2727.27 1254.54 0.162287
1.2 0.0340193 2200 4075.39 2825.13 1250.26 0.162287
1.2 0.0340193 2300 4169.33 2923.11 1246.22 0.162287
1.2 0.0340193 2400 4263.6 3021.2 1242.4 0.162287
1.2 0.0340193 2500 4358.17 3119.39 1238.78 0.162287
1.2 0.0340193 2600 4453.02 3217.67 1235.34 0.162287
1.2 0.0340193 2700 4548.11 3316.04 1232.07 0.162287
1.2 0.0340193 2800 4643.42 3414.48 1228.95 0.162287
1.2 0.0340193 2900 4738.94 3512.98 1225.96 0.162287
1.2 0.0340193 3000 4834.63 3611.54 1223.09 0.162287
1.25 0.0353866 300 2386.33 2324.71 61.6276 0.00514364
1.25 0.0353866 400 2466.68 2389.48 77.2031 0.00647404
1.25 0.0353866 500 2547.49 2452.53 94.9548 0.00800299
1.25 0.0353866 600 2628.85 2513.87 114.979 0.00975815
1.25 0.0353866 700 2711.04 2573.29 137.745 0.0118577
1.25 0.0353866 800 2794.33 2630.39 163.932 0.0144522
1.25 0.0353866 900 2878.85 2685.7 193.145 0.0174261
1.25 0.0353866 1000 2964.44 2726.14 238.301 0.0235026
1.25 0.0353866 1100 3050.91 2678.75 372.156 0.0437591
1.25 0.0353866 1200 3138.31 2278.54 859.767 0.105907
1.25 0.0353866 1300 3226.58 2199 1027.58 0.135896
1.25 0.0353866 1400 3315.66 2103.52 1212.14 0.159473
1.25 0.0353866 1500 3405.47 2140.38 1265.09 0.159689
1.25 0.0353866 1600 3495.96 2231.99 1263.97 0.159696
1.25 0.0353866 1700 3587.08 2329.03 1258.05 0.159696
1.25 0.0353866 1800 3678.77 2426.26 1252.51 0.159696
1.25 0.0353866 1900 3771 2523.67 1247.33 0.159696
1.25 0.0353866 2000 3863.7 2621.24 1242.47 0.159696
1.25 0.0353866 2100 3956.85 2718.95 1237.9 0.159696
1.25 0.0353866 2200 4050.4 2816.8 1233.6 0.159696
1.25 0.0353866 2300 4144.32 2914.78 1229.55 0.159696
1.25 0.0353866 2400 4238.57 3012.86 1225.72 0.159696
1.25 0.0353866 2500 4333.13 3111.04 1222.08 0.159696
1.25 0.0353866 2600 4427.96 3209.32 1218.64 0.159696
1.25 0.0353866 2700 4523.03 3307.68 1215.35 0.159696
1.25 0.0353866 2800 4618.33 3406.11 1212.22 0.159696
1.25 0.0353866 2900 4713.83 3504.61 1209.22 0.159696
1.25 0.0353866 3000 4809.51 3603.17 1206.34 0.159696
1.3 0.0367501 300 2361.46 2304.62 56.8423 0.0047254
1.3 0.0367501 400 2441.96 2370.24 71.7168 0.00599037
1.3 0.0367501 500 2522.89 2434.13 88.7599 0.00745029
1.3 0.0367501 600 2604.36 2496.32 108.04 0.00912394
1.3 0.0367501 700 2686.63 2556.78 129.858 0.011087
1.3 0.0367501 800 2769.99 2614.93 155.053 0.0135382
1.3 0.0367501 900 2854.55 2671.11 183.441 0.0164082
1.3 0.0367501 1000 2940.18 2719.34 220.839 0.020966
1.3 0.0367501 1100 3026.67 2716.03 310.638 0.0345757
1.3 0.0367501 1200 3114.09 2299.17 814.917 0.0995504
1.3 0.0367501 1300 3202.36 2339.63 862.738 0.100832
1.3 0.0367501 1400 3291.44 2105.72 1185.72 0.156866
1.3 0.0367501 1500 3381.25 2198.32 1182.93 0.146587
1.3 0.0367501 1600 3471.74 2223.91 1247.82 0.157186
1.3 0.0367501 1700 3562.85 2320.95 1241.9 0.157186
1.3 0.0367501 1800 3654.53 2418.18 1236.35 0.157186
1.3 0.0367501 1900 3746.74 2515.58 1231.16 0.157186
1.3 0.0367501 2000 3839.43 2613.14 1226.29 0.157186
1.3 0.0367501 2100 3932.56 2710.86 1221.71 0.157186
1.3 0.0367501 2200 4026.1 2808.7 1217.4 0.157186
1.3 0.0367501 2300 4120 2906.67 1213.33 0.157186
1.3 0.0367501 2400 4214.23 3004.75 1209.49 0.157186
1.3 0.0367501 2500 4308.77 3102.92 1205.85 0.157186
1.3 0.0367501 2600 4403.58 3201.19 1202.39 0.157186
1.3 0.0367501 2700 4498.64 3299.55 1199.09 0.157186
1.3 0.0367501 2800 4593.92 3397.98 1195.95 0.157186
1.3 0.0367501 2900 4689.41 3496.47 1192.94 0.157186
1.3 0.0367501 3000 4785.08 3595.03 1190.05 0.157186
1.35 0.0381097 300 2337.2 2284.79 52.412 0.00434014
1.35 0.0381097 400 2417.84 2351.24 66.6057 0.00554218
1.35 0.0381097 500 2498.91 2415.95 82.9607 0.00693641
1.35 0.0381097 600 2580.49 2478.96 101.531 0.00853635
1.35 0.0381097 700 2662.85 2540.32 122.523 0.0103923
1.35 0.0381097 800 2746.26 2599.53 146.737 0.0126998
1.35 0.0381097 900 2830.88 2656.73 174.152 0.0154295
1.35 0.0381097 1000 2916.54 2709.67 206.872 0.019057
1.35 0.0381097 1100 3003.05 2730.09 272.96 0.0288177
1.35 0.0381097 1200 3090.48 2251.76 838.725 0.106808
1.35 0.0381097 1300 3178.77 2336.41 842.362 0.0992999
1.35 0.0381097 1400 3267.85 2107.34 1160.51 0.154319
1.35 0.0381097 1500 3357.67 2235.58 1122.08 0.13749
1.35 0.0381097 1600 3448.15 2216.05 1232.1 0.154753
1.35 0.0381097 1700 3539.25 2313.09 1226.17 0.154753
1.35 0.0381097 1800 3630.93 2410.31 1220.62 0.154753
1.35 0.0381097 1900 3723.12 2507.71 1215.42 0.154753
1.35 0.0381097 2000 3815.8 2605.27 1210.53 0.154753
1.35 0.0381097 2100 3908.92 2702.97 1205.95 0.154753
1.35 0.0381097 2200 4002.44 2800.81 1201.63 0.154753
1.35 0.0381097 2300 4096.33 2898.78 1197.55 0.154753
1.35 0.0381097 2400 4190.55 2996.85 1193.7 0.154753
1.35 0.0381097 2500 4285.07 3095.02 1190.04 0.154753
1.35 0.0381097 2600 4379.86 3193.29 1186.58 0.154753
1.35 0.0381097 2700 4474.91 3291.64 1183.27 0.154753
1.35 0.0381097 2800 4570.18 3390.06 1180.12 0.154753
1.35 0.0381097 2900 4665.65 3488.55 1177.1 0.154753
1.35 0.0381097 3000 4761.31 3587.1 1174.21 0.154753
end

View File

@ -30,7 +30,7 @@ Group
Description Description
Calculates the equilibrium flame temperature for a given fuel and Calculates the equilibrium flame temperature for a given fuel and
pressure for a range of unburnt gas temperatures and equivalence pressure for a range of unburnt gas temperatures and equivalence
ratios; the effects of dissociation on O2, H2O and CO2 are included. ratios; includes the effects of dissociation on O2, H2O and CO2.
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -57,7 +57,16 @@ typedef species::thermo<janafThermo<perfectGas<specie>>, absoluteEnthalpy>
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
argList::addNote
(
"Calculates the equilibrium flame temperature for a given fuel\n"
"and pressure for a range of unburnt gas temperatures and equivalence\n"
"ratios; includes the effects of dissociation on O2, H2O and CO2."
);
argList::noParallel();
argList::noFunctionObjects();
argList::validArgs.append("controlFile"); argList::validArgs.append("controlFile");
argList args(argc, argv); argList args(argc, argv);
const fileName controlFileName = args[1]; const fileName controlFileName = args[1];

View File

@ -55,6 +55,13 @@ typedef species::thermo<janafThermo<perfectGas<specie>>, absoluteEnthalpy>
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
argList::addNote
(
"Calculates the adiabatic flame temperature for a given mixture\n"
"at a given temperature."
);
argList::noParallel();
argList::noFunctionObjects();
argList::validArgs.append("controlFile"); argList::validArgs.append("controlFile");
argList args(argc, argv); argList args(argc, argv);

View File

@ -36,7 +36,6 @@
# file yet. Not supported by this script yet) # file yet. Not supported by this script yet)
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
Script=${0##*/} Script=${0##*/}
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
@ -52,6 +51,8 @@ TMPFILE=/tmp/${Script}$$.tmp
MACHDIR=$HOME/.OpenFOAM/${Script} MACHDIR=$HOME/.OpenFOAM/${Script}
DEFSTATEFILE=$HOME/.OpenFOAM/foamCheckJobs.out DEFSTATEFILE=$HOME/.OpenFOAM/foamCheckJobs.out
# The default is "~/.OpenFOAM/jobControl"
: ${FOAM_JOB_DIR:=$HOME/.OpenFOAM/jobControl}
if [ `uname -s` = Linux ] if [ `uname -s` = Linux ]
then then
@ -196,13 +197,6 @@ fi
#- Check a few things #- Check a few things
if [ ! "$FOAM_JOB_DIR" ]
then
echo "$Script : FOAM_JOB_DIR environment variable not set."
echo
exit 1
fi
if [ ! -d "$FOAM_JOB_DIR" ] if [ ! -d "$FOAM_JOB_DIR" ]
then then
echo "$Script : directory does not exist." echo "$Script : directory does not exist."

View File

@ -4,7 +4,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) 2011-2016 OpenFOAM Foundation # \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
# \\/ M anipulation | # \\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM. # This file is part of OpenFOAM.
@ -29,30 +29,31 @@
# Usage: foamCleanPath [-strip] path [wildcard] .. [wildcard] # Usage: foamCleanPath [-strip] path [wildcard] .. [wildcard]
# #
# Prints its argument (which should be a ':' separated path) # Prints its argument (which should be a ':' separated path)
# without all # without the following:
# - duplicate elements # - duplicate elements
# - elements whose start matches a wildcard # - elements whose start matches a wildcard
# - inaccessible directories (with the -strip (at your option) # - inaccessible directories (with the -strip option)
# #
# Note # Note
# - this routine will fail when directories have embedded spaces # - this routine will fail when directories have embedded spaces
# - false matches possible if a wildcard contains '.' (sed regex) # - false matches possible if a wildcard contains '.' (sed regex)
# - the wildcards can themselves can be written together and separated # - the wildcards themselves can be written together and separated
# by colons or whitespace # by colons or whitespace
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
usage() { usage() {
cat <<USAGE 1>&2 cat <<USAGE 1>&2
Usage: ${0##*/} [OPTION] path [wildcard1] .. [wildcardN] Usage: ${0##*/} [OPTION] path [wildcard1] .. [wildcardN]
options: options:
-debug print debug information to stderr
-strip remove inaccessible directories -strip remove inaccessible directories
-help print the usage -help print the usage
Prints its argument (which should be a ':' separated list) cleansed from Prints its argument (which should be a ':' separated list) cleansed from
- duplicate elements - duplicate elements
- elements whose start matches one of the wildcard(s) - elements whose start matches one of the wildcard(s)
- inaccessible directories (with the -strip option) - inaccessible directories (with the -strip option)
Exit status Exit status
0 on success 0 on success
1 for miscellaneous errors. 1 for miscellaneous errors.
2 initial value of 'path' is empty 2 initial value of 'path' is empty
@ -62,95 +63,100 @@ USAGE
} }
unset strip # Parse options
# parse options unset optDebug optStrip
while [ "$#" -gt 0 ] while [ "$#" -gt 0 ]
do do
case "$1" in case "$1" in
-h | -help) -h | -help)
usage usage
;; ;;
-debug)
optDebug=true
;;
-strip) -strip)
strip=true optStrip=true
shift
;; ;;
*) *)
break break
;; ;;
esac esac
shift
done done
# Basic checks, setup
[ "$#" -ge 1 ] || usage [ "$#" -ge 1 ] || usage
dirList="$1" dirList="$1"
shift shift
[ -n "$dirList" ] || exit 2 # quick exit on empty 'dirList' [ -n "$dirList" ] || exit 2 # Quick exit on empty 'dirList'
#-------------------------------------------------------------------------------
##DEBUG echo "input>$dirList<" 1>&2 # Debugging (optional)
if [ -n "$optDebug" ]
then
printDebug() { while [ "$#" -ge 1 ]; do echo "$1" 1>&2; shift; done; }
else
printDebug() { true; } # No-op
fi
# preserve current IFS and split on colon or whitespace # Check directory existence (optional)
oldIFS="$IFS" if [ -n "$optStrip" ]
IFS=': ' then
isDir() { test -d "$1"; } # Check for directory
else
isDir() { true; } # No check (always true)
fi
# "wildcard1 ... wildcardN" may have been passed as a single parameter # The "wildcard1 ... wildcardN" may have been passed as a single parameter
# or may contain ':' separators # or may contain ':' separators
oldIFS="$IFS" # Preserve initial IFS
IFS=': ' # Split on colon, whitespace
set -- $* set -- $*
printDebug "input>$dirList<"
# Strip out wildcards via sed. Path and wildcard cannot contain '?'. # Strip out wildcards via sed. Path and wildcard cannot contain '?'.
while [ "$#" -ge 1 ] while [ "$#" -ge 1 ]
do do
wildcard=$1 wildcard="$1"
shift shift
##DEBUG echo "remove>$wildcard<" 1>&2
if [ -n "$wildcard" ] if [ -n "$wildcard" ]
then then
printDebug "remove>$wildcard<"
dirList=$(echo "$dirList:" | sed -e "s?${wildcard}[^:]*:??g") dirList=$(echo "$dirList:" | sed -e "s?${wildcard}[^:]*:??g")
fi fi
done done
printDebug "intermediate>$dirList<"
# split on ':' (and on space as well to avoid any surprises) IFS=': ' # Split on colon, whitespace (to avoid surprises)
IFS=': '
set -- $dirList set -- $dirList
##DEBUG echo "intermediate>$dirList<" 1>&2 IFS="$oldIFS" # Restore initial IFS
# rebuild the list from scratch # Rebuild the list
unset dirList unset dirList
for dir for dir
do do
##DEBUG echo "check>$dir<" 1>&2 printDebug "check>$dir< in $dirList"
#- dirs must exist if isDir "$dir"
if [ -e "$dir" ]
then then
#- no duplicate dirs # Detect duplicates (ie, dir already in the list)
duplicate=$(echo " $dirList " | sed -ne "s: $dir :DUP:p") duplicate=$(echo ":$dirList:" | sed -ne '\?:'"$dir"':?p')
if [ ! "$duplicate" ] if [ -n "$duplicate" ]
then then
dirList="$dirList $dir" printDebug "duplicate>$dir<"
else
dirList="${dirList}${dirList:+:}$dir"
fi fi
elif [ "$strip" != true ]
then
# Print non-existing directories if not in 'strip' mode.
dirList="$dirList $dir"
fi fi
done done
# split on whitespace printDebug "output>$dirList<"
IFS=' '
set -- $dirList
# rejoin on ':'
IFS=':'
dirList="$*"
# restore IFS
IFS="$oldIFS"
##DEBUG echo "output>$dirList<" 1>&2
echo "$dirList" echo "$dirList"
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -26,7 +26,7 @@
# foamEtcFile # foamEtcFile
# #
# Description # Description
# Locate user/group/shipped file with semantics similar to the # Locate user/group/other files with semantics similar to the
# ~OpenFOAM/fileName expansion. # ~OpenFOAM/fileName expansion.
# #
# The -mode option can be used to allow chaining from # The -mode option can be used to allow chaining from
@ -34,44 +34,56 @@
# #
# For example, within the user ~/.OpenFOAM/<VER>/prefs.sh: # For example, within the user ~/.OpenFOAM/<VER>/prefs.sh:
# \code # \code
# foamFile=$(foamEtcFile -mode go prefs.sh) && . $foamFile # eval $(foamEtcFile -sh -mode=go prefs.sh)
# \endcode # \endcode
# #
# Environment
# - WM_PROJECT: (unset defaults to OpenFOAM)
# - WM_PROJECT_SITE: (unset defaults to PREFIX/site)
# - WM_PROJECT_VERSION: (unset defaults to detect from path)
#
# Note # Note
# This script must exist in $FOAM_INST_DIR/OpenFOAM-<VERSION>/bin/ # This script must exist in one of these locations:
# or $FOAM_INST_DIR/openfoam<VERSION>/bin/ (for the debian version) # - $WM_PROJECT_INST_DIR/OpenFOAM-<VERSION>/bin
# - $WM_PROJECT_INST_DIR/openfoam-<VERSION>/bin
# - $WM_PROJECT_INST_DIR/OpenFOAM+<VERSION>/bin
# - $WM_PROJECT_INST_DIR/openfoam+<VERSION>/bin
# - $WM_PROJECT_INST_DIR/openfoam<VERSION>/bin (debian version)
# #
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
unset optQuiet optSilent unset optQuiet optSilent
usage() { usage() {
[ "${optQuiet:-$optSilent}" = true ] && exit 1 [ "${optQuiet:-$optSilent}" = true ] && exit 1
exec 1>&2 exec 1>&2
while [ "$#" -ge 1 ]; do echo "$1"; shift; done while [ "$#" -ge 1 ]; do echo "$1"; shift; done
cat<<USAGE cat<<USAGE
Usage: foamEtcFile [OPTION] fileName Usage: foamEtcFile [OPTION] fileName
foamEtcFile [OPTION] -list foamEtcFile [OPTION] [-list|-list-test] [fileName]
options: options:
-a, -all return all files (otherwise stop after the first match) -a, -all Return all files (otherwise stop after the first match)
-l, -list list the directories to be searched -l, -list List directories or files to be checked
-m, -mode MODE any combination of u(user), g(group), o(other) -list-test List (existing) directories or files to be checked
-p, -prefix DIR specify an alternative installation prefix -mode=MODE Any combination of u(user), g(group), o(other)
-q, -quiet suppress all normal output -prefix=DIR Specify an alternative installation prefix
-s, -silent suppress stderr output, except for things that are emitted -version=VER Specify alternative OpenFOAM version (eg, 3.0, 1612, ...)
by -csh-verbose, -sh-verbose. -csh | -sh Produce output suitable for a csh or sh 'eval'
-v, -version VER specify alternative OpenFOAM version (eg, 3.0, 1612, ...) -csh-verbose | -sh-verbose
-csh | -sh produce output suitable for a csh or sh 'eval' As per -csh | -sh, with additional verbosity
-csh-verbose, -q, -quiet Suppress all normal output
-sh-verbose with additional verbosity -s, -silent Suppress stderr, except -csh-verbose, -sh-verbose output
-help print the usage -help Print the usage
Locate user/group/shipped file with semantics similar to the Locate user/group/other file with semantics similar to the
~OpenFOAM/fileName expansion. ~OpenFOAM/fileName expansion.
Many options can be specified as a single character, but must not be grouped. Single character options must not be grouped. Equivalent options:
-mode=MODE, -mode MODE, -m MODE
-prefix=DIR, -prefix DIR, -p DIR
-version=VER, -version VER, -v VER
Exit status Exit status
0 when the file is found. Print resolved path to stdout. 0 when the file is found. Print resolved path to stdout.
1 for miscellaneous errors. 1 for miscellaneous errors.
2 when the file is not found. 2 when the file is not found.
@ -79,74 +91,117 @@ options:
USAGE USAGE
exit 1 exit 1
} }
# Report error and exit
die()
{
[ "${optQuiet:-$optSilent}" = true ] && exit 1
exec 1>&2
echo
echo "Error encountered:"
while [ "$#" -ge 1 ]; do echo " $1"; shift; done
echo
echo "See 'foamEtcFile -help' for usage"
echo
exit 1
}
#-------------------------------------------------------------------------------
binDir="${0%/*}" # The bin dir
projectDir="${binDir%/bin}" # The project dir
prefixDir="${projectDir%/*}" # The prefix dir (same as $WM_PROJECT_INST_DIR)
# Could not resolve projectDir, prefixDir? (eg, called as ./bin/foamEtcFile)
if [ "$prefixDir" = "$projectDir" ]
then
binDir="$(cd $binDir && pwd -L)"
projectDir="${binDir%/bin}"
prefixDir="${projectDir%/*}"
fi
projectDirName="${projectDir##*/}" # The project directory name
projectVersion="$WM_PROJECT_VERSION" # Empty? - will be treated later
userDir="$HOME/.OpenFOAM" # Hard-coded as per foamVersion.H
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# The bin dir: # Guess project version or simply get the stem part of the projectDirName.
binDir="${0%/*}"
# The project dir:
projectDir="${binDir%/bin}"
# The prefix dir (same as $FOAM_INST_DIR):
prefixDir="${projectDir%/*}"
# The name used for the project directory
projectDirName="${projectDir##*/}"
# The versionNum is used for debian packaging
unset versionNum
#
# Handle standard and debian naming conventions. # Handle standard and debian naming conventions.
# - projectDirBase: projectDirName without the version
# - version
# - versionNum (debian only)
# #
case "$projectDirName" in # - projectVersion: update unless already set
OpenFOAM-* | openfoam-*) # OpenFOAM-<VERSION> or openfoam-<VERSION> #
projectDirBase="${projectDirName%%-*}-" # Helper variables:
# - dirBase (for reassembling name) == projectDirName without the version
# - versionNum (debian packaging)
unset dirBase versionNum
guessVersion()
{
local version
case "$projectDirName" in
(OpenFOAM-* | openfoam-*)
# Standard naming: OpenFOAM-<VERSION> or openfoam-<VERSION>
dirBase="${projectDirName%%-*}-"
version="${projectDirName#*-}" version="${projectDirName#*-}"
version="${version%%*-}" # Extra safety, eg openfoam-version-packager
;; ;;
openfoam[0-9]*) # Debian: openfoam<VERSION> (OpenFOAM+* | openfoam+*)
projectDirBase="openfoam" # Alternative naming: OpenFOAM+<VERSION> or openfoam+<VERSION>
versionNum="${projectDirName#openfoam}" dirBase="${projectDirName%%+*}+"
case "${#versionNum}" in version="${projectDirName#*+}"
(2|3|4) # Convert digits version number to decimal delineated version="${version%%*-}" # Extra safety, eg openfoam-version-packager
;;
(openfoam[0-9]*)
# Debian naming: openfoam<VERSION>
dirBase="openfoam"
version="${projectDirName#openfoam}"
versionNum="$version"
# Convert digits version number to decimal delineated
case "${#versionNum}" in (2|3|4)
version=$(echo "$versionNum" | sed -e 's@\([0-9]\)@\1.@g') version=$(echo "$versionNum" | sed -e 's@\([0-9]\)@\1.@g')
version="${version%.}" version="${version%.}"
;; ;;
esac
(*) # Fallback - use current environment setting # Ignore special treatment if no decimals were inserted.
version="$WM_PROJECT_VERSION" [ "${#version}" -gt "${#versionNum}" ] || unset versionNum
;;
(*)
die "unknown/unsupported naming convention for '$projectDirName'"
;; ;;
esac esac
;;
*) # Set projectVersion if required
echo "foamEtcFile error: unknown/unsupported naming convention" 1>&2 : ${projectVersion:=$version}
exit 1
;;
esac
# Set version and update versionNum, projectDirName accordingly
setVersion()
{
version="$1"
# Convert x.y.z -> xyz version (if installation looked like debian)
[ -n "$versionNum" ] && versionNum=$(echo "$version" | sed -e 's@\.@@g')
projectDirName="$projectDirBase${versionNum:-${version}}"
} }
# Default mode is always 'ugo' # Set projectVersion and update versionNum, projectDirName accordingly
mode=ugo setVersion()
unset optAll optList optShell {
projectVersion="$1"
# parse options # Need dirBase when reassembling projectDirName
[ -n "$dirBase" ] || guessVersion
# Debian: update x.y.z -> xyz version
if [ -n "$versionNum" ]
then
versionNum=$(echo "$projectVersion" | sed -e 's@\.@@g')
fi
projectDirName="$dirBase${versionNum:-$projectVersion}"
}
optMode=ugo # Default mode is always 'ugo'
unset optAll optList optShell optVersion
# Parse options
while [ "$#" -gt 0 ] while [ "$#" -gt 0 ]
do do
case "$1" in case "$1" in
@ -161,34 +216,38 @@ do
optList=true optList=true
unset optShell unset optShell
;; ;;
-list-test)
optList='test'
unset optShell
;;
-csh | -sh | -csh-verbose | -sh-verbose) -csh | -sh | -csh-verbose | -sh-verbose)
optShell="${1#-}" optShell="${1#-}"
unset optAll unset optAll
;; ;;
-mode=[ugo]*) -mode=[ugo]*)
mode="${1#*=}" optMode="${1#*=}"
;; ;;
-prefix=/*) -prefix=/*)
prefixDir="${1#*=}" prefixDir="${1#*=}"
prefixDir="${prefixDir%/}" prefixDir="${prefixDir%/}"
;; ;;
-version=*) -version=*)
setVersion "${1#*=}" optVersion="${1#*=}"
;; ;;
-m | -mode) -m | -mode)
mode="$2" optMode="$2"
shift
# Sanity check. Handles missing argument too. # Sanity check. Handles missing argument too.
case "$mode" in case "$optMode" in
[ugo]*) ([ugo]*)
;; ;;
*) (*)
usage "invalid mode '$mode'" die "invalid mode '$optMode'"
;; ;;
esac esac
shift
;; ;;
-p | -prefix) -p | -prefix)
[ "$#" -ge 2 ] || usage "'$1' option requires an argument" [ "$#" -ge 2 ] || die "'$1' option requires an argument"
prefixDir="${2%/}" prefixDir="${2%/}"
shift shift
;; ;;
@ -199,8 +258,8 @@ do
optSilent=true optSilent=true
;; ;;
-v | -version) -v | -version)
[ "$#" -ge 2 ] || usage "'$1' option requires an argument" [ "$#" -ge 2 ] || die "'$1' option requires an argument"
setVersion "$2" optVersion="$2"
shift shift
;; ;;
--) --)
@ -208,7 +267,7 @@ do
break break
;; ;;
-*) -*)
usage "unknown option: '$1'" die "unknown option: '$1'"
;; ;;
*) *)
break break
@ -217,12 +276,27 @@ do
shift shift
done done
# Update projectDir accordingly
#-------------------------------------------------------------------------------
if [ -n "$optVersion" ]
then
setVersion $optVersion
elif [ -z "$projectVersion" ]
then
guessVersion
fi
# Updates:
# - projectDir for changes via -prefix or -version
# - groupDir for changes via -prefix
projectDir="$prefixDir/$projectDirName" projectDir="$prefixDir/$projectDirName"
groupDir="${WM_PROJECT_SITE:-$prefixDir/site}"
# Debugging: # Debugging:
# echo "Installed locations:" 1>&2 # echo "Installed locations:" 1>&2
# for i in projectDir prefixDir projectDirName version versionNum # for i in projectDir prefixDir projectDirName projectVersion
# do # do
# eval echo "$i=\$$i" 1>&2 # eval echo "$i=\$$i" 1>&2
# done # done
@ -235,19 +309,17 @@ fileName="${1#~OpenFOAM/}"
# Define the various places to be searched: # Define the various places to be searched:
unset dirList unset dirList
case "$mode" in (*u*) # (U)ser case "$optMode" in (*u*) # (U)ser
dir="$HOME/.${WM_PROJECT:-OpenFOAM}" dirList="$dirList $userDir/$projectVersion $userDir"
dirList="$dirList $dir/$version $dir"
;; ;;
esac esac
case "$mode" in (*g*) # (G)roup == site case "$optMode" in (*g*) # (G)roup == site
dir="${WM_PROJECT_SITE:-$prefixDir/site}" dirList="$dirList $groupDir/$projectVersion $groupDir"
dirList="$dirList $dir/$version $dir"
;; ;;
esac esac
case "$mode" in (*o*) # (O)ther == shipped case "$optMode" in (*o*) # (O)ther == shipped
dirList="$dirList $projectDir/etc" dirList="$dirList $projectDir/etc"
;; ;;
esac esac
@ -259,30 +331,54 @@ set -- $dirList
# #
exitCode=0 exitCode=0
if [ "$optList" = true ] if [ -n "$optList" ]
then then
# List directories, or potential file locations # List directories, or potential file locations
[ "$nArgs" -le 1 ] || usage [ "$nArgs" -le 1 ] || \
die "-list expects 0 or 1 filename, but $nArgs provided"
# A silly combination, but -quiet does have precedence # A silly combination, but -quiet does have precedence
[ -n "$optQuiet" ] && exit 0 [ -n "$optQuiet" ] && exit 0
for dir # Test for directory or file too?
do if [ "$optList" = "test" ]
then
exitCode=2 # Fallback to a general error (file not found)
if [ "$nArgs" -eq 1 ] if [ "$nArgs" -eq 1 ]
then then
echo "$dir/$fileName" for dir
else do
echo "$dir" resolved="$dir/$fileName"
if [ -f "$resolved" ]
then
echo "$resolved"
exitCode=0 # OK
fi fi
done done
else
for dir
do
if [ -d "$dir" ]
then
echo "$dir"
exitCode=0 # OK
fi
done
fi
else
for dir
do
echo "$dir${fileName:+/}$fileName"
done
fi
else else
[ "$nArgs" -eq 1 ] || usage [ "$nArgs" -eq 1 ] || die "One filename expected - $nArgs provided"
exitCode=2 # Fallback to a general error, eg file not found exitCode=2 # Fallback to a general error (file not found)
for dir for dir
do do
@ -316,7 +412,6 @@ else
fi fi
exit $exitCode exit $exitCode
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -26,7 +26,7 @@
# foamExec # foamExec
# #
# Description # Description
# Usage: foamExec [-v foamVersion] <foamCommand> ... # Usage: foamExec [-version=foamVersion] <foamCommand> ...
# #
# Runs the <foamVersion> version of executable <foamCommand> # Runs the <foamVersion> version of executable <foamCommand>
# with the rest of the arguments. # with the rest of the arguments.
@ -34,7 +34,7 @@
# Can also be used for parallel runs. For example, # Can also be used for parallel runs. For example,
# \code # \code
# mpirun -np <nProcs> \ # mpirun -np <nProcs> \
# foamExec -version <foamVersion> <foamCommand> ... -parallel # foamExec -version=VERSION <foamCommand> ... -parallel
# \endcode # \endcode
# #
# Note # Note
@ -55,34 +55,29 @@ usage() {
Usage: ${0##*/} [OPTION] <application> ... Usage: ${0##*/} [OPTION] <application> ...
options: options:
-prefix <dir> specify an alternative installation prefix -mode=MODE Any combination of u(user), g(group), o(other)
-prefix=DIR Specify an alternative installation prefix
pass through to foamEtcFile and set as FOAM_INST_DIR pass through to foamEtcFile and set as FOAM_INST_DIR
-version <ver> specify an alternative OpenFOAM version -version=VER Specify alternative OpenFOAM version (eg, 3.0, 1612, ...)
pass through to foamEtcFile pass through to foamEtcFile
-help print the usage -help Print the usage
* run a particular OpenFOAM version of <application> Run a particular OpenFOAM version of <APPLICATION>
USAGE USAGE
exit 1 exit 1
} }
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
binDir="${0%/*}" # The bin dir
projectDir="${binDir%/bin}" # The project dir
prefixDir="${projectDir%/*}" # The prefix dir (same as $WM_PROJECT_INST_DIR)
# the bin dir: ## projectDirName="${projectDir##*/}" # The project directory name
binDir="${0%/*}"
# the project dir: version="${WM_PROJECT_VERSION:-unknown}"
projectDir="${binDir%/bin}"
# the prefix dir (same as $FOAM_INST_DIR): unset etcOpts
prefixDir="${projectDir%/*}"
# # the name used for the project directory
# projectDirName="${projectDir##*/}"
unset etcOpts version
# parse options # parse options
while [ "$#" -gt 0 ] while [ "$#" -gt 0 ]
do do
@ -90,6 +85,17 @@ do
-h | -help) -h | -help)
usage usage
;; ;;
-mode=*)
etcOpts="$etcOpts $1" # pass-thru to foamEtcFile
;;
-prefix=/*)
etcOpts="$etcOpts $1" # pass-thru to foamEtcFile
prefixDir="${1#*=}"
;;
-version=*)
etcOpts="$etcOpts $1" # pass-thru to foamEtcFile
version="${1#*=}"
;;
-m | -mode) -m | -mode)
[ "$#" -ge 2 ] || usage "'$1' option requires an argument" [ "$#" -ge 2 ] || usage "'$1' option requires an argument"
etcOpts="$etcOpts $1 $2" # pass-thru to foamEtcFile etcOpts="$etcOpts $1 $2" # pass-thru to foamEtcFile
@ -127,15 +133,15 @@ done
# #
sourceRc() sourceRc()
{ {
foamDotFile="$($binDir/foamEtcFile $etcOpts bashrc)" || { rcFile="$($binDir/foamEtcFile $etcOpts bashrc)" || {
echo "Error : bashrc file could not be found for OpenFOAM-${version:-${WM_PROJECT_VERSION:-???}}" 1>&2 echo "Error : bashrc file could not be found for OpenFOAM-$version" 1>&2
exit 1 exit 1
} }
# set to consistent value before sourcing the bashrc # set to consistent value before sourcing the bashrc
export FOAM_INST_DIR="$prefixDir" export FOAM_INST_DIR="$prefixDir"
. $foamDotFile $FOAM_SETTINGS . $rcFile $FOAM_SETTINGS
} }

View File

@ -34,6 +34,8 @@ Script=${0##*/}
JOBSTRING='%4s %8s %20s %10s %8s %4s %12s %12s %20s\n' JOBSTRING='%4s %8s %20s %10s %8s %4s %12s %12s %20s\n'
DEFSTATEFILE=$HOME/.OpenFOAM/foamCheckJobs.out DEFSTATEFILE=$HOME/.OpenFOAM/foamCheckJobs.out
# The default is "~/.OpenFOAM/jobControl"
: ${FOAM_JOB_DIR:=$HOME/.OpenFOAM/jobControl}
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# #
@ -120,12 +122,6 @@ fi
#- Check a few things #- Check a few things
if [ ! "$FOAM_JOB_DIR" ]
then
echo "$Script : FOAM_JOB_DIR environment variable not set."
echo
exit 1
fi
if [ ! -d "$FOAM_JOB_DIR" ] if [ ! -d "$FOAM_JOB_DIR" ]
then then
echo "$Script : directory does not exist." echo "$Script : directory does not exist."

View File

@ -172,14 +172,12 @@ fvControls="system"
if [ -n "$regionName" ] if [ -n "$regionName" ]
then then
if [ ! -d constant/$regionName ] [ -d constant/$regionName ] || {
then
echo "FATAL ERROR: Region $regionName does not exist" 1>&2 echo "FATAL ERROR: Region $regionName does not exist" 1>&2
exit 1 exit 1
else }
caseFile="$caseName{$regionName}.$extension" caseFile="$caseName{$regionName}.$extension"
fvControls="$fvControls/$regionName" fvControls="$fvControls/$regionName"
fi
fi fi
case "${optTouch:-false}" in case "${optTouch:-false}" in
@ -212,11 +210,42 @@ true)
esac esac
# Parent directory for normal or parallel results # Check existence of some essential OpenFOAM files.
case "$caseName" in # If caseName appears to be a processor directory, check parent as fallback
processor*) parentDir=".." ;; hasFiles() {
*) parentDir="." ;; local warn="Cannot locate OpenFOAM-format case files:"
esac local parent
case "$caseName" in (processor*) parent="../" ;; esac
for file
do
if [ -s "$file" ]
then
continue
elif [ -n "$parent" -a -s "$parent$file" ]
then
continue
else
# Not found
[ -n "$warn" ] && echo "$warn" 1>&2
unset warn
if [ -n "$parent" ]
then
echo " $file, or $parent$file" 1>&2
else
echo " $file" 1>&2
fi
fi
done
if [ -n "$warn" ]
then
return 0 # No warnings were triggered
else
echo 1>&2 # Emit an additional separator line
return 1
fi
}
if [ "${hasData:-false}" = true ] if [ "${hasData:-false}" = true ]
@ -228,7 +257,7 @@ then
else else
# Check existence of essential files # Check existence of essential files
warn="WARN file does not exist:" warn=false
case $extension in case $extension in
blockMesh) blockMesh)
blockMeshDict=system/blockMeshDict blockMeshDict=system/blockMeshDict
@ -236,40 +265,22 @@ else
then then
blockMeshDict=constant/polyMesh/blockMeshDict blockMeshDict=constant/polyMesh/blockMeshDict
fi fi
for check in \
system/controlDict \ hasFiles system/controlDict $blockMeshDict || warn=true
$blockMeshDict \
;
do
[ -s "$parentDir/$check" ] || {
[ -n "$warn" ] && echo "$warn" 1>&2
echo " $parentDir/$check" 1>&2
unset warn
}
done
;; ;;
OpenFOAM) OpenFOAM)
for check in \ hasFiles \
system/controlDict \ system/controlDict \
$fvControls/fvSchemes \ $fvControls/fvSchemes \
$fvControls/fvSolution \ $fvControls/fvSolution || warn=true
;
do
[ -s "$parentDir/$check" ] || {
[ -n "$warn" ] && echo "$warn" 1>&2
echo " $parentDir/$check" 1>&2
unset warn
}
done
;; ;;
esac esac
[ -n "$warn" ] || { [ "${warn:-false}" = false ] || {
echo "Cannot locate OpenFOAM-format case files" echo -n "Would you like to open paraview anyway <Y|n>: "
echo -n "Would you like to open ParaView anyway <Y|n>:"
read open read open
[ "$open" = "" ] || echo $open | grep -iqE "^y" && paraview case "${open:-y}" in ([Yy]*) paraview ;; esac
exit exit
} }

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