void Foam::GAMGInterface::combine(const GAMGInterface& coarseGi) { const labelgpuList& coarseFra = coarseGi.faceRestrictAddressing_; const labelList& coarseFraHost = coarseGi.faceRestrictAddressingHost_; labelgpuList restTmp(faceRestrictAddressing_); thrust::copy ( thrust::make_permutation_iterator ( coarseFra.begin(), restTmp.begin() ), thrust::make_permutation_iterator ( coarseFra.begin(), restTmp.end() ), faceRestrictAddressing_.begin() ); forAll(faceRestrictAddressingHost_, ffi) { faceRestrictAddressingHost_[ffi] = coarseFraHost[faceRestrictAddressingHost_[ffi]]; } faceCells_ = coarseGi.faceCells_; faceCellsHost_ = coarseGi.faceCellsHost_; updateAddressing(); }
Foam::GAMGInterface::GAMGInterface ( const label index, const lduInterfacePtrsList& coarseInterfaces, Istream& is ) : index_(index), coarseInterfaces_(coarseInterfaces), faceCellsHost_(is), faceCells_(faceCellsHost_), faceRestrictAddressingHost_(is), faceRestrictAddressing_(faceRestrictAddressingHost_) { updateAddressing(); }
Foam::cyclicAMIGAMGInterface::cyclicAMIGAMGInterface ( const label index, const lduInterfacePtrsList& coarseInterfaces, const lduInterface& fineInterface, const labelField& localRestrictAddressing, const labelField& neighbourRestrictAddressing, const label fineLevelIndex, const label coarseComm ) : GAMGInterface ( index, coarseInterfaces ), fineCyclicAMIInterface_ ( refCast<const cyclicAMILduInterface>(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()); } } faceCellsHost_.transfer(dynFaceCells); faceRestrictAddressingHost_.transfer(dynFaceRestrictAddressing); faceCells_ = faceCellsHost_; updateAddressing(); }