Changeset 138 for XMLIO_V2/dev/dev_rv
- Timestamp:
- 12/10/10 16:04:54 (13 years ago)
- Location:
- XMLIO_V2/dev/dev_rv/src/XMLIO
- Files:
-
- 26 edited
Legend:
- Unmodified
- Added
- Removed
-
XMLIO_V2/dev/dev_rv/src/XMLIO/NetCDF4_data_output.hpp
r137 r138 7 7 namespace XMLIOSERVER 8 8 { 9 10 9 static const char* TimeName = "time"; 11 10 … … 81 80 } 82 81 83 void writeCoords(const string& id, const Array<double, 1>& cdata )82 void writeCoords(const string& id, const Array<double, 1>& cdata, const CDomain * dom = NULL) 84 83 { 85 84 NcVar *cVar = dataFile->get_var(id.c_str()); 86 85 87 if (!cVar->put(cdata.dataFirst(), cdata.size())) 88 throw XMLIOUndefinedValueException 89 ("Impossible d'écrire les valeurs de coordonnées "+ id +" !"); 86 if (dom == NULL) 87 { 88 if (!cVar->put(cdata.dataFirst(), cdata.size())) 89 XMLIOError 90 ("Impossible d'écrire les valeurs de coordonnées "+ id +" !"); 91 } 92 else 93 { 94 if( dom->lonvalue.getValueConst()->size() == (dom->ni * dom->nj)) 95 { // curvilineaire 96 if (!cVar->put(cdata.dataFirst(), dom->nj, dom->ni)) 97 XMLIOError 98 ("Impossible d'écrire les valeurs de coordonnées "+ id +" !"); 99 } 100 else 101 { // rectilineaire 102 if (!cVar->put(cdata.dataFirst(), cdata.size())) 103 XMLIOError 104 ("Impossible d'écrire les valeurs de coordonnées "+ id +" !"); 105 } 106 } 90 107 } 91 108 … … 108 125 109 126 if (!(oVar = dataFile->add_var(cid.c_str(), ncDouble, dataFile->get_dim(TimeName)))) 110 throw XMLIOUndefinedValueException127 XMLIOError 111 128 ("Impossible d'ajouter la coordonnée temporelle "+cid+" !"); 112 129 … … 131 148 dataFile = new NcFile(filename.c_str(), NcFile::Replace); 132 149 if(!dataFile->is_valid()) 133 throw XMLIOUndefinedValueException150 XMLIOError 134 151 ("Impossible d'ouvrir le fichier '"+ filename +"' pour l'écriture des données' !"); 135 152 … … 152 169 for (it = allDim.begin() ; it != allDim.end(); it++) 153 170 if (NULL == dataFile->add_dim((*it).first.c_str(), (*it).second)) 154 throw XMLIOUndefinedValueException("Impossible d'ajouter la dimension "+ (*it).first +" !");171 XMLIOError("Impossible d'ajouter la dimension "+ (*it).first +" !"); 155 172 156 173 // Ajout de la dimension temporelle non limitée. 157 174 if (withTime) 158 175 if (NULL == dataFile->add_dim(TimeName)) 159 throw XMLIOUndefinedValueException("Impossible d'ajouter la dimension temporelle !");176 XMLIOError("Impossible d'ajouter la dimension temporelle !"); 160 177 } 161 178 … … 175 192 for ( itt = sdom.begin() ; itt != sdom.end(); itt++ ) 176 193 { 177 string domid = ((*itt)->name.hasValue()) ? (string)(*itt)->name : (*itt)->getId(); 178 string lonid = (sdom.size() == 1)? string("lon"): string("lon_").append(domid); 179 string latid = (sdom.size() == 1)? string("lat"): string("lat_").append(domid); 180 181 if (!(latVar = dataFile->add_var(latid.c_str(), ncFloat, dataFile->get_dim(latid.c_str())))) 182 throw XMLIOUndefinedValueException("Impossible d'ajouter la variable de latitude !"); 183 184 if (!(lonVar = dataFile->add_var(lonid.c_str(), ncFloat, dataFile->get_dim(lonid.c_str())))) 185 throw XMLIOUndefinedValueException("Impossible d'ajouter la variable de longitude !"); 194 string domid = (*itt)->name.hasValue() 195 ? (string)(*itt)->name : (*itt)->getId(); 196 string lonid = (sdom.size() == 1) 197 ? string("lon"): string("lon_").append(domid); 198 string latid = (sdom.size() == 1) 199 ? string("lat"): string("lat_").append(domid); 200 201 202 if( (*itt)->lonvalue.getValueConst()->size() == ((*itt)->ni * (*itt)->nj)) 203 { // cas curvilinéaire 204 205 string clonid = (sdom.size() == 1) 206 ? string("nav_lon"): string("nav_lon_").append(domid); 207 string clatid = (sdom.size() == 1) 208 ? string("nav_lat"): string("nav_lat_").append(domid); 209 if (!(latVar = dataFile->add_var(clatid.c_str(), ncFloat, 210 dataFile->get_dim(latid.c_str()), dataFile->get_dim(lonid.c_str())))) 211 XMLIOError("Impossible d'ajouter la variable de latitude !"); 212 213 if (!(lonVar = dataFile->add_var(clonid.c_str(), ncFloat, 214 dataFile->get_dim(latid.c_str()), dataFile->get_dim(lonid.c_str())))) 215 XMLIOError("Impossible d'ajouter la variable de longitude !"); 216 217 lonid = clonid; // beurk 218 latid = clatid; 219 } 220 else 221 { // cas rectilineaire 222 if (!(latVar = dataFile->add_var(latid.c_str(), ncFloat, dataFile->get_dim(latid.c_str())))) 223 XMLIOError("Impossible d'ajouter la variable de latitude !"); 224 225 if (!(lonVar = dataFile->add_var(lonid.c_str(), ncFloat, dataFile->get_dim(lonid.c_str())))) 226 XMLIOError("Impossible d'ajouter la variable de longitude !"); 227 } 186 228 187 229 // Attribut de latitude. … … 218 260 219 261 if ((*itt)->lonvalue.hasValue()) 220 this->writeCoords(lonid, (*itt)->lonvalue );221 else throw XMLIOUndefinedValueException262 this->writeCoords(lonid, (*itt)->lonvalue, *itt); 263 else XMLIOError 222 264 ("Les coordonnées de longitude (xvalue) ne sont pas définies pour le domaine \""+domid+"\"."); 223 265 224 266 if ((*itt)->latvalue.hasValue()) 225 this->writeCoords(latid, (*itt)->latvalue );226 else throw XMLIOUndefinedValueException267 this->writeCoords(latid, (*itt)->latvalue, *itt); 268 else XMLIOError 227 269 ("Les coordonnées de latitude (yvalue) ne sont pas définies pour le domaine \""+domid+"\"."); 228 270 } … … 234 276 string axisid = ((*it)->name.hasValue()) ? (string)(*it)->name : (*it)->getId(); 235 277 if (!(othvar = dataFile->add_var(axisid.c_str(), ncFloat, dataFile->get_dim(axisid.c_str())))) 236 throw XMLIOUndefinedValueException("Impossible d'ajouter la variable "+ (*it)->getId() +" !");278 XMLIOError("Impossible d'ajouter la variable "+ (*it)->getId() +" !"); 237 279 238 280 hm["axis"] = "Z" ; … … 255 297 if ((*it)->zvalue.hasValue()) 256 298 this->writeCoords(axisid, (*it)->zvalue); 257 else throw XMLIOUndefinedValueException299 else XMLIOError 258 300 ("Les coordonnées de l'axe \""+axisid+"\" (value) ne sont pas définies."); 259 301 } … … 317 359 dataFile->get_dim(latid.c_str()), 318 360 dataFile->get_dim(lonid.c_str())))) 319 throw XMLIOUndefinedValueException("Impossible d'ajouter le champ "+ field->getId() +" !");361 XMLIOError("Impossible d'ajouter le champ "+ field->getId() +" !"); 320 362 } 321 363 else // 3D spatio + temps … … 326 368 dataFile->get_dim(latid.c_str()), 327 369 dataFile->get_dim(lonid.c_str())))) 328 throw XMLIOUndefinedValueException("Impossible d'ajouter le champ "+ field->getId() +" !");370 XMLIOError("Impossible d'ajouter le champ "+ field->getId() +" !"); 329 371 } 330 372 } … … 336 378 dataFile->get_dim(latid.c_str()), 337 379 dataFile->get_dim(lonid.c_str())))) 338 throw XMLIOUndefinedValueException("Impossible d'ajouter le champ "+ field->getId() +" !");380 XMLIOError("Impossible d'ajouter le champ "+ field->getId() +" !"); 339 381 } 340 382 else // 3D spatio sans temps … … 344 386 dataFile->get_dim(latid.c_str()), 345 387 dataFile->get_dim(lonid.c_str())))) 346 throw XMLIOUndefinedValueException("Impossible d'ajouter le champ "+ field->getId() +" !");388 XMLIOError("Impossible d'ajouter le champ "+ field->getId() +" !"); 347 389 } 348 390 } … … 377 419 for ( it = attr.begin() ; it != attr.end(); it++ ) 378 420 if (!var->add_att((*it).first.c_str(), (*it).second)) 379 throw XMLIOUndefinedValueException421 XMLIOError 380 422 ("Impossible d'ajouter l'attribut' "+ (*it).first +" à la variable "+ var->name() +" !"); 381 423 } … … 387 429 for ( it = attr.begin() ; it != attr.end(); it++ ) 388 430 if (!var->add_att((*it).first.c_str(), (*it).second.c_str())) 389 throw XMLIOUndefinedValueException431 XMLIOError 390 432 ("Impossible d'ajouter l'attribut' "+ (*it).first +" à la variable "+ var->name() +" !"); 391 433 } -
XMLIO_V2/dev/dev_rv/src/XMLIO/abstract_calendar.hpp
r131 r138 1 1 #ifndef __XMLIO_ABSTRACT_CALENDAR__ 2 2 #define __XMLIO_ABSTRACT_CALENDAR__ 3 4 #include "abstract_object.hpp" 3 5 4 6 namespace XMLIOSERVER -
XMLIO_V2/dev/dev_rv/src/XMLIO/abstract_object.hpp
r126 r138 8 8 public : 9 9 10 const std::string& getId(void) const throw (XMLIOUndefinedValueException)10 const std::string& getId(void) const 11 11 { 12 12 if (!hasId()) // Si l'identifiant de l'objet n'est pas défini. 13 throw XMLIOSERVER::XMLIOUndefinedValueException("Appel de la méthode AbstractObject::getId invalide.");13 XMLIOError("Appel de la méthode AbstractObject::getId invalide."); 14 14 return (id); 15 15 } -
XMLIO_V2/dev/dev_rv/src/XMLIO/attribut.hpp
r137 r138 5 5 6 6 using XMLIOSERVER::BaseAttribut; 7 using XMLIOSERVER::XMLIOUndefinedValueException;8 7 using std::ostringstream; 9 8 using namespace blitz ; … … 38 37 { 39 38 if (!_hasValue) 40 throw XMLIOUndefinedValueException("L'attribut \"" + this->getName() + "\" est invalide !");39 XMLIOError("L'attribut \"" + this->getName() + "\" est invalide !"); 41 40 return (value) ; 42 41 } 43 42 44 43 Ctype* getValue(void) 44 { 45 //if (!_hasValue) return(NULL); // REVOIR: 4 h de debug à cause de ça !!! 46 return (&value); 47 } 48 49 const Ctype * getValueConst(void) const 45 50 { 46 51 //if (!_hasValue) return(NULL); // REVOIR: 4 h de debug à cause de ça !!! … … 81 86 virtual void getValue(Ctype & value_) const 82 87 { 83 if (!_hasValue) throw XMLIOUndefinedValueException("L'attribut \"" + this->getName() + "\" est invalide !");88 if (!_hasValue) XMLIOError("L'attribut \"" + this->getName() + "\" est invalide !"); 84 89 value_ = value ; 85 90 } … … 160 165 iss >> c >> d; 161 166 if (c != ',') 162 throw XMLIOUndefinedValueException("Le tableau de valeur est mal défini !");167 XMLIOError("Le tableau de valeur est mal défini !"); 163 168 vect.push_back(d); 164 169 } … … 171 176 iss >> size >> c >> d; 172 177 if ((c != ')') || (size <= 0)) 173 throw XMLIOUndefinedValueException("Le tableau de valeur est mal défini !");178 XMLIOError("Le tableau de valeur est mal défini !"); 174 179 valsup = d; 175 180 } … … 179 184 break; 180 185 default : 181 throw XMLIOUndefinedValueException("Le tableau de valeur est mal défini !");186 XMLIOError("Le tableau de valeur est mal défini !"); 182 187 } 183 188 } -
XMLIO_V2/dev/dev_rv/src/XMLIO/attribut_registrar.hpp
r126 r138 30 30 const StrHashMap<BaseAttribut>& getAttrList(void) const { return (attrList); } 31 31 32 BaseAttribut* getAttribut(const string& _id) throw (XMLIOUndefinedValueException){ return (attrList[_id]); }32 BaseAttribut* getAttribut(const string& _id) { return (attrList[_id]); } 33 33 34 34 friend ostream& operator<< (ostream& out, const AttributRegistrar& c) … … 65 65 { 66 66 if (hasAttribut(att_name)) getAttribut(att_name)->setFromString(value); 67 else throw XMLIOUndefinedValueException("Impossible de trouver l'attribut nommé \""67 else XMLIOError("Impossible de trouver l'attribut nommé \"" 68 68 + att_name +"\" dans la liste des attributs enregistrés !"); 69 69 } -
XMLIO_V2/dev/dev_rv/src/XMLIO/base_attribut.hpp
r126 r138 4 4 using std::ostream; 5 5 using namespace blitz ; 6 7 using XMLIOSERVER::XMLIOIncompatibleTypeException;8 6 9 7 namespace XMLIOSERVER … … 62 60 63 61 static void error_set(void) 64 { throw XMLIOIncompatibleTypeException62 { XMLIOError 65 63 ("BaseAttribut::set<type> > Setting value type is incompatible with attribut type"); } 66 64 67 65 static void error_get(void) 68 { throw XMLIOIncompatibleTypeException66 { XMLIOError 69 67 ("BaseAttribut::set<type> >Getting value type is incompatible with attribut type"); } 70 68 -
XMLIO_V2/dev/dev_rv/src/XMLIO/c_interface.cpp
r137 r138 44 44 void xios_xml_parse_file(const XString _filename, XSize _filename_len) 45 45 { 46 MAKE_STRING(__filename, _filename, _filename_len); 47 std::ifstream __istr( __filename.c_str() , std::ifstream::in);48 49 // On commence la lecture du flux de donnée xml. 50 XMLNode node = XMLNode::CreateNode(__istr, Context::GetRootName());51 // On parse le fichier xml noeud par noeud52 // (ie on construit dynamiquement notre arbre d'objets).53 XMLParser::Parse(node);54 46 47 MAKE_STRING(__filename, _filename, _filename_len); 48 std::ifstream __istr( __filename.c_str() , std::ifstream::in ); 49 50 // On commence la lecture du flux de donnée xml. 51 XMLNode node = XMLNode::CreateNode(__istr, Context::GetRootName()); 52 // On parse le fichier xml noeud par noeud 53 // (ie on construit dynamiquement notre arbre d'objets). 54 XMLParser::Parse(node); 55 55 } 56 56 … … 76 76 77 77 void xios_context_create (XPtr * _ctx, const XString _ctx_id, 78 XSize _ctx_id_len, XCalendarType _calType) 78 XSize _ctx_id_len, XCalendarType _calType, 79 XInt yr, XInt mth, XInt dd, 80 XInt hr, XInt min, XInt sec) 79 81 { 80 82 MAKE_STRING(__ctx_id, _ctx_id, _ctx_id_len); … … 92 94 { 93 95 case (D360) : 94 context->setCalendar(new D360Calendar()); return; 96 context->setCalendar(new D360Calendar(yr, mth, dd, hr, min, sec)); 97 return; 95 98 case (ALLLEAP) : 96 context->setCalendar(new AllLeapCalendar()); return; 99 context->setCalendar(new AllLeapCalendar(yr, mth, dd, hr, min, sec)); 100 return; 97 101 case (NOLEAP) : 98 context->setCalendar(new NoLeapCalendar()); return; 102 context->setCalendar(new NoLeapCalendar(yr, mth, dd, hr, min, sec)); 103 return; 99 104 case (JULIAN) : 100 context->setCalendar(new JulianCalendar()); return; 105 context->setCalendar(new JulianCalendar(yr, mth, dd, hr, min, sec)); 106 return; 101 107 case (GREGORIAN) : 102 context->setCalendar(new GregorianCalendar()); return; 108 context->setCalendar(new GregorianCalendar(yr, mth, dd, hr, min, sec)); 109 return; 103 110 default: 104 111 std::cerr << "[context_create] Type de calendrier invalide [0-5]" << std::endl; … … 149 156 CFile * _file = (CFile *) _parent; 150 157 FieldGroup * _field_group = _file->createVirtualFieldGroup(_file->getId()); 151 xios_xml_tree_add (_field_group, GFIELD, _child, _child_type, _child_id, _child_id_len); 158 xios_xml_tree_add (_field_group, GFIELD, 159 _child, _child_type, _child_id, _child_id_len); 152 160 return; 153 161 } … … 279 287 XML_SET_STRING(Axis, axis, unit, unit) 280 288 281 void xios_xml_set_axis_value(XPtr const _axis, XDType _dtype, double value[], XSize value_size) 289 void xios_xml_set_axis_value(XPtr const _axis, XDType _dtype, 290 double value[], XSize value_size) 282 291 { 283 292 Array<double, 1> __arr(value, shape(value_size), neverDeleteData, FortranArray<1>()); … … 312 321 XML_SET(Domain, domain, int, nj, nj) 313 322 314 void xios_xml_set_domain_mask(XPtr const _domain, XDType _dtype, bool * _mask , XSize _maskXsize, XSize _maskYsize) 323 void xios_xml_set_domain_mask(XPtr const _domain, XDType _dtype, bool * _mask , 324 XSize _maskXsize, XSize _maskYsize) 315 325 { 316 326 Array<bool, 2> __arr(_mask, shape(_maskXsize, _maskYsize), neverDeleteData, FortranArray<2>()); … … 336 346 XML_SET(Domain, domain, int, dnindex, data_n_index) 337 347 338 void xios_xml_set_domain_diindex(XPtr const _domain, XDType _dtype, int _diindex[], XSize _diindex_size) 348 void xios_xml_set_domain_diindex(XPtr const _domain, XDType _dtype, 349 int _diindex[], XSize _diindex_size) 339 350 { 340 351 Array<int, 1> __arr(_diindex, shape(_diindex_size), neverDeleteData, FortranArray<1>()); … … 351 362 } 352 363 353 void xios_xml_set_domain_djindex(XPtr const _domain, XDType _dtype, int _djindex[], XSize _djindex_size) 364 void xios_xml_set_domain_djindex(XPtr const _domain, XDType _dtype, 365 int _djindex[], XSize _djindex_size) 354 366 { 355 367 Array<int, 1> __arr(_djindex, shape(_djindex_size), neverDeleteData, FortranArray<1>()); … … 366 378 } 367 379 368 void xios_xml_set_domain_lonvalue(XPtr const _domain, XDType _dtype, double _lonvalue[], XSize _lonvalue_Xsize, XSize _lonvalue_Ysize) 380 void xios_xml_set_domain_lonvalue(XPtr const _domain, XDType _dtype, double _lonvalue[], 381 XSize _lonvalue_Xsize, XSize _lonvalue_Ysize) 369 382 { 370 383 XSize __size = (_lonvalue_Ysize == -1) … … 383 396 } 384 397 385 void xios_xml_set_domain_latvalue(XPtr const _domain, XDType _dtype, double _latvalue[], XSize _latvalue_Xsize, XSize _latvalue_Ysize) 398 void xios_xml_set_domain_latvalue(XPtr const _domain, XDType _dtype, double _latvalue[], 399 XSize _latvalue_Xsize, XSize _latvalue_Ysize) 386 400 { 387 401 XSize __size = (_latvalue_Ysize == -1) … … 428 442 called = true; 429 443 } 430 } 444 switch(filetype) 445 { 446 case (NETCDF4): 447 __dtrt->createDataOutput<NetCDF4DataOutput>(); 448 return; 449 // Autres formats de fichiers si disponibles... 450 default: 451 return; 452 } 453 } 454 } 455 456 void xios_dtreatment_end(void) 457 { 458 459 460 } 461 462 void xios_write_data(const XString _field_id, XSize _field_id_len, double * data_k8, 463 XSize data_Xsize, XSize data_Ysize, XSize data_Zsize) 464 { 465 MAKE_STRING(__field_id, _field_id, _field_id_len); 466 467 Context * const __ctxt = Context::GetCurrentContext(); 468 DataTreatment * __dtrt = __ctxt->getDataTreatment(); 469 AbstractCalendar * __cald = __ctxt->getCalendar(); 470 if (__dtrt != NULL) 471 { 472 std::cout << "> Itération de calcul effectuée à la date t = " << __cald->getCurrentDate() 473 << " (soit aprÚs " << (Time)__cald->getCurrentDate() << " sec.)." << std::endl; 474 std::cout << __field_id << " : " 475 << data_Xsize << " : " 476 << data_Ysize << " : " 477 << data_Zsize << std::endl; 478 if ((data_Zsize == -1) && (data_Ysize == -1)) 479 { // cas 1D 480 Array<double, 1> __arr(data_k8, shape(data_Xsize), 481 neverDeleteData, FortranArray<1>()); 482 __dtrt->writeData<Array<double, 1> >(__field_id, __arr); 483 } 484 else if (data_Zsize == -1) 485 { // cas 2D 486 Array<double, 2> __arr(data_k8, shape(data_Xsize, data_Ysize), 487 neverDeleteData, FortranArray<2>()); 488 __dtrt->writeData<Array<double, 2> >(__field_id, __arr); 489 } 490 else 491 { // cas 3D 492 Array<double, 3> __arr(data_k8, shape(data_Xsize, data_Ysize, data_Zsize), 493 neverDeleteData, FortranArray<3>()); 494 __dtrt->writeData<Array<double, 3> >(__field_id, __arr); 495 } 496 } 497 } 498 499 /* ********************************************************** */ 500 /* CALENDAR INTERFACE */ 501 /* ********************************************************** */ 502 503 void xios_update_calendar(int step) 504 { 505 Context * current = Context::GetCurrentContext(); 506 AbstractCalendar * calendar = current->getCalendar(); 507 if (current->getDataTreatment() == NULL) 508 { 509 std::cerr << "Error : Le traitement n'a pas été effectué" << std::endl; 510 return; 511 } 512 calendar->update(); 513 } 514 515 void xios_set_timestep(double ts_year, double ts_month, double ts_day, 516 double ts_hour, double ts_minute, double ts_second) 517 { 518 Context * current = Context::GetCurrentContext(); 519 AbstractCalendar * calendar = current->getCalendar(); 520 struct _duration dr = { ts_year, ts_month , ts_day, 521 ts_hour, ts_minute, ts_second }; 522 if (current->getDataTreatment() == NULL) 523 { 524 std::cerr << "Error : Le traitement n'a pas été effectué" << std::endl; 525 return; 526 } 527 calendar->setTimeStep(dr); 431 528 } 432 529 -
XMLIO_V2/dev/dev_rv/src/XMLIO/c_interface.f03
r137 r138 23 23 INTERFACE ! Ne pas appeler directement/Interface FORTRAN 2003 <-> C99 24 24 25 SUBROUTINE xios_handle_create(ret, dtype, idt, idt_size) bind(C)25 SUBROUTINE xios_handle_create(ret, dtype, idt, idt_size) BIND(C) 26 26 import C_CHAR, C_INT 27 27 INTEGER (kind = C_INT) :: ret … … 71 71 END TYPE XDuration 72 72 73 INTERFACE ! Ne pas appeler directement/Interface FORTRAN 2003 <-> C99 74 75 SUBROUTINE xios_set_timestep(ts_year, ts_month, ts_day, & 76 ts_hour, ts_minute, ts_second) BIND(C) 77 import C_DOUBLE 78 REAL (kind = C_DOUBLE), VALUE :: ts_year, ts_month, ts_day, & 79 ts_hour, ts_minute, ts_second 80 END SUBROUTINE xios_set_timestep 81 82 SUBROUTINE xios_update_calendar(step) BIND(C) 83 import C_INT 84 INTEGER (kind = C_INT), VALUE :: step 85 END SUBROUTINE xios_update_calendar 86 87 END INTERFACE 88 89 CONTAINS ! Fonctions disponibles pour les utilisateurs. 90 91 SUBROUTINE set_timestep(timestep) 92 TYPE(XDuration), INTENT(IN):: timestep 93 94 CALL xios_set_timestep(timestep%year, timestep%month , timestep%day, & 95 timestep%hour, timestep%minute, timestep%second) 96 END SUBROUTINE set_timestep 97 98 SUBROUTINE update_calendar(step) 99 INTEGER, INTENT(IN):: step 100 IF (step < 1) THEN 101 PRINT *, "L'argument 'step' ne peut être négatif ou nul" 102 STOP 103 END IF 104 CALL xios_update_calendar(step) 105 END SUBROUTINE update_calendar 106 73 107 END MODULE ICALENDAR 74 108 … … 82 116 INTERFACE ! Ne pas appeler directement/Interface FORTRAN 2003 <-> C99 83 117 84 SUBROUTINE xios_xml_tree_add(parent_, parent_type, child_, child_type, child_id, child_id_size) bind(C)118 SUBROUTINE xios_xml_tree_add(parent_, parent_type, child_, child_type, child_id, child_id_size) BIND(C) 85 119 import C_CHAR, C_INT 86 120 INTEGER (kind = C_INT), VALUE :: parent_ … … 92 126 END SUBROUTINE xios_xml_tree_add 93 127 94 SUBROUTINE xios_xml_tree_show(filename, filename_size) bind(C)128 SUBROUTINE xios_xml_tree_show(filename, filename_size) BIND(C) 95 129 import C_CHAR, C_INT 96 130 CHARACTER(kind = C_CHAR), DIMENSION(*) :: filename … … 101 135 ! Attribut des éléments de type field et field_group ! 102 136 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 103 SUBROUTINE xios_xml_set_field_name(field, ftype, fname, fname_size) bind(C)137 SUBROUTINE xios_xml_set_field_name(field, ftype, fname, fname_size) BIND(C) 104 138 import C_CHAR, C_INT 105 139 INTEGER (kind = C_INT), VALUE :: field, ftype … … 108 142 END SUBROUTINE xios_xml_set_field_name 109 143 110 SUBROUTINE xios_xml_set_field_sname(field, ftype, fsname, fsname_size) bind(C)144 SUBROUTINE xios_xml_set_field_sname(field, ftype, fsname, fsname_size) BIND(C) 111 145 import C_CHAR, C_INT 112 146 INTEGER (kind = C_INT), VALUE :: field, ftype … … 115 149 END SUBROUTINE xios_xml_set_field_sname 116 150 117 SUBROUTINE xios_xml_set_field_lname(field, ftype, flname, flname_size) bind(C)151 SUBROUTINE xios_xml_set_field_lname(field, ftype, flname, flname_size) BIND(C) 118 152 import C_CHAR, C_INT 119 153 INTEGER (kind = C_INT), VALUE :: field, ftype … … 122 156 END SUBROUTINE xios_xml_set_field_lname 123 157 124 SUBROUTINE xios_xml_set_field_unit(field, ftype, funit, funit_size) bind(C)158 SUBROUTINE xios_xml_set_field_unit(field, ftype, funit, funit_size) BIND(C) 125 159 import C_CHAR, C_INT 126 160 INTEGER (kind = C_INT), VALUE :: field, ftype … … 129 163 END SUBROUTINE xios_xml_set_field_unit 130 164 131 SUBROUTINE xios_xml_set_field_operation(field, ftype, foperation, foperation_size) bind(C)165 SUBROUTINE xios_xml_set_field_operation(field, ftype, foperation, foperation_size) BIND(C) 132 166 import C_CHAR, C_INT 133 167 INTEGER (kind = C_INT), VALUE :: field, ftype … … 136 170 END SUBROUTINE xios_xml_set_field_operation 137 171 138 SUBROUTINE xios_xml_set_field_freq_op(field, ftype, year, month, day, hour, minute, second) bind(C)172 SUBROUTINE xios_xml_set_field_freq_op(field, ftype, year, month, day, hour, minute, second) BIND(C) 139 173 import C_DOUBLE, C_INT 140 174 INTEGER (kind = C_INT), VALUE :: field, ftype … … 142 176 END SUBROUTINE xios_xml_set_field_freq_op 143 177 144 SUBROUTINE xios_xml_set_field_level(field, ftype, flevel) bind(C)178 SUBROUTINE xios_xml_set_field_level(field, ftype, flevel) BIND(C) 145 179 import C_INT 146 180 INTEGER (kind = C_INT), VALUE :: field, ftype … … 148 182 END SUBROUTINE xios_xml_set_field_level 149 183 150 SUBROUTINE xios_xml_set_field_prec(field, ftype, fprec) bind(C)184 SUBROUTINE xios_xml_set_field_prec(field, ftype, fprec) BIND(C) 151 185 import C_INT 152 186 INTEGER (kind = C_INT), VALUE :: field, ftype … … 154 188 END SUBROUTINE xios_xml_set_field_prec 155 189 156 SUBROUTINE xios_xml_set_field_enabled(field, ftype, fenabled) bind(C)190 SUBROUTINE xios_xml_set_field_enabled(field, ftype, fenabled) BIND(C) 157 191 import C_INT, C_BOOL 158 192 INTEGER (kind = C_INT), VALUE :: field, ftype … … 160 194 END SUBROUTINE xios_xml_set_field_enabled 161 195 162 SUBROUTINE xios_xml_set_field_dref(field, ftype, fdref, fdref_size) bind(C)196 SUBROUTINE xios_xml_set_field_dref(field, ftype, fdref, fdref_size) BIND(C) 163 197 import C_CHAR, C_INT 164 198 INTEGER (kind = C_INT), VALUE :: field, ftype … … 167 201 END SUBROUTINE xios_xml_set_field_dref 168 202 169 SUBROUTINE xios_xml_set_field_aref(field, ftype, faref, faref_size) bind(C)203 SUBROUTINE xios_xml_set_field_aref(field, ftype, faref, faref_size) BIND(C) 170 204 import C_CHAR, C_INT 171 205 INTEGER (kind = C_INT), VALUE :: field, ftype … … 174 208 END SUBROUTINE xios_xml_set_field_aref 175 209 176 SUBROUTINE xios_xml_set_field_gref(field, ftype, fgref, fgref_size) bind(C)210 SUBROUTINE xios_xml_set_field_gref(field, ftype, fgref, fgref_size) BIND(C) 177 211 import C_CHAR, C_INT 178 212 INTEGER (kind = C_INT), VALUE :: field, ftype … … 181 215 END SUBROUTINE xios_xml_set_field_gref 182 216 183 SUBROUTINE xios_xml_set_field_zref(field, ftype, fzref, fzref_size) bind(C)217 SUBROUTINE xios_xml_set_field_zref(field, ftype, fzref, fzref_size) BIND(C) 184 218 import C_CHAR, C_INT 185 219 INTEGER (kind = C_INT), VALUE :: field, ftype … … 188 222 END SUBROUTINE xios_xml_set_field_zref 189 223 190 SUBROUTINE xios_xml_set_field_fref(field, ftype, ffref, ffref_size) bind(C)224 SUBROUTINE xios_xml_set_field_fref(field, ftype, ffref, ffref_size) BIND(C) 191 225 import C_CHAR, C_INT 192 226 INTEGER (kind = C_INT), VALUE :: field, ftype … … 199 233 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 200 234 201 SUBROUTINE xios_xml_set_file_name(file_, ftype, fname, fname_size) bind(C)235 SUBROUTINE xios_xml_set_file_name(file_, ftype, fname, fname_size) BIND(C) 202 236 import C_CHAR, C_INT 203 237 INTEGER (kind = C_INT), VALUE :: file_, ftype … … 206 240 END SUBROUTINE xios_xml_set_file_name 207 241 208 SUBROUTINE xios_xml_set_file_description(file_, ftype, fdescription, fdescription_size) bind(C)242 SUBROUTINE xios_xml_set_file_description(file_, ftype, fdescription, fdescription_size) BIND(C) 209 243 import C_CHAR, C_INT 210 244 INTEGER (kind = C_INT), VALUE :: file_, ftype … … 213 247 END SUBROUTINE xios_xml_set_file_description 214 248 215 SUBROUTINE xios_xml_set_file_output_freq(file_, ftype, year, month, day, hour, minute, second) bind(C)249 SUBROUTINE xios_xml_set_file_output_freq(file_, ftype, year, month, day, hour, minute, second) BIND(C) 216 250 import C_DOUBLE, C_INT 217 251 INTEGER (kind = C_INT), VALUE :: file_, ftype … … 219 253 END SUBROUTINE xios_xml_set_file_output_freq 220 254 221 SUBROUTINE xios_xml_set_file_olevel(file_, ftype, folevel) bind(C)255 SUBROUTINE xios_xml_set_file_olevel(file_, ftype, folevel) BIND(C) 222 256 import C_INT 223 257 INTEGER (kind = C_INT), VALUE :: file_, ftype … … 225 259 END SUBROUTINE xios_xml_set_file_olevel 226 260 227 SUBROUTINE xios_xml_set_file_enabled(file_, ftype, fenabled) bind(C)261 SUBROUTINE xios_xml_set_file_enabled(file_, ftype, fenabled) BIND(C) 228 262 import C_INT, C_BOOL 229 263 INTEGER (kind = C_INT), VALUE :: file_, ftype … … 234 268 ! Attribut des éléments de type grid et grid_group ! 235 269 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 236 SUBROUTINE xios_xml_set_grid_name(grid, ftype, gname, gname_size) bind(C)270 SUBROUTINE xios_xml_set_grid_name(grid, ftype, gname, gname_size) BIND(C) 237 271 import C_CHAR, C_INT 238 272 INTEGER (kind = C_INT), VALUE :: grid, ftype … … 241 275 END SUBROUTINE xios_xml_set_grid_name 242 276 243 SUBROUTINE xios_xml_set_grid_description(grid, ftype, gdescription, gdescription_size) bind(C)277 SUBROUTINE xios_xml_set_grid_description(grid, ftype, gdescription, gdescription_size) BIND(C) 244 278 import C_CHAR, C_INT 245 279 INTEGER (kind = C_INT), VALUE :: grid, ftype … … 248 282 END SUBROUTINE xios_xml_set_grid_description 249 283 250 SUBROUTINE xios_xml_set_grid_dref(grid, ftype, dref, dref_size) bind(C)284 SUBROUTINE xios_xml_set_grid_dref(grid, ftype, dref, dref_size) BIND(C) 251 285 import C_CHAR, C_INT 252 286 INTEGER (kind = C_INT), VALUE :: grid, ftype … … 255 289 END SUBROUTINE xios_xml_set_grid_dref 256 290 257 SUBROUTINE xios_xml_set_grid_aref(grid, ftype, aref, aref_size) bind(C)291 SUBROUTINE xios_xml_set_grid_aref(grid, ftype, aref, aref_size) BIND(C) 258 292 import C_CHAR, C_INT 259 293 INTEGER (kind = C_INT), VALUE :: grid, ftype … … 265 299 ! Attribut des éléments de type axis et axis_group ! 266 300 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 267 SUBROUTINE xios_xml_set_axis_name(axis, ftype, aname, aname_size) bind(C)301 SUBROUTINE xios_xml_set_axis_name(axis, ftype, aname, aname_size) BIND(C) 268 302 import C_CHAR, C_INT 269 303 INTEGER (kind = C_INT), VALUE :: axis, ftype … … 272 306 END SUBROUTINE xios_xml_set_axis_name 273 307 274 SUBROUTINE xios_xml_set_axis_sname(axis, ftype, asname, asname_size) bind(C)308 SUBROUTINE xios_xml_set_axis_sname(axis, ftype, asname, asname_size) BIND(C) 275 309 import C_CHAR, C_INT 276 310 INTEGER (kind = C_INT), VALUE :: axis, ftype … … 279 313 END SUBROUTINE xios_xml_set_axis_sname 280 314 281 SUBROUTINE xios_xml_set_axis_lname(axis, ftype, alname, alname_size) bind(C)315 SUBROUTINE xios_xml_set_axis_lname(axis, ftype, alname, alname_size) BIND(C) 282 316 import C_CHAR, C_INT 283 317 INTEGER (kind = C_INT), VALUE :: axis, ftype … … 286 320 END SUBROUTINE xios_xml_set_axis_lname 287 321 288 SUBROUTINE xios_xml_set_axis_unit(axis, ftype, aunit, aunit_size) bind(C)322 SUBROUTINE xios_xml_set_axis_unit(axis, ftype, aunit, aunit_size) BIND(C) 289 323 import C_CHAR, C_INT 290 324 INTEGER (kind = C_INT), VALUE :: axis, ftype … … 293 327 END SUBROUTINE xios_xml_set_axis_unit 294 328 295 SUBROUTINE xios_xml_set_axis_value(axis, ftype, avalue, avalue_size) bind(C)329 SUBROUTINE xios_xml_set_axis_value(axis, ftype, avalue, avalue_size) BIND(C) 296 330 import C_DOUBLE, C_INT 297 331 INTEGER (kind = C_INT), VALUE :: axis, ftype … … 304 338 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 305 339 306 SUBROUTINE xios_xml_set_domain_name(domain, ftype, dname, dname_size) bind(C)340 SUBROUTINE xios_xml_set_domain_name(domain, ftype, dname, dname_size) BIND(C) 307 341 import C_CHAR, C_INT 308 342 INTEGER (kind = C_INT), VALUE :: domain, ftype … … 311 345 END SUBROUTINE xios_xml_set_domain_name 312 346 313 SUBROUTINE xios_xml_set_domain_sname(domain, ftype, dsname, dsname_size) bind(C)347 SUBROUTINE xios_xml_set_domain_sname(domain, ftype, dsname, dsname_size) BIND(C) 314 348 import C_CHAR, C_INT 315 349 INTEGER (kind = C_INT), VALUE :: domain, ftype … … 318 352 END SUBROUTINE xios_xml_set_domain_sname 319 353 320 SUBROUTINE xios_xml_set_domain_lname(domain, ftype, dlname, dlname_size) bind(C)354 SUBROUTINE xios_xml_set_domain_lname(domain, ftype, dlname, dlname_size) BIND(C) 321 355 import C_CHAR, C_INT 322 356 INTEGER (kind = C_INT), VALUE :: domain, ftype … … 325 359 END SUBROUTINE xios_xml_set_domain_lname 326 360 327 SUBROUTINE xios_xml_set_domain_niglo(domain, ftype, niglo) bind(C)361 SUBROUTINE xios_xml_set_domain_niglo(domain, ftype, niglo) BIND(C) 328 362 import C_INT 329 363 INTEGER (kind = C_INT), VALUE :: domain, ftype, niglo 330 364 END SUBROUTINE xios_xml_set_domain_niglo 331 365 332 SUBROUTINE xios_xml_set_domain_njglo(domain, ftype, njglo) bind(C)366 SUBROUTINE xios_xml_set_domain_njglo(domain, ftype, njglo) BIND(C) 333 367 import C_INT 334 368 INTEGER (kind = C_INT), VALUE :: domain, ftype, njglo 335 369 END SUBROUTINE xios_xml_set_domain_njglo 336 370 337 SUBROUTINE xios_xml_set_domain_ibegin(domain, ftype, ibegin) bind(C)371 SUBROUTINE xios_xml_set_domain_ibegin(domain, ftype, ibegin) BIND(C) 338 372 import C_INT 339 373 INTEGER (kind = C_INT), VALUE :: domain, ftype, ibegin 340 374 END SUBROUTINE xios_xml_set_domain_ibegin 341 375 342 SUBROUTINE xios_xml_set_domain_iend(domain, ftype, iend) bind(C)376 SUBROUTINE xios_xml_set_domain_iend(domain, ftype, iend) BIND(C) 343 377 import C_INT 344 378 INTEGER (kind = C_INT), VALUE :: domain, ftype, iend 345 379 END SUBROUTINE xios_xml_set_domain_iend 346 380 347 SUBROUTINE xios_xml_set_domain_ni(domain, ftype, ni) bind(C)381 SUBROUTINE xios_xml_set_domain_ni(domain, ftype, ni) BIND(C) 348 382 import C_INT 349 383 INTEGER (kind = C_INT), VALUE :: domain, ftype, ni 350 384 END SUBROUTINE xios_xml_set_domain_ni 351 385 352 SUBROUTINE xios_xml_set_domain_jbegin(domain, ftype, jbegin) bind(C)386 SUBROUTINE xios_xml_set_domain_jbegin(domain, ftype, jbegin) BIND(C) 353 387 import C_INT 354 388 INTEGER (kind = C_INT), VALUE :: domain, ftype, jbegin 355 389 END SUBROUTINE xios_xml_set_domain_jbegin 356 390 357 SUBROUTINE xios_xml_set_domain_jend(domain, ftype, jend) bind(C)391 SUBROUTINE xios_xml_set_domain_jend(domain, ftype, jend) BIND(C) 358 392 import C_INT 359 393 INTEGER (kind = C_INT), VALUE :: domain, ftype, jend 360 394 END SUBROUTINE xios_xml_set_domain_jend 361 395 362 SUBROUTINE xios_xml_set_domain_nj(domain, ftype, nj) bind(C)396 SUBROUTINE xios_xml_set_domain_nj(domain, ftype, nj) BIND(C) 363 397 import C_INT 364 398 INTEGER (kind = C_INT), VALUE :: domain, ftype, nj 365 399 END SUBROUTINE xios_xml_set_domain_nj 366 400 367 SUBROUTINE xios_xml_set_domain_mask(domain, ftype, mask, maskXsize, maskYsize) bind(C)401 SUBROUTINE xios_xml_set_domain_mask(domain, ftype, mask, maskXsize, maskYsize) BIND(C) 368 402 import C_BOOL, C_INT 369 403 INTEGER (kind = C_INT), VALUE :: domain, ftype … … 372 406 END SUBROUTINE xios_xml_set_domain_mask 373 407 374 SUBROUTINE xios_xml_set_domain_ddim(domain, ftype, dadim) bind(C)408 SUBROUTINE xios_xml_set_domain_ddim(domain, ftype, dadim) BIND(C) 375 409 import C_INT 376 410 INTEGER (kind = C_INT), VALUE :: domain, ftype, dadim 377 411 END SUBROUTINE xios_xml_set_domain_ddim 378 412 379 SUBROUTINE xios_xml_set_domain_dni(domain, ftype, dni) bind(C)413 SUBROUTINE xios_xml_set_domain_dni(domain, ftype, dni) BIND(C) 380 414 import C_INT 381 415 INTEGER (kind = C_INT), VALUE :: domain, ftype, dni 382 416 END SUBROUTINE xios_xml_set_domain_dni 383 417 384 SUBROUTINE xios_xml_set_domain_dnj(domain, ftype, dnj) bind(C)418 SUBROUTINE xios_xml_set_domain_dnj(domain, ftype, dnj) BIND(C) 385 419 import C_INT 386 420 INTEGER (kind = C_INT), VALUE :: domain, ftype, dnj 387 421 END SUBROUTINE xios_xml_set_domain_dnj 388 422 389 SUBROUTINE xios_xml_set_domain_dibegin(domain, ftype, dibegin) bind(C)423 SUBROUTINE xios_xml_set_domain_dibegin(domain, ftype, dibegin) BIND(C) 390 424 import C_INT 391 425 INTEGER (kind = C_INT), VALUE :: domain, ftype, dibegin 392 426 END SUBROUTINE xios_xml_set_domain_dibegin 393 427 394 SUBROUTINE xios_xml_set_domain_djbegin(domain, ftype, djbegin) bind(C)428 SUBROUTINE xios_xml_set_domain_djbegin(domain, ftype, djbegin) BIND(C) 395 429 import C_INT 396 430 INTEGER (kind = C_INT), VALUE :: domain, ftype, djbegin 397 431 END SUBROUTINE xios_xml_set_domain_djbegin 398 432 399 SUBROUTINE xios_xml_set_domain_dnindex(domain, ftype, dnindex) bind(C)433 SUBROUTINE xios_xml_set_domain_dnindex(domain, ftype, dnindex) BIND(C) 400 434 import C_INT 401 435 INTEGER (kind = C_INT), VALUE :: domain, ftype, dnindex 402 436 END SUBROUTINE xios_xml_set_domain_dnindex 403 437 404 SUBROUTINE xios_xml_set_domain_diindex(domain, ftype, diindex, diindex_size) bind(C)438 SUBROUTINE xios_xml_set_domain_diindex(domain, ftype, diindex, diindex_size) BIND(C) 405 439 import C_INT 406 440 INTEGER (kind = C_INT), VALUE :: domain, ftype … … 409 443 END SUBROUTINE xios_xml_set_domain_diindex 410 444 411 SUBROUTINE xios_xml_set_domain_djindex(domain, ftype, djindex, djindex_size) bind(C)445 SUBROUTINE xios_xml_set_domain_djindex(domain, ftype, djindex, djindex_size) BIND(C) 412 446 import C_INT 413 447 INTEGER (kind = C_INT), VALUE :: domain, ftype … … 416 450 END SUBROUTINE xios_xml_set_domain_djindex 417 451 418 SUBROUTINE xios_xml_set_domain_lonvalue(domain, ftype, lonvalue, lonvalue_xsize, lonvalue_ysize) bind(C)452 SUBROUTINE xios_xml_set_domain_lonvalue(domain, ftype, lonvalue, lonvalue_xsize, lonvalue_ysize) BIND(C) 419 453 import C_DOUBLE, C_INT 420 454 INTEGER (kind = C_INT), VALUE :: domain, ftype … … 423 457 END SUBROUTINE xios_xml_set_domain_lonvalue 424 458 425 SUBROUTINE xios_xml_set_domain_latvalue(domain, ftype, latvalue, latvalue_xsize, lonvalue_ysize) bind(C)459 SUBROUTINE xios_xml_set_domain_latvalue(domain, ftype, latvalue, latvalue_xsize, lonvalue_ysize) BIND(C) 426 460 import C_DOUBLE, C_INT 427 461 INTEGER (kind = C_INT), VALUE :: domain, ftype … … 430 464 END SUBROUTINE xios_xml_set_domain_latvalue 431 465 432 SUBROUTINE xios_xml_set_domain_domtype(domain, ftype, domtype, domtype_size) bind(C)466 SUBROUTINE xios_xml_set_domain_domtype(domain, ftype, domtype, domtype_size) BIND(C) 433 467 import C_CHAR, C_INT 434 468 INTEGER (kind = C_INT), VALUE :: domain, ftype … … 829 863 INTERFACE ! Ne pas appeler directement/Interface FORTRAN 2003 <-> C99 830 864 831 SUBROUTINE xios_xml_Parse_File(filename, filename_size) bind(C)865 SUBROUTINE xios_xml_Parse_File(filename, filename_size) BIND(C) 832 866 import C_CHAR, C_INT 833 867 CHARACTER(kind = C_CHAR), DIMENSION(*) :: filename … … 835 869 END SUBROUTINE xios_xml_Parse_File 836 870 837 SUBROUTINE xios_xml_Parse_String(xmlcontent, xmlcontent_size) bind(C)871 SUBROUTINE xios_xml_Parse_String(xmlcontent, xmlcontent_size) BIND(C) 838 872 import C_CHAR, C_INT 839 873 CHARACTER(kind = C_CHAR), DIMENSION(*) :: xmlcontent … … 868 902 INTERFACE ! Ne pas appeler directement/Interface FORTRAN 2003 <-> C99 869 903 870 SUBROUTINE xios_context_set_current(context, withswap) bind(C)904 SUBROUTINE xios_context_set_current(context, withswap) BIND(C) 871 905 import C_BOOL, C_INT 872 906 INTEGER (kind = C_INT), VALUE :: context … … 874 908 END SUBROUTINE xios_context_set_current 875 909 876 SUBROUTINE xios_context_create(context, context_id, context_id_size, calendar_type) bind(C) 910 SUBROUTINE xios_context_create(context, context_id, context_id_size, calendar_type, & 911 year, month, day, hour, minute, second) BIND(C) 877 912 import C_CHAR, C_INT 878 913 INTEGER (kind = C_INT) :: context 879 914 CHARACTER(kind = C_CHAR), DIMENSION(*) :: context_id 880 915 INTEGER (kind = C_INT), VALUE :: context_id_size 881 INTEGER (kind = C_INT), VALUE :: calendar_type 916 INTEGER (kind = C_INT), VALUE :: calendar_type, year, month, day, hour, minute, second 882 917 END SUBROUTINE xios_context_create 883 918 … … 905 940 906 941 ! Créer un nouveau contexte à partir d'un id, d'un type de calendrier et d'une date. 907 SUBROUTINE context_create(context_hdl, context_id, calendar_type) 908 USE IXHANDLE 909 TYPE(XHandle), INTENT(OUT) :: context_hdl 910 CHARACTER(len = *), INTENT(IN) :: context_id 911 INTEGER, INTENT(IN) :: calendar_type 912 CALL xios_context_create(context_hdl%daddr, context_id, len(context_id), calendar_type) 942 SUBROUTINE context_create(context_hdl, context_id, calendar_type, init_date) 943 USE IXHANDLE 944 USE ICALENDAR 945 TYPE(XHandle), INTENT(OUT) :: context_hdl 946 CHARACTER(len = *), INTENT(IN) :: context_id 947 INTEGER, INTENT(IN) :: calendar_type 948 TYPE(XDate), INTENT(IN), OPTIONAL :: init_date 949 IF (PRESENT(init_date)) THEN 950 CALL xios_context_create(context_hdl%daddr, context_id, len(context_id), calendar_type, & 951 init_date%year, init_date%month, init_date%day, & 952 init_date%hour, init_date%minute, init_date%second) 953 ELSE 954 CALL xios_context_create(context_hdl%daddr, context_id, len(context_id), calendar_type, & 955 0, 1, 1, 0, 0, 0) 956 END IF 913 957 IF (context_hdl%daddr .EQ. 0) THEN 914 958 PRINT *, "(F2003 interface) Impossible de créer le context !" … … 934 978 INTERFACE ! Ne pas appeler directement/Interface FORTRAN 2003 <-> C99 935 979 936 SUBROUTINE xios_dtreatment_start(context_hdl, filetype) bind(C)980 SUBROUTINE xios_dtreatment_start(context_hdl, filetype) BIND(C) 937 981 import C_INT 938 982 INTEGER (kind = C_INT), VALUE :: context_hdl 939 983 INTEGER (kind = C_INT), VALUE :: filetype 940 984 END SUBROUTINE xios_dtreatment_start 985 986 SUBROUTINE xios_dtreatment_end() BIND(C) 987 ! Sans argument 988 END SUBROUTINE xios_dtreatment_end 989 990 SUBROUTINE xios_write_data(fieldid, fieldid_size, data_k8, data_Xsize, data_Ysize, data_Zsize) BIND(C) 991 import C_INT, C_CHAR, C_PTR, C_FLOAT, C_DOUBLE, C_BOOL 992 CHARACTER(kind = C_CHAR), DIMENSION(*) :: fieldid 993 INTEGER (kind = C_INT), VALUE :: fieldid_size 994 REAL(kind = C_DOUBLE), DIMENSION(*) :: data_k8 995 INTEGER (kind = C_INT), VALUE :: data_Xsize, data_Ysize, data_Zsize 996 END SUBROUTINE xios_write_data 941 997 942 998 END INTERFACE … … 963 1019 END SUBROUTINE dtreatment_start 964 1020 1021 SUBROUTINE dtreatment_end(context_hdl) 1022 USE ICONTEXT 1023 USE IXHANDLE 1024 TYPE(XHandle), INTENT(IN), VALUE :: context_hdl 1025 IF ((context_hdl%dtype .NE. ECONTEXT) .OR. (context_hdl%daddr .EQ. 0)) THEN 1026 PRINT *, "(F2003 interface) Impossible de traiter un contexte invalide !" 1027 STOP 1028 END IF 1029 CALL context_set_current(context_hdl) 1030 CALL xios_dtreatment_end() 1031 END SUBROUTINE dtreatment_end 1032 1033 SUBROUTINE write_data (fieldid, & 1034 data1d_k8, data2d_k8, data3d_k8) 1035 CHARACTER(len = *), INTENT(IN) :: fieldid 1036 REAL(kind = 8), DIMENSION(*), OPTIONAL, INTENT(IN) :: data1d_k8(:), data2d_k8(:,:), data3d_k8(:,:,:) 1037 IF((.NOT. PRESENT(data1d_k8)) .AND. & 1038 (.NOT. PRESENT(data2d_k8)) .AND. & 1039 (.NOT. PRESENT(data3d_k8))) THEN 1040 PRINT *, "(F2003 interface) Veuillez spécifier des données à écrire !" 1041 STOP 1042 END IF 1043 IF (PRESENT (data1d_k8)) THEN 1044 CALL xios_write_data(fieldid, len(fieldid), data1d_k8, & 1045 size(data1d_k8, 1), -1, -1) 1046 ELSE IF (PRESENT (data2d_k8)) THEN 1047 CALL xios_write_data(fieldid, len(fieldid), data2d_k8, & 1048 size(data2d_k8, 1), size(data2d_k8, 2), -1) 1049 ELSE IF (PRESENT (data3d_k8)) THEN 1050 CALL xios_write_data(fieldid, len(fieldid), data3d_k8, & 1051 size(data3d_k8, 1), size(data3d_k8, 2), size(data3d_k8, 3)) 1052 END IF 1053 END SUBROUTINE 1054 965 1055 END MODULE IDATATREATMENT 966 1056 -
XMLIO_V2/dev/dev_rv/src/XMLIO/c_interface.hpp
r137 r138 58 58 /* ******************** CONTEXT INTERFACE ******************* */ 59 59 void xios_context_set_current (XPtr const _ctx, bool _wswap); 60 void xios_context_create (XPtr * _ctx, const XString _ctx_id, XSize _ctx_id_len, XCalendarType _calType); 60 void xios_context_create (XPtr * _ctx, const XString _ctx_id, 61 XSize _ctx_id_len, XCalendarType _calType, 62 XInt yr, XInt mth, XInt dd, 63 XInt hr, XInt min, XInt sec); 61 64 62 65 /* ****************** XML TREE INTERFACE ******************* */ … … 146 149 XML_SET_STRING(domain, domtype, domtype) ; 147 150 148 /* ****************** 151 /* ******************* DATA TREATMENT INTERFACE ******************* */ 149 152 void xios_dtreatment_start(XPtr const _context, XFileType filetype); 153 void xios_dtreatment_end(void); 154 155 void xios_write_data(const XString _field_id, XSize _field_id_len, double * data_k8, 156 XSize data_Xsize, XSize data_Ysize, XSize data_Zsize); 157 158 /* ********************** CALENDAR INTERFACE ********************* */ 159 160 void xios_update_calendar(int step); 161 void xios_set_timestep(double ts_year, double ts_month, double ts_day, 162 double ts_hour, double ts_minute, double ts_second); 163 164 150 165 151 166 #ifdef __cplusplus -
XMLIO_V2/dev/dev_rv/src/XMLIO/calendar.hpp
r131 r138 8 8 public : 9 9 10 JulianCalendar( void)11 : AbstractCalendar("Julian" )10 JulianCalendar(const string& _dateStr) 11 : AbstractCalendar("Julian", _dateStr) 12 12 { /* Ne rien faire de plus */ } 13 13 14 JulianCalendar(const string& _dateStr) 15 : AbstractCalendar("Julian", _dateStr) 14 JulianCalendar(int yr = 0, int mth = 1, int d = 1, 15 int hr = 0, int min = 0, int sec = 0) 16 : AbstractCalendar("Julian", yr, mth, d, hr, min, sec) 16 17 { /* Ne rien faire de plus */ } 17 18 … … 36 37 } 37 38 38 virtual string getType(void) const { return (string("julian")); } 39 virtual string getType(void) const 40 { return (string("julian")); } 39 41 40 42 virtual ~JulianCalendar(void) 41 { /* Ne rien faire de plus */}43 { /* Ne rien faire de plus */ } 42 44 43 45 }; // class JulianCalendar … … 47 49 public : 48 50 49 GregorianCalendar(void) 50 : AbstractCalendar("Gregorian") 51 {/* Ne rien faire de plus */} 51 GregorianCalendar(int yr = 0, int mth = 1, int d = 1, 52 int hr = 0, int min = 0, int sec = 0) 53 : AbstractCalendar("Gregorian", yr, mth, d, hr, min, sec) 54 { /* Ne rien faire de plus */ } 52 55 53 56 GregorianCalendar(const string& dateStr) 54 57 : AbstractCalendar("Gregorian", dateStr) 55 { /* Ne rien faire de plus */}58 { /* Ne rien faire de plus */ } 56 59 57 60 public : /* virtual */ … … 59 62 virtual int getYearTotalLength(const Date& d) const 60 63 { // Retourne la durée d'une année en seconde. 61 if ((d.getYear() % 4 == 0) && (d.getYear() % 100 != 0 || d.getYear() % 400 == 0)) return (366 * 86400); 64 if ((d.getYear() % 4 == 0) && 65 ((d.getYear() % 100 != 0) || 66 (d.getYear() % 400 == 0) )) 67 return (366 * 86400); 62 68 return (365 * 86400); 63 69 } … … 76 82 } 77 83 78 virtual string getType(void) const { return (string("gregorian")); } 84 virtual string getType(void) const 85 { return (string("gregorian")); } 79 86 80 87 virtual ~GregorianCalendar(void) 81 { /* Ne rien faire de plus */}88 { /* Ne rien faire de plus */ } 82 89 83 90 }; // class GregorianCalendar … … 87 94 public : 88 95 89 NoLeapCalendar(void) 90 : AbstractCalendar("NoLeap") 91 {/* Ne rien faire de plus */} 96 NoLeapCalendar(int yr = 0, int mth = 1, int d = 1, 97 int hr = 0, int min = 0, int sec = 0) 98 : AbstractCalendar("NoLeap", yr, mth, d, hr, min, sec) 99 { /* Ne rien faire de plus */ } 92 100 93 101 NoLeapCalendar(const string& dateStr) 94 102 : AbstractCalendar("NoLeap", dateStr) 95 { /* Ne rien faire de plus */}103 { /* Ne rien faire de plus */ } 96 104 97 105 public : /* virtual */ … … 101 109 102 110 virtual ~NoLeapCalendar(void) 103 { /* Ne rien faire de plus */}111 { /* Ne rien faire de plus */ } 104 112 105 113 }; // class NoLeapCalendar … … 109 117 public : 110 118 111 AllLeapCalendar(void) 112 : AbstractCalendar("AllLeap") 113 {/* Ne rien faire de plus */} 119 AllLeapCalendar(int yr = 0, int mth = 1, int d = 1, 120 int hr = 0, int min = 0, int sec = 0) 121 : AbstractCalendar("AllLeap", yr, mth, d, hr, min, sec) 122 { /* Ne rien faire de plus */ } 114 123 115 124 AllLeapCalendar(const string& dateStr) 116 125 : AbstractCalendar("AllLeap", dateStr) 117 { /* Ne rien faire de plus */}126 { /* Ne rien faire de plus */ } 118 127 119 128 public : /* virtual */ … … 133 142 134 143 virtual ~AllLeapCalendar(void) 135 { /* Ne rien faire de plus */}144 { /* Ne rien faire de plus */ } 136 145 137 146 }; // class NoLeapCalendar … … 141 150 public : 142 151 143 D360Calendar(void) 144 : AbstractCalendar("D360") 145 {/* Ne rien faire de plus */} 152 D360Calendar(int yr = 0, int mth = 1, int d = 1, 153 int hr = 0, int min = 0, int sec = 0) 154 : AbstractCalendar("D360", yr, mth, d, hr, min, sec) 155 { /* Ne rien faire de plus */ } 146 156 147 157 D360Calendar(const string& dateStr) 148 158 : AbstractCalendar("D360", dateStr) 149 { /* Ne rien faire de plus */}159 { /* Ne rien faire de plus */ } 150 160 151 161 public : /* virtual */ … … 161 171 162 172 virtual ~D360Calendar(void) 163 { /* Ne rien faire de plus */}173 { /* Ne rien faire de plus */ } 164 174 165 175 }; // class D360Calendar -
XMLIO_V2/dev/dev_rv/src/XMLIO/container.hpp
r131 r138 17 17 18 18 Mapped* operator[] (const Key& kval) 19 throw (XMLIOUndefinedValueException)20 19 { 21 20 if(!hasMappedValue(kval)) 22 throw XMLIOSERVER::XMLIOUndefinedValueException21 XMLIOError 23 22 ("Appel de la méthode ExHashMap::operator["+kval+"] invalide."); 24 23 return (find(kval)->second); -
XMLIO_V2/dev/dev_rv/src/XMLIO/context.hpp
r137 r138 26 26 { 27 27 if (hasChild()) return false; 28 this->fieldDef = 29 (FieldDefinition*)FieldDefinition ::CreateObject(FieldDefinition ::GetDefName());30 this->fileDef = 31 (FileDefinition*)FileDefinition ::CreateObject(FileDefinition ::GetDefName());32 this->axisDef = 33 (AxisDefinition*)AxisDefinition ::CreateObject(AxisDefinition ::GetDefName());34 this->gridDef = 35 (GridDefinition*)GridDefinition ::CreateObject(GridDefinition ::GetDefName());36 this->domainDef = 37 (DomainDefinition*)DomainDefinition::CreateObject(DomainDefinition::GetDefName());28 this->fieldDef = (FieldDefinition*) 29 FieldDefinition ::CreateObject(FieldDefinition ::GetDefName()); 30 this->fileDef = (FileDefinition*) 31 FileDefinition ::CreateObject(FileDefinition ::GetDefName()); 32 this->axisDef = (AxisDefinition*) 33 AxisDefinition ::CreateObject(AxisDefinition ::GetDefName()); 34 this->gridDef = (GridDefinition*) 35 GridDefinition ::CreateObject(GridDefinition ::GetDefName()); 36 this->domainDef = (DomainDefinition*) 37 DomainDefinition::CreateObject(DomainDefinition::GetDefName()); 38 38 return (true); 39 39 } … … 72 72 template <class T> 73 73 DataTreatment * setDataTreatment(void) 74 { return (dtreatment = (ccalendar == NULL) ? NULL : new T(this)); }74 { return (dtreatment = (ccalendar == NULL) ? NULL : new T(this)); } 75 75 76 76 public : /* virtual */ … … 111 111 if (name.compare(FieldDefinition::GetDefName()) == 0) 112 112 // Parsing pour la définition des champs. 113 { fieldDef = CreateInstanceAndParse<FieldDefinition 113 { fieldDef = CreateInstanceAndParse<FieldDefinition> 114 114 (_node, FieldDefinition::GetDefName().c_str()); continue; } 115 115 116 116 if (name.compare(FileDefinition::GetDefName()) == 0) 117 117 // Parsing pour la définition des fichiers. 118 { fileDef = CreateInstanceAndParse<FileDefinition 118 { fileDef = CreateInstanceAndParse<FileDefinition> 119 119 (_node, FileDefinition ::GetDefName().c_str()); continue; } 120 120 121 121 if (name.compare(AxisDefinition::GetDefName()) == 0) 122 122 // Parsing pour la définition des axes. 123 { axisDef = CreateInstanceAndParse<AxisDefinition 123 { axisDef = CreateInstanceAndParse<AxisDefinition> 124 124 (_node, AxisDefinition ::GetDefName().c_str()); continue; } 125 125 126 126 if (name.compare(GridDefinition::GetDefName()) == 0) 127 127 // Parsing pour la définition des grilles. 128 { gridDef = CreateInstanceAndParse<GridDefinition 128 { gridDef = CreateInstanceAndParse<GridDefinition> 129 129 (_node, GridDefinition ::GetDefName().c_str()); continue; } 130 130 … … 165 165 } 166 166 167 virtual std::string getXmlExtraAttributes(void) const 168 { 169 std::ostringstream oss; 170 oss << " calendar_type=\""<< ccalendar->getId() <<"\"" 171 << " start_date=\"" << ccalendar->getInitDate() <<"\""; 172 return (oss.str()); 173 } 174 167 175 public : /* static */ 168 176 … … 173 181 static void ShowTree(ostream& os = std::clog) 174 182 { 183 std::string __curCtxt = Context::GetCurrentContext()->getId(); 184 175 185 os << NIndent << "<?xml version=\"1.0\"?>" << std::endl; 176 186 os << NIndent << "<" << Context::GetRootName() << ">" << std::endl; … … 189 199 os << NIndent << std::endl; 190 200 os << NIndent << "</" << Context::GetRootName() << ">" << std::endl ; 201 Context::SetCurrentContext(__curCtxt); 191 202 } 192 203 … … 196 207 Poco::HashMap<string, StrHashMap<Context> >::Iterator it; 197 208 198 for (it = AllListContext.begin(); it != AllListContext.end(); it++) 199 { Context::SetCurrentContext((*it).first); delete ((*it).second)[(*it).first]; } 209 for (it = AllListContext.begin(); 210 it != AllListContext.end(); it++) 211 { 212 Context::SetCurrentContext((*it).first); 213 delete ((*it).second)[(*it).first]; 214 } 200 215 } 201 216 … … 223 238 224 239 static bool HasContext(const string& id) 225 { return (Context::GetAllListObject().find(id) != Context::GetAllListObject().end()); } 240 { 241 return (Context::GetAllListObject().find(id) != 242 Context::GetAllListObject().end()); 243 } 226 244 227 245 static Context* GetContext(const string& id) … … 250 268 251 269 if (!Context::HasContext(id) && withcheck) 252 throw new XMLIOUndefinedValueException270 XMLIOError 253 271 ("Impossible de se placer dans le contexte "+id+" car celui-ci n'existe pas dans l'arborescence!"); 254 272 -
XMLIO_V2/dev/dev_rv/src/XMLIO/data_treatment.hpp
r134 r138 103 103 } 104 104 105 std::vector<CFile *> enabledFiles; // Liste des fichiers à créer dans un context donné.105 std::vector<CFile *> enabledFiles; // Liste des fichiers à créer dans un context donné. 106 106 107 107 private : -
XMLIO_V2/dev/dev_rv/src/XMLIO/declare_attribut.hpp
r137 r138 25 25 }; \ 26 26 \ 27 const Attr_##att_name& get Attr_##att_name(void) const { return (att_name); } \27 const Attr_##att_name& get_##att_name(void) const { return (att_name); } \ 28 28 void set_##att_name (const Attr_##att_name& _newattr) { att_name = _newattr; } \ 29 29 void set_##att_name (const att_type& _newattr) { att_name.setValue(_newattr); } \ -
XMLIO_V2/dev/dev_rv/src/XMLIO/domain.hpp
r137 r138 35 35 if ((!ni_glo.hasValue() || ni_glo <= 0 ) || 36 36 (!nj_glo.hasValue() || nj_glo <= 0 )) 37 ERROR("Le domaine global est mal défini, vérifiez les valeurs de \'ni_glo\' et \'nj_glo\' !") ;37 ERROR("Le domaine global est mal défini, vérifiez les valeurs de \'ni_glo\' et \'nj_glo\' !") ; 38 38 39 39 // Domaine local en i // 40 if (ni.hasValue() && ibegin.hasValue() && !iend.hasValue())40 if (ni.hasValue() && ibegin.hasValue() && !iend.hasValue()) 41 41 iend = ibegin + ni - 1 ; 42 42 else if (ni.hasValue() && iend.hasValue() && !ibegin.hasValue()) … … 55 55 56 56 // Domaine local en j // 57 if (nj.hasValue() && jbegin.hasValue() && !jend.hasValue())57 if (nj.hasValue() && jbegin.hasValue() && !jend.hasValue()) 58 58 jend = jbegin + nj - 1 ; 59 59 else if (nj.hasValue() && jend.hasValue() && !jbegin.hasValue()) … … 87 87 88 88 // Données du domaine // 89 if (!data_jbegin.hasValue()) data_jbegin = 0 ; 90 if (!data_ibegin.hasValue()) data_ibegin = 0 ; 89 if (!data_ibegin.hasValue()) 90 data_ibegin = 0 ; 91 if (!data_jbegin.hasValue() && (data_dim == 2)) 92 data_jbegin = 0 ; 91 93 92 94 if (data_dim.hasValue() && 93 !(data_dim ==1 || data_dim==2))95 !(data_dim == 1 || data_dim == 2)) 94 96 ERROR("Dimension des données non comptatible (doit être 1 ou 2) !") ; 95 97 else if (! data_dim.hasValue()) … … 101 103 data_ni = (data_dim == 1) ? (ni * nj) : (int) ni; 102 104 103 if (data_nj.hasValue() && (data_nj <= 0)) 104 ERROR("Dimension des données négative (data_nj).") ; 105 else if (!data_nj.hasValue()) 106 data_nj = (int) nj ; 105 if (data_dim == 2) 106 { 107 if (data_nj.hasValue() && (data_nj <= 0) ) 108 ERROR("Dimension des données négative (data_nj).") ; 109 else if (!data_nj.hasValue()) 110 data_nj = (int) nj ; 111 } 107 112 108 113 // Gestion de la compression // … … 132 137 133 138 if (!data_n_index.hasValue()) 134 { // -> bloc re-vér fié OK139 { // -> bloc re-vérifié OK 135 140 if (data_dim == 1) 136 141 { -
XMLIO_V2/dev/dev_rv/src/XMLIO/exception.hpp
r137 r138 10 10 namespace XMLIOSERVER 11 11 { 12 class XMLIOException : public Exception 12 13 class XMLIOError : public std::ostringstream 13 14 { 15 private : 16 17 class XMLIOException : public Exception 18 { 19 public : 20 21 XMLIOException(int _code) 22 : Exception(_code) 23 { /* Ne rien faire de plus */ } 24 25 XMLIOException(const std::string& _msg, int _code = 0) 26 : Exception(_msg, _code) 27 { /* Ne rien faire de plus */ } 28 29 XMLIOException(const std::string& _msg, const std::string& _arg, int _code) 30 : Exception(_msg, _arg, _code) 31 { /* Ne rien faire de plus */ } 32 33 XMLIOException(const std::string& _msg, const Poco::Exception& _exc, int _code) 34 : Exception(_msg, _exc, _code) 35 { /* Ne rien faire de plus */ } 36 37 XMLIOException(const XMLIOException& _exc) 38 : Exception(_exc) 39 { /* Ne rien faire de plus */ } 40 41 ~XMLIOException(void) throw() 42 { std::cerr << displayText() << std::endl; } 43 44 XMLIOException& operator = (const XMLIOException& _exc) 45 { Exception::operator = (_exc); return *this; } 46 47 public : /* virtual */ 48 49 virtual const char* name(void) const throw() { return ("XMLIO>XMLIOException"); } 50 virtual const char* className(void) const throw() { return (typeid(*this).name()); } 51 52 virtual Exception* clone(void) const { return new XMLIOException(*this); } 53 virtual void rethrow(void) const { throw *this; } 54 55 }; // class XMLIOException 56 14 57 public : 15 58 16 XMLIOE xception(int _code)17 : Exception(_code)59 XMLIOError(const std::string _msg) 60 : msg(_msg) 18 61 { /* Ne rien faire de plus */ } 19 62 20 XMLIOException(const std::string& _msg, int _code) 21 : Exception(_msg, _code) 22 { /* Ne rien faire de plus */ } 63 ~XMLIOError(void) 64 { throw XMLIOException(msg); } 23 65 24 XMLIOException(const std::string& _msg, const std::string& _arg, int _code) 25 : Exception(_msg, _arg, _code) 26 { /* Ne rien faire de plus */ } 66 private : 27 67 28 XMLIOException(const std::string& _msg, const Poco::Exception& _exc, int _code) 29 : Exception(_msg, _exc, _code) 30 { /* Ne rien faire de plus */ } 31 32 XMLIOException(const XMLIOException& _exc) 33 : Exception(_exc) 34 { /* Ne rien faire de plus */ } 35 36 ~XMLIOException(void) throw() 37 { std::cerr << displayText() << std::endl; } 38 39 XMLIOException& operator = (const XMLIOException& _exc) 40 { Exception::operator = (_exc); return *this; } 41 42 virtual const char* name(void) const throw() { return ("XMLIO>XMLIOException"); } 43 virtual const char* className(void) const throw() { return (typeid(*this).name()); } 44 45 virtual Exception* clone(void) const { return new XMLIOException(*this); } 46 virtual void rethrow(void) const { throw *this; } 68 std::string msg; 47 69 48 70 }; // class XMLIOException 49 50 class XMLIOUndefinedValueException : public XMLIOException51 {52 public :53 XMLIOUndefinedValueException(const std::string& _msg)54 : XMLIOException(_msg, 1001)55 { /* Ne rien faire de plus */ }56 57 const char* name(void) const throw()58 { return ("XMLIO>UndefinedValueException"); }59 60 ~XMLIOUndefinedValueException(void) throw()61 { std::cerr << displayText() << std::endl; }62 63 }; //class XMLIOUndefinedException64 65 class XMLIOStreamException : public XMLIOException66 {67 public :68 XMLIOStreamException(const std::string& _msg)69 : XMLIOException(_msg, 1002)70 { /* Ne rien faire de plus */ }71 72 const char* name(void) const throw()73 { return ("XMLIO>StreamException"); }74 75 }; //class XMLIOStreamException76 77 class XMLParsingException : public XMLIOException78 {79 public :80 XMLParsingException(const std::string& _msg)81 : XMLIOException(_msg, 1003)82 { /* Ne rien faire de plus */ }83 84 const char* name(void) const throw()85 { return ("XMLIO>XMLParsingException"); }86 87 }; //class XMLParsingException88 89 class XMLIOIncompatibleTypeException : public XMLIOException90 {91 public :92 XMLIOIncompatibleTypeException(const std::string& _msg)93 : XMLIOException(_msg, 1003)94 { /* Ne rien faire de plus */ }95 96 const char* name(void) const throw()97 { return ("XMLIO>XMLIOIncompatibeTypeException"); }98 99 }; //class XMLIOIncompatibleTypeException100 101 // A compléter.102 71 103 72 }// namespace XMLIOSERVER -
XMLIO_V2/dev/dev_rv/src/XMLIO/field.hpp
r131 r138 112 112 { 113 113 if (!_ori->hasId()) 114 throw (new XMLIOUndefinedValueException115 ("Impossible de créer une référence à un élément sans identifiant !") );114 XMLIOError 115 ("Impossible de créer une référence à un élément sans identifiant !"); 116 116 117 117 CField& obj = *ObjectTemplate<CField>::CreateObject(); -
XMLIO_V2/dev/dev_rv/src/XMLIO/field_gridrefsolver.hpp
r124 r138 12 12 { 13 13 if (CDomain::HasObject(domain_ref)) domain = CDomain::GetObject(domain_ref) ; 14 else throw XMLIOSERVER::XMLIOUndefinedValueException("Référence au domaine nommé \'"+ (string)domain_ref +"\' incorrecte") ;14 else XMLIOError("Référence au domaine nommé \'"+ (string)domain_ref +"\' incorrecte") ; 15 15 } 16 16 … … 18 18 { 19 19 if (CAxis::HasObject(axis_ref)) axis = CAxis::GetObject(axis_ref) ; 20 else throw XMLIOSERVER::XMLIOUndefinedValueException("Référence à l'axe nommé \'"+ (string)axis_ref +"\' incorrecte") ;20 else XMLIOError("Référence à l'axe nommé \'"+ (string)axis_ref +"\' incorrecte") ; 21 21 } 22 22 … … 24 24 { 25 25 if (CGrid::HasObject(grid_ref)) grid = CGrid::GetObject(grid_ref) ; 26 else throw XMLIOSERVER::XMLIOUndefinedValueException("Référence à la grille nommée \'"+ (string)grid_ref +"\' incorrecte");26 else XMLIOError("Référence à la grille nommée \'"+ (string)grid_ref +"\' incorrecte"); 27 27 } 28 28 -
XMLIO_V2/dev/dev_rv/src/XMLIO/file.hpp
r137 r138 35 35 { 36 36 if (_output != NULL) output = _output; 37 else throw XMLIOSERVER::XMLIOUndefinedValueException37 else XMLIOError 38 38 ("Impossible d'initialiser la sortie de données pour le fichier nommé '"+ getId() +"'.") ; 39 39 } -
XMLIO_V2/dev/dev_rv/src/XMLIO/grid.hpp
r127 r138 78 78 static string GetDefName(void) { return (CGrid::GetName()); } 79 79 80 static CGrid* CreateObject(const CDomain* const a_domain, const CAxis* const a_axis) 81 { 82 string new_id = string("___") + a_domain->getId() + string("_") + a_axis->getId() + string("__") ; 80 static CGrid* CreateObject(const CDomain * const a_domain, 81 const CAxis * const a_axis) 82 { 83 string new_id = string("___") + a_domain->getId() + 84 string("_") + a_axis->getId() + string("__") ; 83 85 CGrid* const grid = ObjectTemplate<CGrid>::CreateObject(new_id) ; 84 86 … … 124 126 void CGrid::computeIndex(void) 125 127 { 126 int ni = domain->ni ; 127 int nj = domain->nj ; 128 int size = (hasAxis) ? (int)axis->size : 1 ; 129 int data_dim = domain->data_dim ; 130 int data_n_index = domain->data_n_index ; 131 int data_ibegin = domain->data_ibegin ; 132 int data_jbegin = (data_dim == 2) ? (int)domain->data_jbegin : -1; 133 134 Array<int, 1>& data_i_index =* domain->data_i_index ; 135 Array<int, 1>& data_j_index =* domain->data_j_index ; 136 Array<bool, 2>& mask =* domain->mask ; 137 int i, j, l, n ; 138 int count, indexCount ; 139 140 for(indexCount=0, l=0; l<size ; l++) 128 const int ni = domain->ni , 129 nj = domain->nj , 130 size = (hasAxis) ? (int)axis->size : 1 ; 131 132 /*std::cout << ni << " : " 133 << nj << " : " 134 << size << std::endl;*/ 135 136 const int data_dim = domain->data_dim , 137 data_n_index = domain->data_n_index , 138 data_ibegin = domain->data_ibegin , 139 data_jbegin = (data_dim == 2) ? (int)domain->data_jbegin : -1; 140 141 Array<int, 1>& data_i_index =* domain->data_i_index , 142 data_j_index =* domain->data_j_index ; 143 144 /*std::cout << data_n_index << " : " 145 << data_i_index.size() << " : " 146 << data_j_index.size() << std::endl;*/ 147 148 Array<bool, 2>& mask = *domain->mask ; 149 150 int indexCount = 0; 151 152 for(int l = 0; l < size ; l++) 141 153 { 142 for(n=0; n<data_n_index; n++) 143 { 144 if (data_dim == 1) 145 { 146 i = (data_i_index(n) + data_ibegin) % ni ; 147 j = (data_i_index(n) + data_ibegin) / ni ; 148 //cout<<i<<" "<<j<<" "<<mask(i,j)<<endl ; 149 } 150 else 151 { 152 i = data_i_index(n) + data_ibegin ; 153 j = data_j_index(n) + data_jbegin ; 154 //cout<<i<<" "<<j<<" "<<mask(i,j)<<endl ; 155 } 156 157 if (i>=0 && i<ni && j>=0 && j<nj && mask(i,j) ) indexCount++ ; 154 for(int n = 0, i = 0, j = 0; n < data_n_index; n++) 155 { 156 int temp_i = data_i_index(n) + data_ibegin, 157 temp_j = (data_dim == 1) ? -1 158 : data_j_index(n) + data_jbegin; 159 i = (data_dim == 1) ? (temp_i - 2) % ni 160 : (temp_i - 1) ; 161 j = (data_dim == 1) ? (temp_i - 2) / ni 162 : (temp_j - 1) ; 163 164 if ((i >= 0 && i < ni) && 165 (j >= 0 && j < nj) && mask(i, j)) 166 indexCount++ ; 158 167 } 159 168 } 160 169 161 storeIndex.resize(indexCount) ; 170 //std::cout << indexCount << std::endl; 171 172 storeIndex.resize(indexCount) ; 162 173 out_l_index.resize(indexCount) ; 163 174 out_i_index.resize(indexCount) ; 164 175 out_j_index.resize(indexCount) ; 165 176 166 for( count=0, indexCount=0, l=0; l<size; l++)177 for(int count = 0, indexCount = 0, l = 0; l < size; l++) 167 178 { 168 for(n=0; n<data_n_index; n++, count++) 169 { 170 if (data_dim == 1) 179 for(int n = 0, i = 0, j = 0; n < data_n_index; n++, count++) 180 { 181 int temp_i = data_i_index(n) + data_ibegin, 182 temp_j = (data_dim == 1) ? -1 183 : data_j_index(n) + data_jbegin; 184 i = (data_dim == 1) ? (temp_i - 2) % ni 185 : (temp_i - 1) ; 186 j = (data_dim == 1) ? (temp_i - 2) / ni 187 : (temp_j - 1) ; 188 189 if ((i >= 0 && i < ni) && 190 (j >= 0 && j < nj) && mask(i, j)) 171 191 { 172 i = (data_i_index(n) + data_ibegin) % ni ; 173 j = (data_i_index(n) + data_ibegin) / ni ; 174 } 175 else // (dat_dim == 2) 176 { 177 i = data_i_index(n) + data_ibegin ; 178 j = data_j_index(n) + data_jbegin ; 179 } 180 181 if (i>=0 && i<ni && j>=0 && j<nj && mask(i,j)) 182 { 183 storeIndex(indexCount) = count ; 192 storeIndex(indexCount) = count ; 184 193 out_l_index(indexCount) = l ; 185 194 out_i_index(indexCount) = i ; … … 192 201 193 202 template<> 194 void CGrid::outputField(const Array<double, 1>& stored, Array<double, 2>& outField) const 203 void CGrid::outputField(const Array<double, 1>& stored, 204 Array<double, 2>& outField) const 195 205 { 196 206 for(int n = 0; n < storeIndex.size(); n++) … … 199 209 200 210 template<> 201 void CGrid::outputField(const Array<double, 1>& stored, Array<double, 3>& outField) const 211 void CGrid::outputField(const Array<double, 1>& stored, 212 Array<double, 3>& outField) const 202 213 { 203 214 for(int n = 0; n < storeIndex.size(); n++) -
XMLIO_V2/dev/dev_rv/src/XMLIO/group_template.hpp
r137 r138 9 9 public: 10 10 11 DECLARE_ATTR(group_ref, string) ; // Attribut présent uniqument dans les groupes. 11 // Attribut présent uniqument dans les groupes. 12 DECLARE_ATTR(group_ref, string) ; 12 13 13 14 GroupTemplate(void) … … 22 23 23 24 GroupTemplate<T, U>& createGroup(const string& _id) 24 throw (XMLIOUndefinedValueException) 25 25 26 { 26 27 GroupTemplate<T, U> &obj = *GroupTemplate<T, U>::CreateObject(_id); … … 39 40 40 41 GroupTemplate<T, U>& getGroup(const string& _id) const 41 throw (XMLIOUndefinedValueException) 42 42 43 { return (*groupList[_id]); } 43 44 44 bool hasGroup(const string& _id) const { return (groupList.hasMappedValue(_id)); } 45 bool hasGroup(const string& _id) const 46 { return (groupList.hasMappedValue(_id)); } 45 47 46 48 const StrHashMap<GroupTemplate<T, U>* >& getGroupList(void) const { return (groupList); } … … 51 53 52 54 T& createChild(const string& _id) 53 throw (XMLIOUndefinedValueException) 55 54 56 { 55 57 T& obj = *ObjectTemplate<T>::CreateObject(_id); … … 69 71 70 72 T& getChild(const string& _id) const 71 throw (XMLIOUndefinedValueException) 73 72 74 { return (*childList[_id]); } 73 75 74 bool hasChild(const string& _id) const { return (childList.hasMappedValue(_id)); } 76 bool hasChild(const string& _id) const 77 { return (childList.hasMappedValue(_id)); } 75 78 76 79 const StrHashMap<T*> & getCurrentListChild (void) const { return (childList); } … … 82 85 { 83 86 const vector<GroupTemplate<T, U>*>& groupvect = groupList.getVector(); 84 _allc.insert (_allc.end(), getCurrentVectorChild().begin(), getCurrentVectorChild().end()); 87 _allc.insert (_allc.end(), getCurrentVectorChild().begin(), 88 getCurrentVectorChild().end()); 85 89 86 90 for(unsigned int i = 0; i < groupvect.size() ; i++) -
XMLIO_V2/dev/dev_rv/src/XMLIO/logger.hpp
r137 r138 74 74 ~ILogger(void) { this->flush(); } 75 75 76 }; // class XMLIOLogger76 }; // class ILogger 77 77 78 78 // Initialisation de la classe de Logging -
XMLIO_V2/dev/dev_rv/src/XMLIO/main.f90
r137 r138 4 4 5 5 PROGRAM MAIN 6 6 7 USE IXHANDLE 7 8 USE IXML … … 13 14 14 15 INTEGER :: compt = 0 15 16 16 TYPE(XHandle) :: nemo_style_ctxt = NULLHANDLE, & 17 17 orchidee_style_ctxt = NULLHANDLE, & 18 18 lmdz_style_ctxt = NULLHANDLE 19 20 19 TYPE(XHandle) :: temp_mod = NULLHANDLE, & 21 20 temp_mod_ = NULLHANDLE 22 23 ! Axes verticaux 21 ! Les axes verticaux 24 22 REAL(kind = 8), DIMENSION(10) :: vaxis = (/(i, i=1, 10)/) 25 23 !vvaxis = (/(i, i=1, 5)/) 26 27 ! Domaines horizontaux 28 REAL(kind = 8), DIMENSION(20) :: lonrect_orch0 = (/(i, i=11, 30)/),& 29 latrect_orch0 = (/(i, i=11, 30)/) 30 24 ! Les domaines horizontaux 25 REAL(kind = 8), DIMENSION(20) :: lonrect_orch0 = (/(i, i=11, 30)/),& 26 latrect_orch0 = (/(i, i=11, 30)/) 31 27 REAL(kind = 8), DIMENSION(10,10) :: loncurv_nemo0 = 1, & 32 28 latcurv_nemo0 = 1 33 34 29 ! Les durées 35 30 TYPE(XDuration) :: timestep_1h = XDuration(0., 0., 0., 1., 0., 0.) 36 31 !timestep_2h = XDuration(0., 0., 0., 2., 0., 0.) 37 32 ! Les dates 33 TYPE(XDate) :: init_date_orchidee = XDate(1985, 03, 15, 17, 35, 00) 38 34 ! Les masques 39 35 LOGICAL(kind = 1), DIMENSION(20, 20) :: mask0 = .TRUE._1 40 36 41 CHARACTER(len = *), PARAMETER :: filename = & 42 "/local/XMLIOSERVER_DEV/dev_rv/test/iodef_simple_test.xml" 37 ! Les données 38 REAL(kind = 8), DIMENSION(400, 10) :: orchdata = 2.0 39 REAL(kind = 8), DIMENSION(10, 10, 20) :: nemodata = 3.0 43 40 44 41 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 45 42 46 43 ! Parsing du document xml depuis un fichier situé sur le disque. 47 CALL xml_Parse_File( filename)44 CALL xml_Parse_File("/local/XMLIOSERVER_DEV/dev_rv/test/iodef_simple_test.xml") 48 45 49 46 ! Création de handle sur les contextes exstants dans lequels on souhaite travailler. … … 64 61 CALL context_create(context_hdl = orchidee_style_ctxt, & 65 62 context_id = "orchidee_style", & 66 calendar_type = GREGORIAN) 67 68 ! ---------> field_définition 63 calendar_type = GREGORIAN, & 64 init_date = init_date_orchidee) 65 66 ! ---------> field_definition 69 67 CALL handle_create(temp_mod, GFIELD, "field_definition") 70 68 CALL xml_tree_add(parent_hdl = temp_mod, & … … 88 86 ffreq_op = timestep_1h, & 89 87 fgrid_ref = "grid0") 90 ! ---------> axis_définition 88 89 ! ---------> axis_definition 91 90 CALL handle_create(temp_mod, GAXIS, "axis_definition") 92 91 CALL xml_tree_add(parent_hdl = temp_mod, & … … 106 105 avalue = vaxis) 107 106 108 ! ---------> domain_d éfinition107 ! ---------> domain_definition 109 108 CALL handle_create(temp_mod, GDOMAIN, "domain_definition") 110 109 CALL xml_tree_add(parent_hdl = temp_mod, & … … 135 134 domtype = "rectilinear") 136 135 137 ! ---------> file_d éfinition136 ! ---------> file_definition 138 137 CALL handle_create(temp_mod, GFILE, "file_definition") 139 138 CALL xml_tree_add(parent_hdl = temp_mod, & … … 181 180 182 181 ! ----------- Début du traitement ----------- ! 183 ! On choisit le context dans lequel on va travailler et on commence le traitement des données. 182 183 ! <<<------------- orchidée 184 PRINT *, "Style Orchydée" 185 ! On choisit le context dans lequel on va travailler 186 ! et on commence le traitement des données. 184 187 CALL dtreatment_start(orchidee_style_ctxt, NETCDF4) 188 CALL set_timestep(XDuration(0., 0., 0., 1., 0., 0.)) ! UNE heure 185 189 186 190 ! Exécution de la boucle de calcul-écriture. 187 DO compt = 0, 9 188 191 DO compt = 1, 9 192 CALL update_calendar(compt) 193 CALL write_data("field0", data2d_k8 = orchdata) 189 194 END DO 195 CALL dtreatment_end(orchidee_style_ctxt) 196 197 ! <<<------------- lmdz 198 PRINT *, "Style Lmdz" 199 CALL dtreatment_start(lmdz_style_ctxt, NETCDF4) 200 CALL set_timestep(XDuration(0., 0., 0., 1., 0., 0.)) ! UNE heure 201 202 ! Exécution de la boucle de calcul-écriture. 203 DO compt = 1, 9 204 CALL update_calendar(compt) 205 206 END DO 207 CALL dtreatment_end(lmdz_style_ctxt) 208 209 ! <<<------------- nemo 210 PRINT *, "Style Nemo" 211 CALL dtreatment_start(nemo_style_ctxt, NETCDF4) 212 CALL set_timestep(XDuration(0., 0., 0., 1., 0., 0.)) ! UNE heure 213 214 ! Exécution de la boucle de calcul-écriture. 215 DO compt = 1, 9 216 CALL update_calendar(compt) 217 CALL write_data("champ0", data3d_k8 = nemodata) 218 END DO 219 CALL dtreatment_end(nemo_style_ctxt) 190 220 191 221 ! Affichage de l'arbre xml au niveau de la sortie. -
XMLIO_V2/dev/dev_rv/src/XMLIO/object_template.hpp
r137 r138 25 25 { 26 26 const AttributRegistrar &ar = c; 27 std::string extraAttributes = c.getXmlExtraAttributes(); 27 28 28 29 if (c.baseObject != NULL) … … 32 33 if (c.isDefinition()) 33 34 { 34 out << NIndent << std::endl; 35 out << NIndent << "<!-- Groupe de définition dans le contexte \"" << ObjectTemplate<T>::GetCurrentContextId() << "\" courant -->" << std::endl; 35 out << NIndent << std::endl 36 << NIndent << "<!-- Groupe de définition dans le contexte \"" 37 << ObjectTemplate<T>::GetCurrentContextId() << "\" courant -->" 38 << std::endl; 36 39 } 37 40 38 41 if (c.hasChild()) 39 42 { 40 out << IncIndent << "<" << c.getName() << c.printId() << ar << ">" << std::endl; 41 c.printChild(out); // << Ecriture des objets enfants ici. 42 if (c.hasId() && (c.getName().compare("context") == 0)) 43 out << NIndent << std::endl; 43 bool __isContext = false; 44 if (c.hasId() && 45 (c.getName().compare("context") == 0)) 46 { 47 out << IncIndent << "<" << c.getName() << c.printId() 48 << extraAttributes << ">" << std::endl; 49 __isContext = true; 50 } 51 else 52 out << IncIndent << "<" << c.getName() 53 << c.printId() << ar << ">" << std::endl; 54 c.printChild(out); 55 if (__isContext) out << NIndent << std::endl; 44 56 out << NIndent << "</" << c.getName() << ">" << DecEndl; 45 57 } 46 58 else 47 out << IncIndent << "<" << c.getName() << c.printId() << ar << "/>" << DecEndl; 59 { 60 out << IncIndent << "<" << c.getName() << c.printId() 61 << extraAttributes << ar << "/>" << DecEndl; 62 } 48 63 49 64 return (out); … … 56 71 } 57 72 58 st ring getName(void) const73 std::string getName(void) const 59 74 { 60 75 if (this->hasId()) … … 98 113 } 99 114 115 virtual std::string getXmlExtraAttributes(void) const 116 { return (std::string("")); } 117 100 118 virtual void parse (XMLNode& _node) 101 119 { … … 117 135 public : /* static */ 118 136 119 static T* CreateObject(const string& _id) throw (XMLIOUndefinedValueException)137 static T* CreateObject(const string& _id) 120 138 { 121 139 // Si l'identifiant est répertorié, on retourne l'élément existant. … … 136 154 } 137 155 138 static T* GetObject(const string& _id) throw (XMLIOUndefinedValueException)156 static T* GetObject(const string& _id) 139 157 { return (ObjectTemplate<T>::AllListObj[CurrContext][_id]); } 140 158 -
XMLIO_V2/dev/dev_rv/src/XMLIO/xml_node.hpp
r137 r138 97 97 node.setCNode(node.pDoc->documentElement()); 98 98 if (node.getElementName().compare(_rootName) != 0) // << A passer en avertissement. 99 throw XMLParsingException("L'élément racine doit avoir pour valeur <" + _rootName + "> (\"" + node.getElementName() + "\" lue)");99 XMLIOError("L'élément racine doit avoir pour valeur <" + _rootName + "> (\"" + node.getElementName() + "\" lue)"); 100 100 } 101 101 else 102 throw XMLIOStreamException("Impossible de lire le flux en entrée pour le parsing XML !");102 XMLIOError("Impossible de lire le flux en entrée pour le parsing XML !"); 103 103 104 104 return (node); -
XMLIO_V2/dev/dev_rv/src/XMLIO/xml_parser.hpp
r132 r138 29 29 30 30 if (attributes.end() == attributes.find("id")) 31 { WARNING("Le context ne sera pas traité car il n'est pas identifié !"); continue; } 31 { 32 WARNING("Le context ne sera pas traité car il n'est pas identifié !"); 33 continue; 34 } 32 35 33 36 if( Context::GetAllListObject().find(attributes["id"]) != 34 37 Context::GetAllListObject().end()) 35 { WARNING("Le context ne sera pas traité car il existe déjà un autre context possédant le même nom !"); continue; } 38 { 39 WARNING("Le context ne sera pas traité car il existe déjà un autre context possédant le même nom !"); 40 continue; 41 } 36 42 37 43 Context::SetCurrentContext(attributes["id"], false, false); … … 40 46 if ((attributes.end() != attributes.find("calendar_type")) && 41 47 (attributes.end() != attributes.find("start_date"))) 42 context.setCalendar(attributes["calendar_type"], attributes["start_date"]); 48 context.setCalendar(attributes["calendar_type"], 49 attributes["start_date"]); 43 50 44 51 context.parse(_node);
Note: See TracChangeset
for help on using the changeset viewer.