Porting update

This commit is contained in:
Hrvoje Jasak 2010-08-25 15:03:47 +01:00
parent 54c7d7fb19
commit 903edadc00
1168 changed files with 73511 additions and 38051 deletions

View file

@ -1,94 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright held by original author
\\/ 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Application
CompactListListTest
Description
Simple demonstration and test application for the CompactListList class.
\*---------------------------------------------------------------------------*/
#include "CompactListList.H"
#include "IOstreams.H"
using namespace Foam;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Main program:
int main(int argc, char *argv[])
{
CompactListList<label> cll1;
List<List<label> > lll(5);
lll[0].setSize(3, 0);
lll[1].setSize(2, 1);
lll[2].setSize(6, 2);
lll[3].setSize(0, 3);
lll[4].setSize(1, 4);
CompactListList<label> cll2(lll);
Info<< "cll2 = " << cll2 << endl;
forAll(cll2, i)
{
Info<< cll2[i] << endl;
}
Info<< endl;
Info<< "cll2(2, 3) = " << cll2(2, 3) << nl << endl;
Info<< "cll2 as List<List<label > > " << cll2() << endl;
cll2.setSize(3);
Info<< "cll2 = " << cll2 << endl;
List<label> rowSizes(5);
rowSizes[0] = 2;
rowSizes[1] = 0;
rowSizes[2] = 1;
rowSizes[3] = 3;
rowSizes[4] = 2;
CompactListList<label> cll3(rowSizes, 1);
Info<< "cll3 = " << cll3 << endl;
CompactListList<label> cll4;
cll4.transfer(cll3);
Info<< "cll3 = " << cll3 << endl;
Info<< "cll4 = " << cll4 << endl;
return 0;
}
// ************************************************************************* //

View file

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

View file

@ -1,128 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright held by original author
\\/ 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Application
Description
\*---------------------------------------------------------------------------*/
#include "OSspecific.H"
#include "IOstreams.H"
#include "DLList.H"
using namespace Foam;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Main program:
int main(int argc, char *argv[])
{
DLList<scalar> myList;
for (int i = 0; i<10; i++)
{
myList.append(1.3*i);
}
myList.append(100.3);
myList.append(500.3);
Info<< nl << "And again using STL iterator: " << nl << endl;
for
(
DLList<scalar>::iterator iter = myList.begin();
iter != myList.end();
++iter
)
{
Info<< "element:" << *iter << endl;
}
Info<< nl << "And again using the same STL iterator: " << nl << endl;
for
(
DLList<scalar>::iterator iter = myList.begin();
iter != myList.end();
++iter
)
{
Info<< "Removing " << myList.remove(iter) << endl;
}
myList.append(500.3);
myList.append(100.3);
Info<< nl << "And again using STL const_iterator: " << nl << endl;
const DLList<scalar>& const_myList = myList;
for
(
DLList<scalar>::const_iterator iter = const_myList.begin();
iter != const_myList.end();
++iter
)
{
Info<< "element:" << *iter << endl;
}
myList.swapUp(myList.DLListBase::first());
myList.swapUp(myList.DLListBase::last());
for
(
DLList<scalar>::const_iterator iter = const_myList.begin();
iter != const_myList.end();
++iter
)
{
Info<< "element:" << *iter << endl;
}
myList.swapDown(myList.DLListBase::first());
myList.swapDown(myList.DLListBase::last());
for
(
DLList<scalar>::const_iterator iter = const_myList.begin();
iter != const_myList.end();
++iter
)
{
Info<< "element:" << *iter << endl;
}
Info<< nl << "Bye." << endl;
return 0;
}
// ************************************************************************* //

View file

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

View file

@ -1,116 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright held by original author
\\/ 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Application
Description
\*---------------------------------------------------------------------------*/
#include "OSspecific.H"
#include "IOstreams.H"
#include "Dictionary.H"
using namespace Foam;
class ent
:
public Dictionary<ent>::link
{
word keyword_;
int i_;
public:
ent(const word& keyword, int i)
:
keyword_(keyword),
i_(i)
{}
const word& keyword() const
{
return keyword_;
}
friend Ostream& operator<<(Ostream& os, const ent& e)
{
os << e.keyword_ << ' ' << e.i_ << endl;
return os;
}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Main program:
int main(int argc, char *argv[])
{
Dictionary<ent>* dictPtr = new Dictionary<ent>;
Dictionary<ent>& dict = *dictPtr;
for (int i = 0; i<10; i++)
{
ent* ePtr = new ent(word("ent") + name(i), i);
dict.append(ePtr->keyword(), ePtr);
dict.swapUp(ePtr);
}
Info<< dict << endl;
dict.swapDown(dict.first());
for
(
Dictionary<ent>::const_iterator iter = dict.begin();
iter != dict.end();
++iter
)
{
Info<< "element : " << *iter;
}
Info<< dict.toc() << endl;
delete dictPtr;
dictPtr = new Dictionary<ent>;
Dictionary<ent>& dict2 = *dictPtr;
for (int i = 0; i<10; i++)
{
ent* ePtr = new ent(word("ent") + name(i), i);
dict2.append(ePtr->keyword(), ePtr);
dict2.swapUp(ePtr);
}
Info<< dict2 << endl;
Info<< nl << "Bye." << endl;
return 0;
}
// ************************************************************************* //

View file

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

View file

@ -1,133 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright held by original author
\\/ 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "Time.H"
#include "DimensionedFields.H"
#include "DimensionedSphericalTensorField.H"
#include "vector.H"
#include "tensor.H"
#include "GeoMesh.H"
using namespace Foam;
namespace Foam
{
class vMesh
{
public:
vMesh()
{}
label size() const
{
return 10;
}
};
};
template<>
const word Foam::DimensionedField<scalar, GeoMesh<vMesh> >::typeName
(
"dimenionedScalarField"
);
template<>
const word Foam::DimensionedField<vector, GeoMesh<vMesh> >::typeName
(
"dimenionedVectorField"
);
template<>
const word Foam::DimensionedField<tensor, GeoMesh<vMesh> >::typeName
(
"dimenionedTensorField"
);
template<>
const word Foam::DimensionedField<sphericalTensor, GeoMesh<vMesh> >::typeName
(
"dimenionedSphericalTensorField"
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Main program:
int main(int argc, char *argv[])
{
# include "setRootCase.H"
# include "createTime.H"
vMesh vm;
DimensionedField<scalar, GeoMesh<vMesh> > dsf
(
IOobject
(
"dsf",
runTime.timeName(),
runTime,
IOobject::MUST_READ,
IOobject::NO_WRITE
),
vm
);
Info<< dsf << endl;
dsf += dsf;
dsf -= dimensionedScalar("5", dsf.dimensions(), 5.0);
Info<< dsf << endl;
Info<< sqr(dsf + dsf) - sqr(dsf + dsf) << endl;
DimensionedField<vector, GeoMesh<vMesh> > dvf
(
IOobject
(
"dvf",
runTime.timeName(),
runTime,
IOobject::MUST_READ,
IOobject::NO_WRITE
),
vm
);
Info<< (dvf ^ (dvf ^ dvf)) << endl;
Info << "End\n" << endl;
return 0;
}
// ************************************************************************* //

View file

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

View file

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

View file

@ -1,107 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2008 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
\*---------------------------------------------------------------------------*/
#include "DynamicList.H"
#include "IOstreams.H"
using namespace Foam;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Main program:
int main(int argc, char *argv[])
{
List<DynamicList<label, 1, 0> > ldl(2);
ldl[0](0) = 0;
ldl[0](2) = 2;
ldl[0](3) = 3;
ldl[0](1) = 1;
ldl[0].setSize(5); // increase allocated size
ldl[1].setSize(10); // increase allocated size
ldl[1](2) = 2;
ldl[1] = 3;
Info<< "<ldl>" << ldl << "</ldl>" << nl << "sizes: ";
forAll(ldl, i)
{
Info<< " " << ldl[i].size() << "/" << ldl[i].allocSize();
}
Info<< endl;
List<List<label> > ll(2);
ll[0].transfer(ldl[0]);
ll[1].transfer(ldl[1].shrink());
Info<< "<ldl>" << ldl << "</ldl>" << nl << "sizes: ";
forAll(ldl, i)
{
Info<< " " << ldl[i].size() << "/" << ldl[i].allocSize();
}
Info<< endl;
Info<< "<ll>" << ll << "</ll>" << nl << endl;
// test the transfer between DynamicLists
DynamicList<label, 1, 0> dlA;
DynamicList<label, 1, 0> dlB;
for (label i = 0; i < 5; i++)
{
dlA.append(i);
}
dlA.setSize(10);
Info<< "<dlA>" << dlA << "</dlA>" << nl << "sizes: "
<< " " << dlA.size() << "/" << dlA.allocSize() << endl;
dlB.transfer(dlA);
// provokes memory error if previous transfer did not maintain
// the correct allocated space
// currently fails in OpenFOAM-1.5.x
/*
* dlB[6] = 6;
*/
Info<< "Transferred to dlB" << endl;
Info<< "<dlA>" << dlA << "</dlA>" << nl << "sizes: "
<< " " << dlA.size() << "/" << dlA.allocSize() << endl;
Info<< "<dlB>" << dlB << "</dlB>" << nl << "sizes: "
<< " " << dlB.size() << "/" << dlB.allocSize() << endl;
return 0;
}
// ************************************************************************* //

View file

@ -1,4 +0,0 @@
DynamicListTest.C
EXE = $(FOAM_USER_APPBIN)/DynamicListTest

View file

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

View file

@ -1,11 +0,0 @@
#include "testField.H"
int main()
{
Vector<double> v1(1, 2);
Vector<double> v2(2, 3);
std::cout << v1 + v2;
return 0;
}

View file

@ -1,3 +0,0 @@
FieldTest.C
SEXE = $(FOAM_USER_APPBIN)/FieldTest

View file

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

View file

@ -1,59 +0,0 @@
#include <iostream>
template<class C>
class Vector;
template<class C>
Vector<C> operator+(const Vector<C>& v1, const Vector<C>& v2);
template<class C>
std::ostream& operator<<(std::ostream& os, const Vector<C>& v);
/*---------------------------------------------------------------------------*\
Class Vector Declaration
\*---------------------------------------------------------------------------*/
template<class C>
class Vector
{
double X, Y;
public:
inline Vector(const double x, const double y);
C x() const
{
return X;
}
C y() const
{
return Y;
}
friend Vector<C> operator+ <C>(const Vector<C>& v1, const Vector<C>& v2);
friend std::ostream& operator<<(std::ostream& os, const Vector<C>& v)
{
os << v.X << '\t' << v.Y << '\n';
return os;
}
};
template<class C>
inline Vector<C>::Vector(const double x, const double y)
{
X = x;
Y = y;
}
template<class C>
inline Vector<C> operator+(const Vector<C>& v1, const Vector<C>& v2)
{
return Vector<C>(v1.X+v2.X, v1.Y+v2.Y);
}

View file

@ -1,100 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright held by original author
\\/ 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Application
FixedListTest
Description
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "IOstreams.H"
#include "FixedList.H"
#include "IFstream.H"
#include "OFstream.H"
#include "IPstream.H"
#include "OPstream.H"
using namespace Foam;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Main program:
int main(int argc, char *argv[])
{
argList::validArgs.clear();
argList args(argc, argv);
FixedList<label, 4> list;
list[0] = 1;
list[1] = 2;
list[2] = 3;
list[3] = 4;
Info<< list << endl;
label a[4] = {0, 1, 2, 3};
FixedList<label, 4> list2(a);
Info<< list2 << endl;
Info<< FixedList<label, 4>::Hash<>()(list2) << endl;
//FixedList<label, 3> hmm(Sin);
//Info<< hmm << endl;
if (Pstream::parRun())
{
if (Pstream::myProcNo() != Pstream::masterNo())
{
Serr<< "slave sending to master "
<< Pstream::masterNo() << endl;
OPstream toMaster(Pstream::blocking, Pstream::masterNo(), IOstream::ASCII);
FixedList<label, 2> list3;
list3[0] = 0;
list3[1] = 1;
toMaster << list3;
}
else
{
for
(
int slave=Pstream::firstSlave();
slave<=Pstream::lastSlave();
slave++
)
{
Serr << "master receiving from slave " << slave << endl;
IPstream fromSlave(Pstream::blocking, slave, IOstream::ASCII);
FixedList<label, 2> list3(fromSlave);
Serr<< list3 << endl;
}
}
}
return 0;
}
// ************************************************************************* //

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,116 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright held by original author
\\/ 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include <iostream>
#include "HashTable.H"
using namespace Foam;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Main program:
int main()
{
//for (;;)
{
HashTable<double> myTable(100);
myTable.insert("aaa", 1.0);
myTable.insert("aba", 2.0);
myTable.insert("aca", 3.0);
myTable.insert("ada", 4.0);
myTable.insert("aeq", 5.0);
myTable.insert("aaw", 6.0);
myTable.insert("abs", 7.0);
myTable.insert("acr", 8.0);
myTable.insert("adx", 9.0);
myTable.insert("aec", 10.0);
myTable.erase("aaw");
myTable.erase("abs");
std::cerr << myTable.find("aaa")() << '\n';
std::cerr << myTable.find("aba")() << '\n';
std::cerr << myTable.find("aca")() << '\n';
std::cerr << myTable.find("ada")() << '\n';
std::cerr << myTable.find("aeq")() << '\n';
//std::cerr << myTable.find("aaw")() << '\n';
//std::cerr << myTable.find("abs")() << '\n';
std::cerr << myTable.find("acr")() << '\n';
std::cerr << myTable.find("adx")() << '\n';
std::cerr << myTable.find("aec")() << '\n';
std::cerr << "\nprint table\n" << std::endl;
for
(
HashTable<double>::iterator iter = myTable.begin();
iter != myTable.end();
++iter
)
{
std::cerr << *iter << '\n';
}
std::cerr << "\nprint table\n" << std::endl;
forAllIter(HashTable<double>, myTable, iter)
{
std::cerr << *iter << '\n';
}
std::cerr << "\ncopy of table\n" << std::endl;
HashTable<double> myTable2;
myTable2 = myTable;
forAllConstIter(HashTable<double>, myTable2, iter2)
{
std::cerr << *iter2 << '\n';
}
std::cerr << "\ndelete entries\n" << std::endl;
forAllIter(HashTable<double>, myTable, iter)
{
std::cerr << "deleting " << *iter << '\n';
myTable.erase(iter);
std::cerr << "deleted\n";
}
forAllConstIter(HashTable<double>, myTable, iter)
{
std::cerr << *iter << '\n';
}
}
std::cerr << "\nBye.\n";
return 0;
}
// ************************************************************************* //

View file

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

View file

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

View file

@ -1,76 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright held by original author
\\/ 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
\*---------------------------------------------------------------------------*/
#include "HashTable.H"
#include "HashPtrTable.H"
using namespace Foam;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Main program:
int main(int argc, char *argv[])
{
HashTable<label, Foam::string> testTable(0);
testTable.insert("kjhk", 10);
testTable.insert("kjhk2", 12);
Info<< testTable << endl;
Info<< testTable.toc() << endl;
HashTable<label, label, Hash<label> > testTable2(10);
testTable2.insert(3, 10);
testTable2.insert(5, 12);
testTable2.insert(7, 16);
Info<< testTable2 << endl;
Info<< testTable2.toc() << endl;
HashTable<label, label, Hash<label> > testTable3(1);
testTable3.transfer(testTable2);
Info<< testTable2 << endl;
Info<< testTable2.toc() << endl;
Info<< testTable3 << endl;
Info<< testTable3.toc() << endl;
Foam::HashPtrTable<label, Foam::string> testPtrTable(0);
testPtrTable.insert("kjhkjh", new label(10));
Info<< testPtrTable.toc() << endl;
Info << "End\n" << endl;
return 0;
}
// ************************************************************************* //

View file

@ -1,107 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright held by original author
\\/ 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Application
Description
\*---------------------------------------------------------------------------*/
#include "OSspecific.H"
#include "IOstreams.H"
#include "ISLList.H"
using namespace Foam;
class Scalar
:
public ISLList<Scalar>::link
{
public:
scalar data_;
Scalar()
:
data_(0)
{}
Scalar(scalar s)
:
data_(s)
{}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Main program:
int main(int argc, char *argv[])
{
ISLList<Scalar> myList;
for (int i = 0; i<10; i++)
{
myList.append(new Scalar(1.3*i));
}
myList.append(new Scalar(100.3));
myList.append(new Scalar(500.3));
Info<< nl << "And again using STL iterator: " << nl << endl;
for
(
SLList<scalar>::iterator iter = myList.begin();
iter != myList.end();
++iter
)
{
Info<< "element:" << *iter << endl;
}
Info<< nl << "And again using STL const_iterator: " << nl << endl;
const ISLList<Scalar>& const_myList = myList;
for
(
SLList<scalar>::const_iterator iter2 = const_myList.begin();
iter2 != const_myList.end();
++iter2
)
{
Info<< "element:" << *iter2 << endl;
}
Info<< nl << "Bye." << endl;
return 0;
}
// ************************************************************************* //

View file

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

View file

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

View file

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

View file

@ -1,4 +0,0 @@
IndirectListTest.C
EXE = $(FOAM_USER_APPBIN)/IndirectListTest

View file

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

View file

@ -1,164 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright held by original author
\\/ 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "Time.H"
#include "fvMesh.H"
#include "volFields.H"
#include "LduMatrix.H"
#include "diagTensorField.H"
#include "TPCG.H"
#include "TPBiCG.H"
#include "NoPreconditioner.H"
using namespace Foam;
typedef Foam::LduMatrix<vector, diagTensor, scalar>
lduVectorMatrix;
defineNamedTemplateTypeNameAndDebug(lduVectorMatrix, 0);
typedef Foam::DiagonalSolver<vector, diagTensor, scalar>
lduVectorDiagonalSolver;
defineNamedTemplateTypeNameAndDebug(lduVectorDiagonalSolver, 0);
template<>
const vector lduVectorMatrix::great_(1e15, 1e15, 1e15);
template<>
const vector lduVectorMatrix::small_(1e-15, 1e-15, 1e-15);
namespace Foam
{
typedef LduMatrix<vector, diagTensor, scalar>::preconditioner
lduVectorPreconditioner;
defineTemplateRunTimeSelectionTable(lduVectorPreconditioner, symMatrix);
defineTemplateRunTimeSelectionTable(lduVectorPreconditioner, asymMatrix);
typedef LduMatrix<vector, diagTensor, scalar>::smoother
lduVectorSmoother;
defineTemplateRunTimeSelectionTable(lduVectorSmoother, symMatrix);
defineTemplateRunTimeSelectionTable(lduVectorSmoother, asymMatrix);
typedef LduMatrix<vector, diagTensor, scalar>::solver
lduVectorSolver;
defineTemplateRunTimeSelectionTable(lduVectorSolver, symMatrix);
defineTemplateRunTimeSelectionTable(lduVectorSolver, asymMatrix);
typedef TPCG<vector, diagTensor, scalar> TPCGVector;
defineNamedTemplateTypeNameAndDebug(TPCGVector, 0);
LduMatrix<vector, diagTensor, scalar>::solver::
addsymMatrixConstructorToTable<TPCGVector>
addTPCGSymMatrixConstructorToTable_;
typedef TPBiCG<vector, diagTensor, scalar> TPBiCGVector;
defineNamedTemplateTypeNameAndDebug(TPBiCGVector, 0);
LduMatrix<vector, diagTensor, scalar>::solver::
addasymMatrixConstructorToTable<TPBiCGVector>
addTPBiCGSymMatrixConstructorToTable_;
typedef NoPreconditioner<vector, diagTensor, scalar> NoPreconditionerVector;
defineNamedTemplateTypeNameAndDebug(NoPreconditionerVector, 0);
LduMatrix<vector, diagTensor, scalar>::preconditioner::
addsymMatrixConstructorToTable<NoPreconditionerVector>
addNoPreconditionerSymMatrixConstructorToTable_;
LduMatrix<vector, diagTensor, scalar>::preconditioner::
addasymMatrixConstructorToTable<NoPreconditionerVector>
addNoPreconditionerAsymMatrixConstructorToTable_;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Main program:
int main(int argc, char *argv[])
{
# include "setRootCase.H"
# include "createTime.H"
# include "createMesh.H"
volVectorField psi
(
IOobject
(
"U",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
lduVectorMatrix testMatrix(mesh);
testMatrix.diag() = 2*pTraits<diagTensor>::one;
testMatrix.source() = pTraits<vector>::one;
testMatrix.upper() = 0.1;
testMatrix.lower() = -0.1;
Info<< testMatrix << endl;
FieldField<Field, scalar> boundaryCoeffs(0);
FieldField<Field, scalar> internalCoeffs(0);
autoPtr<lduVectorMatrix::solver> testMatrixSolver =
lduVectorMatrix::solver::New
(
psi.name(),
testMatrix,
boundaryCoeffs,
internalCoeffs,
psi.boundaryField().interfaces(),
IStringStream
(
"PBiCG"
"{"
" preconditioner none;"
" tolerance (1e-05 1e-05 1e-05);"
" relTol (0 0 0);"
"}"
)()
);
lduVectorMatrix::solverPerformance solverPerf =
testMatrixSolver->solve(psi);
solverPerf.print();
Info<< psi << endl;
Info << "End\n" << endl;
return 0;
}
// ************************************************************************* //

View file

@ -1,164 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright held by original author
\\/ 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "Time.H"
#include "fvMesh.H"
#include "volFields.H"
#include "LduMatrix.H"
#include "tensorField.H"
#include "TPCG.H"
#include "TPBiCG.H"
#include "NoPreconditioner.H"
using namespace Foam;
typedef Foam::LduMatrix<vector, tensor, scalar>
lduVectorMatrix;
defineNamedTemplateTypeNameAndDebug(lduVectorMatrix, 0);
typedef Foam::DiagonalSolver<vector, tensor, scalar>
lduVectorDiagonalSolver;
defineNamedTemplateTypeNameAndDebug(lduVectorDiagonalSolver, 0);
template<>
const vector lduVectorMatrix::great_(1e15, 1e15, 1e15);
template<>
const vector lduVectorMatrix::small_(1e-15, 1e-15, 1e-15);
namespace Foam
{
typedef LduMatrix<vector, tensor, scalar>::preconditioner
lduVectorPreconditioner;
defineTemplateRunTimeSelectionTable(lduVectorPreconditioner, symMatrix);
defineTemplateRunTimeSelectionTable(lduVectorPreconditioner, asymMatrix);
typedef LduMatrix<vector, tensor, scalar>::smoother
lduVectorSmoother;
defineTemplateRunTimeSelectionTable(lduVectorSmoother, symMatrix);
defineTemplateRunTimeSelectionTable(lduVectorSmoother, asymMatrix);
typedef LduMatrix<vector, tensor, scalar>::solver
lduVectorSolver;
defineTemplateRunTimeSelectionTable(lduVectorSolver, symMatrix);
defineTemplateRunTimeSelectionTable(lduVectorSolver, asymMatrix);
typedef TPCG<vector, tensor, scalar> TPCGVector;
defineNamedTemplateTypeNameAndDebug(TPCGVector, 0);
LduMatrix<vector, tensor, scalar>::solver::
addsymMatrixConstructorToTable<TPCGVector>
addTPCGSymMatrixConstructorToTable_;
typedef TPBiCG<vector, tensor, scalar> TPBiCGVector;
defineNamedTemplateTypeNameAndDebug(TPBiCGVector, 0);
LduMatrix<vector, tensor, scalar>::solver::
addasymMatrixConstructorToTable<TPBiCGVector>
addTPBiCGSymMatrixConstructorToTable_;
typedef NoPreconditioner<vector, tensor, scalar> NoPreconditionerVector;
defineNamedTemplateTypeNameAndDebug(NoPreconditionerVector, 0);
LduMatrix<vector, tensor, scalar>::preconditioner::
addsymMatrixConstructorToTable<NoPreconditionerVector>
addNoPreconditionerSymMatrixConstructorToTable_;
LduMatrix<vector, tensor, scalar>::preconditioner::
addasymMatrixConstructorToTable<NoPreconditionerVector>
addNoPreconditionerAsymMatrixConstructorToTable_;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Main program:
int main(int argc, char *argv[])
{
# include "setRootCase.H"
# include "createTime.H"
# include "createMesh.H"
volVectorField psi
(
IOobject
(
"U",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
lduVectorMatrix testMatrix(mesh);
testMatrix.diag() = 2*I;
testMatrix.source() = pTraits<vector>::one;
testMatrix.upper() = 0.1;
testMatrix.lower() = -0.1;
Info<< testMatrix << endl;
FieldField<Field, scalar> boundaryCoeffs(0);
FieldField<Field, scalar> internalCoeffs(0);
autoPtr<lduVectorMatrix::solver> testMatrixSolver =
lduVectorMatrix::solver::New
(
psi.name(),
testMatrix,
//boundaryCoeffs,
//internalCoeffs,
//psi.boundaryField().interfaces(),
IStringStream
(
"PBiCG"
"{"
" preconditioner none;"
" tolerance (1e-05 1e-05 1e-05);"
" relTol (0 0 0);"
"}"
)()
);
lduVectorMatrix::solverPerformance solverPerf =
testMatrixSolver->solve(psi);
solverPerf.print();
Info<< psi << endl;
Info << "End\n" << endl;
return 0;
}
// ************************************************************************* //

View file

@ -1,149 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright held by original author
\\/ 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Application
icoFoam
Description
Transient solver for incompressible, laminar flow of Newtonian fluids.
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
#include "LduMatrix.H"
#include "diagTensorField.H"
typedef LduMatrix<vector, scalar, scalar> lduVectorMatrix;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int main(int argc, char *argv[])
{
# include "setRootCase.H"
# include "createTime.H"
# include "createMesh.H"
# include "createFields.H"
# include "initContinuityErrs.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info<< "\nStarting time loop\n" << endl;
for (runTime++; !runTime.end(); runTime++)
{
Info<< "Time = " << runTime.timeName() << nl << endl;
# include "readPISOControls.H"
# include "CourantNo.H"
fvVectorMatrix UEqn
(
fvm::ddt(U)
+ fvm::div(phi, U)
- fvm::laplacian(nu, U)
);
fvVectorMatrix UEqnp(UEqn == -fvc::grad(p));
lduVectorMatrix U3Eqnp(mesh);
U3Eqnp.diag() = UEqnp.diag();
U3Eqnp.upper() = UEqnp.upper();
U3Eqnp.lower() = UEqnp.lower();
U3Eqnp.source() = UEqnp.source();
UEqnp.addBoundaryDiag(U3Eqnp.diag(), 0);
UEqnp.addBoundarySource(U3Eqnp.source(), false);
autoPtr<lduVectorMatrix::solver> U3EqnpSolver =
lduVectorMatrix::solver::New
(
U.name(),
U3Eqnp,
dictionary
(
IStringStream
(
"{"
" solver PBiCG;"
" preconditioner DILU;"
" tolerance (1e-13 1e-13 1e-13);"
" relTol (0 0 0);"
"}"
)()
)
);
U3EqnpSolver->solve(U).print(Info);
// --- PISO loop
for (int corr=0; corr<nCorr; corr++)
{
volScalarField rUA = 1.0/UEqn.A();
U = rUA*UEqn.H();
phi = (fvc::interpolate(U) & mesh.Sf())
+ fvc::ddtPhiCorr(rUA, U, phi);
adjustPhi(phi, U, p);
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{
fvScalarMatrix pEqn
(
fvm::laplacian(rUA, p) == fvc::div(phi)
);
pEqn.setReference(pRefCell, pRefValue);
pEqn.solve();
if (nonOrth == nNonOrthCorr)
{
phi -= pEqn.flux();
}
}
# include "continuityErrs.H"
U -= rUA*fvc::grad(p);
U.correctBoundaryConditions();
}
runTime.write();
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
<< nl << endl;
}
Info<< "End\n" << endl;
return(0);
}
// ************************************************************************* //

View file

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

View file

@ -1,4 +0,0 @@
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude
EXE_LIBS = -lfiniteVolume

View file

@ -1,56 +0,0 @@
Info<< "Reading transportProperties\n" << endl;
IOdictionary transportProperties
(
IOobject
(
"transportProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
)
);
dimensionedScalar nu
(
transportProperties.lookup("nu")
);
Info<< "Reading field p\n" << endl;
volScalarField p
(
IOobject
(
"p",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
Info<< "Reading field U\n" << endl;
volVectorField U
(
IOobject
(
"U",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
# include "createPhi.H"
label pRefCell = 0;
scalar pRefValue = 0.0;
setRefCell(p, mesh.solutionDict().subDict("PISO"), pRefCell, pRefValue);

View file

@ -1,18 +0,0 @@
#include "List.H"
#include "scalar.H"
using namespace Foam;
void func
(
List<scalar>& l1,
const List<scalar>& l2,
const List<label>& a1,
const List<label>& a2
)
{
forAll(l1, i)
{
l1[a1[i]] -= l2[a2[i]];
}
}

View file

@ -1,224 +0,0 @@
.file "ListLoop.C"
.section .ctors,"aw",@progbits
.align 4
.long _GLOBAL__I__Z4funcRN4Foam4ListIdEERKS1_RKNS0_IiEES7_
.text
.align 2
.p2align 4,,15
.type _Z41__static_initialization_and_destruction_0ii, @function
_Z41__static_initialization_and_destruction_0ii:
.LFB2550:
pushl %ebp
.LCFI0:
movl %esp, %ebp
.LCFI1:
pushl %ebx
.LCFI2:
call __i686.get_pc_thunk.bx
addl $_GLOBAL_OFFSET_TABLE_, %ebx
subl $20, %esp
.LCFI3:
decl %eax
je .L7
.L5:
addl $20, %esp
popl %ebx
leave
ret
.p2align 4,,7
.L7:
cmpl $65535, %edx
jne .L5
leal _ZSt8__ioinit@GOTOFF(%ebx), %eax
movl %eax, (%esp)
call _ZNSt8ios_base4InitC1Ev@PLT
movl __dso_handle@GOT(%ebx), %eax
movl $0, 4(%esp)
movl %eax, 8(%esp)
leal __tcf_0@GOTOFF(%ebx), %eax
movl %eax, (%esp)
call __cxa_atexit@PLT
addl $20, %esp
popl %ebx
leave
ret
.LFE2550:
.size _Z41__static_initialization_and_destruction_0ii, .-_Z41__static_initialization_and_destruction_0ii
.globl __gxx_personality_v0
.align 2
.p2align 4,,15
.type _GLOBAL__I__Z4funcRN4Foam4ListIdEERKS1_RKNS0_IiEES7_, @function
_GLOBAL__I__Z4funcRN4Foam4ListIdEERKS1_RKNS0_IiEES7_:
.LFB2552:
pushl %ebp
.LCFI4:
movl $65535, %edx
movl $1, %eax
movl %esp, %ebp
.LCFI5:
leave
jmp _Z41__static_initialization_and_destruction_0ii
.LFE2552:
.size _GLOBAL__I__Z4funcRN4Foam4ListIdEERKS1_RKNS0_IiEES7_, .-_GLOBAL__I__Z4funcRN4Foam4ListIdEERKS1_RKNS0_IiEES7_
.align 2
.p2align 4,,15
.type __tcf_0, @function
__tcf_0:
.LFB2551:
pushl %ebp
.LCFI6:
movl %esp, %ebp
.LCFI7:
pushl %ebx
.LCFI8:
call __i686.get_pc_thunk.bx
addl $_GLOBAL_OFFSET_TABLE_, %ebx
subl $4, %esp
.LCFI9:
leal _ZSt8__ioinit@GOTOFF(%ebx), %eax
movl %eax, (%esp)
call _ZNSt8ios_base4InitD1Ev@PLT
addl $4, %esp
popl %ebx
leave
ret
.LFE2551:
.size __tcf_0, .-__tcf_0
.align 2
.p2align 4,,15
.globl _Z4funcRN4Foam4ListIdEERKS1_RKNS0_IiEES7_
.type _Z4funcRN4Foam4ListIdEERKS1_RKNS0_IiEES7_, @function
_Z4funcRN4Foam4ListIdEERKS1_RKNS0_IiEES7_:
.LFB2352:
pushl %ebp
.LCFI10:
movl %esp, %ebp
.LCFI11:
pushl %edi
.LCFI12:
pushl %esi
.LCFI13:
subl $12, %esp
.LCFI14:
movl 8(%ebp), %edx
movl (%edx), %eax
testl %eax, %eax
movl %eax, -20(%ebp)
jle .L16
movl 16(%ebp), %eax
movl 4(%edx), %edx
xorl %ecx, %ecx
movl 4(%eax), %eax
movl %edx, -12(%ebp)
movl %eax, -16(%ebp)
movl 20(%ebp), %eax
movl 4(%eax), %edi
movl 12(%ebp), %eax
movl 4(%eax), %esi
.p2align 4,,7
.L15:
movl -16(%ebp), %edx
movl (%edx,%ecx,4), %eax
movl -12(%ebp), %edx
leal (%edx,%eax,8), %eax
movl (%edi,%ecx,4), %edx
incl %ecx
cmpl %ecx, -20(%ebp)
fldl (%eax)
fsubl (%esi,%edx,8)
fstpl (%eax)
jne .L15
.L16:
addl $12, %esp
popl %esi
popl %edi
leave
ret
.LFE2352:
.size _Z4funcRN4Foam4ListIdEERKS1_RKNS0_IiEES7_, .-_Z4funcRN4Foam4ListIdEERKS1_RKNS0_IiEES7_
.local _ZSt8__ioinit
.comm _ZSt8__ioinit,1,1
.section .eh_frame,"a",@progbits
.Lframe1:
.long .LECIE1-.LSCIE1
.LSCIE1:
.long 0x0
.byte 0x1
.string "zPR"
.uleb128 0x1
.sleb128 -4
.byte 0x8
.uleb128 0x6
.byte 0x9b
.long DW.ref.__gxx_personality_v0-.
.byte 0x1b
.byte 0xc
.uleb128 0x4
.uleb128 0x4
.byte 0x88
.uleb128 0x1
.align 4
.LECIE1:
.LSFDE1:
.long .LEFDE1-.LASFDE1
.LASFDE1:
.long .LASFDE1-.Lframe1
.long .LFB2550-.
.long .LFE2550-.LFB2550
.uleb128 0x0
.byte 0x4
.long .LCFI0-.LFB2550
.byte 0xe
.uleb128 0x8
.byte 0x85
.uleb128 0x2
.byte 0x4
.long .LCFI1-.LCFI0
.byte 0xd
.uleb128 0x5
.byte 0x4
.long .LCFI2-.LCFI1
.byte 0x83
.uleb128 0x3
.align 4
.LEFDE1:
.LSFDE5:
.long .LEFDE5-.LASFDE5
.LASFDE5:
.long .LASFDE5-.Lframe1
.long .LFB2551-.
.long .LFE2551-.LFB2551
.uleb128 0x0
.byte 0x4
.long .LCFI6-.LFB2551
.byte 0xe
.uleb128 0x8
.byte 0x85
.uleb128 0x2
.byte 0x4
.long .LCFI7-.LCFI6
.byte 0xd
.uleb128 0x5
.byte 0x4
.long .LCFI8-.LCFI7
.byte 0x83
.uleb128 0x3
.align 4
.LEFDE5:
.hidden DW.ref.__gxx_personality_v0
.weak DW.ref.__gxx_personality_v0
.section .data.DW.ref.__gxx_personality_v0,"awG",@progbits,DW.ref.__gxx_personality_v0,comdat
.align 4
.type DW.ref.__gxx_personality_v0, @object
.size DW.ref.__gxx_personality_v0, 4
DW.ref.__gxx_personality_v0:
.long __gxx_personality_v0
.ident "GCC: (GNU) 4.1.1"
.section .text.__i686.get_pc_thunk.bx,"axG",@progbits,__i686.get_pc_thunk.bx,comdat
.globl __i686.get_pc_thunk.bx
.hidden __i686.get_pc_thunk.bx
.type __i686.get_pc_thunk.bx, @function
__i686.get_pc_thunk.bx:
movl (%esp), %ebx
ret
.section .note.GNU-stack,"",@progbits

View file

@ -1,4 +0,0 @@
ListTest.C
ListLoop.C
EXE = $(FOAM_USER_APPBIN)/ListTest

View file

@ -1,4 +0,0 @@
MapTest.C
EXE = $(FOAM_USER_APPBIN)/MapTest

View file

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

View file

@ -1,86 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright held by original author
\\/ 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Application
testMapIterators
Description
For each time calculate the magnitude of velocity.
\*---------------------------------------------------------------------------*/
#include "Map.H"
#include <map>
#include "IOstreams.H"
using namespace Foam;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int main(int argc, char *argv[])
{
Map<bool> banana;
banana.insert(5, true);
// Taking a const iterator from find does not work!
// Also, fails later on op==
Map<bool>::const_iterator bananaIter = banana.find(5);
// This works but now I can change the value.
//Map<bool>::iterator bananaIter = banana.find(5);
if (bananaIter == banana.end())
{
Info << "not found" << endl;
}
else
{
Info << "5 is " << bananaIter() << endl;
}
// Same with STL
Info << "Same with STL" << endl;
std::map<label, bool> STLbanana;
STLbanana[5] = true;
std::map<label, bool>::const_iterator STLbananaIter = STLbanana.find(5);
if (STLbananaIter == STLbanana.end())
{
Info << "not found" << endl;
}
else
{
Info << "5 is " << STLbananaIter->second << endl;
}
Info<< "End\n" << endl;
return(0);
}
// ************************************************************************* //

View file

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

View file

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

View file

@ -1,4 +0,0 @@
namedEnumTest.C
EXE = $(FOAM_APPBIN)/NamedEnum

View file

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

View file

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

View file

@ -1,3 +0,0 @@
EXE_INC = -I$(LIB_SRC)/ODE/lnInclude
EXE_LIBS = -lODE

View file

@ -1,176 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright held by original author
\\/ 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "IOmanip.H"
#include "ODE.H"
#include "ODESolver.H"
#include "RK.H"
using namespace Foam;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
class testODE
:
public ODE
{
public:
testODE()
{}
label nEqns() const
{
return 4;
}
void derivatives
(
const scalar x,
const scalarField& y,
scalarField& dydx
) const
{
dydx[0] = -y[1];
dydx[1] = y[0] - (1.0/x)*y[1];
dydx[2] = y[1] - (2.0/x)*y[2];
dydx[3] = y[2] - (3.0/x)*y[3];
}
void jacobian
(
const scalar x,
const scalarField& y,
scalarField& dfdx,
Matrix<scalar>& dfdy
) const
{
dfdx[0] = 0.0;
dfdx[1] = (1.0/sqr(x))*y[1];
dfdx[2] = (2.0/sqr(x))*y[2];
dfdx[3] = (3.0/sqr(x))*y[3];
dfdy[0][0] = 0.0;
dfdy[0][1] = -1.0;
dfdy[0][2] = 0.0;
dfdy[0][3] = 0.0;
dfdy[1][0] = 1.0;
dfdy[1][1] = -1.0/x;
dfdy[1][2] = 0.0;
dfdy[1][3] = 0.0;
dfdy[2][0] = 0.0;
dfdy[2][1] = 1.0;
dfdy[2][2] = -2.0/x;
dfdy[2][3] = 0.0;
dfdy[3][0] = 0.0;
dfdy[3][1] = 0.0;
dfdy[3][2] = 1.0;
dfdy[3][3] = -3.0/x;
}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Main program:
int main(int argc, char *argv[])
{
argList::validArgs.clear();
argList::validArgs.append("ODESolver");
argList args(argc, argv);
word ODESolverName(args.additionalArgs()[0]);
testODE ode;
autoPtr<ODESolver> odeSolver = ODESolver::New(ODESolverName, ode);
scalar xStart = 1.0;
scalarField yStart(ode.nEqns());
yStart[0] = ::Foam::j0(xStart);
yStart[1] = ::Foam::j1(xStart);
yStart[2] = ::Foam::jn(2, xStart);
yStart[3] = ::Foam::jn(3, xStart);
scalarField dyStart(ode.nEqns());
ode.derivatives(xStart, yStart, dyStart);
Info<< setw(10) << "eps" << setw(12) << "hEst";
Info<< setw(13) << "hDid" << setw(14) << "hNext" << endl;
Info<< setprecision(6);
for (label i=0; i<15; i++)
{
scalar eps = ::Foam::exp(-scalar(i + 1));
scalar x = xStart;
scalarField y = yStart;
scalarField dydx = dyStart;
scalarField yScale(ode.nEqns(), 1.0);
scalar hEst = 0.6;
scalar hDid, hNext;
odeSolver->solve(ode, x, y, dydx, eps, yScale, hEst, hDid, hNext);
Info<< scientific << setw(13) << eps;
Info<< fixed << setw(11) << hEst;
Info<< setw(13) << hDid << setw(13) << hNext
<< setw(13) << y[0] << setw(13) << y[1]
<< setw(13) << y[2] << setw(13) << y[3]
<< endl;
}
scalar x = xStart;
scalar xEnd = x + 1.0;
scalarField y = yStart;
scalarField yEnd(ode.nEqns());
yEnd[0] = ::Foam::j0(xEnd);
yEnd[1] = ::Foam::j1(xEnd);
yEnd[2] = ::Foam::jn(2, xEnd);
yEnd[3] = ::Foam::jn(3, xEnd);
scalar hEst = 0.5;
odeSolver->solve(ode, x, xEnd, y, 1e-4, hEst);
Info<< nl << "Analytical: y(2.0) = " << yEnd << endl;
Info << "Numerical: y(2.0) = " << y << ", hEst = " << hEst << endl;
Info << "\nEnd\n" << endl;
return 0;
}
// ************************************************************************* //

View file

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

View file

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

View file

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

View file

@ -1,107 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright held by original author
\\/ 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Application
Description
\*---------------------------------------------------------------------------*/
#include "OSspecific.H"
#include "IOstreams.H"
#include "SLList.H"
using namespace Foam;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Main program:
int main(int argc, char *argv[])
{
SLList<scalar> myList;
for (int i = 0; i<10; i++)
{
myList.append(1.3*i);
}
myList.append(100.3);
myList.append(500.3);
Info<< nl << "And again using STL iterator: " << nl << endl;
for
(
SLList<scalar>::iterator iter = myList.begin();
iter != myList.end();
++iter
)
{
Info<< "element:" << *iter << endl;
}
Info<< nl << "And again using STL const_iterator: " << nl << endl;
const SLList<scalar>& const_myList = myList;
for
(
SLList<scalar>::const_iterator iter2 = const_myList.begin();
iter2 != const_myList.end();
++iter2
)
{
Info<< "element:" << *iter2 << endl;
}
for
(
SLList<scalar>::iterator iter = myList.begin();
iter != myList.end();
++iter
)
{
Info<< "Removing element:" << *iter << endl;
myList.remove(iter);
}
for
(
SLList<scalar>::const_iterator iter2 = const_myList.begin();
iter2 != const_myList.end();
++iter2
)
{
Info<< "element:" << *iter2 << endl;
}
Info<< nl << "Bye." << endl;
return 0;
}
// ************************************************************************* //

View file

@ -1,140 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright held by original author
\\/ 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
\*---------------------------------------------------------------------------*/
#include <iostream>
#include "StaticHashTable.H"
#include "IOstreams.H"
#include "IStringStream.H"
#include "OStringStream.H"
using namespace Foam;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Main program:
int main()
{
//for (;;)
{
StaticHashTable<double> myTable(10);
myTable.insert("aaa", 1.0);
myTable.insert("aba", 2.0);
myTable.insert("aca", 3.0);
myTable.insert("ada", 4.0);
myTable.insert("aeq", 5.0);
myTable.insert("aaw", 6.0);
myTable.insert("abs", 7.0);
myTable.insert("acr", 8.0);
myTable.insert("adx", 9.0);
myTable.insert("aec", 10.0);
Pout<< "Foam output operator:" << nl << endl;
Pout<< myTable << endl;
//myTable.erase("aaw");
//myTable.erase("abs");
//std::cerr << "Size now:" << myTable.size() << '\n';
Pout<< "toc:" << nl << endl;
Pout<< myTable.toc() << endl;
std::cerr << myTable.find("aaa")() << '\n';
std::cerr << myTable.find("aba")() << '\n';
std::cerr << myTable.find("aca")() << '\n';
std::cerr << myTable.find("ada")() << '\n';
std::cerr << myTable.find("aeq")() << '\n';
std::cerr << myTable.find("aaw")() << '\n';
std::cerr << myTable.find("abs")() << '\n';
std::cerr << myTable.find("acr")() << '\n';
std::cerr << myTable.find("adx")() << '\n';
std::cerr << myTable.find("aec")() << '\n';
std::cerr << myTable["aaa"] << '\n';
{
OStringStream os;
os << myTable;
IStringStream is(os.str());
Pout<< "Foam Istream constructor:" << nl << endl;
StaticHashTable<double> readTable(is, 100);
Pout<< readTable << endl;
}
std::cerr << "\ncopy construct of table\n" << std::endl;
StaticHashTable<double> myTable1(myTable);
Pout<< "myTable1:" << myTable1 << endl;
std::cerr << "\nassignment of table\n" << std::endl;
StaticHashTable<double> myTable2(100);
myTable2.transfer(myTable);
//Pout<< "myTable:" << myTable << endl;
forAllConstIter(StaticHashTable<double>, myTable2, iter2)
{
std::cerr << *iter2 << '\n';
}
std::cerr << "\ntable resize 1\n" << std::endl;
myTable2.resize(1);
forAllConstIter(StaticHashTable<double>, myTable2, iter2)
{
std::cerr << *iter2 << '\n';
}
std::cerr << "\ntable size 10000\n" << std::endl;
myTable2.resize(10000);
forAllConstIter(StaticHashTable<double>, myTable2, iter2)
{
std::cerr << *iter2 << '\n';
}
}
std::cerr << "\nBye.\n";
return 0;
}
// ************************************************************************* //

View file

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

View file

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

View file

@ -1,121 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright held by original author
\\/ 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Application
Description
\*---------------------------------------------------------------------------*/
#include "OSspecific.H"
#include "IOstreams.H"
#include "UDictionary.H"
using namespace Foam;
class ent
:
public UDictionary<ent>::link
{
word keyword_;
int i_;
public:
ent(const word& keyword, int i)
:
keyword_(keyword),
i_(i)
{}
const word& keyword() const
{
return keyword_;
}
friend Ostream& operator<<(Ostream& os, const ent& e)
{
os << e.keyword_ << ' ' << e.i_ << endl;
return os;
}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Main program:
int main(int argc, char *argv[])
{
UDictionary<ent>* dictPtr = new UDictionary<ent>;
UDictionary<ent>& dict = *dictPtr;
for (int i = 0; i<10; i++)
{
ent* ePtr = new ent(word("ent") + name(i), i);
dict.append(ePtr->keyword(), ePtr);
dict.swapUp(ePtr);
}
Info<< dict << endl;
dict.swapDown(dict.first());
for
(
UDictionary<ent>::const_iterator iter = dict.begin();
iter != dict.end();
++iter
)
{
Info<< "element : " << *iter;
}
Info<< dict.toc() << endl;
delete dictPtr;
dictPtr = new UDictionary<ent>;
UDictionary<ent>& dict2 = *dictPtr;
for (int i = 0; i<10; i++)
{
ent* ePtr = new ent(word("ent") + name(i), i);
dict2.append(ePtr->keyword(), ePtr);
dict2.swapUp(ePtr);
}
Info<< dict2 << endl;
dict2.remove("ent9");
dict2.UILList<DLListBase, ent>::remove(dict2.first());
Info<< dict2 << endl;
Info<< nl << "Bye." << endl;
return 0;
}
// ************************************************************************* //

View file

@ -1,2 +0,0 @@
UnixTest.C
EXE = $(FOAM_USER_APPBIN)/UnixTest

View file

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

View file

@ -1,8 +0,0 @@
allocTest.C
/*
newTest.C
mallocTest.C
test.C
*/
SEXE = $(FOAM_USER_APPBIN)/allocTest

View file

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

View file

@ -1,27 +0,0 @@
#include <iostream>
#include <unistd.h>
using namespace std;
int main()
{
int *ptrs[500000];
// for (;;);
cerr << "allocating ints\n";
for (int i=0; i<500000; i++)
{
ptrs[i] = new int[1];
delete[] ptrs[i];
}
for (;;);
cerr << "allocating double\n";
double* array = new double[500000];
for (;;);
}

View file

@ -1,30 +0,0 @@
#include "stream.h"
#include <unistd.h>
#include <stdlib.h>
main()
{
int *ptrs[500000];
cerr << "allocating ints\n";
for (int i=0; i<500000; i++)
{
ptrs[i] = (int*)malloc(sizeof(int));
}
// for (;;);
cerr << "deallocating ints\n";
for (i=0; i<500000; i++)
{
free(ptrs[i]);
}
cerr << "allocating double\n";
double* array = (double*)malloc(500000*sizeof(double));
for (;;);
}

View file

@ -1,30 +0,0 @@
#include <stream.h>
main()
{
int* intPtrs[500000];
cerr << "allocating ints\n";
for (int i=0; i<500000; i++)
{
intPtrs[i] = new int[1];
}
cerr << "allocated ints\n";
cerr << "deallocating ints\n";
for (i=0; i<500000; i++)
{
delete[] intPtrs[i];
}
cerr << "deallocated ints\n";
cerr << "alloacting doubles\n";
double* doubles = new double[500000];
for (;;);
}

View file

@ -1,64 +0,0 @@
#include <stdlib.h>
class Int
{
int I;
public:
Int(){}
operator int()
{
return I;
}
};
template<class T>
class List : public T
{
T* v;
int sz;
public:
List()
{
v = new T[sz=10];
}
List(int s)
{
v = new T[sz=s];
}
~List()
{
delete[] v;
}
inline int size() const;
};
template<class T>
inline int List<T>::size() const
{
return sz;
}
#include <stream.h>
main()
{
typedef List<Int> intList;
intList list(10);
cout << list.size() << "\n";
return 0;
}

View file

@ -1,3 +0,0 @@
callbackTest.C
EXE = $(FOAM_APPBIN)/callbackTest

View file

@ -1,127 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright held by original author
\\/ 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Application
callBackTest
Description
\*---------------------------------------------------------------------------*/
#include "Callback.H"
using namespace Foam;
class callback
:
public Callback<callback>
{
public:
callback(CallbackRegistry<callback>& cbr)
:
Callback<callback>(cbr)
{}
~callback()
{}
virtual const word& name() const = 0;
void testCallbackFunction() const
{
Info<< "calling testCallbackFunction for object " << name() << endl;
}
};
class callbackRegistry
:
public CallbackRegistry<callback>
{
public:
callbackRegistry()
{}
~callbackRegistry()
{}
void testCallbackFunction() const
{
forAllConstIter(callbackRegistry, *this, iter)
{
iter().testCallbackFunction();
}
}
};
class objectWithCallback
:
public callback
{
word name_;
public:
objectWithCallback(const word& n, callbackRegistry& cbr)
:
callback(cbr),
name_(n)
{}
virtual const word& name() const
{
return name_;
}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Main program:
int main(int argc, char *argv[])
{
callbackRegistry cbr;
objectWithCallback ob1("ob1", cbr);
objectWithCallback ob2("ob2", cbr);
cbr.testCallbackFunction();
{
objectWithCallback ob1("ob1", cbr);
cbr.testCallbackFunction();
}
cbr.testCallbackFunction();
Info << "End\n" << endl;
return 0;
}
// ************************************************************************* //

View file

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

View file

@ -1,5 +0,0 @@
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude
EXE_LIBS = \
-lfiniteVolume

View file

@ -1,27 +0,0 @@
Info<< nl << "Reading field p" << endl;
volScalarField p
(
IOobject
(
"p",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
Info<< nl << "Reading field U" << endl;
volVectorField U
(
IOobject
(
"U",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);

View file

@ -1,3 +0,0 @@
testDataEntry.C
EXE = $(FOAM_APPBIN)/testDataEntry

View file

@ -1,11 +0,0 @@
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/lagrangian/intermediate/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude
EXE_LIBS = \
-lfiniteVolume \
-llagrangianIntermediate \
-lradiation \
-lthermophysicalFunctions

View file

@ -1,4 +0,0 @@
testTable.C
EXE=$(FOAM_USER_APPBIN)/testTable

View file

@ -1,89 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright held by original author
\\/ 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Application
testDataEntry
Description
Tests lagrangian/intermediate/submodels/IO/DataEntry
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
#include "DataEntry.H"
#include "IOdictionary.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int main(int argc, char *argv[])
{
# include "setRootCase.H"
# include "createTime.H"
# include "createMesh.H"
IOdictionary dataEntryProperties
(
IOobject
(
"dataEntryProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
)
);
autoPtr<DataEntry<scalar> > dataEntry
(
DataEntry<scalar>::New
(
"dataEntry",
dataEntryProperties
)
);
scalar x0 = readScalar(dataEntryProperties.lookup("x0"));
scalar x1 = readScalar(dataEntryProperties.lookup("x1"));
Info<< "Data entry type: " << dataEntry().type() << nl << endl;
Info<< "Inputs" << nl
<< " x0 = " << x0 << nl
<< " x1 = " << x1 << nl
<< endl;
Info<< "Interpolation" << nl
<< " f(x0) = " << dataEntry().value(x0) << nl
<< " f(x1) = " << dataEntry().value(x1) << nl
<< endl;
Info<< "Integration" << nl
<< " int(f(x)) lim(x0->x1) = " << dataEntry().integrate(x0, x1) << nl
<< endl;
return(0);
}
// ************************************************************************* //

View file

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

View file

@ -1,4 +0,0 @@
calcEntry/calcEntry.C
dictionaryTest.C
EXE = $(FOAM_USER_APPBIN)/dictionaryTest

View file

@ -1,98 +0,0 @@
/*-------------------------------*- C++ -*---------------------------------*\
| ========= |
| \\ / OpenFOAM |
| \\ / |
| \\ / The Open Source CFD Toolbox |
| \\/ http://www.OpenFOAM.org |
\*-------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object testDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#inputMode merge
dimensions [ 0 2 -2 0 0 0 0 ];
internalField uniform 1;
active
{
type turbulentIntensityKineticEnergyInlet;
intensity 0.1;
value $internalField;
}
inactive
{
type zeroGradient;
}
boundaryField
{
Default_Boundary_Region
{
type zeroGradient;
}
inlet_1 { $active }
inlet_2 { $inactive }
inlet_3 { $inactive }
inlet_4 { $inactive }
inlet_5 "a primitiveEntry is squashed by a directory entry";
inlet_5 { $inactive }
inlet_6 { $inactive }
inlet_7 { $inactive }
inlet_8 { $inactive }
#include "testDictInc"
outlet
{
type inletOutlet;
inletValue $internalField;
value #include "value";
// error #remove self;
x 5;
y 6;
another #calc{x $x; y $y;};
}
// this should have no effect
#remove inactive
inlet_7 { $active }
#inputMode overwrite
inlet_8 { $active }
}
// NB: the inputMode has a global scope
#inputMode merge
#include "testDict2"
foo
{
$active
}
bar
{
$active
}
baz
{
$active
}
// this should work
#remove active
// this should work too
#remove ( bar baz )
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View file

@ -1,30 +0,0 @@
/*-------------------------------*- C++ -*---------------------------------*\
| ========= |
| \\ / OpenFOAM |
| \\ / |
| \\ / The Open Source CFD Toolbox |
| \\/ http://www.OpenFOAM.org |
\*-------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object testDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
boundaryField
{
Default_Boundary_Region
{
value $internalField;
note "actually a noslip wall";
}
inlet_3 "a primitiveEntry squashes directory entry";
}
#inputMode overwrite
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View file

@ -1,6 +0,0 @@
inlet_4
{
type inletOutlet;
inletValue $internalField;
value $internalField;
}

View file

@ -1,2 +0,0 @@
// the trailing ';' shouldn't actually be there, but shouldn't cause problems
uniform 2;

View file

@ -1,4 +0,0 @@
dimensionedTypeTest.C
EXE = $(FOAM_USER_APPBIN)/dimensionedType

View file

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

View file

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

View file

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

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