source: XMLIO_V2/dev/dev_rv/src/xmlio/node/domain.cpp @ 270

Last change on this file since 270 was 265, checked in by hozdoba, 13 years ago

Corrections après tests sur titane

File size: 25.3 KB
RevLine 
[152]1#include "domain.hpp"
2
3#include "attribute_template_impl.hpp"
4#include "object_template_impl.hpp"
5#include "group_template_impl.hpp"
6
[187]7#include "mpi_manager.hpp"
8
[180]9#include <algorithm>
10
[168]11namespace xmlioserver {
12namespace tree {
13   
14   /// ////////////////////// Définitions ////////////////////// ///
[152]15
[168]16   CDomain::CDomain(void)
17      : CObjectTemplate<CDomain>(), CDomainAttributes()
[187]18      , isChecked(false), local_mask(new CArray<int, 2>(boost::extents[0][0])), relFiles()
[180]19      , ibegin_sub(), iend_sub(), jbegin_sub(), jend_sub()
[182]20      , lonvalue_sub(), latvalue_sub()
[168]21   { /* Ne rien faire de plus */ }
[152]22
[168]23   CDomain::CDomain(const StdString & id)
24      : CObjectTemplate<CDomain>(id), CDomainAttributes()
[187]25      , isChecked(false), local_mask(new CArray<int, 2>(boost::extents[0][0])), relFiles()
[180]26      , ibegin_sub(), iend_sub(), jbegin_sub(), jend_sub()
[182]27      , lonvalue_sub(), latvalue_sub()
[168]28   { /* Ne rien faire de plus */ }
[152]29
[168]30   CDomain::~CDomain(void)
[182]31   { 
32      this->local_mask.reset();
33      for (StdSize i = 0; i < this->lonvalue_sub.size(); i++)
34      {
35         this->lonvalue_sub[i].reset();
36         this->latvalue_sub[i].reset();
37      }     
38   }
[152]39
[168]40   ///---------------------------------------------------------------
[152]41
[168]42   const std::set<StdString> & CDomain::getRelFiles(void) const
43   {
44      return (this->relFiles);
45   }
[152]46
[180]47   //----------------------------------------------------------------
[184]48   
49   bool CDomain::hasZoom(void) const
50   {
51      return ((this->zoom_ni.getValue() != this->ni_glo.getValue()) && 
52              (this->zoom_nj.getValue() != this->nj_glo.getValue()));
53   }
54   
55   //----------------------------------------------------------------
56   
57   bool CDomain::isEmpty(void) const
58   {
59      return ((this->zoom_ni_loc.getValue() == 0) || 
60              (this->zoom_nj_loc.getValue() == 0));
61   }
[180]62
[184]63   //----------------------------------------------------------------
64
[168]65   bool CDomain::IsWritten(const StdString & filename) const
66   {
67      return (this->relFiles.find(filename) != this->relFiles.end());
68   }
[152]69
[180]70   //----------------------------------------------------------------
71
[168]72   void CDomain::addRelFile(const StdString & filename)
73   {
74      this->relFiles.insert(filename);
75   }
[152]76
[168]77   //----------------------------------------------------------------
[152]78
[180]79   void CDomain::fromBinary(StdIStream & is)
80   {
81      SuperClass::fromBinary(is);
82     
83      this->ibegin_sub.push_back(this->ibegin.getValue());
84      this->jbegin_sub.push_back(this->jbegin.getValue());
85      this->iend_sub.push_back(this->iend.getValue());
[182]86      this->jend_sub.push_back(this->jend.getValue()); 
[180]87     
[182]88      this->latvalue_sub.push_back(this->latvalue.getValue());
89      this->lonvalue_sub.push_back(this->lonvalue.getValue());   
90     
[180]91#define CLEAR_ATT(name_)\
92      SuperClassAttribute::operator[](#name_)->clear()
93
94         CLEAR_ATT(mask);
95         CLEAR_ATT(data_n_index);
96         CLEAR_ATT(data_i_index);
97         CLEAR_ATT(data_j_index);
98         
99         CLEAR_ATT(data_ni);
100         CLEAR_ATT(data_nj);
101         CLEAR_ATT(data_ibegin);
102         CLEAR_ATT(data_jbegin);
103         
104         CLEAR_ATT(ni);
105         CLEAR_ATT(nj);
106         
107#undef CLEAR_ATT
108
109      this->ibegin.setValue(*std::min_element(this->ibegin_sub.begin(),this->ibegin_sub.end()));
110      this->jbegin.setValue(*std::min_element(this->jbegin_sub.begin(),this->jbegin_sub.end()));
111      this->iend.setValue(*std::max_element(this->iend_sub.begin(),this->iend_sub.end()));
112      this->jend.setValue(*std::max_element(this->jend_sub.begin(),this->jend_sub.end()));
113   }
114
115   //----------------------------------------------------------------
116
[168]117   StdString CDomain::GetName(void)   { return (StdString("domain")); }
118   StdString CDomain::GetDefName(void){ return (CDomain::GetName()); }
119   ENodeType CDomain::GetType(void)   { return (eDomain); }
[152]120
[168]121   //----------------------------------------------------------------
[152]122
[168]123   void CDomain::checkGlobalDomain(void)
124   {
125      if ((ni_glo.isEmpty() || ni_glo.getValue() <= 0 ) ||
126          (ni_glo.isEmpty() || nj_glo.getValue() <= 0 ))
127         ERROR("CDomain::checkAttributes(void)",
[187]128               << "[ Id = " << this->getId() << " ] "
[168]129               << "Le domaine global est mal défini,"
130               << " vérifiez les valeurs de \'ni_glo\' et \'nj_glo\' !") ;
131   }
[152]132
[168]133   //----------------------------------------------------------------
[152]134
[168]135   void CDomain::checkLocalIDomain(void)
136   {
137      if (!ni.isEmpty() && !ibegin.isEmpty() && iend.isEmpty())
138         iend.setValue(ibegin.getValue() + ni.getValue() - 1) ;
139
140      else if (!ni.isEmpty() && !iend.isEmpty()   && ibegin.isEmpty())
141         ibegin.setValue( - ni.getValue() + iend.getValue() + 1) ;
142
143      else if (!ibegin.isEmpty() && !iend.isEmpty() && ni.isEmpty())
144         ni.setValue(iend.getValue() - ibegin.getValue() + 1) ;
145
146      else if (!ibegin.isEmpty() && !iend.isEmpty() &&
147               !ni.isEmpty() && (iend.getValue() != ibegin.getValue() + ni.getValue() - 1))
[152]148      {
[168]149         ERROR("CDomain::checkAttributes(void)",
150               << "Le domaine est mal défini,"
151               << " iend est différent de (ibegin + ni - 1) !") ;
152      }
153      else
154      {
155         ERROR("CDomain::checkAttributes(void)",
156               << "Le domaine est mal défini,"
157               << " deux valeurs au moins parmis iend, ibegin, ni doivent être définies !") ;
158      }
[152]159
160
[168]161      if (ni.getValue() < 0 || ibegin.getValue() > iend.getValue() ||
162          ibegin.getValue() < 1 || iend.getValue() > ni_glo.getValue())
163         ERROR("CDomain::checkAttributes(void)",
[187]164               << "[ Id = " << this->getId() << " ] "
[168]165               << "Domaine local mal défini,"
166               << " vérifiez les valeurs ni, ni_glo, ibegin, iend") ;
[152]167
[168]168   }
[152]169
[168]170   //----------------------------------------------------------------
[152]171
[168]172   void CDomain::checkLocalJDomain(void)
173   {
174      if (!nj.isEmpty() && !jbegin.isEmpty() && jend.isEmpty())
175         jend.setValue(jbegin.getValue() + nj.getValue() - 1) ;
[152]176
[168]177      else if (!nj.isEmpty() && !jend.isEmpty() && jbegin.isEmpty())
178         jbegin.setValue( - nj.getValue() + jend.getValue() + 1) ;
[152]179
[168]180      else if (!jbegin.isEmpty() && !jend.isEmpty() && nj.isEmpty())
181         nj.setValue(jend.getValue() - jbegin.getValue() + 1) ;
[152]182
[183]183      else if (!jbegin.isEmpty() && !jend.isEmpty() && !nj.isEmpty() &&
184               (jend.getValue() != jbegin.getValue() + nj.getValue() - 1))
[152]185      {
[168]186         ERROR("CDomain::checkAttributes(void)",
187               << "Le domaine est mal défini,"
188               << " iend est différent de (jbegin + nj - 1) !") ;
189      }
190      else
191      {
192         ERROR("CDomain::checkAttributes(void)",
193               << "Le domaine est mal défini,"
194               << " deux valeurs au moins parmis jend, jbegin, nj doivent être définies !") ;
195      }
[152]196
[168]197      if (nj.getValue() < 0 || jbegin.getValue() > jend.getValue() ||
198          jbegin.getValue() < 1 || jend.getValue() > nj_glo.getValue())
199         ERROR("CDomain::checkAttributes(void)",
200               << "Domaine local mal défini,"
201               << " vérifiez les valeurs nj, nj_glo, jbegin, jend") ;
202   }
[152]203
[168]204   //----------------------------------------------------------------
[152]205
[168]206   void CDomain::checkMask(void)
207   {
[183]208      using namespace std;
209     
210      int ibegin_mask = 0,
211          jbegin_mask = 0,
212          iend_mask = iend.getValue() - ibegin.getValue(),
213          jend_mask = jend.getValue() - jbegin.getValue();
214     
215      if (!zoom_ibegin.isEmpty())
216      {
[184]217         int zoom_iend = zoom_ibegin.getValue() + zoom_ni.getValue() - 1;
[183]218         int zoom_jend = zoom_jbegin.getValue() + zoom_nj.getValue() - 1;
219         
220         ibegin_mask = max (ibegin.getValue(), zoom_ibegin.getValue());
221         jbegin_mask = max (jbegin.getValue(), zoom_jbegin.getValue());
222         iend_mask   = min (iend.getValue(), zoom_iend);
223         jend_mask   = min (jend.getValue(), zoom_jend);
[184]224                 
[183]225         ibegin_mask -= ibegin.getValue();
226         jbegin_mask -= jbegin.getValue();
227         iend_mask   -= ibegin.getValue();
228         jend_mask   -= jbegin.getValue();
229      }
230     
231      //~ std::cout << "-------------------" << std::endl
[184]232                //~ << "zoom : " << std::boolalpha << this->hasZoom() << std::endl
233                //~ << "size : " << ni.getValue()  << " X " << nj.getValue()   << std::endl
234                //~ << "it : " << ibegin.getValue() << ", " << iend.getValue() << std::endl
235                //~ << "jt : " << jbegin.getValue() << ", " << jend.getValue() << std::endl
236                //~ << "im : " << ibegin_mask << ", " << iend_mask << std::endl
237                //~ << "jm : " << jbegin_mask << ", " << jend_mask << std::endl
238                //~ << "-------------------" << std::endl;
[183]239
[168]240      if (!mask.isEmpty())
241      {
[183]242         ARRAY(bool, 2) mask_ = mask.getValue();
[168]243         unsigned int niu = ni.getValue(), nju = nj.getValue();
[183]244         if ((mask_->shape()[0] != niu) ||
245             (mask_->shape()[1] != nju))
[152]246            ERROR("CDomain::checkAttributes(void)",
[168]247                  <<"Le masque n'a pas la même taille que le domaine local") ;
[183]248                 
249         for (int i = 0; i < ni.getValue(); i++)
250         {
251            for (int j = 0; j < nj.getValue(); j++)
252            {
253               if (i < ibegin_mask && i > iend_mask &&
254                   j < jbegin_mask && j > jend_mask )
255                     (*mask_)[i][j] = false;
256            }
257         }
[152]258      }
[168]259      else // (!mask.hasValue())
260      { // Si aucun masque n'est défini,
261        // on en crée un nouveau qui valide l'intégralité du domaine.
262         ARRAY_CREATE(__arr, bool, 2, [ni.getValue()][nj.getValue()]);
263         for (int i = 0; i < ni.getValue(); i++)
[183]264         {
[168]265            for (int j = 0; j < nj.getValue(); j++)
[183]266            {
267               if (i >= ibegin_mask && i <= iend_mask &&
268                   j >= jbegin_mask && j <= jend_mask )
269                     (*__arr)[i][j] = true;
270               else  (*__arr)[i][j] = false;
271            }
272         }
273               
[168]274         mask.setValue(__arr);
[182]275         __arr.reset();
[168]276      }
277   }
[152]278
279
[168]280   //----------------------------------------------------------------
281
282   void CDomain::checkDomainData(void)
[180]283   {     
[168]284      if (!data_dim.isEmpty() &&
285         !(data_dim.getValue() == 1 || data_dim.getValue() == 2))
[152]286      {
[168]287         ERROR("CDomain::checkAttributes(void)",
288               << "Dimension des données non comptatible (doit être 1 ou 2) !") ;
[152]289      }
[168]290      else if (data_dim.isEmpty())
291      {
292         ERROR("CDomain::checkAttributes(void)",
293               << "Dimension des données non définie !") ;
294      }
[152]295
[168]296      if (data_ibegin.isEmpty())
297         data_ibegin.setValue(0) ;
298      if (data_jbegin.isEmpty() && (data_dim.getValue() == 2))
[187]299         data_jbegin.setValue(0) ;
[152]300
[168]301      if (!data_ni.isEmpty() && (data_ni.getValue() <= 0))
302      {
303         ERROR("CDomain::checkAttributes(void)",
304               << "Dimension des données négative (data_ni).") ;
305      }
306      else if (data_ni.isEmpty())
307      {
308         data_ni.setValue((data_dim.getValue() == 1)
309                           ? (ni.getValue() * nj.getValue())
310                           : ni.getValue());
311      }
[152]312
[168]313      if (data_dim.getValue() == 2)
[152]314      {
[168]315         if (!data_nj.isEmpty() && (data_nj.getValue() <= 0) )
[152]316         {
317            ERROR("CDomain::checkAttributes(void)",
[168]318                  << "Dimension des données négative (data_nj).") ;
[152]319         }
[168]320         else if (data_nj.isEmpty())
321            data_nj.setValue(nj.getValue()) ;
322      }
[152]323
[168]324   }
[152]325
[168]326   //----------------------------------------------------------------
327
328   void CDomain::checkCompression(void)
329   {
330      if (!data_i_index.isEmpty())
331      {
332         int ssize = data_i_index.getValue()->size();
333         if (!data_n_index.isEmpty() &&
334            (data_n_index.getValue() != ssize))
[152]335         {
336            ERROR("CDomain::checkAttributes(void)",
[168]337                  <<"Dimension data_i_index incompatible avec data_n_index.") ;
[152]338         }
[168]339         else if (data_n_index.isEmpty())
340            data_n_index.setValue(ssize) ;
[152]341
342         if (data_dim.getValue() == 2)
343         {
[168]344            if (!data_j_index.isEmpty() &&
345               (data_j_index.getValue()->size() != data_i_index.getValue()->size()))
[152]346            {
347               ERROR("CDomain::checkAttributes(void)",
[168]348                     <<"Dimension data_j_index incompatible avec data_i_index.") ;
[152]349            }
[168]350            else if (data_j_index.isEmpty())
351            {
352               ERROR("CDomain::checkAttributes(void)",
353                     <<"La donnée data_j_index doit être renseignée !") ;
354            }
[152]355         }
356      }
[168]357      else
358      {
359         if (!data_n_index.isEmpty() ||
360            ((data_dim.getValue() == 2) && (!data_j_index.isEmpty())))
361            ERROR("CDomain::checkAttributes(void)", << "data_i_index non défini") ;
362      }
[152]363
[168]364      if (data_n_index.isEmpty())
365      { // -> bloc re-vérifié OK
366         if (data_dim.getValue() == 1)
[152]367         {
[168]368            const int dni = data_ni.getValue();
369            ARRAY_CREATE(__arri, int, 1, [dni]);
370            data_n_index.setValue(dni);
371            for (int i = 0; i < dni; i++)
372               (*__arri)[i] = i+1 ;
373            data_i_index.setValue(__arri) ;
[152]374         }
[168]375         else   // (data_dim == 2)
[152]376         {
[168]377            const int dni = data_ni.getValue() * data_nj.getValue();
[180]378           
[168]379            ARRAY_CREATE(__arri, int, 1, [dni]);
380            ARRAY_CREATE(__arrj, int, 1, [dni]);               
381            data_n_index.setValue(dni);
382           
[265]383            //for(int count = 0, i = 0; i  < data_ni.getValue(); i++)
384            //for(int j = 0; j < data_nj.getValue(); j++, count++)
385           
386            for(int count = 0, j = 0; j  < data_nj.getValue(); j++)
[182]387            {
[265]388               for(int i = 0; i < data_ni.getValue(); i++, count++)
[183]389               {
[168]390                  (*__arri)[count] = i+1 ;
391                  (*__arrj)[count] = j+1 ;
392               }
[182]393            }
[168]394            data_i_index.setValue(__arri) ;
[182]395            data_j_index.setValue(__arrj) ;           
396            __arri.reset();
397            __arrj.reset();
[152]398         }
399      }
[168]400   }
[152]401
[168]402   //----------------------------------------------------------------
[182]403   
[265]404   void CDomain::completeLonLatClient(void)
[182]405   {
[187]406      ARRAY_CREATE(lonvalue_temp, double, 1, [0]);
407      ARRAY_CREATE(latvalue_temp, double, 1, [0]);
[185]408     
[265]409      const int zoom_ibegin_client  = zoom_ibegin_loc.getValue(),
410                zoom_jbegin_client  = zoom_jbegin_loc.getValue(),
411                zoom_ni_client      = zoom_ni_loc.getValue(),
412                zoom_nj_client      = zoom_nj_loc.getValue();
413               
414      ARRAY(double, 1) lonvalue_ = this->lonvalue.getValue(),
415                       latvalue_ = this->latvalue.getValue();
416               
417      if (this->data_dim.getValue() == 2)
418      {
419         StdSize dm = zoom_ni_client * zoom_nj_client;
420
421         lonvalue_temp->resize(boost::extents[dm]);
422         latvalue_temp->resize(boost::extents[dm]);
423         
424         for (int i = 0; i < zoom_ni_client; i++)
425         {
426            for (int j = 0; j < zoom_nj_client; j++)
427            {
428               (*lonvalue_temp)[i + j * zoom_ni_client] = (*lonvalue_)[(i + zoom_ibegin_client -1)+(j + zoom_jbegin_client -1)*ni.getValue()];             
429               (*latvalue_temp)[i + j * zoom_ni_client] = (*latvalue_)[(i + zoom_ibegin_client -1)+(j + zoom_jbegin_client -1)*ni.getValue()];
430            }
431         }
432         this->lonvalue.setValue(lonvalue_temp);
433         this->latvalue.setValue(latvalue_temp);
434      }
435      else
436      {
437         lonvalue_temp->resize(boost::extents[zoom_ni_client]);
438         latvalue_temp->resize(boost::extents[zoom_nj_client]);
439         
440         for (int i = zoom_ibegin_client - 1; i < (zoom_ni_client - zoom_ibegin_client + 1); i++)
441         {
442            (*lonvalue_temp)[i] = (*lonvalue_)[i]; 
443         }
444         
445         for (int j = zoom_ibegin_client - 1; j < (zoom_nj_client - zoom_jbegin_client + 1); j++)
446         {
447            (*latvalue_temp)[j] = (*latvalue_)[j];
448         }
449         
450         this->lonvalue.setValue(lonvalue_temp);
451         this->latvalue.setValue(latvalue_temp);
452      } 
453   }
454 
455   //----------------------------------------------------------------
456     
457   void CDomain::completeLonLatServer(void)
458   {
459      ARRAY_CREATE(lonvalue_temp, double, 1, [0]);
460      ARRAY_CREATE(latvalue_temp, double, 1, [0]);
461     
[187]462      const int ibegin_serv  = ibegin.getValue(),
463                jbegin_serv  = jbegin.getValue(),
464                zoom_ni_serv = zoom_ni_loc.getValue(),
465                zoom_nj_serv = zoom_nj_loc.getValue();
466                     
467      /*std::cout << "Rang du serveur :" << comm::CMPIManager::GetCommRank()   << std::endl
468                << "Begin serv : "     << ibegin_serv << ", " << jbegin_serv <<  std::endl
469                << "End serv : "       << iend_serv   << ", " << jend_serv   <<  std::endl
470                << "Zoom_loc begin : " << zoom_ibegin_loc << ", " << zoom_jbegin_loc <<  std::endl
471                << "Zoom_loc size : "  << zoom_ni_loc << ", " << zoom_nj_loc <<  std::endl;*/
472     
473     
[182]474      ARRAY(double, 1) lonvalue_ = this->lonvalue.getValue(),
475                       latvalue_ = this->latvalue.getValue();
476                       
477      if (this->data_dim.getValue() == 2)
478      {
[187]479         StdSize dm = zoom_ni_serv * zoom_nj_serv;
[185]480         StdSize dn = this->ni.getValue() * this->nj.getValue();
[187]481         
[182]482         lonvalue_->resize(boost::extents[dn]);
483         latvalue_->resize(boost::extents[dn]);
[187]484         lonvalue_temp->resize(boost::extents[dm]);
485         latvalue_temp->resize(boost::extents[dm]);
486         
[182]487         for (StdSize k = 0; k < lonvalue_sub.size(); k++)
488         {
489            int l = 0;
490            ARRAY(double, 1) lonvalue_loc = this->lonvalue_sub[k],
491                             latvalue_loc = this->latvalue_sub[k];
492            const int ibegin_loc = ibegin_sub[k], iend_loc = iend_sub[k],
493                      jbegin_loc = jbegin_sub[k], jend_loc = jend_sub[k];
[187]494                     
495            for (int i = ibegin_loc - ibegin_serv; i < (iend_loc - ibegin_serv + 1); i++)
[182]496            {
[187]497               for (int j = jbegin_loc - jbegin_serv; j < (jend_loc - jbegin_serv + 1); j++)
[182]498               {
[265]499                  (*lonvalue_)[i + j * this->ni.getValue()] = (*lonvalue_loc)[l];      // erreur       
500                  (*latvalue_)[i + j * this->ni.getValue()] = (*latvalue_loc)[l++];    // erreur
[182]501               }
502            }
[187]503         }
504         this->lonvalue.setValue(lonvalue_temp);
505         this->latvalue.setValue(latvalue_temp);
[182]506      }
507      else
508      {
[187]509         lonvalue_->resize(boost::extents[this->ni.getValue()]);
510         latvalue_->resize(boost::extents[this->nj.getValue()]);
511         lonvalue_temp->resize(boost::extents[zoom_ni_serv]);
512         latvalue_temp->resize(boost::extents[zoom_nj_serv]);
[182]513         
514         for (StdSize k = 0; k < lonvalue_sub.size(); k++)
515         {
516            int l = 0;
517            ARRAY(double, 1) lonvalue_loc = this->lonvalue_sub[k],
518                             latvalue_loc = this->latvalue_sub[k];
519            const int ibegin_loc = ibegin_sub[k], iend_loc = iend_sub[k],
520                      jbegin_loc = jbegin_sub[k], jend_loc = jend_sub[k];
521                     
[187]522            for (int i = ibegin_loc - ibegin_serv; i < (iend_loc - ibegin_loc + 1); i++)
[182]523               (*lonvalue_)[i] = (*lonvalue_loc)[l++];
524               
[187]525            for (int j = jbegin_loc - jbegin_serv; j < (jend_loc - jbegin_loc + 1); j++)
[182]526               (*latvalue_)[j] = (*latvalue_loc)[l++];
[187]527         }       
528         this->lonvalue.setValue(lonvalue_temp);
529         this->latvalue.setValue(latvalue_temp);
[182]530      }
531   }
532
533   //----------------------------------------------------------------
534
[183]535   void CDomain::checkZoom(void)
536   {
[184]537      // Résolution et vérification des données globales de zoom.
[183]538      if (!this->zoom_ni.isEmpty() || !this->zoom_nj.isEmpty() ||
539          !this->zoom_ibegin.isEmpty() || !this->zoom_jbegin.isEmpty())
540      {
541         if (this->zoom_ni.isEmpty()     && this->zoom_nj.isEmpty() &&
542             this->zoom_ibegin.isEmpty() && this->zoom_jbegin.isEmpty())
543         {
544            ERROR("CDomain::checkZoom(void)",
545                  <<"Les attributs définissant un zoom doivent tous être définis") ;
546         }
547         else
548         {
[184]549            int zoom_iend = zoom_ibegin.getValue() + zoom_ni.getValue() - 1;
[183]550            int zoom_jend = zoom_jbegin.getValue() + zoom_nj.getValue() - 1;
551               
552            if (zoom_ibegin.getValue() < 1  || zoom_jbegin.getValue() < 1 ||
[184]553                zoom_iend > ni_glo.getValue() || zoom_jend > nj_glo.getValue())
[183]554               ERROR("CDomain::checkZoom(void)",
555                     << "Zoom mal défini,"
556                     << " vérifiez les valeurs zoom_ni, zoom_nj, zoom_ibegin, zoom_ibegin") ;
557         }
[184]558      }
559      else
560      {
561         this->zoom_ni.setValue(this->ni_glo.getValue()); 
562         this->zoom_nj.setValue(this->nj_glo.getValue());
563         this->zoom_ibegin.setValue(1);
564         this->zoom_jbegin.setValue(1);
565      }
566      // Résolution des données locales de zoom.
567      {
568         int zoom_iend = zoom_ibegin.getValue() + zoom_ni.getValue() - 1;
569         int zoom_jend = zoom_jbegin.getValue() + zoom_nj.getValue() - 1;
570         
571         if ((zoom_ibegin.getValue() > iend.getValue()) || 
572             (zoom_iend < ibegin.getValue()))
573         {
574            zoom_ni_loc.setValue(0);
575            zoom_ibegin_loc.setValue(-1);
576         }
577         else
578         {
579            int zoom_ibegin_loc_ = (zoom_ibegin.getValue() > ibegin.getValue()) 
580                                 ? zoom_ibegin.getValue()
581                                 : ibegin.getValue();
582            int zoom_iend_loc_  = (zoom_iend < iend.getValue()) 
583                                 ? zoom_iend
584                                 : iend.getValue();
585            int zoom_ni_loc_ = zoom_iend_loc_ - zoom_ibegin_loc_ + 1;
586           
587            zoom_ni_loc.setValue(zoom_ni_loc_);
588            zoom_ibegin_loc.setValue(zoom_ibegin_loc_-ibegin.getValue()+1);
589         }
590         
591         if ((zoom_jbegin.getValue() > jend.getValue()) || 
592             (zoom_jend < jbegin.getValue()))
593         {
594            zoom_nj_loc.setValue(0);
595            zoom_jbegin_loc.setValue(-1);
596         }
597         else
598         {
599            int zoom_jbegin_loc_ = (zoom_jbegin.getValue() > jbegin.getValue()) 
600                                 ? zoom_jbegin.getValue()
601                                 : jbegin.getValue();
602            int zoom_jend_loc_  = (zoom_jend < jend.getValue()) 
603                                 ? zoom_jend
604                                 : jend.getValue();
605            int zoom_nj_loc_ = zoom_jend_loc_ - zoom_jbegin_loc_ + 1;
606           
607            zoom_nj_loc.setValue(zoom_nj_loc_);
608            zoom_jbegin_loc.setValue(zoom_jbegin_loc_-jbegin.getValue()+1);
609         }
610      }
[183]611   }
612
613   //----------------------------------------------------------------
614
[168]615   void CDomain::checkAttributes(void)
616   {
617      if (this->isChecked) return;
[152]618
[168]619      this->checkGlobalDomain();
620      this->checkLocalIDomain();
621      this->checkLocalJDomain();
[183]622     
623      this->checkZoom();
[152]624
[182]625      if (this->latvalue_sub.size() == 0)
[183]626      { // CÃŽté client uniquement
[182]627         this->checkMask();
628         this->checkDomainData();
629         this->checkCompression();
[265]630         
631         this->ibegin_sub.push_back(this->ibegin.getValue());
632         this->jbegin_sub.push_back(this->jbegin.getValue());
633         this->iend_sub.push_back(this->iend.getValue());
634         this->jend_sub.push_back(this->jend.getValue()); 
635     
636         this->latvalue_sub.push_back(this->latvalue.getValue());
637         this->lonvalue_sub.push_back(this->lonvalue.getValue()); 
638         
639         if (!this->isEmpty())
640         {
641            this->completeLonLatClient();
642         }
[182]643      }
644      else
[183]645      { // CÃŽté serveur uniquement
[187]646         if (!this->isEmpty())
[265]647            this->completeLonLatServer();
[182]648      }
[168]649      this->completeMask();
[152]650
[168]651      this->isChecked = true;
652   }
[182]653   
654   //----------------------------------------------------------------
655   
[168]656   void CDomain::completeMask(void)
657   {
[185]658      this->local_mask->resize(boost::extents[zoom_ni_loc.getValue()][zoom_nj_loc.getValue()]);
[168]659   }
[152]660
[182]661   //----------------------------------------------------------------
662
[183]663   ARRAY(int, 2) CDomain::getLocalMask(void) const
[168]664   {
665      return (this->local_mask);
666   }
[182]667   
668   //----------------------------------------------------------------
669   
670   const std::vector<int> & CDomain::getIBeginSub(void) const
671   {
672      return (this->ibegin_sub);
673   }
674   
675   //----------------------------------------------------------------
676   
677   const std::vector<int> & CDomain::getIEndSub(void) const
678   {
679      return (this->iend_sub);
680   }
681   
682   //----------------------------------------------------------------
683   
684   const std::vector<int> & CDomain::getJBeginSub(void) const
685   {
686      return (this->jbegin_sub);
687   }
688   
689   //----------------------------------------------------------------
690   
691   const std::vector<int> & CDomain::getJEndSub(void) const
692   {
693      return (this->iend_sub);
694   }
695   
696   //----------------------------------------------------------------
697   
698   const std::vector<ARRAY(double, 1)> & CDomain::getLonValueSub(void) const
699   {
700      return (this->lonvalue_sub);
701   }
702   
703   //----------------------------------------------------------------
704   
705   const std::vector<ARRAY(double, 1)> & CDomain::getLatValueSub(void) const
706   {
707      return (this->latvalue_sub);
708   }   
709   
[168]710   ///---------------------------------------------------------------
[152]711
[168]712} // namespace tree
[152]713} // namespace xmlioserver
Note: See TracBrowser for help on using the repository browser.