int main(int argc, char *argv[]) { timeSelector::addOptions(); # include "addRegionOption.H" # include "setRootCase.H" # include "createTime.H" instantList timeDirs = timeSelector::select0(runTime, args); # include "createNamedMesh.H" forAll(timeDirs, timeI) { runTime.setTime(timeDirs[timeI], timeI); Info<< "Time = " << runTime.timeName() << nl << endl; const IOobjectList fieldObjs(mesh, runTime.timeName()); const wordList objNames = fieldObjs.names(); PtrList<volScalarField> vsf(objNames.size()); PtrList<volVectorField> vvf(objNames.size()); PtrList<volSphericalTensorField> vsptf(objNames.size()); PtrList<volSymmTensorField> vsytf(objNames.size()); PtrList<volTensorField> vtf(objNames.size()); Info<< "Valid fields:" << endl; forAll(objNames, objI) { IOobject obj ( objNames[objI], runTime.timeName(), mesh, IOobject::MUST_READ ); if (obj.headerOk()) { addToFieldList<scalar>(vsf, obj, objI, mesh); addToFieldList<vector>(vvf, obj, objI, mesh); addToFieldList<sphericalTensor>(vsptf, obj, objI, mesh); addToFieldList<symmTensor>(vsytf, obj, objI, mesh); addToFieldList<tensor>(vtf, obj, objI, mesh); } }
int main(int argc, char *argv[]) { argList::validOptions.insert("noFlipMap", ""); # include "addRegionOption.H" # include "addTimeOptions.H" # include "setRootCase.H" # include "createTime.H" bool noFlipMap = args.optionFound("noFlipMap"); // Get times list instantList Times = runTime.times(); label startTime = Times.size()-1; label endTime = Times.size(); // check -time and -latestTime options # include "checkTimeOption.H" runTime.setTime(Times[startTime], startTime); # include "createNamedPolyMesh.H" // Search for list of objects for the time of the mesh IOobjectList objects ( mesh, mesh.pointsInstance(), polyMesh::meshSubDir/"sets" ); Info<< "Searched : " << mesh.pointsInstance()/polyMesh::meshSubDir/"sets" << nl << "Found : " << objects.names() << nl << endl; IOobjectList pointObjects(objects.lookupClass(pointSet::typeName)); //Pout<< "pointSets:" << pointObjects.names() << endl; for ( IOobjectList::const_iterator iter = pointObjects.begin(); iter != pointObjects.end(); ++iter ) { // Not in memory. Load it. pointSet set(*iter()); SortableList<label> pointLabels(set.toc()); label zoneID = mesh.pointZones().findZoneID(set.name()); if (zoneID == -1) { Info<< "Adding set " << set.name() << " as a pointZone." << endl; label sz = mesh.pointZones().size(); mesh.pointZones().setSize(sz+1); mesh.pointZones().set ( sz, new pointZone ( set.name(), //name pointLabels, //addressing sz, //index mesh.pointZones() //pointZoneMesh ) ); mesh.pointZones().writeOpt() = IOobject::AUTO_WRITE; mesh.pointZones().instance() = mesh.facesInstance(); } else { Info<< "Overwriting contents of existing pointZone " << zoneID << " with that of set " << set.name() << "." << endl; mesh.pointZones()[zoneID] = pointLabels; mesh.pointZones().writeOpt() = IOobject::AUTO_WRITE; mesh.pointZones().instance() = mesh.facesInstance(); } } IOobjectList faceObjects(objects.lookupClass(faceSet::typeName)); HashSet<word> slaveCellSets; //Pout<< "faceSets:" << faceObjects.names() << endl; for ( IOobjectList::const_iterator iter = faceObjects.begin(); iter != faceObjects.end(); ++iter ) { // Not in memory. Load it. faceSet set(*iter()); SortableList<label> faceLabels(set.toc()); DynamicList<label> addressing(set.size()); DynamicList<bool> flipMap(set.size()); if (!noFlipMap) { word setName(set.name() + "SlaveCells"); Info<< "Trying to load cellSet " << setName << " to find out the slave side of the zone." << nl << "If you do not care about the flipMap" << " (i.e. do not use the sideness)" << nl << "use the -noFlipMap command line option." << endl; // Load corresponding cells cellSet cells(mesh, setName); // Store setName to exclude from cellZones further on slaveCellSets.insert(setName); forAll(faceLabels, i) { label faceI = faceLabels[i]; bool flip = false; if (mesh.isInternalFace(faceI)) { if ( cells.found(mesh.faceOwner()[faceI]) && !cells.found(mesh.faceNeighbour()[faceI]) ) { flip = false; } else if ( !cells.found(mesh.faceOwner()[faceI]) && cells.found(mesh.faceNeighbour()[faceI]) ) { flip = true; } else { FatalErrorIn(args.executable()) << "One of owner or neighbour of internal face " << faceI << " should be in cellSet " << cells.name() << " to be able to determine orientation." << endl << "Face:" << faceI << " own:" << mesh.faceOwner()[faceI] << " OwnInCellSet:" << cells.found(mesh.faceOwner()[faceI]) << " nei:" << mesh.faceNeighbour()[faceI] << " NeiInCellSet:" << cells.found(mesh.faceNeighbour()[faceI]) << abort(FatalError); } } else { if (cells.found(mesh.faceOwner()[faceI])) { flip = false; } else { flip = true; } } addressing.append(faceI); flipMap.append(flip); } }