Changeset 127


Ignore:
Timestamp:
10/07/10 16:17:04 (14 years ago)
Author:
hozdoba
Message:

suite du précédent commit

Location:
XMLIO_V2/dev/dev_rv/src/XMLIO
Files:
19 edited

Legend:

Unmodified
Added
Removed
  • XMLIO_V2/dev/dev_rv/src/XMLIO/NetCDF4_data_output.hpp

    r126 r127  
    66namespace XMLIOSERVER 
    77{ 
     8 
     9   static const char* TimeName = "time"; 
     10 
    811   class NetCDF4DataOutput : public AbstractDataOutput 
    912   { 
     
    7477         } 
    7578 
    76          void writeCoords(const string& id, const Array<float, 1>& cdata) 
     79         void writeCoords(const string& id, const Array<double, 1>& cdata) 
    7780         { 
    7881            NcVar *cVar = dataFile->get_var(id.c_str()); 
     
    115118            // Ajout de la dimension temporelle non limitée. 
    116119            if (withTime) 
    117                if (NULL == dataFile->add_dim("time")) 
     120               if (NULL == dataFile->add_dim(TimeName)) 
    118121                  throw XMLIOUndefinedValueException("Impossible d'ajouter la dimension temporelle !"); 
    119122         } 
     
    139142               if (!(latVar = dataFile->add_var(latid.c_str(), ncFloat, dataFile->get_dim(latid.c_str())))) 
    140143                  throw XMLIOUndefinedValueException("Impossible d'ajouter la variable de latitude !"); 
     144 
    141145               if (!(lonVar = dataFile->add_var(lonid.c_str(), ncFloat, dataFile->get_dim(lonid.c_str())))) 
    142146                  throw XMLIOUndefinedValueException("Impossible d'ajouter la variable de longitude !"); 
     
    147151               hm["units"]         = "degrees_north"; 
    148152               hm["long_name"]     = "Latitude" ; 
    149                addStringAttributesToVar(latVar, hm); 
     153               this->addStringAttributesToVar(latVar, hm); 
    150154               hm.clear(); 
    151155 
     
    155159               hm["units"]          = "degrees_east"; 
    156160               hm["long_name"]      = "Longitude" ; 
    157                addStringAttributesToVar(lonVar, hm); 
    158                hm.clear(); 
     161               this->addStringAttributesToVar(lonVar, hm); 
     162               hm.clear(); 
     163 
     164               if ((*itt)->yvalue.hasValue()) 
     165                  this->writeCoords(lonid, (*itt)->xvalue); 
     166               else throw XMLIOUndefinedValueException("Les coordonnées de longitude (xvalue) ne sont pas définies pour le domaine \""+domid+"\"."); 
     167 
     168               if ((*itt)->xvalue.hasValue()) 
     169                  this->writeCoords(latid, (*itt)->yvalue); 
     170               else throw XMLIOUndefinedValueException("Les coordonnées de latitude (yvalue) ne sont pas définies pour le domaine \""+domid+"\"."); 
    159171            } 
    160172 
     
    171183               if ((*it)->long_name.hasValue())    hm["long_name"]     = (*it)->long_name ; 
    172184               if ((*it)->unit.hasValue())         hm["units"]         = (*it)->unit; 
    173                addStringAttributesToVar(othvar, hm); 
    174                hm.clear(); 
     185               this->addStringAttributesToVar(othvar, hm); 
     186               hm.clear(); 
     187 
     188               if ((*it)->value.hasValue()) 
     189                  this->writeCoords(axisid, (*it)->value); 
     190               else throw XMLIOUndefinedValueException("Les coordonnées de l'axe \""+axisid+"\" (value) ne sont pas définies."); 
    175191            } 
    176192         } 
     
    228244                  { 
    229245                     if (!(var = dataFile->add_var(fieldid.c_str(), tvar, 
    230                         dataFile->get_dim("time"), dataFile->get_dim(latid.c_str()), dataFile->get_dim(lonid.c_str())))) 
     246                        dataFile->get_dim(TimeName), dataFile->get_dim(latid.c_str()), dataFile->get_dim(lonid.c_str())))) 
    231247                        throw XMLIOUndefinedValueException("Impossible d'ajouter le champ "+ field->getId() +" !"); 
    232248                  } 
     
    234250                  { 
    235251                     if (!(var = dataFile->add_var(fieldid.c_str(), tvar, 
    236                         dataFile->get_dim("time"), dataFile->get_dim(axisid.c_str()), 
     252                        dataFile->get_dim(TimeName), dataFile->get_dim(axisid.c_str()), 
    237253                        dataFile->get_dim(latid.c_str()), dataFile->get_dim(lonid.c_str())))) 
    238254                        throw XMLIOUndefinedValueException("Impossible d'ajouter le champ "+ field->getId() +" !"); 
     
    258274               if (field->long_name.hasValue())    hm["long_name"]     = field->long_name ; 
    259275               if (field->unit.hasValue())         hm["units"]         = field->unit; 
    260                addStringAttributesToVar(var, hm); 
     276               this->addStringAttributesToVar(var, hm); 
    261277               hm.clear(); 
    262278            } 
     
    265281      private : 
    266282 
    267          void addStringAttributesToVar(NcVar * var, const Poco::HashMap<string, string>& attr) 
     283         void addStringAttributesToVar(NcVar * const var, const Poco::HashMap<string, string>& attr) 
    268284         { 
    269285            Poco::HashMap<string, string>::ConstIterator it; 
  • XMLIO_V2/dev/dev_rv/src/XMLIO/abstract_calendar.hpp

    r126 r127  
    1212      public : 
    1313 
    14          virtual int getMonthLength(const Date& d) const 
    15          { // Retourne la durée du mois en jour. 
    16             static const int NoLeapMonthLength[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; 
    17             return (NoLeapMonthLength[d.getMonth()-1]); 
     14         friend std::ostream& operator<<(std::ostream& out, AbstractCalendar& c) 
     15         { 
     16            out <<   "[type: "   << c.getId() 
     17                << ", start: "   << c.getInitDate() 
     18                << ", current: " << c.getCurrentDate() << "]"; 
     19            return (out); 
    1820         } 
    19  
    20          friend std::ostream& operator<<(std::ostream& out, AbstractCalendar& c) 
    21          { out << "[type: " << c.getId() << ", start: " << c.getInitDate() << ", current: " << c.getCurrentDate() << "]"; return (out); } 
    2221 
    2322         const Date& getInitDate(void) const { return(initDate); } 
    2423         Date& getCurrentDate(void) { return(currentDate); } 
    2524 
    26          void setTempo(const Duration& dr) { tempo = dr; } 
    27          Duration getTempo(void) const { return (tempo); } 
     25         void setTimeStep(const Duration& dr) { timestep = dr; } 
     26         const Duration& getTimeStep(void) const { return (timestep); } 
    2827 
    2928         Date& update(void); 
     29 
     30      public : /* virtual */ 
     31 
     32         virtual int getMonthLength(const Date& d) const 
     33         { // Retourne la durée du mois en jour. 
     34            static const int NoLeapMonthLength[] = 
     35               {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; 
     36            return (NoLeapMonthLength[d.getMonth()-1]); 
     37         } 
    3038 
    3139         virtual int getYearTotalLength(const Date& d) const { return (365 * 86400); } // Retourne la durée d'une année en seconde. 
     
    6371 
    6472         AbstractCalendar(void) 
    65             : AbstractObject(), initDate(*this), currentDate(initDate), tempo(Hour) 
     73            : AbstractObject(), initDate(*this), currentDate(initDate), timestep(Hour) 
    6674         { /* Ne rien faire de plus */ } 
    6775 
    6876         AbstractCalendar(const string& _id, 
    6977                          int yr = 0, int mth = 1, int d = 1, int hr = 0, int min = 0 , int sec = 0) 
    70             : AbstractObject(_id), initDate(*this, yr, mth, d, hr, min, sec), currentDate(initDate), tempo(Hour) 
     78            : AbstractObject(_id), 
     79              initDate(*this, yr, mth, d, hr, min, sec), currentDate(initDate), timestep(Hour) 
    7180         { /* Ne rien faire de plus */ } 
    7281 
    7382         AbstractCalendar(const string& _id, const string& dateStr) 
    74             : AbstractObject(_id), initDate(Date::FromString(dateStr, *this)), currentDate(initDate), tempo(Hour) 
     83            : AbstractObject(_id), 
     84              initDate(Date::FromString(dateStr, *this)), currentDate(initDate), timestep(Hour) 
    7585         { /* Ne rien faire de plus */ } 
    7686 
     
    7989         const Date initDate; 
    8090         Date currentDate; 
    81          Duration tempo; 
     91         Duration timestep; 
    8292 
    8393   }; // class AbstractCalendar 
  • XMLIO_V2/dev/dev_rv/src/XMLIO/attribut.hpp

    r126 r127  
    8686   { _hasValue = true ; value.resize(val.shape()); value = val ; } 
    8787 
     88#define PRINT_ARRAY(type)                                             \ 
     89   template <>                                                        \ 
     90      ostream& Attribut<Array<type, 1> >::print(ostream & _out) const \ 
     91   {                                                                  \ 
     92      if (_hasValue) _out << " " << getName() << "=\"" << value(0);   \ 
     93      _out << "..." << value(value.size()-1); _out << "\"" ;          \ 
     94      return (_out) ;                                                 \ 
     95   } 
     96 
    8897#define SET_ARRAY_TYPE(type) \ 
    89    SET_ARRAY_DIM(type,1)     \ 
    90    SET_ARRAY_DIM(type,2)     \ 
    91    SET_ARRAY_DIM(type,3)     \ 
    92    SET_ARRAY_DIM(type,4) 
     98   PRINT_ARRAY(type)         \ 
     99   SET_ARRAY_DIM(type, 1)    \ 
     100   SET_ARRAY_DIM(type, 2)    \ 
     101   SET_ARRAY_DIM(type, 3)    \ 
     102   SET_ARRAY_DIM(type, 4) 
    93103 
    94104   SET_ARRAY_TYPE(double) 
     105   SET_ARRAY_TYPE(float) 
    95106   SET_ARRAY_TYPE(int) 
    96107   SET_ARRAY_TYPE(bool) 
    97108 
    98    template <> 
    99       ostream& Attribut<Array<double,1> >::print(ostream & o) const 
    100    { 
    101       if (_hasValue) o << " " << getName() << "=\"" << value(0); 
    102       /*for (int i = 1; i < value.size(); i++) 
    103       { o << "," << value(i); }*/ 
    104       o << value(0) << "..." << value(value.size()-1); 
    105       o << "\"" ; 
    106       return (o) ; 
    107    } 
     109#undef SET_ARRAY_DIM 
     110#undef SET_ARRAY_TYPE 
     111#undef PRINT_ARRAY 
    108112 
    109113   template <> 
    110       void Attribut<Array<double,1> >::setFromString(const std::string& _str) 
     114      void Attribut<Array<double, 1> >::setFromString(const std::string& _str) 
    111115   { 
    112116      istringstream iss(_str) ; 
  • XMLIO_V2/dev/dev_rv/src/XMLIO/c_interface.cpp

    r126 r127  
    4545         // Récupération du calendrier assossié au context courant et initialisation des delais d'écriture. 
    4646         AbstractCalendar* calendar = dtreat.getCurrentContext()->getCalendar(); 
    47          calendar->setTempo(1 * Hour); 
     47         calendar->setTimeStep(1 * Hour); 
    4848 
    4949         // Affichage de la date initiale (pour vérification). 
     
    6767         } 
    6868 
     69         std::cout << std::endl << " * ----------- Affichage de l'arborescence ----------- * " << std::endl << std::endl; 
     70 
    6971         // On écrit l'arborescence résultante du traitement sur la sortie de log. 
    70          //Context::ShowTree(std::clog); 
     72         Context::ShowTree(std::clog); 
     73         std::cout << std::endl; 
    7174      } 
    7275 
  • XMLIO_V2/dev/dev_rv/src/XMLIO/calendar.hpp

    r120 r127  
    77   { 
    88      public : 
     9 
    910         JulianCalendar() : AbstractCalendar("Julian") 
    1011         {/* Ne rien faire de plus */} 
    1112         JulianCalendar(const string& _dateStr) : AbstractCalendar("Julian", _dateStr) 
    1213         {/* Ne rien faire de plus */} 
     14 
     15      public : /* virtual */ 
    1316 
    1417         virtual int getYearTotalLength(const Date& _d) const 
     
    3336   { 
    3437      public : 
     38 
    3539         GregorianCalendar() : AbstractCalendar("Gregorian") 
    3640         {/* Ne rien faire de plus */} 
    3741         GregorianCalendar(const string& dateStr) : AbstractCalendar("Gregorian", dateStr) 
    3842         {/* Ne rien faire de plus */} 
     43 
     44      public : /* virtual */ 
    3945 
    4046         virtual int getYearTotalLength(const Date& d) const 
     
    4854            if (d.getMonth() == 2) 
    4955            { // Traitement du cas particulier en Février. 
    50                if ((d.getYear() % 4 == 0) && (d.getYear() % 100 != 0 || d.getYear() % 400 == 0)) 
     56               if ((d.getYear() % 4   == 0) && 
     57                  ((d.getYear() % 100 != 0) || 
     58                   (d.getYear() % 400 == 0) )) 
    5159                  return (29); 
    5260               return (28); 
     
    6371   { 
    6472      public : 
     73 
    6574         NoLeapCalendar() : AbstractCalendar("NoLeap") 
    6675         {/* Ne rien faire de plus */} 
     
    7685   { 
    7786      public : 
     87 
    7888         AllLeapCalendar() : AbstractCalendar("AllLeap") 
    7989         {/* Ne rien faire de plus */} 
    8090         AllLeapCalendar(const string& dateStr) : AbstractCalendar("AllLeap", dateStr) 
    8191         {/* Ne rien faire de plus */} 
     92 
     93      public : /* virtual */ 
    8294 
    8395         virtual int getMonthLength(const Date& d) const 
     
    94106   { 
    95107      public : 
     108 
    96109         D360Calendar() : AbstractCalendar("D360") 
    97110         {/* Ne rien faire de plus */} 
    98111         D360Calendar(const string& dateStr) : AbstractCalendar("D360", dateStr) 
    99112         {/* Ne rien faire de plus */} 
     113 
     114      public : /* virtual */ 
    100115 
    101116         virtual int getYearTotalLength(const Date& d) const { return (360 * 86400); } 
  • XMLIO_V2/dev/dev_rv/src/XMLIO/calendar_utils.hpp

    r124 r127  
    194194 
    195195   Date& AbstractCalendar::update(void) 
    196    { return (getCurrentDate() = getCurrentDate() + tempo); } 
     196   { return (getCurrentDate() = getCurrentDate() + timestep); } 
    197197 
    198198} // namespace XMLIOSERVER 
  • XMLIO_V2/dev/dev_rv/src/XMLIO/data_treatment.hpp

    r126 r127  
    1313         { this->doTreatment(cal); } 
    1414 
    15          const Context* getCurrentContext(void) const { return (currentContext); } 
    16          const std::vector<CFile*>& getEnabledFiles(void) const { return (enabledFiles); } 
     15         const Context*             getCurrentContext(void) const { return (currentContext); } 
     16         const std::vector<CFile*>& getEnabledFiles  (void) const { return (enabledFiles); } 
    1717 
    1818         void getEnabledFilesId(std::vector<std::string>& _vect) const 
     
    7474         } 
    7575 
    76          ~DataTreatment() 
     76         ~DataTreatment(void) 
    7777         { /* Ne rien faire de plus */ } 
    7878 
  • XMLIO_V2/dev/dev_rv/src/XMLIO/date.hpp

    r124 r127  
    88      public : 
    99 
    10          Date(const AbstractCalendar& cal, int yr = 0, int mth = 1, int d = 1, int hr = 0, int min = 0 , int sec = 0) : relCalendar(cal) 
    11             , year(yr), month(mth), day(d), hour(hr), minute(min), second(sec) 
     10         Date(const AbstractCalendar& cal, 
     11              int yr = 0, int mth = 1, int d = 1, int hr = 0, int min = 0 , int sec = 0) 
     12                  : relCalendar(cal) 
     13                  , year(yr), month(mth), day(d), hour(hr), minute(min), second(sec) 
    1214         { 
    13             if(!checkDate()) 
     15            if(!this->checkDate()) 
    1416               WARNING("La date initialisée a été modifiée car elle était incorrecte par rapport au calendrier souhaité."); 
    1517         } 
     
    1820            , year(d.year), month(d.month), day(d.day), hour(d.hour), minute(d.minute), second(d.second) 
    1921         { 
    20             if(!checkDate()) 
     22            if(!this->checkDate()) 
    2123               WARNING("La date initialisée a été modifiée car elle était incorrecte par rapport au calendrier souhaité."); 
    2224         } 
     
    5052         } 
    5153 
    52          static Date FromString(const string& str, const AbstractCalendar& cal); 
    53  
    5454         /// Divers accesseurs. 
    55          int getYear  (void) const { return (year); } 
    56          int getMonth (void) const { return (month); } 
    57          int getDay   (void) const { return (day); } 
    58          int getHour  (void) const { return (hour); } 
     55         int getYear  (void) const { return (year  ); } 
     56         int getMonth (void) const { return (month ); } 
     57         int getDay   (void) const { return (day   ); } 
     58         int getHour  (void) const { return (hour  ); } 
    5959         int getMinute(void) const { return (minute); } 
    6060         int getSecond(void) const { return (second); } 
     
    7070         } 
    7171 
    72  
    73  
    7472         const AbstractCalendar& getRelCalendar(void) const { return (relCalendar); } 
    7573 
    7674         ~Date() 
    7775         {/* Ne rien faire de plus */} 
     76 
     77      public : /* static */ 
     78 
     79         static Date FromString(const string& str, const AbstractCalendar& cal); 
    7880 
    7981      private : 
  • XMLIO_V2/dev/dev_rv/src/XMLIO/declare_attribut.hpp

    r126 r127  
    1818         Attr_##att_name(const att_type& _value) : Attribut<att_type>(_value)       \ 
    1919         { /* Ne rien faire de plus */ }                                            \ 
    20          Attr_##att_name(const Attr_##att_name & att) : Attribut<att_type>(att)     \ 
     20         Attr_##att_name(const Attr_##att_name& _att) : Attribut<att_type>(_att)    \ 
    2121         { /* Ne rien faire de plus */ }                                            \ 
    2222                                                                                    \ 
     
    3333   void setAttr##att_name(const att_type& _newattr) { att_name.setValue(_newattr); }\ 
    3434   void set_##att_name   (const att_type& _newattr) { att_name.setValue(_newattr); }\ 
     35                                                                                    \ 
    3536   Attr_##att_name att_name 
    3637 
  • XMLIO_V2/dev/dev_rv/src/XMLIO/declare_group.hpp

    r126 r127  
    2121            { _parse<child_type##Group>(_node, _withAttr); }               \ 
    2222                                                                           \ 
    23             virtual ~child_type##Group(void){}                             \ 
     23            virtual ~child_type##Group(void)                               \ 
     24            { /* Ne rien faire de plus */ }                                \ 
    2425      };                                                                   \ 
    2526                                                                           \ 
  • XMLIO_V2/dev/dev_rv/src/XMLIO/domain_attribut.hpp

    r126 r127  
    1616         DECLARE_ATTR(ni_glo        , int) ; 
    1717         DECLARE_ATTR(nj_glo        , int) ; 
     18 
    1819         DECLARE_ATTR(ibegin        , int) ; 
    1920         DECLARE_ATTR(iend          , int) ; 
    2021         DECLARE_ATTR(ni            , int) ; 
     22 
    2123         DECLARE_ATTR(jbegin        , int) ; 
    2224         DECLARE_ATTR(jend          , int) ; 
    2325         DECLARE_ATTR(nj            , int) ; 
     26 
    2427         DECLARE_ATTR(mask          , Array(bool, 2)) ; 
    2528 
     
    2932         DECLARE_ATTR(data_ibegin   , int) ; 
    3033         DECLARE_ATTR(data_jbegin   , int) ; 
     34 
    3135         DECLARE_ATTR(data_n_index  , int) ; 
    3236         DECLARE_ATTR(data_i_index  , Array(int, 1)) ; 
    3337         DECLARE_ATTR(data_j_index  , Array(int, 1)) ; 
     38 
     39         DECLARE_ATTR(xvalue        , Array(double, 1)) ; 
     40         DECLARE_ATTR(yvalue        , Array(double, 1)) ; 
    3441 
    3542         DomainAttribut(void) : AttributRegistrar() 
     
    6168            RegisterAttribut(&data_i_index) ; 
    6269            RegisterAttribut(&data_j_index) ; 
     70 
     71            RegisterAttribut(&xvalue) ; 
     72            RegisterAttribut(&yvalue) ; 
    6373         } 
    6474 
  • XMLIO_V2/dev/dev_rv/src/XMLIO/field_operation.hpp

    r124 r127  
    99      public : 
    1010 
    11          FieldOperation(const string& _id = string("inst"), const Duration& _dr = Hour) 
     11         FieldOperation(const string& _id = string("inst"), const Duration& _dr = NoneDu) 
    1212            : AbstractObject(_id), freqOp(_dr) 
    1313         { /* Ne rien faire de plus */ } 
     
    2222         void setFreqOp(const Duration& _dr) { freqOp = _dr; } 
    2323 
    24          //void getOutputField(const Array<double, 1>& inField, Array<double, 1>& outField) const 
     24      public : /* virtual */ 
    2525 
    26          //void getStoreField(const Array<double, 1>& inField, Array<double, 1>& outField) const 
    27  
    28          virtual ~FieldOperation() 
     26         virtual ~FieldOperation(void) 
    2927         { /* Ne rien faire de plus */ } 
    30  
    3128 
    3229      protected : 
  • XMLIO_V2/dev/dev_rv/src/XMLIO/file.hpp

    r125 r127  
    1616         {/* Ne rien faire de plus */} 
    1717 
    18          static string GetName(void) { return ("file"); } 
    19          static string GetDefName(void)  { return (CFile::GetName()); } 
    20  
    21          virtual void parse (XMLNode& _node) 
    22          { 
    23             string name = _node.getElementName(); 
    24             THashAttributes attributes; 
    25  
    26             /// PARSING GESTION DES ATTRIBUTS /// 
    27             _node.getAttributes(attributes); 
    28             this->setAttributes(attributes); 
    29             attributes.clear(); 
    30  
    31             /// PARSING POUR GESION DES ENFANTS /// 
    32             if (_node.goToChildElement() and hasId()) 
    33             { // Si la définition du fichier intégre des champs et si le fichier est identifié. 
    34                _node.goToParentElement(); 
    35                vfieldGroup = CreateInstanceAndParse<FieldGroup>(_node, getId().c_str(), false ); 
    36             } 
    37          } 
    38  
    3918         AbstractDataOutput* getDataOutput(void) const { return (output); } 
    4019         void initializeDataOutput(AbstractDataOutput* _output) 
     
    5029         { 
    5130            std::set<const CGrid*> sgrid; 
    52             const std::vector<CField*> enabledFields = getEnabledFields(); 
     31            const std::vector<CField*> enabledFields = this->getEnabledFields(); 
    5332            std::vector<CField*>::const_iterator it; 
    5433 
     
    5938         } 
    6039 
     40         const std::set<const FieldOperation*> getEnabledOperation(void) const 
     41         { 
     42            std::set<const FieldOperation*> sope; 
     43            const std::vector<CField*> enabledFields = this->getEnabledFields(); 
     44            std::vector<CField*>::const_iterator it; 
     45 
     46            for ( it = enabledFields.begin() ; it != enabledFields.end(); it++ ) 
     47               if ((*it)->operation.hasValue()) 
     48                  sope.insert((FieldOperation*)&(*it)->operation); 
     49 
     50            return (sope); 
     51         } 
     52 
    6153         const std::set<const CDomain*> getEnabledDomains(void) const 
    6254         { 
    63             const std::set<const CGrid*> sgrid = getEnabledGrids(); 
     55            const std::set<const CGrid*> sgrid = this->getEnabledGrids(); 
    6456            std::set<const CDomain*> sdomain; 
    6557 
     
    7466         const std::set<const CAxis*> getEnabledAxis(void) const 
    7567         { 
    76             const std::set<const CGrid*> sgrid = getEnabledGrids(); 
     68            const std::set<const CGrid*> sgrid = this->getEnabledGrids(); 
    7769            std::set<const CAxis*> saxis; 
    7870 
     
    8476            return (saxis); 
    8577         } 
    86  
    87          virtual bool hasChild(void) const { return (vfieldGroup != NULL); } 
    88          virtual void printChild(ostream& out) const { out << *vfieldGroup << std::endl; } 
    89  
    90          virtual void resolveDescInheritance(const AttributRegistrar* const _parent = 0) 
    91          { addAttributes(*_parent); if(vfieldGroup != NULL) vfieldGroup->resolveDescInheritance(); } 
    9278 
    9379         void resolveFieldRefInheritance(void) 
     
    144130         } 
    145131 
     132      public : /* virtual */ 
     133 
     134         virtual void parse (XMLNode& _node) 
     135         { 
     136            string name = _node.getElementName(); 
     137            THashAttributes attributes; 
     138 
     139            /// PARSING GESTION DES ATTRIBUTS /// 
     140            _node.getAttributes(attributes); 
     141            this->setAttributes(attributes); 
     142            attributes.clear(); 
     143 
     144            /// PARSING POUR GESION DES ENFANTS /// 
     145            if (_node.goToChildElement() and hasId()) 
     146            { // Si la définition du fichier intégre des champs et si le fichier est identifié. 
     147               _node.goToParentElement(); 
     148               vfieldGroup = CreateInstanceAndParse<FieldGroup>(_node, getId().c_str(), false ); 
     149            } 
     150         } 
     151 
     152         virtual bool hasChild(void) const { return (vfieldGroup != NULL); } 
     153         virtual void printChild(ostream& out) const { out << *vfieldGroup << std::endl; } 
     154 
     155         virtual void resolveDescInheritance(const AttributRegistrar* const _parent = 0) 
     156         { addAttributes(*_parent); if(vfieldGroup != NULL) vfieldGroup->resolveDescInheritance(); } 
     157 
    146158         virtual  ~CFile(void) 
    147159         { 
     
    149161            if(output != NULL) delete output; 
    150162         } 
     163 
     164      public : /* static */ 
     165 
     166         static string GetName(void) { return ("file"); } 
     167         static string GetDefName(void)  { return (CFile::GetName()); } 
    151168 
    152169      private : 
  • XMLIO_V2/dev/dev_rv/src/XMLIO/grid.hpp

    r125 r127  
    1111      public: 
    1212 
    13          CGrid(void) : ObjectTemplate<CGrid>(), GridAttribut(), hasAxis(false), axis(NULL), domain(NULL) 
     13         CGrid(void) 
     14            : ObjectTemplate<CGrid>(), GridAttribut(), 
     15              hasAxis(false), axis(NULL), domain(NULL) 
    1416         { /* Ne rien faire de plus */ } 
    1517 
    16          CGrid(const string& _id) : ObjectTemplate<CGrid>(_id), GridAttribut(), hasAxis(false), axis(NULL), domain(NULL) 
     18         CGrid(const string& _id) 
     19            : ObjectTemplate<CGrid>(_id), GridAttribut(), 
     20              hasAxis(false), axis(NULL), domain(NULL) 
    1721         { /* Ne rien faire de plus */ } 
    1822 
    19          static string GetName(void) { return ("grid"); } 
    20          static string GetDefName(void)  { return (CGrid::GetName()); } 
    21  
    22          const CAxis* getRelAxis(void) const { return (axis); } 
     23         const CAxis*   getRelAxis  (void) const { return (axis); } 
    2324         const CDomain* getRelDomain(void) const { return (domain); } 
    2425 
    25          const Array<int, 1>& getStoreIndex(void) { return (storeIndex); } 
    26          const Array<int, 1>& getOutIIndex(void) { return (out_i_index); } 
    27          const Array<int, 1>& getOutJIndex(void) { return (out_j_index); } 
    28          const Array<int, 1>& getOutLIndex(void) { return (out_l_index); } 
    29  
    30          inline void solveReference(void) ; 
    31          inline void solveDomainRef(void) ; 
    32          inline void solveAxisRef(void) ; 
     26         const Array<int, 1>& getStoreIndex(void) const { return (storeIndex); } 
     27         const Array<int, 1>& getOutIIndex(void)  const { return (out_i_index); } 
     28         const Array<int, 1>& getOutJIndex(void)  const { return (out_j_index); } 
     29         const Array<int, 1>& getOutLIndex(void)  const { return (out_l_index); } 
     30 
     31         void solveReference(void) 
     32         { this->solveDomainRef() ; this->solveAxisRef() ; this->computeIndex() ; } 
     33 
     34         void solveDomainRef(void) 
     35         { 
     36            if (domain_ref.hasValue()) 
     37            { 
     38               if (CDomain::HasObject(domain_ref)) 
     39               { 
     40                 domain = CDomain::GetObject(domain_ref) ; 
     41                 domain->check() ; 
     42               } 
     43               else ERROR("Référence au domaine incorrecte") ; 
     44            } 
     45            else ERROR("Domaine non défini") ; 
     46         } 
     47 
     48         void solveAxisRef(void) 
     49         { 
     50            if (axis_ref.hasValue()) 
     51            { 
     52               hasAxis = true ; 
     53               if (CAxis::HasObject(axis_ref)) axis = CAxis::GetObject(axis_ref) ; 
     54               else ERROR("Référence a l'axe incorrecte") ; 
     55            } 
     56            else hasAxis = false ; // hasAxis est normalement déjà à false(?). 
     57         } 
    3358 
    3459         inline void computeIndex(void); 
     
    3661         bool _hasAxis(void) const { return (hasAxis); } 
    3762 
    38          inline void storeField(const Array<double, 1>& field, Array<double, 1>& stored) const; 
    39          inline void storeField(const Array<double, 2>& field, Array<double, 1>& stored) const; 
    40          inline void storeField(const Array<double, 3>& field, Array<double, 1>& stored) const; 
    41          inline void storeField(const double* const data, Array<double, 1>& stored) const; 
    42  
    43          inline void outputField(const Array<double,1>& stored, Array<double, 2>& outField) const; 
    44          inline void outputField(const Array<double,1>& stored, Array<double, 3>& outField) const; 
    45  
    46          inline static CGrid* CreateObject(const CDomain* const a_domain, const CAxis* const a_axis); 
    47          inline static CGrid* CreateObject(const CDomain* const a_domain); 
     63         template <class T> 
     64            void storeField(const T& field, Array<double, 1>& stored) const 
     65         { this->storeField_arr(field.dataFirst(), stored) ; } 
     66 
     67         template <class T> 
     68            inline void outputField(const Array<double, 1>& stored, T&) const; 
     69 
     70      public : /* virtual */ 
    4871 
    4972         virtual ~CGrid(void) 
    5073         { /* Ne rien faire de plus */ } 
    5174 
     75      public : /* static */ 
     76 
     77         static string GetName   (void) { return ("grid"); } 
     78         static string GetDefName(void) { return (CGrid::GetName()); } 
     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("__") ; 
     83            CGrid* const grid = ObjectTemplate<CGrid>::CreateObject(new_id) ; 
     84 
     85            grid->domain_ref = a_domain->getId() ; 
     86            grid->axis_ref   = a_axis  ->getId() ; 
     87 
     88            return (grid); 
     89         } 
     90 
     91         static CGrid* CreateObject(const CDomain* const a_domain) 
     92         { 
     93            string new_id = string("___") + a_domain->getId() + string("__") ; 
     94            CGrid* const grid = ObjectTemplate<CGrid>::CreateObject(new_id) ; 
     95            grid->domain_ref = a_domain->getId() ; 
     96 
     97            return (grid); 
     98         } 
     99 
     100      protected : 
     101 
     102         void storeField_arr(const double* const data, Array<double, 1>& stored) const 
     103         { 
     104            const int size = storeIndex.size() ; 
     105            stored.resize(shape(size)) ; 
     106            for(int i = 0; i < size; i++) 
     107               stored(i) = data[storeIndex(i)] ; 
     108         } 
     109 
    52110      private: 
    53111 
    54112         bool hasAxis ; 
    55113 
    56          CAxis* axis ; 
    57          CDomain* domain ; 
     114         CAxis   * axis ; 
     115         CDomain * domain ; 
    58116 
    59117         Array<int, 1> storeIndex ; 
     
    64122   }; // class CGrid 
    65123 
    66    CGrid* CGrid::CreateObject(const CDomain* const a_domain, const CAxis* const a_axis) 
    67    { 
    68       string new_id = string("___") + a_domain->getId() + string("_") + a_axis->getId() + string("__") ; 
    69       CGrid* const grid = ObjectTemplate<CGrid>::CreateObject(new_id) ; 
    70  
    71       grid->domain_ref = a_domain->getId() ; 
    72       grid->axis_ref   = a_axis  ->getId() ; 
    73  
    74       return (grid); 
    75    } 
    76  
    77    CGrid* CGrid::CreateObject(const CDomain* const a_domain) 
    78    { 
    79       string new_id = string("___") + a_domain->getId() + string("__") ; 
    80       CGrid* const grid = ObjectTemplate<CGrid>::CreateObject(new_id) ; 
    81  
    82       grid->domain_ref = a_domain->getId() ; 
    83  
    84       return (grid); 
    85    } 
    86  
    87    void CGrid::solveReference(void) 
    88    { 
    89  
    90       /**static bool isReferenceSolved = false; 
    91       if (isReferenceSolved) 
    92       { 
    93          std::cout << "C'est n'importe quoi, A modifierrrrrrrrrrr!!!!!!!!!!!!!!!!!!!!!" << std::endl; 
    94          return; 
    95       }*/ 
    96  
    97       // Résolution de chacune des références et indexation. 
    98       solveDomainRef() ; 
    99       solveAxisRef() ; 
    100       computeIndex() ; 
    101  
    102       //isReferenceSolved = true ; 
    103    } 
    104  
    105    void CGrid::solveDomainRef(void) 
    106    { 
    107       if (domain_ref.hasValue()) 
    108       { 
    109          if (CDomain::HasObject(domain_ref)) 
    110          { 
    111            domain = CDomain::GetObject(domain_ref) ; 
    112            domain->check() ; 
    113          } 
    114          else ERROR("Référence au domaine incorrecte") ; 
    115       } 
    116       else ERROR("Domaine non défini") ; 
    117    } 
    118  
    119    void CGrid::solveAxisRef(void) 
    120    { 
    121       if (axis_ref.hasValue()) 
    122       { 
    123          hasAxis = true ; 
    124          if (CAxis::HasObject(axis_ref)) axis = CAxis::GetObject(axis_ref) ; 
    125          else ERROR("Référence a l'axe incorrecte") ; 
    126       } 
    127       else hasAxis = false ; // hasAxis est normalement déjà à false(?). 
    128    } 
    129  
    130124   void CGrid::computeIndex(void) 
    131125   { 
    132  
    133126      int ni = domain->ni ; 
    134127      int nj = domain->nj ; 
     
    196189         } 
    197190      } 
    198  
    199       /** Pour tests 
    200  
    201       cout << "Out of CGrid::ComputeIndex" << endl ; 
    202  
    203       cout << "storeIndex : " << endl ; 
    204       cout << storeIndex << endl ; 
    205  
    206       cout << "out_i_index : " << endl ; 
    207       cout << out_i_index << endl ; 
    208  
    209       cout << "out_j_index : " << endl ; 
    210       cout << out_j_index << endl ; 
    211  
    212       cout << "out_l_index : " << endl ; 
    213       cout << out_l_index << endl ; 
    214  
    215       **/ 
    216  
    217191   } 
    218192 
    219    void CGrid::storeField(const Array<double, 1>& field, Array<double, 1>& stored) const 
    220    { 
    221       storeField(field.dataFirst(), stored) ; 
    222       //cout<<"Stored 1"<<stored<<endl ; 
    223    } 
    224  
    225    void CGrid::storeField(const Array<double, 2>& field, Array<double, 1>& stored) const 
    226    { 
    227       storeField(field.dataFirst(), stored) ; 
    228       //cout<<"Stored 2"<<stored<<endl ; 
    229    } 
    230  
    231    void CGrid::storeField(const Array<double, 3>& field, Array<double, 1>& stored) const 
    232    { 
    233       storeField(field.dataFirst(), stored) ; 
    234       //cout<<"Stored 3"<<stored<<endl ; 
    235    } 
    236  
    237    void CGrid::storeField(const double* const data, Array<double, 1>& stored) const 
    238    { 
    239       int size = storeIndex.size() ; 
    240       //cout << "size " << size << endl ; 
    241  
    242       stored.resize(shape(size)) ; 
    243       //cout << "Stored " << stored << endl ; 
    244  
    245       for(int i = 0; i < size; i++) stored(i) = data[storeIndex(i)] ; 
    246       //cout << "Stored " << stored << endl ; 
    247    } 
    248  
    249    void CGrid::outputField(const Array<double, 1>& stored, Array<double, 2>& outField) const 
     193   template<> 
     194      void CGrid::outputField(const Array<double, 1>& stored, Array<double, 2>& outField) const 
    250195   { 
    251196      for(int n = 0; n < storeIndex.size(); n++) 
     
    253198   } 
    254199 
    255    void CGrid::outputField(const Array<double, 1>& stored, Array<double, 3>& outField) const 
     200   template<> 
     201      void CGrid::outputField(const Array<double, 1>& stored, Array<double, 3>& outField) const 
    256202   { 
    257203      for(int n = 0; n < storeIndex.size(); n++) 
  • XMLIO_V2/dev/dev_rv/src/XMLIO/group_template.hpp

    r126 r127  
    9090      public : /* virtual */ 
    9191 
    92          virtual ~GroupTemplate() 
     92         virtual ~GroupTemplate(void) 
    9393         { 
    9494            for (unsigned int i = 0; i < childList.getVector().size(); i++) 
  • XMLIO_V2/dev/dev_rv/src/XMLIO/main.f90

    r115 r127  
    11PROGRAM main 
    2 IMPLICIT NONE 
     2   IMPLICIT NONE 
    33 
    44   CALL main_c 
  • XMLIO_V2/dev/dev_rv/src/XMLIO/xml_node.hpp

    r126 r127  
    108108 
    109109            Poco::XML::Node * getCNode(void) const { return (this->cNode); } 
     110 
    110111            void setCNode(Poco::XML::Node * _otherNode) { this->cNode = _otherNode; } 
    111112 
     
    129130            Poco::XML::Node* cNode; 
    130131 
    131             string rootName; 
     132            std::string rootName; 
    132133 
    133134      };// class XMLNode 
  • XMLIO_V2/dev/dev_rv/src/XMLIO/xml_parser.hpp

    r125 r127  
    3131                  { WARNING("Le context ne sera pas traité car il n'est pas identifié !"); continue; } 
    3232 
    33                   if( Context::GetAllListObject().find(attributes["id"]) != Context::GetAllListObject().end()) 
     33                  if( Context::GetAllListObject().find(attributes["id"]) != 
     34                      Context::GetAllListObject().end()) 
    3435                  { WARNING("Le context ne sera pas traité car il existe déjà un autre context possédant le même nom !"); continue; } 
    3536 
     
    4647               } while (_node.goToNextElement()); 
    4748            } 
     49 
    4850      }; // class XMLParser 
    4951   } // namespace XML 
  • XMLIO_V2/dev/dev_rv/src/XMLIO/xmlio.hpp

    r126 r127  
    6767#include "file_attribut.hpp" 
    6868 
     69#undef DECLARE_ATTR 
     70 
    6971#include "group_template.hpp" 
    7072#include "declare_group.hpp" 
     
    7678#include "grid.hpp" 
    7779#include "file.hpp" 
     80 
     81#undef DECLARE_GROUP 
    7882 
    7983//.... 
Note: See TracChangeset for help on using the changeset viewer.