Foam::CollisionRecordList<PairType, WallType>::CollisionRecordList ( const labelField& pairAccessed, const labelField& pairOrigProcOfOther, const labelField& pairOrigIdOfOther, const Field<PairType>& pairData, const labelField& wallAccessed, const vectorField& wallPRel, const Field<WallType>& wallData ) : pairRecords_(), wallRecords_() { label nPair = pairAccessed.size(); if ( pairOrigProcOfOther.size() != nPair || pairOrigIdOfOther.size() != nPair || pairData.size() != nPair ) { FatalErrorIn ( "Foam::CollisionRecordList<PairType, WallType>::CollisionRecordList" "(" "const labelField& pairAccessed," "const labelField& pairOrigProcOfOther," "const labelField& pairOrigIdOfOther," "const Field<PairType>& pairData," "const labelField& wallAccessed," "const vectorField& wallPRel," "const Field<WallType>& wallData" ")" ) << "Pair field size mismatch." << nl << pairAccessed << nl << pairOrigProcOfOther << nl << pairOrigIdOfOther << nl << pairData << nl << abort(FatalError); } forAll(pairAccessed, i) { pairRecords_.append ( PairCollisionRecord<PairType> ( pairAccessed[i], pairOrigProcOfOther[i], pairOrigIdOfOther[i], pairData[i] ) ); }
Foam::regionCoupledBaseGAMGInterface::regionCoupledBaseGAMGInterface ( const label index, const lduInterfacePtrsList& coarseInterfaces, const lduInterface& fineInterface, const labelField& localRestrictAddressing, const labelField& neighbourRestrictAddressing, const label fineLevelIndex, const label coarseComm ) : GAMGInterface ( index, coarseInterfaces ), fineRegionCoupledLduInterface_ ( refCast<const regionCoupledLduInterface>(fineInterface) ) { // Construct face agglomeration from cell agglomeration { // From coarse face to cell DynamicList<label> dynFaceCells(localRestrictAddressing.size()); // From face to coarse face DynamicList<label> dynFaceRestrictAddressing ( localRestrictAddressing.size() ); Map<label> masterToCoarseFace(localRestrictAddressing.size()); forAll(localRestrictAddressing, ffi) { label curMaster = localRestrictAddressing[ffi]; Map<label>::const_iterator fnd = masterToCoarseFace.find ( curMaster ); if (fnd == masterToCoarseFace.end()) { // New coarse face label coarseI = dynFaceCells.size(); dynFaceRestrictAddressing.append(coarseI); dynFaceCells.append(curMaster); masterToCoarseFace.insert(curMaster, coarseI); } else { // Already have coarse face dynFaceRestrictAddressing.append(fnd()); } } faceCells_.transfer(dynFaceCells); faceRestrictAddressing_.transfer(dynFaceRestrictAddressing); }
Foam::processorGAMGInterface::processorGAMGInterface ( const lduInterface& fineInterface, const labelField& localRestrictAddressing, const labelField& neighbourRestrictAddressing ) : GAMGInterface ( fineInterface, localRestrictAddressing, neighbourRestrictAddressing ), fineProcInterface_(refCast<const processorLduInterface>(fineInterface)) { // Make a lookup table of entries for owner/neighbour HashTable<SLList<label>, label, Hash<label> > neighboursTable ( localRestrictAddressing.size() ); // Table of face-sets to be agglomerated HashTable<SLList<SLList<label> >, label, Hash<label> > faceFaceTable ( localRestrictAddressing.size() ); label nCoarseFaces = 0; forAll (localRestrictAddressing, ffi) { label curMaster = -1; label curSlave = -1; // Do switching on master/slave indexes based on the owner/neighbour of // the processor index such that both sides get the same answer. if (myProcNo() < neighbProcNo()) { // Master side curMaster = localRestrictAddressing[ffi]; curSlave = neighbourRestrictAddressing[ffi]; } else { // Slave side curMaster = neighbourRestrictAddressing[ffi]; curSlave = localRestrictAddressing[ffi]; } // Look for the master cell. If it has already got a face, // add the coefficient to the face. If not, create a new face. if (neighboursTable.found(curMaster)) { // Check all current neighbours to see if the current slave already // exists and if so, add the fine face to the agglomeration. SLList<label>& curNbrs = neighboursTable.find(curMaster)(); SLList<SLList<label> >& curFaceFaces = faceFaceTable.find(curMaster)(); bool nbrFound = false; SLList<label>::iterator nbrsIter = curNbrs.begin(); SLList<SLList<label> >::iterator faceFacesIter = curFaceFaces.begin(); for ( ; nbrsIter != curNbrs.end(), faceFacesIter != curFaceFaces.end(); ++nbrsIter, ++faceFacesIter ) { if (nbrsIter() == curSlave) { nbrFound = true; faceFacesIter().append(ffi); break; } } if (!nbrFound) { curNbrs.append(curSlave); curFaceFaces.append(ffi); // New coarse face created nCoarseFaces++; } } else { // This master has got no neighbours yet. Add a neighbour // and a coefficient, thus creating a new face neighboursTable.insert(curMaster, SLList<label>(curSlave)); faceFaceTable.insert(curMaster, SLList<SLList<label> >(ffi)); // New coarse face created nCoarseFaces++; } } // end for all fine faces
Foam::processorGAMGInterface::processorGAMGInterface ( const label index, const lduInterfacePtrsList& coarseInterfaces, const lduInterface& fineInterface, const labelField& localRestrictAddressing, const labelField& neighbourRestrictAddressing, const label fineLevelIndex, const label coarseComm ) : GAMGInterface ( index, coarseInterfaces ), comm_(coarseComm), myProcNo_(refCast<const processorLduInterface>(fineInterface).myProcNo()), neighbProcNo_ ( refCast<const processorLduInterface>(fineInterface).neighbProcNo() ), forwardT_(refCast<const processorLduInterface>(fineInterface).forwardT()), tag_(refCast<const processorLduInterface>(fineInterface).tag()) { // From coarse face to coarse cell DynamicList<label> dynFaceCells(localRestrictAddressing.size()); // From fine face to coarse face DynamicList<label> dynFaceRestrictAddressing ( localRestrictAddressing.size() ); // From coarse cell pair to coarse face HashTable<label, labelPair, labelPair::Hash<> > cellsToCoarseFace ( 2*localRestrictAddressing.size() ); forAll(localRestrictAddressing, ffi) { labelPair cellPair; // Do switching on master/slave indexes based on the owner/neighbour of // the processor index such that both sides get the same answer. if (myProcNo() < neighbProcNo()) { // Master side cellPair = labelPair ( localRestrictAddressing[ffi], neighbourRestrictAddressing[ffi] ); } else { // Slave side cellPair = labelPair ( neighbourRestrictAddressing[ffi], localRestrictAddressing[ffi] ); } HashTable<label, labelPair, labelPair::Hash<> >::const_iterator fnd = cellsToCoarseFace.find(cellPair); if (fnd == cellsToCoarseFace.end()) { // New coarse face label coarseI = dynFaceCells.size(); dynFaceRestrictAddressing.append(coarseI); dynFaceCells.append(localRestrictAddressing[ffi]); cellsToCoarseFace.insert(cellPair, coarseI); } else { // Already have coarse face dynFaceRestrictAddressing.append(fnd()); } }