Changeset 537 for XIOS/trunk/src/generate_interface_impl.hpp
- Timestamp:
- 12/11/14 14:32:37 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/trunk/src/generate_interface_impl.hpp
r532 r537 17 17 template<> string CInterface::getStrFortranType<float>(void) {return string("REAL") ;} 18 18 template<> string CInterface::getStrFortranType<CDate>(void) {return string("TYPE(txios(date))") ;} 19 template<> string CInterface::getStrFortranType<CDuration>(void) {return string("TYPE(txios(duration))") ;} 19 20 20 21 template<> string CInterface::getStrFortranKind<int>(void) {return string("") ;} … … 23 24 template<> string CInterface::getStrFortranKind<float>(void) {return string("(KIND=4)") ;} 24 25 template<> string CInterface::getStrFortranKind<CDate>(void) {return string("") ;} 26 template<> string CInterface::getStrFortranKind<CDuration>(void) {return string("") ;} 25 27 26 28 template<> string CInterface::getStrFortranKindC<int>(void) {return string("(KIND=C_INT)") ;} … … 29 31 template<> string CInterface::getStrFortranKindC<float>(void) {return string("(KIND=C_FLOAT)") ;} 30 32 template<> string CInterface::getStrFortranKindC<CDate>(void) {return string("") ;} 33 template<> string CInterface::getStrFortranKindC<CDuration>(void) {return string("") ;} 31 34 32 35 template<> bool CInterface::matchingTypeCFortran<int>(void) { return true ; } … … 35 38 template<> bool CInterface::matchingTypeCFortran<float>(void) { return true; } 36 39 template<> bool CInterface::matchingTypeCFortran<CDate>(void) { return true; } 40 template<> bool CInterface::matchingTypeCFortran<CDuration>(void) { return true; } 37 41 38 42 … … 167 171 } 168 172 173 template<> 174 void CInterface::AttributeCInterface<CDuration>(ostream& oss, const string& className,const string& name) 175 { 176 oss << "void cxios_set_" << className << "_" << name << "(" << className << "_Ptr " << className << "_hdl, cxios_duration " << name << "_c)" << iendl; 177 oss << "{" << iendl; 178 oss << " CTimer::get(\"XIOS\").resume();" << iendl; 179 oss << " " << className << "_hdl->" << name << ".allocate();" << iendl; 180 oss << " CDuration& " << name <<" = " << className << "_hdl->" << name << ".get();" << iendl; 181 oss << " " << name << ".year = " << name << "_c.year;" << iendl; 182 oss << " " << name << ".month = " << name << "_c.month;" << iendl; 183 oss << " " << name << ".day = " << name << "_c.day;" << iendl; 184 oss << " " << name << ".hour = " << name << "_c.hour;" << iendl; 185 oss << " " << name << ".minute = " << name << "_c.minute;" << iendl; 186 oss << " " << name << ".second = " << name << "_c.second;" << iendl; 187 oss << " " << name << ".timestep = " << name << "_c.timestep;" << iendl; 188 oss << " CTimer::get(\"XIOS\").suspend();" << iendl; 189 oss << "}" << iendl; 190 191 oss << iendl; 192 193 oss << "void cxios_get_" << className << "_" << name << "(" << className << "_Ptr " << className << "_hdl, cxios_duration* " << name << "_c)" << iendl; 194 oss << "{" << iendl; 195 oss << " CTimer::get(\"XIOS\").resume();" << iendl; 196 oss << " CDuration " << name <<" = " << className << "_hdl->" << name << ".getInheritedValue();" << iendl; 197 oss << " " << name << "_c->year = " << name << ".year;" << iendl; 198 oss << " " << name << "_c->month = " << name << ".month;" << iendl; 199 oss << " " << name << "_c->day = " << name << ".day;" << iendl; 200 oss << " " << name << "_c->hour = " << name << ".hour;" << iendl; 201 oss << " " << name << "_c->minute = " << name << ".minute;" << iendl; 202 oss << " " << name << "_c->second = " << name << ".second;" << iendl; 203 oss << " " << name << "_c->timestep = " << name << ".timestep;" << iendl; 204 oss << " CTimer::get(\"XIOS\").suspend();" << iendl; 205 oss << "}" << iendl; 206 oss << iendl; 207 } 208 169 209 /* 170 210 #define macro(T) \ … … 305 345 oss << " USE IDATE" << iendl; 306 346 oss << " INTEGER (kind = C_INTPTR_T), VALUE :: " << className << "_hdl" << iendl; 307 oss << " TYPE( xios_date), VALUE :: " << name << iendl;347 oss << " TYPE(txios(date)), VALUE :: " << name << iendl; 308 348 oss << "END SUBROUTINE cxios_set_" << className << "_" << name << iendl; 309 349 oss << iendl; … … 313 353 oss << " INTEGER (kind = C_INTPTR_T), VALUE :: " << className << "_hdl" << iendl; 314 354 oss << " TYPE(txios(date)) :: " << name << iendl; 355 oss << "END SUBROUTINE cxios_get_" << className << "_" << name << iendl; 356 oss << iendl; 357 } 358 359 template <> 360 void CInterface::AttributeFortran2003Interface<CDuration>(ostream& oss, const string& className, const string& name) 361 { 362 oss << "SUBROUTINE cxios_set_" << className << "_" << name << "(" << className << "_hdl, " << name << ") BIND(C)" << iendl; 363 oss << " USE ISO_C_BINDING" << iendl; 364 oss << " USE IDATE" << iendl; 365 oss << " INTEGER (kind = C_INTPTR_T), VALUE :: " << className << "_hdl" << iendl; 366 oss << " TYPE(txios(duration)), VALUE :: " << name << iendl; 367 oss << "END SUBROUTINE cxios_set_" << className << "_" << name << iendl; 368 oss << iendl; 369 oss << "SUBROUTINE cxios_get_" << className << "_" << name << "(" << className << "_hdl, " << name << ") BIND(C)" << iendl; 370 oss << " USE ISO_C_BINDING" << iendl; 371 oss << " USE IDATE" << iendl; 372 oss << " INTEGER (kind = C_INTPTR_T), VALUE :: " << className << "_hdl" << iendl; 373 oss << " TYPE(txios(duration)) :: " << name << iendl; 315 374 oss << "END SUBROUTINE cxios_get_" << className << "_" << name << iendl; 316 375 oss << iendl;
Note: See TracChangeset
for help on using the changeset viewer.