Ignore:
Timestamp:
07/20/18 14:02:55 (6 years ago)
Author:
oabramkina
Message:

Grid mask is not reconstructed anymore based on elements' masks.

Whenever it is needed, either elements' masks are used directly or grid mask if it is defined by a user.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/src/distribution_client.cpp

    r1562 r1564  
    6868      break; 
    6969    case 1: 
    70       readGridMaskInfo(grid->mask_1d); 
     70      if (!grid->mask_1d.isEmpty()) readGridMaskInfo(grid->mask_1d); 
    7171      break; 
    7272    case 2: 
    73       readGridMaskInfo(grid->mask_2d); 
     73      if (!grid->mask_2d.isEmpty()) readGridMaskInfo(grid->mask_2d); 
    7474      break; 
    7575    case 3: 
    76       readGridMaskInfo(grid->mask_3d); 
     76      if (!grid->mask_3d.isEmpty()) readGridMaskInfo(grid->mask_3d); 
    7777      break; 
    7878    case 4: 
    79       readGridMaskInfo(grid->mask_4d); 
     79      if (!grid->mask_4d.isEmpty()) readGridMaskInfo(grid->mask_4d); 
    8080      break; 
    8181    case 5: 
    82       readGridMaskInfo(grid->mask_5d); 
     82      if (!grid->mask_5d.isEmpty()) readGridMaskInfo(grid->mask_5d); 
    8383      break; 
    8484    case 6: 
    85       readGridMaskInfo(grid->mask_6d); 
     85      if (!grid->mask_6d.isEmpty()) readGridMaskInfo(grid->mask_6d); 
    8686      break; 
    8787    case 7: 
    88       readGridMaskInfo(grid->mask_7d); 
     88      if (!grid->mask_7d.isEmpty()) readGridMaskInfo(grid->mask_7d); 
    8989      break; 
    9090    default: 
     
    411411  size_t idx = 0, indexLocalDataOnClientCount = 0; 
    412412  size_t ssize = 1; 
     413 
    413414  for (int i = 0; i < numElement_; ++i) ssize *= eachElementSize[i]; 
    414415  while (idx < ssize) 
     
    436437      int gridMaskIndex = 0; 
    437438      currentIndex[0] = elementLocalIndex_[0](i); 
    438       for (int k = 0; k < this->numElement_; ++k) 
    439       { 
    440         gridMaskIndex += (currentIndex[k])*elementNLocal_[k]; 
    441       } 
    442  
    443       if (gridMask_(gridMaskIndex)) 
    444       { 
    445         ++indexLocalDataOnClientCount; 
    446       } 
     439 
     440      // If defined, iterate on grid mask 
     441      if (!gridMask_.isEmpty()) 
     442      { 
     443        for (int k = 0; k < this->numElement_; ++k) 
     444        { 
     445          gridMaskIndex += (currentIndex[k])*elementNLocal_[k]; 
     446        } 
     447        if (gridMask_(gridMaskIndex)) ++indexLocalDataOnClientCount; 
     448      } 
     449      // If grid mask is not defined, iterate on elements' mask 
     450      else 
     451      { 
     452        bool maskTmp = true; 
     453        int idxDomain = 0, idxAxis = 0; 
     454        for (int elem = 0; elem < numElement_; ++elem) 
     455        { 
     456          if (2 == axisDomainOrder_(elem)) 
     457          { 
     458            maskTmp = maskTmp && domainMasks_[idxDomain](currentIndex[elem]); 
     459            ++idxDomain; 
     460          } 
     461          else if (1 == axisDomainOrder_(elem)) 
     462          { 
     463            maskTmp = maskTmp && axisMasks_[idxAxis](currentIndex[elem]); 
     464            ++idxAxis; 
     465          } 
     466        } 
     467        if (maskTmp) ++indexLocalDataOnClientCount; 
     468      } 
     469 
    447470    } 
    448471    idxLoop[0] += innerLoopSize; 
     
    518541          } 
    519542 
    520           if (gridMask_(gridMaskIndex)) 
     543          bool maskTmp = true; 
     544          // If defined, apply grid mask 
     545         if (!gridMask_.isEmpty()) 
     546          { 
     547            maskTmp =  gridMask_(gridMaskIndex); 
     548          } 
     549          // If grid mask is not defined, apply elements' mask 
     550          else 
     551          { 
     552            int idxDomain = 0, idxAxis = 0; 
     553            for (int elem = 0; elem < numElement_; ++elem) 
     554            { 
     555              if (2 == axisDomainOrder_(elem)) 
     556              { 
     557                maskTmp = maskTmp && domainMasks_[idxDomain](currentIndex[elem]); 
     558                ++idxDomain; 
     559              } 
     560              else if (1 == axisDomainOrder_(elem)) 
     561              { 
     562                maskTmp = maskTmp && axisMasks_[idxAxis](currentIndex[elem]); 
     563                ++idxAxis; 
     564              } 
     565            } 
     566          } 
     567 
     568          if (maskTmp) 
    521569          { 
    522570            size_t globalIndex = 0; 
Note: See TracChangeset for help on using the changeset viewer.