Merge branch 'master' of /home/noisy3/OpenFOAM/OpenFOAM-dev

Conflicts:
	src/OpenFOAM/containers/Lists/DynamicList/DynamicList.H
	src/postProcessing/functionObjects/field/fieldValues/cellSource/cellSource.C
	src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSource.C
This commit is contained in:
mattijs
2010-04-13 11:07:19 +01:00
960 changed files with 4013 additions and 5378 deletions

View File

@ -128,8 +128,7 @@ public:
); );
// Destructor //- Destructor
virtual ~basicSubGrid(); virtual ~basicSubGrid();

View File

@ -107,8 +107,7 @@ public:
); );
// Destructor //- Destructor
virtual ~basicSubGrid(); virtual ~basicSubGrid();

View File

@ -137,8 +137,7 @@ public:
); );
// Destructor //- Destructor
virtual ~PDRDragModel(); virtual ~PDRDragModel();

View File

@ -135,8 +135,7 @@ public:
); );
// Destructor //- Destructor
virtual ~basic(); virtual ~basic();

View File

@ -86,8 +86,7 @@ public:
); );
// Destructor //- Destructor
virtual ~Gulder(); virtual ~Gulder();

View File

@ -91,8 +91,7 @@ public:
); );
// Destructor //- Destructor
virtual ~SCOPEBlend(); virtual ~SCOPEBlend();

View File

@ -96,8 +96,7 @@ public:
); );
// Destructor //- Destructor
virtual ~SCOPEXiEq(); virtual ~SCOPEXiEq();

View File

@ -132,8 +132,7 @@ public:
); );
// Destructor //- Destructor
virtual ~XiEqModel(); virtual ~XiEqModel();

View File

@ -90,8 +90,7 @@ public:
); );
// Destructor //- Destructor
virtual ~instability(); virtual ~instability();

View File

@ -85,8 +85,7 @@ public:
); );
// Destructor //- Destructor
virtual ~KTS(); virtual ~KTS();

View File

@ -129,8 +129,7 @@ public:
); );
// Destructor //- Destructor
virtual ~XiGModel(); virtual ~XiGModel();

View File

@ -94,8 +94,7 @@ public:
); );
// Destructor //- Destructor
virtual ~instabilityG(); virtual ~instabilityG();

View File

@ -200,8 +200,7 @@ public:
); );
// Destructor //- Destructor
virtual ~XiModel(); virtual ~XiModel();

View File

@ -95,8 +95,7 @@ public:
); );
// Destructor //- Destructor
virtual ~algebraic(); virtual ~algebraic();

View File

@ -83,8 +83,7 @@ public:
); );
// Destructor //- Destructor
virtual ~fixed(); virtual ~fixed();

View File

@ -95,8 +95,7 @@ public:
); );
// Destructor //- Destructor
virtual ~transport(); virtual ~transport();

View File

@ -194,7 +194,7 @@ public:
); );
// Destructor //- Destructor
~SCOPE(); ~SCOPE();

View File

@ -88,8 +88,7 @@ public:
); );
// Destructor //- Destructor
virtual ~infinitelyFastChemistry(); virtual ~infinitelyFastChemistry();

View File

@ -83,8 +83,7 @@ public:
); );
// Destructor //- Destructor
virtual ~noCombustion(); virtual ~noCombustion();
// Member Functions // Member Functions

View File

@ -77,8 +77,7 @@ public:
regionProperties(const Time& runTime); regionProperties(const Time& runTime);
// Destructor //- Destructor
~regionProperties(); ~regionProperties();

View File

@ -94,8 +94,7 @@ public:
); );
// Destructor //- Destructor
~threePhaseMixture() ~threePhaseMixture()
{} {}

View File

@ -96,8 +96,7 @@ public:
); );
// Destructor //- Destructor
virtual ~Kunz() virtual ~Kunz()
{} {}

View File

@ -90,8 +90,7 @@ public:
); );
// Destructor //- Destructor
virtual ~Merkle() virtual ~Merkle()
{} {}

View File

@ -103,8 +103,7 @@ public:
); );
// Destructor //- Destructor
virtual ~SchnerrSauer() virtual ~SchnerrSauer()
{} {}

View File

@ -121,8 +121,7 @@ public:
); );
// Destructor //- Destructor
virtual ~phaseChangeTwoPhaseMixture() virtual ~phaseChangeTwoPhaseMixture()
{} {}

View File

@ -209,8 +209,7 @@ public:
); );
// Destructor //- Destructor
~multiphaseMixture() ~multiphaseMixture()
{} {}

View File

@ -51,12 +51,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;
for forAllIter(DLList<scalar>, myList, iter)
(
DLList<scalar>::iterator iter = myList.begin();
iter != myList.end();
++iter
)
{ {
Info<< "element:" << *iter << endl; Info<< "element:" << *iter << endl;
} }
@ -64,12 +59,7 @@ int main(int argc, char *argv[])
Info<< nl << "And again using the same STL iterator: " << nl << endl; Info<< nl << "And again using the same STL iterator: " << nl << endl;
for forAllIter(DLList<scalar>, myList, iter)
(
DLList<scalar>::iterator iter = myList.begin();
iter != myList.end();
++iter
)
{ {
Info<< "Removing " << myList.remove(iter) << endl; Info<< "Removing " << myList.remove(iter) << endl;
} }
@ -82,12 +72,7 @@ int main(int argc, char *argv[])
const DLList<scalar>& const_myList = myList; const DLList<scalar>& const_myList = myList;
for forAllConstIter(DLList<scalar>, const_myList, iter)
(
DLList<scalar>::const_iterator iter = const_myList.begin();
iter != const_myList.end();
++iter
)
{ {
Info<< "element:" << *iter << endl; Info<< "element:" << *iter << endl;
} }
@ -95,12 +80,7 @@ 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());
for forAllConstIter(DLList<scalar>, const_myList, iter)
(
DLList<scalar>::const_iterator iter = const_myList.begin();
iter != const_myList.end();
++iter
)
{ {
Info<< "element:" << *iter << endl; Info<< "element:" << *iter << endl;
} }
@ -108,19 +88,14 @@ 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());
for forAllConstIter(DLList<scalar>, const_myList, iter)
(
DLList<scalar>::const_iterator iter = const_myList.begin();
iter != const_myList.end();
++iter
)
{ {
Info<< "element:" << *iter << endl; Info<< "element:" << *iter << endl;
} }
Info<< nl << "Testing transfer: " << nl << endl; Info<< nl << "Testing transfer: " << nl << nl
Info<< "original: " << myList << endl; << "original: " << myList << endl;
DLList<scalar> newList; DLList<scalar> newList;
newList.transfer(myList); newList.transfer(myList);

View File

@ -114,12 +114,7 @@ int main(int argc, char *argv[])
dict.swapDown(dict.first()); dict.swapDown(dict.first());
for forAllConstIter(Dictionary<ent>, dict, iter)
(
Dictionary<ent>::const_iterator iter = dict.begin();
iter != dict.end();
++iter
)
{ {
Info<< "element : " << *iter; Info<< "element : " << *iter;
} }
@ -159,12 +154,7 @@ int main(int argc, char *argv[])
} }
Info<< nl << "scalarDict1: " << endl; Info<< nl << "scalarDict1: " << endl;
for forAllConstIter(PtrDictionary<Scalar>, scalarDict, iter)
(
PtrDictionary<Scalar>::const_iterator iter = scalarDict.begin();
iter != scalarDict.end();
++iter
)
{ {
Info<< " = " << iter() << endl; Info<< " = " << iter() << endl;
} }
@ -176,12 +166,7 @@ int main(int argc, char *argv[])
scalarDict2.insert(key, new Scalar(1.3*i)); scalarDict2.insert(key, new Scalar(1.3*i));
} }
Info<< nl << "scalarDict2: " << endl; Info<< nl << "scalarDict2: " << endl;
for forAllConstIter(PtrDictionary<Scalar>, scalarDict2, iter)
(
PtrDictionary<Scalar>::const_iterator iter = scalarDict2.begin();
iter != scalarDict2.end();
++iter
)
{ {
Info<< "elem = " << *iter << endl; Info<< "elem = " << *iter << endl;
} }

View File

@ -78,12 +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;
for forAllIter(SLList<scalar>, myList, iter)
(
SLList<scalar>::iterator iter = myList.begin();
iter != myList.end();
++iter
)
{ {
Info<< "element:" << *iter << endl; Info<< "element:" << *iter << endl;
} }
@ -92,14 +87,9 @@ int main(int argc, char *argv[])
const ISLList<Scalar>& const_myList = myList; const ISLList<Scalar>& const_myList = myList;
for forAllConstIter(SLList<scalar>, const_myList, iter)
(
SLList<scalar>::const_iterator iter2 = const_myList.begin();
iter2 != const_myList.end();
++iter2
)
{ {
Info<< "element:" << *iter2 << endl; Info<< "element:" << *iter << endl;
} }

View File

@ -188,12 +188,7 @@ int main(int argc, char *argv[])
sum = 0; sum = 0;
for (label iter = 0; iter < nIters; ++iter) for (label iter = 0; iter < nIters; ++iter)
{ {
for forAllIter(PackedBoolList, packed, it)
(
PackedBoolList::iterator it = packed.begin();
it != packed.end();
++it
)
{ {
sum += it; sum += it;
} }
@ -207,12 +202,7 @@ int main(int argc, char *argv[])
sum = 0; sum = 0;
for (label iter = 0; iter < nIters; ++iter) for (label iter = 0; iter < nIters; ++iter)
{ {
for forAllConstIter(PackedBoolList, packed, cit)
(
PackedBoolList::const_iterator cit = packed.cbegin();
cit != packed.cend();
++cit
)
{ {
sum += cit(); sum += cit();
} }
@ -333,12 +323,7 @@ int main(int argc, char *argv[])
// Write packed // Write packed
for (label iter = 0; iter < nIters; ++iter) for (label iter = 0; iter < nIters; ++iter)
{ {
for forAllIter(PackedBoolList, packed, it)
(
PackedBoolList::iterator it = packed.begin();
it != packed.end();
++it
)
{ {
it() = 1; it() = 1;
} }

View File

@ -51,12 +51,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;
for forAllIter(SLList<scalar>, myList, iter)
(
SLList<scalar>::iterator iter = myList.begin();
iter != myList.end();
++iter
)
{ {
Info<< "element:" << *iter << endl; Info<< "element:" << *iter << endl;
} }
@ -65,39 +60,23 @@ int main(int argc, char *argv[])
const SLList<scalar>& const_myList = myList; const SLList<scalar>& const_myList = myList;
for forAllConstIter(SLList<scalar>, const_myList, iter)
(
SLList<scalar>::const_iterator iter2 = const_myList.begin();
iter2 != const_myList.end();
++iter2
)
{ {
Info<< "element:" << *iter2 << endl; Info<< "element:" << *iter << endl;
} }
for forAllIter(SLList<scalar>, myList, iter)
(
SLList<scalar>::iterator iter = myList.begin();
iter != myList.end();
++iter
)
{ {
Info<< "Removing element:" << *iter << endl; Info<< "Removing element:" << *iter << endl;
myList.remove(iter); myList.remove(iter);
} }
for forAllConstIter(SLList<scalar>, const_myList, iter)
(
SLList<scalar>::const_iterator iter2 = const_myList.begin();
iter2 != const_myList.end();
++iter2
)
{ {
Info<< "element:" << *iter2 << endl; Info<< "element:" << *iter << endl;
} }
for (int i = 0; i<10; i++) for (int i = 0; i<10; i++)
{ {
myList.append(1.3*i); myList.append(1.3*i);

View File

@ -81,12 +81,7 @@ int main(int argc, char *argv[])
dict.swapDown(dict.first()); dict.swapDown(dict.first());
for forAllConstIter(UDictionary<ent>, dict, iter)
(
UDictionary<ent>::const_iterator iter = dict.begin();
iter != dict.end();
++iter
)
{ {
Info<< "element : " << *iter; Info<< "element : " << *iter;
} }

View File

@ -292,20 +292,14 @@ void addCutNeighbours
labelHashSet addCutFaces(cutCells.size()); labelHashSet addCutFaces(cutCells.size());
for forAllConstIter(labelHashSet, cutCells, iter)
(
labelHashSet::const_iterator iter = cutCells.begin();
iter != cutCells.end();
++iter
)
{ {
label cellI = iter.key(); const label cellI = iter.key();
const labelList& cFaces = mesh.cells()[cellI]; const labelList& cFaces = mesh.cells()[cellI];
forAll(cFaces, i) forAll(cFaces, i)
{ {
label faceI = cFaces[i]; const label faceI = cFaces[i];
if (mesh.isInternalFace(faceI)) if (mesh.isInternalFace(faceI))
{ {
@ -331,12 +325,7 @@ void addCutNeighbours
Info<< " Selected an additional " << addCutFaces.size() Info<< " Selected an additional " << addCutFaces.size()
<< " neighbours of cutCells to refine" << endl; << " neighbours of cutCells to refine" << endl;
for forAllConstIter(labelHashSet, addCutFaces, iter)
(
labelHashSet::const_iterator iter = addCutFaces.begin();
iter != addCutFaces.end();
++iter
)
{ {
cutCells.insert(iter.key()); cutCells.insert(iter.key());
} }
@ -386,21 +375,15 @@ bool limitRefinementLevel
labelHashSet addCutCells(cutCells.size()); labelHashSet addCutCells(cutCells.size());
for forAllConstIter(labelHashSet, cutCells, iter)
(
labelHashSet::const_iterator iter = cutCells.begin();
iter != cutCells.end();
++iter
)
{ {
// cellI will be refined. // cellI will be refined.
label cellI = iter.key(); const label cellI = iter.key();
const labelList& cCells = mesh.cellCells()[cellI]; const labelList& cCells = mesh.cellCells()[cellI];
forAll(cCells, i) forAll(cCells, i)
{ {
label nbr = cCells[i]; const label nbr = cCells[i];
if (!excludeCells.found(nbr) && !cutCells.found(nbr)) if (!excludeCells.found(nbr) && !cutCells.found(nbr))
{ {
@ -419,12 +402,8 @@ bool limitRefinementLevel
Info<< "Added an additional " << addCutCells.size() << " cells" Info<< "Added an additional " << addCutCells.size() << " cells"
<< " to satisfy 1:" << limitDiff << " refinement level" << " to satisfy 1:" << limitDiff << " refinement level"
<< endl; << endl;
for
( forAllConstIter(labelHashSet, addCutCells, iter)
labelHashSet::const_iterator iter = addCutCells.begin();
iter != addCutCells.end();
++iter
)
{ {
cutCells.insert(iter.key()); cutCells.insert(iter.key());
} }

View File

@ -108,8 +108,7 @@ public:
cellSplitter(const polyMesh& mesh); cellSplitter(const polyMesh& mesh);
// Destructor //- Destructor
~cellSplitter(); ~cellSplitter();

View File

@ -112,12 +112,7 @@ int main(int argc, char *argv[])
<< cells.instance()/cells.local()/cells.name() << cells.instance()/cells.local()/cells.name()
<< nl << endl; << nl << endl;
for forAllConstIter(cellSet, cells, iter)
(
cellSet::const_iterator iter = cells.begin();
iter != cells.end();
++iter
)
{ {
cutCells.erase(iter.key()); cutCells.erase(iter.key());
} }
@ -131,7 +126,7 @@ int main(int argc, char *argv[])
forAll(meshPoints, pointI) forAll(meshPoints, pointI)
{ {
label meshPointI = meshPoints[pointI]; const label meshPointI = meshPoints[pointI];
vertOnPatch[meshPointI] = true; vertOnPatch[meshPointI] = true;
} }
@ -151,8 +146,7 @@ int main(int argc, char *argv[])
forAll(pEdges, pEdgeI) forAll(pEdges, pEdgeI)
{ {
label edgeI = pEdges[pEdgeI]; const label edgeI = pEdges[pEdgeI];
const edge& e = mesh.edges()[edgeI]; const edge& e = mesh.edges()[edgeI];
label otherPointI = e.otherVertex(meshPointI); label otherPointI = e.otherVertex(meshPointI);

View File

@ -392,15 +392,9 @@ void collectCuts
boolList edgeIsCut(mesh.nEdges(), false); boolList edgeIsCut(mesh.nEdges(), false);
scalarField edgeWeight(mesh.nEdges(), -GREAT); scalarField edgeWeight(mesh.nEdges(), -GREAT);
for forAllConstIter(cellSet, cellsToCut, iter)
(
cellSet::const_iterator iter = cellsToCut.begin();
iter != cellsToCut.end();
++iter
)
{ {
label cellI = iter.key(); const label cellI = iter.key();
const labelList& cEdges = cellEdges[cellI]; const labelList& cEdges = cellEdges[cellI];
forAll(cEdges, i) forAll(cEdges, i)

View File

@ -269,12 +269,7 @@ int main(int argc, char *argv[])
pointField points(slPoints.size()); pointField points(slPoints.size());
label i = 0; label i = 0;
for forAllConstIter(SLList<point>, slPoints, pointIter)
(
SLList<point>::iterator pointIter = slPoints.begin();
pointIter != slPoints.end();
++pointIter
)
{ {
// Scale points for the given scale factor // Scale points for the given scale factor
points[i++] = scaleFactor * pointIter(); points[i++] = scaleFactor * pointIter();
@ -284,12 +279,7 @@ int main(int argc, char *argv[])
labelList pointMap(maxNodei+1); labelList pointMap(maxNodei+1);
i = 0; i = 0;
for forAllConstIter(SLList<label>, slPointMap, pointMapIter)
(
SLList<label>::iterator pointMapIter = slPointMap.begin();
pointMapIter != slPointMap.end();
++pointMapIter
)
{ {
pointMap[pointMapIter()] = i++; pointMap[pointMapIter()] = i++;
} }
@ -299,12 +289,7 @@ int main(int argc, char *argv[])
labelList cellMap(maxCelli+1); labelList cellMap(maxCelli+1);
i = 0; i = 0;
for forAllConstIter(SLList<label>, slCellMap, cellMapIter)
(
SLList<label>::iterator cellMapIter = slCellMap.begin();
cellMapIter != slCellMap.end();
++cellMapIter
)
{ {
cellMap[cellMapIter()] = i++; cellMap[cellMapIter()] = i++;
} }
@ -323,12 +308,7 @@ int main(int argc, char *argv[])
cellShapeList cellShapes(slCellLabels.size()); cellShapeList cellShapes(slCellLabels.size());
label nCells = 0; label nCells = 0;
for forAllConstIter(SLPtrList<labelList>, slCellLabels, cellIter)
(
SLPtrList<labelList>::iterator cellIter = slCellLabels.begin();
cellIter != slCellLabels.end();
++cellIter
)
{ {
if // Tetrahedron if // Tetrahedron
( (

View File

@ -100,8 +100,7 @@ public:
return autoPtr<block>(NULL); return autoPtr<block>(NULL);
} }
// Destructor //- Destructor
~block(); ~block();

View File

@ -327,12 +327,7 @@ if
{ {
scalar minz = GREAT; scalar minz = GREAT;
for forAllConstIter(SLList<face>, pFaces[CYLINDERHEAD][0], iter)
(
SLList<face>::iterator iter = pFaces[CYLINDERHEAD][0].begin();
iter != pFaces[CYLINDERHEAD][0].end();
++iter
)
{ {
const face& pf = iter(); const face& pf = iter();
@ -346,12 +341,7 @@ if
SLList<face> newLinerFaces; SLList<face> newLinerFaces;
for forAllConstIter(SLList<face>, pFaces[LINER][0], iter)
(
SLList<face>::iterator iter = pFaces[LINER][0].begin();
iter != pFaces[LINER][0].end();
++iter
)
{ {
const face& pf = iter(); const face& pf = iter();
@ -380,12 +370,7 @@ if
SLList<face> newCylinderHeadFaces; SLList<face> newCylinderHeadFaces;
for forAllConstIter(SLList<face>, pFaces[CYLINDERHEAD][0], iter)
(
SLList<face>::iterator iter = pFaces[CYLINDERHEAD][0].begin();
iter != pFaces[CYLINDERHEAD][0].end();
++iter
)
{ {
const face& pf = iter(); const face& pf = iter();
@ -456,12 +441,7 @@ if (pFaces[WEDGE].size() && pFaces[WEDGE][0].size())
{ {
pFaces[CYCLIC].setSize(1); pFaces[CYCLIC].setSize(1);
pFaces[CYCLIC][0] = pFaces[WEDGE][0]; pFaces[CYCLIC][0] = pFaces[WEDGE][0];
for forAllIter(SLList<face>, pFaces[WEDGE][1], iterb)
(
SLList<face>::iterator iterb = pFaces[WEDGE][1].begin();
iterb != pFaces[WEDGE][1].end();
++iterb
)
{ {
pFaces[CYCLIC][0].append(iterb()); pFaces[CYCLIC][0].append(iterb());
} }

View File

@ -238,8 +238,7 @@ public:
); );
// Destructor //- Destructor
~sammMesh(); ~sammMesh();

View File

@ -299,8 +299,7 @@ public:
); );
// Destructor //- Destructor
~starMesh(); ~starMesh();

View File

@ -468,12 +468,7 @@ int main(int argc, char *argv[])
// Print region to patch mapping // Print region to patch mapping
Info<< "Regions:" << endl; Info<< "Regions:" << endl;
for forAllConstIter(Map<label>, regionToPatch, iter)
(
Map<label>::const_iterator iter = regionToPatch.begin();
iter != regionToPatch.end();
++iter
)
{ {
Info<< " region:" << iter.key() << '\t' << "patch:" Info<< " region:" << iter.key() << '\t' << "patch:"
<< iter() << endl; << iter() << endl;

View File

@ -356,12 +356,7 @@ void writePointCells
label vertI = 0; label vertI = 0;
for forAllConstIter(labelHashSet, allEdges, iter)
(
labelHashSet::const_iterator iter = allEdges.begin();
iter != allEdges.end();
++iter
)
{ {
const edge& e = mesh.edges()[iter.key()]; const edge& e = mesh.edges()[iter.key()];

View File

@ -143,12 +143,7 @@ void addPatchFields(fvMesh& mesh, const word& patchFieldType)
mesh.objectRegistry::lookupClass<GeoField>() mesh.objectRegistry::lookupClass<GeoField>()
); );
for forAllConstIter(typename HashTable<const GeoField*>, flds, iter)
(
typename HashTable<const GeoField*>::const_iterator iter = flds.begin();
iter != flds.end();
++iter
)
{ {
const GeoField& fld = *iter(); const GeoField& fld = *iter();
@ -183,12 +178,7 @@ void trimPatchFields(fvMesh& mesh, const label nPatches)
mesh.objectRegistry::lookupClass<GeoField>() mesh.objectRegistry::lookupClass<GeoField>()
); );
for forAllConstIter(typename HashTable<const GeoField*>, flds, iter)
(
typename HashTable<const GeoField*>::const_iterator iter = flds.begin();
iter != flds.end();
++iter
)
{ {
const GeoField& fld = *iter(); const GeoField& fld = *iter();
@ -209,12 +199,7 @@ void reorderPatchFields(fvMesh& mesh, const labelList& oldToNew)
mesh.objectRegistry::lookupClass<GeoField>() mesh.objectRegistry::lookupClass<GeoField>()
); );
for forAllConstIter(typename HashTable<const GeoField*>, flds, iter)
(
typename HashTable<const GeoField*>::const_iterator iter = flds.begin();
iter != flds.end();
++iter
)
{ {
const GeoField& fld = *iter(); const GeoField& fld = *iter();

View File

@ -102,8 +102,7 @@ public:
mergePolyMesh(const IOobject& io); mergePolyMesh(const IOobject& io);
// Destructor //- Destructor
virtual ~mergePolyMesh() virtual ~mergePolyMesh()
{} {}

View File

@ -76,8 +76,7 @@ public:
mirrorFvMesh(const IOobject& io); mirrorFvMesh(const IOobject& io);
// Destructor //- Destructor
~mirrorFvMesh(); ~mirrorFvMesh();

View File

@ -100,12 +100,7 @@ int main(int argc, char *argv[])
//Pout<< "pointSets:" << pointObjects.names() << endl; //Pout<< "pointSets:" << pointObjects.names() << endl;
for forAllConstIter(IOobjectList, pointObjects, iter)
(
IOobjectList::const_iterator iter = pointObjects.begin();
iter != pointObjects.end();
++iter
)
{ {
// Not in memory. Load it. // Not in memory. Load it.
pointSet set(*iter()); pointSet set(*iter());
@ -149,12 +144,7 @@ int main(int argc, char *argv[])
//Pout<< "faceSets:" << faceObjects.names() << endl; //Pout<< "faceSets:" << faceObjects.names() << endl;
for forAllConstIter(IOobjectList, faceObjects, iter)
(
IOobjectList::const_iterator iter = faceObjects.begin();
iter != faceObjects.end();
++iter
)
{ {
// Not in memory. Load it. // Not in memory. Load it.
faceSet set(*iter()); faceSet set(*iter());
@ -288,12 +278,7 @@ int main(int argc, char *argv[])
//Pout<< "cellSets:" << cellObjects.names() << endl; //Pout<< "cellSets:" << cellObjects.names() << endl;
for forAllConstIter(IOobjectList, cellObjects, iter)
(
IOobjectList::const_iterator iter = cellObjects.begin();
iter != cellObjects.end();
++iter
)
{ {
if (!slaveCellSets.found(iter.key())) if (!slaveCellSets.found(iter.key()))
{ {

View File

@ -81,8 +81,7 @@ Foam::label Foam::regionSide::otherEdge
forAll(fEdges, fEdgeI) forAll(fEdges, fEdgeI)
{ {
label otherEdgeI = fEdges[fEdgeI]; const label otherEdgeI = fEdges[fEdgeI];
const edge& otherE = mesh.edges()[otherEdgeI]; const edge& otherE = mesh.edges()[otherEdgeI];
if if
@ -300,15 +299,9 @@ void Foam::regionSide::walkAllPointConnectedFaces
// //
labelHashSet regionEdges(4*regionFaces.size()); labelHashSet regionEdges(4*regionFaces.size());
for forAllConstIter(labelHashSet, regionFaces, iter)
(
labelHashSet::const_iterator iter = regionFaces.begin();
iter != regionFaces.end();
++iter
)
{ {
label faceI = iter.key(); const label faceI = iter.key();
const labelList& fEdges = mesh.faceEdges()[faceI]; const labelList& fEdges = mesh.faceEdges()[faceI];
forAll(fEdges, fEdgeI) forAll(fEdges, fEdgeI)
@ -326,12 +319,7 @@ void Foam::regionSide::walkAllPointConnectedFaces
labelHashSet visitedPoint(4*regionFaces.size()); labelHashSet visitedPoint(4*regionFaces.size());
// Insert fence points so we don't visit them // Insert fence points so we don't visit them
for forAllConstIter(labelHashSet, fencePoints, iter)
(
labelHashSet::const_iterator iter = fencePoints.begin();
iter != fencePoints.end();
++iter
)
{ {
visitedPoint.insert(iter.key()); visitedPoint.insert(iter.key());
} }
@ -344,14 +332,9 @@ void Foam::regionSide::walkAllPointConnectedFaces
Info<< "Excluding visit of points:" << visitedPoint << endl; Info<< "Excluding visit of points:" << visitedPoint << endl;
} }
for forAllConstIter(labelHashSet, regionFaces, iter)
(
labelHashSet::const_iterator iter = regionFaces.begin();
iter != regionFaces.end();
++iter
)
{ {
label faceI = iter.key(); const label faceI = iter.key();
// Get side of face. // Get side of face.
label cellI; label cellI;
@ -459,12 +442,7 @@ Foam::regionSide::regionSide
labelHashSet fencePoints(fenceEdges.size()); labelHashSet fencePoints(fenceEdges.size());
for forAllConstIter(labelHashSet, fenceEdges, iter)
(
labelHashSet::const_iterator iter = fenceEdges.begin();
iter != fenceEdges.end();
++iter
)
{ {
const edge& e = mesh.edges()[iter.key()]; const edge& e = mesh.edges()[iter.key()];

View File

@ -99,12 +99,7 @@ void addPatchFields(fvMesh& mesh, const word& patchFieldType)
mesh.objectRegistry::lookupClass<GeoField>() mesh.objectRegistry::lookupClass<GeoField>()
); );
for forAllConstIter(typename HashTable<const GeoField*>, flds, iter)
(
typename HashTable<const GeoField*>::const_iterator iter = flds.begin();
iter != flds.end();
++iter
)
{ {
const GeoField& fld = *iter(); const GeoField& fld = *iter();
@ -139,12 +134,7 @@ void trimPatchFields(fvMesh& mesh, const label nPatches)
mesh.objectRegistry::lookupClass<GeoField>() mesh.objectRegistry::lookupClass<GeoField>()
); );
for forAllConstIter(typename HashTable<const GeoField*>, flds, iter)
(
typename HashTable<const GeoField*>::const_iterator iter = flds.begin();
iter != flds.end();
++iter
)
{ {
const GeoField& fld = *iter(); const GeoField& fld = *iter();
@ -165,12 +155,7 @@ void reorderPatchFields(fvMesh& mesh, const labelList& oldToNew)
mesh.objectRegistry::lookupClass<GeoField>() mesh.objectRegistry::lookupClass<GeoField>()
); );
for forAllConstIter(typename HashTable<const GeoField*>, flds, iter)
(
typename HashTable<const GeoField*>::const_iterator iter = flds.begin();
iter != flds.end();
++iter
)
{ {
const GeoField& fld = *iter(); const GeoField& fld = *iter();

View File

@ -76,12 +76,7 @@ int main(int argc, char *argv[])
if (args.optionFound("keywords") && !args.optionFound("entry")) if (args.optionFound("keywords") && !args.optionFound("entry"))
{ {
for forAllConstIter(dictionary, dict, iter)
(
IDLList<entry>::iterator iter = dict.begin();
iter != dict.end();
++iter
)
{ {
Info<< iter().keyword() << endl; Info<< iter().keyword() << endl;
} }
@ -137,13 +132,8 @@ int main(int argc, char *argv[])
} }
*/ */
const dictionary& dict(entPtr->dict()); const dictionary& dict = entPtr->dict();
for forAllConstIter(dictionary, dict, iter)
(
IDLList<entry>::const_iterator iter = dict.begin();
iter != dict.end();
++iter
)
{ {
Info<< iter().keyword() << endl; Info<< iter().keyword() << endl;
} }

View File

@ -126,8 +126,7 @@ public:
domainDecomposition(const IOobject& io); domainDecomposition(const IOobject& io);
// Destructor //- Destructor
~domainDecomposition(); ~domainDecomposition();

View File

@ -506,12 +506,7 @@ void Foam::domainDecomposition::decomposeMesh()
// Add internal and boundary faces // Add internal and boundary faces
// Remember to increment the index by one such that the // Remember to increment the index by one such that the
// turning index works properly. // turning index works properly.
for forAllConstIter(SLList<label>, curProcFaces, curProcFacesIter)
(
SLList<label>::iterator curProcFacesIter = curProcFaces.begin();
curProcFacesIter != curProcFaces.end();
++curProcFacesIter
)
{ {
curProcFaceAddressing[nFaces] = curProcFacesIter() + 1; curProcFaceAddressing[nFaces] = curProcFacesIter() + 1;
nFaces++; nFaces++;
@ -564,12 +559,11 @@ void Foam::domainDecomposition::decomposeMesh()
// add faces for this processor boundary // add faces for this processor boundary
for forAllConstIter
( (
SLList<label>::iterator curFacesIter = SLList<label>,
curInterProcBFacesIter().begin(); curInterProcBFacesIter(),
curFacesIter != curInterProcBFacesIter().end(); curFacesIter
++curFacesIter
) )
{ {
// add the face // add the face

View File

@ -230,8 +230,7 @@ public:
); );
// Destructor //- Destructor
~fvFieldDecomposer(); ~fvFieldDecomposer();

View File

@ -55,7 +55,7 @@ Foam::lagrangianFieldDecomposer::lagrangianFieldDecomposer
{ {
SLList<indexedParticle*>& particlePtrs = *cellParticles[celli]; SLList<indexedParticle*>& particlePtrs = *cellParticles[celli];
forAllIter(SLList<indexedParticle*>, particlePtrs, iter) forAllConstIter(SLList<indexedParticle*>, particlePtrs, iter)
{ {
const indexedParticle& ppi = *iter(); const indexedParticle& ppi = *iter();
particleIndices_[pi++] = ppi.index(); particleIndices_[pi++] = ppi.index();

View File

@ -138,8 +138,7 @@ public:
); );
// Destructor //- Destructor
~pointFieldDecomposer(); ~pointFieldDecomposer();

View File

@ -48,22 +48,13 @@ void Foam::readFields
// Construct the vol scalar fields // Construct the vol scalar fields
fields.setSize(fieldObjects.size()); fields.setSize(fieldObjects.size());
label fieldi=0; label fieldI = 0;
for forAllIter(IOobjectList, fieldObjects, iter)
(
IOobjectList::iterator iter = fieldObjects.begin();
iter != fieldObjects.end();
++iter
)
{ {
fields.set fields.set
( (
fieldi++, fieldI++,
new GeoField new GeoField(*iter(), mesh)
(
*iter(),
mesh
)
); );
} }
} }

View File

@ -110,36 +110,23 @@ int main(int argc, char *argv[])
// Search list of objects for volScalarFields // Search list of objects for volScalarFields
IOobjectList scalarFields(objects.lookupClass("volScalarField")); IOobjectList scalarFields(objects.lookupClass("volScalarField"));
for forAllIter(IOobjectList, scalarFields, iter)
(
IOobjectList::iterator scalarFieldIter = scalarFields.begin();
scalarFieldIter != scalarFields.end();
++scalarFieldIter
)
{ {
// Read field // Read field
volScalarField field volScalarField field(*iter(), mesh);
(
*scalarFieldIter(),
mesh
);
// lookup field from dictionary // lookup field from dictionary and convert field
if (foamDataToFluentDict.found(field.name())) label unitNumber;
{ if
label unitNumber
( (
readLabel(foamDataToFluentDict.lookup(field.name())) foamDataToFluentDict.readIfPresent(field.name(), unitNumber)
); && unitNumber > 0
)
// Convert field
if (unitNumber > 0)
{ {
Info<< " Converting field " << field.name() << endl; Info<< " Converting field " << field.name() << endl;
writeFluentField(field, unitNumber, fluentDataFile); writeFluentField(field, unitNumber, fluentDataFile);
} }
} }
}
// Converting volVectorField // Converting volVectorField
@ -148,36 +135,23 @@ int main(int argc, char *argv[])
// Search list of objects for volVectorFields // Search list of objects for volVectorFields
IOobjectList vectorFields(objects.lookupClass("volVectorField")); IOobjectList vectorFields(objects.lookupClass("volVectorField"));
for forAllIter(IOobjectList, vectorFields, iter)
(
IOobjectList::iterator vectorFieldIter = vectorFields.begin();
vectorFieldIter != vectorFields.end();
++vectorFieldIter
)
{ {
// Read field // Read field
volVectorField field volVectorField field(*iter(), mesh);
(
*vectorFieldIter(),
mesh
);
// lookup field from dictionary // lookup field from dictionary and convert field
if (foamDataToFluentDict.found(field.name())) label unitNumber;
{ if
label unitNumber
( (
readLabel(foamDataToFluentDict.lookup(field.name())) foamDataToFluentDict.readIfPresent(field.name(), unitNumber)
); && unitNumber > 0
)
// Convert field
if (unitNumber > 0)
{ {
Info<< " Converting field " << field.name() << endl; Info<< " Converting field " << field.name() << endl;
writeFluentField(field, unitNumber, fluentDataFile); writeFluentField(field, unitNumber, fluentDataFile);
} }
} }
}
Info<< endl; Info<< endl;
} }

View File

@ -22,11 +22,11 @@ for (label i=0; i < nTypes; i++)
if (fieldTypes[i] == "volScalarField") if (fieldTypes[i] == "volScalarField")
{ {
volScalarField gmvScalarField(fieldObject, mesh); volScalarField fld(fieldObject, mesh);
gmvFile << fieldName << " 0" << nl; gmvFile << fieldName << " 0" << nl;
for (label indx=0;indx<mesh.nCells();indx++) for (label indx=0;indx<mesh.nCells();indx++)
{ {
gmvFile << gmvScalarField[indx] << " "; gmvFile << fld[indx] << " ";
} }
gmvFile << nl; gmvFile << nl;
} }
@ -35,19 +35,19 @@ for (label i=0; i < nTypes; i++)
{ {
if (fieldName == vComp) if (fieldName == vComp)
{ {
volVectorField gmvVectorField(fieldObject, mesh); volVectorField fld(fieldObject, mesh);
gmvFile << "velocity 0" << nl; gmvFile << "velocity 0" << nl;
for (label indx=0;indx<mesh.nCells();indx++) for (label indx=0;indx<mesh.nCells();indx++)
{ {
gmvFile << gmvVectorField[indx].x() << " "; gmvFile << fld[indx].x() << " ";
} }
for (label indx=0;indx<mesh.nCells();indx++) for (label indx=0;indx<mesh.nCells();indx++)
{ {
gmvFile << gmvVectorField[indx].y() << " "; gmvFile << fld[indx].y() << " ";
} }
for (label indx=0;indx<mesh.nCells();indx++) for (label indx=0;indx<mesh.nCells();indx++)
{ {
gmvFile << gmvVectorField[indx].z() << " "; gmvFile << fld[indx].z() << " ";
} }
gmvFile << nl; gmvFile << nl;
} }

View File

@ -1,42 +1,27 @@
gmvFile << "tracers " << particles.size() << nl; gmvFile << "tracers " << particles.size() << nl;
for forAllConstIter(Cloud<passiveParticle>, particles, iter)
(
Cloud<passiveParticle>::iterator elmnt = particles.begin();
elmnt != particles.end();
++elmnt
)
{ {
gmvFile << elmnt().position().x() << " "; gmvFile << iter().position().x() << ' ';
} }
gmvFile << nl; gmvFile << nl;
for forAllConstIter(Cloud<passiveParticle>, particles, iter)
(
Cloud<passiveParticle>::iterator elmnt = particles.begin();
elmnt != particles.end();
++elmnt
)
{ {
gmvFile << elmnt().position().y() << " "; gmvFile << iter().position().y() << ' ';
} }
gmvFile << nl; gmvFile << nl;
for forAllConstIter(Cloud<passiveParticle>, particles, iter)
(
Cloud<passiveParticle>::iterator elmnt = particles.begin();
elmnt != particles.end();
++elmnt
)
{ {
gmvFile << elmnt().position().z() << " "; gmvFile << iter().position().z() << ' ';
} }
gmvFile << nl; gmvFile << nl;
forAll(lagrangianScalarNames, i) forAll(lagrangianScalarNames, i)
{ {
word name = lagrangianScalarNames[i]; const word& name = lagrangianScalarNames[i];
IOField<scalar> s IOField<scalar> fld
( (
IOobject IOobject
( (
@ -49,13 +34,13 @@ forAll(lagrangianScalarNames, i)
) )
); );
if (s.size()) if (fld.size())
{ {
gmvFile << name << nl; gmvFile << name << nl;
for (label n = 0; n < s.size(); n++) forAll(fld, n)
{ {
gmvFile << s[n] << token::SPACE; gmvFile << fld[n] << token::SPACE;
} }
gmvFile << nl; gmvFile << nl;
} }
@ -65,9 +50,9 @@ forAll(lagrangianScalarNames, i)
forAll(lagrangianVectorNames, i) forAll(lagrangianVectorNames, i)
{ {
word name = lagrangianVectorNames[i]; const word& name = lagrangianVectorNames[i];
IOField<vector> v IOField<vector> fld
( (
IOobject IOobject
( (
@ -80,29 +65,29 @@ forAll(lagrangianVectorNames, i)
) )
); );
if (v.size()) if (fld.size())
{ {
gmvFile << name + "x" << nl; gmvFile << name + "x" << nl;
for (label n = 0; n < v.size(); n++) forAll(fld, n)
{ {
gmvFile << v[n].x() << token::SPACE; gmvFile << fld[n].x() << token::SPACE;
} }
gmvFile << nl; gmvFile << nl;
gmvFile << name + "y" << nl; gmvFile << name + "y" << nl;
for (label n = 0; n < v.size(); n++) forAll(fld, n)
{ {
gmvFile << v[n].y() << token::SPACE; gmvFile << fld[n].y() << token::SPACE;
} }
gmvFile << nl; gmvFile << nl;
gmvFile << name + "z" << nl; gmvFile << name + "z" << nl;
for (label n = 0; n < v.size(); n++) forAll(fld, n)
{ {
gmvFile << v[n].z() << token::SPACE; gmvFile << fld[n].z() << token::SPACE;
} }
gmvFile << nl; gmvFile << nl;
} }

View File

@ -1,81 +1,48 @@
gmvFile << "tracers " << particles.size() << nl; gmvFile << "tracers " << particles.size() << nl;
for forAllConstIter(discretePhase, particles, iter)
(
discretePhase::iterator elmnt = particles.begin();
elmnt != particles.end();
++elmnt
)
{ {
gmvFile << elmnt().position().x() << " "; gmvFile << iter().position().x() << " ";
} }
gmvFile << nl; gmvFile << nl;
for
( forAllConstIter(discretePhase, particles, iter)
discretePhase::iterator elmnt = particles.begin();
elmnt != particles.end();
++elmnt
)
{ {
gmvFile << elmnt().position().y() << " "; gmvFile << iter().position().y() << " ";
} }
gmvFile << nl; gmvFile << nl;
for
( forAllConstIter(discretePhase, particles, iter)
discretePhase::iterator elmnt = particles.begin();
elmnt != particles.end();
++elmnt
)
{ {
gmvFile << elmnt().position().z() << " "; gmvFile << iter().position().z() << " ";
} }
gmvFile << nl; gmvFile << nl;
gmvFile << "U" << nl; gmvFile << "U" << nl;
for forAllConstIter(discretePhase, particles, iter)
(
discretePhase::iterator elmnt = particles.begin();
elmnt != particles.end();
++elmnt
)
{ {
gmvFile << elmnt().velocity().x() << " "; gmvFile << iter().velocity().x() << " ";
} }
gmvFile << nl; gmvFile << nl;
gmvFile << "V" << nl; gmvFile << "V" << nl;
for forAllConstIter(discretePhase, particles, iter)
(
discretePhase::iterator elmnt = particles.begin();
elmnt != particles.end();
++elmnt
)
{ {
gmvFile << elmnt().velocity().y() << " "; gmvFile << iter().velocity().y() << " ";
} }
gmvFile << nl; gmvFile << nl;
gmvFile << "W" << nl; gmvFile << "W" << nl;
for forAllConstIter(discretePhase, particles, iter)
(
discretePhase::iterator elmnt = particles.begin();
elmnt != particles.end();
++elmnt
)
{ {
gmvFile << elmnt().velocity().z() << " "; {
gmvFile << iter().velocity().z() << " ";
} }
gmvFile << nl; gmvFile << nl;
gmvFile << "Diam" << nl; gmvFile << "Diam" << nl;
forAllConstIter(discretePhase, particles, iter)
for
(
discretePhase::iterator elmnt = particles.begin();
elmnt != particles.end();
++elmnt
)
{ {
gmvFile << elmnt().d() << " "; gmvFile << iter().d() << " ";
} }
gmvFile << "endtrace"<< nl; gmvFile << "endtrace"<< nl;

View File

@ -1,32 +1,19 @@
gmvFile << "tracers " << particles.size() << nl; gmvFile << "tracers " << particles.size() << nl;
for forAllConstIter(Cloud<passiveParticle>, particles, iter)
(
Cloud<passiveParticle>::iterator elmnt = particles.begin();
elmnt != particles.end();
++elmnt
)
{ {
gmvFile << elmnt().position().x() << " "; gmvFile << iter().position().x() << " ";
} }
gmvFile << nl; gmvFile << nl;
for
( forAllConstIter(Cloud<passiveParticle>, particles, iter)
Cloud<passiveParticle>::iterator elmnt = particles.begin();
elmnt != particles.end();
++elmnt
)
{ {
gmvFile << elmnt().position().y() << " "; gmvFile << iter().position().y() << " ";
} }
gmvFile << nl; gmvFile << nl;
for
( forAllConstIter(Cloud<passiveParticle>, particles, iter)
Cloud<passiveParticles>::iterator elmnt = particles.begin();
elmnt != particles.end();
++elmnt
)
{ {
gmvFile << elmnt().position().z() << " "; gmvFile << iter().position().z() << " ";
} }
gmvFile << nl; gmvFile << nl;
@ -51,15 +38,13 @@ forAll(lagrangianScalarNames, i)
{ {
gmvFile << name << nl; gmvFile << name << nl;
for (label n = 0; n < s.size(); n++) forAll(s, n)
{ {
gmvFile << s[n] << token::SPACE; gmvFile << s[n] << token::SPACE;
} }
gmvFile << nl; gmvFile << nl;
} }
} }
gmvFile << "endtrace"<< nl; gmvFile << "endtrace"<< nl;

View File

@ -1,2 +1,3 @@
gmvFile << "probtime " << runTime.timeName() << nl; gmvFile
gmvFile << "endgmv" << nl; << "probtime " << runTime.timeName() << nl
<< "endgmv" << nl;

View File

@ -33,6 +33,7 @@ if ( (format != "ascii") && (format != "ieeei4r8") )
<< abort(FatalError); << abort(FatalError);
} }
word cells word cells
( (
conversionProperties.lookup("cells") conversionProperties.lookup("cells")

View File

@ -50,12 +50,7 @@ void readFields
label nFields = fields.size(); label nFields = fields.size();
fields.setSize(nFields + fieldObjects.size()); fields.setSize(nFields + fieldObjects.size());
for forAllIter(IOobjectList, fieldObjects, iter)
(
IOobjectList::iterator iter = fieldObjects.begin();
iter != fieldObjects.end();
++iter
)
{ {
if (selectedFields.empty() || selectedFields.found(iter()->name())) if (selectedFields.empty() || selectedFields.found(iter()->name()))
{ {

View File

@ -50,12 +50,7 @@ void readFields
fields.setSize(fieldObjects.size()); fields.setSize(fieldObjects.size());
label nFields = 0; label nFields = 0;
for forAllIter(IOobjectList, fieldObjects, iter)
(
IOobjectList::iterator iter = fieldObjects.begin();
iter != fieldObjects.end();
++iter
)
{ {
if (selectedFields.empty() || selectedFields.found(iter()->name())) if (selectedFields.empty() || selectedFields.found(iter()->name()))
{ {

View File

@ -27,14 +27,9 @@ License
#include "OFstream.H" #include "OFstream.H"
#include "writeFuns.H" #include "writeFuns.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
void writeFaceSet void Foam::writeFaceSet
( (
const bool binary, const bool binary,
const vtkMesh& vMesh, const vtkMesh& vMesh,
@ -73,12 +68,7 @@ void writeFaceSet
labelList setFaceLabels(set.size()); labelList setFaceLabels(set.size());
label setFaceI = 0; label setFaceI = 0;
for forAllConstIter(faceSet, set, iter)
(
faceSet::const_iterator iter = set.begin();
iter != set.end();
++iter
)
{ {
setFaceLabels[setFaceI] = iter.key(); setFaceLabels[setFaceI] = iter.key();
setFaces[setFaceI] = faces[iter.key()]; setFaces[setFaceI] = faces[iter.key()];
@ -139,8 +129,5 @@ void writeFaceSet
writeFuns::write(pStream, binary, setFaceLabels); writeFuns::write(pStream, binary, setFaceLabels);
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* // // ************************************************************************* //

View File

@ -187,7 +187,6 @@ protected:
); );
//- Get the mesh/fields for a particular time //- Get the mesh/fields for a particular time
//- Destructor
virtual int RequestData virtual int RequestData
( (
vtkInformation*, vtkInformation*,

View File

@ -693,7 +693,6 @@ public:
//- Destructor //- Destructor
~vtkPV3Foam(); ~vtkPV3Foam();

View File

@ -312,7 +312,6 @@ public:
//- Destructor //- Destructor
~vtkPV3blockMesh(); ~vtkPV3blockMesh();

View File

@ -47,19 +47,13 @@ int USERD_get_part_coords
} }
else if (part_number == nPatches+2) else if (part_number == nPatches+2)
{ {
label indx = 1; label indx = 1;
for forAllConstIter(Cloud<passiveParticle>, *sprayPtr, iter)
(
Cloud<passiveParticle>::iterator elmnt = sprayPtr->begin();
elmnt != sprayPtr->end();
++elmnt
)
{ {
coord_array[0][indx] = (float)elmnt().position().x(); coord_array[0][indx] = (float)iter().position().x();
coord_array[1][indx] = (float)elmnt().position().y(); coord_array[1][indx] = (float)iter().position().y();
coord_array[2][indx] = (float)elmnt().position().z(); coord_array[2][indx] = (float)iter().position().z();
indx++; indx++;
} }

View File

@ -35,12 +35,8 @@ int USERD_get_part_node_ids
else if (part_number == nPatches+2) else if (part_number == nPatches+2)
{ {
label indx = 0; label indx = 0;
for
( forAllConstIter(Cloud<passiveParticle>, *sprayPtr, iter)
Cloud<passiveParticle>::iterator elmnt = sprayPtr->begin();
elmnt != sprayPtr->end();
++elmnt
)
{ {
nodeid_array[indx] = indx + 1; nodeid_array[indx] = indx + 1;
indx++; indx++;

View File

@ -116,8 +116,7 @@ public:
readerDatabase(); readerDatabase();
// Destructor //- Destructor
~readerDatabase(); ~readerDatabase();

View File

@ -52,12 +52,7 @@ void MapConsistentVolFields
IOobjectList fields = objects.lookupClass(fieldClassName); IOobjectList fields = objects.lookupClass(fieldClassName);
for forAllIter(IOobjectList, fields, fieldIter)
(
IOobjectList::iterator fieldIter = fields.begin();
fieldIter != fields.end();
++fieldIter
)
{ {
Info<< " interpolating " << fieldIter()->name() Info<< " interpolating " << fieldIter()->name()
<< endl; << endl;

View File

@ -52,12 +52,7 @@ void MapVolFields
IOobjectList fields = objects.lookupClass(fieldClassName); IOobjectList fields = objects.lookupClass(fieldClassName);
for forAllIter(IOobjectList, fields, fieldIter)
(
IOobjectList::iterator fieldIter = fields.begin();
fieldIter != fields.end();
++fieldIter
)
{ {
IOobject fieldTargetIOobject IOobject fieldTargetIOobject
( (

View File

@ -2,7 +2,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) 1991-2009 OpenCFD Ltd. \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -39,12 +39,7 @@ void UnMapped(const IOobjectList& objects)
{ {
IOobjectList fields = objects.lookupClass(Type::typeName); IOobjectList fields = objects.lookupClass(Type::typeName);
for forAllConstIter(IOobjectList, fields, fieldIter)
(
IOobjectList::iterator fieldIter = fields.begin();
fieldIter != fields.end();
++fieldIter
)
{ {
mvBak(fieldIter()->objectPath(), "unmapped"); mvBak(fieldIter()->objectPath(), "unmapped");
} }

View File

@ -126,12 +126,7 @@ void dumpFaces
OFstream os(fName); OFstream os(fName);
for forAllConstIter(Map<label>, connectedFaces, iter)
(
Map<label>::const_iterator iter = connectedFaces.begin();
iter != connectedFaces.end();
++iter
)
{ {
const labelledTri& f = surf.localFaces()[iter.key()]; const labelledTri& f = surf.localFaces()[iter.key()];
@ -502,14 +497,9 @@ void calcPointVecs
boolList edgeDone(surf.nEdges(), false); boolList edgeDone(surf.nEdges(), false);
for forAllConstIter(Map<label>, faceToEdge, iter)
(
Map<label>::const_iterator iter = faceToEdge.begin();
iter != faceToEdge.end();
++iter
)
{ {
label edgeI = iter(); const label edgeI = iter();
if (!edgeDone[edgeI]) if (!edgeDone[edgeI])
{ {
@ -610,15 +600,9 @@ void renumberFaces
List<labelledTri>& newTris List<labelledTri>& newTris
) )
{ {
for forAllConstIter(Map<label>, faceToEdge, iter)
(
Map<label>::const_iterator iter = faceToEdge.begin();
iter != faceToEdge.end();
++iter
)
{ {
label faceI = iter.key(); const label faceI = iter.key();
const labelledTri& f = surf.localFaces()[faceI]; const labelledTri& f = surf.localFaces()[faceI];
forAll(f, fp) forAll(f, fp)

View File

@ -51,7 +51,6 @@ int main(int argc, char *argv[])
{ {
# include "setRootCase.H" # include "setRootCase.H"
# include "createTime.H" # include "createTime.H"
Info<< nl << "Reading Burcat data IOdictionary" << endl; Info<< nl << "Reading Burcat data IOdictionary" << endl;
@ -119,17 +118,11 @@ int main(int argc, char *argv[])
); );
for forAllConstIter(SLPtrList<thermo>, EQreactions, iter)
(
SLPtrList<thermo>::iterator EQreactionsIter = EQreactions.begin();
EQreactionsIter != EQreactions.end();
++EQreactionsIter
)
{ {
Info<< "Kc(EQreactions) = " << EQreactionsIter().Kc(T) << endl; Info<< "Kc(EQreactions) = " << iter().Kc(T) << endl;
} }
Info<< nl << "end" << endl; Info<< nl << "end" << endl;
return 0; return 0;

View File

@ -37,9 +37,12 @@
# to add any custom rsync options. # to add any custom rsync options.
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
Script=${0##*/} Script=${0##*/}
if [ "$1" = "-h" -o "$1" = "-help" -o "$#" -ne 2 ]
then #------------------------------------------------------------------------------
usage() {
while [ "$#" -ge 1 ]; do echo "$1" 1>&2; shift; done
cat <<USAGE 1>&2 cat <<USAGE 1>&2
Usage: $Script srcDir dstDir Usage: $Script srcDir dstDir
Copy OpenFOAM settings from one case to another, without copying Copy OpenFOAM settings from one case to another, without copying
@ -52,7 +55,29 @@ Note
USAGE USAGE
exit 1 exit 1
fi }
#------------------------------------------------------------------------------
# parse options
while [ "$#" -gt 0 ]
do
case "$1" in
-h | -help)
usage
;;
-*)
usage "unknown option: '$*'"
;;
*)
break
;;
esac
done
# need rsync
type rsync >/dev/null 2>&1 || usage "Error: 'rsync' seems to be missing"
[ "$#" -eq 2 ] || usage "Error: incorrect number of arguments"
srcDir=${1%/} srcDir=${1%/}
dstDir=${2%/} dstDir=${2%/}

View File

@ -35,8 +35,94 @@
# to restore controlDict # to restore controlDict
# #
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
Script=${0##*/}
PROGNAME=`basename $0` usage() {
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
cat<<USAGE
Usage: $Script [OPTION] <pid>
Usage: $Script [OPTION] -c
options:
-clear use blockMesh reader (uses .blockMesh extension)
-case <dir> specify alternative case directory, default is the cwd
-now stop at next time step
-help print the usage
Tries to end running OpenFOAM application at next write (or optionally
at the next time step). It needs runTimeModifiable switched on in the
controlDict. It changes stopAt in the controlDict and waits for the
job to finish. Restores original controlDict if
- job has finished
- controlDict gets modified (by user)
- $Script gets killed.
The -clear option clears any outstanding $Script for the case.
USAGE
exit 1
}
unset clearOpt stopOpt
# parse options
while [ "$#" -gt 0 ]
do
case "$1" in
-h | -help)
usage
;;
-case)
[ "$#" -ge 2 ] || usage "'$1' option requires an argument"
cd "$2" 2>/dev/null || usage "directory does not exist: '$2'"
shift 2
;;
-c | -clear)
clearOpt=true
shift
;;
-n | -now)
stopOpt=now
shift
;;
-*)
usage "unknown option: '$*'"
;;
*)
break
;;
esac
done
# parent directory for normal or parallel
case "$PWD" in
processor*) caseDir=".." ;;
*) caseDir="." ;;
esac
# check that case directory is writeable
[ -w $caseDir ] || {
echo "$Script : $caseDir is not writeable"
exit 1
}
# check that controlDict is writeable
controlDict=$caseDir/system/controlDict
[ -w $controlDict ] || {
echo "$Script : $controlDict is not writeable"
exit 1
}
# need a pid unless with the -clear option
if [ "$clearOpt" = true ]
then
[ $# -eq 0 ] || usage
else
[ $# -eq 1 ] || usage
PID=$1
fi
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
@ -84,6 +170,7 @@ setRawEntry() {
oldLine=`echo "$oldNumLine" | sed -e 's/^[^:]*://'` oldLine=`echo "$oldNumLine" | sed -e 's/^[^:]*://'`
oldKey=`getKey "$oldLine"` oldKey=`getKey "$oldLine"`
oldVal=`getRawEntry $1 "$2"` oldVal=`getRawEntry $1 "$2"`
if [ ! "$oldKey" -o ! "$oldVal" -o ! "$oldLine" ] if [ ! "$oldKey" -o ! "$oldVal" -o ! "$oldLine" ]
then then
echo "setRawStringEntry: entry $2 not found in $1" echo "setRawStringEntry: entry $2 not found in $1"
@ -92,6 +179,7 @@ setRawEntry() {
echo "oldLine=$oldLine" echo "oldLine=$oldLine"
exit 1 exit 1
fi fi
#echo "oldKey=$oldKey" #echo "oldKey=$oldKey"
#echo "lineNo=$lineNo" #echo "lineNo=$lineNo"
#echo "oldLine=$oldLine" #echo "oldLine=$oldLine"
@ -108,76 +196,30 @@ getBoolEntry()
{ {
val=`getEntry $1 $2` val=`getEntry $1 $2`
case "$val" in case "$val" in
'yes') y | yes | true | on | 1)
return 0 return 0
;; ;;
'no') n | no | false | off | 0)
return 123
;;
'true')
return 0
;;
'false')
return 123
;;
1)
return 0
;;
0)
return 123 return 123
;; ;;
*) *)
echo "$PROGNAME : getBoolEntry : Illegal boolean value $val in dictionary $1" echo "$Script : getBoolEntry : Illegal boolean value $val in dictionary $1"
exit 1 exit 1
;; ;;
esac esac
} }
# newerFile file1 file2
# ... could also use if [ $file1 -nt $file2 ] ...
newerFile()
{
latest=`ls -1 -t $1 $2 2> /dev/null | head -1`
if [ "$latest" = $1 ]
then
return 0
else
return 1
fi
}
# processExists pid # processExists pid
# Returns true if pid exists. # Returns true if pid exists.
processExists() { processExists() {
ps -u $LOGNAME -o 'pid' | fgrep $1 >/dev/null ps -u $LOGNAME -o pid | fgrep $1 >/dev/null
} }
usage() {
cat << USAGE
Usage: $PROGNAME [-n] <root> <case> <pid>
or
$PROGNAME -c <root> <case>
Tries to end running Foam application at next write or at next time
step (-n (at your option). It needs runTimeModifiable switched on in the
controlDict. It changes stopAt in the controlDict and waits for the job to
finish. Restores original controlDict if
- job has finished
- controlDict gets modified (by user)
- $PROGNAME gets killed.
The -c option clears any outstanding $PROGNAME for the case.
USAGE
exit 1
}
# Restore controlDict and clean up # Restore controlDict and clean up
restoreDict() { restoreDict() {
trap 2 3 15 trap QUIT TERM INT
echo "$PROGNAME : Restoring controlDict from controlDict_bak." echo "$Script : Restoring controlDict from controlDict_bak"
if [ -r ${controlDict}_bak ] if [ -r ${controlDict}_bak ]
then then
cp ${controlDict}_bak $controlDict cp ${controlDict}_bak $controlDict
@ -185,7 +227,7 @@ restoreDict() {
rm -f $pidFile rm -f $pidFile
echo "$PROGNAME : Exiting." echo "$Script : Exiting"
exit 0 exit 0
} }
@ -196,105 +238,51 @@ restoreDict() {
# #
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
ARCH=`uname -s`
#-- Force standards behaving ps #-- Force standards behaving ps
# Get info on all $USER processes # Get info on all $USER processes
case $ARCH in case `uname -s` in
HP-UX*) HP-UX*)
UNIX95=a; export UNIX95 UNIX95=a
export UNIX95
;; ;;
IRIX*) IRIX*)
_XPG=1; export _XPG _XPG=1
export _XPG
;; ;;
esac esac
# # Pid actually running
# Initial checks if [ "$clearOpt" != true ]
#
if [ $# -lt 3 ]
then
usage
fi
STOPNOW=''
if [ $1 = '-n' ]
then
STOPNOW='yes'
shift
fi
CLEAR=''
if [ $1 = '-c' ]
then
CLEAR='yes'
shift
if [ $# -ne 2 ]
then
usage
fi
ROOT=$1
CASE=$2
else
if [ $# -ne 3 ]
then
usage
fi
ROOT=$1
CASE=$2
PID=$3
fi
CASE=`echo $CASE | sed -e 's!/.*!!'` # strip of processorXXX ending
#- Pid actually running
if [ ! "$CLEAR" ]
then then
processExists $PID processExists $PID
if [ $? -ne 0 ] if [ $? -ne 0 ]
then then
echo "$PROGNAME : process $PID not running." echo "$Script : process $PID not running"
exit 1 exit 1
fi fi
fi fi
#- case directory writeable
if [ ! -w $ROOT/$CASE ]
then
echo "$PROGNAME : $ROOT/$CASE is not writeable."
exit 1
fi
#- Controldict writeable
controlDict=$ROOT/$CASE/system/controlDict
if [ ! -w $controlDict ]
then
echo "$PROGNAME : $controlDict is not writeable."
exit 1
fi
#- runTimeModifiable #- runTimeModifiable
getBoolEntry $controlDict 'runTimeModifiable' getBoolEntry $controlDict runTimeModifiable || {
if [ $? -ne 0 ] echo "$Script : runTimeModifiable not true in dictionary $controlDict"
then
echo "$PROGNAME : runTimeModifiable not true in dictionary $controlDict."
exit 1 exit 1
fi }
# #
#- Check if another foamEndJob running #- Check if another foamEndJob running
# #
if [ "$CLEAR" ] if [ "$clear" = true ]
then then
pidFiles=`ls $ROOT/$CASE/.foamEndJob* 2>/dev/null` pidFiles=`ls $caseDir/.foamEndJob* 2>/dev/null`
for pidFile in $pidFiles for pidFile in $pidFiles
do do
pid=`cat $pidFile` pid=`cat $pidFile`
if [ "$pid" ] if [ "$pid" ]
then then
echo "$PROGNAME : found $PROGNAME (pid $pid) for Foam process" echo "$Script : found $Script (pid $pid) for OpenFOAM process"
echo " root: $ROOT" echo " case: $PWD/$caseDir"
echo " case: $CASE" echo "$Script : Killing $Script (pid $pid)"
echo "$PROGNAME : Killing $PROGNAME (pid $pid)."
kill $pid kill $pid
rm -f $pidFile rm -f $pidFile
fi fi
@ -302,7 +290,7 @@ then
exit 0 exit 0
fi fi
pidFile=$ROOT/$CASE/.foamEndJob${PID} pidFile=$caseDir/.foamEndJob$PID
if [ -f $pidFile ] if [ -f $pidFile ]
then then
pid=`cat $pidFile` pid=`cat $pidFile`
@ -311,12 +299,11 @@ then
processExists $pid processExists $pid
if [ $? -eq 0 ] if [ $? -eq 0 ]
then then
echo "$PROGNAME : found running $PROGNAME (pid $pid) for Foam process" echo "$Script : found running $Script (pid $pid) for OpenFOAM process"
echo " root: $ROOT" echo " case: $PWD/$caseDir"
echo " case: $CASE"
echo " pid : $PID" echo " pid : $PID"
echo " lock: $pidFile" echo " lock: $pidFile"
echo "Remove the lock if this is not the case." echo "Remove the lock if this is not the case"
exit 1 exit 1
fi fi
fi fi
@ -331,63 +318,60 @@ echo $$ > $pidFile
#- startTime #- startTime
startTime=`getEntry $controlDict 'startTime'` startTime=`getEntry $controlDict startTime`
if [ ! "$startTime" ] [ "$startTime" ] || {
then echo "$Script : startTime not set in dictionary $controlDict"
echo "$PROGNAME : startTime not set in dictionary $controlDict."
exit 1 exit 1
fi }
#- Write interval #- Write interval
writeInterval=`getEntry $controlDict 'writeInterval'` writeInterval=`getEntry $controlDict writeInterval`
if [ ! "$writeInterval" ] [ "$writeInterval" ] || {
then echo "$Script : writeInterval not set in dictionary $controlDict"
echo "$PROGNAME : writeInterval not set in dictionary $controlDict."
exit 1 exit 1
fi }
#- stopAt #- stopAt
stopAt=`getEntry $controlDict 'stopAt'` stopAt=`getEntry $controlDict stopAt`
if [ ! "$stopAt" ] [ "$stopAt" ] || {
then echo "$Script : stopAt not set in dictionary $controlDict"
echo "$PROGNAME : stopAt not set in dictionary $controlDict."
exit 1 exit 1
fi }
#- endTime #- endTime
endTime=`getEntry $controlDict 'endTime'` endTime=`getEntry $controlDict endTime`
if [ ! "$endTime" ] [ "$endTime" ] || {
then echo "$Script : endTime not set in dictionary $controlDict"
echo "$PROGNAME : endTime not set in dictionary $controlDict."
exit 1 exit 1
fi }
echo "$PROGNAME : Read from controlDict:" echo "$Script : Read from controlDict:"
echo " controlDict : $controlDict" echo " controlDict : $controlDict"
echo " writeInterval : $writeInterval" echo " writeInterval : $writeInterval"
#echo " startTime : $startTime" #echo " startTime : $startTime"
echo " stopAt : $stopAt" echo " stopAt : $stopAt"
#echo " endTime : $endTime" #echo " endTime : $endTime"
echo "$PROGNAME : Making backup of controlDict to controlDict_bak" echo "$Script : Making backup of controlDict to controlDict_bak"
cp $controlDict ${controlDict}_bak cp $controlDict ${controlDict}_bak
#- Set up handler to restore controlDict #- Set up handler to restore controlDict
trap restoreDict 2 3 15 trap restoreDict QUIT TERM INT
if [ "$STOPNOW" ] if [ "$stopOpt" = now ]
then then
setRawEntry $controlDict 'stopAt' 'nextWrite' setRawEntry $controlDict stopAt nextWrite
setRawEntry $controlDict 'writeInterval' '1' setRawEntry $controlDict writeInterval 1
echo "$PROGNAME : Changed in controlDict:" echo "$Script : Changed in controlDict:"
echo " `getLine $controlDict 'stopAt'`" echo " `getLine $controlDict stopAt`"
echo " `getLine $controlDict 'writeInterval'`" echo " `getLine $controlDict writeInterval`"
else else
setRawEntry $controlDict 'stopAt' 'nextWrite' setRawEntry $controlDict stopAt nextWrite
echo "$PROGNAME : Changed in controlDict:" echo "$Script : Changed in controlDict:"
echo " `getLine $controlDict 'stopAt'`" echo " `getLine $controlDict stopAt`"
fi fi
@ -401,23 +385,24 @@ sleep 5
touch ${controlDict}_bak touch ${controlDict}_bak
#- Loop a while to give NFS time to update #- Loop a while to give NFS time to update
if newerFile ${controlDict} ${controlDict}_bak; then if [ ${controlDict} -nt ${controlDict}_bak ]
echo "$PROGNAME : controlDict newer than controlDict_bak." then
echo "$PROGNAME : Waiting for file dates to get updated." echo "$Script : controlDict newer than controlDict_bak"
echo "$Script : Waiting for file dates to get updated"
iter=0 iter=0
while newerFile ${controlDict} ${controlDict}_bak while [ ${controlDict} -nt ${controlDict}_bak ]
do do
if [ $iter -ge 120 ] if [ $iter -ge 120 ]
then then
#- 120*5 sec = 10 mins passed. Give up #- 120*5 sec = 10 mins passed. Give up
echo "$PROGNAME : File date not yet ok after 10 mins. Giving up." echo "$Script : File date not yet ok after 10 mins ... giving up"
break break
fi fi
#- Give _bak a later time #- Give _bak a later time
touch ${controlDict}_bak touch ${controlDict}_bak
#- Give nfs some time to update time on controlDict. #- Give NFS a chance to update time on controlDict.
sleep 5 sleep 5
iter=`expr $iter + 1` iter=`expr $iter + 1`
@ -430,21 +415,20 @@ fi
# - controlDict modified. No restore. # - controlDict modified. No restore.
# - controlDict_bak removed. No restore. # - controlDict_bak removed. No restore.
echo "$PROGNAME : Waiting for Foam job $PID to finish ..." echo "$Script : Waiting for OpenFOAM job $PID to finish ..."
while true while true
do do
sleep 5 sleep 5
if [ ! -r ${controlDict}_bak ] [ -r ${controlDict}_bak ] || {
then echo "$Script : ${controlDict}_bak disappeared. Exiting without restore"
echo "$PROGNAME : ${controlDict}_bak dissappeared. Exiting without restore."
exit 1 exit 1
fi }
if newerFile ${controlDict} ${controlDict}_bak if [ ${controlDict} -nt ${controlDict}_bak ]
then then
echo "$PROGNAME : ${controlDict} modified externally. Exiting without restore." echo "$Script : ${controlDict} modified externally. Exiting without restore"
exit 0 exit 0
fi fi
@ -454,7 +438,7 @@ do
#- Job finished #- Job finished
break break
fi fi
# echo "Foam job $PID still running ..." # echo "OpenFOAM job $PID still running ..."
done done
#- Dictionary restore #- Dictionary restore

View File

@ -31,35 +31,36 @@
# Bugs # Bugs
# -solution singularity not handled # -solution singularity not handled
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
Script=${0##*/}
toolsDir=${0%/*}/tools
PROGDIR=`dirname $0` usage() {
PROGNAME=`basename $0` while [ "$#" -ge 1 ]; do echo "$1"; shift; done
DBFILE=${PROGNAME}.db
printUsage() {
cat <<USAGE cat <<USAGE
$PROGNAME - extracts xy files from OpenFOAM logs.
Usage: $PROGNAME [-n][-s] <log> Usage: $Script [OPTIONS] <log>
extracts xy files from log -list lists but does not extract
$PROGNAME -l <log> -n create single column files with the extracted data only
lists but does not extract -quiet quiet operation
$PROGNAME -h -help print the usage
for a help message
$Script - extracts xy files from OpenFOAM logs.
USAGE USAGE
exit 1
} }
#------------------------------------------------------------------------------
printHelp() { printHelp() {
printUsage cat <<HELP
cat <<LABHELP -----------------------------------------------------------------------------
The default is to extract for all the 'Solved for' variables the initial The default is to extract for all the 'Solved for' variables the initial
residual, the final residual and the number of iterations. Additionally, a residual, the final residual and the number of iterations. Additionally, a
(user editable) database is used to extract data for standard non-solved for (user editable) database is used to extract data for standard non-solved for
variables like Courant number, and execution time. variables like Courant number, and execution time.
$PROGNAME -l lists all the possible variables without extracting them. $Script -l lists all the possible variables without extracting them.
The program will generate and run an awk script which writes a set of files, The program will generate and run an awk script which writes a set of files,
logs/<var>_<subIter>, for every <var> specified, for every occurrence inside logs/<var>_<subIter>, for every <var> specified, for every occurrence inside
@ -79,7 +80,7 @@ separated with '/' :
Column 2 is the extended regular expression (egrep) to select the line. Column 2 is the extended regular expression (egrep) to select the line.
Column 3 is the string (fgrep) to select the column inside the line. Column 3 is the string (fgrep) to select the column inside the line.
The value taken will be the first (non-space)word after this column. The value taken will be the first (non-space)word after this column.
The database ($PROGNAME.db) will taken from these locations: The database ($Script.db) will taken from these locations:
. .
$HOME/.OpenFOAM/$WM_PROJECT_VERSION $HOME/.OpenFOAM/$WM_PROJECT_VERSION
@ -87,61 +88,97 @@ The database ($PROGNAME.db) will taken from these locations:
$WM_PROJECT_INST_DIR/site/$WM_PROJECT_VERSION $WM_PROJECT_INST_DIR/site/$WM_PROJECT_VERSION
$WM_PROJECT_INST_DIR/site $WM_PROJECT_INST_DIR/site
$WM_PROJECT_DIR/etc $WM_PROJECT_DIR/etc
$PROGDIR/tools $toolsDir
Option -s suppresses the default information and only prints the extracted Option -q suppresses the default information and only prints the extracted
variables. variables.
-----------------------------------------------------------------------------
HELP
LABHELP usage
} }
# The various places to be searched: timeName=Time
for i in \ unset listOpt quietOpt
. \
$HOME/.OpenFOAM/$WM_PROJECT_VERSION \ # parse options
$HOME/.OpenFOAM \ while [ "$#" -gt 0 ]
$WM_PROJECT_INST_DIR/site/$WM_PROJECT_VERSION \
$WM_PROJECT_INST_DIR/site \
$WM_PROJECT_DIR/etc \
$PROGDIR/tools \
;
do do
if [ -r $i/$DBFILE ] case "$1" in
then -h | -help)
DBFILE="$i/$DBFILE" printHelp
exit 0
;;
-n)
unset timeName
shift
;;
-l | -list)
listOpt=true
shift
;;
-q | -quiet | -s | -silent)
quietOpt=true
shift
;;
-*)
usage "unknown option: '$*'"
;;
*)
break break
fi ;;
esac
done done
# find the database file
DBFILE=$Script.db
[ -f $DBFILE ] || DBFILE=`foamEtcFile $Script.db` || DBFILE=$toolsDir/$Script.db
myEcho() { # need the database file
if [ "$VERBOSE" ] [ -f $DBFILE ] || {
then echo "$Script: Cannot read database $DBFILE"
echo "$*" exit 1
fi
} }
# single logFile
if [ $# -eq 1 ]
then
LOG=$1
[ -r "$LOG" ] && [ -f "$LOG" ] || usage "Cannot read log $LOG"
else
usage
fi
myEcho()
{
[ "$quietOpt" = true ] || echo "$*"
}
# getSolvedVars logFile # getSolvedVars logFile
# Prints names of all 'solved for' variables in the log file. # Prints names of all 'solved for' variables in the log file.
getSolvedVars() { getSolvedVars()
{
fgrep ' Solving for ' $1 | fgrep ',' | sed -e 's/.* Solving for \([^,]*\)[,:].*/\1/' | sort -u fgrep ' Solving for ' $1 | fgrep ',' | sed -e 's/.* Solving for \([^,]*\)[,:].*/\1/' | sort -u
} }
# getQueries dbFile queryName # getQueries dbFile queryName
# Gets regular expressions for a certain queryName from the database # Gets regular expressions for a certain queryName from the database
getQueries() { getQueries()
if [ ! -f "$1" ] {
then dbFile=$1
echo "Cannot find dbFile $1"
exit 1
fi
queryName=$2 queryName=$2
LINEQ=`grep -v '^#' $1 | awk -F '/' "/$queryName/ {if (\"$queryName\" "'!= $1) next; print $2}'` [ -f "$dbFile" ] || {
NUMQ=`grep -v '^#' $1 | awk -F '/' "/$queryName/ {if (\"$queryName\" "'!= $1) next; print $3}'` echo "Cannot find dbFile $dbFile"
exit 1
}
LINEQ=`grep -v '^#' $dbFile | awk -F '/' "/$queryName/ {if (\"$queryName\" "'!= $1) next; print $2}'`
NUMQ=`grep -v '^#' $dbFile | awk -F '/' "/$queryName/ {if (\"$queryName\" "'!= $1) next; print $3}'`
#echo "For $queryName found line selection /$LINEQ/ , column selection /$NUMQ/" 1>&2 #echo "For $queryName found line selection /$LINEQ/ , column selection /$NUMQ/" 1>&2
#if [ ! "$LINEQ" -o ! "$NUMQ" ] #if [ ! "$LINEQ" -o ! "$NUMQ" ]
@ -153,14 +190,16 @@ getQueries() {
# getDbQueryList dbFile # getDbQueryList dbFile
# Echoes list of possible queries # Echoes list of possible queries
getDbQueryList() { getDbQueryList()
{
grep -v '^#' $1 | grep '[^ \t]' | awk -F '/' '{print $1}' grep -v '^#' $1 | grep '[^ \t]' | awk -F '/' '{print $1}'
} }
# getSolveQueryList logFile # getSolveQueryList logFile
# Echoes list of queries from "solved for" variables in log file # Echoes list of queries from "solved for" variables in log file
getSolveQueryList() { getSolveQueryList()
{
solvedVars=`getSolvedVars $1` solvedVars=`getSolvedVars $1`
for var in $solvedVars for var in $solvedVars
@ -174,7 +213,8 @@ getSolveQueryList() {
# getAllQueries dbFile logFile # getAllQueries dbFile logFile
# Gets all queries from database and from logfile # Gets all queries from database and from logfile
getAllQueries() { getAllQueries()
{
#-- All solved for queries from log file #-- All solved for queries from log file
queries=`getSolveQueryList $2` queries=`getSolveQueryList $2`
@ -208,107 +248,33 @@ getAllQueries() {
# Main # Main
#----------------------------- #-----------------------------
# sort arguments if [ "$listOpt" = true ]
TIMENAME='Time'
VERBOSE='yes'
LISTONLY=''
while getopts nslh flags
do
case $flags in
n)
TIMENAME=""
;;
h)
printHelp
exit 0
;;
s)
VERBOSE=""
;;
l)
LISTONLY='yes'
;;
\?)
printUsage
exit 1
;;
esac
done
# Shift options
shift `expr $OPTIND - 1`
if [ ! -f $DBFILE ]
then then
echo "$PROGNAME: Cannot read database $DBFILE"
exit 1
fi
if [ "$LISTONLY" ]
then
if [ $# -ne 1 ]
then
printUsage
exit 1
fi
LOG=$1;
if [ ! -r $LOG ]
then
echo "$PROGNAME: Cannot read log $LOG"
exit 1
fi
getAllQueries $DBFILE $LOG getAllQueries $DBFILE $LOG
exit 0 exit 0
fi fi
if [ $# -ne 1 ] caseDir=.
then outputDir=$caseDir/logs
printUsage
exit 1
fi
CASEDIR=. [ -d "$caseDir" ] || {
LOG=$1 echo "$Script: Cannot read $caseDir"
if [ ! -r $LOG ]
then
echo "$PROGNAME: Cannot read log $LOG"
exit 1 exit 1
fi }
QUERYNAMES=`getAllQueries $DBFILE $LOG` QUERYNAMES=`getAllQueries $DBFILE $LOG`
#
if [ ! "$CASEDIR" ] # Make logs dir in case directory and place awk file there
then #
printUsage mkdir -p $outputDir
exit 1 AWKFILE=$outputDir/$Script.awk
fi
if [ ! -d "$CASEDIR" ]
then
echo "$PROGNAME: Cannot read $CASEDIR"
exit 1
fi
if [ ! -f "$LOG" ]
then
echo "$PROGNAME: Cannot read log file $LOG"
exit 1
fi
#-- Make logs dir in case directory and put awk file there.
mkdir -p $CASEDIR/logs
AWKFILE=$CASEDIR/logs/$PROGNAME.awk
myEcho "Using:" myEcho "Using:"
myEcho " log : $LOG" myEcho " log : $LOG"
myEcho " database : $DBFILE" myEcho " database : $DBFILE"
myEcho " awk file : $AWKFILE" myEcho " awk file : $AWKFILE"
myEcho " files to : $CASEDIR/logs" myEcho " files to : $outputDir"
myEcho "" myEcho ""
@ -316,22 +282,25 @@ myEcho ""
# Generate Awk program # Generate Awk program
#----------------------------- #-----------------------------
#-- header rm -f $AWKFILE 2> /dev/null
cat << AWK_CONTENTS > $AWKFILE
# header
BEGIN {
Iteration=0
resetCounters()
}
rm -f $AWKFILE; touch $AWKFILE # reset counters used for variable postfix
echo "BEGIN {" >> $AWKFILE function resetCounters() {
echo " Iteration=0" >> $AWKFILE AWK_CONTENTS
echo " resetCounters()" >> $AWKFILE # ----------
echo "}" >> $AWKFILE
echo "" >> $AWKFILE
echo "# reset counters used for variable postfix" >> $AWKFILE
echo "function resetCounters() {" >> $AWKFILE
for queryName in $QUERYNAMES for queryName in $QUERYNAMES
do do
varName=${queryName}Cnt varName=${queryName}Cnt
echo " ${varName}=0" >> $AWKFILE echo " ${varName}=0" >> $AWKFILE
done done
echo " # Reset counters for general Solving for extraction" >> $AWKFILE echo " # Reset counters for general Solving for extraction" >> $AWKFILE
echo " for (varName in subIter)" >> $AWKFILE echo " for (varName in subIter)" >> $AWKFILE
echo " {" >> $AWKFILE echo " {" >> $AWKFILE
@ -341,10 +310,9 @@ echo "}" >> $AWKFILE
echo "" >> $AWKFILE echo "" >> $AWKFILE
cat <<LABEL >> $AWKFILE cat << AWK_CONTENTS >> $AWKFILE
# Extract value after columnSel # Extract value after columnSel
function extract(inLine,columnSel,outVar, function extract(inLine,columnSel,outVar,a,b)
a,b)
{ {
a=index(inLine, columnSel) a=index(inLine, columnSel)
b=length(columnSel) b=length(columnSel)
@ -352,71 +320,82 @@ function extract(inLine,columnSel,outVar,
gsub("[,:]","",outVar[1]) gsub("[,:]","",outVar[1])
} }
LABEL AWK_CONTENTS
# ----------
#
#-- Generate code for iteration separator (increments 'Iteration') # Code for iteration separator (increments 'Iteration')
#
getQueries $DBFILE 'Separator' getQueries $DBFILE 'Separator'
cat <<LABSEP >> $AWKFILE cat << AWK_CONTENTS >> $AWKFILE
#-- Iteration separator (increments 'Iteration') # Iteration separator (increments 'Iteration')
/$LINEQ/ { /$LINEQ/ {
Iteration++ Iteration++
resetCounters() resetCounters()
} }
LABSEP AWK_CONTENTS
# ----------
#
#-- Generate code for extracting Time # Code for extracting Time
#
getQueries $DBFILE 'Time' getQueries $DBFILE 'Time'
cat <<LABTIME >> $AWKFILE cat << AWK_CONTENTS >> $AWKFILE
#-- Time extraction (sets 'Time') # Time extraction (sets 'Time')
/$LINEQ/ { /$LINEQ/ {
extract(\$0, "$NUMQ", val) extract(\$0, "$NUMQ", val)
Time=val[1] Time=val[1]
} }
LABTIME AWK_CONTENTS
# ----------
#
#-- Generate code for singularity handling. # Code for singularity handling.
cat <<LABSING >> $AWKFILE #
#-- Skip whole line with singularity variable cat << AWK_CONTENTS >> $AWKFILE
# Skip whole line with singularity variable
/solution singularity/ { /solution singularity/ {
next; next;
} }
LABSING
AWK_CONTENTS
# ----------
#-- Generate code for extracting solved for quantities #
cat <<LABSOLVE >> $AWKFILE # Code for extracting solved for quantities
#-- Extraction of any solved for variable #
cat << AWK_CONTENTS >> $AWKFILE
# Extraction of any solved for variable
/Solving for/ { /Solving for/ {
extract(\$0, "Solving for ", varNameVal) extract(\$0, "Solving for ", varNameVal)
varName=varNameVal[1] varName=varNameVal[1]
file=varName "_" subIter[varName]++ file=varName "_" subIter[varName]++
file="$CASEDIR/logs/" file file="$outputDir/" file
extract(\$0, "Initial residual = ", val) extract(\$0, "Initial residual = ", val)
print $TIMENAME "\t" val[1] > file print $timeName "\t" val[1] > file
varName=varNameVal[1] "FinalRes" varName=varNameVal[1] "FinalRes"
file=varName "_" subIter[varName]++ file=varName "_" subIter[varName]++
file="$CASEDIR/logs/" file file="$outputDir/" file
extract(\$0, "Final residual = ", val) extract(\$0, "Final residual = ", val)
print $TIMENAME "\t" val[1] > file print $timeName "\t" val[1] > file
varName=varNameVal[1] "Iters" varName=varNameVal[1] "Iters"
file=varName "_" subIter[varName]++ file=varName "_" subIter[varName]++
file="$CASEDIR/logs/" file file="$outputDir/" file
extract(\$0, "No Iterations ", val) extract(\$0, "No Iterations ", val)
print $TIMENAME "\t" val[1] > file print $timeName "\t" val[1] > file
} }
LABSOLVE AWK_CONTENTS
# ----------
#
#-- generate code to process queries # Code to process queries
#
for queryName in $QUERYNAMES for queryName in $QUERYNAMES
do do
getQueries $DBFILE $queryName getQueries $DBFILE $queryName
@ -424,11 +403,11 @@ do
then then
counter=${queryName}Cnt counter=${queryName}Cnt
echo "#-- Extraction of $queryName" >> $AWKFILE echo "# Extraction of $queryName" >> $AWKFILE
echo "/$LINEQ/ {" >> $AWKFILE echo "/$LINEQ/ {" >> $AWKFILE
echo " extract(\$0, \"$NUMQ\", val)" >> $AWKFILE echo " extract(\$0, \"$NUMQ\", val)" >> $AWKFILE
echo " file=\"$CASEDIR/logs/${queryName}_\" ${counter}" >> $AWKFILE echo " file=\"$outputDir/${queryName}_\" ${counter}" >> $AWKFILE
echo " print $TIMENAME \"\\t\" val[1] > file" >> $AWKFILE echo " print $timeName \"\\t\" val[1] > file" >> $AWKFILE
echo " ${counter}++" >> $AWKFILE echo " ${counter}++" >> $AWKFILE
echo "}" >> $AWKFILE echo "}" >> $AWKFILE
echo "" >> $AWKFILE echo "" >> $AWKFILE

View File

@ -55,7 +55,6 @@ USAGE
exit 1 exit 1
} }
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
unset appName caseName listOpt unset appName caseName listOpt
# parse options # parse options
@ -84,12 +83,19 @@ do
version="$2" version="$2"
shift 2 shift 2
;; ;;
-*)
usage "unknown option: '$*'"
;;
*) *)
usage "unknown option/argument: '$*'" usage "unexpected argument: '$*'"
;; ;;
esac esac
done done
# need rsync, except for when listing
type rsync >/dev/null 2>&1 || [ "$listOpt" = true ] || usage "Error: 'rsync' seems to be missing"
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
[ -n "$version" ] || { [ -n "$version" ] || {

View File

@ -32,41 +32,70 @@
# Also removes consecutive blank lines from file. # Also removes consecutive blank lines from file.
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
foamVersion=$WM_PROJECT_VERSION
usage() { usage() {
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
cat<<USAGE cat<<USAGE
Usage: ${0##*/} [OPTION] <file1> ... <fileN> Usage: ${0##*/} [OPTION] <file1> ... <fileN>
options: options:
-v VER specifies the version to be written in the header -version <ver> specifies the version to be written in the header
-h help -help print the usage
Updates the header of application files and removes consecutive blank lines. Updates the header of application files and removes consecutive blank lines.
By default, writes current OpenFOAM version in the header. By default, writes current OpenFOAM version in the header.
An alternative version can be specified with the -v option. An alternative version can be specified with the -version option.
USAGE USAGE
exit 1 exit 1
} }
#------------------------------------------------------------------------------
printHeader() { # parse options
while [ "$#" -gt 0 ]
do
case "$1" in
-h | -help)
usage
;;
-v | -version)
[ "$#" -ge 2 ] || usage "'$1' option requires an argument"
version="$2"
shift 2
;;
-*)
usage "unknown option: '$*'"
;;
*)
break
;;
esac
done
# constant width for version - default to WM_PROJECT_VERSION
version=$(printf %-36s ${version:-$WM_PROJECT_VERSION})
[ $# -ge 1 ] || usage
#------------------------------------------------------------------------------
printHeader()
{
cat<<HEADER cat<<HEADER
/*--------------------------------*- C++ -*----------------------------------*\\ /*--------------------------------*- C++ -*----------------------------------*\\
| ========= | | | ========= | |
| \\\\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\\\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\\\ / O peration | Version: ${foamVersion} | | \\\\ / O peration | Version: $version |
| \\\\ / A nd | Web: www.OpenFOAM.org | | \\\\ / A nd | Web: www.OpenFOAM.org |
| \\\\/ M anipulation | | | \\\\/ M anipulation | |
\\*---------------------------------------------------------------------------*/ \\*---------------------------------------------------------------------------*/
FoamFile FoamFile
{ {
version 2.0; version 2.0;
format ${1}; format $1;
class ${2}; class $2;
object ${3}; object $3;
} }
HEADER HEADER
} }
@ -75,68 +104,40 @@ HEADER
# #
# extract attribute '$1' from file '$2' # extract attribute '$1' from file '$2'
# #
FoamFileAttribute() { FoamFileAttribute()
{
sed -n -e 's/[ ;]*$//' -e "s/^ *$1 *//p" $2 sed -n -e 's/[ ;]*$//' -e "s/^ *$1 *//p" $2
} }
# #
# OPTIONS # main
# #
opts=$(getopt hv: $*)
if [ $? -ne 0 ]
then
echo "Aborting due to invalid option"
usage
fi
eval set -- '$opts'
while [ "$1" != "--" ]
do
case $1 in
-v)
foamVersion=$2
shift
;;
-h)
usage
;;
esac
shift
done
shift
[ $# -ge 1 ] || usage
# constant width for version
foamVersion=$(printf %-36s $foamVersion)
#
# MAIN
#
unset NOTE
tmpFile=FoamFile.tmp$$
for caseFile for caseFile
do do
if grep FoamFile $caseFile >/dev/null 2>&1 if grep FoamFile $caseFile >/dev/null 2>&1
then then
echo "Updating case file: $caseFile" echo "Updating case file: $caseFile"
sed -n '/FoamFile/,/}/p' $caseFile > FoamFile.tmp sed -n '/FoamFile/,/}/p' $caseFile > $tmpFile
FORMAT=$(FoamFileAttribute format FoamFile.tmp) format=$(FoamFileAttribute format $tmpFile)
CLASS=$(FoamFileAttribute class FoamFile.tmp) class=$(FoamFileAttribute class $tmpFile)
OBJECT=$(FoamFileAttribute object FoamFile.tmp) object=$(FoamFileAttribute object $tmpFile)
# extract NOTE? # extract note? - needs special handling
unset note
printHeader $FORMAT $CLASS $OBJECT $NOTE > FoamFile.tmp printHeader $format $class $object "$note" > $tmpFile
sed '1,/}/d' $caseFile | sed '/./,/^$/!d' >> FoamFile.tmp
sed '1,/}/d' $caseFile | sed '/./,/^$/!d' >> $tmpFile
# use cat to avoid removing/replace soft-links # use cat to avoid removing/replace soft-links
[ -s FoamFile.tmp ] && cat FoamFile.tmp >| $caseFile [ -s $tmpFile ] && cat $tmpFile >| $caseFile
rm -f FoamFile.tmp 2>/dev/null rm -f $tmpFile 2>/dev/null
else else
echo " Invalid case file: $caseFile" 1>&2 echo " Invalid case file: $caseFile" 1>&2
fi fi
done done
#------------------------------------------------------------------------------ #------------------------------------------------------------------ end-of-file

View File

@ -2,7 +2,7 @@
# #
#+TITLE: OpenFOAM C++ style guide #+TITLE: OpenFOAM C++ style guide
#+AUTHOR: OpenCFD Ltd. #+AUTHOR: OpenCFD Ltd.
#+DATE: November 2009 #+DATE: April 2010
#+LINK: http://www.opencfd.co.uk #+LINK: http://www.opencfd.co.uk
#+OPTIONS: author:nil ^:{} #+OPTIONS: author:nil ^:{}
@ -18,97 +18,116 @@
made with 'break' or 'continue' as part of a control structure. made with 'break' or 'continue' as part of a control structure.
+ stream output + stream output
=<<= is always four characters after the start of the stream, + =<<= is always four characters after the start of the stream,
so that the =<<= symbols align, i.e. so that the =<<= symbols align, i.e.
:Info<< ... #+BEGIN_EXAMPLE
:os << ... Info<< ...
os << ...
#+END_EXAMPLE
so so
:WarningIn("className::functionName()") #+BEGIN_EXAMPLE
: << "Warning message" WarningIn("className::functionName()")
<< "Warning message"
#+END_EXAMPLE
NOT NOT
:WarningIn("className::functionName()") #+BEGIN_EXAMPLE
:<< "Warning message" WarningIn("className::functionName()")
<< "Warning message"
#+END_EXAMPLE
+ no unnecessary class section headers, i.e. remove + no unnecessary class section headers, i.e. remove
:// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // #+BEGIN_EXAMPLE
: // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
:// Check
: // Check
:// Edit
: // Edit
:// Write
// Write
#+END_EXAMPLE
if they contain nothing, even if planned for 'future use' if they contain nothing, even if planned for 'future use'
+ class titles are centred + class titles are centred
:/*---------------------------------------------------------------------------*\ #+BEGIN_EXAMPLE
: Class exampleClass Declaration /*---------------------------------------------------------------------------*\
:\*---------------------------------------------------------------------------*/ Class exampleClass Declaration
\*---------------------------------------------------------------------------*/
#+END_EXAMPLE
NOT NOT
:/*---------------------------------------------------------------------------*\ #+BEGIN_EXAMPLE
: Class exampleClass Declaration /*---------------------------------------------------------------------------*\
:\*---------------------------------------------------------------------------*/ Class exampleClass Declaration
\*---------------------------------------------------------------------------*/
#+END_EXAMPLE
*** The =.H= Files *** The =.H= Files
+ header file spacing + header file spacing
Leave two empty lines between sections (as per functions in the =.C= file etc) + Leave two empty lines between sections
(as per functions in the =.C= file etc)
+ use "//- Comment" comments in header file + use "//- Comment" comments in header file
+ add descriptions to class data and functions + add descriptions to class data and functions
+ destructor + destructor
If adding a comment to the destructor - use //- and code as a normal function: + If adding a comment to the destructor -
use //- and code as a normal function:
://- Destructor #+BEGIN_EXAMPLE
:~className(); //- Destructor
~className();
#+END_EXAMPLE
+ inline functions + inline functions
Use inline functions where appropriate in a separate classNameI.H file. + Use inline functions where appropriate in a separate classNameI.H file.
Avoid cluttering the header file with function bodies. Avoid cluttering the header file with function bodies.
*** The =.C= Files *** The =.C= Files
+ Do not open/close namespaces in a =.C= file + Do not open/close namespaces in a =.C= file
Fully scope the function name, i.e. + Fully scope the function name, i.e.
:Foam::returnType Foam::className::functionName() #+BEGIN_EXAMPLE
Foam::returnType Foam::className::functionName()
#+END_EXAMPLE
NOT NOT
:namespace Foam #+BEGIN_EXAMPLE
:{ namespace Foam
: ... {
: ...
: returnType className::functionName() returnType className::functionName()
: ...
: ... }
:} #+END_EXAMPLE
EXCEPTION EXCEPTION
When there are multiple levels of namespace, they may be used in the =.C= When there are multiple levels of namespace, they may be used in the =.C=
file, i.e. file, i.e.
:namespace Foam #+BEGIN_EXAMPLE
:{ namespace Foam
:namespace compressible {
:{ namespace compressible
:namespace RASModels {
:{ namespace RASModels
: {
: ... ...
: } // End namespace RASModels
:} // End namespace RASModels } // End namespace compressible
:} // End namespace compressible } // End namespace Foam
:} // End namespace Foam #+END_EXAMPLE
+ Use two empty lines between functions + Use two empty lines between functions
@ -131,64 +150,95 @@
If a class is virtual - make all derived classes virtual. If a class is virtual - make all derived classes virtual.
*** Conditional Statements *** Conditional Statements
:if (condition) #+BEGIN_EXAMPLE
:{ if (condition)
: code; {
:} code;
}
#+END_EXAMPLE
OR OR
:if #+BEGIN_EXAMPLE
:( if
: long condition (
:) long condition
:{ )
: code; {
:} code;
}
#+END_EXAMPLE
NOT (no space between "if" and "(") NOT (no space between "if" and "(")
:if(condition) #+BEGIN_EXAMPLE
:{ if(condition)
: code; {
:} code;
}
#+END_EXAMPLE
*** =for= and =while= Loops *** =for= and =while= Loops
:for (i = 0; i < maxI; i++)
:{ #+BEGIN_EXAMPLE
: code; for (i = 0; i < maxI; i++)
:} {
code;
}
#+END_EXAMPLE
OR OR
:for #+BEGIN_EXAMPLE
:( for
: i = 0; (
: i < maxI; i = 0;
: i++ i < maxI;
:) i++
:{ )
: code; {
:} code;
}
#+END_EXAMPLE
NOT (no space between "for" and "(") NOT (no space between "for" and "(")
:for(i = 0; i < maxI; i++) #+BEGIN_EXAMPLE
:{ for(i = 0; i < maxI; i++)
: code; {
:} code;
}
#+END_EXAMPLE
Note that when indexing through iterators, it is often slightly more Note that when indexing through iterators, it is often slightly more
efficient to use the pre-increment form. Eg, =++iter= instead of =iter++= efficient to use the pre-increment form. Eg, =++iter= instead of =iter++=
*** =forAll= , =forAllIter=, etc. loops *** =forAll=, =forAllIter=, =forAllConstIter=, etc. loops
like =for= loops, but like =for= loops, but
:forAll( #+BEGIN_EXAMPLE
forAll(
#+END_EXAMPLE
NOT NOT
:forAll ( #+BEGIN_EXAMPLE
forAll (
#+END_EXAMPLE
Using the =forAllIter= and =forAllConstIter= macros is generally
advantageous - less typing, easier to find later. However, since
they are macros, they will fail if the iterated object contains
any commas.
The following will FAIL!:
#+BEGIN_EXAMPLE
forAllIter(HashTable<labelPair, edge, Hash<edge> >, foo, iter)
#+END_EXAMPLE
These convenience macros are also generally avoided in other
container classes and OpenFOAM primitive classes.
*** Splitting Over Multiple Lines *** Splitting Over Multiple Lines
@ -198,64 +248,81 @@
+ do not put "const" onto its own line - use a split to keep it with + do not put "const" onto its own line - use a split to keep it with
the function name and arguments. the function name and arguments.
so: so
:const Foam::longReturnTypeName& #+BEGIN_EXAMPLE
:Foam::longClassName::longFunctionName const const Foam::longReturnTypeName&
Foam::longClassName::longFunctionName const
#+END_EXAMPLE
NOT NOT
:const Foam::longReturnTypeName& #+BEGIN_EXAMPLE
: Foam::longClassName::longFunctionName const const Foam::longReturnTypeName&
Foam::longClassName::longFunctionName const
#+END_EXAMPLE
NOR NOR
:const Foam::longReturnTypeName& Foam::longClassName::longFunctionName #+BEGIN_EXAMPLE
:const const Foam::longReturnTypeName& Foam::longClassName::longFunctionName
const
#+END_EXAMPLE
NOR NOR
:const Foam::longReturnTypeName& Foam::longClassName:: #+BEGIN_EXAMPLE
:longFunctionName const const Foam::longReturnTypeName& Foam::longClassName::
longFunctionName const
#+END_EXAMPLE
+ if it needs to be split again, split at the function name (leaving + if it needs to be split again, split at the function name (leaving
behind the preceding scoping "::"s), and again, left align, i.e. behind the preceding scoping "::"s), and again, left align, i.e.
For example, For example,
:const Foam::longReturnTypeName& #+BEGIN_EXAMPLE
:Foam::veryveryveryverylongClassName:: const Foam::longReturnTypeName&
:veryveryveryverylongFunctionName const Foam::veryveryveryverylongClassName::
veryveryveryverylongFunctionName const
#+END_EXAMPLE
**** Splitting long lines at an "=" **** Splitting long lines at an "="
Indent after split Indent after split
:variableName = #+BEGIN_EXAMPLE
: longClassName.longFunctionName(longArgument); variableName =
longClassName.longFunctionName(longArgument);
#+END_EXAMPLE
OR (where necessary) OR (where necessary)
:variableName = #+BEGIN_EXAMPLE
: longClassName.longFunctionName variableName =
: ( longClassName.longFunctionName
: longArgument1, (
: longArgument2 longArgument1,
: ); longArgument2
);
#+END_EXAMPLE
NOT NOT
:variableName = #+BEGIN_EXAMPLE
:longClassName.longFunctionName(longArgument); variableName =
longClassName.longFunctionName(longArgument);
#+END_EXAMPLE
NOR NOR
:variableName = longClassName.longFunctionName #+BEGIN_EXAMPLE
:( variableName = longClassName.longFunctionName
: longArgument1, (
: longArgument2 longArgument1,
:); longArgument2
);
#+END_EXAMPLE
*** Maths and Logic *** Maths and Logic
+ operator spacing + operator spacing
@ -267,34 +334,41 @@
+ a || b, a && b + a || b, a && b
+ splitting formulae over several lines + splitting formulae over several lines
Split and indent as per "splitting long lines at an "="" Split and indent as per "splitting long lines at an "=""
with the operator on the lower line. Align operator so that first with the operator on the lower line. Align operator so that first
variable, function or bracket on the next line is 4 spaces indented i.e. variable, function or bracket on the next line is 4 spaces indented i.e.
:variableName = #+BEGIN_EXAMPLE
: a * (a + b) variableName =
: - exp(c/d) a * (a + b)
: * (k + t); - exp(c/d)
* (k + t);
#+END_EXAMPLE
This is sometime more legible when surrounded by extra parentheses: This is sometime more legible when surrounded by extra parentheses:
:variableName = #+BEGIN_EXAMPLE
:( variableName =
: a * (a + b) (
: - exp(c/d) a * (a + b)
: * (k + t) - exp(c/d)
:); * (k + t)
);
#+END_EXAMPLE
+ splitting logical tests over several lines + splitting logical tests over several lines
outdent the operator so that the next variable to test is aligned with outdent the operator so that the next variable to test is aligned with
the four space indentation, i.e. the four space indentation, i.e.
:if #+BEGIN_EXAMPLE
:( if
: a == true (
: && b == c a == true
:) && b == c
)
#+END_EXAMPLE
** Documentation ** Documentation
@ -315,14 +389,16 @@
For example, For example,
:Class #+BEGIN_EXAMPLE
: Foam::myClass Class
: Foam::myClass
:Description
: A class for specifying the documentation style. Description
: A class for specifying the documentation style.
: The class is implemented as a set of recommendations that may
: sometimes be useful. The class is implemented as a set of recommendations that may
sometimes be useful.
#+END_EXAMPLE
+ The class name must be qualified by its namespace, otherwise Doxygen + The class name must be qualified by its namespace, otherwise Doxygen
will think you are documenting some other class. will think you are documenting some other class.
@ -332,11 +408,13 @@
finding these under-documented classes later. finding these under-documented classes later.
:Class #+BEGIN_EXAMPLE
: Foam::myUnderDocumentedClass Class
: Foam::myUnderDocumentedClass
:Description
: Foam::myUnderDocumentedClass Description
Foam::myUnderDocumentedClass
#+END_EXAMPLE
+ Use 'Class' and 'Namespace' tags in the header files. + Use 'Class' and 'Namespace' tags in the header files.
@ -346,11 +424,13 @@
The Description block then applies to documenting the file itself. The Description block then applies to documenting the file itself.
:InClass #+BEGIN_EXAMPLE
: Foam::myClass InClass
: Foam::myClass
:Description
: Implements the read and writing of files. Description
Implements the read and writing of files.
#+END_EXAMPLE
*** Doxygen Special Commands *** Doxygen Special Commands
@ -368,29 +448,31 @@
Doxygen commmands can be inserted within the block without problems. Doxygen commmands can be inserted within the block without problems.
:InClass #+BEGIN_EXAMPLE
: Foam::myClass InClass
: Foam::myClass
:Description
: Implements the read and writing of files. Description
: Implements the read and writing of files.
: An example input file:
: @verbatim An example input file:
: patchName @verbatim
: { patchName
: type myPatchType; {
: refValue 100; type myPatchType;
: value uniform 1; refValue 100;
: } value uniform 1;
: @endverbatim }
: @endverbatim
: Within the implementation, a loop over all patches is done:
: @code Within the implementation, a loop over all patches is done:
: forAll(patches, patchI) @code
: { forAll(patches, patchI)
: ... // some operation {
: } ... // some operation
: @endcode }
@endcode
#+END_EXAMPLE
*** HTML Special Commands *** HTML Special Commands
@ -399,28 +481,34 @@
Doxygen to complain, but seem to work anyhow. Doxygen to complain, but seem to work anyhow.
eg, eg,
+ The template with type <HR> is a bad example. + The template with type =<HR>= is a bad example.
+ The template with type \<HR\> is a better example. + The template with type =\<HR\>= is a better example.
+ The template with type <Type> causes Doxygen to complain about an + The template with type =<Type>= causes Doxygen to complain about an
unknown html type, but it seems to work okay anyhow. unknown html type, but it seems to work okay anyhow.
*** Documenting Namespaces *** Documenting Namespaces
+ If namespaces are explictly declared with the Namespace() macro, + If namespaces are explictly declared with the =Namespace()= macro,
they should be documented there. they should be documented there.
+ If the namespaces is used to hold sub-models, the namespace can be + If the namespaces is used to hold sub-models, the namespace can be
documented in the same file as the class with the model selector. documented in the same file as the class with the model selector.
eg, eg,
:documented namespace 'Foam::functionEntries' within the
:class 'Foam::functionEntry' #+BEGIN_EXAMPLE
documented namespace 'Foam::functionEntries' within the
class 'Foam::functionEntry'
#+END_EXAMPLE
+ If nothing else helps, find some sensible header. + If nothing else helps, find some sensible header.
eg, eg,
:namespace 'Foam' is documented in the foamVersion.H file
#+BEGIN_EXAMPLE
namespace 'Foam' is documented in the foamVersion.H file
#+END_EXAMPLE
*** Documenting Typedefs and classes defined via macros *** Documenting Typedefs and classes defined via macros
@ -459,7 +547,9 @@
Press. Press.
Eg, Eg,
:myClass.initialize() #+BEGIN_EXAMPLE
myClass.initialize()
#+END_EXAMPLE
The word "its" (possesive) vs. "it's" (colloquial for "it is" or "it has") The word "its" (possesive) vs. "it's" (colloquial for "it is" or "it has")
@ -468,4 +558,3 @@
Any remaining "it's" are likely an incorrect spelling of "its". Any remaining "it's" are likely an incorrect spelling of "its".

View File

@ -56,8 +56,7 @@ public:
{} {}
// Destructor //- Destructor
virtual ~ODE() virtual ~ODE()
{} {}

View File

@ -103,8 +103,7 @@ public:
); );
// Destructor //- Destructor
virtual ~ODESolver() virtual ~ODESolver()
{} {}

View File

@ -102,8 +102,7 @@ public:
//- Construct from std::string (or string), optionally ignoring case //- Construct from std::string (or string), optionally ignoring case
regExp(const std::string&, const bool ignoreCase=false); regExp(const std::string&, const bool ignoreCase=false);
// Destructor //- Destructor
~regExp(); ~regExp();

View File

@ -99,8 +99,7 @@ public:
sigFpe(); sigFpe();
// Destructor //- Destructor
~sigFpe(); ~sigFpe();

View File

@ -70,8 +70,7 @@ public:
sigInt(); sigInt();
// Destructor //- Destructor
~sigInt(); ~sigInt();

View File

@ -70,8 +70,7 @@ public:
sigQuit(); sigQuit();
// Destructor //- Destructor
~sigQuit(); ~sigQuit();

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