- Timestamp:
- 01/17/21 22:43:51 (3 years ago)
- Location:
- XIOS/dev/dev_ym/XIOS_COUPLING/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/grid.cpp
r2011 r2016 1708 1708 if (CGrid::has(newId)) 1709 1709 { 1710 cout<<"Retrive existing grid : "<<newId<<endl ; 1710 1711 newGrid = CGrid::get(newId); 1711 1712 isNewGrid = false ; … … 1713 1714 else 1714 1715 { 1716 cout<<"Create new grid : "<<newId<<endl ; 1715 1717 newGrid = CGrid::create(newId) ; 1716 1718 isNewGrid = true ; … … 1767 1769 { 1768 1770 CDomain* dstDomain ; 1769 if (CDomain::has(dstElementId)) dstDomain = CDomain::get(dstElementId) ; 1770 else 1771 CDomain* lastDstDomain ; 1772 bool isGenerate=false ; 1773 1774 do 1771 1775 { 1772 dstDomain = CDomain::create() ; 1773 dstDomain->createAlias(dstElementId) ; 1774 if (srcElementId=="" && srcElement.type==TYPE_DOMAIN) dstDomain->duplicateAttributes(srcElement.domain) ; // make a copy 1775 else dstDomain->duplicateAttributes(dstElement.domain) ; // make a copy 1776 CTransformation<CDomain>* transformation = CTransformation<CDomain>::createTransformation(transType,"") ; 1777 auto srcTransform = CTransformation<CDomain>::getTransformation(transType, transId) ; 1778 transformation->inheritFrom(srcTransform) ; 1779 tmpGridDst->addDomain(dstDomain->getId()) ; 1780 1781 algo = transformation -> createAlgorithm(false, tmpGridDst, tmpGridSrc, 0, 1782 posInGrid,posInGrid,posInGrid, 1783 posInGrid,posInGrid,posInGrid ); 1784 //reuse existing algorithm interface for, now 1785 /* algo = CGridTransformationFactory<CDomain>::createTransformation(transType, false, tmpGridDst, tmpGridSrc, 1786 transformation, 0, 1787 posInGrid,posInGrid,posInGrid, 1788 posInGrid,posInGrid,posInGrid ); 1789 */ 1790 dstDomain->setTransformationAlgorithm(algo) ; 1776 1777 if (CDomain::has(dstElementId)) 1778 { 1779 dstDomain = CDomain::get(dstElementId) ; 1780 cout<<"Retrive existing domain : "<<dstElementId<<endl ; 1781 } 1782 else 1783 { 1784 dstDomain = CDomain::create() ; 1785 dstDomain->createAlias(dstElementId) ; 1786 cout<<"Create new domain : "<<dstDomain->getId()<<" with alias : "<<dstElementId<<endl ; 1787 1788 if (isGenerate) dstDomain->duplicateAttributes(lastDstDomain) ; 1789 else if (srcElementId=="" && srcElement.type==TYPE_DOMAIN) dstDomain->duplicateAttributes(srcElement.domain) ; // make a copy 1790 else dstDomain->duplicateAttributes(dstElement.domain) ; // make a copy 1791 CTransformation<CDomain>* transformation = CTransformation<CDomain>::createTransformation(transType,"") ; 1792 auto srcTransform = CTransformation<CDomain>::getTransformation(transType, transId) ; 1793 transformation->inheritFrom(srcTransform) ; 1794 CGrid* tmpGridDst=CGrid::create(); // destination Grid 1795 tmpGridDst->addDomain(dstDomain->getId()) ; 1796 1797 algo = transformation -> createAlgorithm(false, tmpGridDst, tmpGridSrc, 0, 1798 posInGrid,posInGrid,posInGrid, 1799 posInGrid,posInGrid,posInGrid ); 1800 1801 1802 dstDomain->setTransformationAlgorithm(algo) ; 1803 dstDomain->setTransformationPaths(transformationPath) ; 1804 } 1805 algo=dstDomain->getTransformationAlgorithm() ; 1806 isGenerate = algo->isGenerateTransformation() ; 1791 1807 transformationPath.removeNextTransform() ; 1808 dstElementId=transformationPath.getNextElementId() ; 1809 srcElementId=transformationPath.getNextElementSrcId() ; 1810 transType = transformationPath.getNextTransformationType() ; 1811 transId = transformationPath.getNextTransformationId() ; 1812 lastDstDomain=dstDomain ; 1792 1813 dstDomain->setTransformationPaths(transformationPath) ; 1793 } 1814 } while(transformationPath.hasTransform() && isGenerate) ; 1815 1794 1816 if (isNewGrid) newGrid->addDomain(dstDomain->getId()) ; 1795 1817 algo = dstDomain->getTransformationAlgorithm() ; … … 1798 1820 { 1799 1821 CAxis* dstAxis ; 1800 if (CAxis::has(dstElementId)) dstAxis = CAxis::get(dstElementId) ; 1801 else 1822 CAxis* lastDstAxis ; 1823 bool isGenerate=false ; 1824 1825 do 1802 1826 { 1803 dstAxis = CAxis::create() ; 1804 dstAxis->createAlias(dstElementId) ; 1805 if (srcElementId=="" && srcElement.type==TYPE_AXIS) dstAxis->duplicateAttributes(srcElement.axis) ; // make a copy 1806 else dstAxis->duplicateAttributes(dstElement.axis) ; // make a copy 1807 CTransformation<CAxis>* transformation = CTransformation<CAxis>::createTransformation(transType,"") ; 1808 auto srcTransform = CTransformation<CAxis>::getTransformation(transType, transId) ; 1809 transformation->inheritFrom(srcTransform) ; 1810 tmpGridDst->addAxis(dstAxis->getId()) ; 1811 1812 algo = transformation -> createAlgorithm(false, tmpGridDst, tmpGridSrc, 0, 1813 posInGrid,posInGrid,posInGrid, 1814 posInGrid,posInGrid,posInGrid ); 1815 1816 //reuse existing algorithm interface for, now 1817 /* algo = CGridTransformationFactory<CAxis>::createTransformation(transType, false, tmpGridDst, tmpGridSrc, 1818 transformation, 0, 1819 posInGrid,posInGrid,posInGrid, 1820 posInGrid,posInGrid,posInGrid );*/ 1821 dstAxis->setTransformationAlgorithm(algo) ; 1827 if (CAxis::has(dstElementId)) 1828 { 1829 dstAxis = CAxis::get(dstElementId) ; 1830 cout<<"Retrive existing axis : "<<dstElementId<<endl ; 1831 } 1832 else 1833 { 1834 dstAxis = CAxis::create() ; 1835 dstAxis->createAlias(dstElementId) ; 1836 cout<<"Create new axis : "<<dstAxis->getId()<<" with alias : "<<dstElementId<<endl ; 1837 1838 if (isGenerate) dstAxis->duplicateAttributes(lastDstAxis) ; 1839 else if (srcElementId=="" && srcElement.type==TYPE_AXIS) dstAxis->duplicateAttributes(srcElement.axis) ; // make a copy 1840 else dstAxis->duplicateAttributes(dstElement.axis) ; // make a copy 1841 CTransformation<CAxis>* transformation = CTransformation<CAxis>::createTransformation(transType,"") ; 1842 auto srcTransform = CTransformation<CAxis>::getTransformation(transType, transId) ; 1843 transformation->inheritFrom(srcTransform) ; 1844 tmpGridDst->addAxis(dstAxis->getId()) ; 1845 1846 algo = transformation -> createAlgorithm(false, tmpGridDst, tmpGridSrc, 0, 1847 posInGrid,posInGrid,posInGrid, 1848 posInGrid,posInGrid,posInGrid ); 1849 1850 dstAxis->setTransformationAlgorithm(algo) ; 1851 dstAxis->setTransformationPaths(transformationPath) ; 1852 } 1853 1854 algo=dstAxis->getTransformationAlgorithm() ; 1855 isGenerate = algo->isGenerateTransformation() ; 1822 1856 transformationPath.removeNextTransform() ; 1857 dstElementId=transformationPath.getNextElementId() ; 1858 srcElementId=transformationPath.getNextElementSrcId() ; 1859 transType = transformationPath.getNextTransformationType() ; 1860 transId = transformationPath.getNextTransformationId() ; 1861 lastDstAxis=dstAxis ; 1823 1862 dstAxis->setTransformationPaths(transformationPath) ; 1824 } 1825 if (isNewGrid) newGrid->addAxis(dstAxis->getId()) ; 1863 } while(transformationPath.hasTransform() && isGenerate) ; 1864 1865 if (isNewGrid) newGrid->addAxis(dstAxis->getId()) ; 1826 1866 algo = dstAxis->getTransformationAlgorithm() ; 1827 1867 } … … 1829 1869 { 1830 1870 CScalar* dstScalar ; 1831 if (CScalar::has(dstElementId)) dstScalar = CScalar::get(dstElementId) ; 1832 else 1871 CScalar* lastDstScalar ; 1872 bool isGenerate=false ; 1873 1874 do 1833 1875 { 1834 dstScalar = CScalar::create() ; 1835 dstScalar->createAlias(dstElementId) ; 1836 if (srcElementId=="" && srcElement.type==TYPE_SCALAR) dstScalar->duplicateAttributes(srcElement.scalar) ; // make a copy 1837 else dstScalar->duplicateAttributes(dstElement.scalar) ; // make a copy 1838 CTransformation<CScalar>* transformation = CTransformation<CScalar>::createTransformation(transType,"") ; 1839 auto srcTransform = CTransformation<CScalar>::getTransformation(transType, transId) ; 1840 transformation->inheritFrom(srcTransform) ; 1841 tmpGridDst->addScalar(dstScalar->getId()) ; 1842 1843 algo = transformation -> createAlgorithm(false, tmpGridDst, tmpGridSrc, 0, 1844 posInGrid,posInGrid,posInGrid, 1845 posInGrid,posInGrid,posInGrid ); 1846 //reuse existing algorithm interface for, now 1847 /* algo = CGridTransformationFactory<CScalar>::createTransformation(transType, false, tmpGridDst, tmpGridSrc, 1848 transformation, 0, 1849 posInGrid,posInGrid,posInGrid, 1850 posInGrid,posInGrid,posInGrid );*/ 1851 dstScalar->setTransformationAlgorithm(algo) ; 1876 if (CScalar::has(dstElementId)) 1877 { 1878 dstScalar = CScalar::get(dstElementId) ; 1879 cout<<"Retrive existing scalar : "<<dstElementId<<endl ; 1880 } 1881 else 1882 { 1883 dstScalar = CScalar::create() ; 1884 dstScalar->createAlias(dstElementId) ; 1885 cout<<"Create new scalar : "<<dstScalar->getId()<<" with alias : "<<dstElementId<<endl ; 1886 1887 if (isGenerate) dstScalar->duplicateAttributes(lastDstScalar) ; 1888 else if (srcElementId=="" && srcElement.type==TYPE_SCALAR) dstScalar->duplicateAttributes(srcElement.scalar) ; // make a copy 1889 else dstScalar->duplicateAttributes(dstElement.scalar) ; // make a copy 1890 CTransformation<CScalar>* transformation = CTransformation<CScalar>::createTransformation(transType,"") ; 1891 auto srcTransform = CTransformation<CScalar>::getTransformation(transType, transId) ; 1892 transformation->inheritFrom(srcTransform) ; 1893 tmpGridDst->addScalar(dstScalar->getId()) ; 1894 1895 algo = transformation -> createAlgorithm(false, tmpGridDst, tmpGridSrc, 0, 1896 posInGrid,posInGrid,posInGrid, 1897 posInGrid,posInGrid,posInGrid ); 1898 1899 dstScalar->setTransformationAlgorithm(algo) ; 1900 dstScalar->setTransformationPaths(transformationPath) ; 1901 } 1902 algo=dstScalar->getTransformationAlgorithm() ; 1903 isGenerate = algo->isGenerateTransformation() ; 1852 1904 transformationPath.removeNextTransform() ; 1905 dstElementId=transformationPath.getNextElementId() ; 1906 srcElementId=transformationPath.getNextElementSrcId() ; 1907 transType = transformationPath.getNextTransformationType() ; 1908 transId = transformationPath.getNextTransformationId() ; 1909 lastDstScalar=dstScalar ; 1853 1910 dstScalar->setTransformationPaths(transformationPath) ; 1854 } 1855 if (isNewGrid) newGrid->addScalar(dstScalar->getId()) ; 1911 } while(transformationPath.hasTransform() && isGenerate) ; 1912 1913 if (isNewGrid) newGrid->addScalar(dstScalar->getId()) ; 1856 1914 algo = dstScalar->getTransformationAlgorithm() ; 1857 1915 } -
XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/domain_algorithm/domain_algorithm_generate_rectilinear.cpp
r1998 r2016 64 64 } 65 65 fillInAttributesDomainDestination(); 66 domainDestination->checkAttributes() ; 66 67 } 67 68 CATCH -
XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/domain_algorithm/domain_algorithm_generate_rectilinear.hpp
r2011 r2016 34 34 virtual ~CDomainAlgorithmGenerateRectilinear() {} 35 35 static bool registerTrans(); 36 virtual bool isGenerateTransformation(void) { return true ;} 36 37 37 38 protected: -
XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/generic_algorithm_transformation.hpp
r2011 r2016 40 40 virtual void apply(int dimBefore, int dimAfter, const CArray<double,1>& dataIn, CArray<double,1>& dataOut) { abort() ;} //=0 41 41 virtual void apply(int dimBefore, int dimAfter, const CArray<double,1>& dataIn, const vector<CArray<double,1>>& auxData, CArray<double,1>& dataOut) { abort() ;} //=0 42 42 virtual bool isGenerateTransformation(void) { return false ;} 43 43 44 virtual vector<string> getAuxFieldId(void) ; 44 45 protected : -
XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/grid_algorithm.cpp
r2007 r2016 10 10 } 11 11 12 12 bool CGridAlgorithm::isGenerateTranformation(void) 13 { 14 return algorithm_->isGenerateTransformation() ; 15 } 13 16 } -
XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/grid_algorithm.hpp
r2011 r2016 27 27 virtual void apply(const CArray<double,1>& dataIn, const vector<CArray<double,1>>& auxData, CArray<double,1>& dataOut) { abort(); } //=0 28 28 virtual CTransformFilter* createTransformFilter(CGarbageCollector& gc, bool detectMissingValues, double defaultValue) ; 29 virtual bool isGenerateTranformation(void) ; 29 30 30 31 protected:
Note: See TracChangeset
for help on using the changeset viewer.