Ignore:
Timestamp:
09/22/16 10:59:27 (8 years ago)
Author:
mhnguyen
Message:

Adding Fortran interfaces for retrieving domains, axis, scalars of a field

+) Add some functions in Grid to get its domain, axis, scalar

Test
+) On Curie
+) Work

File:
1 edited

Legend:

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

    r940 r943  
    18451845 
    18461846  /*! 
     1847  \brief Get domain pointer with index 
     1848  \return domain pointer 
     1849  */ 
     1850  CDomain* CGrid::getDomain(int domainIndex) 
     1851  { 
     1852    std::vector<CDomain*> domainListP = this->getDomains(); 
     1853    if (domainListP.empty()) 
     1854    { 
     1855      ERROR("CGrid::getDomain(int domainIndex)", 
     1856            << "No domain associated to this grid. " << std::endl 
     1857            << "Grid id = " << this->getId()); 
     1858    } 
     1859 
     1860    if (domainIndex >= domainListP.size() || (domainIndex < 0)) 
     1861      ERROR("CGrid::getDomain(int domainIndex)", 
     1862            << "Domain with the index doesn't exist " << std::endl 
     1863            << "Grid id = " << this->getId() << std::endl 
     1864            << "Grid has only " << domainListP.size() << " domain but domain index required is " << domainIndex << std::endl); 
     1865 
     1866    return domainListP[domainIndex]; 
     1867  } 
     1868 
     1869  /*! 
     1870  \brief Get the axis pointer with index 
     1871  \return axis pointer 
     1872  */ 
     1873  CAxis* CGrid::getAxis(int axisIndex) 
     1874  { 
     1875    std::vector<CAxis*> axisListP = this->getAxis(); 
     1876    if (axisListP.empty()) 
     1877    { 
     1878      ERROR("CGrid::getDomain(int axisIndex)", 
     1879            << "No axis associated to this grid. " << std::endl 
     1880            << "Grid id = " << this->getId()); 
     1881    } 
     1882 
     1883    if (axisIndex >= axisListP.size() || (axisIndex < 0)) 
     1884      ERROR("CGrid::getDomain(int axisIndex)", 
     1885            << "Domain with the index doesn't exist " << std::endl 
     1886            << "Grid id = " << this->getId() << std::endl 
     1887            << "Grid has only " << axisListP.size() << " axis but axis index required is " << axisIndex << std::endl); 
     1888 
     1889    return axisListP[axisIndex]; 
     1890  } 
     1891 
     1892  /*! 
     1893  \brief Get the a scalar pointer 
     1894  \return scalar pointer 
     1895  */ 
     1896  CScalar* CGrid::getScalar(int scalarIndex) 
     1897  { 
     1898    std::vector<CScalar*> scalarListP = this->getScalars(); 
     1899    if (scalarListP.empty()) 
     1900    { 
     1901      ERROR("CGrid::getScalar(int scalarIndex)", 
     1902            << "No scalar associated to this grid. " << std::endl 
     1903            << "Grid id = " << this->getId()); 
     1904    } 
     1905 
     1906    if (scalarIndex >= scalarListP.size() || (scalarIndex < 0)) 
     1907      ERROR("CGrid::getScalar(int scalarIndex)", 
     1908            << "Scalar with the index doesn't exist " << std::endl 
     1909            << "Grid id = " << this->getId() << std::endl 
     1910            << "Grid has only " << scalarListP.size() << " scalar but scalar index required is " << scalarIndex << std::endl); 
     1911 
     1912    return scalarListP[scalarIndex]; 
     1913  } 
     1914 
     1915  /*! 
    18471916  \brief Set domain(s) of a grid from a list 
    18481917  \param[in] domains list of domains 
Note: See TracChangeset for help on using the changeset viewer.