Foam::labelList Foam::manualDecomp::decompose ( const polyMesh& mesh, const pointField& points, const scalarField& pointWeights ) { labelIOList finalDecomp ( IOobject ( decompDataFile_, mesh.facesInstance(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE, false ) ); // check if the final decomposition is OK if (finalDecomp.size() != points.size()) { FatalErrorInFunction << "Size of decomposition list does not correspond " << "to the number of points. Size: " << finalDecomp.size() << " Number of points: " << points.size() << ".\n" << "Manual decomposition data read from file " << decompDataFile_ << "." << endl << exit(FatalError); } if (min(finalDecomp) < 0 || max(finalDecomp) > nProcessors_ - 1) { FatalErrorInFunction << "According to the decomposition, cells assigned to " << "impossible processor numbers. Min processor = " << min(finalDecomp) << " Max processor = " << max(finalDecomp) << ".\n" << "Manual decomposition data read from file " << decompDataFile_ << "." << endl << exit(FatalError); } return finalDecomp; }
Foam::labelList Foam::manualRenumber::renumber ( const polyMesh& mesh, const pointField& points ) const { labelIOList newToOld ( IOobject ( dataFile_, mesh.facesInstance(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE, false ) ); // check if the final renumbering is OK if (newToOld.size() != points.size()) { FatalErrorIn ( "manualRenumber::renumber(const pointField&, const scalarField&)" ) << "Size of renumber list does not correspond " << "to the number of points. Size: " << newToOld.size() << " Number of points: " << points.size() << ".\n" << "Manual renumbering data read from file " << dataFile_ << "." << endl << exit(FatalError); } // Invert to see if one to one labelList oldToNew(points.size(), -1); forAll(newToOld, i) { label origCellI = newToOld[i]; if (origCellI < 0 || origCellI >= points.size()) { FatalErrorIn ( "manualRenumber::renumber(const pointField&" ", const scalarField&)" ) << "Renumbering is not one-to-one. Index " << i << " maps onto original cell " << origCellI << ".\n" << "Manual renumbering data read from file " << dataFile_ << "." << endl << exit(FatalError); } if (oldToNew[origCellI] == -1) { oldToNew[origCellI] = i; } else { FatalErrorIn ( "manualRenumber::renumber(const pointField&" ", const scalarField&)" ) << "Renumbering is not one-to-one. Both index " << oldToNew[origCellI] << " and " << i << " map onto " << origCellI << ".\n" << "Manual renumbering data read from file " << dataFile_ << "." << endl << exit(FatalError); } }