Changeset 2226 for XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/domain_algorithm/domain_algorithm_extract.cpp
- Timestamp:
- 09/09/21 13:05:36 (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/domain_algorithm/domain_algorithm_extract.cpp
r2190 r2226 175 175 if (domainSrc_->hasArea) domainDest_->area.resize(niDest,njDest); 176 176 177 177 178 // Set attributes required to define domainDestination->localElement_ and associated views, full and workflow) 178 179 CArray<size_t,1> sourceGlobalIdx = domainSource->getLocalElement()->getGlobalIndex(); 179 180 int indexSize = sourceGlobalIdx.numElements(); 180 domainDest_->mask_1d.resize(niDest*njDest); 181 domainDest_->data_i_index.resize(niDest*njDest); 182 domainDestination->data_i_index = -1; 183 domainDest_->data_j_index.resize(niDest*njDest); 184 domainDestination->data_j_index = 0; 185 181 186 CArray<int,1> sourceWorkflowIdx = domainSource->getLocalView(CElementView::WORKFLOW)->getIndex(); 182 CArray<int,1> sourceFullIdx = domainSource->getLocalView(CElementView::FULL )->getIndex(); 187 int srcWorkflowSize = sourceWorkflowIdx.numElements(); 188 for (size_t i = 0; i < srcWorkflowSize ; ++i) 189 { 190 { 191 int iIdxSrc = sourceWorkflowIdx(i)%domainSource->ni_glo-destIBegin; 192 int jIdxSrc = sourceWorkflowIdx(i)/domainSource->ni_glo-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 } 183 200 184 201 int countDest(0); // increment of the position in destination domain 185 int countMasked(0); // countMasked will store the offset index between full and workflow views186 202 for (int countSrc = 0; countSrc < indexSize ; ++countSrc) { 187 203 int iIdxSrc = sourceGlobalIdx(countSrc)%domainSource->ni_glo; … … 195 211 domainDest_->j_index(countDest) = jIdxSrc-extractJBegin_; 196 212 transformationMapping_[extractNi_*(jIdxSrc-extractJBegin_)+iIdxSrc-extractIBegin_]=sourceGlobalIdx(countSrc); 197 if ( ( (countSrc-countMasked) >= sourceWorkflowIdx.numElements() )198 || ( sourceFullIdx(countSrc)!=sourceWorkflowIdx(countSrc-countMasked) ) )199 {200 domainDest_->mask_1d(countDest) = 0;201 // if point masked, manage offset between full and worfklow views of domainSource202 countMasked++;203 }204 else {205 domainDest_->mask_1d(countDest) = 1;206 }207 213 208 214 int iIdxDestLocal = countDest%niDest; … … 262 268 countDest++; 263 269 } 264 else265 if ( ( (countSrc-countMasked) >= sourceWorkflowIdx.numElements() )266 || ( sourceFullIdx(countSrc)!=sourceWorkflowIdx(countSrc-countMasked) ) )267 {268 // manage offset between full and worfklow views of domainSource even if point i is not concerned269 countMasked++;270 }271 270 272 271 }
Note: See TracChangeset
for help on using the changeset viewer.