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,9 +128,8 @@ public:
);
// Destructor
virtual ~basicSubGrid();
//- Destructor
virtual ~basicSubGrid();
// Member Functions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -84,7 +84,7 @@
multivariateSurfaceInterpolationScheme<scalar>::fieldTable fields;
forAll (Y, i)
forAll(Y, i)
{
fields.add(Y[i]);
}

View File

@ -94,10 +94,9 @@ public:
);
// Destructor
~threePhaseMixture()
{}
//- Destructor
~threePhaseMixture()
{}
// Member Functions

View File

@ -96,10 +96,9 @@ public:
);
// Destructor
virtual ~Kunz()
{}
//- Destructor
virtual ~Kunz()
{}
// Member Functions

View File

@ -90,10 +90,9 @@ public:
);
// Destructor
virtual ~Merkle()
{}
//- Destructor
virtual ~Merkle()
{}
// Member Functions

View File

@ -103,10 +103,9 @@ public:
);
// Destructor
virtual ~SchnerrSauer()
{}
//- Destructor
virtual ~SchnerrSauer()
{}
// Member Functions

View File

@ -121,10 +121,9 @@ public:
);
// Destructor
virtual ~phaseChangeTwoPhaseMixture()
{}
//- Destructor
virtual ~phaseChangeTwoPhaseMixture()
{}
// Member Functions

View File

@ -209,10 +209,9 @@ public:
);
// Destructor
~multiphaseMixture()
{}
//- Destructor
~multiphaseMixture()
{}
// Member Functions

View File

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

View File

@ -114,12 +114,7 @@ int main(int argc, char *argv[])
dict.swapDown(dict.first());
for
(
Dictionary<ent>::const_iterator iter = dict.begin();
iter != dict.end();
++iter
)
forAllConstIter(Dictionary<ent>, dict, iter)
{
Info<< "element : " << *iter;
}
@ -159,12 +154,7 @@ int main(int argc, char *argv[])
}
Info<< nl << "scalarDict1: " << endl;
for
(
PtrDictionary<Scalar>::const_iterator iter = scalarDict.begin();
iter != scalarDict.end();
++iter
)
forAllConstIter(PtrDictionary<Scalar>, scalarDict, iter)
{
Info<< " = " << iter() << endl;
}
@ -176,12 +166,7 @@ int main(int argc, char *argv[])
scalarDict2.insert(key, new Scalar(1.3*i));
}
Info<< nl << "scalarDict2: " << endl;
for
(
PtrDictionary<Scalar>::const_iterator iter = scalarDict2.begin();
iter != scalarDict2.end();
++iter
)
forAllConstIter(PtrDictionary<Scalar>, scalarDict2, iter)
{
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;
for
(
SLList<scalar>::iterator iter = myList.begin();
iter != myList.end();
++iter
)
forAllIter(SLList<scalar>, myList, iter)
{
Info<< "element:" << *iter << endl;
}
@ -92,14 +87,9 @@ int main(int argc, char *argv[])
const ISLList<Scalar>& const_myList = myList;
for
(
SLList<scalar>::const_iterator iter2 = const_myList.begin();
iter2 != const_myList.end();
++iter2
)
forAllConstIter(SLList<scalar>, const_myList, iter)
{
Info<< "element:" << *iter2 << endl;
Info<< "element:" << *iter << endl;
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -238,9 +238,8 @@ public:
);
// Destructor
~sammMesh();
//- Destructor
~sammMesh();
// Member Functions

View File

@ -299,9 +299,8 @@ public:
);
// Destructor
~starMesh();
//- Destructor
~starMesh();
// Member Functions

View File

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

View File

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

View File

@ -143,12 +143,7 @@ void addPatchFields(fvMesh& mesh, const word& patchFieldType)
mesh.objectRegistry::lookupClass<GeoField>()
);
for
(
typename HashTable<const GeoField*>::const_iterator iter = flds.begin();
iter != flds.end();
++iter
)
forAllConstIter(typename HashTable<const GeoField*>, flds, iter)
{
const GeoField& fld = *iter();
@ -183,12 +178,7 @@ void trimPatchFields(fvMesh& mesh, const label nPatches)
mesh.objectRegistry::lookupClass<GeoField>()
);
for
(
typename HashTable<const GeoField*>::const_iterator iter = flds.begin();
iter != flds.end();
++iter
)
forAllConstIter(typename HashTable<const GeoField*>, flds, iter)
{
const GeoField& fld = *iter();
@ -209,12 +199,7 @@ void reorderPatchFields(fvMesh& mesh, const labelList& oldToNew)
mesh.objectRegistry::lookupClass<GeoField>()
);
for
(
typename HashTable<const GeoField*>::const_iterator iter = flds.begin();
iter != flds.end();
++iter
)
forAllConstIter(typename HashTable<const GeoField*>, flds, iter)
{
const GeoField& fld = *iter();
@ -1461,7 +1446,7 @@ int main(int argc, char *argv[])
mesh.setInstance(meshInstance);
}
// Change master and slave boundary conditions on originating mesh

View File

@ -102,10 +102,9 @@ public:
mergePolyMesh(const IOobject& io);
// Destructor
virtual ~mergePolyMesh()
{}
//- Destructor
virtual ~mergePolyMesh()
{}
// Member Functions

View File

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

View File

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

View File

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

View File

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

View File

@ -360,7 +360,7 @@ int main(int argc, char *argv[])
labelList osf(slavePatch.size());
forAll (osf, i)
forAll(osf, i)
{
osf[i] = slavePatch.start() + i;
}

View File

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

View File

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

View File

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

View File

@ -230,9 +230,8 @@ public:
);
// Destructor
~fvFieldDecomposer();
//- Destructor
~fvFieldDecomposer();
// Member Functions

View File

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

View File

@ -138,9 +138,8 @@ public:
);
// Destructor
~pointFieldDecomposer();
//- Destructor
~pointFieldDecomposer();
// Member Functions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -26,13 +26,14 @@ word format
conversionProperties.lookup("format")
);
if ( (format != "ascii") && (format != "ieeei4r8") )
if ((format != "ascii") && (format != "ieeei4r8"))
{
FatalError << "format type: " << format << " unknown."
<< " Valid options are: ascii ieeei4r8"
<< abort(FatalError);
}
word cells
(
conversionProperties.lookup("cells")

View File

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

View File

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

View File

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

View File

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

View File

@ -693,8 +693,7 @@ public:
//- Destructor
~vtkPV3Foam();
~vtkPV3Foam();
// Member Functions

View File

@ -312,8 +312,7 @@ public:
//- Destructor
~vtkPV3blockMesh();
~vtkPV3blockMesh();
// Member Functions

View File

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

View File

@ -17,7 +17,7 @@ int USERD_get_part_node_ids
nodeid_array[indx] = indx + 1;
}
}
else if (part_number < nPatches+2)
else if (part_number < nPatches+2)
{
label patchi = part_number-2;
@ -32,18 +32,14 @@ int USERD_get_part_node_ids
}
}
else if (part_number == nPatches+2)
else if (part_number == nPatches+2)
{
label indx = 0;
for
(
Cloud<passiveParticle>::iterator elmnt = sprayPtr->begin();
elmnt != sprayPtr->end();
++elmnt
)
forAllConstIter(Cloud<passiveParticle>, *sprayPtr, iter)
{
nodeid_array[indx] = indx + 1;
indx++;
nodeid_array[indx] = indx + 1;
indx++;
}
}
else

View File

@ -116,9 +116,8 @@ public:
readerDatabase();
// Destructor
~readerDatabase();
//- Destructor
~readerDatabase();
// Member Functions

View File

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

View File

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

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -39,12 +39,7 @@ void UnMapped(const IOobjectList& objects)
{
IOobjectList fields = objects.lookupClass(Type::typeName);
for
(
IOobjectList::iterator fieldIter = fields.begin();
fieldIter != fields.end();
++fieldIter
)
forAllConstIter(IOobjectList, fields, fieldIter)
{
mvBak(fieldIter()->objectPath(), "unmapped");
}

View File

@ -126,18 +126,13 @@ void dumpFaces
OFstream os(fName);
for
(
Map<label>::const_iterator iter = connectedFaces.begin();
iter != connectedFaces.end();
++iter
)
forAllConstIter(Map<label>, connectedFaces, iter)
{
const labelledTri& f = surf.localFaces()[iter.key()];
point ctr(f.centre(surf.localPoints()));
os << "v " << ctr.x() << ' ' << ctr.y() << ' ' << ctr.z() << endl;
os << "v " << ctr.x() << ' ' << ctr.y() << ' ' << ctr.z() << endl;
}
}
@ -502,14 +497,9 @@ void calcPointVecs
boolList edgeDone(surf.nEdges(), false);
for
(
Map<label>::const_iterator iter = faceToEdge.begin();
iter != faceToEdge.end();
++iter
)
forAllConstIter(Map<label>, faceToEdge, iter)
{
label edgeI = iter();
const label edgeI = iter();
if (!edgeDone[edgeI])
{
@ -610,15 +600,9 @@ void renumberFaces
List<labelledTri>& newTris
)
{
for
(
Map<label>::const_iterator iter = faceToEdge.begin();
iter != faceToEdge.end();
++iter
)
forAllConstIter(Map<label>, faceToEdge, iter)
{
label faceI = iter.key();
const label faceI = iter.key();
const labelledTri& f = surf.localFaces()[faceI];
forAll(f, fp)

View File

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

View File

@ -37,9 +37,12 @@
# to add any custom rsync options.
#-------------------------------------------------------------------------------
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
Usage: $Script srcDir dstDir
Copy OpenFOAM settings from one case to another, without copying
@ -52,7 +55,29 @@ Note
USAGE
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%/}
dstDir=${2%/}

View File

@ -35,8 +35,94 @@
# 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
#-------------------------------------------------------------------------------
@ -54,7 +140,7 @@ getNumberedLine() {
# getLine dictionary entry
# Prints dictionary entry line (without lineno)
getLine() {
getNumberedLine $1 "$2" | sed -e 's/^[^:]*://'
getNumberedLine $1 "$2" | sed -e 's/^[^:]*://'
}
# getRawEntry dictionary entry
@ -66,7 +152,7 @@ getRawEntry() {
# getEntry dictionary entry
# Like getRawEntry but strips " and ending ';'
getEntry() {
getRawEntry $1 "$2" | sed -e 's/^"//' -e 's/;$//' -e 's/"$//'
getRawEntry $1 "$2" | sed -e 's/^"//' -e 's/;$//' -e 's/"$//'
}
# getKey entryLine
@ -77,13 +163,14 @@ getKey() {
# setRawEntry dictionary entry newValue
# Replaces value of entry
# Replaces value of entry
setRawEntry() {
oldNumLine=`getNumberedLine $1 "$2"`
lineNo=`echo "$oldNumLine" | sed -e 's/:.*//'`
oldLine=`echo "$oldNumLine" | sed -e 's/^[^:]*://'`
oldKey=`getKey "$oldLine"`
oldVal=`getRawEntry $1 "$2"`
if [ ! "$oldKey" -o ! "$oldVal" -o ! "$oldLine" ]
then
echo "setRawStringEntry: entry $2 not found in $1"
@ -92,6 +179,7 @@ setRawEntry() {
echo "oldLine=$oldLine"
exit 1
fi
#echo "oldKey=$oldKey"
#echo "lineNo=$lineNo"
#echo "oldLine=$oldLine"
@ -108,76 +196,30 @@ getBoolEntry()
{
val=`getEntry $1 $2`
case "$val" in
'yes')
y | yes | true | on | 1)
return 0
;;
'no')
n | no | false | off | 0)
return 123
;;
'true')
return 0
;;
'false')
return 123
;;
1)
return 0
;;
0)
return 123
;;
*)
echo "$PROGNAME : getBoolEntry : Illegal boolean value $val in dictionary $1"
*)
echo "$Script : getBoolEntry : Illegal boolean value $val in dictionary $1"
exit 1
;;
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
# Returns true if pid exists.
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
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 ]
then
cp ${controlDict}_bak $controlDict
@ -185,7 +227,7 @@ restoreDict() {
rm -f $pidFile
echo "$PROGNAME : Exiting."
echo "$Script : Exiting"
exit 0
}
@ -196,105 +238,51 @@ restoreDict() {
#
#-------------------------------------------------------------------------------
ARCH=`uname -s`
#-- Force standards behaving ps
# Get info on all $USER processes
case $ARCH in
HP-UX*)
UNIX95=a; export UNIX95
case `uname -s` in
HP-UX*)
UNIX95=a
export UNIX95
;;
IRIX*)
_XPG=1; export _XPG
IRIX*)
_XPG=1
export _XPG
;;
esac
#
# Initial checks
#
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" ]
# Pid actually running
if [ "$clearOpt" != true ]
then
processExists $PID
if [ $? -ne 0 ]
then
echo "$PROGNAME : process $PID not running."
echo "$Script : process $PID not running"
exit 1
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
getBoolEntry $controlDict 'runTimeModifiable'
if [ $? -ne 0 ]
then
echo "$PROGNAME : runTimeModifiable not true in dictionary $controlDict."
getBoolEntry $controlDict runTimeModifiable || {
echo "$Script : runTimeModifiable not true in dictionary $controlDict"
exit 1
fi
}
#
#- Check if another foamEndJob running
#
if [ "$CLEAR" ]
if [ "$clear" = true ]
then
pidFiles=`ls $ROOT/$CASE/.foamEndJob* 2>/dev/null`
pidFiles=`ls $caseDir/.foamEndJob* 2>/dev/null`
for pidFile in $pidFiles
do
pid=`cat $pidFile`
if [ "$pid" ]
then
echo "$PROGNAME : found $PROGNAME (pid $pid) for Foam process"
echo " root: $ROOT"
echo " case: $CASE"
echo "$PROGNAME : Killing $PROGNAME (pid $pid)."
echo "$Script : found $Script (pid $pid) for OpenFOAM process"
echo " case: $PWD/$caseDir"
echo "$Script : Killing $Script (pid $pid)"
kill $pid
rm -f $pidFile
fi
@ -302,7 +290,7 @@ then
exit 0
fi
pidFile=$ROOT/$CASE/.foamEndJob${PID}
pidFile=$caseDir/.foamEndJob$PID
if [ -f $pidFile ]
then
pid=`cat $pidFile`
@ -311,12 +299,11 @@ then
processExists $pid
if [ $? -eq 0 ]
then
echo "$PROGNAME : found running $PROGNAME (pid $pid) for Foam process"
echo " root: $ROOT"
echo " case: $CASE"
echo "$Script : found running $Script (pid $pid) for OpenFOAM process"
echo " case: $PWD/$caseDir"
echo " pid : $PID"
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
fi
fi
@ -331,63 +318,60 @@ echo $$ > $pidFile
#- startTime
startTime=`getEntry $controlDict 'startTime'`
if [ ! "$startTime" ]
then
echo "$PROGNAME : startTime not set in dictionary $controlDict."
startTime=`getEntry $controlDict startTime`
[ "$startTime" ] || {
echo "$Script : startTime not set in dictionary $controlDict"
exit 1
fi
}
#- Write interval
writeInterval=`getEntry $controlDict 'writeInterval'`
if [ ! "$writeInterval" ]
then
echo "$PROGNAME : writeInterval not set in dictionary $controlDict."
writeInterval=`getEntry $controlDict writeInterval`
[ "$writeInterval" ] || {
echo "$Script : writeInterval not set in dictionary $controlDict"
exit 1
fi
}
#- stopAt
stopAt=`getEntry $controlDict 'stopAt'`
if [ ! "$stopAt" ]
then
echo "$PROGNAME : stopAt not set in dictionary $controlDict."
stopAt=`getEntry $controlDict stopAt`
[ "$stopAt" ] || {
echo "$Script : stopAt not set in dictionary $controlDict"
exit 1
fi
}
#- endTime
endTime=`getEntry $controlDict 'endTime'`
if [ ! "$endTime" ]
then
echo "$PROGNAME : endTime not set in dictionary $controlDict."
endTime=`getEntry $controlDict endTime`
[ "$endTime" ] || {
echo "$Script : endTime not set in dictionary $controlDict"
exit 1
fi
}
echo "$PROGNAME : Read from controlDict:"
echo "$Script : Read from controlDict:"
echo " controlDict : $controlDict"
echo " writeInterval : $writeInterval"
#echo " startTime : $startTime"
echo " stopAt : $stopAt"
#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
#- Set up handler to restore controlDict
trap restoreDict 2 3 15
trap restoreDict QUIT TERM INT
if [ "$STOPNOW" ]
if [ "$stopOpt" = now ]
then
setRawEntry $controlDict 'stopAt' 'nextWrite'
setRawEntry $controlDict 'writeInterval' '1'
setRawEntry $controlDict stopAt nextWrite
setRawEntry $controlDict writeInterval 1
echo "$PROGNAME : Changed in controlDict:"
echo " `getLine $controlDict 'stopAt'`"
echo " `getLine $controlDict 'writeInterval'`"
echo "$Script : Changed in controlDict:"
echo " `getLine $controlDict stopAt`"
echo " `getLine $controlDict writeInterval`"
else
setRawEntry $controlDict 'stopAt' 'nextWrite'
setRawEntry $controlDict stopAt nextWrite
echo "$PROGNAME : Changed in controlDict:"
echo " `getLine $controlDict 'stopAt'`"
echo "$Script : Changed in controlDict:"
echo " `getLine $controlDict stopAt`"
fi
@ -401,23 +385,24 @@ sleep 5
touch ${controlDict}_bak
#- Loop a while to give NFS time to update
if newerFile ${controlDict} ${controlDict}_bak; then
echo "$PROGNAME : controlDict newer than controlDict_bak."
echo "$PROGNAME : Waiting for file dates to get updated."
if [ ${controlDict} -nt ${controlDict}_bak ]
then
echo "$Script : controlDict newer than controlDict_bak"
echo "$Script : Waiting for file dates to get updated"
iter=0
while newerFile ${controlDict} ${controlDict}_bak
while [ ${controlDict} -nt ${controlDict}_bak ]
do
if [ $iter -ge 120 ]
then
#- 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
fi
#- Give _bak a later time
touch ${controlDict}_bak
#- Give nfs some time to update time on controlDict.
#- Give NFS a chance to update time on controlDict.
sleep 5
iter=`expr $iter + 1`
@ -430,21 +415,20 @@ fi
# - controlDict modified. 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
do
sleep 5
if [ ! -r ${controlDict}_bak ]
then
echo "$PROGNAME : ${controlDict}_bak dissappeared. Exiting without restore."
[ -r ${controlDict}_bak ] || {
echo "$Script : ${controlDict}_bak disappeared. Exiting without restore"
exit 1
fi
}
if newerFile ${controlDict} ${controlDict}_bak
if [ ${controlDict} -nt ${controlDict}_bak ]
then
echo "$PROGNAME : ${controlDict} modified externally. Exiting without restore."
echo "$Script : ${controlDict} modified externally. Exiting without restore"
exit 0
fi
@ -454,7 +438,7 @@ do
#- Job finished
break
fi
# echo "Foam job $PID still running ..."
# echo "OpenFOAM job $PID still running ..."
done
#- Dictionary restore

View File

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

View File

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

View File

@ -32,41 +32,70 @@
# Also removes consecutive blank lines from file.
#
#------------------------------------------------------------------------------
foamVersion=$WM_PROJECT_VERSION
usage() {
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
cat<<USAGE
Usage: ${0##*/} [OPTION] <file1> ... <fileN>
options:
-v VER specifies the version to be written in the header
-h help
-version <ver> specifies the version to be written in the header
-help print the usage
Updates the header of application files and removes consecutive blank lines.
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
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
/*--------------------------------*- C++ -*----------------------------------*\\
| ========= | |
| \\\\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\\\ / O peration | Version: ${foamVersion} |
| \\\\ / O peration | Version: $version |
| \\\\ / A nd | Web: www.OpenFOAM.org |
| \\\\/ M anipulation | |
\\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ${1};
class ${2};
object ${3};
format $1;
class $2;
object $3;
}
HEADER
}
@ -75,68 +104,40 @@ HEADER
#
# extract attribute '$1' from file '$2'
#
FoamFileAttribute() {
FoamFileAttribute()
{
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
do
if grep FoamFile $caseFile >/dev/null 2>&1
then
echo "Updating case file: $caseFile"
sed -n '/FoamFile/,/}/p' $caseFile > FoamFile.tmp
sed -n '/FoamFile/,/}/p' $caseFile > $tmpFile
FORMAT=$(FoamFileAttribute format FoamFile.tmp)
CLASS=$(FoamFileAttribute class FoamFile.tmp)
OBJECT=$(FoamFileAttribute object FoamFile.tmp)
# extract NOTE?
format=$(FoamFileAttribute format $tmpFile)
class=$(FoamFileAttribute class $tmpFile)
object=$(FoamFileAttribute object $tmpFile)
# extract note? - needs special handling
unset note
printHeader $FORMAT $CLASS $OBJECT $NOTE > FoamFile.tmp
sed '1,/}/d' $caseFile | sed '/./,/^$/!d' >> FoamFile.tmp
printHeader $format $class $object "$note" > $tmpFile
sed '1,/}/d' $caseFile | sed '/./,/^$/!d' >> $tmpFile
# use cat to avoid removing/replace soft-links
[ -s FoamFile.tmp ] && cat FoamFile.tmp >| $caseFile
rm -f FoamFile.tmp 2>/dev/null
[ -s $tmpFile ] && cat $tmpFile >| $caseFile
rm -f $tmpFile 2>/dev/null
else
echo " Invalid case file: $caseFile" 1>&2
fi
done
#------------------------------------------------------------------------------
#------------------------------------------------------------------ end-of-file

View File

@ -2,7 +2,7 @@
#
#+TITLE: OpenFOAM C++ style guide
#+AUTHOR: OpenCFD Ltd.
#+DATE: November 2009
#+DATE: April 2010
#+LINK: http://www.opencfd.co.uk
#+OPTIONS: author:nil ^:{}
@ -18,97 +18,116 @@
made with 'break' or 'continue' as part of a control structure.
+ stream output
=<<= is always four characters after the start of the stream,
so that the =<<= symbols align, i.e.
+ =<<= is always four characters after the start of the stream,
so that the =<<= symbols align, i.e.
:Info<< ...
:os << ...
#+BEGIN_EXAMPLE
Info<< ...
os << ...
#+END_EXAMPLE
so
:WarningIn("className::functionName()")
: << "Warning message"
#+BEGIN_EXAMPLE
WarningIn("className::functionName()")
<< "Warning message"
#+END_EXAMPLE
NOT
:WarningIn("className::functionName()")
:<< "Warning message"
#+BEGIN_EXAMPLE
WarningIn("className::functionName()")
<< "Warning message"
#+END_EXAMPLE
+ no unnecessary class section headers, i.e. remove
:// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
:
:// Check
:
:// Edit
:
:// Write
#+BEGIN_EXAMPLE
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// Check
// Edit
// Write
#+END_EXAMPLE
if they contain nothing, even if planned for 'future use'
+ class titles are centred
:/*---------------------------------------------------------------------------*\
: Class exampleClass Declaration
:\*---------------------------------------------------------------------------*/
#+BEGIN_EXAMPLE
/*---------------------------------------------------------------------------*\
Class exampleClass Declaration
\*---------------------------------------------------------------------------*/
#+END_EXAMPLE
NOT
:/*---------------------------------------------------------------------------*\
: Class exampleClass Declaration
:\*---------------------------------------------------------------------------*/
#+BEGIN_EXAMPLE
/*---------------------------------------------------------------------------*\
Class exampleClass Declaration
\*---------------------------------------------------------------------------*/
#+END_EXAMPLE
*** The =.H= Files
+ 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
+ add descriptions to class data and functions
+ 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
:~className();
#+BEGIN_EXAMPLE
//- Destructor
~className();
#+END_EXAMPLE
+ inline functions
Use inline functions where appropriate in a separate classNameI.H file.
Avoid cluttering the header file with function bodies.
+ Use inline functions where appropriate in a separate classNameI.H file.
Avoid cluttering the header file with function bodies.
*** The =.C= Files
+ 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
:namespace Foam
:{
: ...
:
: returnType className::functionName()
:
: ...
:}
#+BEGIN_EXAMPLE
namespace Foam
{
...
returnType className::functionName()
...
}
#+END_EXAMPLE
EXCEPTION
When there are multiple levels of namespace, they may be used in the =.C=
file, i.e.
:namespace Foam
:{
:namespace compressible
:{
:namespace RASModels
:{
:
: ...
:
:} // End namespace RASModels
:} // End namespace compressible
:} // End namespace Foam
#+BEGIN_EXAMPLE
namespace Foam
{
namespace compressible
{
namespace RASModels
{
...
} // End namespace RASModels
} // End namespace compressible
} // End namespace Foam
#+END_EXAMPLE
+ Use two empty lines between functions
@ -131,64 +150,95 @@
If a class is virtual - make all derived classes virtual.
*** Conditional Statements
:if (condition)
:{
: code;
:}
#+BEGIN_EXAMPLE
if (condition)
{
code;
}
#+END_EXAMPLE
OR
:if
:(
: long condition
:)
:{
: code;
:}
#+BEGIN_EXAMPLE
if
(
long condition
)
{
code;
}
#+END_EXAMPLE
NOT (no space between "if" and "(")
:if(condition)
:{
: code;
:}
#+BEGIN_EXAMPLE
if(condition)
{
code;
}
#+END_EXAMPLE
*** =for= and =while= Loops
:for (i = 0; i < maxI; i++)
:{
: code;
:}
#+BEGIN_EXAMPLE
for (i = 0; i < maxI; i++)
{
code;
}
#+END_EXAMPLE
OR
:for
:(
: i = 0;
: i < maxI;
: i++
:)
:{
: code;
:}
#+BEGIN_EXAMPLE
for
(
i = 0;
i < maxI;
i++
)
{
code;
}
#+END_EXAMPLE
NOT (no space between "for" and "(")
:for(i = 0; i < maxI; i++)
:{
: code;
:}
#+BEGIN_EXAMPLE
for(i = 0; i < maxI; i++)
{
code;
}
#+END_EXAMPLE
Note that when indexing through iterators, it is often slightly more
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
:forAll(
#+BEGIN_EXAMPLE
forAll(
#+END_EXAMPLE
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
@ -198,64 +248,81 @@
+ do not put "const" onto its own line - use a split to keep it with
the function name and arguments.
so:
so
:const Foam::longReturnTypeName&
:Foam::longClassName::longFunctionName const
#+BEGIN_EXAMPLE
const Foam::longReturnTypeName&
Foam::longClassName::longFunctionName const
#+END_EXAMPLE
NOT
:const Foam::longReturnTypeName&
: Foam::longClassName::longFunctionName const
#+BEGIN_EXAMPLE
const Foam::longReturnTypeName&
Foam::longClassName::longFunctionName const
#+END_EXAMPLE
NOR
:const Foam::longReturnTypeName& Foam::longClassName::longFunctionName
:const
#+BEGIN_EXAMPLE
const Foam::longReturnTypeName& Foam::longClassName::longFunctionName
const
#+END_EXAMPLE
NOR
:const Foam::longReturnTypeName& Foam::longClassName::
:longFunctionName const
#+BEGIN_EXAMPLE
const Foam::longReturnTypeName& Foam::longClassName::
longFunctionName const
#+END_EXAMPLE
+ if it needs to be split again, split at the function name (leaving
behind the preceding scoping "::"s), and again, left align, i.e.
For example,
:const Foam::longReturnTypeName&
:Foam::veryveryveryverylongClassName::
:veryveryveryverylongFunctionName const
#+BEGIN_EXAMPLE
const Foam::longReturnTypeName&
Foam::veryveryveryverylongClassName::
veryveryveryverylongFunctionName const
#+END_EXAMPLE
**** Splitting long lines at an "="
Indent after split
:variableName =
: longClassName.longFunctionName(longArgument);
#+BEGIN_EXAMPLE
variableName =
longClassName.longFunctionName(longArgument);
#+END_EXAMPLE
OR (where necessary)
:variableName =
: longClassName.longFunctionName
: (
: longArgument1,
: longArgument2
: );
#+BEGIN_EXAMPLE
variableName =
longClassName.longFunctionName
(
longArgument1,
longArgument2
);
#+END_EXAMPLE
NOT
:variableName =
:longClassName.longFunctionName(longArgument);
#+BEGIN_EXAMPLE
variableName =
longClassName.longFunctionName(longArgument);
#+END_EXAMPLE
NOR
:variableName = longClassName.longFunctionName
:(
: longArgument1,
: longArgument2
:);
#+BEGIN_EXAMPLE
variableName = longClassName.longFunctionName
(
longArgument1,
longArgument2
);
#+END_EXAMPLE
*** Maths and Logic
+ operator spacing
@ -267,34 +334,41 @@
+ a || b, a && b
+ splitting formulae over several lines
Split and indent as per "splitting long lines at an "=""
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.
:variableName =
: a * (a + b)
: - exp(c/d)
: * (k + t);
#+BEGIN_EXAMPLE
variableName =
a * (a + b)
- exp(c/d)
* (k + t);
#+END_EXAMPLE
This is sometime more legible when surrounded by extra parentheses:
:variableName =
:(
: a * (a + b)
: - exp(c/d)
: * (k + t)
:);
#+BEGIN_EXAMPLE
variableName =
(
a * (a + b)
- exp(c/d)
* (k + t)
);
#+END_EXAMPLE
+ splitting logical tests over several lines
outdent the operator so that the next variable to test is aligned with
the four space indentation, i.e.
:if
:(
: a == true
: && b == c
:)
#+BEGIN_EXAMPLE
if
(
a == true
&& b == c
)
#+END_EXAMPLE
** Documentation
@ -315,14 +389,16 @@
For example,
:Class
: Foam::myClass
:
:Description
: A class for specifying the documentation style.
:
: The class is implemented as a set of recommendations that may
: sometimes be useful.
#+BEGIN_EXAMPLE
Class
Foam::myClass
Description
A class for specifying the documentation style.
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
will think you are documenting some other class.
@ -332,11 +408,13 @@
finding these under-documented classes later.
:Class
: Foam::myUnderDocumentedClass
:
:Description
: Foam::myUnderDocumentedClass
#+BEGIN_EXAMPLE
Class
Foam::myUnderDocumentedClass
Description
Foam::myUnderDocumentedClass
#+END_EXAMPLE
+ Use 'Class' and 'Namespace' tags in the header files.
@ -346,11 +424,13 @@
The Description block then applies to documenting the file itself.
:InClass
: Foam::myClass
:
:Description
: Implements the read and writing of files.
#+BEGIN_EXAMPLE
InClass
Foam::myClass
Description
Implements the read and writing of files.
#+END_EXAMPLE
*** Doxygen Special Commands
@ -368,29 +448,31 @@
Doxygen commmands can be inserted within the block without problems.
:InClass
: Foam::myClass
:
:Description
: Implements the read and writing of files.
:
: An example input file:
: @verbatim
: patchName
: {
: type myPatchType;
: refValue 100;
: value uniform 1;
: }
: @endverbatim
:
: Within the implementation, a loop over all patches is done:
: @code
: forAll(patches, patchI)
: {
: ... // some operation
: }
: @endcode
#+BEGIN_EXAMPLE
InClass
Foam::myClass
Description
Implements the read and writing of files.
An example input file:
@verbatim
patchName
{
type myPatchType;
refValue 100;
value uniform 1;
}
@endverbatim
Within the implementation, a loop over all patches is done:
@code
forAll(patches, patchI)
{
... // some operation
}
@endcode
#+END_EXAMPLE
*** HTML Special Commands
@ -399,28 +481,34 @@
Doxygen to complain, but seem to work anyhow.
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.
*** 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.
+ 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.
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.
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
@ -459,7 +547,9 @@
Press.
Eg,
:myClass.initialize()
#+BEGIN_EXAMPLE
myClass.initialize()
#+END_EXAMPLE
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".

View File

@ -56,10 +56,9 @@ public:
{}
// Destructor
virtual ~ODE()
{}
//- Destructor
virtual ~ODE()
{}
// Member Functions

View File

@ -103,10 +103,9 @@ public:
);
// Destructor
virtual ~ODESolver()
{}
//- Destructor
virtual ~ODESolver()
{}
// Member Functions

View File

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

View File

@ -99,9 +99,8 @@ public:
sigFpe();
// Destructor
~sigFpe();
//- Destructor
~sigFpe();
// Member functions

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