Ignore:
Timestamp:
01/11/17 15:14:22 (7 years ago)
Author:
mhnguyen
Message:

Merging working version of coupler

+) Add some changes of domain and axis: Retransfer the atttributes in a generic ways for each level of client (or server)
+) Remove some spoiled files from the previous commits

Test
+) No test

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/dev_olga/src/distribution_client.cpp

    r1021 r1025  
    1111namespace xios { 
    1212 
    13 CDistributionClient::CDistributionClient(int rank, const GlobalLocalDataMap& globalLocalIndex) 
     13CDistributionClient::CDistributionClient(int rank, CGrid* grid, const GlobalLocalDataMap& globalLocalIndex) 
    1414  : CDistribution(rank, 0) 
    1515   , axisDomainOrder_() 
     
    3434    ++idx; 
    3535  } 
     36 
     37  std::vector<CDomain*> domList = grid->getDomains(); 
     38  std::vector<CAxis*> axisList = grid->getAxis(); 
     39  std::vector<CScalar*> scalarList = grid->getScalars(); 
     40  CArray<int,1> axisDomainOrder = grid->axis_domain_order; 
     41 
     42  int numElement = axisDomainOrder.numElements(); 
     43  // Because domain and axis can be in any order (axis1, domain1, axis2, axis3, ) 
     44  // their position should be specified. In axisDomainOrder, domain == true, axis == false 
     45  int dims = numElement; 
     46  idx = 0; 
     47  std::vector<int> indexMap(numElement);   
     48  for (int i = 0; i < numElement; ++i) 
     49  { 
     50    indexMap[i] = idx; 
     51    if (2 == axisDomainOrder(i)) 
     52    { 
     53      ++dims; 
     54      idx += 2; 
     55    } 
     56    else ++idx; 
     57  } 
     58 
     59  nGlob_.resize(dims); 
     60 
     61  // Data_n_index of domain or axis (For now, axis uses its size as data_n_index 
     62  dataNIndex_.resize(numElement); 
     63  dataDims_.resize(numElement); 
     64  isDataDistributed_ = false; 
     65  int domIndex = 0, axisIndex = 0, scalarIndex = 0; 
     66  for (idx = 0; idx < numElement; ++idx) 
     67  { 
     68    int eleDim = axisDomainOrder(idx); 
     69 
     70    // If this is a domain 
     71    if (2 == eleDim) 
     72    { 
     73      // On the j axis 
     74      nGlob_.at(indexMap[idx]+1)  = domList[domIndex]->nj_glo.getValue(); 
     75      nGlob_.at(indexMap[idx]) = domList[domIndex]->ni_glo.getValue(); 
     76      dataNIndex_.at(idx) = domList[domIndex]->data_i_index.numElements(); 
     77      dataDims_.at(idx) = domList[domIndex]->data_dim.getValue(); 
     78 
     79      isDataDistributed_ |= domList[domIndex]->isDistributed(); 
     80      ++domIndex; 
     81    } 
     82    else if (1 == eleDim)// So it's an axis 
     83    { 
     84      nGlob_.at(indexMap[idx]) = axisList[axisIndex]->n_glo.getValue(); 
     85      dataNIndex_.at(idx) = axisList[axisIndex]->data_index.numElements(); 
     86      dataDims_.at(idx) = 1; 
     87 
     88      isDataDistributed_ |= axisList[axisIndex]->isDistributed(); 
     89      ++axisIndex; 
     90    } 
     91    else // scalar 
     92    { 
     93      nGlob_.at(indexMap[idx]) = 1; 
     94      dataNIndex_.at(idx) = 1; 
     95      dataDims_.at(idx) = 1; 
     96 
     97      isDataDistributed_ |= false; 
     98      ++scalarIndex; 
     99    } 
     100  } 
     101 
    36102} 
    37103 
     
    192258  infoIndex_.resize(this->dims_); 
    193259 
    194   // A trick to determine position of each domain in domainList 
    195   int domIndex = 0, axisIndex = 0, scalarIndex = 0; 
    196   idx = 0; 
    197  
    198260  elementLocalIndex_.resize(numElement_); 
    199261  elementGlobalIndex_.resize(numElement_); 
     
    202264  elementNLocal_.resize(numElement_); 
    203265  elementNGlobal_.resize(numElement_); 
     266 
    204267  elementNLocal_[0] = 1; 
    205268  elementNGlobal_[0] = 1; 
     269  isDataDistributed_ = false; 
     270 
    206271  size_t localSize = 1, globalSize = 1; 
    207272 
    208   isDataDistributed_ = false; 
     273  // A trick to determine position of each domain in domainList 
     274  int domIndex = 0, axisIndex = 0, scalarIndex = 0; 
     275  idx = 0; 
     276 
     277   
    209278  // Update all the vectors above 
    210279  for (idx = 0; idx < numElement_; ++idx) 
Note: See TracChangeset for help on using the changeset viewer.