Changeset 343 for XIOS/trunk
- Timestamp:
- 03/30/12 17:06:38 (12 years ago)
- Location:
- XIOS/trunk/src
- Files:
-
- 31 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/trunk/src/calendar.cpp
r335 r343 6 6 namespace xios 7 7 { 8 namespace date9 {10 8 /// ////////////////////// Définitions ////////////////////// /// 11 9 CCalendar::CCalendar(void) … … 153 151 ///---------------------------------------------------------------- 154 152 155 } // namespace date156 153 } // namespace xios -
XIOS/trunk/src/calendar.hpp
r335 r343 9 9 namespace xios 10 10 { 11 namespace date12 {13 11 /// ////////////////////// Déclarations ////////////////////// /// 14 12 … … 98 96 99 97 }; // class CCalendar 100 } // namespace date101 98 102 99 } // namespace xios -
XIOS/trunk/src/calendar_util.cpp
r335 r343 3 3 namespace xios 4 4 { 5 namespace date6 {7 5 /// ////////////////////// Définitions ////////////////////// /// 8 6 … … 172 170 ///---------------------------------------------------------------- 173 171 174 } // namespace date175 172 } // namespace xios 176 173 -
XIOS/trunk/src/calendar_util.hpp
r335 r343 9 9 namespace xios 10 10 { 11 namespace date12 {13 11 /// ////////////////////// Déclarations ////////////////////// /// 14 12 … … 35 33 ///--------------------------------------------------------------- 36 34 37 } // namespace date38 35 } // namespace xios 39 36 -
XIOS/trunk/src/data_output.cpp
r337 r343 77 77 boost::shared_ptr<tree::CContext> context = 78 78 CObjectFactory::GetObject<tree::CContext>(CObjectFactory::GetCurrentContextId()); 79 boost::shared_ptr< date::CCalendar> calendar = context->getCalendar();79 boost::shared_ptr<CCalendar> calendar = context->getCalendar(); 80 80 81 81 this->writeField_(field); -
XIOS/trunk/src/data_output.hpp
r337 r343 51 51 virtual void writeAxis_ (const boost::shared_ptr<tree::CAxis> axis) = 0; 52 52 virtual void writeTimeAxis_ (const boost::shared_ptr<tree::CField> field, 53 const boost::shared_ptr< date::CCalendar> cal) = 0;53 const boost::shared_ptr<CCalendar> cal) = 0; 54 54 55 55 /// Propriétés protégées /// -
XIOS/trunk/src/date.cpp
r335 r343 10 10 namespace xios 11 11 { 12 namespace date13 {14 12 /// ////////////////////// Définitions ////////////////////// /// 15 13 CDate::CDate(const CCalendar& calendar) … … 224 222 ///--------------------------------------------------------------- 225 223 226 } // namespace date227 224 } // namespace xios -
XIOS/trunk/src/date.hpp
r335 r343 9 9 namespace xios 10 10 { 11 namespace date12 {13 11 /// ////////////////////// Déclarations ////////////////////// /// 14 12 class CCalendar; … … 72 70 }; // class CDate; 73 71 74 } // namespace date75 72 } // namespace xios 76 73 -
XIOS/trunk/src/date/allleap.cpp
r335 r343 3 3 namespace xios 4 4 { 5 namespace date6 {7 5 /// ////////////////////// Définitions ////////////////////// /// 8 6 … … 38 36 39 37 ///-------------------------------------------------------------- 40 } // namespace date41 38 } // namespace xmlioserver 42 39 -
XIOS/trunk/src/date/allleap.hpp
r335 r343 8 8 namespace xios 9 9 { 10 namespace date11 {12 10 /// ////////////////////// Déclarations ////////////////////// /// 13 11 class CAllLeapCalendar : public CCalendar … … 37 35 }; // class CAllLeapCalendar 38 36 39 } // namespace date40 37 } // namespace xmlioserver 41 38 -
XIOS/trunk/src/date/d360.cpp
r335 r343 3 3 namespace xios 4 4 { 5 namespace date6 {7 5 /// ////////////////////// Définitions ////////////////////// /// 8 6 … … 35 33 36 34 ///-------------------------------------------------------------- 37 } // namespace date38 35 } // namespace xmlioserver 39 36 -
XIOS/trunk/src/date/d360.hpp
r335 r343 8 8 namespace xios 9 9 { 10 namespace date11 {12 10 /// ////////////////////// Déclarations ////////////////////// /// 13 11 class CD360Calendar : public CCalendar … … 37 35 }; // class CD360Calendar 38 36 39 } // namespace date40 37 } // namespace xmlioserver 41 38 -
XIOS/trunk/src/date/gregorian.cpp
r335 r343 3 3 namespace xios 4 4 { 5 namespace date6 {7 5 /// ////////////////////// Définitions ////////////////////// /// 8 6 … … 51 49 52 50 ///-------------------------------------------------------------- 53 } // namespace date54 51 } // namespace xmlioserver 55 52 -
XIOS/trunk/src/date/gregorian.hpp
r335 r343 8 8 namespace xios 9 9 { 10 namespace date11 {12 10 /// ////////////////////// Déclarations ////////////////////// /// 13 11 class CGregorianCalendar : public CCalendar … … 37 35 }; // class CGregorianCalendar 38 36 39 } // namespace date40 37 } // namespace xmlioserver 41 38 -
XIOS/trunk/src/date/julian.cpp
r335 r343 3 3 namespace xios 4 4 { 5 namespace date6 {7 5 /// ////////////////////// Définitions ////////////////////// /// 8 6 … … 45 43 46 44 ///-------------------------------------------------------------- 47 } // namespace date48 45 } // namespace xmlioserver -
XIOS/trunk/src/date/julian.hpp
r335 r343 8 8 namespace xios 9 9 { 10 namespace date11 {12 10 /// ////////////////////// Déclarations ////////////////////// /// 13 11 class CJulianCalendar : public CCalendar … … 37 35 }; // class CJulianCalendar 38 36 39 } // namespace date40 37 } // namespace xmlioserver 41 38 -
XIOS/trunk/src/date/noleap.cpp
r335 r343 4 4 namespace xios 5 5 { 6 namespace date7 {8 6 /// ////////////////////// Définitions ////////////////////// /// 9 7 … … 31 29 32 30 ///-------------------------------------------------------------- 33 } // namespace date34 31 } // namespace xmlioserver 35 32 -
XIOS/trunk/src/date/noleap.hpp
r335 r343 8 8 namespace xios 9 9 { 10 namespace date11 {12 10 /// ////////////////////// Déclarations ////////////////////// /// 13 11 class CNoLeapCalendar : public CCalendar … … 35 33 }; // class CNoLeapCalendar 36 34 37 } // namespace date38 35 } // namespace xmlioserver 39 36 -
XIOS/trunk/src/duration.cpp
r335 r343 5 5 namespace xios 6 6 { 7 namespace date8 {9 7 /// ////////////////////// Définitions ////////////////////// /// 10 8 const CDuration Year = {1.0, 0.0, 0.0, 0.0, 0.0, 0.0}, … … 141 139 142 140 143 } // namespace date144 141 } // namespace xios 145 142 -
XIOS/trunk/src/duration.hpp
r335 r343 8 8 namespace xios 9 9 { 10 namespace date11 {12 10 /// ////////////////////// Déclarations ////////////////////// /// 13 11 typedef long long int Time; … … 49 47 ///--------------------------------------------------------------- 50 48 51 } // namespace date52 49 } // namespace xios 53 50 -
XIOS/trunk/src/field_impl.hpp
r335 r343 25 25 { 26 26 shared_ptr<CContext> context=CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId()) ; 27 const date::CDate & currDate = context->getCalendar()->getCurrentDate();28 const date::CDate opeDate = *last_operation + freq_operation;29 const date::CDate writeDate = *last_Write + freq_write;27 const CDate & currDate = context->getCalendar()->getCurrentDate(); 28 const CDate opeDate = *last_operation + freq_operation; 29 const CDate writeDate = *last_Write + freq_write; 30 30 31 31 -
XIOS/trunk/src/interface/c/icdate.cpp
r335 r343 25 25 try 26 26 { 27 date::CDuration dur = {ts_year, ts_month, ts_day, ts_hour, ts_minute, ts_second};27 CDuration dur = {ts_year, ts_month, ts_day, ts_hour, ts_minute, ts_second}; 28 28 boost::shared_ptr<xios::tree::CContext> context = 29 29 xios::CObjectFactory::GetObject<xios::tree::CContext> -
XIOS/trunk/src/node/context.cpp
r335 r343 63 63 //---------------------------------------------------------------- 64 64 65 boost::shared_ptr< date::CCalendar> CContext::getCalendar(void) const65 boost::shared_ptr<CCalendar> CContext::getCalendar(void) const 66 66 { 67 67 return (this->calendar); … … 70 70 //---------------------------------------------------------------- 71 71 72 void CContext::setCalendar(boost::shared_ptr< date::CCalendar> newCalendar)72 void CContext::setCalendar(boost::shared_ptr<CCalendar> newCalendar) 73 73 { 74 74 this->calendar = newCalendar; … … 91 91 { \ 92 92 if (time_origin.isEmpty()) \ 93 this->calendar = boost::shared_ptr< date::CCalendar> \94 (new date::C##MType##Calendar(start_date.getValue())); \95 else this->calendar = boost::shared_ptr< date::CCalendar> \96 (new date::C##MType##Calendar(start_date.getValue(),time_origin.getValue())); \93 this->calendar = boost::shared_ptr<CCalendar> \ 94 (new C##MType##Calendar(start_date.getValue())); \ 95 else this->calendar = boost::shared_ptr<CCalendar> \ 96 (new C##MType##Calendar(start_date.getValue(),time_origin.getValue())); \ 97 97 if (!this->timestep.isEmpty()) \ 98 98 this->calendar->setTimeStep \ 99 ( date::CDuration::FromString(this->timestep.getValue())); \99 (CDuration::FromString(this->timestep.getValue())); \ 100 100 return; \ 101 101 } -
XIOS/trunk/src/node/context.hpp
r335 r343 78 78 79 79 /// Mutateurs /// 80 void setCalendar(boost::shared_ptr< date::CCalendar> newCalendar);80 void setCalendar(boost::shared_ptr<CCalendar> newCalendar); 81 81 void setDataTreatment(boost::shared_ptr<data::CDataTreatment> datat); 82 82 83 83 /// Accesseurs /// 84 boost::shared_ptr< date::CCalendar> getCalendar(void) const;84 boost::shared_ptr<CCalendar> getCalendar(void) const; 85 85 boost::shared_ptr<data::CDataTreatment> getDataTreatment(void) const; 86 86 … … 148 148 public : 149 149 150 boost::shared_ptr< date::CCalendar> calendar;150 boost::shared_ptr<CCalendar> calendar; 151 151 boost::shared_ptr<data::CDataTreatment> datat; 152 152 -
XIOS/trunk/src/node/field.cpp
r335 r343 46 46 47 47 bool CField::updateDataServer 48 (const date::CDate & currDate,48 (const CDate & currDate, 49 49 const std::deque<ARRAY(double, 1)> storedClient) 50 50 { 51 const date::CDate opeDate = *last_operation + freq_operation;52 const date::CDate writeDate = *last_Write + freq_write;51 const CDate opeDate = *last_operation + freq_operation; 52 const CDate writeDate = *last_Write + freq_write; 53 53 54 54 if (opeDate <= currDate) … … 152 152 153 153 shared_ptr<CContext> context=CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId()) ; 154 const date::CDate & currDate = context->getCalendar()->getCurrentDate();155 const date::CDate opeDate = *last_operation_srv + freq_operation_srv;156 const date::CDate writeDate = *last_Write_srv + freq_write_srv;154 const CDate & currDate = context->getCalendar()->getCurrentDate(); 155 const CDate opeDate = *last_operation_srv + freq_operation_srv; 156 const CDate writeDate = *last_Write_srv + freq_write_srv; 157 157 158 158 … … 271 271 //---------------------------------------------------------------- 272 272 273 const date::CDuration & CField::getFreqOperation(void) const273 const CDuration & CField::getFreqOperation(void) const 274 274 { 275 275 return (this->freq_operation); … … 277 277 278 278 //---------------------------------------------------------------- 279 const date::CDuration & CField::getFreqWrite(void) const279 const CDuration & CField::getFreqWrite(void) const 280 280 { 281 281 return (this->freq_write); … … 309 309 //---------------------------------------------------------------- 310 310 311 boost::shared_ptr< date::CDate> CField::getLastWriteDate(void) const311 boost::shared_ptr<CDate> CField::getLastWriteDate(void) const 312 312 { 313 313 return(this->last_Write); … … 316 316 //---------------------------------------------------------------- 317 317 318 boost::shared_ptr< date::CDate> CField::getLastOperationDate(void) const318 boost::shared_ptr<CDate> CField::getLastOperationDate(void) const 319 319 { 320 320 return(this->last_operation); … … 355 355 { 356 356 using namespace func; 357 using namespace date;358 357 359 358 StdString id = this->getBaseFieldReference()->getId(); … … 385 384 this->freq_write_srv = 386 385 CDuration::FromString(this->file->output_freq.getValue()); 387 this->lastlast_Write_srv = boost::shared_ptr< xios::date::CDate>388 (new date::CDate(context->getCalendar()->getInitDate()));389 this->last_Write_srv = boost::shared_ptr< xios::date::CDate>390 (new date::CDate(context->getCalendar()->getInitDate()));391 this->last_operation_srv = boost::shared_ptr< xios::date::CDate>392 (new date::CDate(context->getCalendar()->getInitDate()));386 this->lastlast_Write_srv = boost::shared_ptr<CDate> 387 (new CDate(context->getCalendar()->getInitDate())); 388 this->last_Write_srv = boost::shared_ptr<CDate> 389 (new CDate(context->getCalendar()->getInitDate())); 390 this->last_operation_srv = boost::shared_ptr<CDate> 391 (new CDate(context->getCalendar()->getInitDate())); 393 392 // this->foperation_srv = 394 393 // boost::shared_ptr<func::CFunctor>(new CInstant(this->data_srv)); … … 402 401 this->freq_operation = CDuration::FromString(freq_op.getValue()); 403 402 this->freq_write = CDuration::FromString(this->file->output_freq.getValue()); 404 this->last_Write = boost::shared_ptr< xios::date::CDate>405 (new date::CDate(context->getCalendar()->getInitDate()));406 this->last_operation = boost::shared_ptr< xios::date::CDate>407 (new date::CDate(context->getCalendar()->getInitDate()));403 this->last_Write = boost::shared_ptr<CDate> 404 (new CDate(context->getCalendar()->getInitDate())); 405 this->last_operation = boost::shared_ptr<CDate> 406 (new CDate(context->getCalendar()->getInitDate())); 408 407 409 408 const CDuration toffset = this->freq_operation - freq_offset_ - context->getCalendar()->getTimeStep(); -
XIOS/trunk/src/node/field.hpp
r335 r343 73 73 StdSize getNStep(void) const; 74 74 75 const date::CDuration & getFreqOperation(void) const;76 const date::CDuration & getFreqWrite(void) const;75 const CDuration & getFreqOperation(void) const; 76 const CDuration & getFreqWrite(void) const; 77 77 78 boost::shared_ptr< date::CDate> getLastWriteDate(void) const;79 boost::shared_ptr< date::CDate> getLastOperationDate(void) const;78 boost::shared_ptr<CDate> getLastWriteDate(void) const; 79 boost::shared_ptr<CDate> getLastOperationDate(void) const; 80 80 81 81 boost::shared_ptr<func::CFunctor> getFieldOperation(void) const; … … 93 93 94 94 bool updateDataServer 95 (const date::CDate & currDate,95 (const CDate & currDate, 96 96 const std::deque<ARRAY(double, 1)> storedClient); 97 97 … … 136 136 boost::shared_ptr<CFile> file; 137 137 138 date::CDuration freq_operation, freq_write;139 date::CDuration freq_operation_srv, freq_write_srv;138 CDuration freq_operation, freq_write; 139 CDuration freq_operation_srv, freq_write_srv; 140 140 141 141 StdSize nstep; 142 boost::shared_ptr< date::CDate> last_Write, last_operation;143 boost::shared_ptr< date::CDate> lastlast_Write_srv,last_Write_srv, last_operation_srv;142 boost::shared_ptr<CDate> last_Write, last_operation; 143 boost::shared_ptr<CDate> lastlast_Write_srv,last_Write_srv, last_operation_srv; 144 144 145 145 boost::shared_ptr<func::CFunctor> foperation; -
XIOS/trunk/src/node/file.cpp
r337 r343 130 130 { 131 131 shared_ptr<CContext> context=CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId()) ; 132 date::CDate& currentDate=context->calendar->getCurrentDate() ;132 CDate& currentDate=context->calendar->getCurrentDate() ; 133 133 if (! sync_freq.isEmpty()) 134 134 { … … 145 145 { 146 146 shared_ptr<CContext> context=CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId()) ; 147 date::CDate& currentDate=context->calendar->getCurrentDate() ;148 149 if (! sync_freq.isEmpty()) syncFreq = date::CDuration::FromString(sync_freq.getValue());150 if (! split_freq.isEmpty()) splitFreq = date::CDuration::FromString(split_freq.getValue());151 if (! output_freq.isEmpty()) outputFreq = date::CDuration::FromString(output_freq.getValue());152 lastSync=new date::CDate(currentDate) ;153 lastSplit=new date::CDate(currentDate) ;147 CDate& currentDate=context->calendar->getCurrentDate() ; 148 149 if (! sync_freq.isEmpty()) syncFreq = CDuration::FromString(sync_freq.getValue()); 150 if (! split_freq.isEmpty()) splitFreq = CDuration::FromString(split_freq.getValue()); 151 if (! output_freq.isEmpty()) outputFreq = CDuration::FromString(output_freq.getValue()); 152 lastSync=new CDate(currentDate) ; 153 lastSplit=new CDate(currentDate) ; 154 154 isOpen=false ; 155 155 } … … 166 166 { 167 167 shared_ptr<CContext> context=CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId()) ; 168 date::CDate& currentDate=context->calendar->getCurrentDate() ;168 CDate& currentDate=context->calendar->getCurrentDate() ; 169 169 if (! sync_freq.isEmpty()) 170 170 { … … 183 183 { 184 184 shared_ptr<CContext> context=CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId()) ; 185 date::CDate& currentDate=context->calendar->getCurrentDate() ;185 CDate& currentDate=context->calendar->getCurrentDate() ; 186 186 if (! split_freq.isEmpty()) 187 187 { … … 202 202 { 203 203 shared_ptr<CContext> context=CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId()) ; 204 date::CDate& currentDate=context->calendar->getCurrentDate() ;204 CDate& currentDate=context->calendar->getCurrentDate() ; 205 205 206 206 std::vector<boost::shared_ptr<CField> >::iterator it, end = this->enabledFields.end(); … … 224 224 if (!name_suffix.isEmpty()) oss << name_suffix.getValue(); 225 225 // if (!split_freq.isEmpty()) oss<<"-["<<currentDate.toString()<<"]" ; 226 if (!split_freq.isEmpty()) oss<<"_"<<lastSplit->getStryyyymmdd()<<"-"<< (*lastSplit+(splitFreq-1* date::Second)).getStryyyymmdd();226 if (!split_freq.isEmpty()) oss<<"_"<<lastSplit->getStryyyymmdd()<<"-"<< (*lastSplit+(splitFreq-1*Second)).getStryyyymmdd(); 227 227 bool multifile=true ; 228 228 if (!type.isEmpty()) -
XIOS/trunk/src/node/file.hpp
r337 r343 108 108 void checkFile(void) ; 109 109 void initFile(void) ; 110 date::CDate* lastSync ;111 date::CDate* lastSplit ;112 date::CDuration syncFreq ;113 date::CDuration splitFreq ;114 date::CDuration outputFreq ;110 CDate* lastSync ; 111 CDate* lastSplit ; 112 CDuration syncFreq ; 113 CDuration splitFreq ; 114 CDuration outputFreq ; 115 115 int nbDomain ; 116 116 bool isOpen ; -
XIOS/trunk/src/output/nc4_data_output.cpp
r337 r343 482 482 // ARRAY(double, 1) field_data = field->data_srv; 483 483 ARRAY_CREATE(time_data, double, 1, [1]); 484 if (field->operation.getValue()=="instant") (*time_data)[0] = date::Time(*field->last_Write_srv)485 - date::Time(context->calendar->getTimeOrigin());486 else (*time_data)[0] = ( date::Time(*field->last_Write_srv)+date::Time(*field->lastlast_Write_srv))/2487 - date::Time(context->calendar->getTimeOrigin());484 if (field->operation.getValue()=="instant") (*time_data)[0] = Time(*field->last_Write_srv) 485 -Time(context->calendar->getTimeOrigin()); 486 else (*time_data)[0] = (Time(*field->last_Write_srv)+Time(*field->lastlast_Write_srv))/2 487 -Time(context->calendar->getTimeOrigin()); 488 488 489 489 if (grid->hasAxis()) // 3D … … 562 562 void CNc4DataOutput::writeTimeAxis_ 563 563 (const boost::shared_ptr<tree::CField> field, 564 const boost::shared_ptr< date::CCalendar> cal)564 const boost::shared_ptr<CCalendar> cal) 565 565 { 566 566 StdOStringStream oss; … … 576 576 { 577 577 SuperClassWriter::addVariable(axisid, NC_DOUBLE, dims); 578 date::CDate timeOrigin=cal->getTimeOrigin() ;578 CDate timeOrigin=cal->getTimeOrigin() ; 579 579 // StdOStringStream oss2; 580 580 // oss2<<initDate.getYear()<<"-"<<initDate.getMonth()<<"-"<<initDate.getDay()<<" " -
XIOS/trunk/src/output/nc4_data_output.hpp
r337 r343 48 48 virtual void syncFile_ (void); 49 49 virtual void writeTimeAxis_ (const boost::shared_ptr<tree::CField> field, 50 const boost::shared_ptr< date::CCalendar> cal);50 const boost::shared_ptr<CCalendar> cal); 51 51 52 52 protected : -
XIOS/trunk/src/test/test.cpp
r335 r343 13 13 using namespace boost::gregorian ; 14 14 using namespace xios; 15 using namespace date ;16 15 17 16 int main(void)
Note: See TracChangeset
for help on using the changeset viewer.