Changeset 943
- Timestamp:
- 09/22/16 10:59:27 (8 years ago)
- Location:
- XIOS/trunk/src
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/trunk/src/interface/c/icfield.cpp
r591 r943 25 25 typedef xios::CFieldGroup * XFieldGroupPtr; 26 26 27 typedef xios::CDomain * XDomainPtr; 28 typedef xios::CAxis * XAxisPtr; 29 typedef xios::CScalar * XScalarPtr; 30 27 31 // -------------------------------------------------------------------------- 28 32 // ------------------------ Création des handle ----------------------------- … … 69 73 70 74 // ----------------------------------------------------------------------------------------------------- 71 // ------------------------- other function---------- --------------------------- ---------------------75 // ------------------------- Other functions 72 76 // ----------------------------------------------------------------------------------------------------- 73 77 … … 78 82 CTimer::get("XIOS").suspend() ; 79 83 } 80 84 85 // ----------------------------------------------------------------------------------------------------- 86 // ------------------------- Retrieving information of grid associated to field 87 // ----------------------------------------------------------------------------------------------------- 88 void cxios_field_get_domain_handle(XDomainPtr * domain_hdl_ret, XFieldPtr field_hdl, int domainIndex) 89 { 90 CTimer::get("XIOS").resume() ; 91 *domain_hdl_ret = field_hdl->grid->getDomain(domainIndex); 92 CTimer::get("XIOS").suspend(); 93 } 94 95 void cxios_field_get_axis_handle(XAxisPtr * axis_hdl_ret, XFieldPtr field_hdl, int axisIndex) 96 { 97 CTimer::get("XIOS").resume() ; 98 *axis_hdl_ret = field_hdl->grid->getAxis(axisIndex); 99 CTimer::get("XIOS").suspend(); 100 } 101 102 void cxios_field_get_scalar_handle(XScalarPtr * scalar_hdl_ret, XFieldPtr field_hdl, int scalarIndex) 103 { 104 CTimer::get("XIOS").resume() ; 105 *scalar_hdl_ret = field_hdl->grid->getScalar(scalarIndex); 106 CTimer::get("XIOS").suspend(); 107 } 81 108 } // extern "C" -
XIOS/trunk/src/interface/fortran/field_interface.f90
r501 r943 24 24 END SUBROUTINE cxios_field_is_active 25 25 26 SUBROUTINE cxios_field_get_domain_handle(ret, field_hdl, idx) BIND(C) 27 USE ISO_C_BINDING 28 INTEGER (kind = C_INTPTR_T) :: ret 29 INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl 30 INTEGER (kind = C_INT) , VALUE :: idx 31 END SUBROUTINE cxios_field_get_domain_handle 32 33 SUBROUTINE cxios_field_get_axis_handle(ret, field_hdl, idx) BIND(C) 34 USE ISO_C_BINDING 35 INTEGER (kind = C_INTPTR_T) :: ret 36 INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl 37 INTEGER (kind = C_INT) , VALUE :: idx 38 END SUBROUTINE cxios_field_get_axis_handle 39 40 SUBROUTINE cxios_field_get_scalar_handle(ret, field_hdl, idx) BIND(C) 41 USE ISO_C_BINDING 42 INTEGER (kind = C_INTPTR_T) :: ret 43 INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl 44 INTEGER (kind = C_INT) , VALUE :: idx 45 END SUBROUTINE cxios_field_get_scalar_handle 46 26 47 END INTERFACE 27 48 -
XIOS/trunk/src/interface/fortran/ifield.F90
r545 r943 8 8 ! USE IFIELDGROUP_ATTR 9 9 USE IDURATION 10 USE IDOMAIN 11 USE IAXIS 12 USE ISCALAR 10 13 11 14 TYPE txios(field) … … 16 19 INTEGER(kind = C_INTPTR_T) :: daddr 17 20 END TYPE txios(fieldgroup) 18 21 19 22 CONTAINS ! Fonctions disponibles pour les utilisateurs. 20 23 … … 35 38 END SUBROUTINE xios(get_fieldgroup_handle) 36 39 40 SUBROUTINE xios(field_id_get_domain_handle)(field_id, ret, idx) 41 IMPLICIT NONE 42 CHARACTER(len = *) , INTENT(IN) :: field_id 43 INTEGER, OPTIONAL , INTENT(IN) :: idx 44 TYPE(txios(domain)), INTENT(OUT) :: ret 45 TYPE(txios(field)) :: field_hdl 46 INTEGER :: index 47 index = 0 48 IF (PRESENT(idx)) THEN 49 index = idx 50 ENDIF 51 52 CALL xios(get_field_handle)(field_id,field_hdl) 53 CALL xios(field_get_domain_handle(field_hdl, ret, index)) 54 END SUBROUTINE xios(field_id_get_domain_handle) 55 56 SUBROUTINE xios(field_get_domain_handle)(field_hdl, ret, idx) 57 IMPLICIT NONE 58 TYPE(txios(field)) , INTENT(IN) :: field_hdl 59 INTEGER, OPTIONAL , INTENT(IN) :: idx 60 TYPE(txios(domain)), INTENT(OUT) :: ret 61 INTEGER :: index 62 index = 0 63 IF (PRESENT(idx)) THEN 64 index = idx 65 ENDIF 66 CALL cxios_field_get_domain_handle(ret%daddr, field_hdl%daddr, index) 67 END SUBROUTINE xios(field_get_domain_handle) 68 69 SUBROUTINE xios(field_id_get_axis_handle)(field_id, ret, idx) 70 IMPLICIT NONE 71 CHARACTER(len = *) , INTENT(IN) :: field_id 72 INTEGER, OPTIONAL , INTENT(IN) :: idx 73 TYPE(txios(axis)), INTENT(OUT) :: ret 74 TYPE(txios(field)) :: field_hdl 75 INTEGER :: index 76 index = 0 77 IF (PRESENT(idx)) THEN 78 index = idx 79 ENDIF 80 CALL xios(get_field_handle)(field_id,field_hdl) 81 CALL xios(field_get_axis_handle(field_hdl, ret, index)) 82 END SUBROUTINE xios(field_id_get_axis_handle) 83 84 SUBROUTINE xios(field_get_axis_handle)(field_hdl, ret, idx) 85 IMPLICIT NONE 86 TYPE(txios(field)) , INTENT(IN) :: field_hdl 87 INTEGER, OPTIONAL , INTENT(IN) :: idx 88 TYPE(txios(axis)), INTENT(OUT) :: ret 89 INTEGER :: index 90 index = 0 91 IF (PRESENT(idx)) THEN 92 index = idx 93 ENDIF 94 CALL cxios_field_get_axis_handle(ret%daddr, field_hdl%daddr, index) 95 END SUBROUTINE xios(field_get_axis_handle) 96 97 SUBROUTINE xios(field_id_get_scalar_handle)(field_id, ret, idx) 98 IMPLICIT NONE 99 CHARACTER(len = *) , INTENT(IN) :: field_id 100 INTEGER, OPTIONAL , INTENT(IN) :: idx 101 TYPE(txios(scalar)), INTENT(OUT) :: ret 102 TYPE(txios(field)) :: field_hdl 103 INTEGER :: index 104 index = 0 105 IF (PRESENT(idx)) THEN 106 index = idx 107 ENDIF 108 CALL xios(get_field_handle)(field_id,field_hdl) 109 CALL xios(field_get_scalar_handle(field_hdl, ret, index)) 110 END SUBROUTINE xios(field_id_get_scalar_handle) 111 112 SUBROUTINE xios(field_get_scalar_handle)(field_hdl, ret, idx) 113 IMPLICIT NONE 114 TYPE(txios(field)) , INTENT(IN) :: field_hdl 115 INTEGER, OPTIONAL , INTENT(IN) :: idx 116 TYPE(txios(scalar)), INTENT(OUT) :: ret 117 INTEGER :: index 118 index = 0 119 IF (PRESENT(idx)) THEN 120 index = idx 121 ENDIF 122 CALL cxios_field_get_axis_handle(ret%daddr, field_hdl%daddr, index) 123 END SUBROUTINE xios(field_get_scalar_handle) 37 124 38 125 LOGICAL FUNCTION xios(is_valid_field)(idt) -
XIOS/trunk/src/interface/fortran/ixios.F90
r934 r943 113 113 114 114 USE XIOS_INTERFACES, ONLY : xios(set_attr), xios(get_attr), xios(is_defined_attr), xios(get_handle), xios(add_child), & 115 xios(send_field), xios(recv_field), xios(field_is_active), xios(getVar), xios(setVar) 115 xios(send_field), xios(recv_field), xios(field_is_active), xios(getVar), xios(setVar), & 116 xios(field_get_domain),xios(field_get_axis),xios(field_get_scalar) 116 117 117 118 END MODULE XIOS -
XIOS/trunk/src/interface/fortran/ixios_interfaces.F90
r934 r943 24 24 USE idomaingroup_attr, ONLY : xios(set_domaingroup_attr_hdl), xios(get_domaingroup_attr_hdl), xios(is_defined_domaingroup_attr_hdl) 25 25 26 USE ifield, ONLY : xios(get_field_handle), xios(get_fieldgroup_handle), xios(field_is_active_id), xios(field_is_active_hdl) 26 USE ifield, ONLY : xios(get_field_handle), xios(get_fieldgroup_handle), xios(field_is_active_id), xios(field_is_active_hdl), & 27 xios(field_get_domain_handle), xios(field_get_axis_handle), xios(field_get_scalar_handle), & 28 xios(field_id_get_domain_handle), xios(field_id_get_axis_handle), xios(field_id_get_scalar_handle) 27 29 28 30 USE ifield_attr, ONLY : xios(set_field_attr_hdl), xios(get_field_attr_hdl), xios(is_defined_field_attr_hdl) … … 195 197 END INTERFACE xios(field_is_active) 196 198 199 INTERFACE xios(field_get_domain) 200 MODULE PROCEDURE xios(field_get_domain_handle), xios(field_id_get_domain_handle) 201 END INTERFACE xios(field_get_domain) 202 203 INTERFACE xios(field_get_axis) 204 MODULE PROCEDURE xios(field_get_axis_handle),xios(field_id_get_axis_handle) 205 END INTERFACE xios(field_get_axis) 206 207 INTERFACE xios(field_get_scalar) 208 MODULE PROCEDURE xios(field_get_scalar_handle),xios(field_id_get_scalar_handle) 209 END INTERFACE xios(field_get_scalar) 210 197 211 INTERFACE xios(getVar) 198 212 MODULE PROCEDURE xios(getVar_k8), xios(getVar_k4), xios(getVar_int), xios(getVar_logic), xios(getVar_char) … … 204 218 205 219 PUBLIC :: xios(set_attr), xios(get_attr), xios(is_defined_attr), xios(get_handle), xios(add_child), & 206 xios(send_field), xios(recv_field), xios(field_is_active), xios(getVar), xios(setVar) 220 xios(send_field), xios(recv_field), xios(field_is_active), xios(getVar), xios(setVar), & 221 xios(field_get_domain),xios(field_get_axis),xios(field_get_scalar) 207 222 208 223 END MODULE XIOS_INTERFACES -
XIOS/trunk/src/node/grid.cpp
r940 r943 1845 1845 1846 1846 /*! 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 /*! 1847 1916 \brief Set domain(s) of a grid from a list 1848 1917 \param[in] domains list of domains -
XIOS/trunk/src/node/grid.hpp
r890 r943 181 181 std::vector<CAxis*> getAxis(); 182 182 std::vector<CScalar*> getScalars(); 183 CDomain* getDomain(int domainIndex); 184 CAxis* getAxis(int axisIndex); 185 CScalar* getScalar(int scalarIndex); 183 186 std::vector<int> getAxisOrder(); 184 187 std::vector<int> getGlobalDimension(); -
XIOS/trunk/src/transformation/domain_algorithm_expand.cpp
r941 r943 55 55 } 56 56 57 if (!domainDestination->hasRefTo(domainSource))58 {59 ERROR("CDomainAlgorithmExpand::CDomainAlgorithmExpand(CDomain* domainDestination,CDomain* domainSource, CExpandDomain* expandDomain)",60 << "Domain domain destination must refer to domain source (directly or indirectly) by domain_ref " << std::endl61 << "Domain source " <<domainSource->getId() << std::endl62 << "Domain destination " <<domainDestination->getId() << std::endl);63 }57 // if (!domainDestination->hasRefTo(domainSource)) 58 // { 59 // ERROR("CDomainAlgorithmExpand::CDomainAlgorithmExpand(CDomain* domainDestination,CDomain* domainSource, CExpandDomain* expandDomain)", 60 // << "Domain domain destination must refer to domain source (directly or indirectly) by domain_ref " << std::endl 61 // << "Domain source " <<domainSource->getId() << std::endl 62 // << "Domain destination " <<domainDestination->getId() << std::endl); 63 // } 64 64 65 65 this->type_ = (ELEMENT_MODIFICATION_WITH_DATA); … … 140 140 StdString domainDstRef = (!domainDestination->domain_ref.isEmpty()) ? domainDestination->domain_ref.getValue() 141 141 : ""; 142 domainDestination->domain_ref.setValue(domainSource->getId()); 143 domainDestination->solveRefInheritance(true); 142 if (domainDstRef != domainSource->getId()) 143 { 144 domainDestination->domain_ref.setValue(domainSource->getId()); 145 domainDestination->solveRefInheritance(true); 146 } 147 144 148 if (domainDstRef.empty()) domainDestination->domain_ref.reset(); 145 149 else domainDestination->domain_ref.setValue(domainDstRef);
Note: See TracChangeset
for help on using the changeset viewer.