Changeset 532 for XIOS/trunk/src/generate_interface_impl.hpp
- Timestamp:
- 12/10/14 14:27:09 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/trunk/src/generate_interface_impl.hpp
r509 r532 8 8 #include "enum.hpp" 9 9 #include "array_new.hpp" 10 #include "date.hpp" 10 11 11 12 namespace xios … … 15 16 template<> string CInterface::getStrFortranType<double>(void) {return string("REAL") ;} 16 17 template<> string CInterface::getStrFortranType<float>(void) {return string("REAL") ;} 18 template<> string CInterface::getStrFortranType<CDate>(void) {return string("TYPE(txios(date))") ;} 17 19 18 20 template<> string CInterface::getStrFortranKind<int>(void) {return string("") ;} … … 20 22 template<> string CInterface::getStrFortranKind<double>(void) {return string("(KIND=8)") ;} 21 23 template<> string CInterface::getStrFortranKind<float>(void) {return string("(KIND=4)") ;} 24 template<> string CInterface::getStrFortranKind<CDate>(void) {return string("") ;} 22 25 23 26 template<> string CInterface::getStrFortranKindC<int>(void) {return string("(KIND=C_INT)") ;} … … 25 28 template<> string CInterface::getStrFortranKindC<double>(void) {return string("(KIND=C_DOUBLE)") ;} 26 29 template<> string CInterface::getStrFortranKindC<float>(void) {return string("(KIND=C_FLOAT)") ;} 30 template<> string CInterface::getStrFortranKindC<CDate>(void) {return string("") ;} 27 31 28 32 template<> bool CInterface::matchingTypeCFortran<int>(void) { return true ; } … … 30 34 template<> bool CInterface::matchingTypeCFortran<double>(void) { return true; } 31 35 template<> bool CInterface::matchingTypeCFortran<float>(void) { return true; } 36 template<> bool CInterface::matchingTypeCFortran<CDate>(void) { return true; } 32 37 33 38 … … 125 130 // if (!array_copy(domain_hdl->mask.getValue(), mask, extent1, extent2)) 126 131 // ERROR("cxios_get_domain_mask(XDomainPtr domain_hdl, bool * mask, int extent1, int extent2)",<<"Output array size is not conform to array size attribut") ; 132 133 template<> 134 void CInterface::AttributeCInterface<CDate>(ostream& oss, const string& className,const string& name) 135 { 136 oss << "void cxios_set_" << className << "_" << name << "(" << className << "_Ptr " << className << "_hdl, cxios_date " << name << "_c)" << iendl; 137 oss << "{" << iendl; 138 oss << " CTimer::get(\"XIOS\").resume();" << iendl; 139 oss << " " << className << "_hdl->" << name << ".allocate();" << iendl; 140 oss << " CDate& " << name <<" = " << className << "_hdl->" << name << ".get();" << iendl; 141 oss << " " << name << ".setDate(" << name << "_c.year," << iendl; 142 oss << " " << name << "_c.month," << iendl; 143 oss << " " << name << "_c.day," << iendl; 144 oss << " " << name << "_c.hour," << iendl; 145 oss << " " << name << "_c.minute," << iendl; 146 oss << " " << name << "_c.second);" << iendl; 147 oss << " if (" << name << ".hasRelCalendar())" << iendl; 148 oss << " " << name << ".checkDate();" << iendl; 149 oss << " CTimer::get(\"XIOS\").suspend();" << iendl; 150 oss << "}" << iendl; 151 152 oss << iendl; 153 154 oss << "void cxios_get_" << className << "_" << name << "(" << className << "_Ptr " << className << "_hdl, cxios_date* " << name << "_c)" << iendl; 155 oss << "{" << iendl; 156 oss << " CTimer::get(\"XIOS\").resume();" << iendl; 157 oss << " CDate " << name <<" = " << className << "_hdl->" << name << ".getInheritedValue();" << iendl; 158 oss << " " << name << "_c->year = " << name << ".getYear();" << iendl; 159 oss << " " << name << "_c->month = " << name << ".getMonth();" << iendl; 160 oss << " " << name << "_c->day = " << name << ".getDay();" << iendl; 161 oss << " " << name << "_c->hour = " << name << ".getHour();" << iendl; 162 oss << " " << name << "_c->minute = " << name << ".getMinute();" << iendl; 163 oss << " " << name << "_c->second = " << name << ".getSecond();" << iendl; 164 oss << " CTimer::get(\"XIOS\").suspend();" << iendl; 165 oss << "}" << iendl; 166 oss << iendl; 167 } 127 168 128 169 /* … … 256 297 oss<<iendl ; 257 298 } 299 300 template <> 301 void CInterface::AttributeFortran2003Interface<CDate>(ostream& oss, const string& className, const string& name) 302 { 303 oss << "SUBROUTINE cxios_set_" << className << "_" << name << "(" << className << "_hdl, " << name << ") BIND(C)" << iendl; 304 oss << " USE ISO_C_BINDING" << iendl; 305 oss << " USE IDATE" << iendl; 306 oss << " INTEGER (kind = C_INTPTR_T), VALUE :: " << className << "_hdl" << iendl; 307 oss << " TYPE(xios_date), VALUE :: " << name << iendl; 308 oss << "END SUBROUTINE cxios_set_" << className << "_" << name << iendl; 309 oss << iendl; 310 oss << "SUBROUTINE cxios_get_" << className << "_" << name << "(" << className << "_hdl, " << name << ") BIND(C)" << iendl; 311 oss << " USE ISO_C_BINDING" << iendl; 312 oss << " USE IDATE" << iendl; 313 oss << " INTEGER (kind = C_INTPTR_T), VALUE :: " << className << "_hdl" << iendl; 314 oss << " TYPE(txios(date)) :: " << name << iendl; 315 oss << "END SUBROUTINE cxios_get_" << className << "_" << name << iendl; 316 oss << iendl; 317 } 258 318 259 319 /*
Note: See TracChangeset
for help on using the changeset viewer.