Ignore:
Timestamp:
11/02/15 11:46:25 (8 years ago)
Author:
mhnguyen
Message:

Implementing the reading of attributes of an axis from a file

+) 3d grid can be read directly from a file
+) Clean some redundant codes
+) Add new attribute declaration that allows to output only desired attributes

Test
+) On Curie
+) test_remap passes and result is correct

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/src/transformation/domain_algorithm_generate_rectilinear.cpp

    r727 r775  
    1717 
    1818CDomainAlgorithmGenerateRectilinear::CDomainAlgorithmGenerateRectilinear(CDomain* domainDestination, CDomain* domainSource, 
    19                                                                          CGrid* gridSource, CGenerateRectilinearDomain* genRectDomain) 
    20 : CDomainAlgorithmTransformation(domainDestination, domainSource), gridSrc_(gridSource), nbDomainDistributedPart_(0) 
     19                                                                         CGrid* gridDest, CGrid* gridSource, 
     20                                                                         CGenerateRectilinearDomain* genRectDomain) 
     21: CDomainAlgorithmTransformation(domainDestination, domainSource), nbDomainDistributedPart_(0) 
    2122{ 
    2223  genRectDomain->checkValid(domainDestination); 
    23   computeDistributionGridSource(); 
     24  if (0 != gridSource) computeDistributionGridSource(gridSource); 
     25  else 
     26  { 
     27    computeDistributionGridDestination(gridDest); 
     28  } 
    2429  fillInAttributesDomainDestination(); 
    2530} 
     
    3641  Calculate the number of distributed parts on domain source 
    3742*/ 
    38 void CDomainAlgorithmGenerateRectilinear::computeDistributionGridSource() 
     43void CDomainAlgorithmGenerateRectilinear::computeDistributionGridSource(CGrid* gridSrc) 
    3944{ 
    4045  CContext* context = CContext::getCurrent(); 
    4146  CContextClient* client = context->client; 
    4247 
    43   std::vector<CDomain*> domListSrcP = gridSrc_->getDomains(); 
    44   std::vector<CAxis*> axisListSrcP = gridSrc_->getAxis(); 
     48  std::vector<CDomain*> domListSrcP = gridSrc->getDomains(); 
     49  std::vector<CAxis*> axisListSrcP = gridSrc->getAxis(); 
    4550 
    4651  for (int i = 0; i < domListSrcP.size(); ++i) // support we have only domain, more than one, for now, dont know how to process 
     
    5055    else 
    5156    { 
    52       gridSrc_->solveAxisRef(false); 
     57      gridSrc->solveAxisRef(false); 
    5358      int nbAxis = axisListSrcP.size(); 
    5459      std::vector<int> nbLocalAxis(nbAxis, 0); 
     
    9095 
    9196/*! 
     97  Compute the distribution of the domain destination by using available information provided by user such as n_distributed_partition of axis 
     98*/ 
     99void CDomainAlgorithmGenerateRectilinear::computeDistributionGridDestination(CGrid* gridDest) 
     100{ 
     101  // For now, just suppose that the grid contains only one domain 
     102  std::vector<CAxis*> axisListDestP = gridDest->getAxis(); 
     103  int nbPartition = 1, idx = 0; 
     104  for (int i = 0; i < gridDest->axis_domain_order.numElements(); ++i) 
     105  { 
     106    if (false == (gridDest->axis_domain_order)(i)) 
     107    { 
     108      nbPartition *= (axisListDestP[idx]->n_distributed_partition.isEmpty()) ? 1: (axisListDestP[idx]->n_distributed_partition.getValue()); 
     109      ++idx; 
     110    } 
     111  } 
     112 
     113  CContext* context = CContext::getCurrent(); 
     114  CContextClient* client = context->client; 
     115  int modPart = (client->clientSize) % nbPartition; 
     116  if (0 != modPart) 
     117    ERROR("CDomainAlgorithmGenerateRectilinear::computeDistributionGridDestination(CGrid* gridDest)", 
     118       << "The grid " <<gridDest->getId() << " is not well-distributed. There is an incompatibility between distribution of axis and domain."); 
     119  nbDomainDistributedPart_ = client->clientSize/nbPartition; 
     120 
     121} 
     122 
     123/*! 
    92124  Fill in all necessary attributes of domain destination and their values 
    93125*/ 
Note: See TracChangeset for help on using the changeset viewer.