- Timestamp:
- 10/07/10 16:17:04 (14 years ago)
- 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 6 6 namespace XMLIOSERVER 7 7 { 8 9 static const char* TimeName = "time"; 10 8 11 class NetCDF4DataOutput : public AbstractDataOutput 9 12 { … … 74 77 } 75 78 76 void writeCoords(const string& id, const Array< float, 1>& cdata)79 void writeCoords(const string& id, const Array<double, 1>& cdata) 77 80 { 78 81 NcVar *cVar = dataFile->get_var(id.c_str()); … … 115 118 // Ajout de la dimension temporelle non limitée. 116 119 if (withTime) 117 if (NULL == dataFile->add_dim( "time"))120 if (NULL == dataFile->add_dim(TimeName)) 118 121 throw XMLIOUndefinedValueException("Impossible d'ajouter la dimension temporelle !"); 119 122 } … … 139 142 if (!(latVar = dataFile->add_var(latid.c_str(), ncFloat, dataFile->get_dim(latid.c_str())))) 140 143 throw XMLIOUndefinedValueException("Impossible d'ajouter la variable de latitude !"); 144 141 145 if (!(lonVar = dataFile->add_var(lonid.c_str(), ncFloat, dataFile->get_dim(lonid.c_str())))) 142 146 throw XMLIOUndefinedValueException("Impossible d'ajouter la variable de longitude !"); … … 147 151 hm["units"] = "degrees_north"; 148 152 hm["long_name"] = "Latitude" ; 149 addStringAttributesToVar(latVar, hm);153 this->addStringAttributesToVar(latVar, hm); 150 154 hm.clear(); 151 155 … … 155 159 hm["units"] = "degrees_east"; 156 160 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+"\"."); 159 171 } 160 172 … … 171 183 if ((*it)->long_name.hasValue()) hm["long_name"] = (*it)->long_name ; 172 184 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."); 175 191 } 176 192 } … … 228 244 { 229 245 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())))) 231 247 throw XMLIOUndefinedValueException("Impossible d'ajouter le champ "+ field->getId() +" !"); 232 248 } … … 234 250 { 235 251 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()), 237 253 dataFile->get_dim(latid.c_str()), dataFile->get_dim(lonid.c_str())))) 238 254 throw XMLIOUndefinedValueException("Impossible d'ajouter le champ "+ field->getId() +" !"); … … 258 274 if (field->long_name.hasValue()) hm["long_name"] = field->long_name ; 259 275 if (field->unit.hasValue()) hm["units"] = field->unit; 260 addStringAttributesToVar(var, hm);276 this->addStringAttributesToVar(var, hm); 261 277 hm.clear(); 262 278 } … … 265 281 private : 266 282 267 void addStringAttributesToVar(NcVar * var, const Poco::HashMap<string, string>& attr)283 void addStringAttributesToVar(NcVar * const var, const Poco::HashMap<string, string>& attr) 268 284 { 269 285 Poco::HashMap<string, string>::ConstIterator it; -
XMLIO_V2/dev/dev_rv/src/XMLIO/abstract_calendar.hpp
r126 r127 12 12 public : 13 13 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); 18 20 } 19 20 friend std::ostream& operator<<(std::ostream& out, AbstractCalendar& c)21 { out << "[type: " << c.getId() << ", start: " << c.getInitDate() << ", current: " << c.getCurrentDate() << "]"; return (out); }22 21 23 22 const Date& getInitDate(void) const { return(initDate); } 24 23 Date& getCurrentDate(void) { return(currentDate); } 25 24 26 void setT empo(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); } 28 27 29 28 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 } 30 38 31 39 virtual int getYearTotalLength(const Date& d) const { return (365 * 86400); } // Retourne la durée d'une année en seconde. … … 63 71 64 72 AbstractCalendar(void) 65 : AbstractObject(), initDate(*this), currentDate(initDate), t empo(Hour)73 : AbstractObject(), initDate(*this), currentDate(initDate), timestep(Hour) 66 74 { /* Ne rien faire de plus */ } 67 75 68 76 AbstractCalendar(const string& _id, 69 77 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) 71 80 { /* Ne rien faire de plus */ } 72 81 73 82 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) 75 85 { /* Ne rien faire de plus */ } 76 86 … … 79 89 const Date initDate; 80 90 Date currentDate; 81 Duration t empo;91 Duration timestep; 82 92 83 93 }; // class AbstractCalendar -
XMLIO_V2/dev/dev_rv/src/XMLIO/attribut.hpp
r126 r127 86 86 { _hasValue = true ; value.resize(val.shape()); value = val ; } 87 87 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 88 97 #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) 93 103 94 104 SET_ARRAY_TYPE(double) 105 SET_ARRAY_TYPE(float) 95 106 SET_ARRAY_TYPE(int) 96 107 SET_ARRAY_TYPE(bool) 97 108 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 108 112 109 113 template <> 110 void Attribut<Array<double, 1> >::setFromString(const std::string& _str)114 void Attribut<Array<double, 1> >::setFromString(const std::string& _str) 111 115 { 112 116 istringstream iss(_str) ; -
XMLIO_V2/dev/dev_rv/src/XMLIO/c_interface.cpp
r126 r127 45 45 // Récupération du calendrier assossié au context courant et initialisation des delais d'écriture. 46 46 AbstractCalendar* calendar = dtreat.getCurrentContext()->getCalendar(); 47 calendar->setT empo(1 * Hour);47 calendar->setTimeStep(1 * Hour); 48 48 49 49 // Affichage de la date initiale (pour vérification). … … 67 67 } 68 68 69 std::cout << std::endl << " * ----------- Affichage de l'arborescence ----------- * " << std::endl << std::endl; 70 69 71 // 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; 71 74 } 72 75 -
XMLIO_V2/dev/dev_rv/src/XMLIO/calendar.hpp
r120 r127 7 7 { 8 8 public : 9 9 10 JulianCalendar() : AbstractCalendar("Julian") 10 11 {/* Ne rien faire de plus */} 11 12 JulianCalendar(const string& _dateStr) : AbstractCalendar("Julian", _dateStr) 12 13 {/* Ne rien faire de plus */} 14 15 public : /* virtual */ 13 16 14 17 virtual int getYearTotalLength(const Date& _d) const … … 33 36 { 34 37 public : 38 35 39 GregorianCalendar() : AbstractCalendar("Gregorian") 36 40 {/* Ne rien faire de plus */} 37 41 GregorianCalendar(const string& dateStr) : AbstractCalendar("Gregorian", dateStr) 38 42 {/* Ne rien faire de plus */} 43 44 public : /* virtual */ 39 45 40 46 virtual int getYearTotalLength(const Date& d) const … … 48 54 if (d.getMonth() == 2) 49 55 { // 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) )) 51 59 return (29); 52 60 return (28); … … 63 71 { 64 72 public : 73 65 74 NoLeapCalendar() : AbstractCalendar("NoLeap") 66 75 {/* Ne rien faire de plus */} … … 76 85 { 77 86 public : 87 78 88 AllLeapCalendar() : AbstractCalendar("AllLeap") 79 89 {/* Ne rien faire de plus */} 80 90 AllLeapCalendar(const string& dateStr) : AbstractCalendar("AllLeap", dateStr) 81 91 {/* Ne rien faire de plus */} 92 93 public : /* virtual */ 82 94 83 95 virtual int getMonthLength(const Date& d) const … … 94 106 { 95 107 public : 108 96 109 D360Calendar() : AbstractCalendar("D360") 97 110 {/* Ne rien faire de plus */} 98 111 D360Calendar(const string& dateStr) : AbstractCalendar("D360", dateStr) 99 112 {/* Ne rien faire de plus */} 113 114 public : /* virtual */ 100 115 101 116 virtual int getYearTotalLength(const Date& d) const { return (360 * 86400); } -
XMLIO_V2/dev/dev_rv/src/XMLIO/calendar_utils.hpp
r124 r127 194 194 195 195 Date& AbstractCalendar::update(void) 196 { return (getCurrentDate() = getCurrentDate() + t empo); }196 { return (getCurrentDate() = getCurrentDate() + timestep); } 197 197 198 198 } // namespace XMLIOSERVER -
XMLIO_V2/dev/dev_rv/src/XMLIO/data_treatment.hpp
r126 r127 13 13 { this->doTreatment(cal); } 14 14 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); } 17 17 18 18 void getEnabledFilesId(std::vector<std::string>& _vect) const … … 74 74 } 75 75 76 ~DataTreatment( )76 ~DataTreatment(void) 77 77 { /* Ne rien faire de plus */ } 78 78 -
XMLIO_V2/dev/dev_rv/src/XMLIO/date.hpp
r124 r127 8 8 public : 9 9 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) 12 14 { 13 if(! checkDate())15 if(!this->checkDate()) 14 16 WARNING("La date initialisée a été modifiée car elle était incorrecte par rapport au calendrier souhaité."); 15 17 } … … 18 20 , year(d.year), month(d.month), day(d.day), hour(d.hour), minute(d.minute), second(d.second) 19 21 { 20 if(! checkDate())22 if(!this->checkDate()) 21 23 WARNING("La date initialisée a été modifiée car elle était incorrecte par rapport au calendrier souhaité."); 22 24 } … … 50 52 } 51 53 52 static Date FromString(const string& str, const AbstractCalendar& cal);53 54 54 /// 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 ); } 59 59 int getMinute(void) const { return (minute); } 60 60 int getSecond(void) const { return (second); } … … 70 70 } 71 71 72 73 74 72 const AbstractCalendar& getRelCalendar(void) const { return (relCalendar); } 75 73 76 74 ~Date() 77 75 {/* Ne rien faire de plus */} 76 77 public : /* static */ 78 79 static Date FromString(const string& str, const AbstractCalendar& cal); 78 80 79 81 private : -
XMLIO_V2/dev/dev_rv/src/XMLIO/declare_attribut.hpp
r126 r127 18 18 Attr_##att_name(const att_type& _value) : Attribut<att_type>(_value) \ 19 19 { /* 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) \ 21 21 { /* Ne rien faire de plus */ } \ 22 22 \ … … 33 33 void setAttr##att_name(const att_type& _newattr) { att_name.setValue(_newattr); }\ 34 34 void set_##att_name (const att_type& _newattr) { att_name.setValue(_newattr); }\ 35 \ 35 36 Attr_##att_name att_name 36 37 -
XMLIO_V2/dev/dev_rv/src/XMLIO/declare_group.hpp
r126 r127 21 21 { _parse<child_type##Group>(_node, _withAttr); } \ 22 22 \ 23 virtual ~child_type##Group(void){} \ 23 virtual ~child_type##Group(void) \ 24 { /* Ne rien faire de plus */ } \ 24 25 }; \ 25 26 \ -
XMLIO_V2/dev/dev_rv/src/XMLIO/domain_attribut.hpp
r126 r127 16 16 DECLARE_ATTR(ni_glo , int) ; 17 17 DECLARE_ATTR(nj_glo , int) ; 18 18 19 DECLARE_ATTR(ibegin , int) ; 19 20 DECLARE_ATTR(iend , int) ; 20 21 DECLARE_ATTR(ni , int) ; 22 21 23 DECLARE_ATTR(jbegin , int) ; 22 24 DECLARE_ATTR(jend , int) ; 23 25 DECLARE_ATTR(nj , int) ; 26 24 27 DECLARE_ATTR(mask , Array(bool, 2)) ; 25 28 … … 29 32 DECLARE_ATTR(data_ibegin , int) ; 30 33 DECLARE_ATTR(data_jbegin , int) ; 34 31 35 DECLARE_ATTR(data_n_index , int) ; 32 36 DECLARE_ATTR(data_i_index , Array(int, 1)) ; 33 37 DECLARE_ATTR(data_j_index , Array(int, 1)) ; 38 39 DECLARE_ATTR(xvalue , Array(double, 1)) ; 40 DECLARE_ATTR(yvalue , Array(double, 1)) ; 34 41 35 42 DomainAttribut(void) : AttributRegistrar() … … 61 68 RegisterAttribut(&data_i_index) ; 62 69 RegisterAttribut(&data_j_index) ; 70 71 RegisterAttribut(&xvalue) ; 72 RegisterAttribut(&yvalue) ; 63 73 } 64 74 -
XMLIO_V2/dev/dev_rv/src/XMLIO/field_operation.hpp
r124 r127 9 9 public : 10 10 11 FieldOperation(const string& _id = string("inst"), const Duration& _dr = Hour)11 FieldOperation(const string& _id = string("inst"), const Duration& _dr = NoneDu) 12 12 : AbstractObject(_id), freqOp(_dr) 13 13 { /* Ne rien faire de plus */ } … … 22 22 void setFreqOp(const Duration& _dr) { freqOp = _dr; } 23 23 24 //void getOutputField(const Array<double, 1>& inField, Array<double, 1>& outField) const24 public : /* virtual */ 25 25 26 //void getStoreField(const Array<double, 1>& inField, Array<double, 1>& outField) const 27 28 virtual ~FieldOperation() 26 virtual ~FieldOperation(void) 29 27 { /* Ne rien faire de plus */ } 30 31 28 32 29 protected : -
XMLIO_V2/dev/dev_rv/src/XMLIO/file.hpp
r125 r127 16 16 {/* Ne rien faire de plus */} 17 17 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 39 18 AbstractDataOutput* getDataOutput(void) const { return (output); } 40 19 void initializeDataOutput(AbstractDataOutput* _output) … … 50 29 { 51 30 std::set<const CGrid*> sgrid; 52 const std::vector<CField*> enabledFields = getEnabledFields();31 const std::vector<CField*> enabledFields = this->getEnabledFields(); 53 32 std::vector<CField*>::const_iterator it; 54 33 … … 59 38 } 60 39 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 61 53 const std::set<const CDomain*> getEnabledDomains(void) const 62 54 { 63 const std::set<const CGrid*> sgrid = getEnabledGrids();55 const std::set<const CGrid*> sgrid = this->getEnabledGrids(); 64 56 std::set<const CDomain*> sdomain; 65 57 … … 74 66 const std::set<const CAxis*> getEnabledAxis(void) const 75 67 { 76 const std::set<const CGrid*> sgrid = getEnabledGrids();68 const std::set<const CGrid*> sgrid = this->getEnabledGrids(); 77 69 std::set<const CAxis*> saxis; 78 70 … … 84 76 return (saxis); 85 77 } 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(); }92 78 93 79 void resolveFieldRefInheritance(void) … … 144 130 } 145 131 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 146 158 virtual ~CFile(void) 147 159 { … … 149 161 if(output != NULL) delete output; 150 162 } 163 164 public : /* static */ 165 166 static string GetName(void) { return ("file"); } 167 static string GetDefName(void) { return (CFile::GetName()); } 151 168 152 169 private : -
XMLIO_V2/dev/dev_rv/src/XMLIO/grid.hpp
r125 r127 11 11 public: 12 12 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) 14 16 { /* Ne rien faire de plus */ } 15 17 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) 17 21 { /* Ne rien faire de plus */ } 18 22 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); } 23 24 const CDomain* getRelDomain(void) const { return (domain); } 24 25 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 } 33 58 34 59 inline void computeIndex(void); … … 36 61 bool _hasAxis(void) const { return (hasAxis); } 37 62 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 */ 48 71 49 72 virtual ~CGrid(void) 50 73 { /* Ne rien faire de plus */ } 51 74 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 52 110 private: 53 111 54 112 bool hasAxis ; 55 113 56 CAxis * axis ;57 CDomain * domain ;114 CAxis * axis ; 115 CDomain * domain ; 58 116 59 117 Array<int, 1> storeIndex ; … … 64 122 }; // class CGrid 65 123 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 130 124 void CGrid::computeIndex(void) 131 125 { 132 133 126 int ni = domain->ni ; 134 127 int nj = domain->nj ; … … 196 189 } 197 190 } 198 199 /** Pour tests200 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 217 191 } 218 192 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 250 195 { 251 196 for(int n = 0; n < storeIndex.size(); n++) … … 253 198 } 254 199 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 256 202 { 257 203 for(int n = 0; n < storeIndex.size(); n++) -
XMLIO_V2/dev/dev_rv/src/XMLIO/group_template.hpp
r126 r127 90 90 public : /* virtual */ 91 91 92 virtual ~GroupTemplate( )92 virtual ~GroupTemplate(void) 93 93 { 94 94 for (unsigned int i = 0; i < childList.getVector().size(); i++) -
XMLIO_V2/dev/dev_rv/src/XMLIO/main.f90
r115 r127 1 1 PROGRAM main 2 IMPLICIT NONE2 IMPLICIT NONE 3 3 4 4 CALL main_c -
XMLIO_V2/dev/dev_rv/src/XMLIO/xml_node.hpp
r126 r127 108 108 109 109 Poco::XML::Node * getCNode(void) const { return (this->cNode); } 110 110 111 void setCNode(Poco::XML::Node * _otherNode) { this->cNode = _otherNode; } 111 112 … … 129 130 Poco::XML::Node* cNode; 130 131 131 st ring rootName;132 std::string rootName; 132 133 133 134 };// class XMLNode -
XMLIO_V2/dev/dev_rv/src/XMLIO/xml_parser.hpp
r125 r127 31 31 { WARNING("Le context ne sera pas traité car il n'est pas identifié !"); continue; } 32 32 33 if( Context::GetAllListObject().find(attributes["id"]) != Context::GetAllListObject().end()) 33 if( Context::GetAllListObject().find(attributes["id"]) != 34 Context::GetAllListObject().end()) 34 35 { WARNING("Le context ne sera pas traité car il existe déjà un autre context possédant le même nom !"); continue; } 35 36 … … 46 47 } while (_node.goToNextElement()); 47 48 } 49 48 50 }; // class XMLParser 49 51 } // namespace XML -
XMLIO_V2/dev/dev_rv/src/XMLIO/xmlio.hpp
r126 r127 67 67 #include "file_attribut.hpp" 68 68 69 #undef DECLARE_ATTR 70 69 71 #include "group_template.hpp" 70 72 #include "declare_group.hpp" … … 76 78 #include "grid.hpp" 77 79 #include "file.hpp" 80 81 #undef DECLARE_GROUP 78 82 79 83 //....
Note: See TracChangeset
for help on using the changeset viewer.