X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FParaMEDMEM%2FInterpolationMatrix.cxx;h=b8271a9451a0dbb2c4038f5eda05ad6dfa1ea3c7;hb=b832b15337be013a56e0976170e5e235b89fcb03;hp=b0c4c0c1e2cb96bb58b74860a8548b30444caff1;hpb=b33408f1dc045a4d0f2e16d22f4930d7029996a3;p=tools%2Fmedcoupling.git diff --git a/src/ParaMEDMEM/InterpolationMatrix.cxx b/src/ParaMEDMEM/InterpolationMatrix.cxx index b0c4c0c1e..b8271a945 100644 --- a/src/ParaMEDMEM/InterpolationMatrix.cxx +++ b/src/ParaMEDMEM/InterpolationMatrix.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2021 CEA/DEN, EDF R&D +// Copyright (C) 2007-2024 CEA, EDF // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -849,7 +849,10 @@ namespace MEDCoupling _mapping.prepareSendRecv(); } - + MCAuto InterpolationMatrix::retrieveNonFetchedIdsTarget(mcIdType nbTuples) const + { + return _mapping.retrieveNonFetchedIdsTarget(nbTuples); + } /*! \brief performs t=Ws, where t is the target field, s is the source field @@ -866,12 +869,10 @@ namespace MEDCoupling { mcIdType nbcomp = ToIdType(field.getArray()->getNumberOfComponents()); vector target_value(_col_offsets.size()* nbcomp,0.0); - //computing the matrix multiply on source side if (_source_group.containsMyRank()) { mcIdType nbrows = ToIdType(_coeffs.size()); - // performing W.S // W is the intersection matrix // S is the source vector @@ -894,17 +895,42 @@ namespace MEDCoupling if (_target_group.containsMyRank()) { - mcIdType nbelems = field.getArray()->getNumberOfTuples() ; - double* value = const_cast (field.getArray()->getPointer()); - for (mcIdType i=0; ifillWithZero(); } //on source side : sending T=VT^(-1).(W.S) //on target side :: receiving T and storing it in field - _mapping.sendRecv(&target_value[0],field); + _mapping.sendRecv(target_value.data(),field); + + if( _target_group.containsMyRank() ) + { + if( this->_presence_dft_value ) + { + const MCAuto nonFetchedEntities = _mapping.retrieveNonFetchedIdsTarget(field.getArray()->getNumberOfTuples()); + double *fieldPtr( field.getArray()->getPointerSilent() ); + for( const mcIdType *eltId = nonFetchedEntities->begin() ; eltId != nonFetchedEntities->end() ; ++eltId) + std::fill( fieldPtr + (*eltId)*nbcomp, fieldPtr + ((*eltId)+1)*nbcomp, this->_dft_value ); + } + } + } + + MCAuto InterpolationMatrix::retrieveNonFetchedIdsSource() const + { + MCAuto ret(DataArrayIdType::New()); ret->alloc(0,1); + if (_source_group.containsMyRank()) + { + mcIdType nbrows = ToIdType( _coeffs.size() ); + for (mcIdType irow = 0; irow < nbrows; irow++) + { + if( _row_offsets[irow+1] == _row_offsets[irow] ) + { + ret->pushBackSilent( irow ); + } + } + } + else + THROW_IK_EXCEPTION("InterpolationMatrix::retrieveNonFetchedIdsSource : not supposed to be called target side !"); + return ret; } @@ -941,17 +967,25 @@ namespace MEDCoupling //T is the target vector for (mcIdType irow = 0; irow < nbrows; irow++) { - for (mcIdType icol = _row_offsets[irow]; icol < _row_offsets[irow+1]; icol++) - { - int colid = _coeffs[irow][icol-_row_offsets[irow]].first; - double value = _coeffs[irow][icol-_row_offsets[irow]].second; - double deno = _deno_reverse_multiply[irow][icol-_row_offsets[irow]]; - for (std::size_t icomp=0; icomp _row_offsets[irow] ) + { + for (mcIdType icol = _row_offsets[irow]; icol < _row_offsets[irow+1]; icol++) + { + int colid = _coeffs[irow][icol-_row_offsets[irow]].first; + double value = _coeffs[irow][icol-_row_offsets[irow]].second; + double deno = _deno_reverse_multiply[irow][icol-_row_offsets[irow]]; + for (std::size_t icomp=0; icomp_dft_value); + } } } }