Foam::labelList Foam::scotchDecomp::decompose ( const labelList& fineToCoarse, const pointField& coarsePoints, const scalarField& coarseWeights ) { if (fineToCoarse.size() != mesh_.nCells()) { FatalErrorIn ( "parMetisDecomp::decompose(const labelList&, const pointField&)" ) << "Size of cell-to-coarse map " << fineToCoarse.size() << " differs from number of cells in mesh " << mesh_.nCells() << exit(FatalError); } // Make Metis CSR (Compressed Storage Format) storage // adjncy : contains neighbours (= edges in graph) // xadj(celli) : start of information in adjncy for celli List<int> adjncy; List<int> xadj; { // Get cellCells on coarse mesh. labelListList cellCells; calcCellCells ( mesh_, fineToCoarse, coarsePoints.size(), cellCells ); calcCSR(cellCells, adjncy, xadj); } // Decompose using weights List<int> finalDecomp; decompose(adjncy, xadj, coarseWeights, finalDecomp); // Rework back into decomposition for original mesh_ labelList fineDistribution(fineToCoarse.size()); forAll(fineDistribution, i) { fineDistribution[i] = finalDecomp[fineToCoarse[i]]; } return fineDistribution; }
Foam::labelList Foam::scotchDecomp::decompose ( const labelListList& globalCellCells, const pointField& cc, const scalarField& cWeights ) { if (cc.size() != globalCellCells.size()) { FatalErrorIn ( "scotchDecomp::decompose" "(const labelListList&, const pointField&, const scalarField&)" ) << "Inconsistent number of cells (" << globalCellCells.size() << ") and number of cell centres (" << cc.size() << ")." << exit(FatalError); } // Make Metis CSR (Compressed Storage Format) storage // adjncy : contains neighbours (= edges in graph) // xadj(celli) : start of information in adjncy for celli List<int> adjncy; List<int> xadj; calcCSR(globalCellCells, adjncy, xadj); // Decompose using weights List<int> finalDecomp; decompose(adjncy, xadj, cWeights, finalDecomp); // Copy back to labelList labelList decomp(finalDecomp.size()); forAll(decomp, i) { decomp[i] = finalDecomp[i]; } return decomp; }
Foam::labelList Foam::scotchDecomp::decompose ( const pointField& points, const scalarField& pointWeights ) { if (points.size() != mesh_.nCells()) { FatalErrorIn ( "scotchDecomp::decompose(const pointField&, const scalarField&)" ) << "Can use this decomposition method only for the whole mesh" << endl << "and supply one coordinate (cellCentre) for every cell." << endl << "The number of coordinates " << points.size() << endl << "The number of cells in the mesh " << mesh_.nCells() << exit(FatalError); } // Make Metis CSR (Compressed Storage Format) storage // adjncy : contains neighbours (= edges in graph) // xadj(celli) : start of information in adjncy for celli List<int> adjncy; List<int> xadj; calcCSR(mesh_, adjncy, xadj); // Decompose using default weights List<int> finalDecomp; decompose(adjncy, xadj, pointWeights, finalDecomp); // Copy back to labelList labelList decomp(finalDecomp.size()); forAll(decomp, i) { decomp[i] = finalDecomp[i]; } return decomp; }