Changeset 2232
- Timestamp:
- 09/15/21 14:41:40 (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/domain_algorithm/domain_algorithm_extract.cpp
r2228 r2232 175 175 if (domainSrc_->hasArea) domainDest_->area.resize(niDest,njDest); 176 176 177 178 177 // Set attributes required to define domainDestination->localElement_ and associated views, full and workflow) 179 178 CArray<size_t,1> sourceGlobalIdx = domainSource->getLocalElement()->getGlobalIndex(); … … 186 185 CArray<int,1> sourceWorkflowIdx = domainSource->getLocalView(CElementView::WORKFLOW)->getIndex(); 187 186 int srcWorkflowSize = sourceWorkflowIdx.numElements(); 188 for (size_t i = 0; i < srcWorkflowSize ; ++i)189 {190 {191 int iIdxSrc = sourceWorkflowIdx(i)%domainSource->ni-destIBegin;192 int jIdxSrc = sourceWorkflowIdx(i)/domainSource->ni-destJBegin;193 int extractedSrcWFIdx = jIdxSrc * niDest + iIdxSrc;194 if ((extractedSrcWFIdx>=0)&&(extractedSrcWFIdx<niDest*njDest))195 {196 domainDest_->data_i_index(extractedSrcWFIdx) = extractedSrcWFIdx;197 }198 }199 }200 187 201 188 int iIdxSrcMin = INT_MAX; 202 189 int jIdxSrcMin = INT_MAX; 190 int IdxMin = INT_MAX; 203 191 for (int countSrc = 0; countSrc < indexSize ; ++countSrc) 204 192 { 205 if ( sourceGlobalIdx(countSrc)%domainSource->ni_glo < iIdxSrcMin ) 206 iIdxSrcMin = sourceGlobalIdx(countSrc)%domainSource->ni_glo; 207 if ( sourceGlobalIdx(countSrc)/domainSource->ni_glo < jIdxSrcMin ) 208 jIdxSrcMin = sourceGlobalIdx(countSrc)/domainSource->ni_glo; 193 if ( sourceGlobalIdx(countSrc)%domainSource->ni_glo < iIdxSrcMin ) 194 iIdxSrcMin = sourceGlobalIdx(countSrc)%domainSource->ni_glo; 195 if ( sourceGlobalIdx(countSrc)/domainSource->ni_glo < jIdxSrcMin ) 196 jIdxSrcMin = sourceGlobalIdx(countSrc)/domainSource->ni_glo; 197 if ( sourceGlobalIdx(countSrc) < IdxMin ) 198 IdxMin = sourceGlobalIdx(countSrc); 209 199 } 210 200 … … 223 213 224 214 // ------------------ define transformation only if in the WF ------------------ 225 int convert_locally_global_idx = (jIdxSrc-jIdxSrcMin)*domainSource->ni + (iIdxSrc-iIdxSrcMin) ; 215 // countSrc+IdxMin is the global position (not index) considering the distributed memory 216 // - can be compared to the workflow view 217 int iIdxSrc2 = (countSrc+IdxMin)%domainSource->ni_glo; 218 int jIdxSrc2 = (countSrc+IdxMin)/domainSource->ni_glo; 219 int convert_locally_global_idx = (jIdxSrc2-jIdxSrcMin)*domainSource->ni + (iIdxSrc2-iIdxSrcMin) ; 226 220 bool concerned_by_WF(false); 227 221 for ( int i = 0 ; i<sourceWorkflowIdx.numElements() ; ++i ) … … 236 230 { 237 231 transformationMapping_[extractNi_*(jIdxSrc-extractJBegin_)+iIdxSrc-extractIBegin_]=sourceGlobalIdx(countSrc); 232 domainDest_->data_i_index( countDest ) = countDest; 238 233 } 239 234 // -----------------------------------------------------------------------------
Note: See TracChangeset
for help on using the changeset viewer.