diff --git a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/GAMGAgglomeration/GAMGAgglomeration.H b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/GAMGAgglomeration/GAMGAgglomeration.H index 8590cff0c2..bcf4b8cec9 100644 --- a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/GAMGAgglomeration/GAMGAgglomeration.H +++ b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/GAMGAgglomeration/GAMGAgglomeration.H @@ -372,16 +372,6 @@ public: const labelList& fineToCoarse ) const; - ////- Restrict (integrate by summation) face field - //template - //void restrictFaceField - //( - // Field& cf, - // const Field& ff, - // const label fineLevelIndex, - // const bool dummy - //) const; - //- Prolong (interpolate by injection) cell field template void prolongField diff --git a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/GAMGAgglomeration/GAMGAgglomerationTemplates.C b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/GAMGAgglomeration/GAMGAgglomerationTemplates.C index b5903aa110..e30a1e69cd 100644 --- a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/GAMGAgglomeration/GAMGAgglomerationTemplates.C +++ b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/GAMGAgglomeration/GAMGAgglomerationTemplates.C @@ -29,354 +29,6 @@ License // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -//template -//void Foam::GAMGAgglomeration::gatherFaceField -//( -// const label comm, -// const labelList& procIDs, -// const labelListList& procFaceMap, -// const UList& fld, -// List& allFld, -// const int tag -//) -//{ -// if (Pstream::myProcNo(comm) == procIDs[0]) -// { -// // Assign my local data -// UIndirectList(allFld, procFaceMap[0]) = fld; -// -// // Temporary storage -// Field buff(allFld.size()); -// -// for (label i = 1; i < procIDs.size(); i++) -// { -// const labelList& map = procFaceMap[i]; -// -// IPstream::read -// ( -// Pstream::scheduled, -// procIDs[i], -// reinterpret_cast(buff.begin()), -// map.size()*sizeof(Type), -// tag, -// comm -// ); -// -// forAll(map, i) -// { -// allFld[map[i]] = buff[i]; -// } -// } -// } -// else -// { -// OPstream::write -// ( -// Pstream::scheduled, -// procIDs[0], -// reinterpret_cast(fld.begin()), -// fld.byteSize(), -// tag, -// comm -// ); -// } -// -// //Pout<< "** GAMGAgglomeration: gatherFaceField :" -// // << " fld was:" << fld.size() -// // << " fld now:" << allFld.size() << endl; -//} -// -// -//template -//void Foam::GAMGAgglomeration::gatherPatchFaceField -//( -// const label comm, -// const labelList& procIDs, -// const labelListList& procBoundaryMap, -// const labelListListList& procPatchFaceMap, -// -// const List >& fld, -// List >& allFld, -// const int tag -//) -//{ -// if (Pstream::myProcNo(comm) == procIDs[0]) -// { -// // Assign my local data -// { -// const labelList& patches = procBoundaryMap[0]; -// -// forAll(patches, intI) -// { -// label newIntI = patches[intI]; -// if (newIntI != -1) -// { -// const labelList& map = procPatchFaceMap[0][intI]; -// const List& patchFld = fld[intI]; -// // Only copy unflipped faces. One of the processors will -// // have positive ones. -// forAll(map, i) -// { -// if (map[i] >= 0) -// { -// allFld[newIntI][map[i]] = patchFld[i]; -// } -// } -// } -// } -// } -// -// -// // Temporary storage -// List > buff(allFld.size()); -// -// for (label i = 1; i < procIDs.size(); i++) -// { -// IPstream fromSlave -// ( -// Pstream::scheduled, -// procIDs[i], -// 0, -// tag, -// comm -// ); -// fromSlave >> buff; -// -// const labelList& patches = procBoundaryMap[i]; -// forAll(patches, intI) -// { -// label newIntI = patches[intI]; -// if (newIntI != -1) -// { -// const labelList& map = procPatchFaceMap[i][intI]; -// const List& patchFld = buff[intI]; -// forAll(map, i) -// { -// if (map[i] >= 0) -// { -// allFld[newIntI][map[i]] = patchFld[i]; -// } -// } -// } -// } -// } -// } -// else -// { -// OPstream toMaster -// ( -// Pstream::scheduled, -// procIDs[0], -// 0, -// tag, -// comm -// ); -// toMaster << fld; -// } -// -// //Pout<< "** GAMGAgglomeration: gatherPatchFaceField :" -// // << " fld was:" << fld.size() -// // << " fld now:" << allFld.size() << endl; -//} - - -//XXXXXXXX - -template -void Foam::GAMGAgglomeration::mapField -( - const faceMappingType mapType, - const labelList& map, - const UList& fld, - UList& mappedFld -) -{ - switch (mapType) - { - case IGNORESIGN: - forAll(map, i) - { - label allI = map[i]; - if (allI < 0) - { - allI = -allI-1; - } - mappedFld[allI] = fld[i]; - } - break; - - case APPLYSIGN: - forAll(map, i) - { - label allI = map[i]; - if (allI < 0) - { - allI = -allI-1; - mappedFld[allI] = -fld[i]; - } - else - { - mappedFld[allI] = fld[i]; - } - } - break; - - case DONTMAP: - forAll(map, i) - { - label allI = map[i]; - if (allI >= 0) - { - mappedFld[allI] = fld[i]; - } - } - break; - - default: - FatalErrorIn("GAMGAgglomeration::mapField(..)") - << "Unhandled mapping method." << exit(FatalError); - break; - } -} - - -template -void Foam::GAMGAgglomeration::gatherFaceField -( - const label comm, - const labelList& procIDs, - - const faceMappingType mapType, - - // Field on internal faces - const labelListList& procFaceMap, - const UList& faceFld, - - // Field on patches faces - const labelListList& procPatchMap, - const labelListListList& procPatchFaceMap, - const UList >& patchFld, - - List& allFaceFld, - List >& allPatchFld, - const int tag -) -{ - if (Pstream::myProcNo(comm) == procIDs[0]) - { - // Map from local faces to faces - mapField - ( - mapType, - procFaceMap[0], - faceFld, - allFaceFld - ); - - // Map patch fields - const labelList& patches = procPatchMap[0]; - forAll(patches, intI) - { - const labelList& map = procPatchFaceMap[0][intI]; - - label newIntI = patches[intI]; - if (newIntI != -1) - { - // Map into patch field - mapField - ( - mapType, - map, - patchFld, - allPatchFld - ); - } - else - { - // Map into internal faces field - mapField - ( - mapType, - map, - patchFld, - allFaceFld - ); - } - } - - - - // Temporary storage - List procFaceFld; - List > procPatchFld; - - for (label i = 1; i < procIDs.size(); i++) - { - IPstream fromSlave - ( - Pstream::scheduled, - procIDs[i], - 0, - tag, - comm - ); - fromSlave >> procFaceFld >> procPatchFld; - - // Map from faces to faces - mapField - ( - mapType, - procFaceMap[i], - procFaceFld, - allFaceFld - ); - - - const labelList& patches = procPatchMap[i]; - forAll(patches, intI) - { - const List& patchFld = procPatchFld[intI]; - const labelList& map = procPatchFaceMap[i][intI]; - - label newIntI = patches[intI]; - if (newIntI != -1) - { - // Map into patch field - mapField - ( - mapType, - map, - patchFld, - allPatchFld[newIntI] - ); - } - else - { - // Map into internal faces field - mapField - ( - mapType, - map, - patchFld, - allFaceFld - ); - } - } - } - } - else - { - OPstream toMaster - ( - Pstream::scheduled, - procIDs[0], - 0, - tag, - comm - ); - toMaster << faceFld << patchFld; - } -} template void Foam::GAMGAgglomeration::gatherList ( @@ -437,9 +89,6 @@ void Foam::GAMGAgglomeration::restrictField cf[fineToCoarse[i]] += ff[i]; } } -//XXXXXXXX - - template @@ -466,19 +115,7 @@ void Foam::GAMGAgglomeration::restrictField << abort(FatalError); } - Pout<< "** GAMGAgglomeration: restrictField :" - << " fineLevel:" << fineLevelIndex - << " agglomerating from:" << ff.size() - << " down to:" << cf.size() - << " max fineToCoarse:" << max(fineToCoarse) << endl; - - cf = pTraits::zero; - - forAll(ff, i) - { - cf[fineToCoarse[i]] += ff[i]; - } - + restrictField(cf, ff, fineToCoarse); label coarseLevelIndex = fineLevelIndex+1; @@ -486,28 +123,11 @@ void Foam::GAMGAgglomeration::restrictField { label fineComm = UPstream::parent(procCommunicator_[coarseLevelIndex]); - Pout<< "** GAMGAgglomeration: restrictField :" - << " fineLevel:" << fineLevelIndex - << " coarseLevel:" << coarseLevelIndex - << " have proc agglomeration with comm:" - << fineComm << endl; - - const List& procIDs = agglomProcIDs(coarseLevelIndex); const labelList& offsets = cellOffsets(coarseLevelIndex); - Pout<< "procIDs:" << procIDs << endl; - Pout<< "offsets:" << offsets << endl; - Pout<< "myProcNo:" << UPstream::myProcNo(fineComm) << endl; - const globalIndex cellOffsetter(offsets); - - Pout<< "** GAMGAgglomeration: restrictField :" - << " cf was:" << cf.size(); - cellOffsetter.gather(fineComm, procIDs, cf); - - Pout<< " cf now:" << cf.size() << endl; } } @@ -549,50 +169,6 @@ void Foam::GAMGAgglomeration::restrictFaceField } -//template -//void Foam::GAMGAgglomeration::restrictFaceField -//( -// Field& cf, -// const Field& ff, -// const label fineLevelIndex, -// const bool dummy -//) const -//{ -// restrictFaceField(cf, ff, fineLevelIndex); -// -// if (hasProcMesh(fineLevelIndex)) -// { -// label fineComm = UPstream::parent(procCommunicator_[fineLevelIndex]); -// -// Pout<< "** GAMGAgglomeration: restrictFaceField :" -// << " fineLevel:" << fineLevelIndex -// << " coarseLevel:" << fineLevelIndex+1 -// << " have proc agglomeration with comm:" -// << fineComm << endl; -// -// const labelListList& map = faceMap(fineLevelIndex); -// const List& procIDs = agglomProcIDs(fineLevelIndex); -// -// Field allCf; -// if (Pstream::myProcNo(fineComm) == procIDs[0]) -// { -// allCf.setSize -// ( -// meshLevel(fineLevelIndex).lduAddr().size() -// ); -// } -// -// gatherFaceField(fineComm, procIDs, map, cf, allCf); -// -// Pout<< "** GAMGAgglomeration: restrictFaceField :" -// << " cf was:" << cf.size() -// << " cf now:" << allCf.size() << endl; -// -// cf.transfer(allCf); -// } -//} - - template void Foam::GAMGAgglomeration::prolongField ( @@ -604,12 +180,6 @@ void Foam::GAMGAgglomeration::prolongField { const labelList& fineToCoarse = restrictAddressing_[levelIndex]; - Pout<< "** GAMGAgglomeration: prolongField :" - << " fineLevel:" << levelIndex - << " prolonging from:" << cf.size() - << " to:" << ff.size() - << " max fineToCoarse:" << max(fineToCoarse) << endl; - label coarseLevelIndex = levelIndex+1; if (procAgglom && hasProcMesh(coarseLevelIndex)) @@ -619,23 +189,12 @@ void Foam::GAMGAgglomeration::prolongField procCommunicator_[coarseLevelIndex] ); - Pout<< "** GAMGAgglomeration: prolongField :" - << " fineLevel:" << levelIndex - << " coarseLevel:" << coarseLevelIndex - << " have proc agglomeration with comm:" - << coarseComm << endl; - const List& procIDs = agglomProcIDs(coarseLevelIndex); const labelList& offsets = cellOffsets(coarseLevelIndex); - Pout<< "procIDs:" << procIDs << endl; - Pout<< "offsets:" << offsets << endl; - Pout<< "myProcNo:" << UPstream::myProcNo(coarseComm) << endl; - const globalIndex cellOffsetter(offsets); label localSize = nCells_[levelIndex]; - Pout<< "localSize:" << localSize << endl; Field allCf(localSize); @@ -647,10 +206,6 @@ void Foam::GAMGAgglomeration::prolongField allCf ); - Pout<< "** GAMGAgglomeration: prolongField :" - << " cf was:" << cf.size() - << " cf now:" << allCf.size() << endl; - forAll(fineToCoarse, i) { ff[i] = allCf[fineToCoarse[i]]; @@ -666,51 +221,4 @@ void Foam::GAMGAgglomeration::prolongField } -//template -//void Foam::GAMGAgglomeration::scatter -//( -// Field& ff, -// const Field& allFf, -// const label levelIndex -//) const -//{ -// label coarseComm = UPstream::parent -// ( -// procCommunicator_[levelIndex] -// ); -// -// Pout<< "** GAMGAgglomeration: prolongField :" -// << " fineLevel:" << levelIndex -// << " have proc agglomeration with comm:" -// << coarseComm << endl; -// -// const List& procIDs = agglomProcIDs(levelIndex); -// const labelList& offsets = cellOffsets(levelIndex); -// -// Pout<< "procIDs:" << procIDs << endl; -// Pout<< "offsets:" << offsets << endl; -// Pout<< "myProcNo:" << UPstream::myProcNo(coarseComm) << endl; -// -// const globalIndex cellOffsetter(offsets); -// -// label localSize = nCells_[levelIndex-1]; -// Pout<< "localSize:" << localSize << endl; -// -// -// ff.setSize(localSize); -// cellOffsetter.scatter -// ( -// coarseComm, -// procIDs, -// allFf, -// ff -// ); -// -// Pout<< "** GAMGAgglomeration: prolongField :" -// << " cf was:" << allFf.size() -// << " cf now:" << ff.size() << endl; -//} - - - // ************************************************************************* //