Index: XIOS/trunk/src/context_client.cpp.old
===================================================================
--- XIOS/trunk/src/context_client.cpp.old	(revision 309)
+++ 	(revision )
@@ -1,149 +1,0 @@
-#include "xmlioserver_spl.hpp"
-#include "context_client.hpp"
-#include "event_client.hpp"
-#include "buffer_out.hpp"
-#include "buffer_client.hpp"
-#include "type.hpp"
-#include <mpi.h>
-
-namespace xmlioserver
-{
-
-
-    CContextClient::CContextClient(MPI_Comm intraComm_, MPI_Comm interComm_)
-    {
-      intraComm=intraComm_ ;
-      interComm=interComm_ ;
-      MPI_Comm_rank(intraComm,&clientRank) ;
-      MPI_Comm_size(intraComm,&clientSize) ;
-      MPI_Comm_remote_size(interComm,&serverSize) ;
-      
-      timeLine=0 ;
-      locked=false; 
-    }
-
-
-
-    void CContextClient::registerEvent(CEventClient& event)
-    {
-      list<int>::iterator it;
-      map<int,CClientBuffer*> clientBuffer ;
-      
-      for(it=event.serverList.begin();it!=event.serverList.end();it++)
-      {
-        
-        if (connectedServer.find(*it)==connectedServer.end())
-        {
-          connectedServer.insert(*it) ;
-          buffers[*it]=new CClientBuffer(interComm,*it) ;
-        }
-      }
-    }
-
-
-
-    list<CBufferOut*> CContextClient::newEvent(CEventClient& event,list<int>& sizes)
-    {
-      
-      if (locked==true) ERROR("list<CBufferOut*> CContextClient::newEvent(CEventClient& event,list<int>& sizes)",
-                              "event is locked. Please send last event before requesting a new event") ; 
-      
-      list<CBufferOut*> buffers ; 
-      list<CBufferOut*>::iterator itBuff ; 
-      list<int>::iterator it ;
-      
-//      CType<size_t> ttimeLine(timeLine) ;
-//      int size ;
-//      CType<int> tsize(size) ;
-//      int offset=tsize.size()+ttimeLine.size() ;
-
-      int size ;
-      timeLine++ ;
-      CMessage msg ;
-      msg<<size<<timeLine ;
-            
-      for(it=sizes.begin();it!=sizes.end();it++) *it+=msg.size() ;
-      buffers=getBuffers(event.serverList,sizes) ;
-      
-      it=sizes.begin() ;
-      for(itBuff=buffers.begin();itBuff!=buffers.end();itBuff++)
-      {
-        size=*it ;
-        *(*itBuff)<<msg ;
-        it++ ;
-      }      
-    
-      locked=true ;
-      return buffers ;
-    
-    }
-    
-
-
-    void CContextClient::sendEvent(CEventClient& event)
-    {
-      list<int>::iterator itServer ;
-      list<int>::ranks ;
-      list<int>::sizes ;  
-      list<int>::iterator itSize ;
-      
-//      if (locked==false) ERROR("void CContextClient::sendEvent(CEventClient& event)",
-//                              "event is not locked. Please request a new event before sending it") ;
-      ranks=event.getRanks() ;
-      sizes=event.getSizes() ;
-      
-      list<CMessage> msg<<sizes.begin()<<timeLine ;
-      
-      for(list<int>::iterator it=sizes.begin();it!=sizes.end();it++) *it+=msg.size() ;
-      list<CBufferOut*> buffList=getBuffers(ranks,sizes) ;
-      
-      
-      
-      for(list<CBufferOut*>::iterator it=buffList.begin(),itSize=sizes.begin() ;;it!=buffList.end();it++)
-      {
-         **it<<
-        
-      
-      
-                               
-      for(itServer=event.serverList.begin();itServer!=event.serverList.end();itServer++) 
-      {
-        buffers[*itServer]->checkBuffer() ;
-      }
-    }
-    
-
-
-    list<CBufferOut*> CContextClient::getBuffers(list<int>& serverList, list<int>& sizeList)
-    {
-      list<int>::iterator itServer,itSize ;
-      list<CClientBuffer*> bufferList ; 
-      list<CClientBuffer*>::iterator itBuffer ; 
-      list<CBufferOut*>  retBuffer ;
-      bool free ;
-      
-      for(itServer=serverList.begin();itServer!=serverList.end();itServer++) bufferList.push_back(buffers[*itServer]) ;
-
-      free=false ;
-      while(!free)
-      {
-        free=true ;
-        for(itBuffer=bufferList.begin(),itSize=sizeList.begin(); itBuffer!=bufferList.end();itBuffer++,itSize++)
-        {
-          (*itBuffer)->checkBuffer() ;
-          free&=(*itBuffer)->isBufferFree(*itSize) ;
-        }
-      }
-      
-      for(itBuffer=bufferList.begin(),itSize=sizeList.begin(); itBuffer!=bufferList.end();itBuffer++,itSize++)
-      {
-        retBuffer.push_back((*itBuffer)->getBuffer(*itSize)) ;
-      }
-      
-      return retBuffer ;             
-   
-   }
-     
-      
-
-}      
Index: XIOS/trunk/src/fortran/field_interface.f90
===================================================================
--- XIOS/trunk/src/fortran/field_interface.f90	(revision 309)
+++ XIOS/trunk/src/fortran/field_interface.f90	(revision 310)
@@ -112,4 +112,10 @@
       END SUBROUTINE cxios_field_valid_id
 
+      SUBROUTINE cxios_field_is_active(field_hdl, ret) BIND(C)
+         USE ISO_C_BINDING
+         INTEGER  (kind = C_INTPTR_T), VALUE        :: field_hdl
+         LOGICAL  (kind = C_BOOL)                   :: ret
+      END SUBROUTINE cxios_field_is_active
+
    END INTERFACE
    
Index: XIOS/trunk/src/fortran/icfield.cpp
===================================================================
--- XIOS/trunk/src/fortran/icfield.cpp	(revision 309)
+++ XIOS/trunk/src/fortran/icfield.cpp	(revision 310)
@@ -293,3 +293,8 @@
    }
    
+   void cxios_field_is_active (XFieldPtr field_hdl, bool* ret)
+   {
+      *ret = field_hdl->isActive();
+   }
+   
 } // extern "C"
Index: XIOS/trunk/src/fortran/ifield.F90
===================================================================
--- XIOS/trunk/src/fortran/ifield.F90	(revision 309)
+++ XIOS/trunk/src/fortran/ifield.F90	(revision 310)
@@ -31,4 +31,5 @@
    END INTERFACE  
    !----------------------------------------------------------------------------
+   
    
    CONTAINS ! Fonctions disponibles pour les utilisateurs.
@@ -318,5 +319,25 @@
    END FUNCTION  xios(is_valid_fieldgroup)
    
-   
+  LOGICAL FUNCTION xios(field_is_active_id(field_id))
+      IMPLICIT NONE
+      CHARACTER(len  = *)    , INTENT(IN) :: field_id
+      LOGICAL  (kind = 1)                 :: val
+      TYPE(txios(field))                 :: field_hdl
+      
+      CALL xios(get_field_handle)(field_id,field_hdl)
+      xios(field_is_active_id)=xios(field_is_active_hdl(field_hdl))
+
+   END FUNCTION  xios(field_is_active_id)
+   
+   
+   LOGICAL FUNCTION xios(field_is_active_hdl(field_hdl))
+      IMPLICIT NONE
+      TYPE(txios(field)),INTENT(IN)       :: field_hdl
+      LOGICAL  (kind = 1)                 :: ret
+      
+      CALL cxios_field_is_active(field_hdl%daddr, ret);
+      xios(field_is_active_hdl) = ret
+      
+   END FUNCTION  xios(field_is_active_hdl) 
  
    
@@ -544,4 +565,5 @@
       field_valid_id = val
    END FUNCTION  field_valid_id
+ 
 
    LOGICAL FUNCTION fieldgroup_valid_id(idt)
Index: XIOS/trunk/src/fortran/ixios.F90
===================================================================
--- XIOS/trunk/src/fortran/ixios.F90	(revision 309)
+++ XIOS/trunk/src/fortran/ixios.F90	(revision 310)
@@ -24,5 +24,5 @@
                    xios(set_fieldgroup_attr_hdl),xios(set_field_attr),xios(set_field_attr_hdl),      &
                    xios(get_field_handle), xios(get_fieldgroup_handle), xios(is_valid_field),        &
-                   xios(is_valid_fieldgroup)  
+                   xios(is_valid_fieldgroup),xios(field_is_active_id),xios(field_is_active_hdl)  
                    
 USE ifile, ONLY : txios(file), txios(filegroup), xios(set_file_attr),xios(set_file_attr_hdl), &
@@ -72,4 +72,7 @@
 END INTERFACE xios(send_field)
 
+INTERFACE xios(field_is_active)
+  MODULE PROCEDURE xios(field_is_active_id),xios(field_is_active_hdl)
+END INTERFACE
   
  PUBLIC :: txios(domain), txios(domaingroup),txios(field), txios(fieldgroup),txios(file), txios(filegroup), &
@@ -91,5 +94,5 @@
  PUBLIC :: xios(set_timestep),xios(update_calendar)
  PUBLIC :: xios(initialize), xios(init_server), xios(finalize), xios(context_initialize),                       &
-           xios(close_context_definition), xios(context_finalize), xios(send_field)
+           xios(close_context_definition), xios(context_finalize), xios(send_field),xios(field_is_active)
 
 END MODULE XIOS
Index: XIOS/trunk/src/node/field.cpp
===================================================================
--- XIOS/trunk/src/node/field.cpp	(revision 309)
+++ XIOS/trunk/src/node/field.cpp	(revision 310)
@@ -285,7 +285,11 @@
    bool CField::hasDirectFieldReference(void) const
    { 
-      return (!this->field_ref.isEmpty()); 
-   }
-   
+     return (!this->field_ref.isEmpty()); 
+   }
+   
+   bool CField::isActive(void) const
+   { 
+      return (!this->refObject.empty()); 
+   }
    //----------------------------------------------------------------
    
Index: XIOS/trunk/src/node/field.hpp
===================================================================
--- XIOS/trunk/src/node/field.hpp	(revision 309)
+++ XIOS/trunk/src/node/field.hpp	(revision 310)
@@ -99,4 +99,5 @@
          /// Test ///
          bool hasDirectFieldReference(void) const;
+         bool isActive(void) const;
 
          /// Traitements ///
Index: XIOS/trunk/src/test/test_cs.f90
===================================================================
--- XIOS/trunk/src/test/test_cs.f90	(revision 309)
+++ XIOS/trunk/src/test/test_cs.f90	(revision 310)
@@ -98,4 +98,6 @@
 
     CALL xios_close_context_definition()
+    
+    PRINT*,"field field_A is active ? ",xios_field_is_active("field_A")
     DO ts=1,96
       CALL xios_update_calendar(ts)
