Ignore:
Timestamp:
01/05/21 10:12:00 (3 years ago)
Author:
ymipsl
Message:

Some cleaning of old transformation dead code

YM

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/node/grid.cpp

    r1999 r2002  
    1717#include "distribution_client.hpp" 
    1818#include "grid_transformation.hpp" 
    19 #include "grid_generate.hpp" 
    2019#include "server.hpp" 
    2120#include "distribution_type.hpp" 
     
    4645      , transformations_(0), isTransformed_(false) 
    4746      , axisPositionInGrid_(), hasDomainAxisBaseRef_(false) 
    48       , gridSrc_(), hasTransform_(false), isGenerated_(false), order_() 
     47      , gridSrc_(), hasTransform_(false), order_() 
    4948      , clients() 
    5049   { 
     
    6564      , transformations_(0), isTransformed_(false) 
    6665      , axisPositionInGrid_(), hasDomainAxisBaseRef_(false) 
    67       , gridSrc_(), hasTransform_(false), isGenerated_(false), order_() 
     66      , gridSrc_(), hasTransform_(false), order_() 
    6867      , clients() 
    6968   { 
     
    838837     if (this->isChecked) return; 
    839838     this->checkElementsAttributes(); 
    840  
    841      if (!(this->hasTransform() && !this->isTransformed())) 
    842       this->isChecked = true; 
    843  
    844      if (!(this->hasTransform() && (!this->isGenerated()))) 
    845       this->isChecked = true; 
     839     this->isChecked = true; 
    846840   } 
    847841   CATCH_DUMP_ATTR 
     
    938932 
    939933   
    940    /*! 
    941      Compute the global index of grid to send to server as well as the connected server of the current client. 
    942      First of all, from the local data on each element of grid, we can calculate their local index which also allows us to know 
    943      their global index. We can have a map of global index of grid and local index that each client holds 
    944      Then, each client holds a piece of information about the distribution of servers, which permits to compute the connected server(s) 
    945      of the current client. 
    946    */ 
    947    // ym obsolete : to be removed.... 
    948    void CGrid::computeIndex(void) 
    949    TRY 
    950    { 
    951     // old interface 
    952      CContext* context = CContext::getCurrent(); 
    953      if (isScalarGrid()) 
    954      { 
    955        //computeClientIndexScalarGrid(); 
    956        if (context->getServiceType()==CServicesManager::CLIENT || context->getServiceType()==CServicesManager::GATHERER) 
    957        { 
    958          // ym computeConnectedClientsScalarGrid(); 
    959        } 
    960      } 
    961      else 
    962      { 
    963        //computeClientIndex(); 
    964        if (context->getServiceType()==CServicesManager::CLIENT || context->getServiceType()==CServicesManager::GATHERER) 
    965        { 
    966          //computeConnectedClients(); 
    967        } 
    968      } 
    969 //ym     if (CServer::serverLevel==2) 
    970      if (context->getServiceType()==CServicesManager::OUT_SERVER) 
    971      { 
    972        if (clientDistribution_!=0) clientDistribution_->partialClear() ; 
    973      } 
    974    } 
    975    CATCH_DUMP_ATTR 
    976  
    977     
    978  
    979934 
    980935   CGrid* CGrid::cloneGrid(const StdString& idNewGrid, CGrid* gridSrc) 
     
    17301685  CATCH_DUMP_ATTR 
    17311686 
    1732   bool CGrid::isTransformed() 
    1733   TRY 
    1734   { 
    1735     return isTransformed_; 
    1736   } 
    1737   CATCH_DUMP_ATTR 
    1738  
    1739   void CGrid::setTransformed() 
    1740   TRY 
    1741   { 
    1742     isTransformed_ = true; 
    1743   } 
    1744   CATCH_DUMP_ATTR 
    1745  
    1746   CGridTransformation* CGrid::getTransformations() 
    1747   TRY 
    1748   { 
    1749     return transformations_; 
    1750   } 
    1751   CATCH_DUMP_ATTR 
    1752  
    1753   void CGrid::addTransGridSource(CGrid* gridSrc) 
    1754   TRY 
    1755   { 
    1756     if (gridSrc_.end() == gridSrc_.find(gridSrc)) 
    1757       gridSrc_.insert(make_pair(gridSrc,make_pair(false,""))); 
    1758   } 
    1759   CATCH_DUMP_ATTR 
    1760  
    1761   std::map<CGrid*,std::pair<bool,StdString> >& CGrid::getTransGridSource() 
    1762   TRY 
    1763   { 
    1764     return gridSrc_; 
    1765   } 
    1766   CATCH_DUMP_ATTR 
    1767  
    1768   /*! 
    1769      Complete all the necessary (and lacking) attributes of a grid 
    1770      This function is similar to gridTransformation but works only (till now) on generate_rectilinear_domain transformation 
    1771   */ 
    1772   void CGrid::completeGrid(CGrid* transformGridSrc) 
    1773   TRY 
    1774   { 
    1775     if (nullptr != transformGridSrc) 
    1776     { 
    1777       if (axis_domain_order.numElements() != transformGridSrc->axis_domain_order.numElements()) 
    1778       { 
    1779         ERROR("CGrid::completeGrid(CGrid* transformGridSrc)", 
    1780              << "Two grids have different number of elements. " << std::endl 
    1781              << "Number of element of grid destination " << this->getId() << " is " << axis_domain_order.numElements() << std::endl 
    1782              << "Number of element of grid source " << transformGridSrc->getId() << " is " << transformGridSrc->axis_domain_order.numElements()); 
    1783       } 
    1784     } 
    1785  
    1786     if (isGenerated()) return; 
    1787     setGenerated(); 
    1788  
    1789     CGridGenerate gridGenerate(this, transformGridSrc); 
    1790     gridGenerate.completeGrid(); 
    1791   } 
    1792   CATCH_DUMP_ATTR 
    1793  
    1794   bool CGrid::isGenerated() 
    1795   TRY 
    1796   { 
    1797     return isGenerated_; 
    1798   } 
    1799   CATCH 
    1800  
    1801   void CGrid::setGenerated() 
    1802   TRY 
    1803   { 
    1804     isGenerated_ = true; 
    1805   } 
    1806   CATCH_DUMP_ATTR 
    1807  
    1808   void CGrid::transformGrid(CGrid* transformGridSrc) 
    1809   TRY 
    1810   { 
    1811     if (!transformGridSrc) 
    1812       ERROR("CGrid::transformGrid(CGrid* transformGridSrc)", 
    1813             << "Impossible to transform grid '" << getId() << "', the source grid is null."); 
    1814  
    1815     if (isTransformed()) return; 
    1816     setTransformed(); 
    1817     if (axis_domain_order.numElements() != transformGridSrc->axis_domain_order.numElements()) 
    1818     { 
    1819       ERROR("CGrid::transformGrid(CGrid* transformGridSrc)", 
    1820            << "Two grids have different number of elements. " << std::endl 
    1821            << "Number of element of grid destination " << this->getId() << " is " << axis_domain_order.numElements() << std::endl 
    1822            << "Number of element of grid source " << transformGridSrc->getId() << " is " << transformGridSrc->axis_domain_order.numElements()); 
    1823     } 
    1824     else 
    1825     { 
    1826     } 
    1827  
    1828     transformations_ = new CGridTransformation(this, transformGridSrc); 
    1829     transformations_->computeAll(); 
    1830     if (0 < transformations_->getNbAlgo()) hasTransform_ = true; 
    1831  
    1832  } 
    1833   CATCH_DUMP_ATTR 
    1834  
    1835  
    1836  
    1837  
    1838   void CGrid::prepareTransformGrid(CGrid* transformGridSrc) 
    1839   TRY 
    1840   { 
    1841     if (prepareTransformGrid_done_) return ; 
    1842  
    1843     if (!transformGridSrc) 
    1844       ERROR("CGrid::transformGrid(CGrid* transformGridSrc)", 
    1845             << "Impossible to transform grid '" << getId() << "', the source grid is null."); 
    1846  
    1847     if (isTransformed()) return; 
    1848     setTransformed(); 
    1849     if (axis_domain_order.numElements() != transformGridSrc->axis_domain_order.numElements()) 
    1850     { 
    1851       ERROR("CGrid::transformGrid(CGrid* transformGridSrc)", 
    1852            << "Two grids have different number of elements. " << std::endl 
    1853            << "Number of element of grid destination " << this->getId() << " is " << axis_domain_order.numElements() << std::endl 
    1854            << "Number of element of grid source " << transformGridSrc->getId() << " is " << transformGridSrc->axis_domain_order.numElements()); 
    1855     } 
    1856     else 
    1857     { 
    1858     } 
    1859  
    1860     transformations_ = new CGridTransformation(this, transformGridSrc); 
    1861     if (0 < transformations_->getNbAlgo()) hasTransform_ = true; 
    1862  
    1863     prepareTransformGrid_done_ = true;  
    1864   } 
    1865   CATCH_DUMP_ATTR 
    1866  
    1867  
    1868   void CGrid::makeTransformGrid(void) 
    1869   TRY 
    1870   { 
    1871     if (makeTransformGrid_done_) return ; 
    1872     transformations_->computeAll(); 
    1873  
    1874     makeTransformGrid_done_ = true ;  
    1875   } 
    1876   CATCH_DUMP_ATTR 
    1877  
     1687   
    18781688 
    18791689  vector<std::string> CGrid::getAuxInputTransformGrid(void) 
     
    18811691  { 
    18821692    if (transformations_ != nullptr) return transformations_->getAuxInputs() ; 
    1883   } 
    1884   CATCH_DUMP_ATTR 
    1885  
    1886  
    1887   bool CGrid::hasTransform() 
    1888   TRY 
    1889   { 
    1890     if (hasTransform_) return hasTransform_; 
    1891  
    1892     std::vector<CDomain*> domList = getDomains(); 
    1893     std::vector<CAxis*> axisList = getAxis(); 
    1894     std::vector<CScalar*> scalarList = getScalars(); 
    1895  
    1896     for (int idx = 0; idx < domList.size(); ++idx) hasTransform_ |= domList[idx]->hasTransformation(); 
    1897     for (int idx = 0; idx < axisList.size(); ++idx) hasTransform_ |= axisList[idx]->hasTransformation(); 
    1898     for (int idx = 0; idx < scalarList.size(); ++idx) hasTransform_ |= scalarList[idx]->hasTransformation(); 
    1899  
    1900     return hasTransform_; 
    19011693  } 
    19021694  CATCH_DUMP_ATTR 
Note: See TracChangeset for help on using the changeset viewer.