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
Line 
1#include "domain.hpp"
2
3#include "attribute_template_impl.hpp"
4#include "object_template_impl.hpp"
5#include "group_template_impl.hpp"
6
7#include "mpi_manager.hpp"
8
9#include <algorithm>
10
11namespace xmlioserver {
12namespace tree {
13   
14   /// ////////////////////// Définitions ////////////////////// ///
15
16   CDomain::CDomain(void)
17      : CObjectTemplate<CDomain>(), CDomainAttributes()
18      , isChecked(false), local_mask(new CArray<int, 2>(boost::extents[0][0])), relFiles()
19      , ibegin_sub(), iend_sub(), jbegin_sub(), jend_sub()
20      , lonvalue_sub(), latvalue_sub()
21   { /* Ne rien faire de plus */ }
22
23   CDomain::CDomain(const StdString & id)
24      : CObjectTemplate<CDomain>(id), CDomainAttributes()
25      , isChecked(false), local_mask(new CArray<int, 2>(boost::extents[0][0])), relFiles()
26      , ibegin_sub(), iend_sub(), jbegin_sub(), jend_sub()
27      , lonvalue_sub(), latvalue_sub()
28   { /* Ne rien faire de plus */ }
29
30   CDomain::~CDomain(void)
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   }
39
40   ///---------------------------------------------------------------
41
42   const std::set<StdString> & CDomain::getRelFiles(void) const
43   {
44      return (this->relFiles);
45   }
46
47   //----------------------------------------------------------------
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   }
62
63   //----------------------------------------------------------------
64
65   bool CDomain::IsWritten(const StdString & filename) const
66   {
67      return (this->relFiles.find(filename) != this->relFiles.end());
68   }
69
70   //----------------------------------------------------------------
71
72   void CDomain::addRelFile(const StdString & filename)
73   {
74      this->relFiles.insert(filename);
75   }
76
77   //----------------------------------------------------------------
78
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());
86      this->jend_sub.push_back(this->jend.getValue()); 
87     
88      this->latvalue_sub.push_back(this->latvalue.getValue());
89      this->lonvalue_sub.push_back(this->lonvalue.getValue());   
90     
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
117   StdString CDomain::GetName(void)   { return (StdString("domain")); }
118   StdString CDomain::GetDefName(void){ return (CDomain::GetName()); }
119   ENodeType CDomain::GetType(void)   { return (eDomain); }
120
121   //----------------------------------------------------------------
122
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)",
128               << "[ Id = " << this->getId() << " ] "
129               << "Le domaine global est mal défini,"
130               << " vérifiez les valeurs de \'ni_glo\' et \'nj_glo\' !") ;
131   }
132
133   //----------------------------------------------------------------
134
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))
148      {
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      }
159
160
161      if (ni.getValue() < 0 || ibegin.getValue() > iend.getValue() ||
162          ibegin.getValue() < 1 || iend.getValue() > ni_glo.getValue())
163         ERROR("CDomain::checkAttributes(void)",
164               << "[ Id = " << this->getId() << " ] "
165               << "Domaine local mal défini,"
166               << " vérifiez les valeurs ni, ni_glo, ibegin, iend") ;
167
168   }
169
170   //----------------------------------------------------------------
171
172   void CDomain::checkLocalJDomain(void)
173   {
174      if (!nj.isEmpty() && !jbegin.isEmpty() && jend.isEmpty())
175         jend.setValue(jbegin.getValue() + nj.getValue() - 1) ;
176
177      else if (!nj.isEmpty() && !jend.isEmpty() && jbegin.isEmpty())
178         jbegin.setValue( - nj.getValue() + jend.getValue() + 1) ;
179
180      else if (!jbegin.isEmpty() && !jend.isEmpty() && nj.isEmpty())
181         nj.setValue(jend.getValue() - jbegin.getValue() + 1) ;
182
183      else if (!jbegin.isEmpty() && !jend.isEmpty() && !nj.isEmpty() &&
184               (jend.getValue() != jbegin.getValue() + nj.getValue() - 1))
185      {
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      }
196
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   }
203
204   //----------------------------------------------------------------
205
206   void CDomain::checkMask(void)
207   {
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      {
217         int zoom_iend = zoom_ibegin.getValue() + zoom_ni.getValue() - 1;
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);
224                 
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
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;
239
240      if (!mask.isEmpty())
241      {
242         ARRAY(bool, 2) mask_ = mask.getValue();
243         unsigned int niu = ni.getValue(), nju = nj.getValue();
244         if ((mask_->shape()[0] != niu) ||
245             (mask_->shape()[1] != nju))
246            ERROR("CDomain::checkAttributes(void)",
247                  <<"Le masque n'a pas la même taille que le domaine local") ;
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         }
258      }
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++)
264         {
265            for (int j = 0; j < nj.getValue(); j++)
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               
274         mask.setValue(__arr);
275         __arr.reset();
276      }
277   }
278
279
280   //----------------------------------------------------------------
281
282   void CDomain::checkDomainData(void)
283   {     
284      if (!data_dim.isEmpty() &&
285         !(data_dim.getValue() == 1 || data_dim.getValue() == 2))
286      {
287         ERROR("CDomain::checkAttributes(void)",
288               << "Dimension des données non comptatible (doit être 1 ou 2) !") ;
289      }
290      else if (data_dim.isEmpty())
291      {
292         ERROR("CDomain::checkAttributes(void)",
293               << "Dimension des données non définie !") ;
294      }
295
296      if (data_ibegin.isEmpty())
297         data_ibegin.setValue(0) ;
298      if (data_jbegin.isEmpty() && (data_dim.getValue() == 2))
299         data_jbegin.setValue(0) ;
300
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      }
312
313      if (data_dim.getValue() == 2)
314      {
315         if (!data_nj.isEmpty() && (data_nj.getValue() <= 0) )
316         {
317            ERROR("CDomain::checkAttributes(void)",
318                  << "Dimension des données négative (data_nj).") ;
319         }
320         else if (data_nj.isEmpty())
321            data_nj.setValue(nj.getValue()) ;
322      }
323
324   }
325
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))
335         {
336            ERROR("CDomain::checkAttributes(void)",
337                  <<"Dimension data_i_index incompatible avec data_n_index.") ;
338         }
339         else if (data_n_index.isEmpty())
340            data_n_index.setValue(ssize) ;
341
342         if (data_dim.getValue() == 2)
343         {
344            if (!data_j_index.isEmpty() &&
345               (data_j_index.getValue()->size() != data_i_index.getValue()->size()))
346            {
347               ERROR("CDomain::checkAttributes(void)",
348                     <<"Dimension data_j_index incompatible avec data_i_index.") ;
349            }
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            }
355         }
356      }
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      }
363
364      if (data_n_index.isEmpty())
365      { // -> bloc re-vérifié OK
366         if (data_dim.getValue() == 1)
367         {
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) ;
374         }
375         else   // (data_dim == 2)
376         {
377            const int dni = data_ni.getValue() * data_nj.getValue();
378           
379            ARRAY_CREATE(__arri, int, 1, [dni]);
380            ARRAY_CREATE(__arrj, int, 1, [dni]);               
381            data_n_index.setValue(dni);
382           
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++)
387            {
388               for(int i = 0; i < data_ni.getValue(); i++, count++)
389               {
390                  (*__arri)[count] = i+1 ;
391                  (*__arrj)[count] = j+1 ;
392               }
393            }
394            data_i_index.setValue(__arri) ;
395            data_j_index.setValue(__arrj) ;           
396            __arri.reset();
397            __arrj.reset();
398         }
399      }
400   }
401
402   //----------------------------------------------------------------
403   
404   void CDomain::completeLonLatClient(void)
405   {
406      ARRAY_CREATE(lonvalue_temp, double, 1, [0]);
407      ARRAY_CREATE(latvalue_temp, double, 1, [0]);
408     
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     
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     
474      ARRAY(double, 1) lonvalue_ = this->lonvalue.getValue(),
475                       latvalue_ = this->latvalue.getValue();
476                       
477      if (this->data_dim.getValue() == 2)
478      {
479         StdSize dm = zoom_ni_serv * zoom_nj_serv;
480         StdSize dn = this->ni.getValue() * this->nj.getValue();
481         
482         lonvalue_->resize(boost::extents[dn]);
483         latvalue_->resize(boost::extents[dn]);
484         lonvalue_temp->resize(boost::extents[dm]);
485         latvalue_temp->resize(boost::extents[dm]);
486         
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];
494                     
495            for (int i = ibegin_loc - ibegin_serv; i < (iend_loc - ibegin_serv + 1); i++)
496            {
497               for (int j = jbegin_loc - jbegin_serv; j < (jend_loc - jbegin_serv + 1); j++)
498               {
499                  (*lonvalue_)[i + j * this->ni.getValue()] = (*lonvalue_loc)[l];      // erreur       
500                  (*latvalue_)[i + j * this->ni.getValue()] = (*latvalue_loc)[l++];    // erreur
501               }
502            }
503         }
504         this->lonvalue.setValue(lonvalue_temp);
505         this->latvalue.setValue(latvalue_temp);
506      }
507      else
508      {
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]);
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                     
522            for (int i = ibegin_loc - ibegin_serv; i < (iend_loc - ibegin_loc + 1); i++)
523               (*lonvalue_)[i] = (*lonvalue_loc)[l++];
524               
525            for (int j = jbegin_loc - jbegin_serv; j < (jend_loc - jbegin_loc + 1); j++)
526               (*latvalue_)[j] = (*latvalue_loc)[l++];
527         }       
528         this->lonvalue.setValue(lonvalue_temp);
529         this->latvalue.setValue(latvalue_temp);
530      }
531   }
532
533   //----------------------------------------------------------------
534
535   void CDomain::checkZoom(void)
536   {
537      // Résolution et vérification des données globales de zoom.
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         {
549            int zoom_iend = zoom_ibegin.getValue() + zoom_ni.getValue() - 1;
550            int zoom_jend = zoom_jbegin.getValue() + zoom_nj.getValue() - 1;
551               
552            if (zoom_ibegin.getValue() < 1  || zoom_jbegin.getValue() < 1 ||
553                zoom_iend > ni_glo.getValue() || zoom_jend > nj_glo.getValue())
554               ERROR("CDomain::checkZoom(void)",
555                     << "Zoom mal défini,"
556                     << " vérifiez les valeurs zoom_ni, zoom_nj, zoom_ibegin, zoom_ibegin") ;
557         }
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      }
611   }
612
613   //----------------------------------------------------------------
614
615   void CDomain::checkAttributes(void)
616   {
617      if (this->isChecked) return;
618
619      this->checkGlobalDomain();
620      this->checkLocalIDomain();
621      this->checkLocalJDomain();
622     
623      this->checkZoom();
624
625      if (this->latvalue_sub.size() == 0)
626      { // CÃŽté client uniquement
627         this->checkMask();
628         this->checkDomainData();
629         this->checkCompression();
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         }
643      }
644      else
645      { // CÃŽté serveur uniquement
646         if (!this->isEmpty())
647            this->completeLonLatServer();
648      }
649      this->completeMask();
650
651      this->isChecked = true;
652   }
653   
654   //----------------------------------------------------------------
655   
656   void CDomain::completeMask(void)
657   {
658      this->local_mask->resize(boost::extents[zoom_ni_loc.getValue()][zoom_nj_loc.getValue()]);
659   }
660
661   //----------------------------------------------------------------
662
663   ARRAY(int, 2) CDomain::getLocalMask(void) const
664   {
665      return (this->local_mask);
666   }
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   
710   ///---------------------------------------------------------------
711
712} // namespace tree
713} // namespace xmlioserver
Note: See TracBrowser for help on using the repository browser.