- Timestamp:
- 09/09/21 13:05:36 (3 years ago)
- Location:
- XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/domain_algorithm
- Files:
-
- 2 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 } -
XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/domain_algorithm/domain_algorithm_reorder.cpp
r2190 r2226 94 94 domainDestination->i_index.resize( indexSize ); 95 95 domainDestination->j_index.resize( indexSize ); 96 for (size_t i = 0; i < indexSize ; ++i) { 96 for (size_t i = 0; i < indexSize ; ++i) 97 { 97 98 domainDestination->i_index(i) = sourceGlobalIdx(i)%domainSource->ni_glo; 98 99 domainDestination->j_index(i) = sourceGlobalIdx(i)/domainSource->ni_glo; … … 104 105 // - domainDestination->j_index = 0; 105 106 106 // set mask_1d to enable domainMask computing (in checkMask())107 // set data_i_index to enable localMask computing (in computeLocalMask()), used to compute Workflow View 107 108 CArray<int,1> sourceWorkflowIdx = domainSource->getLocalView(CElementView::WORKFLOW)->getIndex(); 108 CArray<int,1> sourceFullIdx = domainSource->getLocalView(CElementView::FULL )->getIndex(); 109 domainDestination->mask_1d.resize( indexSize ); 110 int countMasked(0); // countMasked will store the offset index between full and workflow views 111 for (size_t i = 0; i < indexSize ; ++i) { 112 if ( ( (i-countMasked) >= sourceWorkflowIdx.numElements() ) 113 || ( sourceFullIdx(i)!=sourceWorkflowIdx(i-countMasked) ) ) { 114 domainDestination->mask_1d(i) = 0; 115 countMasked++; 116 } 117 else { 118 domainDestination->mask_1d(i) = 1; 119 } 109 domainDestination->data_i_index.resize( indexSize ); 110 domainDestination->data_i_index = -1; 111 domainDestination->data_j_index.resize( indexSize ); 112 domainDestination->data_j_index = 0; 113 int srcWorkflowSize = sourceWorkflowIdx.numElements(); 114 for (size_t i = 0; i < srcWorkflowSize ; ++i) 115 { 116 domainDestination->data_i_index(sourceWorkflowIdx(i)) = sourceWorkflowIdx(i); 120 117 } 121 118
Note: See TracChangeset
for help on using the changeset viewer.