Changeset 300


Ignore:
Timestamp:
02/13/12 19:35:25 (12 years ago)
Author:
ymipsl
Message:

nouvelle version de developpement de xios

  • nouvelle interface fortran
  • recodage complet de la couche de communication
  • et bien d'autres choses...

YM

Location:
XMLIO_V2/dev/common
Files:
38 added
57 edited

Legend:

Unmodified
Added
Removed
  • XMLIO_V2/dev/common/Doxyfile

    r245 r300  
    620620# with spaces. 
    621621 
    622 INPUT                  = src/xmlio 
     622INPUT                  = src 
    623623 
    624624# This tag can be used to specify the character encoding of the source files  
  • XMLIO_V2/dev/common/bld.cfg

    r291 r300  
    2727bld::lib xios 
    2828bld::target libxios.a 
    29 bld::target main_server.exe  
     29#bld::target main_server.exe test_xios.exe  
     30bld::target server_main.exe test_cs.exe  
    3031bld::exe_dep 
    3132 
     
    4344bld::pp              false 
    4445bld::excl_dep        use::mod_prism_get_comm 
     46bld::excl_dep        use::mod_prism_get_localcomm_proto 
    4547bld::excl_dep        use::mod_prism_proto 
    4648bld::excl_dep        inc::mpif.h 
  • XMLIO_V2/dev/common/src/array.hpp

    r219 r300  
    99/// xmlioserver headers /// 
    1010#include "xmlioserver_spl.hpp" 
     11#include "buffer_in.hpp" 
     12#include "buffer_out.hpp" 
     13 
    1114 
    1215namespace xmlioserver 
    1316{ 
     17   template<size_t numDims> 
     18   detail::multi_array::extent_gen<numDims> getExtentNull(void) { return getExtentNull<numDims-1>()[0];} 
     19    
     20   template<> 
     21   detail::multi_array::extent_gen<1> getExtentNull<1>(void) { return extents[0]; } 
     22 
    1423   /// ////////////////////// Déclarations ////////////////////// /// 
    1524   template <typename ValueType, StdSize  NumDims, 
     
    2938            explicit CArray(const ExtentList & sizes); 
    3039 
     40         explicit CArray(); 
     41 
    3142         template <typename ExtentList> 
    3243            CArray(const ExtentList & sizes, const boost::general_storage_order<NumDims> & store); 
     
    3647 
    3748      public: 
    38        
     49 
    3950         /// Flux /// 
    4051         template <typename U, StdSize V, typename W> 
     
    5162         void fromBinary(StdIStream & is); 
    5263 
     64         size_t getSize(void) const ; 
     65         bool toBuffer  (CBufferOut& buffer) const; 
     66         bool fromBuffer(CBufferIn& buffer); 
     67 
     68 
    5369         /// Destructeur /// 
    5470         virtual ~CArray(void); 
    5571 
    5672   }; // class CArray 
     73    
    5774 
    5875   ///--------------------------------------------------------------- 
  • XMLIO_V2/dev/common/src/array_impl.hpp

    r219 r300  
    33 
    44#include "array_mac.hpp" 
     5#include "buffer_in.hpp" 
     6#include "buffer_out.hpp" 
    57 
    68namespace xmlioserver 
     
    1618   { /* Ne rien faire de plus */ } 
    1719 
     20   template <typename ValueType, StdSize NumDims, typename Allocator> 
     21       CArray<ValueType, NumDims, Allocator>::CArray() 
     22            : boost::multi_array<ValueType, NumDims, Allocator> 
     23                  (getExtentNull<NumDims>(), boost::fortran_storage_order()) 
     24   { /* Ne rien faire de plus */ } 
     25    
    1826   template <typename ValueType, StdSize NumDims, typename Allocator> 
    1927      template <typename ExtentList> 
     
    3341                                const CArray<ValueType, NumDims, Allocator> & array) 
    3442   { 
    35       os << (array.data()[0]) << "(" << array.shape()[0]; 
     43      os << "CArray (" ; 
    3644      for (StdSize i = 1; i < array.num_dimensions(); i++) 
    3745         os << ", " << array.shape()[i]; 
    38       os << ")" << (array.data()[array.num_elements()-1]); 
     46      os << ") = " ;  
     47      for (StdSize i = 0; i < array.num_elements(); i++) os << (array.data()[i])<<"  "; 
    3948      return (os); 
    4049   } 
     
    108117      is.read (reinterpret_cast<char*>(this->data()), nelem * sizeof(ValueType)); 
    109118   } 
     119   
     120    template <typename ValueType, StdSize NumDims, typename Allocator> 
     121    size_t CArray<ValueType, NumDims, Allocator>::getSize(void) const 
     122   { 
     123      typedef boost::multi_array_types::size_type LSize; 
     124      LSize nelem = this->num_elements(); 
     125      LSize ndim  = this->num_dimensions(); 
     126      const LSize * shape = this->shape(); 
     127      const ValueType * data = this->data(); 
     128      size_t ret ; 
     129      ret=sizeof(ndim) ; 
     130      for (LSize i = 0; i < ndim; i++ ) ret+=sizeof(shape[i]) ; 
     131      ret+=sizeof(nelem) ; 
     132      ret+=sizeof(ValueType)*nelem ; 
     133      return ret ; 
     134   } 
     135 
     136   template <typename ValueType, StdSize NumDims, typename Allocator> 
     137   bool CArray<ValueType, NumDims, Allocator>::toBuffer(CBufferOut& buffer) const 
     138   { 
     139      typedef boost::multi_array_types::size_type LSize; 
     140 
     141      LSize nelem = this->num_elements(); 
     142      LSize ndim  = this->num_dimensions(); 
     143      const LSize* shape = this->shape(); 
     144      const ValueType* data = this->data(); 
     145      bool ret ; 
     146       
     147      ret=buffer.put(ndim) ; 
     148      for (LSize i = 0; i < ndim; i++ ) ret&=buffer.put(shape[i]) ; 
     149      ret&=buffer.put(nelem) ; 
     150      ret&=buffer.put(data,nelem) ; 
     151      return ret ; 
     152  } 
     153 
     154   template <typename ValueType, StdSize NumDims, typename Allocator> 
     155   bool CArray<ValueType, NumDims, Allocator>::fromBuffer(CBufferIn& buffer) 
     156   { 
     157      typedef boost::multi_array_types::size_type LSize; 
     158      LSize ndim = 0, nelem = 0, temp = 0; 
     159      std::vector<LSize> shape; 
     160      bool ret ; 
     161       
     162      ret=buffer.get(ndim) ; 
     163      for (LSize i = 0; i < ndim; i++ ) 
     164      { 
     165         ret&=buffer.get(temp) ; 
     166         shape.push_back(temp); 
     167      } 
     168      this->resize(shape); 
     169      ret&=buffer.get(nelem) ; 
     170      ret&=buffer.get(this->data(),nelem) ; 
     171      return ret ; 
     172   } 
     173    
    110174 
    111175   ///--------------------------------------------------------------- 
  • XMLIO_V2/dev/common/src/attribute.cpp

    r219 r300  
    11#include "attribute.hpp" 
     2#include "base_type.hpp" 
    23 
    34namespace xmlioserver 
     
    78      /// ////////////////////// Définitions ////////////////////// /// 
    89      CAttribute::CAttribute(const StdString & id) 
    9          : CObject(id) 
     10         : CObject(id), CBaseType() 
    1011         , value() 
    1112      { /* Ne rien faire de plus */ } 
    1213 
    1314      CAttribute::CAttribute(const CAttribute & attribut) 
    14          : CObject(attribut.getId()) 
     15         : CObject(attribut.getId()),CBaseType() 
    1516      {  
    1617         this->value = attribut.getAnyValue();  
     
    5051      } 
    5152       
     53 
    5254      ///-------------------------------------------------------------- 
    5355 
    5456   } // namespace tree 
     57       
     58      CMessage& operator<<(CMessage& msg,tree::CAttribute& type) 
     59      { 
     60        msg.push(type) ; 
     61        return msg ; 
     62      } 
     63 
     64     CMessage& operator<<(CMessage& msg, const tree::CAttribute&  type) 
     65     { 
     66       msg.push(*type.duplicate()) ; 
     67       return msg ; 
     68     } 
     69  
     70      CBufferOut& operator<<(CBufferOut& buffer, tree::CAttribute&  type) 
     71     { 
     72     
     73       if (!type.toBuffer(buffer)) ERROR("CBufferOut& operator<<(CBufferOut& buffer, tree::CAttribute&  type)", 
     74                                           <<"Buffer remain size is to low for size type") ; 
     75      return buffer ; 
     76     } 
     77      
     78     CBufferIn& operator>>(CBufferIn& buffer, tree::CAttribute&  type) 
     79     { 
     80     
     81       if (!type.fromBuffer(buffer)) ERROR("CBufferInt& operator>>(CBufferIn& buffer, tree::CAttribute&  type)", 
     82                                           <<"Buffer remain size is to low for size type") ; 
     83       return buffer ; 
     84     } 
     85 
    5586} // namespace xmlioserver 
  • XMLIO_V2/dev/common/src/attribute.hpp

    r219 r300  
    88#include "xmlioserver_spl.hpp" 
    99#include "object.hpp" 
     10#include "base_type.hpp" 
     11#include "message.hpp" 
     12#include "buffer_in.hpp" 
     13#include "buffer_out.hpp" 
    1014 
    1115namespace xmlioserver 
     
    1418   { 
    1519      /// ////////////////////// Déclarations ////////////////////// /// 
    16       class CAttribute : public CObject 
     20      class CAttribute : public CObject, public CBaseType 
    1721      { 
    1822            typedef CObject SuperClass; 
     
    2933            const boost::any & getAnyValue(void) const; 
    3034            template <typename T> inline T getValue(void) const; 
     35            template <typename T> inline T* getRef(void); 
    3136 
    3237            /// Mutateurs /// 
     
    5459            CAttribute(void);  // Not implemented. 
    5560 
    56          private : 
    57  
    5861            /// Propriété /// 
    5962            boost::any value; 
     
    6669      {  
    6770         return (boost::any_cast<T>(this->value));  
     71      } 
     72 
     73      template <typename T> 
     74         T* CAttribute::getRef(void) 
     75      {  
     76         return (boost::any_cast<T>(&value));  
    6877      } 
    6978 
     
    8190 
    8291   } // namespace tree 
    83 } // namespace xmlioserver 
     92  
     93   CMessage& operator<<(CMessage& msg,tree::CAttribute& type) ; 
     94   CMessage& operator<<(CMessage& msg, const tree::CAttribute&  type) ; 
     95  
     96   CBufferOut& operator<<(CBufferOut& buffer,tree::CAttribute& type) ; 
     97   CBufferIn& operator>>(CBufferIn& buffer, tree::CAttribute&  type) ; 
     98} 
     99  // namespace xmlioserver 
    84100 
    85101#endif // __XMLIO_CAttribute__ 
  • XMLIO_V2/dev/common/src/attribute_template.cpp

    r219 r300  
    9999 
    100100         iss >> d; vect.push_back(d); 
     101         size = vect.size(); 
    101102         if (!iss.eof ()) 
    102103         { 
     
    138139         array.resize(boost::extents[size]); 
    139140         for (int i = 0; i < size; i++) 
    140             array[i] = vect[i]; 
     141            array[i] = vect[i];  
    141142 
    142143      } 
  • XMLIO_V2/dev/common/src/attribute_template.hpp

    r219 r300  
    1010#include "array.hpp" 
    1111#include "attribute.hpp" 
     12#include "buffer_in.hpp" 
     13#include "buffer_out.hpp" 
     14 
    1215 
    1316namespace xmlioserver 
     
    4043            /// Accesseur /// 
    4144            inline ValueType getValue(void) const; 
     45            inline ValueType* getRef(void) ; 
    4246 
    4347            /// Mutateurs /// 
     
    5761            virtual void fromBinary(StdIStream & is);             
    5862 
     63            virtual bool toBuffer  (CBufferOut& buffer) const; 
     64            virtual bool fromBuffer(CBufferIn& buffer) ; 
     65            virtual size_t size(void) const; 
     66    
     67 
    5968         protected : 
    6069 
  • XMLIO_V2/dev/common/src/attribute_template_impl.hpp

    r274 r300  
    33 
    44#include "array.hpp" 
     5#include "type.hpp" 
     6#include "buffer_in.hpp" 
     7#include "buffer_out.hpp" 
    58 
    69namespace xmlioserver 
     
    6972 
    7073      template <class T> 
     74         T* CAttributeTemplate<T>::getRef(void) 
     75      { 
     76         if (SuperClass::isEmpty()) 
     77         { 
     78            ERROR("T CAttributeTemplate<T>::getValue(void) const", 
     79                  << "[ id = " << this->getId() << "]" 
     80                  << " L'attribut est requis mais n'est pas défini !"); 
     81          } 
     82         return (SuperClass::getRef<T>()); 
     83      } 
     84 
     85      template <class T> 
    7186         void CAttributeTemplate<T>::setValue(const T & value) 
    7287      { 
     
    115130         FromBinary(is, value); 
    116131         this->setValue(value); 
     132      } 
     133 
     134      template <class T> 
     135         bool CAttributeTemplate<T>::toBuffer (CBufferOut& buffer) const 
     136      { 
     137         if (isEmpty()) return buffer.put(true) ; 
     138         else 
     139         { 
     140           bool ret=true ; 
     141           CType<T> val(*boost::any_cast<T>(&value)) ; 
     142           ret&=buffer.put(false) ; 
     143           ret&=val.toBuffer(buffer) ; 
     144           return ret ; 
     145         } 
     146      } 
     147 
     148      template <class T> 
     149      bool CAttributeTemplate<T>::fromBuffer(CBufferIn& buffer) 
     150      { 
     151        bool empty ; 
     152        bool ret=true ; 
     153        ret&=buffer.get(empty) ; 
     154        if (empty)  
     155        { 
     156          clear() ; 
     157          return ret ; 
     158        } 
     159        else 
     160        { 
     161          if (isEmpty()) 
     162          { 
     163            T val ; 
     164            setValue(val) ; 
     165          } 
     166          T* V=const_cast<T*>(boost::any_cast<T>(&value)) ; 
     167          CType<T> val(*V) ; 
     168          return val.fromBuffer(buffer) ; 
     169        } 
     170      } 
     171 
     172      template <class T> 
     173      size_t CAttributeTemplate<T>::size(void) const 
     174      { 
     175        if (isEmpty()) return sizeof(bool) ; 
     176        else 
     177        { 
     178          CType<T> val(*const_cast<T*>(boost::any_cast<T>(&value))) ; 
     179          return val.size()+sizeof(bool) ; 
     180        } 
    117181      } 
    118182 
  • XMLIO_V2/dev/common/src/buffer_list.cpp

    r286 r300  
    3636                  if (SuperClass::operator[](i-1).isAvailable(size)) 
    3737                  { 
    38                      //std::cout << "Données reçues de " << i << std::endl; 
    3938                     CMPIManager::ReceiveCircularBuffer 
    4039                        (com_client_server, i, SuperClass::operator[](i-1)); 
     
    5150         } 
    5251          
    53          //static int u = 0; 
    54          //std::cout << "Nouvelle requête disponible " << u++ << std::endl; 
    55          /*if (u == 3046) 
    56             for (int i = 1; i < CMPIManager::GetCommSize(com_client_server); i++) 
    57             { 
    58                StdOStringStream oss; oss << "data/buffer"<<i<<".txt"; 
    59                SuperClass::operator[](i-1).printToTextFile (oss.str()); 
    60             }*/ 
     52 
    6153             
    6254         return (true); 
     
    6759         for (StdSize i = 0; i < this->nbbuffer; i++) 
    6860         { 
    69             //std::cout << "Récupération de la requête " << (i+1) << std::endl; 
    7061            lbuffer.push_back(SuperClass::operator[](i).getNextRequest()); 
    7162         } 
  • XMLIO_V2/dev/common/src/calendar.cpp

    r286 r300  
    5454      CDate & CCalendar::update(int step) 
    5555      {  
    56          std::cout << "step : " << step <<" timestep "<<this->timestep << std::endl; 
    57 //         std::cout << "date before : " << this->getCurrentDate() <<" date after "<<this->getInitDate() + step * this->timestep << std::endl; 
     56         info(20) << "update step : " << step <<" timestep "<<this->timestep << std::endl; 
    5857         return (this->getCurrentDate() = this->getInitDate() + step * this->timestep); 
    5958      } 
  • XMLIO_V2/dev/common/src/circular_buffer.cpp

    r219 r300  
    6969         this->movePRead(currsize); 
    7070         this->nbrequest--; 
    71          //std::cout <<  this->nbrequest << std::endl; 
    7271         
    7372         return (CLinearBuffer(SuperClass::getData(startpos), currsize)); 
  • XMLIO_V2/dev/common/src/configure.hpp

    r219 r300  
    22#define __XMLIO_Configure__ 
    33 
    4 /// xmlioserver headers /// 
    5 #include "xmlioserver_spl.hpp" 
    64 
    75/// /////////// Macros /////////// /// 
  • XMLIO_V2/dev/common/src/data_treatment.cpp

    r286 r300  
    3838         // Mise à jour cÃŽté client 
    3939         this->currentContext->getCalendar()->update(step); 
    40 //         std::cout <<  "current date : " << this->currentContext->getCalendar()->getCurrentDate() << std::endl; 
    4140         if (CXIOSManager::GetStatus() == CXIOSManager::LOC_CLIENT) 
    4241         { // Mise à jour cÃŽté serveur 
     
    118117          
    119118         // Résolution des héritages pour le context actuel. 
    120          //std::cout << "(Message temporaire) Résolution des héritages ..." << std::endl; 
    121119         this->solveAllInheritance(); 
    122120 
    123121         //Initialisation du vecteur 'enabledFiles' contenant la liste des fichiers à sortir. 
    124          //std::cout << "(Message temporaire) Initialisation du vecteur enabledFiles ..." << std::endl; 
    125122         this->findEnabledFiles(); 
    126123 
    127124         //Recherche des champs à sortir (enable à true + niveau de sortie correct) 
    128125         // pour chaque fichier précédemment listé. 
    129          //std::cout << "(Message temporaire) Recherche des champs à sortir ..." << std::endl; 
    130126         this->findAllEnabledFields(); 
    131127 
    132128         // Résolution des références de grilles pour chacun des champs. 
    133          //std::cout << "(Message temporaire) Résolution des références de grilles ..." << std::endl; 
    134129         this->solveAllGridRef(); 
    135130 
     
    140135         CContext::CleanTree(); 
    141136 
    142          //std::cout << "(Message temporaire) fin traitement sorties ..." << std::endl; 
    143137      } 
    144138 
  • XMLIO_V2/dev/common/src/data_treatment.hpp

    r286 r300  
    113113 
    114114            boost::shared_ptr<io::CDataOutput> dout(new T(oss.str(), false,comm_server,multifile)); 
    115             file->initializeDataOutput(dout); 
     115//            file->initializeDataOutput(dout); 
    116116         } 
    117117      } 
     
    149149            boost::shared_ptr<CField> field = *it; 
    150150            boost::shared_ptr<CFile>  file  = field->getRelFile(); 
    151             if (field->updateData(currDate, timestep, data)) 
     151            if (field->updateData(data)) 
    152152            { 
    153153               if (CXIOSManager::GetStatus() == CXIOSManager::LOC_CLIENT) 
    154154               {  
    155155                   boost::shared_ptr<comm::CClient> client = comm::CClient::GetClient(); 
    156 //                   std::cout<<"--> sendData :: fieldId : "<<fieldId<<", fileId : "<<file->getId()<<std::endl ; 
    157 //                   client->sendData(fieldId, file->getId(), field->getData()); 
    158156                   client->sendData(field->getId(), file->getId(), field->getData()); 
    159157               } 
  • XMLIO_V2/dev/common/src/fortran/file_interface.f90

    r286 r300  
    5858      END SUBROUTINE cxios_file_valid_id 
    5959 
     60     SUBROUTINE cxios_set_file_type(file_hdl, type, type_size) BIND(C) 
     61         USE ISO_C_BINDING 
     62         INTEGER  (kind = C_INTPTR_T), VALUE        :: file_hdl 
     63         CHARACTER(kind = C_CHAR)    , DIMENSION(*) :: type 
     64         INTEGER  (kind = C_INT)     , VALUE        :: type_size 
     65      END SUBROUTINE cxios_set_file_type 
     66       
    6067   END INTERFACE 
    6168    
  • XMLIO_V2/dev/common/src/fortran/filegroup_interface.f90

    r286 r300  
    5858      END SUBROUTINE cxios_filegroup_valid_id 
    5959 
     60      SUBROUTINE cxios_set_filegroup_type(filegroup_hdl, type ,type_size) BIND(C) 
     61         USE ISO_C_BINDING 
     62         INTEGER  (kind = C_INTPTR_T), VALUE        :: filegroup_hdl 
     63         CHARACTER(kind = C_CHAR)    , DIMENSION(*) :: type 
     64         INTEGER  (kind = C_INT)     , VALUE        :: type_size 
     65      END SUBROUTINE cxios_set_filegroup_type 
     66       
    6067   END INTERFACE 
    6168    
  • XMLIO_V2/dev/common/src/fortran/icaxis.cpp

    r286 r300  
    3131 
    3232      axis_hdl->name.setValue(name_str); 
     33      axis_hdl->sendAttributToServer(axis_hdl->name) ; 
    3334   } 
    3435 
     
    3940      if (!cstr2string(standard_name, standard_name_size, standard_name_str)) return; 
    4041 
    41       axis_hdl->standard_name.setValue(standard_name_str); 
    42    } 
     42      axis_hdl->standard_name.setValue(standard_name_str);  
     43      axis_hdl->sendAttributToServer(axis_hdl->standard_name);  
     44  } 
    4345     
    4446   void cxios_set_axis_long_name  
     
    4951 
    5052      axis_hdl->long_name.setValue(long_name_str); 
     53      axis_hdl->sendAttributToServer(axis_hdl->long_name) ; 
    5154   } 
    5255 
     
    5861 
    5962      axis_hdl->unit.setValue(unit_str); 
     63      axis_hdl->sendAttributToServer(axis_hdl->unit) ; 
    6064   } 
    6165     
     
    6367   { 
    6468      axis_hdl->size.setValue(size); 
     69      axis_hdl->sendAttributToServer(axis_hdl->size) ; 
    6570   } 
    6671 
     
    7277 
    7378      axis_hdl->zvalue.setValue(zvalue_val); 
     79      axis_hdl->sendAttributToServer(axis_hdl->zvalue) ; 
    7480 
    7581   } 
     
    8490 
    8591      axisgroup_hdl->name.setValue(name_str); 
     92      axisgroup_hdl->sendAttributToServer(axisgroup_hdl->name) ; 
    8693   } 
    8794 
     
    93100 
    94101      axisgroup_hdl->standard_name.setValue(standard_name_str); 
     102      axisgroup_hdl->sendAttributToServer(axisgroup_hdl->standard_name) ; 
    95103   } 
    96104     
     
    102110 
    103111      axisgroup_hdl->long_name.setValue(long_name_str); 
     112      axisgroup_hdl->sendAttributToServer(axisgroup_hdl->long_name) ; 
    104113   } 
    105114 
     
    111120 
    112121      axisgroup_hdl->unit.setValue(unit_str); 
     122      axisgroup_hdl->sendAttributToServer(axisgroup_hdl->unit) ; 
    113123   } 
    114124     
     
    116126   { 
    117127      axisgroup_hdl->size.setValue(size); 
     128      axisgroup_hdl->sendAttributToServer(axisgroup_hdl->size) ; 
    118129   } 
    119130 
     
    125136 
    126137      axisgroup_hdl->zvalue.setValue(zvalue_val); 
     138      axisgroup_hdl->sendAttributToServer(axisgroup_hdl->zvalue) ; 
    127139   } 
    128140    
  • XMLIO_V2/dev/common/src/fortran/iccontext.cpp

    r286 r300  
    3333      std::string calendar_type_str;  
    3434      if (!cstr2string(calendar_type, calendar_type_size, calendar_type_str)) return; 
    35  
    3635      context_hdl->calendar_type.setValue(calendar_type_str); 
     36      context_hdl->sendAttributToServer(context_hdl->calendar_type) ; 
    3737   } 
    3838    
     
    4343 
    4444      context_hdl->start_date.setValue(start_date_str); 
     45      context_hdl->sendAttributToServer(context_hdl->start_date) ;  
    4546   } 
    4647    
     
    5152 
    5253      context_hdl->output_dir.setValue(output_dir_str); 
     54      context_hdl->sendAttributToServer(context_hdl->output_dir) ;  
    5355   } 
    5456    
  • XMLIO_V2/dev/common/src/fortran/icdata.cpp

    r286 r300  
    1919#include "mpi_manager.hpp" 
    2020#include "buffer.hpp" 
     21#include "cxios.hpp" 
     22#include "client_ym.hpp" 
     23#include "field.hpp" 
    2124 
    2225extern "C" 
     
    3134 
    3235   // -------------------- Traitement des données ------------------------------ 
     36   void cxios_init_server(void) 
     37   { 
     38     CXios::initServerSide();       
     39   } 
     40 
     41   void cxios_init_client(const char * client_id , int len_client_id, MPI_Fint* f_local_comm, MPI_Fint* f_return_comm ) 
     42   { 
     43      std::string str;  
     44      MPI_Comm local_comm ; 
     45      MPI_Comm return_comm ; 
     46       
     47      if (!cstr2string(client_id, len_client_id, str)) return; 
     48       
     49      int initialized ; 
     50      MPI_Initialized(&initialized) ; 
     51      if (initialized) local_comm=MPI_Comm_f2c(*f_local_comm) ; 
     52      else local_comm=MPI_COMM_NULL ; 
     53      CXios::initClientSide(str,local_comm,return_comm); 
     54      *f_return_comm=MPI_Comm_c2f(return_comm) ; 
     55   } 
     56 
     57   void cxios_context_initialize(const char * context_id , int len_context_id, MPI_Fint* f_comm) 
     58   { 
     59     std::string str;  
     60     MPI_Comm comm ; 
     61      
     62     if (!cstr2string(context_id, len_context_id, str)) return; 
     63     comm=MPI_Comm_f2c(*f_comm) ; 
     64     ym::CClient::registerContext(context_id,comm) ; 
     65   } 
     66  
     67    void cxios_context_close_definition() 
     68   { 
     69     boost::shared_ptr<CContext> context = 
     70            CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId()); 
     71     context->closeDefinition() ; 
     72   }   
     73 
     74   void cxios_context_finalize() 
     75   { 
     76     boost::shared_ptr<CContext> context = 
     77            CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId()); 
     78     context->finalize() ; 
     79   } 
     80    
     81   void cxios_finalize() 
     82   { 
     83     CXios::clientFinalize() ; 
     84   } 
     85 
    3386    
    3487   void cxios_dtreatment_start() 
     
    60113            MPI_Request request = 0; 
    61114            StdOStringStream ostrs; 
    62 /* 
    63             if (CMPIManager::GetCommRank(comm_client_server) == 1) 
    64             { 
    65                CTreeManager::ToBinary(ostrs); 
    66                CLinearBuffer lbuffer(ostrs.str().size()+CBuffer::getDataHeaderSize()); 
    67                std::cout<<"lbuffer size "<<ostrs.str().size()<<std::endl ; 
    68                lbuffer.appendString(ostrs.str()); 
    69                CMPIManager::SendLinearBuffer(comm_client_server, 0, lbuffer, request); 
    70                CMPIManager::Wait(request);  // Pas encore en mode RPC 
    71             } 
    72             else 
    73             { 
    74                CTreeManager::DomainsToBinary(ostrs); 
    75                CLinearBuffer lbuffer(ostrs.str().size()+CBuffer::getDataHeaderSize());  
    76                std::cout<<"lbuffer size "<<ostrs.str().size()<<std::endl ; 
    77                lbuffer.appendString(ostrs.str()); 
    78                CMPIManager::SendLinearBuffer(comm_client_server, 0, lbuffer, request); 
    79                CMPIManager::Wait(request);  // Pas encore en mode RPC 
    80             } 
    81 */ 
     115 
    82116            CTreeManager::ToBinary(ostrs); 
    83117            CLinearBuffer lbuffer(ostrs.str().size()+CBuffer::getDataHeaderSize()); 
     
    172206      ARRAY(double, 1) data(new CArray<double, 1>(boost::extents [data_Xsize])); 
    173207      std::copy(data_k8, &(data_k8[data->num_elements()]), data->data()); 
    174       dtreat->write_data(fieldid_str, data); 
     208       
     209//      dtreat->write_data(fieldid_str, data); 
     210      CField::get(fieldid)->setData(data) ; 
    175211   } 
    176212    
     
    188224      ARRAY(double, 2) data(new CArray<double, 2>(boost::extents [data_Xsize][data_Ysize])); 
    189225      std::copy(data_k8, &(data_k8[data->num_elements()]), data->data()); 
    190       dtreat->write_data(fieldid_str, data); 
     226//      dtreat->write_data(fieldid_str, data); 
     227      CField::get(fieldid)->setData(data) ; 
    191228   } 
    192229    
     
    204241      ARRAY(double, 3) data(new CArray<double, 3>(boost::extents [data_Xsize][data_Ysize][data_Zsize])); 
    205242      std::copy(data_k8, &(data_k8[data->num_elements()]), data->data()); 
    206       dtreat->write_data(fieldid_str, data); 
     243//      dtreat->write_data(fieldid_str, data); 
     244      CField::get(fieldid)->setData(data) ; 
     245 
    207246   } 
    208247    
     
    218257//          boost::extents [data_Xsize], 
    219258//          boost::fortran_storage_order()); 
    220       ARRAY(float, 1) data(new CArray<float, 1>(boost::extents [data_Xsize])); 
    221       std::copy(data_k4, &(data_k4[data->num_elements()]), data->data()); 
    222       dtreat->write_data(fieldid_str, data); 
     259//      ARRAY(float, 1) data(new CArray<float, 1>(boost::extents [data_Xsize])); 
     260//      std::copy(data_k4, &(data_k4[data->num_elements()]), data->data()); 
     261//      dtreat->write_data(fieldid_str, data); 
     262      ARRAY(double, 1) data(new CArray<double, 1>(boost::extents [data_Xsize])); 
     263      double* ptr_data=data->data() ;  
     264      for(int i=0;i<data->num_elements();i++) ptr_data[i]=data_k4[i]; 
     265      CField::get(fieldid)->setData(data) ; 
    223266   } 
    224267    
     
    234277//          boost::extents [data_Xsize][data_Ysize], 
    235278//          boost::fortran_storage_order()); 
    236       ARRAY(float, 2) data(new CArray<float, 2>(boost::extents [data_Xsize][data_Ysize])); 
    237       std::copy(data_k4, &(data_k4[data->num_elements()]), data->data()); 
    238       dtreat->write_data(fieldid_str, data); 
     279//      ARRAY(float, 2) data(new CArray<float, 2>(boost::extents [data_Xsize][data_Ysize])); 
     280//      std::copy(data_k4, &(data_k4[data->num_elements()]), data->data()); 
     281//      dtreat->write_data(fieldid_str, data); 
     282      ARRAY(double, 2) data(new CArray<double, 2>(boost::extents [data_Xsize][data_Ysize])); 
     283      double* ptr_data=data->data() ;  
     284      for(int i=0;i<data->num_elements();i++) ptr_data[i]=data_k4[i]; 
     285      CField::get(fieldid)->setData(data) ; 
    239286   } 
    240287    
     
    250297//          boost::extents [data_Xsize][data_Ysize][data_Zsize], 
    251298//          boost::fortran_storage_order()); 
    252       ARRAY(float, 3) data(new CArray<float, 3>(boost::extents [data_Xsize][data_Ysize][data_Zsize])); 
    253       std::copy(data_k4, &(data_k4[data->num_elements()]), data->data()); 
    254       dtreat->write_data(fieldid_str, data); 
    255    }  
     299//      ARRAY(float, 3) data(new CArray<float, 3>(boost::extents [data_Xsize][data_Ysize][data_Zsize])); 
     300//      std::copy(data_k4, &(data_k4[data->num_elements()]), data->data()); 
     301//      dtreat->write_data(fieldid_str, data); 
     302      ARRAY(double, 3) data(new CArray<double, 3>(boost::extents [data_Xsize][data_Ysize][data_Zsize])); 
     303      double* ptr_data=data->data() ;  
     304      for(int i=0;i<data->num_elements();i++) ptr_data[i]=data_k4[i]; 
     305      CField::get(fieldid)->setData(data) ; 
     306    }  
    256307 
    257308} // extern "C" 
  • XMLIO_V2/dev/common/src/fortran/icdate.cpp

    r286 r300  
    2929         xmlioserver::CObjectFactory::GetObject<xmlioserver::tree::CContext> 
    3030            (CObjectFactory::GetCurrentContextId()); 
    31          boost::shared_ptr<xmlioserver::data::CDataTreatment> dtreat = context->getDataTreatment(); 
    32          if (dtreat.get() != 0) 
    33          { 
    34             dtreat->set_timestep(dur);      
    35          } 
    36          else 
    37          { 
    38             context->solveCalendar(); 
     31          
    3932            context->timestep.setValue(dur.toString()); 
    40             context->getCalendar()->setTimeStep(dur); 
    41          }        
     33            context->sendAttributToServer("timestep") ; 
    4234      } 
    4335      catch (xmlioserver::CException & exc) 
     
    5042   void cxios_update_calendar(int step) 
    5143   { 
    52       try 
    53       { 
    54          boost::shared_ptr<xmlioserver::tree::CContext> context = 
    55          xmlioserver::CObjectFactory::GetObject<xmlioserver::tree::CContext> 
     44      boost::shared_ptr<xmlioserver::tree::CContext> context = 
     45            xmlioserver::CObjectFactory::GetObject<xmlioserver::tree::CContext> 
    5646            (CObjectFactory::GetCurrentContextId()); 
    57          boost::shared_ptr<xmlioserver::data::CDataTreatment> dtreat = context->getDataTreatment(); 
    58          dtreat->update_calendar(step); 
    59       } 
    60       catch (xmlioserver::CException & exc) 
    61       { 
    62          std::cerr << exc.getMessage() << std::endl; 
    63          exit (EXIT_FAILURE); 
    64       } 
     47      context->updateCalendar(step) ; 
     48      context->sendUpdateCalendar(step) ; 
     49       
    6550   } 
    6651 
  • XMLIO_V2/dev/common/src/fortran/icdomain.cpp

    r286 r300  
    3131 
    3232      domain_hdl->name.setValue(name_str); 
     33      domain_hdl->sendAttributToServer(domain_hdl->name) ;  
    3334   } 
    3435    
     
    3940 
    4041      domain_hdl->standard_name.setValue(standard_name_str); 
     42      domain_hdl->sendAttributToServer(domain_hdl->standard_name) ;  
    4143   } 
    4244    
     
    4749 
    4850      domain_hdl->long_name.setValue(long_name_str); 
     51      domain_hdl->sendAttributToServer(domain_hdl->long_name) ;  
    4952   } 
    5053    
     
    5558 
    5659      domain_hdl->domain_group_ref.setValue(domain_group_ref_str); 
     60      domain_hdl->sendAttributToServer(domain_hdl->domain_group_ref) ;  
    5761   } 
    5862    
     
    6064   { 
    6165      domain_hdl->ni_glo.setValue(ni_glo); 
     66      domain_hdl->sendAttributToServer(domain_hdl->ni_glo) ;  
    6267   } 
    6368    
     
    6570   { 
    6671      domain_hdl->nj_glo.setValue(nj_glo); 
     72      domain_hdl->sendAttributToServer(domain_hdl->nj_glo) ;  
    6773   } 
    6874    
     
    7076   { 
    7177      domain_hdl->ibegin.setValue(ibegin); 
     78      domain_hdl->sendAttributToServer(domain_hdl->ibegin) ;  
    7279   } 
    7380    
     
    7582   { 
    7683      domain_hdl->iend.setValue(iend); 
     84      domain_hdl->sendAttributToServer(domain_hdl->iend) ;  
    7785   } 
    7886    
     
    8088   { 
    8189      domain_hdl->ni.setValue(ni); 
     90      domain_hdl->sendAttributToServer(domain_hdl->ni) ;  
    8291   } 
    8392    
     
    8594   { 
    8695      domain_hdl->jbegin.setValue(jbegin); 
     96      domain_hdl->sendAttributToServer(domain_hdl->jbegin) ;  
    8797   } 
    8898    
     
    90100   { 
    91101      domain_hdl->jend.setValue(jend); 
     102      domain_hdl->sendAttributToServer(domain_hdl->jend) ;  
    92103   } 
    93104    
     
    95106   { 
    96107      domain_hdl->nj.setValue(nj); 
     108      domain_hdl->sendAttributToServer(domain_hdl->nj) ;  
    97109   } 
    98110    
     
    103115 
    104116      domain_hdl->mask.setValue(mask_val); 
     117      domain_hdl->sendAttributToServer(domain_hdl->mask) ;  
    105118   } 
    106119    
     
    108121   { 
    109122      domain_hdl->data_dim.setValue(data_dim); 
     123      domain_hdl->sendAttributToServer(domain_hdl->data_dim) ;  
    110124   } 
    111125    
     
    113127   { 
    114128      domain_hdl->data_ni.setValue(data_ni); 
     129      domain_hdl->sendAttributToServer(domain_hdl->data_ni) ;  
    115130   } 
    116131    
     
    118133   { 
    119134      domain_hdl->data_nj.setValue(data_nj); 
     135      domain_hdl->sendAttributToServer(domain_hdl->data_nj) ;  
    120136   } 
    121137    
     
    123139   { 
    124140      domain_hdl->data_ibegin.setValue(data_ibegin); 
     141      domain_hdl->sendAttributToServer(domain_hdl->data_ibegin) ;  
    125142   } 
    126143    
     
    128145   { 
    129146      domain_hdl->data_jbegin.setValue(data_jbegin); 
     147      domain_hdl->sendAttributToServer(domain_hdl->data_jbegin) ;  
    130148   } 
    131149    
     
    133151   { 
    134152      domain_hdl->zoom_ni.setValue(zoom_ni); 
     153      domain_hdl->sendAttributToServer(domain_hdl->zoom_ni) ;  
    135154   } 
    136155    
     
    138157   { 
    139158      domain_hdl->zoom_nj.setValue(zoom_nj); 
     159      domain_hdl->sendAttributToServer(domain_hdl->zoom_nj) ;  
    140160   } 
    141161    
     
    143163   { 
    144164      domain_hdl->zoom_ibegin.setValue(zoom_ibegin); 
     165      domain_hdl->sendAttributToServer(domain_hdl->zoom_ibegin) ;  
    145166   } 
    146167     
     
    148169   { 
    149170      domain_hdl->zoom_jbegin.setValue(zoom_jbegin); 
     171      domain_hdl->sendAttributToServer(domain_hdl->zoom_jbegin) ;  
    150172   } 
    151173    
     
    153175   { 
    154176      domain_hdl->zoom_ni_loc.setValue(zoom_ni_loc); 
     177      domain_hdl->sendAttributToServer(domain_hdl->zoom_ni_loc) ;  
    155178   } 
    156179    
     
    158181   { 
    159182      domain_hdl->zoom_nj_loc.setValue(zoom_nj_loc); 
     183      domain_hdl->sendAttributToServer(domain_hdl->zoom_nj_loc) ;  
    160184   } 
    161185    
     
    163187   { 
    164188      domain_hdl->zoom_ibegin_loc.setValue(zoom_ibegin_loc); 
     189      domain_hdl->sendAttributToServer(domain_hdl->zoom_ibegin_loc) ;  
    165190   } 
    166191    
     
    168193   { 
    169194      domain_hdl->zoom_jbegin_loc.setValue(zoom_jbegin_loc); 
     195      domain_hdl->sendAttributToServer(domain_hdl->zoom_jbegin_loc) ;  
    170196   } 
    171197    
     
    173199   { 
    174200      domain_hdl->data_n_index.setValue(data_n_index); 
     201      domain_hdl->sendAttributToServer(domain_hdl->data_n_index) ;  
    175202   } 
    176203    
     
    181208 
    182209      domain_hdl->data_i_index.setValue(data_i_index_val); 
     210      domain_hdl->sendAttributToServer(domain_hdl->data_i_index) ;  
    183211   } 
    184212    
     
    189217 
    190218      domain_hdl->data_j_index.setValue(data_j_index_val); 
     219      domain_hdl->sendAttributToServer(domain_hdl->data_j_index) ;  
    191220   } 
    192221     
     
    197226 
    198227      domain_hdl->lonvalue.setValue(lonvalue_val); 
     228      domain_hdl->sendAttributToServer(domain_hdl->lonvalue) ;  
    199229   } 
    200230    
     
    205235 
    206236      domain_hdl->latvalue.setValue(latvalue_val); 
     237      domain_hdl->sendAttributToServer(domain_hdl->latvalue) ;  
    207238   }    
    208239    
    209    // -------------------- Attributs des groupes d'axes ------------------------ 
     240   // -------------------- Attributs des groupes de domaine ------------------------ 
    210241    
    211242    
     
    216247 
    217248      domaingroup_hdl->name.setValue(name_str); 
     249      domaingroup_hdl->sendAttributToServer(domaingroup_hdl->name) ;  
     250       
    218251   } 
    219252    
     
    224257 
    225258      domaingroup_hdl->standard_name.setValue(standard_name_str); 
     259      domaingroup_hdl->sendAttributToServer(domaingroup_hdl->standard_name) ; 
    226260   } 
    227261    
     
    232266 
    233267      domaingroup_hdl->long_name.setValue(long_name_str); 
     268      domaingroup_hdl->sendAttributToServer(domaingroup_hdl->long_name) ; 
    234269   } 
    235270    
     
    240275 
    241276      domaingroup_hdl->domain_group_ref.setValue(domain_group_ref_str); 
     277      domaingroup_hdl->sendAttributToServer(domaingroup_hdl->domain_group_ref) ; 
    242278   } 
    243279    
     
    245281   { 
    246282      domaingroup_hdl->ni_glo.setValue(ni_glo); 
     283      domaingroup_hdl->sendAttributToServer(domaingroup_hdl->ni_glo) ; 
    247284   } 
    248285    
     
    250287   { 
    251288      domaingroup_hdl->nj_glo.setValue(nj_glo); 
     289      domaingroup_hdl->sendAttributToServer(domaingroup_hdl->nj_glo) ; 
    252290   } 
    253291    
     
    255293   { 
    256294      domaingroup_hdl->ibegin.setValue(ibegin); 
     295      domaingroup_hdl->sendAttributToServer(domaingroup_hdl->ibegin) ; 
    257296   } 
    258297    
     
    260299   { 
    261300      domaingroup_hdl->iend.setValue(iend); 
     301      domaingroup_hdl->sendAttributToServer(domaingroup_hdl->iend) ; 
    262302   } 
    263303    
     
    265305   { 
    266306      domaingroup_hdl->ni.setValue(ni); 
     307      domaingroup_hdl->sendAttributToServer(domaingroup_hdl->ni) ; 
    267308   } 
    268309    
     
    270311   { 
    271312      domaingroup_hdl->jbegin.setValue(jbegin); 
     313      domaingroup_hdl->sendAttributToServer(domaingroup_hdl->jbegin) ; 
    272314   } 
    273315    
     
    275317   { 
    276318      domaingroup_hdl->jend.setValue(jend); 
     319      domaingroup_hdl->sendAttributToServer(domaingroup_hdl->jend) ; 
    277320   } 
    278321    
     
    280323   { 
    281324      domaingroup_hdl->nj.setValue(nj); 
     325      domaingroup_hdl->sendAttributToServer(domaingroup_hdl->nj) ; 
    282326   } 
    283327    
     
    288332 
    289333      domaingroup_hdl->mask.setValue(mask_val); 
     334      domaingroup_hdl->sendAttributToServer(domaingroup_hdl->mask) ; 
    290335   } 
    291336    
     
    293338   { 
    294339      domaingroup_hdl->data_dim.setValue(data_dim); 
     340      domaingroup_hdl->sendAttributToServer(domaingroup_hdl->data_dim) ; 
    295341   } 
    296342    
     
    298344   { 
    299345      domaingroup_hdl->data_ni.setValue(data_ni); 
     346      domaingroup_hdl->sendAttributToServer(domaingroup_hdl->data_ni) ; 
    300347   } 
    301348    
     
    303350   { 
    304351      domaingroup_hdl->data_nj.setValue(data_nj); 
     352      domaingroup_hdl->sendAttributToServer(domaingroup_hdl->data_nj) ; 
    305353   } 
    306354    
     
    308356   { 
    309357      domaingroup_hdl->data_ibegin.setValue(data_ibegin); 
     358      domaingroup_hdl->sendAttributToServer(domaingroup_hdl->data_ibegin) ; 
    310359   } 
    311360    
     
    313362   { 
    314363      domaingroup_hdl->data_jbegin.setValue(data_jbegin); 
     364      domaingroup_hdl->sendAttributToServer(domaingroup_hdl->data_jbegin) ; 
    315365   } 
    316366    
     
    318368   { 
    319369      domaingroup_hdl->zoom_ni.setValue(zoom_ni); 
     370      domaingroup_hdl->sendAttributToServer(domaingroup_hdl->zoom_ni) ; 
    320371   } 
    321372    
     
    323374   { 
    324375      domaingroup_hdl->zoom_nj.setValue(zoom_nj); 
     376      domaingroup_hdl->sendAttributToServer(domaingroup_hdl->zoom_nj) ; 
    325377   } 
    326378    
     
    328380   { 
    329381      domaingroup_hdl->zoom_ibegin.setValue(zoom_ibegin); 
     382      domaingroup_hdl->sendAttributToServer(domaingroup_hdl->zoom_ibegin) ; 
    330383   } 
    331384     
     
    333386   { 
    334387      domaingroup_hdl->zoom_jbegin.setValue(zoom_jbegin); 
     388      domaingroup_hdl->sendAttributToServer(domaingroup_hdl->zoom_jbegin) ; 
    335389   } 
    336390    
     
    338392   { 
    339393      domaingroup_hdl->zoom_ni_loc.setValue(zoom_ni_loc); 
     394      domaingroup_hdl->sendAttributToServer(domaingroup_hdl->zoom_ni_loc) ; 
    340395   } 
    341396    
     
    343398   { 
    344399      domaingroup_hdl->zoom_nj_loc.setValue(zoom_nj_loc); 
     400      domaingroup_hdl->sendAttributToServer(domaingroup_hdl->zoom_nj_loc) ; 
    345401   } 
    346402    
     
    348404   { 
    349405      domaingroup_hdl->zoom_ibegin_loc.setValue(zoom_ibegin_loc); 
     406      domaingroup_hdl->sendAttributToServer(domaingroup_hdl->zoom_ibegin_loc) ; 
    350407   } 
    351408    
     
    353410   { 
    354411      domaingroup_hdl->zoom_jbegin_loc.setValue(zoom_jbegin_loc); 
     412      domaingroup_hdl->sendAttributToServer(domaingroup_hdl->zoom_jbegin_loc) ; 
    355413   } 
    356414    
     
    358416   { 
    359417      domaingroup_hdl->data_n_index.setValue(data_n_index); 
     418      domaingroup_hdl->sendAttributToServer(domaingroup_hdl->data_n_index) ; 
    360419   } 
    361420    
     
    366425 
    367426      domaingroup_hdl->data_i_index.setValue(data_i_index_val); 
     427      domaingroup_hdl->sendAttributToServer(domaingroup_hdl->data_i_index) ; 
    368428   } 
    369429    
     
    374434 
    375435      domaingroup_hdl->data_j_index.setValue(data_j_index_val); 
     436      domaingroup_hdl->sendAttributToServer(domaingroup_hdl->data_j_index) ; 
    376437   } 
    377438     
     
    382443 
    383444      domaingroup_hdl->lonvalue.setValue(lonvalue_val); 
     445      domaingroup_hdl->sendAttributToServer(domaingroup_hdl->lonvalue) ; 
    384446   } 
    385447    
     
    390452 
    391453      domaingroup_hdl->latvalue.setValue(latvalue_val); 
     454      domaingroup_hdl->sendAttributToServer(domaingroup_hdl->latvalue) ; 
    392455   }   
    393456    
  • XMLIO_V2/dev/common/src/fortran/icfield.cpp

    r286 r300  
    3131 
    3232      field_hdl->name.setValue(name_str); 
     33      field_hdl->sendAttributToServer(field_hdl->name) ;  
    3334   } 
    3435    
     
    3940 
    4041      field_hdl->standard_name.setValue(standard_name_str); 
     42      field_hdl->sendAttributToServer(field_hdl->standard_name) ;  
    4143   } 
    4244    
     
    4749 
    4850      field_hdl->long_name.setValue(long_name_str); 
     51      field_hdl->sendAttributToServer(field_hdl->long_name) ; 
    4952   } 
    5053    
     
    5558 
    5659      field_hdl->unit.setValue(unit_str); 
     60      field_hdl->sendAttributToServer(field_hdl->unit) ; 
     61 
    5762   } 
    5863    
     
    6368 
    6469      field_hdl->operation.setValue(operation_str); 
     70      field_hdl->sendAttributToServer(field_hdl->operation) ; 
    6571   } 
    6672    
     
    7177 
    7278      field_hdl->freq_op.setValue(freq_op_str); 
     79      field_hdl->sendAttributToServer(field_hdl->freq_op) ; 
    7380   } 
    7481    
     
    7683   { 
    7784      field_hdl->level.setValue(level); 
     85      field_hdl->sendAttributToServer(field_hdl->level) ; 
    7886   } 
    7987    
     
    8189   { 
    8290      field_hdl->prec.setValue(prec); 
     91      field_hdl->sendAttributToServer(field_hdl->prec) ; 
    8392   } 
    8493    
     
    8695   { 
    8796      field_hdl->enabled.setValue(enabled); 
     97      field_hdl->sendAttributToServer(field_hdl->enabled) ; 
    8898   } 
    8999    
     
    94104 
    95105      field_hdl->domain_ref.setValue(domain_ref_str); 
     106      field_hdl->sendAttributToServer(field_hdl->domain_ref) ; 
    96107   } 
    97108    
     
    102113 
    103114      field_hdl->axis_ref.setValue(axis_ref_str); 
     115      field_hdl->sendAttributToServer(field_hdl->axis_ref) ; 
    104116   } 
    105117    
     
    110122 
    111123      field_hdl->grid_ref.setValue(grid_ref_str); 
     124      field_hdl->sendAttributToServer(field_hdl->grid_ref) ; 
    112125   } 
    113126    
     
    118131 
    119132      field_hdl->field_ref.setValue(field_ref_str); 
     133      field_hdl->sendAttributToServer(field_hdl->field_ref) ; 
    120134   } 
    121135    
     
    123137   { 
    124138      field_hdl->default_value.setValue(default_value); 
     139      field_hdl->sendAttributToServer(field_hdl->default_value) ; 
    125140   }   
    126141    
     
    133148 
    134149      fieldgroup_hdl->name.setValue(name_str); 
     150      fieldgroup_hdl->sendAttributToServer(fieldgroup_hdl->name); 
    135151   } 
    136152    
     
    141157 
    142158      fieldgroup_hdl->standard_name.setValue(standard_name_str); 
     159      fieldgroup_hdl->sendAttributToServer(fieldgroup_hdl->standard_name); 
    143160   } 
    144161    
     
    149166 
    150167      fieldgroup_hdl->long_name.setValue(long_name_str); 
     168      fieldgroup_hdl->sendAttributToServer(fieldgroup_hdl->long_name); 
    151169   } 
    152170    
     
    157175 
    158176      fieldgroup_hdl->unit.setValue(unit_str); 
     177      fieldgroup_hdl->sendAttributToServer(fieldgroup_hdl->unit); 
    159178   } 
    160179    
     
    165184 
    166185      fieldgroup_hdl->operation.setValue(operation_str); 
     186      fieldgroup_hdl->sendAttributToServer(fieldgroup_hdl->operation); 
    167187   } 
    168188    
     
    173193 
    174194      fieldgroup_hdl->freq_op.setValue(freq_op_str); 
     195      fieldgroup_hdl->sendAttributToServer(fieldgroup_hdl->freq_op); 
    175196   } 
    176197    
     
    178199   { 
    179200      fieldgroup_hdl->level.setValue(level); 
     201      fieldgroup_hdl->sendAttributToServer(fieldgroup_hdl->level); 
    180202   } 
    181203    
     
    183205   { 
    184206      fieldgroup_hdl->prec.setValue(prec); 
     207      fieldgroup_hdl->sendAttributToServer(fieldgroup_hdl->prec); 
    185208   } 
    186209    
     
    188211   { 
    189212      fieldgroup_hdl->enabled.setValue(enabled); 
     213      fieldgroup_hdl->sendAttributToServer(fieldgroup_hdl->enabled); 
    190214   } 
    191215    
     
    196220 
    197221      fieldgroup_hdl->domain_ref.setValue(domain_ref_str); 
     222      fieldgroup_hdl->sendAttributToServer(fieldgroup_hdl->domain_ref); 
    198223   } 
    199224    
     
    204229 
    205230      fieldgroup_hdl->axis_ref.setValue(axis_ref_str); 
     231      fieldgroup_hdl->sendAttributToServer(fieldgroup_hdl->axis_ref); 
    206232   } 
    207233    
     
    212238 
    213239      fieldgroup_hdl->grid_ref.setValue(grid_ref_str); 
     240      fieldgroup_hdl->sendAttributToServer(fieldgroup_hdl->grid_ref); 
    214241   } 
    215242    
     
    220247 
    221248      fieldgroup_hdl->field_ref.setValue(field_ref_str); 
     249      fieldgroup_hdl->sendAttributToServer(fieldgroup_hdl->field_ref); 
    222250   } 
    223251    
     
    225253   { 
    226254      fieldgroup_hdl->default_value.setValue(default_value); 
     255      fieldgroup_hdl->sendAttributToServer(fieldgroup_hdl->default_value); 
    227256   }   
    228257    
  • XMLIO_V2/dev/common/src/fortran/icfile.cpp

    r286 r300  
    3131 
    3232      file_hdl->name.setValue(name_str); 
     33      file_hdl->sendAttributToServer(file_hdl->name) ; 
    3334   } 
    3435    
     
    3940 
    4041      file_hdl->description.setValue(description_str); 
     42      file_hdl->sendAttributToServer(file_hdl->description) ; 
    4143   }  
    4244    
     
    4749 
    4850      file_hdl->name_suffix.setValue(name_suffix_str); 
     51      file_hdl->sendAttributToServer(file_hdl->name_suffix) ; 
    4952   }  
    5053    
     
    5558 
    5659      file_hdl->output_freq.setValue(output_freq_str); 
     60      file_hdl->sendAttributToServer(file_hdl->output_freq) ; 
    5761   } 
    5862    
     
    6064   { 
    6165      file_hdl->output_level.setValue(output_level); 
     66      file_hdl->sendAttributToServer(file_hdl->output_level) ; 
    6267   } 
    6368    
     
    6570   { 
    6671      file_hdl->enabled.setValue(enabled); 
     72      file_hdl->sendAttributToServer(file_hdl->enabled) ; 
     73   } 
     74    
     75   void cxios_set_file_type(XFilePtr file_hdl, const char * type, int type_size) 
     76   { 
     77      std::string type_str;  
     78      if (!cstr2string(type, type_size, type_str)) return; 
     79 
     80      file_hdl->type.setValue(type_str); 
     81      file_hdl->sendAttributToServer(file_hdl->type) ; 
    6782   } 
    6883    
     
    7388      std::string name_str;  
    7489      if (!cstr2string(name, name_size, name_str)) return; 
    75       if (!cstr2string(name, name_size, name_str)) return; 
    7690 
    7791      filegroup_hdl->name.setValue(name_str); 
     92      filegroup_hdl->sendAttributToServer(filegroup_hdl->name) ; 
    7893   } 
    7994    
     
    8499 
    85100      filegroup_hdl->description.setValue(description_str); 
     101      filegroup_hdl->sendAttributToServer(filegroup_hdl->description) ; 
    86102   }  
    87103    
     
    92108 
    93109      filegroup_hdl->name_suffix.setValue(name_suffix_str); 
     110      filegroup_hdl->sendAttributToServer(filegroup_hdl->name_suffix) ; 
    94111   }  
    95112    
     
    100117 
    101118      filegroup_hdl->output_freq.setValue(output_freq_str); 
     119      filegroup_hdl->sendAttributToServer(filegroup_hdl->output_freq) ; 
    102120   } 
    103121    
     
    105123   { 
    106124      filegroup_hdl->output_level.setValue(output_level); 
     125      filegroup_hdl->sendAttributToServer(filegroup_hdl->output_level) ; 
    107126   } 
    108127    
     
    110129   { 
    111130      filegroup_hdl->enabled.setValue(enabled); 
     131      filegroup_hdl->sendAttributToServer(filegroup_hdl->enabled) ; 
     132   } 
     133    
     134   void cxios_set_filegroup_type(XFileGroupPtr filegroup_hdl, const char * type, int type_size) 
     135   { 
     136      std::string type_str;  
     137      if (!cstr2string(type, type_size, type_str)) return; 
     138 
     139      filegroup_hdl->type.setValue(type_str); 
     140      filegroup_hdl->sendAttributToServer(filegroup_hdl->type) ; 
    112141   } 
    113142    
  • XMLIO_V2/dev/common/src/fortran/icgrid.cpp

    r286 r300  
    3131 
    3232      grid_hdl->name.setValue(name_str); 
     33      grid_hdl->sendAttributToServer(name_str) ; 
    3334   } 
    3435    
     
    3940 
    4041      grid_hdl->description.setValue(description_str); 
     42      grid_hdl->sendAttributToServer(description_str) ; 
    4143   } 
    4244    
     
    4749 
    4850      grid_hdl->domain_ref.setValue(domain_ref_str); 
     51      grid_hdl->sendAttributToServer(domain_ref_str) ; 
    4952   } 
    5053    
     
    5558 
    5659     grid_hdl->axis_ref.setValue(axis_ref_str); 
     60     grid_hdl->sendAttributToServer(axis_ref_str) ; 
    5761   } 
    5862    
     
    6569 
    6670      gridgroup_hdl->name.setValue(name_str); 
     71      gridgroup_hdl->sendAttributToServer(gridgroup_hdl->name) ; 
    6772   } 
    6873    
     
    7378 
    7479      gridgroup_hdl->description.setValue(description_str); 
     80      gridgroup_hdl->sendAttributToServer(gridgroup_hdl->description) ; 
    7581   } 
    7682    
     
    8187 
    8288      gridgroup_hdl->domain_ref.setValue(domain_ref_str); 
     89      gridgroup_hdl->sendAttributToServer(gridgroup_hdl->domain_ref) ; 
    8390   } 
    8491    
     
    8996 
    9097      gridgroup_hdl->axis_ref.setValue(axis_ref_str); 
     98      gridgroup_hdl->sendAttributToServer(gridgroup_hdl->axis_ref) ; 
    9199   } 
    92100    
  • XMLIO_V2/dev/common/src/fortran/icxml_tree.cpp

    r286 r300  
    4343   { 
    4444      std::string child_id_str;  
    45       boost::shared_ptr<xmlioserver::tree::CFieldGroup> fieldgroup = 
    46          xmlioserver::CObjectFactory::GetObject<xmlioserver::tree::CFieldGroup>(parent_); 
    47  
    48       if (cstr2string(child_id, child_id_size, child_id_str)) 
    49          *child_ = xmlioserver::CGroupFactory::CreateChild(fieldgroup, child_id_str).get(); 
    50       else 
    51          *child_ = xmlioserver::CGroupFactory::CreateChild(fieldgroup).get(); 
    52    } 
     45 
     46      if (cstr2string(child_id, child_id_size, child_id_str)) 
     47      { 
     48         *child_ = parent_->createChild(child_id_str).get() ; 
     49         parent_->sendCreateChild(child_id_str) ; 
     50      } 
     51      else 
     52      { 
     53         *child_ = parent_->createChild().get() ; 
     54         parent_->sendCreateChild() ; 
     55      } 
     56  } 
    5357    
    5458   void cxios_xml_tree_add_grid 
     
    5660   { 
    5761      std::string child_id_str;  
    58       boost::shared_ptr<xmlioserver::tree::CGridGroup> gridgroup = 
    59          xmlioserver::CObjectFactory::GetObject<xmlioserver::tree::CGridGroup>(parent_); 
    60  
    61       if (cstr2string(child_id, child_id_size, child_id_str)) 
    62          *child_ = xmlioserver::CGroupFactory::CreateChild(gridgroup, child_id_str).get(); 
    63       else 
    64          *child_ = xmlioserver::CGroupFactory::CreateChild(gridgroup).get(); 
     62      if (cstr2string(child_id, child_id_size, child_id_str)) 
     63      { 
     64         *child_ = parent_->createChild(child_id_str).get() ; 
     65         parent_->sendCreateChild(child_id_str) ; 
     66      } 
     67      else 
     68      { 
     69         *child_ = parent_->createChild().get() ; 
     70         parent_->sendCreateChild() ; 
     71      } 
    6572   } 
    6673    
     
    6976   { 
    7077      std::string child_id_str;  
    71       boost::shared_ptr<xmlioserver::tree::CFileGroup> filegroup = 
    72          xmlioserver::CObjectFactory::GetObject<xmlioserver::tree::CFileGroup>(parent_); 
    73  
    74       if (cstr2string(child_id, child_id_size, child_id_str)) 
    75          *child_ = xmlioserver::CGroupFactory::CreateChild(filegroup, child_id_str).get(); 
    76       else 
    77          *child_ = xmlioserver::CGroupFactory::CreateChild(filegroup).get(); 
     78      if (cstr2string(child_id, child_id_size, child_id_str)) 
     79      { 
     80         *child_ = parent_->createChild(child_id_str).get() ; 
     81         parent_->sendCreateChild(child_id_str) ; 
     82      } 
     83      else 
     84      { 
     85         *child_ = parent_->createChild().get() ; 
     86         parent_->sendCreateChild() ; 
     87      } 
    7888   } 
    7989    
     
    8292   { 
    8393      std::string child_id_str;  
    84       boost::shared_ptr<xmlioserver::tree::CAxisGroup> axisgroup = 
    85          xmlioserver::CObjectFactory::GetObject<xmlioserver::tree::CAxisGroup>(parent_); 
    86  
    87       if (cstr2string(child_id, child_id_size, child_id_str)) 
    88          *child_ = xmlioserver::CGroupFactory::CreateChild(axisgroup, child_id_str).get(); 
    89       else 
    90          *child_ = xmlioserver::CGroupFactory::CreateChild(axisgroup).get(); 
     94      if (cstr2string(child_id, child_id_size, child_id_str)) 
     95      { 
     96         *child_ = parent_->createChild(child_id_str).get() ; 
     97         parent_->sendCreateChild(child_id_str) ; 
     98      } 
     99      else 
     100      { 
     101         *child_ = parent_->createChild().get() ; 
     102         parent_->sendCreateChild() ; 
     103      } 
    91104   } 
    92105    
     
    95108   { 
    96109      std::string child_id_str;  
    97       boost::shared_ptr<xmlioserver::tree::CDomainGroup> domaingroup = 
    98          xmlioserver::CObjectFactory::GetObject<xmlioserver::tree::CDomainGroup>(parent_); 
    99  
    100       if (cstr2string(child_id, child_id_size, child_id_str)) 
    101          *child_ = xmlioserver::CGroupFactory::CreateChild(domaingroup, child_id_str).get(); 
    102       else 
    103          *child_ = xmlioserver::CGroupFactory::CreateChild(domaingroup).get(); 
     110      if (cstr2string(child_id, child_id_size, child_id_str)) 
     111      { 
     112         *child_ = parent_->createChild(child_id_str).get() ; 
     113         parent_->sendCreateChild(child_id_str) ; 
     114      } 
     115      else 
     116      { 
     117         *child_ = parent_->createChild().get() ; 
     118         parent_->sendCreateChild() ; 
     119      } 
    104120   } 
    105121    
     
    108124   { 
    109125      std::string child_id_str;  
    110       boost::shared_ptr<xmlioserver::tree::CFile> file = 
    111          xmlioserver::CObjectFactory::GetObject<xmlioserver::tree::CFile>(parent_); 
    112  
    113       if (file->getVirtualFieldGroup().get() == 0 ) 
    114           file->setVirtualFieldGroup(file->getId()); 
    115  
    116       if (cstr2string(child_id, child_id_size, child_id_str)) 
    117          *child_ = xmlioserver::CGroupFactory::CreateChild(file->getVirtualFieldGroup(), child_id_str).get(); 
    118       else 
    119          *child_ = xmlioserver::CGroupFactory::CreateChild(file->getVirtualFieldGroup()).get(); 
     126  
     127      if (cstr2string(child_id, child_id_size, child_id_str)) 
     128      { 
     129         *child_ = parent_->addField(child_id_str).get(); 
     130         parent_->sendAddField(child_id_str) ; 
     131      } 
     132      else 
     133      { 
     134         *child_ = parent_->addField().get(); 
     135         parent_->sendAddField() ; 
     136      } 
    120137   } 
    121138 
     
    125142      (XFieldGroupPtr  parent_, XFieldGroupPtr * child_, const char * child_id, int child_id_size) 
    126143   { 
    127       std::string child_id_str; 
    128       boost::shared_ptr<xmlioserver::tree::CFieldGroup> fieldgroup = 
    129          xmlioserver::CObjectFactory::GetObject<xmlioserver::tree::CFieldGroup>(parent_); 
    130  
    131       if (cstr2string(child_id, child_id_size, child_id_str)) 
    132          *child_ = xmlioserver::CGroupFactory::CreateGroup(fieldgroup, child_id_str).get(); 
    133       else 
    134          *child_ = xmlioserver::CGroupFactory::CreateGroup(fieldgroup).get(); 
     144     std::string child_id_str;  
     145 
     146      if (cstr2string(child_id, child_id_size, child_id_str)) 
     147      { 
     148         *child_ = parent_->createChildGroup(child_id_str).get() ; 
     149         parent_->sendCreateChildGroup(child_id_str) ; 
     150      } 
     151      else 
     152      { 
     153         *child_ = parent_->createChildGroup().get() ; 
     154         parent_->sendCreateChildGroup(child_id_str) ; 
     155      } 
    135156   } 
    136157 
     
    139160   { 
    140161      std::string child_id_str; 
    141       boost::shared_ptr<xmlioserver::tree::CGridGroup> gridgroup = 
    142          xmlioserver::CObjectFactory::GetObject<xmlioserver::tree::CGridGroup>(parent_); 
    143  
    144       if (cstr2string(child_id, child_id_size, child_id_str)) 
    145          *child_ = xmlioserver::CGroupFactory::CreateGroup(gridgroup, child_id_str).get(); 
    146       else 
    147          *child_ = xmlioserver::CGroupFactory::CreateGroup(gridgroup).get(); 
     162  
     163      if (cstr2string(child_id, child_id_size, child_id_str)) 
     164      { 
     165         *child_ = parent_->createChildGroup(child_id_str).get() ; 
     166         parent_->sendCreateChildGroup(child_id_str) ; 
     167      } 
     168      else 
     169      { 
     170         *child_ = parent_->createChildGroup().get() ; 
     171         parent_->sendCreateChildGroup(child_id_str) ; 
     172      } 
    148173   } 
    149174 
     
    152177   { 
    153178      std::string child_id_str; 
    154       boost::shared_ptr<xmlioserver::tree::CFileGroup> filegroup = 
    155          xmlioserver::CObjectFactory::GetObject<xmlioserver::tree::CFileGroup>(parent_); 
    156  
    157       if (cstr2string(child_id, child_id_size, child_id_str)) 
    158          *child_ = xmlioserver::CGroupFactory::CreateGroup(filegroup, child_id_str).get(); 
    159       else 
    160          *child_ = xmlioserver::CGroupFactory::CreateGroup(filegroup).get(); 
     179      if (cstr2string(child_id, child_id_size, child_id_str)) 
     180      { 
     181         *child_ = parent_->createChildGroup(child_id_str).get() ; 
     182         parent_->sendCreateChildGroup(child_id_str) ; 
     183      } 
     184      else 
     185      { 
     186         *child_ = parent_->createChildGroup().get() ; 
     187         parent_->sendCreateChildGroup(child_id_str) ; 
     188      } 
    161189   } 
    162190 
     
    165193   { 
    166194      std::string child_id_str; 
    167       boost::shared_ptr<xmlioserver::tree::CAxisGroup> axisgroup = 
    168          xmlioserver::CObjectFactory::GetObject<xmlioserver::tree::CAxisGroup>(parent_); 
    169  
    170       if (cstr2string(child_id, child_id_size, child_id_str)) 
    171          *child_ = xmlioserver::CGroupFactory::CreateGroup(axisgroup, child_id_str).get(); 
    172       else 
    173          *child_ = xmlioserver::CGroupFactory::CreateGroup(axisgroup).get(); 
     195      if (cstr2string(child_id, child_id_size, child_id_str)) 
     196      { 
     197         *child_ = parent_->createChildGroup(child_id_str).get() ; 
     198         parent_->sendCreateChildGroup(child_id_str) ; 
     199      } 
     200      else 
     201      { 
     202         *child_ = parent_->createChildGroup().get() ; 
     203         parent_->sendCreateChildGroup(child_id_str) ; 
     204      } 
    174205   } 
    175206 
     
    178209   { 
    179210      std::string child_id_str; 
    180       boost::shared_ptr<xmlioserver::tree::CDomainGroup> domaingroup = 
    181          xmlioserver::CObjectFactory::GetObject<xmlioserver::tree::CDomainGroup>(parent_); 
    182  
    183       if (cstr2string(child_id, child_id_size, child_id_str)) 
    184          *child_ = xmlioserver::CGroupFactory::CreateGroup(domaingroup, child_id_str).get(); 
    185       else 
    186          *child_ = xmlioserver::CGroupFactory::CreateGroup(domaingroup).get(); 
     211      if (cstr2string(child_id, child_id_size, child_id_str)) 
     212      { 
     213         *child_ = parent_->createChildGroup(child_id_str).get() ; 
     214         parent_->sendCreateChildGroup(child_id_str) ; 
     215      } 
     216      else 
     217      { 
     218         *child_ = parent_->createChildGroup().get() ; 
     219         parent_->sendCreateChildGroup(child_id_str) ; 
     220      } 
    187221   } 
    188222 
     
    191225   { 
    192226      std::string child_id_str;  
    193       boost::shared_ptr<xmlioserver::tree::CFile> file = 
    194          xmlioserver::CObjectFactory::GetObject<xmlioserver::tree::CFile>(parent_); 
    195  
    196       if (file->getVirtualFieldGroup().get() == 0 ) 
    197           file->setVirtualFieldGroup(file->getId()); 
    198        
    199       if (cstr2string(child_id, child_id_size, child_id_str)) 
    200          *child_ = xmlioserver::CGroupFactory::CreateGroup(file->getVirtualFieldGroup(), child_id_str).get(); 
    201       else 
    202          *child_ = xmlioserver::CGroupFactory::CreateGroup(file->getVirtualFieldGroup()).get(); 
     227  
     228      if (cstr2string(child_id, child_id_size, child_id_str)) 
     229      { 
     230         *child_ = parent_->addFieldGroup(child_id_str).get(); 
     231         parent_->sendAddFieldGroup(child_id_str) ; 
     232      } 
     233      else 
     234      { 
     235         *child_ = parent_->addFieldGroup().get(); 
     236         parent_->sendAddFieldGroup() ; 
     237      } 
    203238   } 
    204239    
  • XMLIO_V2/dev/common/src/fortran/idata.F90

    r286 r300  
    77   INTERFACE ! Ne pas appeler directement/Interface FORTRAN 2003 <-> C99 
    88 
     9      SUBROUTINE  cxios_init_server() BIND(C) 
     10      END SUBROUTINE cxios_init_server 
     11 
     12     SUBROUTINE cxios_init_client(client_id, len_client_id, f_local_comm, f_return_comm) BIND(C) 
     13         USE ISO_C_BINDING 
     14         CHARACTER(kind = C_CHAR)    , DIMENSION(*) :: client_id 
     15         INTEGER  (kind = C_INT)     , VALUE        :: len_client_id 
     16         INTEGER  (kind = C_INT)                    :: f_local_comm 
     17         INTEGER  (kind = C_INT)                    :: f_return_comm 
     18      END SUBROUTINE cxios_init_client 
     19       
     20      SUBROUTINE  cxios_context_initialize(context_id,len_context_id,f_comm) BIND(C) 
     21         USE ISO_C_BINDING 
     22         CHARACTER(kind = C_CHAR)    , DIMENSION(*) :: context_id 
     23         INTEGER  (kind = C_INT)     , VALUE        :: len_context_id 
     24         INTEGER  (kind = C_INT)                    :: f_comm 
     25      END SUBROUTINE cxios_context_initialize 
     26 
     27       SUBROUTINE  cxios_context_close_definition() BIND(C) 
     28         USE ISO_C_BINDING 
     29      END SUBROUTINE cxios_context_close_definition 
     30      
     31 
     32       SUBROUTINE  cxios_context_finalize() BIND(C) 
     33         USE ISO_C_BINDING 
     34      END SUBROUTINE cxios_context_finalize 
     35      
    936      SUBROUTINE  cxios_init_ioserver(comm_client,comm_parent) BIND(C) 
    1037         USE ISO_C_BINDING 
     
    1542      SUBROUTINE  cxios_finalize_ioserver BIND(C) 
    1643      END SUBROUTINE cxios_finalize_ioserver 
     44  
     45      SUBROUTINE  cxios_finalize BIND(C) 
     46      END SUBROUTINE cxios_finalize 
    1747 
    1848      SUBROUTINE cxios_dtreatment_start() BIND(C) 
     
    80110   CONTAINS ! Fonctions disponibles pour les utilisateurs. 
    81111 
    82  
    83    SUBROUTINE  xios(initialize)(local_comm,return_comm ) 
     112   SUBROUTINE  xios(init_server)() 
     113   IMPLICIT NONE 
     114     CALL cxios_init_server() 
     115   END SUBROUTINE xios(init_server) 
     116    
     117   SUBROUTINE  xios(initialize)(client_id, local_comm, return_comm) 
    84118   IMPLICIT NONE 
    85119   INCLUDE 'mpif.h' 
    86       INTEGER, INTENT(OUT),OPTIONAL :: return_comm 
    87       INTEGER, INTENT(IN),OPTIONAL :: local_comm 
    88  
    89       INTEGER  :: comm_client 
    90       INTEGER  :: comm_parent 
    91        
     120   CHARACTER(LEN=*),INTENT(IN) :: client_id 
     121   INTEGER,INTENT(IN),OPTIONAL         :: local_comm   
     122   INTEGER,INTENT(OUT),OPTIONAL        :: return_comm 
     123   INTEGER :: f_local_comm 
     124   INTEGER :: f_return_comm 
     125    
    92126      IF (PRESENT(local_comm)) THEN 
    93         comm_parent=local_comm 
     127        f_local_comm=local_comm  
    94128      ELSE 
    95         comm_parent=MPI_COMM_WORLD 
     129        f_local_comm = MPI_COMM_NULL  
    96130      ENDIF 
    97131       
    98       CALL cxios_init_ioserver(comm_client,comm_parent) 
    99       IF (PRESENT(return_comm)) return_comm=comm_client ; 
    100  
    101     END SUBROUTINE  xios(initialize) 
    102  
     132      CALL cxios_init_client(client_id,LEN(client_id),f_local_comm,f_return_comm) 
     133  
     134      IF (PRESENT(return_comm)) return_comm=f_return_comm 
     135 
     136   END SUBROUTINE  xios(initialize) 
     137 
     138 
     139   SUBROUTINE  xios(context_initialize)(context_id,comm) 
     140   IMPLICIT NONE 
     141   CHARACTER(LEN=*),INTENT(IN)  :: context_id 
     142   INTEGER, INTENT(IN)          :: comm 
     143       
     144      CALL cxios_context_initialize(context_id,LEN(context_id),comm) 
     145  
     146    END SUBROUTINE  xios(context_initialize) 
     147     
     148     
    103149   SUBROUTINE  xios(finalize) 
    104150   IMPLICIT NONE 
    105151 
    106       CALL cxios_finalize_ioserver 
     152      CALL cxios_finalize 
    107153 
    108154    END SUBROUTINE  xios(finalize) 
     
    111157   SUBROUTINE xios(close_context_definition)() 
    112158   IMPLICIT NONE 
    113       CALL cxios_dtreatment_start() 
     159      CALL cxios_context_close_definition() 
    114160   END SUBROUTINE xios(close_context_definition) 
    115161 
     
    117163   SUBROUTINE xios(context_finalize)() 
    118164   IMPLICIT NONE 
    119       CALL cxios_dtreatment_end() 
     165      CALL cxios_context_finalize() 
    120166   END SUBROUTINE xios(context_finalize) 
    121167    
  • XMLIO_V2/dev/common/src/fortran/idate.F90

    r286 r300  
    1919 
    2020   TYPE txios(time) 
    21       REAL(kind = 8) :: year, month, day, hour, minute, second 
     21      REAL(kind = 8) :: year=0, month=0, day=0, hour=0, minute=0, second=0 
    2222   END TYPE txios(time)    
    2323 
  • XMLIO_V2/dev/common/src/fortran/ifile.F90

    r286 r300  
    3535 
    3636 
    37    SUBROUTINE xios(set_file_attr)(file_id, name , description, name_suffix, output_freq, output_level, enabled) 
     37   SUBROUTINE xios(set_file_attr)(file_id, name , description, name_suffix, output_freq, output_level, enabled, type) 
    3838      IMPLICIT NONE 
    3939      TYPE(txios(file))                       :: file_hdl 
     
    4545      INTEGER           , OPTIONAL, INTENT(IN) :: output_level 
    4646      LOGICAL           , OPTIONAL, INTENT(IN) :: enabled 
    47        
     47      CHARACTER(len = *), OPTIONAL, INTENT(IN) :: type 
     48             
    4849      CALL xios(get_file_handle)(file_id,file_hdl) 
    49       CALL xios(set_file_attr_hdl_)(file_hdl, name , description, name_suffix, output_freq, output_level, enabled) 
     50      CALL xios(set_file_attr_hdl_)(file_hdl, name , description, name_suffix, output_freq, output_level, enabled, type) 
    5051       
    5152   END SUBROUTINE xios(set_file_attr) 
    5253    
    5354 
    54    SUBROUTINE xios(set_file_attr_hdl)(file_hdl, name , description, name_suffix, output_freq, output_level, enabled) 
     55   SUBROUTINE xios(set_file_attr_hdl)(file_hdl, name , description, name_suffix, output_freq, output_level, enabled,type) 
    5556      TYPE(txios(file))          , INTENT(IN) :: file_hdl 
    5657      CHARACTER(len = *), OPTIONAL, INTENT(IN) :: name 
     
    6061      INTEGER           , OPTIONAL, INTENT(IN) :: output_level 
    6162      LOGICAL           , OPTIONAL, INTENT(IN) :: enabled 
    62  
    63       CALL xios(set_file_attr_hdl_)(file_hdl, name , description, name_suffix, output_freq, output_level, enabled) 
     63      CHARACTER(len = *), OPTIONAL, INTENT(IN) :: type 
     64 
     65      CALL xios(set_file_attr_hdl_)(file_hdl, name , description, name_suffix, output_freq, output_level, enabled, type) 
    6466       
    6567   END SUBROUTINE xios(set_file_attr_hdl) 
    6668 
    67    SUBROUTINE xios(set_file_attr_hdl_)(file_hdl, name_ , description_, name_suffix_, output_freq_, output_level_, enabled_) 
     69   SUBROUTINE xios(set_file_attr_hdl_)(file_hdl, name_ , description_, name_suffix_, output_freq_, output_level_, enabled_, type_) 
    6870      TYPE(txios(file))          , INTENT(IN) :: file_hdl 
    6971      CHARACTER(len = *), OPTIONAL, INTENT(IN) :: name_ 
     
    7476      LOGICAL(kind = 1)                        :: enabled__ 
    7577      LOGICAL           , OPTIONAL, INTENT(IN) :: enabled_ 
    76        
     78      CHARACTER(len = *), OPTIONAL, INTENT(IN) :: type_ 
     79             
    7780      IF (PRESENT(name_))         THEN 
    7881         CALL cxios_set_file_name(file_hdl%daddr, name_, len(name_)) 
     
    9497         CALL cxios_set_file_enabled(file_hdl%daddr, enabled__) 
    9598      END IF 
    96  
     99       
     100      IF (PRESENT(type_))         THEN 
     101         CALL cxios_set_file_type(file_hdl%daddr, type_, len(type_)) 
     102      END IF 
     103       
    97104   END SUBROUTINE xios(set_file_attr_hdl_) 
    98105 
    99106 
    100107    
    101    SUBROUTINE xios(set_filegroup_attr)(filegroup_id, name , description, name_suffix, output_freq, output_level, enabled) 
     108   SUBROUTINE xios(set_filegroup_attr)(filegroup_id, name , description, name_suffix, output_freq, output_level, enabled, type) 
    102109      IMPLICIT NONE 
    103110      TYPE(txios(filegroup))                  :: filegroup_hdl 
     
    109116      INTEGER           , OPTIONAL, INTENT(IN) :: output_level 
    110117      LOGICAL           , OPTIONAL, INTENT(IN) :: enabled 
     118      CHARACTER(len = *), OPTIONAL, INTENT(IN) :: type 
    111119       
    112120      CALL xios(get_filegroup_handle)(filegroup_id,filegroup_hdl) 
    113       CALL xios(set_filegroup_attr_hdl_)(filegroup_hdl, name , description, name_suffix, output_freq, output_level, enabled) 
     121      CALL xios(set_filegroup_attr_hdl_)(filegroup_hdl, name , description, name_suffix, output_freq, output_level, enabled, type) 
    114122       
    115123   END SUBROUTINE xios(set_filegroup_attr) 
    116124 
    117125 
    118    SUBROUTINE xios(set_filegroup_attr_hdl)(filegroup_hdl, name , description, name_suffix, output_freq, output_level, enabled) 
     126   SUBROUTINE xios(set_filegroup_attr_hdl)(filegroup_hdl, name , description, name_suffix, output_freq, output_level, enabled, type) 
    119127      IMPLICIT NONE 
    120128      TYPE(txios(filegroup))     , INTENT(IN) :: filegroup_hdl 
     
    125133      INTEGER           , OPTIONAL, INTENT(IN) :: output_level 
    126134      LOGICAL           , OPTIONAL, INTENT(IN) :: enabled 
    127        
    128      CALL xios(set_filegroup_attr_hdl_)(filegroup_hdl, name , description, name_suffix, output_freq, output_level, enabled) 
     135      CHARACTER(len = *), OPTIONAL, INTENT(IN) :: type 
     136       
     137     CALL xios(set_filegroup_attr_hdl_)(filegroup_hdl, name , description, name_suffix, output_freq, output_level, enabled, type) 
    129138 
    130139   END SUBROUTINE xios(set_filegroup_attr_hdl) 
    131140       
    132141    
    133    SUBROUTINE xios(set_filegroup_attr_hdl_)(filegroup_hdl, name_ , description_, name_suffix_, output_freq_, output_level_, enabled_) 
     142   SUBROUTINE xios(set_filegroup_attr_hdl_)(filegroup_hdl, name_ , description_, name_suffix_, output_freq_, output_level_,     & 
     143                   enabled_,type_) 
    134144      IMPLICIT NONE 
    135145      TYPE(txios(filegroup))     , INTENT(IN) :: filegroup_hdl 
     
    141151      LOGICAL(kind = 1)                        :: enabled__ 
    142152      LOGICAL           , OPTIONAL, INTENT(IN) :: enabled_ 
     153      CHARACTER(len = *), OPTIONAL, INTENT(IN) :: type_ 
    143154       
    144155      IF (PRESENT(name_))         THEN 
     
    160171        enabled__ = enabled_  
    161172        CALL cxios_set_filegroup_enabled(filegroup_hdl%daddr, enabled__) 
     173      END IF 
     174       
     175      IF (PRESENT(type_))         THEN 
     176         CALL cxios_set_filegroup_type(filegroup_hdl%daddr, type_, len(type_)) 
    162177      END IF 
    163178 
  • XMLIO_V2/dev/common/src/fortran/ixios.F90

    r286 r300  
    88                     xios(is_valid_context) 
    99 
    10 USE idata, ONLY : xios(initialize), xios(finalize), xios(close_context_definition),       & 
     10USE idata, ONLY : xios(initialize),xios(init_server), xios(finalize), xios(context_initialize),  & 
     11                  xios(close_context_definition),       & 
    1112                  xios(context_finalize), xios(send_field_r8_1d), xios(send_field_r8_2d), & 
    1213                  xios(send_field_r8_3d), xios(send_field_r4_1d), xios(send_field_r4_2d), & 
     
    4041                     xios(add_fieldtofile), xios(add_axisgroup), xios(add_filegroup), xios(add_gridgroup), & 
    4142                     xios(add_fieldgroup), xios(add_domaingroup), xios(add_fieldgrouptofile) 
    42  
    43 USE idata, ONLY : xios(initialize), xios(finalize), xios(close_context_definition), xios(context_finalize), & 
    44                   xios(send_field_r8_1d), xios(send_field_r8_2d), xios(send_field_r8_3d),                   & 
    45                   xios(send_field_r4_1d), xios(send_field_r4_2d), xios(send_field_r4_3d) 
    4643                   
    4744 
     
    8582 
    8683 PUBLIC :: xios(get_handle)  
     84 PUBLIC :: xios(add_child)  
    8785 
    8886 PUBLIC :: xios(is_valid_context),xios(is_valid_domain), xios(is_valid_domaingroup),xios(is_valid_field),        & 
     
    9290 PUBLIC :: xios(set_current_context)   
    9391 PUBLIC :: xios(set_timestep),xios(update_calendar) 
    94  PUBLIC :: xios(initialize), xios(finalize), xios(close_context_definition), xios(context_finalize), xios(send_field) 
     92 PUBLIC :: xios(initialize), xios(init_server), xios(finalize), xios(context_initialize),                       & 
     93           xios(close_context_definition), xios(context_finalize), xios(send_field) 
    9594 
    9695END MODULE XIOS 
  • XMLIO_V2/dev/common/src/fortran/oasis_cinterface.cpp

    r286 r300  
    1616  } 
    1717   
    18  
     18  void oasis_get_localcomm(MPI_Comm& comm) 
     19  { 
     20    MPI_Fint f_comm ; 
     21     
     22    fxios_oasis_get_localcomm(&f_comm) ; 
     23    comm=MPI_Comm_f2c(f_comm) ; 
     24  } 
     25  
    1926  void oasis_get_intracomm(MPI_Comm& comm_client_server,const std::string& server_id) 
    2027  { 
     
    2431    comm_client_server=MPI_Comm_f2c(f_comm) ; 
    2532  } 
    26  
     33  
     34  void oasis_get_intercomm(MPI_Comm& comm_client_server,const std::string& server_id) 
     35  { 
     36    MPI_Fint f_comm ; 
     37     
     38    fxios_oasis_get_intercomm(&f_comm,server_id.data(),server_id.size()) ; 
     39    comm_client_server=MPI_Comm_f2c(f_comm) ; 
     40  } 
    2741} 
  • XMLIO_V2/dev/common/src/fortran/oasis_cinterface.hpp

    r286 r300  
    99  void fxios_oasis_init(const char* server_id,int str_len) ; 
    1010  void fxios_oasis_finalize(void) ; 
     11  void fxios_oasis_get_localcomm(MPI_Fint* f_comm) ; 
    1112  void fxios_oasis_get_intracomm(MPI_Fint* f_comm_client_server,const char* client_id,int str_len) ; 
     13  void fxios_oasis_get_intercomm(MPI_Fint* f_comm_client_server,const char* client_id,int str_len) ; 
    1214} 
    1315  
     
    1618  void oasis_init(const std::string& server_id) ; 
    1719  void oasis_finalize(void) ; 
     20  void oasis_get_localcomm(MPI_Comm& comm) ; 
    1821  void oasis_get_intracomm(MPI_Comm& comm_client_server,const std::string& server_id) ; 
     22  void oasis_get_intercomm(MPI_Comm& comm_client_server,const std::string& server_id) ; 
    1923} 
    2024#endif 
  • XMLIO_V2/dev/common/src/fortran/oasis_interface.F90

    r286 r300  
    3939 
    4040 
     41SUBROUTINE fxios_oasis_get_localcomm(f_comm) BIND(C,NAME="fxios_oasis_get_localcomm") 
     42  USE, INTRINSIC :: ISO_C_BINDING 
     43#ifdef USE_OASIS 
     44!  USE mod_prism_get_localcomm_proto  
     45#endif 
     46  IMPLICIT NONE 
     47  INTEGER(kind=C_INT) :: f_comm 
     48   
     49  INTEGER :: comm 
     50  INTEGER :: ierr 
     51     
     52#ifdef USE_OASIS 
     53    CALL prism_get_localcomm_proto(comm,ierr) 
     54#endif 
     55    f_comm=comm 
     56 
     57END SUBROUTINE fxios_oasis_get_localcomm 
     58 
     59 
     60 
     61 
    4162SUBROUTINE fxios_oasis_get_intracomm(f_comm_client_server,client_id,str_len) BIND(C,NAME="fxios_oasis_get_intracomm") 
    4263  USE, INTRINSIC :: ISO_C_BINDING 
     
    6182    CALL prism_get_intracomm(comm_client_server,oasis_client_id,ierr) 
    6283#endif 
    63     PRINT *,"---> prism_get_intracomm ",oasis_client_id,comm_client_server,ierr 
     84 
    6485    f_comm_client_server=comm_client_server 
    6586 
    6687END SUBROUTINE fxios_oasis_get_intracomm 
     88 
     89SUBROUTINE fxios_oasis_get_intercomm(f_comm_client_server,client_id,str_len) BIND(C,NAME="fxios_oasis_get_intercomm") 
     90  USE, INTRINSIC :: ISO_C_BINDING 
     91#ifdef USE_OASIS 
     92  USE mod_prism_get_comm  
     93#endif 
     94  IMPLICIT NONE 
     95  INTEGER(kind=C_INT) :: f_comm_client_server 
     96  CHARACTER,DIMENSION(*) :: client_id 
     97  INTEGER,VALUE          :: str_len 
     98   
     99  INTEGER :: comm_client_server 
     100  CHARACTER(len=str_len) :: oasis_client_id 
     101  INTEGER :: ierr 
     102  INTEGER :: i 
     103     
     104    DO i=1,str_len 
     105      oasis_client_id(i:i)=client_id(i) 
     106    ENDDO 
     107     
     108#ifdef USE_OASIS 
     109    CALL prism_get_intercomm(comm_client_server,oasis_client_id,ierr) 
     110#endif 
     111 
     112    f_comm_client_server=comm_client_server 
     113 
     114END SUBROUTINE fxios_oasis_get_intercomm 
  • XMLIO_V2/dev/common/src/group_template.hpp

    r274 r300  
    22#define __XMLIO_CGroupTemplate__ 
    33 
     4#include "xmlioserver_spl.hpp" 
    45#include "declare_attribute.hpp" 
     6#include "event_server.hpp" 
     7#include "object_template.hpp" 
    58 
    69namespace xmlioserver 
     
    2326 
    2427      public : 
     28       
     29         enum EEventId 
     30         { 
     31           EVENT_ID_CREATE_CHILD=200, EVENT_ID_CREATE_CHILD_GROUP 
     32         } ; 
    2533 
    2634         /// Spécifique /// 
     
    5563         virtual void solveDescInheritance(const CAttributeMap * const parent = 0); 
    5664         void solveRefInheritance(void); 
    57  
     65//         static bool has(const string & id);  
     66//         static boost::shared_ptr<V> get(const string& id) ; 
     67//         static boost::shared_ptr<V> create(const string& id=string("")) ; 
     68         boost::shared_ptr<U> createChild(const string& id="") ;  
     69         boost::shared_ptr<V> createChildGroup(const string& id="") ;  
     70         static bool dispatchEvent(CEventServer& event) ; 
     71         void sendCreateChild(const string& id="") ; 
     72         void sendCreateChildGroup(const string& id="") ; 
     73         static void recvCreateChild(CEventServer& event) ; 
     74         void recvCreateChild(CBufferIn& buffer) ; 
     75         static void recvCreateChildGroup(CEventServer& event) ; 
     76         void recvCreateChildGroup(CBufferIn& buffer) ; 
     77          
    5878         /// Destructeur /// 
    5979         virtual ~CGroupTemplate(void); 
     
    82102} // namespace xmlioserver 
    83103 
     104//#include "group_template_impl.hpp" 
     105 
    84106#endif // __XMLIO_CGroupTemplate__ 
  • XMLIO_V2/dev/common/src/group_template_impl.hpp

    r219 r300  
    11#ifndef __XMLIO_CGroupTemplate_impl__ 
    22#define __XMLIO_CGroupTemplate_impl__ 
     3 
     4#include "xmlioserver_spl.hpp" 
     5#include "event_server.hpp" 
     6#include "object_template_impl.hpp" 
     7#include "group_template.hpp" 
     8#include "context.hpp" 
     9#include "event_client.hpp" 
     10#include "context_client.hpp" 
     11 
    312 
    413namespace xmlioserver 
     
    307316      void CGroupTemplate<U, V, W>::solveRefInheritance(void) 
    308317   { /* Ne rien faire de plus */ } 
    309  
     318    
     319//   template <class U, class V, class W> 
     320//   bool CGroupTemplate<U, V, W>::has(const string& id)  
     321//   { 
     322//       return CObjectFactory::HasObject<V>(id) ; 
     323//   } 
     324 
     325//   template <class U, class V, class W> 
     326//   boost::shared_ptr<V> CGroupTemplate<U, V, W>::get(const string& id)  
     327//   { 
     328//       return CObjectFactory::GetObject<V>(id) ; 
     329//   } 
     330 
     331//   template <class U, class V, class W> 
     332//   boost::shared_ptr<V> CGroupTemplate<U, V, W>::get()  
     333//   { 
     334//       return CObjectFactory::GetObject<V>(this) ; 
     335//   } 
     336    
     337//   template <class U, class V, class W> 
     338//   boost::shared_ptr<V> CGroupTemplate<U, V, W>::create(const string& id)  
     339//   { 
     340//       return CObjectFactory::CreateObject<V>(id) ; 
     341//   } 
    310342   ///-------------------------------------------------------------- 
    311343 
     344   template <class U, class V, class W> 
     345   boost::shared_ptr<U> CGroupTemplate<U, V, W>::createChild(const string& id)  
     346  { 
     347    return CGroupFactory::CreateChild<V>(this->get(), id) ; 
     348  } 
     349   
     350   template <class U, class V, class W> 
     351   boost::shared_ptr<V> CGroupTemplate<U, V, W>::createChildGroup(const string& id)  
     352  { 
     353    return CGroupFactory::CreateGroup<V>(this->get(), id) ; 
     354  } 
     355 
     356 
     357   template <class U, class V, class W> 
     358   void CGroupTemplate<U, V, W>::sendCreateChild(const string& id) 
     359   { 
     360    shared_ptr<CContext> context=CContext::current() ; 
     361     
     362    if (! context->hasServer ) 
     363    { 
     364       CContextClient* client=context->client ; 
     365 
     366       CEventClient event(this->getType(),EVENT_ID_CREATE_CHILD) ;    
     367       if (client->isServerLeader()) 
     368       { 
     369         CMessage msg ; 
     370         msg<<this->getId() ; 
     371         msg<<id ; 
     372         event.push(client->getServerLeader(),1,msg) ; 
     373         client->sendEvent(event) ; 
     374       } 
     375       else client->sendEvent(event) ; 
     376    } 
     377       
     378   } 
     379    
     380   template <class U, class V, class W> 
     381   void CGroupTemplate<U, V, W>::sendCreateChildGroup(const string& id) 
     382   { 
     383    shared_ptr<CContext> context=CContext::current() ; 
     384    if (! context->hasServer ) 
     385    { 
     386       CContextClient* client=context->client ; 
     387 
     388       CEventClient event(this->getType(),EVENT_ID_CREATE_CHILD_GROUP) ;    
     389       if (client->isServerLeader()) 
     390       { 
     391         CMessage msg ; 
     392         msg<<this->getId() ; 
     393         msg<<id ; 
     394         event.push(client->getServerLeader(),1,msg) ; 
     395         client->sendEvent(event) ; 
     396       } 
     397       else client->sendEvent(event) ; 
     398    } 
     399       
     400   } 
     401    
     402   template <class U, class V, class W> 
     403   void CGroupTemplate<U, V, W>::recvCreateChild(CEventServer& event) 
     404   { 
     405       
     406      CBufferIn* buffer=event.subEvents.begin()->buffer; 
     407      string id; 
     408      *buffer>>id ; 
     409      V::get(id)->recvCreateChild(*buffer) ; 
     410   } 
     411    
     412    
     413   template <class U, class V, class W> 
     414   void CGroupTemplate<U, V, W>::recvCreateChild(CBufferIn& buffer) 
     415   { 
     416      string id ; 
     417      buffer>>id ; 
     418      createChild(id) ; 
     419   } 
     420 
     421   template <class U, class V, class W> 
     422   void CGroupTemplate<U, V, W>::recvCreateChildGroup(CEventServer& event) 
     423   { 
     424       
     425      CBufferIn* buffer=event.subEvents.begin()->buffer; 
     426      string id; 
     427      *buffer>>id ; 
     428      V::get(id)->recvCreateChildGroup(*buffer) ; 
     429   } 
     430    
     431    
     432   template <class U, class V, class W> 
     433   void CGroupTemplate<U, V, W>::recvCreateChildGroup(CBufferIn& buffer) 
     434   { 
     435      string id ; 
     436      buffer>>id ; 
     437      createChildGroup(id) ; 
     438   } 
     439    
     440 
     441   template <class U, class V, class W> 
     442   bool CGroupTemplate<U, V, W>::dispatchEvent(CEventServer& event) 
     443   { 
     444      if (CObjectTemplate<V>::dispatchEvent(event)) return true ; 
     445      else 
     446      { 
     447        switch(event.type) 
     448        { 
     449           case EVENT_ID_CREATE_CHILD : 
     450             recvCreateChild(event) ; 
     451             return true ; 
     452             break ; 
     453          
     454           case EVENT_ID_CREATE_CHILD_GROUP : 
     455             recvCreateChildGroup(event) ; 
     456             return true ; 
     457             break ;        
     458          
     459           default : 
     460           return false ; 
     461        } 
     462      } 
     463   } 
     464 
    312465} // namespace xmlioserver 
    313466 
  • XMLIO_V2/dev/common/src/main_server.cpp

    r286 r300  
    1414 
    1515 
     16 
    1617// Point d'entrée du programme principal 
    1718 
     
    2627      CTreeManager::SetCurrentContextId(StdString("xios")); 
    2728      boost::shared_ptr<CVariable> var = CObjectFactory::GetObject<CVariable>("buffer_client_size");  
    28       std::cout<<CObjectFactory::GetObject<CVariable>("xios","using_oasis")->getData<bool>()<<std::endl; 
    2929      
    3030//      oasis_init(std::string("ionemo")) ; 
    31 //      std::cout<<"Initialisation OASIS Ok"<<std::endl ; 
    3231//      oasis_get_intracomm(comm_parent,std::string("oceanx")) ; 
    33 //      std::cout<<"Appel Oasis intracom Ok"<<std::endl ; 
    3432      CXIOSManager::Initialise(CXIOSManager::CLIENT_SERVER, &argc, &argv); 
    3533      
    36       std::cout<<"Appel Dispatch client ?"<<std::endl ; 
    37       std::cout<<comm_client<<" "<<comm_client_server<<" "<<comm_server<<"  "<<comm_parent<<std::endl ; 
    3834      CMPIManager::DispatchClient(true, comm_client, comm_client_server, comm_server, comm_parent); 
    39       std::cout<<"Appel Dispatch client Ok"<<std::endl ; 
    4035      CXIOSManager::RunServer("Nemo", comm_client_server, comm_server); 
    4136      CTreeManager::SetCurrentContextId(StdString("nemo")); 
  • XMLIO_V2/dev/common/src/manager/xios_manager.cpp

    r286 r300  
    126126         if (CMPIManager::IsMaster(comm_client_server)) 
    127127         { 
    128             std::cout << " *************************************** " << std::endl 
    129                       << " *     XmlIOServer (Client/Server)     * " << std::endl 
    130                       << " *************************************** " << std::endl; 
    131             std::cout << " > Nombre de processus : " 
    132                       << CMPIManager::GetCommSize(comm_client_server) << std::endl; 
    133             std::cout << " > Nombre de processus utilisés : " 
    134                       << (CXIOSManager::GetNbClient() + CXIOSManager::GetNbServer()) << std::endl; 
    135             std::cout << " > Nombre de clients : " 
    136                       << CXIOSManager::GetNbClient() << std::endl; 
    137             std::cout << " > Nombre de serveurs : " 
    138                       << CXIOSManager::GetNbServer() << std::endl; 
    139128 
    140129            xios_map<StdString, XIOSClient>::iterator 
     
    145134            { 
    146135               const StdPairStrClient & elem = *iit; 
    147                std::cout << " - " << elem.first 
    148                          << " > nombre de clients : "              
    149                          << elem.second.nbClient 
    150                          << " , nombre de clients par serveur : "  
    151                          << elem.second.nbClientPServer 
    152                          << " , nombre de serveurs : "             
    153                          << elem.second.nbClient/elem.second.nbClientPServer 
    154                          << std::endl; 
    155             } 
    156  
    157             std::cout << " *************************************** " << std::endl; 
     136            } 
     137 
    158138         } 
    159139 
  • XMLIO_V2/dev/common/src/node/axis.cpp

    r219 r300  
    44#include "object_template_impl.hpp" 
    55#include "group_template_impl.hpp" 
     6#include "transfert_parameters.hpp" 
    67 
    78namespace xmlioserver { 
  • XMLIO_V2/dev/common/src/node/context.cpp

    r286 r300  
    11#include "context.hpp" 
    2  
    32#include "tree_manager.hpp" 
    43 
     
    1110 
    1211#include "data_treatment.hpp" 
     12#include "context_client.hpp" 
     13#include "context_server.hpp" 
     14#include "nc4_data_output.hpp" 
    1315 
    1416namespace xmlioserver { 
     
    1921   CContext::CContext(void) 
    2022      : CObjectTemplate<CContext>(), CContextAttributes() 
    21       , calendar() 
     23      , calendar(),hasClient(false),hasServer(false) 
    2224   { /* Ne rien faire de plus */ } 
    2325 
    2426   CContext::CContext(const StdString & id) 
    2527      : CObjectTemplate<CContext>(id), CContextAttributes() 
    26       , calendar() 
     28      , calendar(),hasClient(false),hasServer(false) 
    2729   { /* Ne rien faire de plus */ } 
    2830 
    2931   CContext::~CContext(void) 
    30    { /* Ne rien faire de plus */ } 
     32   {  
     33     if (hasClient) delete client ; 
     34     if (hasServer) delete server ; 
     35   } 
    3136 
    3237   //---------------------------------------------------------------- 
     
    299304   } 
    300305   ///--------------------------------------------------------------- 
    301  
     306    
     307   void CContext::initClient(MPI_Comm intraComm, MPI_Comm interComm) 
     308   { 
     309     hasClient=true ; 
     310     client = new CContextClient(this,intraComm, interComm) ; 
     311   }  
     312 
     313   void CContext::initServer(MPI_Comm intraComm,MPI_Comm interComm) 
     314   { 
     315     hasServer=true ; 
     316     server = new CContextServer(this,intraComm,interComm) ; 
     317   }  
     318 
     319   bool CContext::eventLoop(void) 
     320   { 
     321     return server->eventLoop() ; 
     322   }  
     323    
     324   void CContext::finalize(void) 
     325   { 
     326      if (hasClient && !hasServer) 
     327      { 
     328         client->finalize() ; 
     329      } 
     330      if (hasServer) 
     331      { 
     332        closeAllFile() ; 
     333      } 
     334   } 
     335        
     336        
     337  
     338    
     339   void CContext::closeDefinition(void) 
     340   { 
     341      if (hasClient && !hasServer) sendCloseDefinition() ; 
     342       
     343      solveCalendar();          
     344          
     345      // Résolution des héritages pour le context actuel. 
     346      this->solveAllInheritance(); 
     347 
     348      //Initialisation du vecteur 'enabledFiles' contenant la liste des fichiers à sortir. 
     349      this->findEnabledFiles(); 
     350 
     351      //Recherche des champs à sortir (enable à true + niveau de sortie correct) 
     352      // pour chaque fichier précédemment listé. 
     353      this->findAllEnabledFields(); 
     354 
     355      // Résolution des références de grilles pour chacun des champs. 
     356      this->solveAllGridRef(); 
     357 
     358      // Traitement des opérations. 
     359      this->solveAllOperation(); 
     360 
     361      // Nettoyage de l'arborescence 
     362      CleanTree(); 
     363      if (hasClient) sendCreateFileHeader() ; 
     364   } 
     365    
     366   void CContext::findAllEnabledFields(void) 
     367   { 
     368     for (unsigned int i = 0; i < this->enabledFiles.size(); i++) 
     369     (void)this->enabledFiles[i]->getEnabledFields(); 
     370   } 
     371 
     372   void CContext::solveAllGridRef(void) 
     373   { 
     374     for (unsigned int i = 0; i < this->enabledFiles.size(); i++) 
     375     this->enabledFiles[i]->solveEFGridRef(); 
     376   } 
     377 
     378   void CContext::solveAllOperation(void) 
     379   { 
     380      for (unsigned int i = 0; i < this->enabledFiles.size(); i++) 
     381      this->enabledFiles[i]->solveEFOperation(); 
     382   } 
     383 
     384   void CContext::solveAllInheritance(void) 
     385   { 
     386     // Résolution des héritages descendants (càd des héritages de groupes) 
     387     // pour chacun des contextes. 
     388      solveDescInheritance(); 
     389 
     390     // Résolution des héritages par référence au niveau des fichiers. 
     391      const std::vector<boost::shared_ptr<CFile> > & allFiles 
     392             = CObjectFactory::GetObjectVector<CFile>(); 
     393 
     394      for (unsigned int i = 0; i < allFiles.size(); i++) 
     395         allFiles[i]->solveFieldRefInheritance(); 
     396   } 
     397 
     398   void CContext::findEnabledFiles(void) 
     399   { 
     400      const std::vector<boost::shared_ptr<CFile> > & allFiles 
     401          = CObjectFactory::GetObjectVector<CFile>(); 
     402 
     403      for (unsigned int i = 0; i < allFiles.size(); i++) 
     404         if (!allFiles[i]->enabled.isEmpty()) // Si l'attribut 'enabled' est défini. 
     405            if (allFiles[i]->enabled.getValue()) // Si l'attribut 'enabled' est fixé à vrai. 
     406               enabledFiles.push_back(allFiles[i]); 
     407 
     408      if (enabledFiles.size() == 0) 
     409         DEBUG(<<"Aucun fichier ne va être sorti dans le contexte nommé \"" 
     410               << getId() << "\" !"); 
     411   } 
     412 
     413   void CContext::closeAllFile(void) 
     414   { 
     415     std::vector<boost::shared_ptr<CFile> >::const_iterator 
     416            it = this->enabledFiles.begin(), end = this->enabledFiles.end(); 
     417          
     418     for (; it != end; it++) 
     419     { 
     420       info(30)<<"Closing File : "<<(*it)->getId()<<endl; 
     421       (*it)->close(); 
     422     } 
     423   } 
     424    
     425   bool CContext::dispatchEvent(CEventServer& event) 
     426   { 
     427       
     428      if (SuperClass::dispatchEvent(event)) return true ; 
     429      else 
     430      { 
     431        switch(event.type) 
     432        { 
     433           case EVENT_ID_CLOSE_DEFINITION : 
     434             recvCloseDefinition(event) ; 
     435             return true ; 
     436             break ; 
     437           case EVENT_ID_UPDATE_CALENDAR : 
     438             recvUpdateCalendar(event) ; 
     439             return true ; 
     440             break ; 
     441           case EVENT_ID_CREATE_FILE_HEADER : 
     442             recvCreateFileHeader(event) ; 
     443             return true ; 
     444             break ; 
     445           default : 
     446             ERROR("bool CContext::dispatchEvent(CEventServer& event)", 
     447                    <<"Unknown Event") ; 
     448           return false ; 
     449         } 
     450      } 
     451   } 
     452    
     453   void CContext::sendCloseDefinition(void) 
     454   { 
     455 
     456     CEventClient event(getType(),EVENT_ID_CLOSE_DEFINITION) ;    
     457     if (client->isServerLeader()) 
     458     { 
     459       CMessage msg ; 
     460       msg<<this->getId() ; 
     461       event.push(client->getServerLeader(),1,msg) ; 
     462       client->sendEvent(event) ; 
     463     } 
     464     else client->sendEvent(event) ; 
     465   } 
     466    
     467   void CContext::recvCloseDefinition(CEventServer& event) 
     468   { 
     469       
     470      CBufferIn* buffer=event.subEvents.begin()->buffer; 
     471      string id; 
     472      *buffer>>id ; 
     473      get(id)->closeDefinition() ; 
     474   } 
     475    
     476   void CContext::sendUpdateCalendar(int step) 
     477   { 
     478     if (!hasServer) 
     479     { 
     480       CEventClient event(getType(),EVENT_ID_UPDATE_CALENDAR) ;    
     481       if (client->isServerLeader()) 
     482       { 
     483         CMessage msg ; 
     484         msg<<this->getId()<<step ; 
     485         event.push(client->getServerLeader(),1,msg) ; 
     486         client->sendEvent(event) ; 
     487       } 
     488       else client->sendEvent(event) ; 
     489     } 
     490   } 
     491    
     492   void CContext::recvUpdateCalendar(CEventServer& event) 
     493   { 
     494       
     495      CBufferIn* buffer=event.subEvents.begin()->buffer; 
     496      string id; 
     497      *buffer>>id ; 
     498      get(id)->recvUpdateCalendar(*buffer) ; 
     499   } 
     500    
     501   void CContext::recvUpdateCalendar(CBufferIn& buffer) 
     502   { 
     503      int step ; 
     504      buffer>>step ; 
     505      updateCalendar(step) ; 
     506   } 
     507    
     508   void CContext::sendCreateFileHeader(void) 
     509   { 
     510 
     511     CEventClient event(getType(),EVENT_ID_CREATE_FILE_HEADER) ;    
     512     if (client->isServerLeader()) 
     513     { 
     514       CMessage msg ; 
     515       msg<<this->getId() ; 
     516       event.push(client->getServerLeader(),1,msg) ; 
     517       client->sendEvent(event) ; 
     518     } 
     519     else client->sendEvent(event) ; 
     520   } 
     521    
     522   void CContext::recvCreateFileHeader(CEventServer& event) 
     523   { 
     524       
     525      CBufferIn* buffer=event.subEvents.begin()->buffer; 
     526      string id; 
     527      *buffer>>id ; 
     528      get(id)->recvCreateFileHeader(*buffer) ; 
     529   } 
     530    
     531   void CContext::recvCreateFileHeader(CBufferIn& buffer) 
     532   { 
     533      createFileHeader() ; 
     534   } 
     535    
     536   void CContext::updateCalendar(int step) 
     537   { 
     538      calendar->update(step) ; 
     539   } 
     540  
     541   void CContext::createFileHeader(void ) 
     542   { 
     543      vector<shared_ptr<CFile> >::const_iterator it ; 
     544          
     545      for (it=enabledFiles.begin(); it != enabledFiles.end(); it++) 
     546      { 
     547/*         shared_ptr<CFile> file = *it; 
     548         StdString filename = (!file->name.isEmpty()) ?   file->name.getValue() : file->getId(); 
     549         StdOStringStream oss; 
     550         if (! output_dir.isEmpty()) oss << output_dir.getValue(); 
     551         oss << filename; 
     552         if (!file->name_suffix.isEmpty()) oss << file->name_suffix.getValue(); 
     553 
     554         bool multifile=true ; 
     555         if (!file->type.isEmpty()) 
     556         { 
     557           StdString str=file->type.getValue() ;  
     558           if (str.compare("one_file")==0) multifile=false ; 
     559           else if (str.compare("multi_file")==0) multifile=true ; 
     560           else ERROR("void Context::createDataOutput(void)", 
     561                      "incorrect file <type> attribut : must be <multi_file> or <one_file>, " 
     562                      <<"having : <"<<str<<">") ; 
     563         }  
     564         if (multifile)  
     565         { 
     566            if (server->intraCommSize > 1) oss << "_" << server->intraCommRank; 
     567         } 
     568         oss << ".nc"; 
     569 
     570         shared_ptr<io::CDataOutput> dout(new T(oss.str(), false,server->intraComm,multifile)); 
     571*/ 
     572         (*it)->createHeader(); 
     573      } 
     574   }  
     575    
     576   shared_ptr<CContext> CContext::current(void) 
     577   { 
     578     return CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId()) ; 
     579   } 
     580    
    302581} // namespace tree 
    303582} // namespace xmlioserver 
  • XMLIO_V2/dev/common/src/node/context.hpp

    r219 r300  
    88 
    99#include "declare_group.hpp" 
     10//#include "context_client.hpp" 
     11//#include "context_server.hpp" 
     12#include "data_output.hpp" 
     13 
     14#include <mpi.h> 
    1015 
    1116namespace xmlioserver { 
     
    1621 
    1722namespace xmlioserver { 
     23   class CContextClient ; 
     24   class CContextServer ; 
     25    
    1826namespace tree { 
    1927    
     
    2230   class CContextAttributes; 
    2331   class CContext; 
    24  
     32   
    2533   ///-------------------------------------------------------------- 
    2634 
     
    3644      , public CContextAttributes 
    3745   { 
     46         public : 
     47         enum EEventId 
     48         { 
     49           EVENT_ID_CLOSE_DEFINITION,EVENT_ID_UPDATE_CALENDAR, 
     50           EVENT_ID_CREATE_FILE_HEADER,EVENT_ID_CONTEXT_FINALIZE 
     51         } ; 
     52          
    3853         /// typedef /// 
    3954         typedef CObjectTemplate<CContext>   SuperClass; 
     
    90105         /// Test /// 
    91106         virtual bool hasChild(void) const; 
     107 
     108         bool eventLoop(void) ; 
     109         bool serverLoop(void) ; 
     110         void clientLoop(void) ; 
     111         void initServer(MPI_Comm intraComm, MPI_Comm interComm) ; 
     112         void initClient(MPI_Comm intraComm, MPI_Comm interComm) ; 
     113         CContextServer* server ; 
     114         CContextClient* client ; 
     115         bool hasClient ; 
     116         bool hasServer ; 
     117         void finalize(void) ; 
     118         void closeDefinition(void) ; 
     119         void findAllEnabledFields(void); 
     120         void solveAllGridRef(void); 
     121         void solveAllOperation(void); 
     122         void solveAllInheritance(void) ; 
     123         void findEnabledFiles(void); 
     124         void closeAllFile(void) ; 
     125         void updateCalendar(int step) ; 
     126         void createFileHeader(void ) ; 
     127      // dispatch event 
     128         static bool dispatchEvent(CEventServer& event) ; 
     129         void sendCloseDefinition(void) ; 
     130         void sendUpdateCalendar(int step) ; 
     131         void sendCreateFileHeader(void) ; 
     132         static void recvUpdateCalendar(CEventServer& event) ; 
     133         void recvUpdateCalendar(CBufferIn& buffer) ; 
     134         static void recvCloseDefinition(CEventServer& event) ; 
     135         static void recvCreateFileHeader(CEventServer& event) ; 
     136         void recvCreateFileHeader(CBufferIn& buffer) ; 
     137         static shared_ptr<CContext> current(void) ; 
    92138          
    93139      public : 
     
    100146         virtual void fromBinary(StdIStream & is); 
    101147          
    102       private : 
     148      public : 
    103149       
    104150         boost::shared_ptr<date::CCalendar>      calendar; 
    105151         boost::shared_ptr<data::CDataTreatment> datat; 
     152  
     153         std::vector<boost::shared_ptr<CFile> > enabledFiles; 
     154 
    106155 
    107156   }; // class CContext 
  • XMLIO_V2/dev/common/src/node/domain.cpp

    r286 r300  
    88 
    99#include "tree_manager.hpp" 
    10  
    11 #include <algorithm> 
     10#include "xmlioserver_spl.hpp" 
     11#include "event_client.hpp" 
     12#include "event_server.hpp" 
     13#include "buffer_in.hpp" 
    1214 
    1315namespace xmlioserver { 
     
    2123      , ibegin_sub(), iend_sub(), jbegin_sub(), jend_sub() 
    2224      , ibegin_zoom_sub(), jbegin_zoom_sub(), ni_zoom_sub(), nj_zoom_sub() 
    23       , lonvalue_sub(), latvalue_sub() 
     25      , lonvalue_sub(), latvalue_sub(),lonvalue_srv(new CArray<double,1>()) 
     26      , latvalue_srv(new CArray<double,1>()) 
    2427   { /* Ne rien faire de plus */ } 
    2528 
     
    2932      , ibegin_sub(), iend_sub(), jbegin_sub(), jend_sub() 
    3033      , ibegin_zoom_sub(), jbegin_zoom_sub(),ni_zoom_sub(), nj_zoom_sub() 
    31       , lonvalue_sub(), latvalue_sub() 
     34      , lonvalue_sub(), latvalue_sub(),lonvalue_srv(new CArray<double,1>()) 
     35      , latvalue_srv(new CArray<double,1>()) 
    3236   { /* Ne rien faire de plus */ } 
    3337 
     
    6165   bool CDomain::isEmpty(void) const 
    6266   { 
    63       return ((this->zoom_ni_loc.getValue() == 0) ||  
    64               (this->zoom_nj_loc.getValue() == 0)); 
     67      return ((this->zoom_ni_srv == 0) ||  
     68              (this->zoom_nj_srv == 0)); 
    6569   } 
    6670 
     
    258262      } 
    259263       
    260       //~ std::cout << "-------------------" << std::endl 
    261                 //~ << "zoom : " << std::boolalpha << this->hasZoom() << std::endl 
    262                 //~ << "size : " << ni.getValue()  << " X " << nj.getValue()   << std::endl 
    263                 //~ << "it : " << ibegin.getValue() << ", " << iend.getValue() << std::endl 
    264                 //~ << "jt : " << jbegin.getValue() << ", " << jend.getValue() << std::endl 
    265                 //~ << "im : " << ibegin_mask << ", " << iend_mask << std::endl 
    266                 //~ << "jm : " << jbegin_mask << ", " << jend_mask << std::endl 
    267                 //~ << "-------------------" << std::endl; 
    268264 
    269265      if (!mask.isEmpty()) 
     
    498494                jbegin_zoom_srv = zoom_jbegin_loc.getValue(); 
    499495                       
    500       /*std::cout << "Rang du serveur :" << comm::CMPIManager::GetCommRank()   << std::endl 
    501                 << "Begin serv : "     << ibegin_serv << ", " << jbegin_serv <<  std::endl 
    502                 << "End serv : "       << iend_serv   << ", " << jend_serv   <<  std::endl 
    503                 << "Zoom_loc begin : " << zoom_ibegin_loc << ", " << zoom_jbegin_loc <<  std::endl 
    504                 << "Zoom_loc size : "  << zoom_ni_loc << ", " << zoom_nj_loc <<  std::endl;*/ 
    505496                        
    506497      if (this->data_dim.getValue() == 2) 
     
    647638   { 
    648639      if (this->isChecked) return; 
     640      shared_ptr<CContext> context=CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId()) ; 
    649641 
    650642      this->checkGlobalDomain(); 
     
    653645       
    654646      this->checkZoom(); 
    655  
    656       if (this->latvalue_sub.size() == 0) 
     647       
     648      if (context->hasClient) 
    657649      { // CÃŽté client uniquement 
    658650         this->checkMask(); 
     
    678670            this->completeLonLatClient(); 
    679671//         } 
     672         this->completeMask(); 
     673 
    680674      } 
    681675      else 
    682676      { // CÃŽté serveur uniquement 
    683677//         if (!this->isEmpty()) 
    684             this->completeLonLatServer(); 
    685       } 
    686       this->completeMask(); 
    687  
     678// ne sert plus //   this->completeLonLatServer(); 
     679      } 
     680     
     681      if (context->hasClient) 
     682      { 
     683        computeConnectedServer() ; 
     684        sendServerAttribut() ; 
     685        sendLonLat() ; 
     686      } 
     687       
    688688      this->isChecked = true; 
    689689   } 
    690690    
     691  void CDomain::sendServerAttribut(void) 
     692  { 
     693    int ni_srv=ni_glo.getValue() ; 
     694    int ibegin_srv=1 ; 
     695    int iend_srv=ni_glo.getValue() ; 
     696      
     697    int nj_srv ; 
     698    int jbegin_srv ; 
     699    int jend_srv ; 
     700     
     701    shared_ptr<CContext> context=CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId()) ; 
     702    CContextClient* client=context->client ; 
     703    int nbServer=client->serverSize ; 
     704    int serverRank=client->getServerLeader() ; 
     705     
     706    jend_srv=0 ; 
     707    for(int i=0;i<=serverRank;i++) 
     708    { 
     709      jbegin_srv=jend_srv+1 ; 
     710      nj_srv=nj_glo.getValue()/nbServer ; 
     711      if (i<nj_glo.getValue()%nbServer) nj_srv++ ; 
     712      jend_srv=jbegin_srv+nj_srv-1 ; 
     713    } 
     714     
     715     CEventClient event(getType(),EVENT_ID_SERVER_ATTRIBUT) ;    
     716     if (client->isServerLeader()) 
     717     { 
     718       CMessage msg ; 
     719       msg<<this->getId() ; 
     720       msg<<ni_srv<<ibegin_srv<<iend_srv<<nj_srv<<jbegin_srv<<jend_srv; 
     721       event.push(client->getServerLeader(),1,msg) ; 
     722       client->sendEvent(event) ; 
     723     } 
     724     else client->sendEvent(event) ; 
     725  } 
     726   
     727  void CDomain::computeConnectedServer(void) 
     728  { 
     729    int ib,ie,in; 
     730    int jb,je,jn ; 
     731     
     732    int ni_srv=ni_glo.getValue() ; 
     733    int ibegin_srv=1 ; 
     734    int iend_srv=ni_glo.getValue() ; 
     735      
     736    int nj_serv,jbegin_srv, jend_srv ; 
     737    int zoom_ibegin_srv,zoom_iend_srv,zoom_ni_srv ; 
     738    int zoom_jbegin_srv,zoom_jend_srv,zoom_nj_srv ; 
     739     
     740    ibegin_client=ibegin.getValue() ; iend_client=iend.getValue() ; ni_client=ni.getValue() ; 
     741    jbegin_client=jbegin.getValue() ; jend_client=jend.getValue() ; nj_client=nj.getValue() ; 
     742      
     743    shared_ptr<CContext> context=CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId()) ; 
     744    CContextClient* client=context->client ; 
     745    int nbServer=client->serverSize ; 
     746     
     747    // compute client zoom indices 
     748    int zoom_iend=zoom_ibegin.getValue()+zoom_ni.getValue()-1 ; 
     749    zoom_ibegin_client = ibegin_client > zoom_ibegin.getValue() ? ibegin_client : zoom_ibegin.getValue() ; 
     750    zoom_iend_client = iend_client < zoom_iend ? iend_client : zoom_iend ; 
     751    zoom_ni_client=zoom_iend_client-zoom_ibegin_client+1 ; 
     752    if (zoom_ni_client<0) zoom_ni_client=0 ; 
     753 
     754    int zoom_jend=zoom_jbegin.getValue()+zoom_nj.getValue()-1 ; 
     755    zoom_jbegin_client = jbegin_client > zoom_jbegin.getValue() ? jbegin_client : zoom_jbegin.getValue() ; 
     756    zoom_jend_client = jend_client < zoom_jend ? jend_client : zoom_jend ; 
     757    zoom_nj_client=zoom_jend_client-zoom_jbegin_client+1 ; 
     758    if (zoom_nj_client<0) zoom_nj_client=0 ; 
     759  
     760    // find how much client are connected to a server 
     761    jend_srv=0 ; 
     762    for(int ns=0;ns<nbServer;ns++) 
     763    { 
     764      jbegin_srv=jend_srv+1 ; 
     765      nj_srv=nj_glo.getValue()/nbServer ; 
     766      if (ns<nj_glo.getValue()%nbServer) nj_srv++ ; 
     767      jend_srv=jbegin_srv+nj_srv-1 ; 
     768       
     769      ib = ibegin_client>ibegin_srv ? ibegin_client : ibegin_srv ; 
     770      ie=  iend_client< iend_srv? iend_client : iend_srv ; 
     771      in=ie-ib+1 ; 
     772      if (in<0) in=0 ; 
     773       
     774      jb= jbegin_client>jbegin_srv ? jbegin_client : jbegin_srv ; 
     775      je= jend_client<jend_srv ? jend_client : jend_srv ; 
     776      jn=je-jb+1 ; 
     777      if (jn<0) jn=0 ; 
     778         
     779      if (in>0 && jn>0) 
     780      { 
     781        zoom_ibegin_srv = zoom_ibegin.getValue() > ibegin_srv ? zoom_ibegin.getValue() : ibegin_srv ; 
     782        zoom_iend_srv = zoom_iend < iend_srv ? zoom_iend : iend_srv ; 
     783        zoom_ni_srv=zoom_iend_srv-zoom_ibegin_srv+1 ; 
     784        if (zoom_ni_srv<0) zoom_ni_srv=0 ; 
     785       
     786        zoom_jbegin_srv = zoom_jbegin.getValue() > jbegin_srv ? zoom_jbegin.getValue() : jbegin_srv ; 
     787        zoom_jend_srv = zoom_jend < jend_srv ? zoom_jend : jend_srv ; 
     788        zoom_nj_srv=zoom_jend_srv-zoom_jbegin_srv+1 ; 
     789        if (zoom_nj_srv<0) zoom_nj_srv=0 ; 
     790  
     791        if (zoom_ni_srv>0 && zoom_nj_srv>0 && zoom_ni_client>0 && zoom_nj_client>0) 
     792        { 
     793          ib = zoom_ibegin_client>zoom_ibegin_srv ? zoom_ibegin_client : zoom_ibegin_srv ; 
     794          ie=zoom_iend_client<zoom_iend_srv?zoom_iend_client:zoom_iend_srv ; 
     795          in=ie-ib+1 ; 
     796          if (in<0) in=0 ; 
     797         
     798          jb=zoom_jbegin_client>zoom_jbegin_srv?zoom_jbegin_client:zoom_jbegin_srv ; 
     799          je=zoom_jend_client<zoom_jend_srv?zoom_jend_client:zoom_jend_srv ; 
     800          jn=je-jb+1 ; 
     801          if (jn<0) jn=0 ; 
     802        } 
     803        else 
     804        { 
     805          ib=1 ; ie=0 ; in=0 ; 
     806          jb=1 ; je=0 ; jn=0 ; 
     807        } 
     808         
     809//          if (in>0 && jn>0)  
     810//          {  
     811            connectedServer.push_back(ns) ; 
     812            ib_srv.push_back(ib) ; 
     813            ie_srv.push_back(ie) ; 
     814            in_srv.push_back(in) ; 
     815            jb_srv.push_back(jb) ; 
     816            je_srv.push_back(je) ; 
     817            jn_srv.push_back(jn) ; 
     818//           } 
     819         
     820      } 
     821    } 
     822    int nbConnectedServer=connectedServer.size() ; 
     823    int* recvCount=new int[client->clientSize] ; 
     824    int* displ=new int[client->clientSize] ; 
     825    int* sendBuff=new int[nbConnectedServer] ; 
     826    valarray<int> nbClient(0,client->serverSize) ; 
     827     
     828    for(int n=0;n<nbConnectedServer;n++) sendBuff[n]=connectedServer[n] ; 
     829     
     830    // get connected server for everybody 
     831    MPI_Allgather(&nbConnectedServer,1,MPI_INT,recvCount,1,MPI_INT,client->intraComm) ; 
     832     
     833    displ[0]=0 ; 
     834    for(int n=1;n<client->clientSize;n++) displ[n]=displ[n-1]+recvCount[n-1] ; 
     835    int recvSize=displ[client->clientSize-1]+recvCount[client->clientSize-1] ; 
     836    int* recvBuff=new int[recvSize] ; 
     837  
     838     
     839    MPI_Allgatherv(sendBuff,nbConnectedServer,MPI_INT,recvBuff,recvCount,displ,MPI_INT,client->intraComm) ; 
     840    for(int n=0;n<recvSize;n++) nbClient[recvBuff[n]]++ ; 
     841     
     842    for(int n=0;n<nbConnectedServer;n++) nbSenders.push_back(nbClient[connectedServer[n]]) ; 
     843    
     844    delete [] recvCount ; 
     845    delete [] displ ; 
     846    delete [] sendBuff ; 
     847    delete [] recvBuff ; 
     848  } 
     849   
     850  void CDomain::sendLonLat(void) 
     851  { 
     852    shared_ptr<CContext> context=CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId()) ; 
     853    CContextClient* client=context->client ; 
     854    // send lon lat for each connected server 
     855    CEventClient event(getType(),EVENT_ID_LON_LAT) ; 
     856     
     857    ARRAY(double, 1) lonvalue_client = lonvalue.getValue(), 
     858                     latvalue_client = latvalue.getValue(); 
     859     
     860    int ib,ie,in ; 
     861    int jb,je,jn ; 
     862   
     863    list<shared_ptr<CMessage> > list_msg ;     
     864    list<ARRAY(double,1)> list_indi,list_indj,list_lon,list_lat ; 
     865 
     866    for(int ns=0;ns<connectedServer.size();ns++) 
     867    { 
     868      ib=ib_srv[ns] ; ie=ie_srv[ns] ; in=in_srv[ns] ; 
     869      jb=jb_srv[ns] ; je=je_srv[ns] ; jn=jn_srv[ns] ; 
     870       
     871      ARRAY_CREATE(indi,double,1,[in*jn]) ; 
     872      ARRAY_CREATE(indj,double,1,[in*jn]) ; 
     873      ARRAY_CREATE(lon,double,1,[in*jn]) ; 
     874      ARRAY_CREATE(lat,double,1,[in*jn]) ; 
     875 
     876           
     877      int ind_client,ind_loc ; 
     878       
     879      for(int j=jb;j<=je;j++) 
     880        for(int i=ib;i<=ie;i++) 
     881        { 
     882          ind_client=(i-zoom_ibegin_client)+(j-zoom_jbegin_client)*zoom_ni_client ; 
     883          ind_loc=(i-ib)+(j-jb)*in ; 
     884          (*lon)[ind_loc]=(*lonvalue_client)[ind_client] ; 
     885          (*lat)[ind_loc]=(*latvalue_client)[ind_client] ; 
     886          (*indi)[ind_loc]=i ; 
     887          (*indj)[ind_loc]=j ; 
     888        } 
     889       
     890      list_indi.push_back(indi) ; list_indj.push_back(indj) ; 
     891      list_lon.push_back(lon) ; list_lat.push_back(lat) ; 
     892      list_msg.push_back(shared_ptr<CMessage>(new CMessage)) ; 
     893 
     894      *list_msg.back()<<this->getId() ; 
     895      *list_msg.back()<<list_indi.back()<<list_indj.back()<<list_lon.back()<<list_lat.back() ; 
     896      event.push(connectedServer[ns],nbSenders[ns],*list_msg.back()) ; 
     897    } 
     898 
     899    client->sendEvent(event) ; 
     900  } 
     901   
     902  bool CDomain::dispatchEvent(CEventServer& event) 
     903   { 
     904       
     905      if (SuperClass::dispatchEvent(event)) return true ; 
     906      else 
     907      { 
     908        switch(event.type) 
     909        { 
     910           case EVENT_ID_SERVER_ATTRIBUT : 
     911             recvServerAttribut(event) ; 
     912             return true ; 
     913             break ; 
     914           case EVENT_ID_LON_LAT : 
     915             recvLonLat(event) ; 
     916             return true ; 
     917             break ; 
     918           default : 
     919             ERROR("bool CContext::dispatchEvent(CEventServer& event)", 
     920                    <<"Unknown Event") ; 
     921           return false ; 
     922         } 
     923      } 
     924   } 
     925    
     926  void CDomain::recvServerAttribut(CEventServer& event) 
     927  { 
     928    CBufferIn* buffer=event.subEvents.begin()->buffer; 
     929    string domainId ; 
     930    *buffer>>domainId ; 
     931    get(domainId)->recvServerAttribut(*buffer) ; 
     932  } 
     933   
     934  void CDomain::recvServerAttribut(CBufferIn& buffer) 
     935  { 
     936    int zoom_iend=zoom_ibegin.getValue()+zoom_ni.getValue()-1 ; 
     937    int zoom_jend=zoom_jbegin.getValue()+zoom_nj.getValue()-1 ; 
     938 
     939     buffer>>ni_srv>>ibegin_srv>>iend_srv>>nj_srv>>jbegin_srv>>jend_srv; 
     940     
     941    zoom_ibegin_srv = zoom_ibegin.getValue() > ibegin_srv ? zoom_ibegin.getValue() : ibegin_srv ; 
     942    zoom_iend_srv = zoom_iend < iend_srv ? zoom_iend : iend_srv ; 
     943    zoom_ni_srv=zoom_iend_srv-zoom_ibegin_srv+1 ; 
     944       
     945    zoom_jbegin_srv = zoom_jbegin.getValue() > jbegin_srv ? zoom_jbegin.getValue() : jbegin_srv ; 
     946    zoom_jend_srv = zoom_jend < jend_srv ? zoom_jend : jend_srv ; 
     947    zoom_nj_srv=zoom_jend_srv-zoom_jbegin_srv+1 ; 
     948 
     949    if (zoom_ni_srv<=0 || zoom_nj_srv<=0)  
     950    { 
     951      zoom_ibegin_srv=1 ; zoom_iend_srv=0 ; zoom_ni_srv=0 ; 
     952      zoom_jbegin_srv=1 ; zoom_jend_srv=0 ; zoom_nj_srv=0 ; 
     953    } 
     954     
     955    lonvalue_srv->resize(extents[zoom_ni_srv*zoom_nj_srv]) ; 
     956    latvalue_srv->resize(extents[zoom_ni_srv*zoom_nj_srv]) ; 
     957  } 
     958     
     959  void CDomain::recvLonLat(CEventServer& event) 
     960  { 
     961    list<CEventServer::SSubEvent>::iterator it ; 
     962    for (it=event.subEvents.begin();it!=event.subEvents.end();++it) 
     963    { 
     964      CBufferIn* buffer=it->buffer; 
     965      string domainId ; 
     966      *buffer>>domainId ; 
     967      get(domainId)->recvLonLat(*buffer) ; 
     968    } 
     969  } 
     970   
     971  void CDomain::recvLonLat(CBufferIn& buffer) 
     972  { 
     973    ARRAY_CREATE(indi,double,1,[0]) ; 
     974    ARRAY_CREATE(indj,double,1,[0]) ; 
     975    ARRAY_CREATE(lon,double,1,[0]) ; 
     976    ARRAY_CREATE(lat,double,1,[0]) ; 
     977     
     978    buffer>>indi>>indj>>lon>>lat ; 
     979    int i,j,ind_srv ; 
     980 
     981    for(int ind=0;ind<indi->num_elements();ind++) 
     982    { 
     983      i=(*indi)[ind] ; j=(*indj)[ind] ; 
     984      ind_srv=(i-zoom_ibegin_srv)+(j-zoom_jbegin_srv)*zoom_ni_srv ; 
     985      (*lonvalue_srv)[ind_srv]=(*lon)[ind] ; 
     986      (*latvalue_srv)[ind_srv]=(*lat)[ind] ; 
     987    } 
     988  } 
    691989   //---------------------------------------------------------------- 
    692990    
  • XMLIO_V2/dev/common/src/node/domain.hpp

    r286 r300  
    77 
    88#include "declare_group.hpp" 
     9#include "event_client.hpp" 
     10#include "event_server.hpp" 
     11#include "buffer_in.hpp" 
    912 
    1013namespace xmlioserver { 
     
    3033      , public CDomainAttributes 
    3134   { 
     35         enum EEventId 
     36         { 
     37           EVENT_ID_SERVER_ATTRIBUT, EVENT_ID_LON_LAT 
     38         } ; 
     39          
    3240         /// typedef /// 
    3341         typedef CObjectTemplate<CDomain>   SuperClass; 
     
    9199         bool isEmpty(void) const; 
    92100          
     101          
     102         int ni_client,ibegin_client,iend_client ; 
     103         int zoom_ni_client,zoom_ibegin_client,zoom_iend_client ; 
     104 
     105         int nj_client,jbegin_client,jend_client ; 
     106         int zoom_nj_client,zoom_jbegin_client,zoom_jend_client ; 
     107 
     108         int ni_srv,ibegin_srv,iend_srv ; 
     109         int zoom_ni_srv,zoom_ibegin_srv,zoom_iend_srv ; 
     110 
     111         int nj_srv,jbegin_srv,jend_srv ; 
     112         int zoom_nj_srv,zoom_jbegin_srv,zoom_jend_srv ; 
     113 
     114         ARRAY(double, 1) lonvalue_srv, latvalue_srv ; 
     115          
     116          
     117        vector<int> connectedServer,nbSenders ; 
     118        vector<int> ib_srv, ie_srv, in_srv ; 
     119        vector<int> jb_srv, je_srv, jn_srv ; 
     120          
    93121      public : 
    94122       
     
    97125         void completeLonLatServer(void); 
    98126         void completeLonLatClient(void); 
     127         void sendServerAttribut(void) ; 
     128         void sendLonLat(void) ; 
     129         void computeConnectedServer(void) ; 
     130         static bool dispatchEvent(CEventServer& event) ; 
     131         static void recvLonLat(CEventServer& event) ; 
     132         static void recvServerAttribut(CEventServer& event) ; 
     133         void recvLonLat(CBufferIn& buffer) ; 
     134         void recvServerAttribut(CBufferIn& buffer) ; 
    99135          
    100136         /// Destructeur /// 
     
    117153         std::vector<int> ibegin_zoom_sub, jbegin_zoom_sub, ni_zoom_sub, nj_zoom_sub; 
    118154         std::vector<ARRAY(double, 1)> lonvalue_sub, latvalue_sub; 
     155          
    119156 
    120157   }; // class CDomain 
  • XMLIO_V2/dev/common/src/node/field.cpp

    r286 r300  
    7373      return (false); 
    7474   } 
    75  
     75    
     76   bool CField::dispatchEvent(CEventServer& event) 
     77  { 
     78      
     79    if (SuperClass::dispatchEvent(event)) return true ; 
     80    else 
     81    { 
     82      switch(event.type) 
     83      { 
     84        case EVENT_ID_UPDATE_DATA : 
     85          recvUpdateData(event) ; 
     86          return true ; 
     87          break ; 
     88  
     89        default : 
     90          ERROR("bool CField::dispatchEvent(CEventServer& event)",<<"Unknown Event") ; 
     91          return false ; 
     92      } 
     93    } 
     94  } 
     95   
     96  void CField::sendUpdateData(void) 
     97  { 
     98    shared_ptr<CContext> context=CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId()) ; 
     99    CContextClient* client=context->client ; 
     100     
     101    CEventClient event(getType(),EVENT_ID_UPDATE_DATA) ; 
     102     
     103    map<int,ARRAY(int, 1)>::iterator it ; 
     104    list<shared_ptr<CMessage> > list_msg ; 
     105    list<ARRAY(double,1) > list_data ; 
     106     
     107    for(it=grid->storeIndex_toSrv.begin();it!=grid->storeIndex_toSrv.end();it++) 
     108    { 
     109      int rank=(*it).first ; 
     110      ARRAY(int,1) index=(*it).second ; 
     111      ARRAY_CREATE(data_tmp,double,1,[index->num_elements()]) ; 
     112      for(int n=0;n<data_tmp->num_elements();n++) (*data_tmp)[n]=(*data)[(*index)[n]] ; 
     113      list_msg.push_back(shared_ptr<CMessage>(new CMessage)) ; 
     114      list_data.push_back(data_tmp) ; 
     115      *list_msg.back()<<getId()<<list_data.back() ; 
     116      event.push(rank,grid->nbSenders[rank],*list_msg.back()) ; 
     117    } 
     118    client->sendEvent(event) ; 
     119  } 
     120   
     121  void CField::recvUpdateData(CEventServer& event) 
     122  { 
     123    vector<int> ranks ; 
     124    vector<CBufferIn*> buffers ; 
     125       
     126    list<CEventServer::SSubEvent>::iterator it ; 
     127    string fieldId ; 
     128 
     129    for (it=event.subEvents.begin();it!=event.subEvents.end();++it) 
     130    { 
     131      int rank=it->rank; 
     132      CBufferIn* buffer=it->buffer; 
     133      *buffer>>fieldId ; 
     134      ranks.push_back(rank) ; 
     135      buffers.push_back(buffer) ; 
     136    } 
     137    get(fieldId)->recvUpdateData(ranks,buffers) ;    
     138  } 
     139   
     140  void  CField::recvUpdateData(vector<int>& ranks, vector<CBufferIn*>& buffers) 
     141  { 
     142     
     143    if (data_srv.empty()) 
     144    { 
     145      for(map<int,ARRAY(int, 1)>::iterator it=grid->out_i_fromClient.begin();it!=grid->out_i_fromClient.end();it++) 
     146      { 
     147        int rank=it->first ; 
     148        ARRAY_CREATE(data_tmp,double,1,[it->second->num_elements()]) ; 
     149        data_srv.insert(pair<int, ARRAY(double,1)>(rank,data_tmp)) ; 
     150        foperation_srv.insert(pair<int,boost::shared_ptr<func::CFunctor> >(rank,boost::shared_ptr<func::CFunctor>(new func::CInstant(data_srv[rank])))) ; 
     151      } 
     152    } 
     153 
     154    shared_ptr<CContext> context=CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId()) ; 
     155    const date::CDate & currDate = context->getCalendar()->getCurrentDate(); 
     156    const date::CDate opeDate      = *last_operation_srv + freq_operation_srv; 
     157    const date::CDate writeDate    = *last_Write_srv     + freq_write_srv;  
     158     
     159 
     160     
     161    if (opeDate <= currDate) 
     162    { 
     163      for(int n=0;n<ranks.size();n++) 
     164      { 
     165        ARRAY_CREATE(data_tmp,double,1,[0]) ; 
     166        *buffers[n]>>data_tmp ; 
     167        (*foperation_srv[ranks[n]])(data_tmp) ; 
     168      } 
     169      *last_operation_srv = currDate; 
     170    } 
     171      
     172    if (writeDate < (currDate + freq_operation_srv)) 
     173    { 
     174      for(int n=0;n<ranks.size();n++) 
     175      { 
     176        this->foperation_srv[ranks[n]]->final(); 
     177      } 
     178       
     179      this->incrementNStep(); 
     180      *last_Write_srv = writeDate; 
     181      writeField() ; 
     182    } 
     183  } 
     184   
     185  void CField::writeField(void) 
     186  { 
     187    if (! grid->domain->isEmpty() || getRelFile()->type.getValue()=="one_file")  
     188      getRelFile()->getDataOutput()->writeFieldData(CObjectFactory::GetObject<CField>(this)); 
     189  } 
    76190   //---------------------------------------------------------------- 
    77191 
     
    232346        
    233347      StdString id = this->getBaseFieldReference()->getId(); 
    234       boost::shared_ptr<CContext> _context = 
     348      boost::shared_ptr<CContext> context = 
    235349         CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId()); 
    236350 
     
    252366      }   
    253367 
    254       if (CXIOSManager::GetStatus() == CXIOSManager::LOC_SERVER) 
    255       { 
    256          this->freq_operation = 
     368//      if (CXIOSManager::GetStatus() == CXIOSManager::LOC_SERVER) 
     369      if (context->hasServer) 
     370      { 
     371         this->freq_operation_srv = 
    257372             CDuration::FromString(this->file->output_freq.getValue()); 
    258          this->freq_write     = 
     373         this->freq_write_srv     = 
    259374             CDuration::FromString(this->file->output_freq.getValue()); 
    260          this->last_Write     = boost::shared_ptr<xmlioserver::date::CDate> 
    261                         (new date::CDate(_context->getCalendar()->getInitDate())); 
    262          this->last_operation = boost::shared_ptr<xmlioserver::date::CDate> 
    263                         (new date::CDate(_context->getCalendar()->getInitDate())); 
    264          this->foperation     = 
    265              boost::shared_ptr<func::CFunctor>(new CInstant(this->data)); 
     375         this->last_Write_srv     = boost::shared_ptr<xmlioserver::date::CDate> 
     376                        (new date::CDate(context->getCalendar()->getInitDate())); 
     377         this->last_operation_srv = boost::shared_ptr<xmlioserver::date::CDate> 
     378                        (new date::CDate(context->getCalendar()->getInitDate())); 
     379//         this->foperation_srv     = 
     380//             boost::shared_ptr<func::CFunctor>(new CInstant(this->data_srv)); 
    266381              
    267          const CDuration toffset = this->freq_operation - freq_offset_ - _context->getCalendar()->getTimeStep();  
    268          *this->last_operation   = *this->last_operation - toffset;  
    269       } 
    270       else 
     382         const CDuration toffset = this->freq_operation_srv - freq_offset_ - context->getCalendar()->getTimeStep();  
     383         *this->last_operation_srv   = *this->last_operation_srv - toffset;  
     384      } 
     385       
     386      if (context->hasClient) 
    271387      {                   
    272388         this->freq_operation = CDuration::FromString(freq_op.getValue()); 
    273389         this->freq_write     = CDuration::FromString(this->file->output_freq.getValue()); 
    274390         this->last_Write     = boost::shared_ptr<xmlioserver::date::CDate> 
    275                         (new date::CDate(_context->getCalendar()->getInitDate())); 
     391                        (new date::CDate(context->getCalendar()->getInitDate())); 
    276392         this->last_operation = boost::shared_ptr<xmlioserver::date::CDate> 
    277                         (new date::CDate(_context->getCalendar()->getInitDate())); 
     393                        (new date::CDate(context->getCalendar()->getInitDate())); 
    278394                         
    279          const CDuration toffset = this->freq_operation - freq_offset_ - _context->getCalendar()->getTimeStep();  
     395         const CDuration toffset = this->freq_operation - freq_offset_ - context->getCalendar()->getTimeStep();  
    280396         *this->last_operation   = *this->last_operation - toffset;   
    281397          
     
    409525      } 
    410526   } 
    411  
     527    
     528   void CField::outputField(ARRAY(double,3) fieldOut) 
     529   { 
     530      map<int,ARRAY(double,1)>::iterator it; 
     531      for(it=data_srv.begin();it!=data_srv.end();it++) 
     532         grid->outputField(it->first,it->second, fieldOut) ; 
     533       
     534   } 
     535    
     536   void CField::outputField(ARRAY(double,2) fieldOut) 
     537   { 
     538      map<int,ARRAY(double,1)>::iterator it; 
     539 
     540      for(it=data_srv.begin();it!=data_srv.end();it++) 
     541      { 
     542         grid->outputField(it->first,it->second, fieldOut) ; 
     543      } 
     544   } 
    412545   ///------------------------------------------------------------------- 
    413546 
  • XMLIO_V2/dev/common/src/node/field.hpp

    r286 r300  
    1111#include "declare_group.hpp" 
    1212#include "calendar_util.hpp" 
     13//#include "context.hpp" 
     14 
    1315 
    1416namespace xmlioserver { 
     
    2325   class CFile; 
    2426   class CGrid; 
    25  
     27   class CContext ; 
    2628   ///-------------------------------------------------------------- 
    2729 
     
    4850         typedef CFieldGroup      RelGroup; 
    4951 
     52         enum EEventId 
     53         { 
     54           EVENT_ID_UPDATE_DATA 
     55         } ; 
     56          
    5057         /// Constructeurs /// 
    5158         CField(void); 
     
    8289         void incrementNStep(void); 
    8390 
    84          template <StdSize N> 
    85             inline bool updateData 
    86                (const date::CDate      & currDate, 
    87                 const date::CDuration  & timestep, 
    88                 const ARRAY(double, N)   data); 
    89  
     91         template <StdSize N> bool updateData(const ARRAY(double, N)   data); 
     92          
    9093         bool updateDataServer 
    9194               (const date::CDate & currDate, 
    9295                const std::deque<ARRAY(double, 1)> storedClient); 
    93  
    94       public : 
     96  
     97       public : 
    9598 
    9699         /// Test /// 
     
    112115          
    113116         static ENodeType GetType(void); 
    114  
    115       private : 
     117          
     118        template <StdSize N> void setData(const ARRAY(double, N) _data) ; 
     119        static bool dispatchEvent(CEventServer& event) ; 
     120        void sendUpdateData(void) ; 
     121        static void recvUpdateData(CEventServer& event) ; 
     122        void recvUpdateData(vector<int>& ranks, vector<CBufferIn*>& buffers) ; 
     123        void writeField(void) ; 
     124        void outputField(ARRAY(double,3) fieldOut) ; 
     125        void outputField(ARRAY(double,2) fieldOut) ; 
     126         
     127      public : 
    116128 
    117129         /// Propriétés privées /// 
     
    123135 
    124136         date::CDuration freq_operation, freq_write; 
     137         date::CDuration freq_operation_srv, freq_write_srv; 
    125138 
    126139         StdSize nstep; 
    127140         boost::shared_ptr<date::CDate>    last_Write, last_operation; 
     141         boost::shared_ptr<date::CDate>    last_Write_srv, last_operation_srv; 
     142          
    128143         boost::shared_ptr<func::CFunctor> foperation; 
     144         map<int,boost::shared_ptr<func::CFunctor> > foperation_srv; 
    129145          
    130146         ARRAY(double, 1) data; 
     147         map<int,ARRAY(double,1)> data_srv ; 
    131148 
    132149   }; // class CField 
     
    153170 
    154171   template <StdSize N> 
    155       bool CField::updateData(const date::CDate & currDate, const date::CDuration & timestep, const ARRAY(double, N) _data) 
     172   void CField::setData(const ARRAY(double, N) _data) 
     173   { 
     174     const std::vector<boost::shared_ptr<CField> > & refField=getAllReference(); 
     175     std::vector<boost::shared_ptr<CField> >::const_iterator  it = refField.begin(), end = refField.end(); 
     176      
     177     for (; it != end; it++) (*it)->updateData(_data) ; 
     178    } 
     179     
     180   template <StdSize N> 
     181      bool CField::updateData(const ARRAY(double, N) _data) 
    156182   {         
     183      shared_ptr<CContext> context=CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId()) ; 
     184      const date::CDate & currDate = context->getCalendar()->getCurrentDate(); 
    157185      const date::CDate opeDate      = *last_operation + freq_operation; 
    158186      const date::CDate writeDate    = *last_Write     + freq_write;        
    159187 
    160 //      std::cout << "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" << std::endl; 
    161 //      std::cout << "Champ : "     << this->getBaseFieldId() << std::endl; 
    162 //      std::cout << "CurrDate : "  << currDate  << std::endl; 
    163 //      std::cout << "opeDate : "   << opeDate   << " = " << *last_operation << " + " << freq_operation << std::endl; 
    164 //      std::cout       << "writeDate : " << writeDate << " = " << *last_Write     << " + " << freq_write     << std::endl; 
    165 //      std::cout << "(opeDate <= currDate)   = " << std::boolalpha << (opeDate <= currDate)   << std::endl; 
    166 //      std::cout       << "(writeDate <= currDate) = " << std::boolalpha << (writeDate <= currDate) << std::endl;    
    167188    
    168       std::cout << ">> " << currDate <<  " : Envoi de données " << this->getBaseFieldId() << std::endl; 
    169       std::cout << ">> next operation "  << opeDate<<std::endl; 
     189      info(50) << "CField::updateData " << currDate <<  " : send data to " << this->getBaseFieldId() << std::endl; 
     190      info(50) << "Next operation "  << opeDate<<std::endl; 
     191 
    170192      if (opeDate <= currDate) 
    171193      { 
    172          //std::cout << "> " << currDate << ": Operation du champs" << this->getBaseFieldId() << std::endl; 
    173          if (this->data->num_elements() != this->grid->storeIndex[0]->num_elements()) 
     194         if (this->data->num_elements() != this->grid->storeIndex_client->num_elements()) 
    174195         { 
    175             this->data->resize(boost::extents[this->grid->storeIndex[0] ->num_elements()]); 
     196            this->data->resize(boost::extents[this->grid->storeIndex_client ->num_elements()]); 
    176197         } 
    177198             
     
    181202          
    182203         *last_operation = currDate; 
    183          std::cout << "(*last_operation = currDate) : " << *last_operation << " = " << currDate << std::endl;  
     204         info(50) << "(*last_operation = currDate) : " << *last_operation << " = " << currDate << std::endl;  
    184205      } 
    185206       
     
    187208      { 
    188209         this->foperation->final(); 
    189          this->incrementNStep(); 
    190210         *last_Write = writeDate; 
    191          std::cout << "(*last_Write = currDate) : " << *last_Write << " = " << currDate << std::endl; 
     211         info(50) << "(*last_Write = currDate) : " << *last_Write << " = " << currDate  << std::endl; 
     212         sendUpdateData() ; 
    192213         return (true);         
    193214      } 
    194 //      std::cout << "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" << std::endl; 
     215 
    195216      return (false); 
    196    }; 
     217   } 
    197218 
    198219} // namespace tree 
  • XMLIO_V2/dev/common/src/node/file.cpp

    r286 r300  
    77#include "object_factory.hpp" 
    88#include "object_factory_impl.hpp" 
     9#include "data_output.hpp" 
     10#include "context.hpp" 
     11#include "context_server.hpp" 
     12#include "nc4_data_output.hpp" 
     13 
    914 
    1015namespace xmlioserver { 
     
    1621      : CObjectTemplate<CFile>(), CFileAttributes() 
    1722      , vFieldGroup(), data_out(), enabledFields() 
    18    { /* Ne rien faire de plus */ } 
     23   { setVirtualFieldGroup() ;} 
    1924 
    2025   CFile::CFile(const StdString & id) 
    2126      : CObjectTemplate<CFile>(id), CFileAttributes() 
    2227      , vFieldGroup(), data_out(), enabledFields() 
    23    { /* Ne rien faire de plus */ } 
     28   { setVirtualFieldGroup() ;} 
    2429 
    2530   CFile::~CFile(void) 
     
    6267      this->enabledFields = this->getAllFields(); 
    6368 
    64       std::cout<<"---> File :"<<this->name.getValue()<<std::endl ; 
     69      std::vector<boost::shared_ptr<CField> > newEnabledFields; 
     70       
    6571      for ( it = this->enabledFields.begin() ; it != this->enabledFields.end(); it++ ) 
    6672      { 
    6773         if (!(*it)->enabled.isEmpty()) // Si l'attribut 'enabled' est défini ... 
    6874         { 
    69             if (! (*it)->enabled.getValue()) 
    70             { it--; this->enabledFields.erase(it+1); continue; } 
     75            if (! (*it)->enabled.getValue()) continue; 
     76//            { it--; this->enabledFields.erase(it+1); continue; } 
    7177         } 
    7278         else // Si l'attribut 'enabled' n'est pas défini ... 
    7379         { 
    74             if (!default_enabled) 
    75             { it--; this->enabledFields.erase(it+1); continue; } 
     80            if (!default_enabled) continue ; 
     81//            { it--; this->enabledFields.erase(it+1); continue; } 
    7682         } 
    7783 
    7884         if (!(*it)->level.isEmpty()) // Si l'attribut 'level' est défini ... 
    7985         { 
    80             if ((*it)->level.getValue() > _outputlevel) 
    81             { it--; this->enabledFields.erase(it+1); continue; } 
     86            if ((*it)->level.getValue() > _outputlevel) continue ; 
     87//            { it--; this->enabledFields.erase(it+1); continue; } 
    8288         } 
    8389         else // Si l'attribut 'level' n'est pas défini ... 
    8490         { 
    85             if (default_level > _outputlevel) 
    86             { it--; this->enabledFields.erase(it+1); continue; } 
    87          } 
    88  
     91            if (default_level > _outputlevel) continue ; 
     92//            { it--; this->enabledFields.erase(it+1); continue; } 
     93         } 
     94  
     95//         CField* field_tmp=(*it).get() ; 
     96//         shared_ptr<CField> sptfield=*it ; 
     97//         field_tmp->refObject.push_back(sptfield) ; 
     98         newEnabledFields.push_back(*it) ; 
    8999         // Le champ est finalement actif, on y ajoute sa propre reference. 
    90100         (*it)->refObject.push_back(*it); 
    91101         // Le champ est finalement actif, on y ajoute la référence au champ de base. 
    92          std::cout<<"    Field Enabled : "<<(*it)->getId()<<std::endl ; 
    93102         (*it)->setRelFile(CObjectFactory::GetObject(this)); 
    94103         (*it)->baseRefObject->refObject.push_back(*it); 
    95104         // A faire, ajouter les references intermediaires... 
    96105      } 
     106      enabledFields=newEnabledFields ; 
    97107 
    98108      return (this->enabledFields); 
     
    108118   //---------------------------------------------------------------- 
    109119 
    110    void CFile::setVirtualFieldGroup(const StdString & newVFieldGroupId) 
     120   void CFile::setVirtualFieldGroup(void) 
    111121   { 
    112122      this->setVirtualFieldGroup 
    113          (CObjectFactory::CreateObject<CFieldGroup>(/*newVFieldGroupId*/)); 
    114    } 
    115  
    116    //---------------------------------------------------------------- 
    117  
    118    void CFile::initializeDataOutput(boost::shared_ptr<io::CDataOutput> dout) 
    119    { 
    120       this->data_out = dout; 
    121       this->data_out->writeFile(CObjectFactory::GetObject<CFile>(this)); 
    122        
     123         (CObjectFactory::CreateObject<CFieldGroup>()); 
     124   } 
     125 
     126   //---------------------------------------------------------------- 
     127 
     128   void CFile::createHeader(void) 
     129   { 
     130     
    123131      std::vector<boost::shared_ptr<CField> >::iterator it, end = this->enabledFields.end(); 
    124132 
     133      AllDomainEmpty=true ; 
    125134      for (it = this->enabledFields.begin() ;it != end; it++) 
    126135      { 
    127136         boost::shared_ptr<CField> field = *it; 
    128          this->data_out->writeFieldGrid(field); 
     137         AllDomainEmpty&=field->grid->domain->isEmpty() ; 
    129138      } 
    130           
    131       for (it = this->enabledFields.begin() ;it != end; it++) 
     139       
     140      if (!AllDomainEmpty ||  type.getValue()=="one_file") 
    132141      { 
    133          boost::shared_ptr<CField> field = *it; 
    134          this->data_out->writeField(field); 
     142         StdString filename = (!name.isEmpty()) ?   name.getValue() : getId(); 
     143         StdOStringStream oss; 
     144//         if (! output_dir.isEmpty()) oss << output_dir.getValue(); 
     145         oss << filename; 
     146         if (!name_suffix.isEmpty()) oss << name_suffix.getValue(); 
     147 
     148         bool multifile=true ; 
     149         if (!type.isEmpty()) 
     150         { 
     151           if (type.getValue()=="one_file") multifile=false ; 
     152           else if (type.getValue()=="multi_file") multifile=true ; 
     153           else ERROR("void Context::createDataOutput(void)", 
     154                      "incorrect file <type> attribut : must be <multi_file> or <one_file>, " 
     155                      <<"having : <"<<type.getValue()<<">") ; 
     156         }  
     157          
     158         shared_ptr<CContext> context=CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId()) ; 
     159         CContextServer* server=context->server ; 
     160 
     161         if (multifile)  
     162         { 
     163            if (server->intraCommSize > 1) oss << "_" << server->intraCommRank; 
     164         } 
     165         oss << ".nc"; 
     166 
     167         data_out=shared_ptr<io::CDataOutput>(new io::CNc4DataOutput(oss.str(), false,server->intraComm,multifile)); 
     168 
     169         data_out->writeFile(CObjectFactory::GetObject<CFile>(this)); 
     170         for (it = this->enabledFields.begin() ;it != end; it++) 
     171         { 
     172            boost::shared_ptr<CField> field = *it; 
     173            this->data_out->writeFieldGrid(field); 
     174         } 
     175          
     176         for (it = this->enabledFields.begin() ;it != end; it++) 
     177         { 
     178            boost::shared_ptr<CField> field = *it; 
     179            this->data_out->writeField(field); 
     180         } 
     181          
     182         this->data_out->definition_end(); 
    135183      } 
    136           
    137       this->data_out->definition_end(); 
    138184   } 
    139185 
    140186   void CFile::close(void) 
    141187   { 
    142      this->data_out->closeFile(); 
     188     if (!AllDomainEmpty ||  type.getValue()=="one_file") 
     189       this->data_out->closeFile(); 
    143190   } 
    144191   //---------------------------------------------------------------- 
     
    150197      { // Si la définition du fichier intégre des champs et si le fichier est identifié. 
    151198         node.goToParentElement(); 
    152          this->setVirtualFieldGroup(this->getId()); 
     199//         this->setVirtualFieldGroup(this->getId()); 
    153200         this->getVirtualFieldGroup()->parse(node, false); 
    154201      } 
     
    234281               << "[ renum = " << renum << "] Bad type !"); 
    235282       
    236       this->setVirtualFieldGroup(this->getId()); 
     283//      this->setVirtualFieldGroup(this->getId()); 
    237284      if (hasVFG)this->getVirtualFieldGroup()->fromBinary(is); 
    238285       
    239286   } 
    240  
     287    
     288   shared_ptr<CField> CFile::addField(const string& id) 
     289   { 
     290     return vFieldGroup->createChild(id) ; 
     291   } 
     292 
     293   shared_ptr<CFieldGroup> CFile::addFieldGroup(const string& id) 
     294   { 
     295     return vFieldGroup->createChildGroup(id) ; 
     296   } 
     297    
     298   
     299   void CFile::sendAddField(const string& id) 
     300   { 
     301    shared_ptr<CContext> context=CContext::current() ; 
     302     
     303    if (! context->hasServer ) 
     304    { 
     305       CContextClient* client=context->client ; 
     306 
     307       CEventClient event(this->getType(),EVENT_ID_ADD_FIELD) ;    
     308       if (client->isServerLeader()) 
     309       { 
     310         CMessage msg ; 
     311         msg<<this->getId() ; 
     312         msg<<id ; 
     313         event.push(client->getServerLeader(),1,msg) ; 
     314         client->sendEvent(event) ; 
     315       } 
     316       else client->sendEvent(event) ; 
     317    } 
     318       
     319   } 
     320    
     321   void CFile::sendAddFieldGroup(const string& id) 
     322   { 
     323    shared_ptr<CContext> context=CContext::current() ; 
     324    if (! context->hasServer ) 
     325    { 
     326       CContextClient* client=context->client ; 
     327 
     328       CEventClient event(this->getType(),EVENT_ID_ADD_FIELD_GROUP) ;    
     329       if (client->isServerLeader()) 
     330       { 
     331         CMessage msg ; 
     332         msg<<this->getId() ; 
     333         msg<<id ; 
     334         event.push(client->getServerLeader(),1,msg) ; 
     335         client->sendEvent(event) ; 
     336       } 
     337       else client->sendEvent(event) ; 
     338    } 
     339       
     340   } 
     341    
     342   void CFile::recvAddField(CEventServer& event) 
     343   { 
     344       
     345      CBufferIn* buffer=event.subEvents.begin()->buffer; 
     346      string id; 
     347      *buffer>>id ; 
     348      get(id)->recvAddField(*buffer) ; 
     349   } 
     350    
     351    
     352   void CFile::recvAddField(CBufferIn& buffer) 
     353   { 
     354      string id ; 
     355      buffer>>id ; 
     356      addField(id) ; 
     357   } 
     358 
     359   void CFile::recvAddFieldGroup(CEventServer& event) 
     360   { 
     361       
     362      CBufferIn* buffer=event.subEvents.begin()->buffer; 
     363      string id; 
     364      *buffer>>id ; 
     365      get(id)->recvAddFieldGroup(*buffer) ; 
     366   } 
     367    
     368    
     369   void CFile::recvAddFieldGroup(CBufferIn& buffer) 
     370   { 
     371      string id ; 
     372      buffer>>id ; 
     373      addFieldGroup(id) ; 
     374   } 
     375    
     376 
     377   bool CFile::dispatchEvent(CEventServer& event) 
     378   { 
     379      if (SuperClass::dispatchEvent(event)) return true ; 
     380      else 
     381      { 
     382        switch(event.type) 
     383        { 
     384           case EVENT_ID_ADD_FIELD : 
     385             recvAddField(event) ; 
     386             return true ; 
     387             break ; 
     388          
     389           case EVENT_ID_ADD_FIELD_GROUP : 
     390             recvAddFieldGroup(event) ; 
     391             return true ; 
     392             break ;        
     393          
     394           default : 
     395              ERROR("bool CFile::dispatchEvent(CEventServer& event)", <<"Unknown Event") ; 
     396           return false ; 
     397        } 
     398      } 
     399   } 
     400    
     401    
     402    
     403    
    241404   ///--------------------------------------------------------------- 
    242405 
  • XMLIO_V2/dev/common/src/node/file.hpp

    r286 r300  
    55#include "xmlioserver_spl.hpp" 
    66#include "field.hpp" 
     7#include "data_output.hpp" 
    78#include "declare_group.hpp" 
    89 
    9 #include "data_output.hpp" 
     10 
    1011 
    1112namespace xmlioserver { 
     
    3435         typedef CObjectTemplate<CFile>   SuperClass; 
    3536         typedef CFileAttributes SuperClassAttribute; 
    36  
     37       
    3738      public : 
    38  
     39         enum EEventId 
     40         { 
     41           EVENT_ID_ADD_FIELD=0,EVENT_ID_ADD_FIELD_GROUP 
     42         } ; 
     43          
    3944         typedef CFileAttributes RelAttributes; 
    4045         typedef CFileGroup      RelGroup; 
     
    6065         /// Mutateurs /// 
    6166         void setVirtualFieldGroup(boost::shared_ptr<CFieldGroup> newVFieldGroup); 
    62          void setVirtualFieldGroup(const StdString & newVFieldGroupId); 
     67         void setVirtualFieldGroup(void); 
    6368 
    64          void initializeDataOutput(boost::shared_ptr<io::CDataOutput> dout); 
     69         void createHeader(void); 
    6570         void close(void) ; 
    6671          
     
    8691          
    8792         static ENodeType GetType(void); 
     93          
     94         bool AllDomainEmpty ; 
     95         shared_ptr<CField> addField(const string& id="") ; 
     96         shared_ptr<CFieldGroup> addFieldGroup(const string& id="") ; 
     97         void sendAddField(const string& id="") ; 
     98         void sendAddFieldGroup(const string& id="") ; 
     99         static void recvAddField(CEventServer& event) ; 
     100         void recvAddField(CBufferIn& buffer) ; 
     101         static void recvAddFieldGroup(CEventServer& event) ; 
     102         void recvAddFieldGroup(CBufferIn& buffer) ; 
     103         static bool dispatchEvent(CEventServer& event) ; 
    88104 
    89105      private : 
  • XMLIO_V2/dev/common/src/node/grid.cpp

    r286 r300  
    160160   { 
    161161      if (this->isChecked) return; 
     162      shared_ptr<CContext> context=CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId()) ; 
     163      CContextClient* client=context->client ; 
     164       
    162165      this->solveDomainRef() ; 
    163166      this->solveAxisRef() ; 
    164       if (this->storeIndex.size() == 1) 
     167      if (context->hasClient) 
    165168      { 
    166169          
     
    176179         this->out_l_index.push_front(out_l_index_); 
    177180      } 
    178       this->computeIndexServer(); 
     181//      this->computeIndexServer(); 
    179182      this->isChecked = true; 
    180183   } 
     
    225228                size = (this->hasAxis()) ? axis->size.getValue() : 1 ; 
    226229 
    227       /*std::cout << ni   << " : " 
    228                   << nj   << " : " 
    229                   << size << std::endl;*/ 
    230230 
    231231      const int data_dim     = domain->data_dim.getValue() , 
     
    238238                    data_j_index = domain->data_j_index.getValue() ; 
    239239 
    240       /*std::cout << data_n_index  << " : " 
    241                   << data_i_index  << " : " 
    242                   << data_j_index  << std::endl; */ 
    243240 
    244241      ARRAY(bool, 2) mask = domain->mask.getValue() ; 
     
    265262      } 
    266263       
    267       //std::cout << indexCount  << std::endl; 
    268264      ARRAY_ASSIGN(this->storeIndex[0] , int, 1, [indexCount]); 
    269265      ARRAY_ASSIGN(this->out_l_index[0], int, 1, [indexCount]); 
     
    271267      ARRAY_ASSIGN(this->out_j_index[0], int, 1, [indexCount]); 
    272268       
    273       // for(int count = 0, indexCount = 0,  l = 0; l < size; l++) 
    274       // for(int n = 0, i = 0, j = 0; n < data_n_index; n++, count++) 
    275  
    276       //for(int n = 0, i = 0, j = 0, count = 0, indexCount = 0; n < data_n_index;  n++) 
    277       //for(int l = 0; l < size; l++, count++) 
     269      ARRAY_ASSIGN(storeIndex_client,int,1,[indexCount]); 
     270      ARRAY_ASSIGN(out_i_client,int,1,[indexCount]); 
     271      ARRAY_ASSIGN(out_j_client,int,1,[indexCount]); 
     272      ARRAY_ASSIGN(out_l_client,int,1,[indexCount]); 
     273       
    278274       
    279275      for(int count = 0, indexCount = 0,  l = 0; l < size; l++) 
     
    296292               (*this->out_i_index[0])[indexCount] = i ; 
    297293               (*this->out_j_index[0])[indexCount] = j ; 
     294                
     295               (*storeIndex_client)[indexCount] = count ; 
     296               (*out_i_client)[indexCount]=i+domain->ibegin_client-1 ; 
     297               (*out_j_client)[indexCount]=j+domain->jbegin_client-1 ; 
     298               (*out_l_client)[indexCount]=l ; 
    298299               indexCount++ ; 
    299300            } 
    300301         } 
    301302      } 
    302  
    303  
    304 //      if (this->storeIndex[0]->size() != 0) 
    305 //         for (StdSize u = 0; u < this->storeIndex[0]->size(); u++) 
    306 //            (*local_mask)[(*out_i_index[0])[u]][(*out_j_index[0])[u]] = 1; 
    307                                   
    308 //      std::cout << "indexCount" << indexCount << std::endl;  
    309 //      std::cout << this->getId() << " : "  << (*this->storeIndex[0]).num_elements() << std::endl; 
    310 //      StdOFStream ofs2(("log_client_"+this->getId()).c_str()); 
    311 //      for (StdSize h = 0; h < storeIndex[0]->size(); h++) 
    312 //      { 
    313 //        ofs2 << "(" << (*storeIndex[0])[h]  << ";" 
    314 //             << (*out_i_index[0])[h] << "," 
    315 //             << (*out_j_index[0])[h] << "," 
    316 //             << (*out_l_index[0])[h] << ")" << std::endl; 
    317 //      } 
    318 //      ofs2.close();    
     303      sendIndex() ; 
     304 
     305 
    319306   } 
    320307 
     
    345332   //---------------------------------------------------------------- 
    346333 
    347    template <> 
    348       void CGrid::outputField 
    349          (const ARRAY(double, 1) stored,  ARRAY(double, 3) field) const 
    350    { 
    351       //std::cout <<"champ : " ; 
    352       for(StdSize n = 0; n < storeIndex[0]->num_elements(); n++) 
    353       { 
    354          (*field)[(*out_i_index[0])[n]][(*out_j_index[0])[n]][(*out_l_index[0])[n]] = (*stored)[n] ; 
    355          /*if (storeIndex[0]->num_elements() == 31) 
    356          { 
    357             std::cout << "( " << (*field)[(*out_i_index[0])[n]][(*out_j_index[0])[n]][(*out_l_index[0])[n]] << ", " 
    358                       << (*out_i_index[0])[n] << ", " 
    359                       << (*out_j_index[0])[n] << ", " 
    360                       << (*out_l_index[0])[n] << ")"; 
    361          }*/ 
    362       } 
    363       //std::cout << std::endl; 
    364  
    365    } 
    366  
    367    //--------------------------------------------------------------- 
    368  
    369    template <> 
    370       void CGrid::outputField 
    371          (const ARRAY(double, 1) stored,  ARRAY(double, 2) field) const 
    372    { 
    373       for(StdSize n = 0; n < storeIndex[0]->num_elements(); n++) 
    374          (*field)[(*out_i_index[0])[n]][(*out_j_index[0])[n]] = (*stored)[n] ; 
    375    } 
    376  
    377    //--------------------------------------------------------------- 
    378  
    379    template <> 
    380       void CGrid::outputField 
    381          (const ARRAY(double, 1) stored,  ARRAY(double, 1) field) const 
    382    { 
    383       for(StdSize n = 0; n < storeIndex[0]->num_elements(); n++) 
    384          (*field)[(*out_i_index[0])[n]] = (*stored)[n] ; 
     334   void CGrid::outputField(int rank, const ARRAY(double, 1) stored,  ARRAY(double, 3) field)  
     335   { 
     336      ARRAY(int,1) out_i=out_i_fromClient[rank] ; 
     337      ARRAY(int,1) out_j=out_j_fromClient[rank] ; 
     338      ARRAY(int,1) out_l=out_l_fromClient[rank] ; 
     339       
     340      for(StdSize n = 0; n < stored->num_elements(); n++) 
     341         (*field)[(*out_i)[n]][(*out_j)[n]][(*out_l)[n]] = (*stored)[n] ; 
     342   } 
     343 
     344   void CGrid::outputField(int rank, const ARRAY(double, 1) stored,  ARRAY(double, 2) field)  
     345   { 
     346      ARRAY(int,1) out_i=out_i_fromClient[rank] ; 
     347      ARRAY(int,1) out_j=out_j_fromClient[rank] ; 
     348 
     349       for(StdSize n = 0; n < stored->num_elements(); n++) 
     350         (*field)[(*out_i)[n]][(*out_j)[n]] = (*stored)[n] ; 
     351   } 
     352 
     353   //--------------------------------------------------------------- 
     354 
     355   void CGrid::outputField(int rank,const ARRAY(double, 1) stored,  ARRAY(double, 1) field) 
     356   { 
     357      ARRAY(int,1) out_i = out_i_fromClient[rank] ; 
     358      for(StdSize n = 0; n < stored->num_elements(); n++) 
     359         (*field)[(*out_i)[n]] = (*stored)[n] ; 
    385360   } 
    386361 
    387362   //---------------------------------------------------------------- 
     363   
    388364 
    389365   void CGrid::storeField_arr 
    390366      (const double * const data, ARRAY(double, 1) stored) const 
    391367   { 
    392       const StdSize size = (this->storeIndex[0])->num_elements() ; 
    393 //    std::cout << this->getId() << "> size : " << size << std::endl; 
     368      const StdSize size = (this->storeIndex_client)->num_elements() ; 
     369 
    394370      stored->resize(boost::extents[size]) ; 
    395371      for(StdSize i = 0; i < size; i++) 
    396          (*stored)[i] = data[(*storeIndex[0])[i]] ; 
     372         (*stored)[i] = data[(*storeIndex_client)[i]] ; 
    397373   } 
    398374    
     
    442418    
    443419   //--------------------------------------------------------------- 
    444     
     420  void CGrid::sendIndex(void) 
     421  { 
     422    shared_ptr<CContext> context=CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId()) ; 
     423    CContextClient* client=context->client ; 
     424     
     425    CEventClient event(getType(),EVENT_ID_INDEX) ; 
     426    int rank ; 
     427    list<shared_ptr<CMessage> > list_msg ; 
     428    list<ARRAY(int,1) > list_out_i,list_out_j,list_out_l ; 
     429      
     430    for(int ns=0;ns<domain->connectedServer.size();ns++) 
     431    { 
     432       rank=domain->connectedServer[ns] ; 
     433       int ib=domain->ib_srv[ns] ; 
     434       int ie=domain->ie_srv[ns] ; 
     435       int jb=domain->jb_srv[ns] ; 
     436       int je=domain->je_srv[ns] ; 
     437        
     438       int i,j ; 
     439       int nb=0 ; 
     440       for(int k=0;k<storeIndex_client->num_elements();k++) 
     441       { 
     442         i=(*out_i_client)[k] ; 
     443         j=(*out_j_client)[k] ; 
     444         if (i>=ib-1 && i<=ie-1 && j>=jb-1 && j<=je-1) nb++ ;  
     445       } 
     446        
     447       ARRAY_CREATE(storeIndex,int,1,[nb]) ; 
     448       ARRAY_CREATE(out_i,int,1,[nb]) ; 
     449       ARRAY_CREATE(out_j,int,1,[nb]) ; 
     450       ARRAY_CREATE(out_l,int,1,[nb]) ; 
     451        
     452       nb=0 ; 
     453       for(int k=0;k<storeIndex_client->num_elements();k++) 
     454       { 
     455         i=(*out_i_client)[k] ; 
     456         j=(*out_j_client)[k] ; 
     457         if (i>=ib-1 && i<=ie-1 && j>=jb-1 && j<=je-1)  
     458         { 
     459            (*storeIndex)[nb]=k ; 
     460            (*out_i)[nb]=(*out_i_client)[k] ; 
     461            (*out_j)[nb]=(*out_j_client)[k] ; 
     462            (*out_l)[nb]=(*out_l_client)[k] ; 
     463            nb++ ; 
     464         } 
     465       } 
     466        
     467       storeIndex_toSrv.insert(pair<int,ARRAY(int,1) >(rank,storeIndex)) ; 
     468       nbSenders.insert(pair<int,int>(rank,domain->nbSenders[ns])) ; 
     469       list_msg.push_back(shared_ptr<CMessage>(new CMessage)) ; 
     470       list_out_i.push_back(out_i) ; 
     471       list_out_j.push_back(out_j) ; 
     472       list_out_l.push_back(out_l) ; 
     473 
     474       *list_msg.back()<<getId()<<list_out_i.back()<<list_out_j.back()<<list_out_l.back() ; 
     475       event.push(rank,domain->nbSenders[ns],*list_msg.back()) ; 
     476    } 
     477    client->sendEvent(event) ; 
     478  } 
     479   
     480  void CGrid::recvIndex(CEventServer& event) 
     481  { 
     482    list<CEventServer::SSubEvent>::iterator it ; 
     483    for (it=event.subEvents.begin();it!=event.subEvents.end();++it) 
     484    { 
     485      int rank=it->rank; 
     486      CBufferIn* buffer=it->buffer; 
     487      string domainId ; 
     488      *buffer>>domainId ; 
     489      get(domainId)->recvIndex(rank,*buffer) ; 
     490    } 
     491  } 
     492   
     493  void CGrid::recvIndex(int rank, CBufferIn& buffer) 
     494  { 
     495    ARRAY_CREATE(out_i,int,1,[0]) ; 
     496    ARRAY_CREATE(out_j,int,1,[0]) ; 
     497    ARRAY_CREATE(out_l,int,1,[0]) ; 
     498     
     499    buffer>>out_i>>out_j>>out_l ; 
     500    int offset ; 
     501     
     502    offset=domain->zoom_ibegin_srv-1 ; 
     503    for(int k=0;k<out_i->num_elements();k++) (*out_i)[k]=(*out_i)[k]-offset ; 
     504     
     505    offset=domain->zoom_jbegin_srv-1 ; 
     506    for(int k=0;k<out_i->num_elements();k++) (*out_j)[k]=(*out_j)[k]-offset ; 
     507     
     508    out_i_fromClient.insert(pair< int,ARRAY(int,1) >(rank,out_i)) ; 
     509    out_j_fromClient.insert(pair< int,ARRAY(int,1) >(rank,out_j)) ; 
     510    out_l_fromClient.insert(pair< int,ARRAY(int,1) >(rank,out_l)) ; 
     511  } 
     512 
     513  bool CGrid::dispatchEvent(CEventServer& event) 
     514  { 
     515      
     516    if (SuperClass::dispatchEvent(event)) return true ; 
     517    else 
     518    { 
     519      switch(event.type) 
     520      { 
     521        case EVENT_ID_INDEX : 
     522          recvIndex(event) ; 
     523          return true ; 
     524          break ; 
     525  
     526        default : 
     527          ERROR("bool CDomain::dispatchEvent(CEventServer& event)", 
     528                <<"Unknown Event") ; 
     529          return false ; 
     530      } 
     531    } 
     532  } 
     533 
     534 
     535 
    445536   void CGrid::computeIndexServer(void) 
    446537   { 
     
    468559      const int  jend_zoom_srv = jbegin_zoom_srv + zoom_nj_srv-1 ; 
    469560         
    470 //      std::cout<<"----> computeIndexServer !!"<<std::endl ; 
    471561      StdSize dn = 0;       
    472562      for (StdSize j = 1; j < this->out_i_index.size(); j++) 
     
    503593         } 
    504594          
    505 //         std::cout<<"--> client No "<<i<<std::endl ; 
    506 //         std::cout<<" ibegin "<<ibegin[i]<<" iend "<<iend[i]<<" jbegin "<<jbegin[i]<<" jend "<<jend[i]<<std::endl ; 
    507 //         std::cout<<"zoom cl : ibegin "<<ibegin_zoom_cl<<" iend "<<iend_zoom_cl<<" jbegin "<<jbegin_zoom_cl<<" jend "<<jend_zoom_cl<<std::endl ; 
    508 //         std::cout<<"--> server "<<std::endl ; 
    509 //         std::cout<<" ibegin "<<ibegin_srv<<" iend "<<iend_srv<<" jbegin "<<jbegin_srv<<" jend "<<jend_srv<<std::endl ; 
    510 //        std::cout<<"zoom : ibegin "<<ibegin_zoom_srv<<" iend "<<iend_zoom_srv<< " ni "<<zoom_ni_srv<<" jbegin "<<jbegin_zoom_srv<<" jend "<<jend_zoom_srv<<" nj "<<zoom_nj_srv<<std::endl ; 
    511 //         std::cout<<"zoom_size "<<ibegin_zoom.size()<<std::endl ; 
    512595 
    513596         if (comm::CMPIManager::IsClient()) 
     
    517600              (*storeIndex_srv)[n]  = (*storeIndex_cl)[m]; // Faux mais inutile dans le cas serveur. 
    518601 
    519 //            (*out_i_index_srv)[n] = (*out_i_index_cl)[m]  
    520 //                                  /*+ (ibegin_cl - 1) - (ibegin_srv - 1)*/ + (ibegin_zoom_cl - 1) - (ibegin_zoom_srv - 1); 
    521 //            (*out_j_index_srv)[n] = (*out_j_index_cl)[m] 
    522 //                                  /*+ (jbegin_cl - 1) - (jbegin_srv - 1)*/ + (jbegin_zoom_cl - 1) - (jbegin_zoom_srv - 1); 
    523 //            (*out_l_index_srv)[n] = (*out_l_index_cl)[m]; 
    524602              (*out_i_index_srv)[n] = (*out_i_index_cl)[m] + ibegin_cl - 1 - (ibegin_srv + ibegin_zoom_srv - 1) + 1 ; 
    525603              (*out_j_index_srv)[n] = (*out_j_index_cl)[m] + jbegin_cl - 1 - (jbegin_srv + jbegin_zoom_srv - 1) + 1 ; 
     
    542620                   
    543621         dn += storeIndex_cl->size();  
    544 //         std::cout<<"storeIndex_cl->size() "<<storeIndex_cl->size()<<std::endl;                
    545        
    546 //         std::cout<<"storeIndex_srv->size() "<<storeIndex_srv->size()<<std::endl;                
    547622      } 
    548623       
     
    558633            *std::max_element(out_j_index_srv->begin(), out_j_index_srv->end()); 
    559634                
    560 //                std::cout<< "[ grille = "      << this->getId() 
    561 //                         << ", ibegin_t = "    << ibegin_t 
    562 //                         << ", jbegin_t = "    << jbegin_t 
    563 //                         << ", iend_t = "      << iend_t 
    564 //                         << ", jend_t = "      << jend_t 
    565 //                         << ", zoom_ni_srv = " << zoom_ni_srv 
    566 //                         << ", zoom_nj_srv = " << zoom_nj_srv 
    567 //                         << ", nb subdomain = "   << out_i_index.size()-1<<std::endl   ;   
    568635                                  
    569636         if ((ibegin_t < 0) || (jbegin_t < 0) || 
     
    623690   } 
    624691 
     692   void CGrid::outputFieldToServer(ARRAY(double, 1) fieldIn, int rank, ARRAY(double, 1) fieldOut) 
     693   { 
     694     ARRAY(int,1) index=storeIndex_toSrv[rank] ; 
     695     int nb=index->num_elements() ; 
     696     fieldOut->resize(extents[nb]) ; 
     697      
     698     for(int k=0;k<nb;k++) (*fieldOut)[k]=(*fieldIn)[(*index)[k]] ; 
     699    } 
    625700   ///--------------------------------------------------------------- 
    626701 
  • XMLIO_V2/dev/common/src/node/grid.hpp

    r286 r300  
    4141         typedef CGridGroup      RelGroup; 
    4242 
     43         enum EEventId 
     44         { 
     45           EVENT_ID_INDEX 
     46         } ; 
     47          
    4348         /// Constructeurs /// 
    4449         CGrid(void); 
     
    8186         void inputFieldServer(const std::deque<ARRAY(double, 1)> storedClient, 
    8287                                                ARRAY(double, 1)  storedServer) const; 
    83  
     88/* 
    8489         template <StdSize n> 
    8590            void outputField(const ARRAY(double, 1) stored,  ARRAY(double, n) field) const; 
    86  
     91*/ 
     92         void outputField(int rank, const ARRAY(double, 1) stored,  ARRAY(double, 3) field)  ; 
     93         void outputField(int rank, const ARRAY(double, 1) stored,  ARRAY(double, 2) field)  ; 
     94         void outputField(int rank,const ARRAY(double, 1) stored,  ARRAY(double, 1) field)  ;  
     95    
    8796         /// Destructeur /// 
    8897         virtual ~CGrid(void); 
     
    102111            CreateGrid(boost::shared_ptr<CDomain> domain, boost::shared_ptr<CAxis> axis); 
    103112 
    104       protected : 
     113      public : 
    105114 
    106115         /// Entrées-sorties de champs (interne) /// 
     
    113122         void solveAxisRef(void); 
    114123 
     124         static bool dispatchEvent(CEventServer& event) ; 
     125         void outputFieldToServer(ARRAY(double, 1) fieldIn, int rank, ARRAY(double, 1) fieldOut) ; 
     126         static void recvIndex(CEventServer& event) ; 
     127         void recvIndex(int rank, CBufferIn& buffer) ; 
     128         void sendIndex(void) ; 
     129          
    115130      public: 
    116131 
     
    126141         std::deque<ARRAY(int, 1)> out_j_index ; 
    127142         std::deque<ARRAY(int, 1)> out_l_index ; 
    128  
     143         ARRAY(int, 1) storeIndex_client ; 
     144         ARRAY(int, 1) out_i_client ; 
     145         ARRAY(int, 1) out_j_client ; 
     146         ARRAY(int, 1) out_l_client ; 
     147          
     148         map<int,ARRAY(int, 1)>  storeIndex_toSrv ; 
     149         map<int,int> nbSenders ; 
     150//         std::deque<ARRAY(int, 1)> out_i_toSrv ; 
     151//         std::deque<ARRAY(int, 1)> out_j_toSrv ; 
     152//         std::deque<ARRAY(int, 1)> out_l_toSrv ; 
     153          
     154         map<int,ARRAY(int, 1)> out_i_fromClient ; 
     155         map<int,ARRAY(int, 1)> out_j_fromClient ; 
     156         map<int,ARRAY(int, 1)> out_l_fromClient ; 
     157          
    129158   }; // class CGrid 
    130159 
  • XMLIO_V2/dev/common/src/node/node_enum.hpp

    r219 r300  
    22#define __XMLIO_NODE_ENUM__ 
    33 
    4 #define DECLARE_NODE(Name_, name_)     ,e##Name_, g##Name_ 
    5 #define DECLARE_NODE_PAR(Name_, name_) ,e##Name_, g##Name_ 
     4//#define DECLARE_NODE(Name_, name_)     ,e##Name_, g##Name_ 
     5//#define DECLARE_NODE_PAR(Name_, name_) ,e##Name_, g##Name_ 
    66 
    77namespace xmlioserver 
     
    1212      typedef enum _node_type 
    1313      { 
    14          Unknown = 0 
     14         Unknown = 0, 
     15         eAxis,gAxis, 
     16         eDomain,gDomain, 
     17         eField,gField, 
     18         eFile,gFile, 
     19         eGrid,gGrid, 
     20         eVariable,gVariable, 
     21         eContext,gContext 
    1522 
    16 #include "node_type.conf" 
     23//#include "node_type.conf" 
    1724 
    1825      } ENodeType; 
  • XMLIO_V2/dev/common/src/node/variable.cpp

    r274 r300  
    102102           subdata   = content.substr ( begindata, enddata-begindata); 
    103103 
    104            //std::cout << "\"" << subid << "\":\"" << subdata << "\"" << std::endl; 
    105104           CGroupFactory::CreateChild(group_ptr, subid)->content = subdata; 
    106105        } 
  • XMLIO_V2/dev/common/src/object_factory_impl.hpp

    r286 r300  
    8686               << "[ id = " << id << ", U = " << U::GetName() <<", context = "<<context<< " ] " 
    8787               << " object is not referenced !"); 
    88       return (U::AllMapObj[CObjectFactory::CurrContext][id]); 
     88      return (U::AllMapObj[context][id]); 
    8989   } 
    9090 
  • XMLIO_V2/dev/common/src/object_template.hpp

    r286 r300  
    66#include "attribute_map.hpp" 
    77#include "node_enum.hpp" 
     8#include "buffer_in.hpp" 
     9#include "event_server.hpp" 
     10#include "attribute.hpp" 
    811 
    912namespace xmlioserver 
     
    2326         typedef CObject SuperClass; 
    2427         typedef T DerivedType; 
     28          
     29         enum EEventId 
     30         { 
     31           EVENT_ID_SEND_ATTRIBUTE=100 
     32         } ; 
    2533 
    2634      public : 
     
    4654         /// Traitement statique /// 
    4755         static void ClearAllAttributes(void); 
     56         void sendAttributToServer(const string& id); 
     57         void sendAttributToServer(tree::CAttribute& attr) ; 
     58         static void recvAttributFromClient(CEventServer& event) ; 
     59         static bool dispatchEvent(CEventServer& event) ; 
    4860 
    4961         /// Accesseur statique /// 
     
    5365         /// Destructeur /// 
    5466         virtual ~CObjectTemplate(void); 
    55  
     67          
     68         static bool has(const string& id) ; 
     69         static boost::shared_ptr<T> get(const string& id) ; 
     70         boost::shared_ptr<T> get(void) ; 
     71         static boost::shared_ptr<T> create(const string& id=string("")) ; 
     72          
    5673      protected : 
    5774 
     
    7794} // namespace xmlioserver 
    7895 
     96//#include "object_template_impl.hpp" 
     97 
    7998#endif // __XMLIO_CObjectTemplate__ 
  • XMLIO_V2/dev/common/src/object_template_impl.hpp

    r286 r300  
    11#ifndef __XMLIO_CObjectTemplate_impl__ 
    22#define __XMLIO_CObjectTemplate_impl__ 
     3 
     4#include "object_factory.hpp" 
     5#include "context.hpp" 
     6#include "transfert_parameters.hpp" 
     7#include "buffer_in.hpp" 
     8#include "attribute.hpp" 
     9#include "event_client.hpp" 
     10#include "context_client.hpp" 
     11#include "object_template.hpp" 
    312 
    413namespace xmlioserver 
     
    137146   } 
    138147 
    139    ///-------------------------------------------------------------- 
    140  
     148   template <class T> 
     149   void CObjectTemplate<T>::sendAttributToServer(const string& id) 
     150   { 
     151      CAttributeMap & attrMap = *this; 
     152      CAttribute* attr=attrMap[id] ; 
     153      sendAttributToServer(*attr) ; 
     154   } 
     155 
     156   template <class T> 
     157   void CObjectTemplate<T>::sendAttributToServer(tree::CAttribute& attr) 
     158   { 
     159     shared_ptr<CContext> context=CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId()) ; 
     160      
     161    if (!context->hasServer) 
     162    { 
     163       CContextClient* client=context->client ; 
     164 
     165       CEventClient event(getType(),EVENT_ID_SEND_ATTRIBUTE) ;    
     166       if (client->isServerLeader()) 
     167       { 
     168         CMessage msg ; 
     169         msg<<this->getId() ; 
     170         msg<<attr.getName() ; 
     171         msg<<attr ; 
     172         event.push(client->getServerLeader(),1,msg) ; 
     173         client->sendEvent(event) ; 
     174       } 
     175       else client->sendEvent(event) ; 
     176    } 
     177       
     178   } 
     179    
     180   template <class T> 
     181   void CObjectTemplate<T>::recvAttributFromClient(CEventServer& event) 
     182   { 
     183       
     184      CBufferIn* buffer=event.subEvents.begin()->buffer; 
     185      string id,attrId; 
     186      *buffer>>id ; 
     187      CAttributeMap & attrMap = *get(id); 
     188      *buffer>>attrId ; 
     189      CAttribute* attr=attrMap[attrId] ; 
     190      info(50)<<"attribut recu "<<attrId<<"  " ; 
     191      if (attr->isEmpty()) info(50)<<"--> empty"<<endl ; 
     192      else info(50) /*<attr->getValue()*/<<endl ; 
     193      *buffer>>*attr ; 
     194       info(50)<<"attribut recu "<<attrId<<"  " ; 
     195      if (attr->isEmpty()) info(50)<<"--> empty"<<endl ; 
     196      else info(50) /*attr->getValue()*/<<endl ; 
     197  } 
     198 
     199   template <class T> 
     200   bool CObjectTemplate<T>::dispatchEvent(CEventServer& event) 
     201   { 
     202      switch(event.type) 
     203      { 
     204         case EVENT_ID_SEND_ATTRIBUTE : 
     205           recvAttributFromClient(event) ; 
     206           return true ; 
     207           break ; 
     208        
     209         default : 
     210         return false ; 
     211//           ERROR("void CObjectTemplate<T>::recvEvent(CEventServer& event)", 
     212//                 <<"Unknown Event") ; 
     213      } 
     214   } 
     215    
     216   template <typename T> 
     217   bool CObjectTemplate<T>::has(const string & id) 
     218   { 
     219     return CObjectFactory::HasObject<T>(id) ; 
     220   } 
     221 
     222   template <typename T> 
     223   boost::shared_ptr<T> CObjectTemplate<T>::get(const string & id) 
     224   { 
     225     return CObjectFactory::GetObject<T>(id) ; 
     226   } 
     227 
     228   template <typename T> 
     229   boost::shared_ptr<T> CObjectTemplate<T>::create(const string & id) 
     230   { 
     231     return CObjectFactory::CreateObject<T>(id) ; 
     232   }   ///-------------------------------------------------------------- 
     233 
     234  template <typename T> 
     235  boost::shared_ptr<T> CObjectTemplate<T>::get(void) 
     236  { 
     237    return CObjectFactory::GetObject<T>((T*)this) ; 
     238  } 
     239   
     240 
     241   
    141242} // namespace xmlioserver 
    142243 
  • XMLIO_V2/dev/common/src/output/nc4_data_output.cpp

    r292 r300  
    1010#include "xios_manager.hpp" 
    1111#include "context.hpp" 
     12#include "context_server.hpp" 
    1213 
    1314namespace xmlioserver 
     
    5859      void CNc4DataOutput::writeDomain_(const boost::shared_ptr<tree::CDomain> domain) 
    5960      { 
     61         shared_ptr<CContext> context=CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId()) ; 
     62         CContextServer* server=context->server ; 
     63          
    6064         if (domain->IsWritten(this->filename)) return; 
    6165         domain->checkAttributes(); 
    6266          
    63 //         if (domain->isEmpty()) return; 
     67         if (domain->isEmpty())  
     68           if (SuperClass::type==MULTI_FILE) return ; 
    6469 
    6570         std::vector<StdString> dim0, dim1; 
     
    6873         StdString lonid     = StdString("lon_").append(domid); 
    6974         StdString latid     = StdString("lat_").append(domid); 
    70          StdString lonid_loc = (comm::CMPIManager::GetCommSize(CXIOSManager::Comm_Server) > 1) 
     75         StdString lonid_loc = (server->intraCommSize > 1) 
    7176                             ? StdString("lon_").append(domid).append("_local") 
    7277                             : lonid; 
    73          StdString latid_loc = (comm::CMPIManager::GetCommSize(CXIOSManager::Comm_Server) > 1) 
     78         StdString latid_loc = (server->intraCommSize > 1) 
    7479                             ? StdString("lat_").append(domid).append("_local") 
    7580                             : latid; 
    76          StdString maskid    = StdString("mask_").append(domid).append("_local"); 
    77  
    78          ARRAY(int, 2) mask = domain->getLocalMask(); 
    79  
    80          unsigned int ssize = domain->zoom_ni_loc.getValue() * domain->zoom_nj_loc.getValue(); 
    81          bool isCurvilinear = (domain->lonvalue.getValue()->size() == ssize); 
     81// supress mask         StdString maskid    = StdString("mask_").append(domid).append("_local"); 
     82 
     83// supress mask         ARRAY(int, 2) mask = domain->getLocalMask(); 
     84 
     85//         unsigned int ssize = domain->zoom_ni_loc.getValue() * domain->zoom_nj_loc.getValue(); 
     86//         bool isCurvilinear = (domain->lonvalue.getValue()->size() == ssize); 
     87         bool isCurvilinear = true ; //for moment 
    8288 
    8389         switch (SuperClass::type) 
     
    8591            case (MULTI_FILE) : 
    8692            { 
    87                if (domain->isEmpty()) return; 
     93//               if (domain->isEmpty()) return; 
    8894                
    89                if (comm::CMPIManager::GetCommSize(CXIOSManager::Comm_Server) > 1) 
     95               if (server->intraCommSize > 1) 
    9096               { 
    9197                 SuperClassWriter::addDimension(lonid, domain->zoom_ni.getValue()); 
     
    105111               } 
    106112 
    107                SuperClassWriter::addDimension(lonid_loc, domain->zoom_ni_loc.getValue()); 
    108                SuperClassWriter::addDimension(latid_loc, domain->zoom_nj_loc.getValue()); 
    109                if (comm::CMPIManager::GetCommSize(CXIOSManager::Comm_Server) > 1) 
    110                { 
    111                   this->writeLocalAttributes(domain->zoom_ibegin_loc.getValue(), 
    112                                              domain->zoom_ni_loc.getValue(), 
    113                                              domain->zoom_jbegin_loc.getValue(), 
    114                                              domain->zoom_nj_loc.getValue(), 
     113               SuperClassWriter::addDimension(lonid_loc, domain->zoom_ni_srv); 
     114               SuperClassWriter::addDimension(latid_loc, domain->zoom_nj_srv); 
     115               if (server->intraCommSize > 1) 
     116               { 
     117                  this->writeLocalAttributes(domain->zoom_ibegin_srv, 
     118                                             domain->zoom_ni_srv, 
     119                                             domain->zoom_jbegin_srv, 
     120                                             domain->zoom_nj_srv, 
    115121                                             domid); 
    116122               } 
     
    135141               dim0.push_back(lonid_loc); 
    136142 
    137                if (comm::CMPIManager::GetCommSize(CXIOSManager::Comm_Server) > 1) 
    138                { 
    139                   SuperClassWriter::addVariable(maskid, NC_INT, dim0); 
    140  
    141                   this->writeMaskAttributes(maskid, 
    142                      domain->data_dim.getValue()/*, 
    143                      domain->data_ni.getValue(), 
    144                      domain->data_nj.getValue(), 
    145                      domain->data_ibegin.getValue(), 
    146                      domain->data_jbegin.getValue()*/); 
    147                } 
     143 
     144// supress mask               if (server->intraCommSize > 1) 
     145// supress mask               { 
     146// supress mask                  SuperClassWriter::addVariable(maskid, NC_INT, dim0); 
     147// supress mask 
     148// supress mask                  this->writeMaskAttributes(maskid, 
     149// supress mask                     domain->data_dim.getValue()/*, 
     150// supress mask                     domain->data_ni.getValue(), 
     151// supress mask                     domain->data_nj.getValue(), 
     152// supress mask                     domain->data_ibegin.getValue(), 
     153// supress mask                     domain->data_jbegin.getValue()*/); 
     154// supress mask               } 
    148155                   
    149156               //SuperClassWriter::setDefaultValue(maskid, &dvm); 
    150157 
    151158               SuperClassWriter::definition_end(); 
    152                SuperClassWriter::writeData(domain->latvalue.getValue(), latid, true, 0); 
    153                SuperClassWriter::writeData(domain->lonvalue.getValue(), lonid, true, 0); 
    154                if (comm::CMPIManager::GetCommSize(CXIOSManager::Comm_Server) > 1) 
    155                   SuperClassWriter::writeData(mask, maskid); 
     159               SuperClassWriter::writeData(domain->latvalue_srv, latid, true, 0); 
     160               SuperClassWriter::writeData(domain->lonvalue_srv, lonid, true, 0); 
     161// supress mask               if (server->intraCommSize > 1) SuperClassWriter::writeData(mask, maskid); 
    156162               SuperClassWriter::definition_start(); 
    157163 
     
    195201               else 
    196202               { 
    197                  start[1]=domain->zoom_ibegin_loc.getValue()+domain->ibegin.getValue()-1-domain->zoom_ibegin.getValue() ; start [0]=domain->zoom_jbegin_loc.getValue()+domain->jbegin.getValue()-1-domain->zoom_jbegin.getValue() ;  
    198                  count[1]=domain->zoom_ni_loc.getValue() ; count[0]=domain->zoom_nj_loc.getValue() ;  
     203                 start[1]=domain->zoom_ibegin_srv-domain->zoom_ibegin.getValue() ; start [0]=domain->zoom_jbegin_srv-domain->zoom_jbegin.getValue() ;  
     204                 count[1]=domain->zoom_ni_srv ; count[0]=domain->zoom_nj_srv ;  
    199205               } 
    200206                
    201                SuperClassWriter::writeData(domain->latvalue.getValue(), latid, true, 0,&start,&count); 
    202                SuperClassWriter::writeData(domain->lonvalue.getValue(), lonid, true, 0,&start,&count); 
     207               SuperClassWriter::writeData(domain->latvalue_srv, latid, true, 0,&start,&count); 
     208               SuperClassWriter::writeData(domain->lonvalue_srv, lonid, true, 0,&start,&count); 
    203209               SuperClassWriter::definition_start(); 
    204210 
     
    265271      void CNc4DataOutput::writeField_(const boost::shared_ptr<tree::CField> field) 
    266272      { 
     273         shared_ptr<CContext> context=CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId()) ; 
     274         CContextServer* server=context->server ; 
     275 
    267276         std::vector<StdString> dims, coodinates; 
    268          boost::shared_ptr<CGrid> grid = 
    269             CObjectFactory::GetObject<CGrid>(field->grid_ref.getValue()); 
    270          boost::shared_ptr<CDomain> domain = 
    271             CObjectFactory::GetObject<CDomain>(grid->domain_ref.getValue()); 
     277         boost::shared_ptr<CGrid> grid = field->grid; 
     278         boost::shared_ptr<CDomain> domain = grid->domain; 
    272279            
    273280         if (domain->isEmpty())  
     
    279286         StdString lonid     = StdString("lon_").append(domid); 
    280287         StdString latid     = StdString("lat_").append(domid); 
    281          StdString lonid_loc = (comm::CMPIManager::GetCommSize(CXIOSManager::Comm_Server) > 1) 
     288         StdString lonid_loc = (server->intraCommSize > 1) 
    282289                             ? StdString("lon_").append(domid).append("_local") 
    283290                             : lonid; 
    284          StdString latid_loc = (comm::CMPIManager::GetCommSize(CXIOSManager::Comm_Server) > 1) 
     291         StdString latid_loc = (server->intraCommSize > 1) 
    285292                             ? StdString("lat_").append(domid).append("_local") 
    286293                             : latid; 
     
    288295                             ? field->name.getValue() : field->getBaseFieldReference()->getId(); 
    289296 
    290          unsigned int ssize = domain->zoom_ni_loc.getValue() * domain->zoom_nj_loc.getValue(); 
    291          bool isCurvilinear = (domain->lonvalue.getValue()->size() == ssize); 
    292  
     297//         unsigned int ssize = domain->zoom_ni_loc.getValue() * domain->zoom_nj_loc.getValue(); 
     298//         bool isCurvilinear = (domain->lonvalue.getValue()->size() == ssize); 
     299          bool isCurvilinear = true ; // for moment  
     300           
    293301         nc_type type = (!field->prec.isEmpty() && 
    294302                        ( field->prec.getValue() == 4)) 
     
    309317         if (!grid->axis_ref.isEmpty()) 
    310318         { 
    311             boost::shared_ptr<CAxis> axis = 
    312                CObjectFactory::GetObject<CAxis>(grid->axis_ref.getValue()); 
    313             StdString axisid = (!axis->name.isEmpty()) 
    314                              ? axis->name.getValue() : axis->getId(); 
     319            boost::shared_ptr<CAxis> axis = grid->axis ; 
     320            StdString axisid = (!axis->name.isEmpty()) ? axis->name.getValue() : axis->getId(); 
    315321            dims.push_back(axisid); 
    316322            coodinates.push_back(axisid); 
     
    425431      void CNc4DataOutput::closeFile_ (void) 
    426432      { 
    427          std::cout<<"--> Close file "<<filename<<std::endl ; 
    428433         SuperClassWriter::close() ; 
    429434      } 
     
    449454      void CNc4DataOutput::writeFieldData_ (const boost::shared_ptr<tree::CField>  field) 
    450455      { 
    451          boost::shared_ptr<CGrid> grid = 
    452             CObjectFactory::GetObject<CGrid>(field->grid_ref.getValue()); 
    453          boost::shared_ptr<CDomain> domain = 
    454             CObjectFactory::GetObject<CDomain>(grid->domain_ref.getValue()); 
     456         shared_ptr<CContext> context=CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId()) ; 
     457 
     458         boost::shared_ptr<CGrid> grid = field->grid ; 
     459         boost::shared_ptr<CDomain> domain = grid->domain ; 
    455460          
    456461         if(SuperClass::type==MULTI_FILE) if (domain->isEmpty()) return; 
    457462 
    458463 
    459          StdString fieldid   = (!field->name.isEmpty()) 
     464         StdString fieldid   = (!field->name.isEmpty())  
    460465                             ? field->name.getValue()  
    461466                             : field->getBaseFieldReference()->getId(); 
    462          boost::shared_ptr<xmlioserver::tree::CContext> context = 
    463             CObjectFactory::GetObject<xmlioserver::tree::CContext> 
    464                (CObjectFactory::GetCurrentContextId()); 
    465467                              
    466468         StdOStringStream oss; 
     
    468470             << "_" << field->getRelFile()->output_freq.getValue(); 
    469471              
    470          ARRAY(double, 1) field_data = field->getData(); 
     472 //        ARRAY(double, 1) field_data = field->data_srv; 
    471473         ARRAY_CREATE(time_data, double, 1, [1]); 
    472          (*time_data)[0] = date::Time(*field->getLastWriteDate()); 
     474         (*time_data)[0] = date::Time(*field->last_Write_srv); 
    473475          
    474476         if (grid->hasAxis()) // 3D 
    475477         { 
    476             boost::shared_ptr<CAxis> axis = CObjectFactory::GetObject<CAxis>(grid->axis_ref.getValue()); 
    477             ARRAY(double, 3) field_data3D (new CArray<double,3>(grid->getLocalShape()/*, boost::c_storage_order()*/));             
    478             grid->outputField(field_data, field_data3D); 
     478            boost::shared_ptr<CAxis> axis = grid->axis ; 
     479            ARRAY_CREATE(field_data3D,double,3,[domain->zoom_ni_srv][domain->zoom_nj_srv][axis->size.getValue()]) ; 
     480            field->outputField(field_data3D); 
    479481            switch (SuperClass::type) 
    480482           { 
     
    497499                 { 
    498500//                 start[2]=domain->zoom_ibegin_loc.getValue()-domain->zoom_ibegin.getValue() ; start [1]=domain->zoom_jbegin_loc.getValue()-domain->zoom_jbegin.getValue() ; start[0]=0 ; 
    499                    start[2]=domain->zoom_ibegin_loc.getValue()+domain->ibegin.getValue()-1-domain->zoom_ibegin.getValue() ; start [1]=domain->zoom_jbegin_loc.getValue()+domain->jbegin.getValue()-1-domain->zoom_jbegin.getValue() ; start[0]=0 ;  
    500                    count[2]=domain->zoom_ni_loc.getValue() ; count[1]=domain->zoom_nj_loc.getValue() ; count[0] = axis->size.getValue(); 
     501                   start[2]=domain->zoom_ibegin_srv-domain->zoom_ibegin.getValue() ; start [1]=domain->zoom_jbegin_srv-domain->zoom_jbegin.getValue() ; start[0]=0 ; 
     502                   count[2]=domain->zoom_ni_srv ; count[1]=domain->zoom_nj_srv ; count[0] = axis->size.getValue(); 
    501503                 } 
    502504                 SuperClassWriter::writeData(field_data3D, fieldid, true, field->getNStep()-1,&start,&count ); 
     
    509511         else // 2D 
    510512         { 
    511             ARRAY(double, 2) field_data2D (new CArray<double, 2>(grid->getLocalShape()/*, boost::c_storage_order()*/)); 
    512             grid->outputField(field_data,  field_data2D); 
     513            ARRAY_CREATE(field_data2D,double,2,[domain->zoom_ni_srv][domain->zoom_nj_srv]) ; 
     514            field->outputField(field_data2D); 
    513515            switch (SuperClass::type) 
    514516            { 
     
    530532                 else 
    531533                 { 
    532                    start[1]=domain->zoom_ibegin_loc.getValue()+domain->ibegin.getValue()-1-domain->zoom_ibegin.getValue() ; start [0]=domain->zoom_jbegin_loc.getValue()+domain->jbegin.getValue()-1-domain->zoom_jbegin.getValue() ;  
    533                    count[1]=domain->zoom_ni_loc.getValue() ; count[0]=domain->zoom_nj_loc.getValue() ;  
     534                   start[1]=domain->zoom_ibegin_srv-domain->zoom_ibegin.getValue() ; start[0]=domain->zoom_jbegin_srv-domain->zoom_jbegin.getValue() ;  
     535                   count[1]=domain->zoom_ni_srv ; count[0]=domain->zoom_nj_srv ; 
    534536                 } 
     537 
    535538                 SuperClassWriter::writeData(field_data2D, fieldid, true, field->getNStep()-1,&start,&count); 
    536539                 SuperClassWriter::writeData(time_data, oss.str(), true, field->getNStep()-1); 
  • XMLIO_V2/dev/common/src/output/onetcdf4.cpp

    r286 r300  
    255255            dimids.push_back(this->getDimension(dimid)); 
    256256         } 
    257          std::cout<<"--> Var "<<name.c_str()<<std::endl ; 
    258257         CheckError(nc_def_var (grpid, name.c_str(), type, dimids.size(), &(dimids[0]), &retvalue)); 
    259258         return (retvalue); 
     
    346345         } 
    347346          
    348 //         if (iddims.begin()->compare(this->getUnlimitedDimensionName()) == 0) 
    349 //         { 
    350 //            if (array_size==0) scount[0]=0 ; 
    351 //         }          
    352 //         for (StdSize u = 0; u < sstart.size(); u++) 
    353 //            std::cout << "(" << sstart[u] << "," << scount[u]  << ")" ; 
    354 //         std::cout << std::endl; 
    355347      } 
    356348 
  • XMLIO_V2/dev/common/src/server.cpp

    r286 r300  
    55#include "duration.hpp" 
    66#include "data_treatment.hpp" 
     7#include "group_template.hpp" 
    78#include "group_template_impl.hpp" 
    89 
     
    6263            if (((managerId_ != managerId) || (methodId_ != methodId) || (nbargs_ != nbargs)) && (i != 0 )) 
    6364            { 
    64                //std::cout << managerId_ << "<->" << managerId << std::endl 
    65                //          << methodId_  << "<->" << methodId  << std::endl 
    66                //          << nbargs_    << "<->" << nbargs    << std::endl; 
    6765               ERROR("CServer::run(void)", << "[" << i << "] Les requêtes ne sont pas synchronisées !"); 
    6866            } 
     
    7775            { 
    7876               case (0) : 
    79 //                  std::cout<<"--> Request initialize()"<<std::endl ; 
    8077                  this->initialize(); 
    8178                  continue; 
    8279               case (1) : 
    83 //                  std::cout<<"--> Request finalize()"<<std::endl ; 
    8480                  this->finalize(); 
    8581                  return; 
     
    9793            { 
    9894               case (0) : 
    99 //                  std::cout<<"--> Request setContext()"<<std::endl ; 
    10095                  this->setContext(lbuffer); 
    10196                  continue; 
    10297               case (1) : 
    103 //                  std::cout<<"--> Request updateCalendar()"<<std::endl ; 
    10498                  this->updateCalendar(lbuffer); 
    10599                  continue; 
    106100               case (2) : 
    107 //                  std::cout<<"--> Request setTimestep()"<<std::endl ; 
    108101                  this->setTimestep(lbuffer); 
    109102                  continue; 
     
    121114            { 
    122115               case (0) : 
    123 //                  std::cout<<"--> Request writeData()"<<std::endl ; 
    124116                  this->writeData(lbuffer, 4); 
    125117                  continue; 
    126118               case (1) : 
    127 //                  std::cout<<"--> Request writeData()"<<std::endl ; 
    128119                  this->writeData(lbuffer, 8); 
    129120                  continue; 
     
    270261         for (StdSize i = 0; i < buffer.size(); i++) 
    271262            dataArray[i] = buffer[i].getFloatArray(5); 
    272          std::cout << "writeData called (float) " << fieldId << ", " << dataArray[0] << std::endl; 
    273263         // Jamais atteint car les données sont transférées en tant que double 
    274264         return; 
     
    279269         for (StdSize i = 0; i < buffer.size(); i++) 
    280270            dataArray[i] = buffer[i].getDoubleArray(5); 
    281          std::cout << "writeData called (double) " << fieldId << ", " << dataArray[0]  << std::endl; 
    282271         dtreat->write_data(fieldId, fileId, dataArray); 
    283272         return; 
  • XMLIO_V2/dev/common/src/xmlioserver_spl.hpp

    r219 r300  
    2020#include <map> 
    2121#include <deque> 
    22  
     22#include <valarray> 
    2323// Flux. 
    2424#include <iostream> 
     
    2828/// boost headers /// 
    2929//#include <boost/unordered_map.hpp> 
    30  
     30#include <boost/shared_ptr.hpp> 
     31#include <boost/cast.hpp> 
    3132/// Map /// 
    3233#define xios_map std::map 
     
    4546typedef std::size_t        StdSize; 
    4647 
     48typedef  unsigned short int   ushort; 
     49typedef  unsigned int         uint; 
     50typedef  unsigned long int    ulong; 
     51 
    4752/// xmlioserver headers /// 
    4853#include "configure.hpp" 
     54#include "log.hpp" 
     55using namespace std; 
     56using namespace boost ; 
     57 
    4958 
    5059#endif //__XMLIO_SPL__ 
Note: See TracChangeset for help on using the changeset viewer.