Changeset 278
- Timestamp:
- 09/21/11 09:42:30 (13 years ago)
- Location:
- XMLIO_V2/dev/common/src/xmlio
- Files:
-
- 26 edited
Legend:
- Unmodified
- Added
- Removed
-
XMLIO_V2/dev/common/src/xmlio/attribute_map.cpp
r219 r278 96 96 it != attributes.end(); 97 97 it ++) 98 { 98 99 if ((*it).first.compare(StdString("id")) != 0 && 99 100 (*it).first.compare(StdString("src"))!= 0) … … 102 103 CAttributeMap::operator[]((*it).first)->fromString((*it).second); 103 104 } 105 } 104 106 } 105 107 -
XMLIO_V2/dev/common/src/xmlio/client.cpp
r219 r278 16 16 CClient::~CClient(void) 17 17 { 18 this->finalize();18 //this->finalize(); 19 19 } 20 20 … … 27 27 boost::shared_ptr<CClient> CClient::CreateClient(MPIComm comm_client_server) 28 28 { 29 if (CClient::Client.get() != NULL)29 if (CClient::Client.get() == NULL) 30 30 CClient::Client = boost::shared_ptr<CClient>(new CClient(comm_client_server)); 31 31 return (CClient::GetClient()); -
XMLIO_V2/dev/common/src/xmlio/client.hpp
r219 r278 24 24 ~CClient(void); 25 25 26 p rotected:26 public : 27 27 28 28 /// Accesseur /// -
XMLIO_V2/dev/common/src/xmlio/config/context_attribute.conf
r274 r278 1 1 DECLARE_ATTRIBUTE(StdString, calendar_type) 2 2 DECLARE_ATTRIBUTE(StdString, start_date) 3 3 DECLARE_ATTRIBUTE(StdString, timestep) 4 4 DECLARE_ATTRIBUTE(StdString, output_dir) 5 5 -
XMLIO_V2/dev/common/src/xmlio/data_treatment.cpp
r266 r278 50 50 // Mise à jour cÃŽté client 51 51 this->currentContext->getCalendar()->setTimeStep(duration); 52 this->currentContext->timestep.setValue(duration.toString()); 52 53 std::cout << "timestep :" << duration << std::endl; 53 54 if (CXIOSManager::GetStatus() == CXIOSManager::LOC_CLIENT) … … 79 80 { 80 81 if (field->updateDataServer(currDate, data)) 82 { 81 83 file->getDataOutput()->writeFieldData(field); 84 } 82 85 return; 83 86 } -
XMLIO_V2/dev/common/src/xmlio/data_treatment.hpp
r274 r278 47 47 48 48 /// Création des sorties /// 49 template <class T> void createDataOutput( void);49 template <class T> void createDataOutput(comm::MPIComm comm_server = CXIOSManager::Comm_Server); 50 50 51 51 /// Destructeur /// … … 72 72 73 73 template <class T> 74 void CDataTreatment::createDataOutput( void)74 void CDataTreatment::createDataOutput(comm::MPIComm comm_server ) 75 75 { 76 76 std::vector<boost::shared_ptr<CFile> >::const_iterator … … 79 79 for (; it != end; it++) 80 80 { 81 CXIOSManager::Comm_Server = comm_server; 81 82 boost::shared_ptr<CFile> file = *it; 82 83 StdString filename = (!file->name.isEmpty()) … … 89 90 if (!file->name_suffix.isEmpty()) 90 91 oss << file->name_suffix.getValue(); 91 if (comm::CMPIManager::GetCommSize( ) > 1)92 oss << "_node" << comm::CMPIManager::GetCommRank();93 oss << ".nc";92 if (comm::CMPIManager::GetCommSize(comm_server) > 1) 93 oss << "." << comm::CMPIManager::GetCommRank(comm_server); 94 oss << ".nc"; 94 95 boost::shared_ptr<io::CDataOutput> dout(new T(oss.str(), false)); 95 96 file->initializeDataOutput(dout); -
XMLIO_V2/dev/common/src/xmlio/exception.cpp
r219 r278 23 23 24 24 CException::~CException(void) 25 { if (desc_rethrow) throw (*this); } 25 { 26 if (desc_rethrow) 27 #ifdef __XIOS_NOABORT 28 throw (*this); 29 #else 30 std::cerr << this->getMessage() << std::endl; 31 abort(); 32 #endif 33 } 26 34 27 35 //--------------------------------------------------------------- -
XMLIO_V2/dev/common/src/xmlio/fortran/icdata.cpp
r274 r278 39 39 CTreeManager::PrintTreeToFile(oss.str()); 40 40 oss.str(""); 41 42 41 boost::shared_ptr<CDataTreatment> dt(new CDataTreatment (context)); 43 42 context->setDataTreatment(dt); … … 67 66 CMPIManager::Wait(request); // Pas encore en mode RPC 68 67 } 68 CXIOSManager::RunClient(false, CMPIManager::GetCommWorld()); 69 CClient::CreateClient(comm_client_server); 69 70 } 70 71 else 71 72 { 72 dt->createDataOutput<CNc4DataOutput>( );73 dt->createDataOutput<CNc4DataOutput>(CMPIManager::GetCommWorld()); 73 74 } 74 75 } -
XMLIO_V2/dev/common/src/xmlio/fortran/icdate.cpp
r274 r278 30 30 (CObjectFactory::GetCurrentContextId()); 31 31 boost::shared_ptr<xmlioserver::data::CDataTreatment> dtreat = context->getDataTreatment(); 32 dtreat->set_timestep(dur); 32 if (dtreat.get() != 0) 33 { 34 dtreat->set_timestep(dur); 35 } 36 else 37 { 38 context->solveCalendar(); 39 context->timestep.setValue(dur.toString()); 40 context->getCalendar()->setTimeStep(dur); 41 } 33 42 } 34 43 catch (xmlioserver::CException & exc) -
XMLIO_V2/dev/common/src/xmlio/group_factory.hpp
r219 r278 10 10 #include "object_factory.hpp" 11 11 #include "group_template.hpp" 12 #include "xml_parser.hpp" 12 13 13 14 namespace xmlioserver -
XMLIO_V2/dev/common/src/xmlio/group_parser.hpp
r219 r278 13 13 14 14 StdString name = node.getElementName(); 15 xml::THashAttributes attributes = node.getAttributes(); 15 16 if (withAttr) 17 { 16 18 CGroupTemplate<U, V, W>::SuperClass::parse(node); 19 if (attributes.end() != attributes.find("src")) 20 { 21 StdIFStream ifs ( attributes["src"].c_str() , StdIFStream::in ); 22 if (!ifs.good()) 23 ERROR("CGroupTemplate<U, V, W>::parse(xml::CXMLNode & node, bool withAttr)", 24 << "[ filename = " << attributes["src"] << " ] Bad xml stream !"); 25 xml::CXMLParser::ParseInclude(ifs, *this); 26 } 27 } 17 28 18 29 // PARSING POUR GESTION DES ENFANTS 19 xml::THashAttributes attributes;20 30 boost::shared_ptr<V> group_ptr = (this->hasId()) 21 31 ? CObjectFactory::GetObject<V>(this->getId()) … … 61 71 << "\' ne peut contenir qu'un objet de type \'" << V::GetName() 62 72 << "\' ou de type \'" << U::GetName() 63 << "\' !");73 << "\' (reçu : " << name << ") !"); 64 74 65 75 } while (node.goToNextElement()); -
XMLIO_V2/dev/common/src/xmlio/main_server.cpp
r274 r278 7 7 #include "client.hpp" 8 8 #include "server.hpp" 9 9 extern "C" 10 { 11 void xios_dtreatment_start(tree::CContext * context_hdl, int filetype, int comm_client_server, int comm_server); 12 void xios_set_timestep(double ts_year, double ts_month, double ts_day, 13 double ts_hour, double ts_minute, double ts_second); 14 void xios_write_data_k83(const char * fieldid, int fieldid_size, double * data_k8, int data_Xsize, int data_Ysize, int data_Zsize); 15 void xios_update_calendar(int step); 16 } 10 17 // Point d'entrée du programme principal 11 18 … … 15 22 { 16 23 MPIComm comm_client, comm_client_server, comm_server; 17 comm::CMPIManager::Initialise(&argc, &argv); // < seulement en mode connecté 18 19 CTreeManager::ParseFile ("test/iodef_simple_test.xml"); 20 CTreeManager::PrintTreeToFile("wk/def/test.xml"); 21 22 comm::CMPIManager::Finalize(); // < seulement en mode connecté 23 24 //CXIOSManager::Initialise (CXIOSManager::CLIENT_SERVER, &argc, &argv); 25 //CMPIManager::DispatchClient(true, comm_client, comm_client_server, comm_server); 26 //CXIOSManager::RunServer("Nemo", comm_client_server, comm_server); 27 //CXIOSManager::Finalize (); 24 CXIOSManager::Initialise (CXIOSManager::CLIENT_SERVER, &argc, &argv); 25 CMPIManager::DispatchClient(true, comm_client, comm_client_server, comm_server); 26 CXIOSManager::RunServer("Nemo", comm_client_server, comm_server); 27 CXIOSManager::Finalize (); 28 28 } 29 29 catch (CException & exc) -
XMLIO_V2/dev/common/src/xmlio/manager/xios_manager.cpp
r274 r278 27 27 { 28 28 if (CXIOSManager::Type != CLIENT) 29 29 30 { 30 31 // Finalisation de la biliothÚque MPI si nécessaire … … 53 54 { 54 55 using namespace comm; 56 CXIOSManager::Comm_Client_Server = comm_client_server; 57 CXIOSManager::Comm_Server = comm_server; 58 CXIOSManager::Status = LOC_SERVER; 55 59 56 60 // Reconstruction de l'arborescence d'objet à l'aide des données envoyées par chacun des … … 67 71 StdString main_data_tree = clientBuffer[0]->getString(0); 68 72 tree::CTreeManager::FromBinary(main_data_tree); 69 std::cout << "main_data_tree" << main_data_tree.size() << std::endl;70 73 71 74 // Obtention des sous-domaines clients. … … 156 159 using namespace comm; 157 160 typedef std::pair<StdString, XIOSClient> StdPairStrClient; 161 CXIOSManager::Comm_Client_Server = comm_client_server; 162 CXIOSManager::Comm_Server = comm_client_server; 158 163 159 164 CXIOSManager::ShowInformation_CS(comm_client_server); … … 244 249 if (launch) 245 250 { 246 CXIOSManager::Status = LOC_CLIENT_SERVER; 251 CXIOSManager::Status = LOC_CLIENT_SERVER; 252 CXIOSManager::Comm_Server = comm_client; 247 253 (CXIOSManager::Clients.begin()->second.entry) 248 254 (comm_client, comm_client, comm_client); -
XMLIO_V2/dev/common/src/xmlio/manager/xios_manager.hpp
r274 r278 55 55 static StdString GetClientName(void); 56 56 57 p rotected:57 public : 58 58 59 59 static StdSize GetNbClient(void); … … 63 63 static StdSize GetNbLocServer(const StdString & clientName = CXIOSManager::ClientName); 64 64 65 p rivate:65 public : 66 66 67 67 /// Information /// -
XMLIO_V2/dev/common/src/xmlio/node/context.cpp
r274 r278 8 8 9 9 #include "calendar_type.hpp" 10 #include "duration.hpp" 10 11 11 12 #include "data_treatment.hpp" … … 82 83 << "Impossible de définir un calendrier (un attribut est manquant)."); 83 84 84 #define DECLARE_CALENDAR(MType , mtype) \ 85 if (calendar_type.getValue().compare(#mtype) == 0) \ 86 { \ 87 this->calendar = boost::shared_ptr<date::CCalendar> \ 88 (new date::C##MType##Calendar(start_date.getValue())); \ 89 return; \ 85 #define DECLARE_CALENDAR(MType , mtype) \ 86 if (calendar_type.getValue().compare(#mtype) == 0) \ 87 { \ 88 this->calendar = boost::shared_ptr<date::CCalendar> \ 89 (new date::C##MType##Calendar(start_date.getValue())); \ 90 if (!this->timestep.isEmpty()) \ 91 this->calendar->setTimeStep \ 92 (date::CDuration::FromString(this->timestep.getValue())); \ 93 return; \ 90 94 } 91 95 #include "calendar_type.conf" … … 103 107 104 108 // PARSING POUR GESTION DES ENFANTS 105 xml::THashAttributes attributes; 109 xml::THashAttributes attributes = node.getAttributes(); 110 111 if (attributes.end() != attributes.find("src")) 112 { 113 StdIFStream ifs ( attributes["src"].c_str() , StdIFStream::in ); 114 if (!ifs.good()) 115 ERROR("CContext::parse(xml::CXMLNode & node)", 116 << "[ filename = " << attributes["src"] << " ] Bad xml stream !"); 117 xml::CXMLParser::ParseInclude(ifs, *this); 118 } 106 119 107 120 if (node.getElementName().compare(CContext::GetName())) -
XMLIO_V2/dev/common/src/xmlio/node/domain.cpp
r274 r278 20 20 , isChecked(false), local_mask(new CArray<int, 2>(boost::extents[0][0])), relFiles() 21 21 , ibegin_sub(), iend_sub(), jbegin_sub(), jend_sub() 22 , ibegin_zoom_sub(), jbegin_zoom_sub() 22 , ibegin_zoom_sub(), jbegin_zoom_sub(), ni_zoom_sub(), nj_zoom_sub() 23 23 , lonvalue_sub(), latvalue_sub() 24 24 { /* Ne rien faire de plus */ } … … 28 28 , isChecked(false), local_mask(new CArray<int, 2>(boost::extents[0][0])), relFiles() 29 29 , ibegin_sub(), iend_sub(), jbegin_sub(), jend_sub() 30 , ibegin_zoom_sub(), jbegin_zoom_sub() 30 , ibegin_zoom_sub(), jbegin_zoom_sub(),ni_zoom_sub(), nj_zoom_sub() 31 31 , lonvalue_sub(), latvalue_sub() 32 32 { /* Ne rien faire de plus */ } … … 100 100 this->ibegin_zoom_sub.push_back(this->zoom_ibegin_loc.getValue()); 101 101 this->jbegin_zoom_sub.push_back(this->zoom_jbegin_loc.getValue()); 102 this->ni_zoom_sub.push_back(this->zoom_ni_loc.getValue()); 103 this->nj_zoom_sub.push_back(this->zoom_nj_loc.getValue()); 102 104 103 105 this->latvalue_sub.push_back(this->latvalue.getValue()); … … 151 153 (nj_glo.isEmpty() || nj_glo.getValue() <= 0 )) 152 154 { 153 abort();154 155 ERROR("CDomain::checkAttributes(void)", 155 156 << "[ Id = " << this->getId() << " ] " … … 454 455 for (int j = 0; j < zoom_nj_client; j++) 455 456 { 456 (*lonvalue_temp)[i + j * zoom_ni_client] = (*lonvalue_)[(i + zoom_ibegin_client -1)+(j + zoom_jbegin_client -1)*ni.getValue()]; 457 (*latvalue_temp)[i + j * zoom_ni_client] = (*latvalue_)[(i + zoom_ibegin_client -1)+(j + zoom_jbegin_client -1)*ni.getValue()]; 457 (*lonvalue_temp)[i + j * zoom_ni_client] = 458 (*lonvalue_)[(i + zoom_ibegin_client -1)+(j + zoom_jbegin_client -1)*ni.getValue()]; 459 (*latvalue_temp)[i + j * zoom_ni_client] = 460 (*latvalue_)[(i + zoom_ibegin_client -1)+(j + zoom_jbegin_client -1)*ni.getValue()]; 458 461 } 459 462 } … … 488 491 ARRAY_CREATE(latvalue_temp, double, 1, [0]); 489 492 490 const int ibegin_serv = ibegin.getValue(), 491 jbegin_serv = jbegin.getValue(), 492 zoom_ni_serv = zoom_ni_loc.getValue(), 493 zoom_nj_serv = zoom_nj_loc.getValue(); 493 const int ibegin_serv = ibegin.getValue(), 494 jbegin_serv = jbegin.getValue(), 495 zoom_ni_serv = zoom_ni_loc.getValue(), 496 zoom_nj_serv = zoom_nj_loc.getValue(), 497 ibegin_zoom_srv = zoom_ibegin_loc.getValue(), 498 jbegin_zoom_srv = zoom_jbegin_loc.getValue(); 494 499 495 500 /*std::cout << "Rang du serveur :" << comm::CMPIManager::GetCommRank() << std::endl … … 498 503 << "Zoom_loc begin : " << zoom_ibegin_loc << ", " << zoom_jbegin_loc << std::endl 499 504 << "Zoom_loc size : " << zoom_ni_loc << ", " << zoom_nj_loc << std::endl;*/ 500 501 502 ARRAY(double, 1) lonvalue_ = this->lonvalue.getValue(),503 latvalue_ = this->latvalue.getValue();504 505 505 506 if (this->data_dim.getValue() == 2) 506 507 { 507 StdSize dm = zoom_ni_serv * zoom_nj_serv; 508 StdSize dn = this->ni.getValue() * this->nj.getValue(); 509 510 lonvalue_->resize(boost::extents[dn]); 511 latvalue_->resize(boost::extents[dn]); 508 StdSize dm = zoom_ni_serv * zoom_nj_serv; 509 512 510 lonvalue_temp->resize(boost::extents[dm]); 513 511 latvalue_temp->resize(boost::extents[dm]); … … 515 513 for (StdSize k = 0; k < lonvalue_sub.size(); k++) 516 514 { 517 int l = 0;518 515 ARRAY(double, 1) lonvalue_loc = this->lonvalue_sub[k], 519 516 latvalue_loc = this->latvalue_sub[k]; 520 const int ibegin_loc = ibegin_sub[k], iend_loc = iend_sub[k], 521 jbegin_loc = jbegin_sub[k], jend_loc = jend_sub[k]; 517 const int zoom_ibegin_cl = ibegin_zoom_sub[k], zoom_ni_cl = ni_zoom_sub[k], 518 zoom_jbegin_cl = jbegin_zoom_sub[k], zoom_nj_cl = nj_zoom_sub[k], 519 ni_cl = iend_sub[k] - ibegin_sub[k] + 1; 522 520 523 for (int i = ibegin_loc - ibegin_serv; i < (iend_loc - ibegin_serv + 1); i++)521 for (int i = 0; i < zoom_ni_cl; i++) 524 522 { 525 for (int j = jbegin_loc - jbegin_serv; j < (jend_loc - jbegin_serv + 1); j++)523 for (int j = 0; j < zoom_nj_cl; j++) 526 524 { 527 (*lonvalue_)[i + j * this->ni.getValue()] = (*lonvalue_loc)[l]; // erreur 528 (*latvalue_)[i + j * this->ni.getValue()] = (*latvalue_loc)[l++]; // erreur 525 int ii = i /*- (ibegin_serv - 1)*/ + (zoom_ibegin_cl - 1) - (ibegin_zoom_srv - 1); 526 int jj = j /*- (jbegin_serv - 1)*/ + (zoom_jbegin_cl - 1) - (jbegin_zoom_srv - 1); 527 (*lonvalue_temp)[ii + jj * zoom_ni_serv] = 528 (*lonvalue_loc)[i + j * zoom_ni_cl]; 529 (*latvalue_temp)[ii + jj * zoom_ni_serv] = 530 (*latvalue_loc)[i + j * zoom_ni_cl]; 529 531 } 530 532 } … … 535 537 else 536 538 { 537 lonvalue_->resize(boost::extents[this->ni.getValue()]);538 latvalue_->resize(boost::extents[this->nj.getValue()]);539 539 lonvalue_temp->resize(boost::extents[zoom_ni_serv]); 540 540 latvalue_temp->resize(boost::extents[zoom_nj_serv]); … … 542 542 for (StdSize k = 0; k < lonvalue_sub.size(); k++) 543 543 { 544 int l = 0;545 544 ARRAY(double, 1) lonvalue_loc = this->lonvalue_sub[k], 546 545 latvalue_loc = this->latvalue_sub[k]; 547 const int ibegin_loc = ibegin_sub[k], iend_loc = iend_sub[k],548 jbegin_loc = jbegin_sub[k], jend_loc = jend_sub[k];546 const int zoom_ibegin_cl = ibegin_zoom_sub[k], zoom_ni_cl = ni_zoom_sub[k], 547 zoom_jbegin_cl = jbegin_zoom_sub[k], zoom_nj_cl = nj_zoom_sub[k]; 549 548 550 for (int i = ibegin_loc - ibegin_serv; i < (iend_loc - ibegin_loc + 1); i++) 551 (*lonvalue_)[i] = (*lonvalue_loc)[l++]; 549 for (int i = 0; i < zoom_ni_cl; i++) 550 (*lonvalue_temp)[i /*- (ibegin_serv - 1)*/ + (zoom_ibegin_cl - 1) - (ibegin_zoom_srv - 1)] = 551 (*lonvalue_loc)[i]; 552 552 553 for (int j = jbegin_loc - jbegin_serv; j < (jend_loc - jbegin_loc + 1); j++) 554 (*latvalue_)[j] = (*latvalue_loc)[l++]; 553 for (int j = 0; j < zoom_nj_cl; j++) 554 (*latvalue_temp)[j /*- (jbegin_serv - 1)*/ + (zoom_jbegin_cl - 1) - (jbegin_zoom_srv - 1)] = 555 (*latvalue_loc)[j]; 555 556 } 556 557 this->lonvalue.setValue(lonvalue_temp); -
XMLIO_V2/dev/common/src/xmlio/node/domain.hpp
r274 r278 113 113 114 114 std::vector<int> ibegin_sub, iend_sub, jbegin_sub, jend_sub; 115 std::vector<int> ibegin_zoom_sub, jbegin_zoom_sub ;115 std::vector<int> ibegin_zoom_sub, jbegin_zoom_sub, ni_zoom_sub, nj_zoom_sub; 116 116 std::vector<ARRAY(double, 1)> lonvalue_sub, latvalue_sub; 117 117 -
XMLIO_V2/dev/common/src/xmlio/node/field.cpp
r266 r278 47 47 48 48 bool CField::updateDataServer 49 (const date::CDate & currDate, const std::deque<ARRAY(double, 1)> storedClient) 50 { 51 if ((*last_operation + freq_operation) >= currDate) 52 { 53 ARRAY_CREATE(input, double, 1, [0]); 54 this->grid->inputFieldServer(storedClient, input); 49 (const date::CDate & currDate, 50 const std::deque<ARRAY(double, 1)> storedClient) 51 { 52 const date::CDate opeDate = *last_operation + freq_operation; 53 const date::CDate writeDate = *last_Write + freq_write; 54 55 if (opeDate <= currDate) 56 { 57 if (this->data->num_elements() != this->grid->storeIndex[0]->num_elements()) 58 { 59 this->data->resize(boost::extents[this->grid->storeIndex[0] ->num_elements()]); 60 } 61 ARRAY_CREATE(input, double, 1, [this->data->num_elements()]); 62 this->grid->inputFieldServer(storedClient, input); 55 63 (*this->foperation)(input); 56 64 *last_operation = currDate; 57 65 } 58 59 if ((*last_Write + freq_write) >= currDate) 60 { 61 *last_Write = currDate; 62 return (true); 66 if (writeDate < (currDate + freq_operation)) 67 { 68 this->foperation->final(); 69 this->incrementNStep(); 70 *last_Write = writeDate; 71 return (true); 63 72 } 64 73 return (false); … … 232 241 << "Impossible de définir une opération pour le champ !"); 233 242 } 243 244 CDuration freq_offset_ = NoneDu; 245 if (!freq_offset.isEmpty()) 246 { 247 freq_offset_ = CDuration::FromString(freq_offset.getValue()); 248 } 249 else 250 { 251 freq_offset.setValue(NoneDu.toString()); 252 } 234 253 235 254 if (CXIOSManager::GetStatus() == CXIOSManager::LOC_SERVER) … … 245 264 this->foperation = 246 265 boost::shared_ptr<func::CFunctor>(new CInstant(this->data)); 266 267 const CDuration toffset = this->freq_operation - freq_offset_ - _context->getCalendar()->getTimeStep(); 268 *this->last_operation = *this->last_operation - toffset; 247 269 } 248 270 else 249 { 250 CDuration freq_offset_ = NoneDu; 251 if (!freq_offset.isEmpty()) 252 { 253 freq_offset_ = CDuration::FromString(freq_offset.getValue()); 254 } 255 else 256 { 257 freq_offset.setValue(NoneDu.toString()); 258 } 259 271 { 260 272 this->freq_operation = CDuration::FromString(freq_op.getValue()); 261 273 this->freq_write = CDuration::FromString(this->file->output_freq.getValue()); … … 264 276 this->last_operation = boost::shared_ptr<xmlioserver::date::CDate> 265 277 (new date::CDate(_context->getCalendar()->getInitDate())); 278 266 279 const CDuration toffset = this->freq_operation - freq_offset_ - _context->getCalendar()->getTimeStep(); 267 *this->last_operation = *this->last_operation - toffset;280 *this->last_operation = *this->last_operation - toffset; 268 281 269 282 #define DECLARE_FUNCTOR(MType, mtype) \ -
XMLIO_V2/dev/common/src/xmlio/node/field.hpp
r268 r278 170 170 { 171 171 //std::cout << "> " << currDate << ": Operation du champs" << this->getBaseFieldId() << std::endl; 172 173 172 if (this->data->num_elements() != this->grid->storeIndex[0]->num_elements()) 174 173 { -
XMLIO_V2/dev/common/src/xmlio/node/grid.cpp
r274 r278 463 463 ARRAY(int, 1) out_j_index_cl = this->out_j_index[i + 1]; 464 464 ARRAY(int, 1) out_l_index_cl = this->out_l_index[i + 1]; 465 466 const int ibegin_cl = ibegin[i]; 467 const int jbegin_cl = jbegin[i]; 468 465 469 466 int ibegin_zoom_cl = ibegin[i]; //ibegin_zoom[i]; 470 467 int jbegin_zoom_cl = jbegin[i]; //jbegin_zoom[i]; … … 480 477 (*storeIndex_srv)[n] = (*storeIndex_cl)[m]; // Faux mais inutile dans le cas serveur. 481 478 (*out_i_index_srv)[n] = (*out_i_index_cl)[m] 482 /*+ (ibegin_cl - 1) */ - (ibegin_srv - 1) + (ibegin_zoom_cl - 1) - (ibegin_zoom_srv - 1);479 /*+ (ibegin_cl - 1) - (ibegin_srv - 1)*/ + (ibegin_zoom_cl - 1) - (ibegin_zoom_srv - 1); 483 480 (*out_j_index_srv)[n] = (*out_j_index_cl)[m] 484 /*+ (jbegin_cl - 1) */ - (jbegin_srv - 1)+ (jbegin_zoom_cl - 1) - (jbegin_zoom_srv - 1);481 /*+ (jbegin_cl - 1) - (jbegin_srv - 1)*/ + (jbegin_zoom_cl - 1) - (jbegin_zoom_srv - 1); 485 482 (*out_l_index_srv)[n] = (*out_l_index_cl)[m]; 486 483 } … … 532 529 this->out_i_index[0] = out_i_index_srv; 533 530 this->out_j_index[0] = out_j_index_srv; 534 this->out_l_index[0] = out_l_index_srv; 535 536 this->storeIndex.resize(1); 537 this->out_i_index.resize(1); 538 this->out_j_index.resize(1); 539 this->out_l_index.resize(1); 540 531 this->out_l_index[0] = out_l_index_srv; 541 532 } 542 533 … … 552 543 << "Les données d'un client sont manquantes !") ; 553 544 if (storedServer.get() != NULL) 554 storedServer->resize(boost::extents[this->storeIndex .size()-1]);545 storedServer->resize(boost::extents[this->storeIndex[0]->num_elements()]); 555 546 else 556 ARRAY_ASSIGN(storedServer, double, 1, [this->storeIndex .size()-1]);547 ARRAY_ASSIGN(storedServer, double, 1, [this->storeIndex[0]->num_elements()]); 557 548 558 549 for (StdSize i = 0, n = 0; i < storedClient.size(); i++) -
XMLIO_V2/dev/common/src/xmlio/output/nc4_data_output.cpp
r274 r278 8 8 #include "file.hpp" 9 9 #include "calendar.hpp" 10 #include "xios_manager.hpp" 11 #include "context.hpp" 10 12 11 13 namespace xmlioserver … … 75 77 StdString lonid = StdString("lon_").append(domid); 76 78 StdString latid = StdString("lat_").append(domid); 77 StdString lonid_loc = StdString("lon_").append(domid).append("_local"); 78 StdString latid_loc = StdString("lat_").append(domid).append("_local"); 79 StdString lonid_loc = (comm::CMPIManager::GetCommSize(CXIOSManager::Comm_Server) > 1) 80 ? StdString("lon_").append(domid).append("_local") 81 : lonid; 82 StdString latid_loc = (comm::CMPIManager::GetCommSize(CXIOSManager::Comm_Server) > 1) 83 ? StdString("lat_").append(domid).append("_local") 84 : latid; 79 85 StdString maskid = StdString("mask_").append(domid).append("_local"); 80 86 … … 84 90 bool isCurvilinear = (domain->lonvalue.getValue()->size() == ssize); 85 91 86 SuperClassWriter::addDimension(lonid, domain->ni_glo.getValue()); 87 SuperClassWriter::addDimension(latid, domain->nj_glo.getValue()); 92 if (comm::CMPIManager::GetCommSize(CXIOSManager::Comm_Server) > 1) 93 { 94 SuperClassWriter::addDimension(lonid, domain->zoom_ni.getValue()); 95 SuperClassWriter::addDimension(latid, domain->zoom_nj.getValue()); 96 } 88 97 89 98 if (isCurvilinear) … … 104 113 SuperClassWriter::addDimension(lonid_loc, domain->zoom_ni_loc.getValue()); 105 114 SuperClassWriter::addDimension(latid_loc, domain->zoom_nj_loc.getValue()); 106 this->writeLocalAttributes(domain->zoom_ibegin_loc.getValue(), 107 domain->zoom_ni_loc.getValue(), 108 domain->zoom_jbegin_loc.getValue(), 109 domain->zoom_nj_loc.getValue(), 110 domid); 115 if (comm::CMPIManager::GetCommSize(CXIOSManager::Comm_Server) > 1) 116 { 117 this->writeLocalAttributes(domain->zoom_ibegin_loc.getValue(), 118 domain->zoom_ni_loc.getValue(), 119 domain->zoom_jbegin_loc.getValue(), 120 domain->zoom_nj_loc.getValue(), 121 domid); 122 } 123 111 124 if (isCurvilinear) 112 125 { … … 128 141 dim0.push_back(lonid_loc); 129 142 130 SuperClassWriter::addVariable(maskid, NC_INT, dim0); 131 132 this->writeMaskAttributes(maskid, 133 domain->data_dim.getValue()/*, 134 domain->data_ni.getValue(), 135 domain->data_nj.getValue(), 136 domain->data_ibegin.getValue(), 137 domain->data_jbegin.getValue()*/); 143 if (comm::CMPIManager::GetCommSize(CXIOSManager::Comm_Server) > 1) 144 { 145 SuperClassWriter::addVariable(maskid, NC_INT, dim0); 146 147 this->writeMaskAttributes(maskid, 148 domain->data_dim.getValue()/*, 149 domain->data_ni.getValue(), 150 domain->data_nj.getValue(), 151 domain->data_ibegin.getValue(), 152 domain->data_jbegin.getValue()*/); 153 } 138 154 139 155 //SuperClassWriter::setDefaultValue(maskid, &dvm); … … 142 158 SuperClassWriter::writeData(domain->latvalue.getValue(), latid, true, 0); 143 159 SuperClassWriter::writeData(domain->lonvalue.getValue(), lonid, true, 0); 144 SuperClassWriter::writeData(mask, maskid); 160 if (comm::CMPIManager::GetCommSize(CXIOSManager::Comm_Server) > 1) 161 SuperClassWriter::writeData(mask, maskid); 145 162 SuperClassWriter::definition_start(); 146 163 … … 169 186 switch (SuperClass::type) 170 187 { 188 case (ONE_FILE) : 171 189 case (MULTI_FILE) : 172 190 { … … 218 236 StdString lonid = StdString("lon_").append(domid); 219 237 StdString latid = StdString("lat_").append(domid); 220 StdString lonid_loc = StdString("lon_").append(domid).append("_local"); 221 StdString latid_loc = StdString("lat_").append(domid).append("_local"); 238 StdString lonid_loc = (comm::CMPIManager::GetCommSize(CXIOSManager::Comm_Server) > 1) 239 ? StdString("lon_").append(domid).append("_local") 240 : lonid; 241 StdString latid_loc = (comm::CMPIManager::GetCommSize(CXIOSManager::Comm_Server) > 1) 242 ? StdString("lat_").append(domid).append("_local") 243 : latid; 222 244 StdString fieldid = (!field->name.isEmpty()) 223 245 ? field->name.getValue() : field->getBaseFieldReference()->getId(); … … 376 398 ? field->name.getValue() 377 399 : field->getBaseFieldReference()->getId(); 400 boost::shared_ptr<xmlioserver::tree::CContext> context = 401 CObjectFactory::GetObject<xmlioserver::tree::CContext> 402 (CObjectFactory::GetCurrentContextId()); 403 404 StdOStringStream oss; 405 oss << "time_" << field->operation.getValue() 406 << "_" << field->getRelFile()->output_freq.getValue(); 407 378 408 ARRAY(double, 1) field_data = field->getData(); 409 ARRAY_CREATE(time_data, double, 1, [1]); 410 (*time_data)[0] = date::Time(*field->getLastWriteDate()); 379 411 380 412 if (grid->hasAxis()) // 3D … … 383 415 grid->outputField(field_data, field_data3D); 384 416 SuperClassWriter::writeData(field_data3D, fieldid, true, field->getNStep()-1); 417 SuperClassWriter::writeData(time_data, oss.str(), true, field->getNStep()-1); 385 418 386 419 } … … 390 423 grid->outputField(field_data, field_data2D); 391 424 SuperClassWriter::writeData(field_data2D, fieldid, true, field->getNStep()-1); 425 SuperClassWriter::writeData(time_data, oss.str(), true, field->getNStep()-1); 392 426 } 393 427 } -
XMLIO_V2/dev/common/src/xmlio/server.cpp
r274 r278 33 33 boost::shared_ptr<CServer> CServer::CreateServer(MPIComm comm_client_server) 34 34 { 35 if (CServer::Server.get() != NULL)35 if (CServer::Server.get() == NULL) 36 36 CServer::Server = boost::shared_ptr<CServer>(new CServer(comm_client_server)); 37 37 return (CServer::GetServer()); … … 140 140 void CServer::initialize(void) // manager 0, method 0 141 141 { 142 // Ne rien faire de plus142 std::cout << "initialize" << std::endl; 143 143 } 144 144 … … 147 147 void CServer::finalize(void) // manager 0, method 1 148 148 { 149 std::cout << "finalize" << std::endl; 149 150 comm::CMPIManager::Barrier(); 150 151 } -
XMLIO_V2/dev/common/src/xmlio/xml_node.cpp
r274 r278 11 11 CXMLNode::CXMLNode(rapidxml::xml_node<char> * const root) 12 12 : node(root) 13 , level(0) 13 14 { /* Ne rien faire de plus */ } 14 15 … … 48 49 else if (nextElement->type() == rapidxml::node_element) 49 50 { 50 node = nextElement; 51 node = nextElement; 52 level++; 51 53 return (!retvalue); 52 54 } … … 59 61 { 60 62 bool retvalue = false; 61 if (!(this->getElementName().compare(CXMLNode::RootName)) )63 if (!(this->getElementName().compare(CXMLNode::RootName)) || (level == 0)) 62 64 return (retvalue); 63 65 node = node->parent(); 66 level--; 64 67 return (!retvalue); 65 68 } -
XMLIO_V2/dev/common/src/xmlio/xml_node.hpp
r274 r278 46 46 47 47 rapidxml::xml_node<char> * node; 48 int level; 48 49 49 50 static StdString RootName; -
XMLIO_V2/dev/common/src/xmlio/xml_parser.cpp
r219 r278 1 1 #include "xml_parser.hpp" 2 3 #include "context.hpp" 2 4 3 5 #include "attribute_template_impl.hpp" … … 12 14 13 15 void CXMLParser::ParseFile(const StdString & filename) 14 { StdIFStream ifs ( filename.c_str() , StdIFStream::in ); 15 CXMLParser::ParseStream(ifs); } 16 { 17 StdIFStream ifs ( filename.c_str() , StdIFStream::in ); 18 CXMLParser::ParseStream(ifs); 19 } 16 20 17 21 void CXMLParser::ParseString(const StdString & xmlContent) … … 86 90 } 87 91 } 92 88 93 }// namespace xml 89 94 } // namespace xmlioserver -
XMLIO_V2/dev/common/src/xmlio/xml_parser.hpp
r219 r278 4 4 /// xmlioserver headers /// 5 5 #include "xmlioserver_spl.hpp" 6 #include "exception.hpp" 6 7 #include "xml_node.hpp" 7 #include "context.hpp" 8 8 9 9 10 namespace xmlioserver … … 19 20 static void ParseString(const StdString & xmlContent); 20 21 static void ParseStream(StdIStream & stream); 22 template <class T> 23 static inline void ParseInclude(StdIStream & stream, T & object); 21 24 22 25 }; //class CXMLParser 26 27 template <class T> 28 void CXMLParser::ParseInclude(StdIStream & stream, T& object) 29 { 30 StdOStringStream oss; 31 while(!stream.eof() && !stream.fail ()) 32 oss.put(stream.get()); 33 try 34 { 35 const StdString xmlcontent( oss.str(), 0, oss.str().size()-1 ); 36 rapidxml::xml_document<char> doc; 37 doc.parse<0>(const_cast<char*>(xmlcontent.c_str())); 38 CXMLNode node(doc.first_node()); 39 object.parse(node); 40 } 41 catch (rapidxml::parse_error & exc) 42 { 43 ERROR("CXMLParser::ParseStream(StdIStream & stream)", 44 << "RapidXML error : " << exc.what() << " !"); 45 } 46 } 23 47 24 48 }// namespace xml
Note: See TracChangeset
for help on using the changeset viewer.