Ignore:
Timestamp:
10/24/16 16:16:40 (8 years ago)
Author:
mhnguyen
Message:

Minor improvements:

+) Change some type of variable to avoid some error-prone inputs
+) Change some class name to make it meaningful

Test
+) On Curie
+) Okie

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/src/node/reduce_domain_to_axis.cpp

    r938 r980  
    5151    int domain_nj_glo = domainSrc->nj_glo; 
    5252 
    53     StdString opLists[]= {"sum","min","max"}; 
    54     std::set<StdString> opString(opLists, opLists + sizeof(opLists)/sizeof(opLists[0])); 
    55  
    5653    if (this->operation.isEmpty()) 
    5754      ERROR("CReduceDomainToAxis::checkValid(CAxis* axisDst, CDomain* domainSrc)", 
     
    6057             << "Axis destination " << axisDst->getId()); 
    6158 
    62     StdString op = this->operation; 
    63     if (opString.end() == opString.find(op)) 
     59    if (this->direction.isEmpty()) 
    6460      ERROR("CReduceDomainToAxis::checkValid(CAxis* axisDst, CDomain* domainSrc)", 
    65          << "Operation '" << op << "' not found. Please make sure to use a supported one" 
    66          << "Domain source " <<domainSrc->getId() << std::endl 
    67          << "Axis destination " << axisDst->getId()); 
     61             << "A direction to apply the operation must be defined. It should be: 'iDir' or 'jDir'" 
     62             << "Domain source " <<domainSrc->getId() << std::endl 
     63             << "Axis destination " << axisDst->getId()); 
    6864 
    6965    if (this->direction.isEmpty()) 
     
    7268             << "Domain source " <<domainSrc->getId() << std::endl 
    7369             << "Axis destination " << axisDst->getId()); 
     70 
     71     
     72    switch (direction) 
     73    { 
     74      case direction_attr::jDir: 
     75        if (axis_n_glo != domain_ni_glo) 
     76          ERROR("CReduceDomainToAxis::checkValid(CAxis* axisDst, CDomain* domainSrc)", 
     77            << "Extract domain along j, axis destination should have n_glo equal to ni_glo of domain source" 
     78            << "Domain source " <<domainSrc->getId() << " has nj_glo " << domain_ni_glo << std::endl 
     79            << "Axis destination " << axisDst->getId() << " has n_glo " << axis_n_glo); 
     80         break; 
     81 
     82      case direction_attr::iDir: 
     83        if (axis_n_glo != domain_nj_glo) 
     84          ERROR("CReduceDomainToAxis::checkValid(CAxis* axisDst, CDomain* domainSrc)", 
     85            << "Extract domain along i, axis destination should have n_glo equal to nj_glo of domain source" 
     86            << "Domain source " <<domainSrc->getId() << " has nj_glo " << domain_nj_glo << std::endl 
     87            << "Axis destination " << axisDst->getId() << " has n_glo " << axis_n_glo); 
     88        break; 
     89 
     90      default: 
     91        break; 
     92    } 
    7493  } 
    7594 
Note: See TracChangeset for help on using the changeset viewer.