Changeset 300
- Timestamp:
- 02/13/12 19:35:25 (12 years ago)
- Location:
- XMLIO_V2/dev/common
- Files:
-
- 38 added
- 57 edited
Legend:
- Unmodified
- Added
- Removed
-
XMLIO_V2/dev/common/Doxyfile
r245 r300 620 620 # with spaces. 621 621 622 INPUT = src /xmlio622 INPUT = src 623 623 624 624 # This tag can be used to specify the character encoding of the source files -
XMLIO_V2/dev/common/bld.cfg
r291 r300 27 27 bld::lib xios 28 28 bld::target libxios.a 29 bld::target main_server.exe 29 #bld::target main_server.exe test_xios.exe 30 bld::target server_main.exe test_cs.exe 30 31 bld::exe_dep 31 32 … … 43 44 bld::pp false 44 45 bld::excl_dep use::mod_prism_get_comm 46 bld::excl_dep use::mod_prism_get_localcomm_proto 45 47 bld::excl_dep use::mod_prism_proto 46 48 bld::excl_dep inc::mpif.h -
XMLIO_V2/dev/common/src/array.hpp
r219 r300 9 9 /// xmlioserver headers /// 10 10 #include "xmlioserver_spl.hpp" 11 #include "buffer_in.hpp" 12 #include "buffer_out.hpp" 13 11 14 12 15 namespace xmlioserver 13 16 { 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 14 23 /// ////////////////////// Déclarations ////////////////////// /// 15 24 template <typename ValueType, StdSize NumDims, … … 29 38 explicit CArray(const ExtentList & sizes); 30 39 40 explicit CArray(); 41 31 42 template <typename ExtentList> 32 43 CArray(const ExtentList & sizes, const boost::general_storage_order<NumDims> & store); … … 36 47 37 48 public: 38 49 39 50 /// Flux /// 40 51 template <typename U, StdSize V, typename W> … … 51 62 void fromBinary(StdIStream & is); 52 63 64 size_t getSize(void) const ; 65 bool toBuffer (CBufferOut& buffer) const; 66 bool fromBuffer(CBufferIn& buffer); 67 68 53 69 /// Destructeur /// 54 70 virtual ~CArray(void); 55 71 56 72 }; // class CArray 73 57 74 58 75 ///--------------------------------------------------------------- -
XMLIO_V2/dev/common/src/array_impl.hpp
r219 r300 3 3 4 4 #include "array_mac.hpp" 5 #include "buffer_in.hpp" 6 #include "buffer_out.hpp" 5 7 6 8 namespace xmlioserver … … 16 18 { /* Ne rien faire de plus */ } 17 19 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 18 26 template <typename ValueType, StdSize NumDims, typename Allocator> 19 27 template <typename ExtentList> … … 33 41 const CArray<ValueType, NumDims, Allocator> & array) 34 42 { 35 os << (array.data()[0]) << "(" << array.shape()[0];43 os << "CArray (" ; 36 44 for (StdSize i = 1; i < array.num_dimensions(); i++) 37 45 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])<<" "; 39 48 return (os); 40 49 } … … 108 117 is.read (reinterpret_cast<char*>(this->data()), nelem * sizeof(ValueType)); 109 118 } 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 110 174 111 175 ///--------------------------------------------------------------- -
XMLIO_V2/dev/common/src/attribute.cpp
r219 r300 1 1 #include "attribute.hpp" 2 #include "base_type.hpp" 2 3 3 4 namespace xmlioserver … … 7 8 /// ////////////////////// Définitions ////////////////////// /// 8 9 CAttribute::CAttribute(const StdString & id) 9 : CObject(id) 10 : CObject(id), CBaseType() 10 11 , value() 11 12 { /* Ne rien faire de plus */ } 12 13 13 14 CAttribute::CAttribute(const CAttribute & attribut) 14 : CObject(attribut.getId()) 15 : CObject(attribut.getId()),CBaseType() 15 16 { 16 17 this->value = attribut.getAnyValue(); … … 50 51 } 51 52 53 52 54 ///-------------------------------------------------------------- 53 55 54 56 } // 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 55 86 } // namespace xmlioserver -
XMLIO_V2/dev/common/src/attribute.hpp
r219 r300 8 8 #include "xmlioserver_spl.hpp" 9 9 #include "object.hpp" 10 #include "base_type.hpp" 11 #include "message.hpp" 12 #include "buffer_in.hpp" 13 #include "buffer_out.hpp" 10 14 11 15 namespace xmlioserver … … 14 18 { 15 19 /// ////////////////////// Déclarations ////////////////////// /// 16 class CAttribute : public CObject 20 class CAttribute : public CObject, public CBaseType 17 21 { 18 22 typedef CObject SuperClass; … … 29 33 const boost::any & getAnyValue(void) const; 30 34 template <typename T> inline T getValue(void) const; 35 template <typename T> inline T* getRef(void); 31 36 32 37 /// Mutateurs /// … … 54 59 CAttribute(void); // Not implemented. 55 60 56 private :57 58 61 /// Propriété /// 59 62 boost::any value; … … 66 69 { 67 70 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)); 68 77 } 69 78 … … 81 90 82 91 } // 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 84 100 85 101 #endif // __XMLIO_CAttribute__ -
XMLIO_V2/dev/common/src/attribute_template.cpp
r219 r300 99 99 100 100 iss >> d; vect.push_back(d); 101 size = vect.size(); 101 102 if (!iss.eof ()) 102 103 { … … 138 139 array.resize(boost::extents[size]); 139 140 for (int i = 0; i < size; i++) 140 array[i] = vect[i]; 141 array[i] = vect[i]; 141 142 142 143 } -
XMLIO_V2/dev/common/src/attribute_template.hpp
r219 r300 10 10 #include "array.hpp" 11 11 #include "attribute.hpp" 12 #include "buffer_in.hpp" 13 #include "buffer_out.hpp" 14 12 15 13 16 namespace xmlioserver … … 40 43 /// Accesseur /// 41 44 inline ValueType getValue(void) const; 45 inline ValueType* getRef(void) ; 42 46 43 47 /// Mutateurs /// … … 57 61 virtual void fromBinary(StdIStream & is); 58 62 63 virtual bool toBuffer (CBufferOut& buffer) const; 64 virtual bool fromBuffer(CBufferIn& buffer) ; 65 virtual size_t size(void) const; 66 67 59 68 protected : 60 69 -
XMLIO_V2/dev/common/src/attribute_template_impl.hpp
r274 r300 3 3 4 4 #include "array.hpp" 5 #include "type.hpp" 6 #include "buffer_in.hpp" 7 #include "buffer_out.hpp" 5 8 6 9 namespace xmlioserver … … 69 72 70 73 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> 71 86 void CAttributeTemplate<T>::setValue(const T & value) 72 87 { … … 115 130 FromBinary(is, value); 116 131 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 } 117 181 } 118 182 -
XMLIO_V2/dev/common/src/buffer_list.cpp
r286 r300 36 36 if (SuperClass::operator[](i-1).isAvailable(size)) 37 37 { 38 //std::cout << "Données reçues de " << i << std::endl;39 38 CMPIManager::ReceiveCircularBuffer 40 39 (com_client_server, i, SuperClass::operator[](i-1)); … … 51 50 } 52 51 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 61 53 62 54 return (true); … … 67 59 for (StdSize i = 0; i < this->nbbuffer; i++) 68 60 { 69 //std::cout << "Récupération de la requête " << (i+1) << std::endl;70 61 lbuffer.push_back(SuperClass::operator[](i).getNextRequest()); 71 62 } -
XMLIO_V2/dev/common/src/calendar.cpp
r286 r300 54 54 CDate & CCalendar::update(int step) 55 55 { 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; 58 57 return (this->getCurrentDate() = this->getInitDate() + step * this->timestep); 59 58 } -
XMLIO_V2/dev/common/src/circular_buffer.cpp
r219 r300 69 69 this->movePRead(currsize); 70 70 this->nbrequest--; 71 //std::cout << this->nbrequest << std::endl;72 71 73 72 return (CLinearBuffer(SuperClass::getData(startpos), currsize)); -
XMLIO_V2/dev/common/src/configure.hpp
r219 r300 2 2 #define __XMLIO_Configure__ 3 3 4 /// xmlioserver headers ///5 #include "xmlioserver_spl.hpp"6 4 7 5 /// /////////// Macros /////////// /// -
XMLIO_V2/dev/common/src/data_treatment.cpp
r286 r300 38 38 // Mise à jour cÃŽté client 39 39 this->currentContext->getCalendar()->update(step); 40 // std::cout << "current date : " << this->currentContext->getCalendar()->getCurrentDate() << std::endl;41 40 if (CXIOSManager::GetStatus() == CXIOSManager::LOC_CLIENT) 42 41 { // Mise à jour cÃŽté serveur … … 118 117 119 118 // Résolution des héritages pour le context actuel. 120 //std::cout << "(Message temporaire) Résolution des héritages ..." << std::endl;121 119 this->solveAllInheritance(); 122 120 123 121 //Initialisation du vecteur 'enabledFiles' contenant la liste des fichiers à sortir. 124 //std::cout << "(Message temporaire) Initialisation du vecteur enabledFiles ..." << std::endl;125 122 this->findEnabledFiles(); 126 123 127 124 //Recherche des champs à sortir (enable à true + niveau de sortie correct) 128 125 // pour chaque fichier précédemment listé. 129 //std::cout << "(Message temporaire) Recherche des champs à sortir ..." << std::endl;130 126 this->findAllEnabledFields(); 131 127 132 128 // 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;134 129 this->solveAllGridRef(); 135 130 … … 140 135 CContext::CleanTree(); 141 136 142 //std::cout << "(Message temporaire) fin traitement sorties ..." << std::endl;143 137 } 144 138 -
XMLIO_V2/dev/common/src/data_treatment.hpp
r286 r300 113 113 114 114 boost::shared_ptr<io::CDataOutput> dout(new T(oss.str(), false,comm_server,multifile)); 115 file->initializeDataOutput(dout);115 // file->initializeDataOutput(dout); 116 116 } 117 117 } … … 149 149 boost::shared_ptr<CField> field = *it; 150 150 boost::shared_ptr<CFile> file = field->getRelFile(); 151 if (field->updateData( currDate, timestep,data))151 if (field->updateData(data)) 152 152 { 153 153 if (CXIOSManager::GetStatus() == CXIOSManager::LOC_CLIENT) 154 154 { 155 155 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());158 156 client->sendData(field->getId(), file->getId(), field->getData()); 159 157 } -
XMLIO_V2/dev/common/src/fortran/file_interface.f90
r286 r300 58 58 END SUBROUTINE cxios_file_valid_id 59 59 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 60 67 END INTERFACE 61 68 -
XMLIO_V2/dev/common/src/fortran/filegroup_interface.f90
r286 r300 58 58 END SUBROUTINE cxios_filegroup_valid_id 59 59 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 60 67 END INTERFACE 61 68 -
XMLIO_V2/dev/common/src/fortran/icaxis.cpp
r286 r300 31 31 32 32 axis_hdl->name.setValue(name_str); 33 axis_hdl->sendAttributToServer(axis_hdl->name) ; 33 34 } 34 35 … … 39 40 if (!cstr2string(standard_name, standard_name_size, standard_name_str)) return; 40 41 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 } 43 45 44 46 void cxios_set_axis_long_name … … 49 51 50 52 axis_hdl->long_name.setValue(long_name_str); 53 axis_hdl->sendAttributToServer(axis_hdl->long_name) ; 51 54 } 52 55 … … 58 61 59 62 axis_hdl->unit.setValue(unit_str); 63 axis_hdl->sendAttributToServer(axis_hdl->unit) ; 60 64 } 61 65 … … 63 67 { 64 68 axis_hdl->size.setValue(size); 69 axis_hdl->sendAttributToServer(axis_hdl->size) ; 65 70 } 66 71 … … 72 77 73 78 axis_hdl->zvalue.setValue(zvalue_val); 79 axis_hdl->sendAttributToServer(axis_hdl->zvalue) ; 74 80 75 81 } … … 84 90 85 91 axisgroup_hdl->name.setValue(name_str); 92 axisgroup_hdl->sendAttributToServer(axisgroup_hdl->name) ; 86 93 } 87 94 … … 93 100 94 101 axisgroup_hdl->standard_name.setValue(standard_name_str); 102 axisgroup_hdl->sendAttributToServer(axisgroup_hdl->standard_name) ; 95 103 } 96 104 … … 102 110 103 111 axisgroup_hdl->long_name.setValue(long_name_str); 112 axisgroup_hdl->sendAttributToServer(axisgroup_hdl->long_name) ; 104 113 } 105 114 … … 111 120 112 121 axisgroup_hdl->unit.setValue(unit_str); 122 axisgroup_hdl->sendAttributToServer(axisgroup_hdl->unit) ; 113 123 } 114 124 … … 116 126 { 117 127 axisgroup_hdl->size.setValue(size); 128 axisgroup_hdl->sendAttributToServer(axisgroup_hdl->size) ; 118 129 } 119 130 … … 125 136 126 137 axisgroup_hdl->zvalue.setValue(zvalue_val); 138 axisgroup_hdl->sendAttributToServer(axisgroup_hdl->zvalue) ; 127 139 } 128 140 -
XMLIO_V2/dev/common/src/fortran/iccontext.cpp
r286 r300 33 33 std::string calendar_type_str; 34 34 if (!cstr2string(calendar_type, calendar_type_size, calendar_type_str)) return; 35 36 35 context_hdl->calendar_type.setValue(calendar_type_str); 36 context_hdl->sendAttributToServer(context_hdl->calendar_type) ; 37 37 } 38 38 … … 43 43 44 44 context_hdl->start_date.setValue(start_date_str); 45 context_hdl->sendAttributToServer(context_hdl->start_date) ; 45 46 } 46 47 … … 51 52 52 53 context_hdl->output_dir.setValue(output_dir_str); 54 context_hdl->sendAttributToServer(context_hdl->output_dir) ; 53 55 } 54 56 -
XMLIO_V2/dev/common/src/fortran/icdata.cpp
r286 r300 19 19 #include "mpi_manager.hpp" 20 20 #include "buffer.hpp" 21 #include "cxios.hpp" 22 #include "client_ym.hpp" 23 #include "field.hpp" 21 24 22 25 extern "C" … … 31 34 32 35 // -------------------- 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 33 86 34 87 void cxios_dtreatment_start() … … 60 113 MPI_Request request = 0; 61 114 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 82 116 CTreeManager::ToBinary(ostrs); 83 117 CLinearBuffer lbuffer(ostrs.str().size()+CBuffer::getDataHeaderSize()); … … 172 206 ARRAY(double, 1) data(new CArray<double, 1>(boost::extents [data_Xsize])); 173 207 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) ; 175 211 } 176 212 … … 188 224 ARRAY(double, 2) data(new CArray<double, 2>(boost::extents [data_Xsize][data_Ysize])); 189 225 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) ; 191 228 } 192 229 … … 204 241 ARRAY(double, 3) data(new CArray<double, 3>(boost::extents [data_Xsize][data_Ysize][data_Zsize])); 205 242 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 207 246 } 208 247 … … 218 257 // boost::extents [data_Xsize], 219 258 // 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) ; 223 266 } 224 267 … … 234 277 // boost::extents [data_Xsize][data_Ysize], 235 278 // 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) ; 239 286 } 240 287 … … 250 297 // boost::extents [data_Xsize][data_Ysize][data_Zsize], 251 298 // 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 } 256 307 257 308 } // extern "C" -
XMLIO_V2/dev/common/src/fortran/icdate.cpp
r286 r300 29 29 xmlioserver::CObjectFactory::GetObject<xmlioserver::tree::CContext> 30 30 (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 39 32 context->timestep.setValue(dur.toString()); 40 context->getCalendar()->setTimeStep(dur); 41 } 33 context->sendAttributToServer("timestep") ; 42 34 } 43 35 catch (xmlioserver::CException & exc) … … 50 42 void cxios_update_calendar(int step) 51 43 { 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> 56 46 (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 65 50 } 66 51 -
XMLIO_V2/dev/common/src/fortran/icdomain.cpp
r286 r300 31 31 32 32 domain_hdl->name.setValue(name_str); 33 domain_hdl->sendAttributToServer(domain_hdl->name) ; 33 34 } 34 35 … … 39 40 40 41 domain_hdl->standard_name.setValue(standard_name_str); 42 domain_hdl->sendAttributToServer(domain_hdl->standard_name) ; 41 43 } 42 44 … … 47 49 48 50 domain_hdl->long_name.setValue(long_name_str); 51 domain_hdl->sendAttributToServer(domain_hdl->long_name) ; 49 52 } 50 53 … … 55 58 56 59 domain_hdl->domain_group_ref.setValue(domain_group_ref_str); 60 domain_hdl->sendAttributToServer(domain_hdl->domain_group_ref) ; 57 61 } 58 62 … … 60 64 { 61 65 domain_hdl->ni_glo.setValue(ni_glo); 66 domain_hdl->sendAttributToServer(domain_hdl->ni_glo) ; 62 67 } 63 68 … … 65 70 { 66 71 domain_hdl->nj_glo.setValue(nj_glo); 72 domain_hdl->sendAttributToServer(domain_hdl->nj_glo) ; 67 73 } 68 74 … … 70 76 { 71 77 domain_hdl->ibegin.setValue(ibegin); 78 domain_hdl->sendAttributToServer(domain_hdl->ibegin) ; 72 79 } 73 80 … … 75 82 { 76 83 domain_hdl->iend.setValue(iend); 84 domain_hdl->sendAttributToServer(domain_hdl->iend) ; 77 85 } 78 86 … … 80 88 { 81 89 domain_hdl->ni.setValue(ni); 90 domain_hdl->sendAttributToServer(domain_hdl->ni) ; 82 91 } 83 92 … … 85 94 { 86 95 domain_hdl->jbegin.setValue(jbegin); 96 domain_hdl->sendAttributToServer(domain_hdl->jbegin) ; 87 97 } 88 98 … … 90 100 { 91 101 domain_hdl->jend.setValue(jend); 102 domain_hdl->sendAttributToServer(domain_hdl->jend) ; 92 103 } 93 104 … … 95 106 { 96 107 domain_hdl->nj.setValue(nj); 108 domain_hdl->sendAttributToServer(domain_hdl->nj) ; 97 109 } 98 110 … … 103 115 104 116 domain_hdl->mask.setValue(mask_val); 117 domain_hdl->sendAttributToServer(domain_hdl->mask) ; 105 118 } 106 119 … … 108 121 { 109 122 domain_hdl->data_dim.setValue(data_dim); 123 domain_hdl->sendAttributToServer(domain_hdl->data_dim) ; 110 124 } 111 125 … … 113 127 { 114 128 domain_hdl->data_ni.setValue(data_ni); 129 domain_hdl->sendAttributToServer(domain_hdl->data_ni) ; 115 130 } 116 131 … … 118 133 { 119 134 domain_hdl->data_nj.setValue(data_nj); 135 domain_hdl->sendAttributToServer(domain_hdl->data_nj) ; 120 136 } 121 137 … … 123 139 { 124 140 domain_hdl->data_ibegin.setValue(data_ibegin); 141 domain_hdl->sendAttributToServer(domain_hdl->data_ibegin) ; 125 142 } 126 143 … … 128 145 { 129 146 domain_hdl->data_jbegin.setValue(data_jbegin); 147 domain_hdl->sendAttributToServer(domain_hdl->data_jbegin) ; 130 148 } 131 149 … … 133 151 { 134 152 domain_hdl->zoom_ni.setValue(zoom_ni); 153 domain_hdl->sendAttributToServer(domain_hdl->zoom_ni) ; 135 154 } 136 155 … … 138 157 { 139 158 domain_hdl->zoom_nj.setValue(zoom_nj); 159 domain_hdl->sendAttributToServer(domain_hdl->zoom_nj) ; 140 160 } 141 161 … … 143 163 { 144 164 domain_hdl->zoom_ibegin.setValue(zoom_ibegin); 165 domain_hdl->sendAttributToServer(domain_hdl->zoom_ibegin) ; 145 166 } 146 167 … … 148 169 { 149 170 domain_hdl->zoom_jbegin.setValue(zoom_jbegin); 171 domain_hdl->sendAttributToServer(domain_hdl->zoom_jbegin) ; 150 172 } 151 173 … … 153 175 { 154 176 domain_hdl->zoom_ni_loc.setValue(zoom_ni_loc); 177 domain_hdl->sendAttributToServer(domain_hdl->zoom_ni_loc) ; 155 178 } 156 179 … … 158 181 { 159 182 domain_hdl->zoom_nj_loc.setValue(zoom_nj_loc); 183 domain_hdl->sendAttributToServer(domain_hdl->zoom_nj_loc) ; 160 184 } 161 185 … … 163 187 { 164 188 domain_hdl->zoom_ibegin_loc.setValue(zoom_ibegin_loc); 189 domain_hdl->sendAttributToServer(domain_hdl->zoom_ibegin_loc) ; 165 190 } 166 191 … … 168 193 { 169 194 domain_hdl->zoom_jbegin_loc.setValue(zoom_jbegin_loc); 195 domain_hdl->sendAttributToServer(domain_hdl->zoom_jbegin_loc) ; 170 196 } 171 197 … … 173 199 { 174 200 domain_hdl->data_n_index.setValue(data_n_index); 201 domain_hdl->sendAttributToServer(domain_hdl->data_n_index) ; 175 202 } 176 203 … … 181 208 182 209 domain_hdl->data_i_index.setValue(data_i_index_val); 210 domain_hdl->sendAttributToServer(domain_hdl->data_i_index) ; 183 211 } 184 212 … … 189 217 190 218 domain_hdl->data_j_index.setValue(data_j_index_val); 219 domain_hdl->sendAttributToServer(domain_hdl->data_j_index) ; 191 220 } 192 221 … … 197 226 198 227 domain_hdl->lonvalue.setValue(lonvalue_val); 228 domain_hdl->sendAttributToServer(domain_hdl->lonvalue) ; 199 229 } 200 230 … … 205 235 206 236 domain_hdl->latvalue.setValue(latvalue_val); 237 domain_hdl->sendAttributToServer(domain_hdl->latvalue) ; 207 238 } 208 239 209 // -------------------- Attributs des groupes d 'axes------------------------240 // -------------------- Attributs des groupes de domaine ------------------------ 210 241 211 242 … … 216 247 217 248 domaingroup_hdl->name.setValue(name_str); 249 domaingroup_hdl->sendAttributToServer(domaingroup_hdl->name) ; 250 218 251 } 219 252 … … 224 257 225 258 domaingroup_hdl->standard_name.setValue(standard_name_str); 259 domaingroup_hdl->sendAttributToServer(domaingroup_hdl->standard_name) ; 226 260 } 227 261 … … 232 266 233 267 domaingroup_hdl->long_name.setValue(long_name_str); 268 domaingroup_hdl->sendAttributToServer(domaingroup_hdl->long_name) ; 234 269 } 235 270 … … 240 275 241 276 domaingroup_hdl->domain_group_ref.setValue(domain_group_ref_str); 277 domaingroup_hdl->sendAttributToServer(domaingroup_hdl->domain_group_ref) ; 242 278 } 243 279 … … 245 281 { 246 282 domaingroup_hdl->ni_glo.setValue(ni_glo); 283 domaingroup_hdl->sendAttributToServer(domaingroup_hdl->ni_glo) ; 247 284 } 248 285 … … 250 287 { 251 288 domaingroup_hdl->nj_glo.setValue(nj_glo); 289 domaingroup_hdl->sendAttributToServer(domaingroup_hdl->nj_glo) ; 252 290 } 253 291 … … 255 293 { 256 294 domaingroup_hdl->ibegin.setValue(ibegin); 295 domaingroup_hdl->sendAttributToServer(domaingroup_hdl->ibegin) ; 257 296 } 258 297 … … 260 299 { 261 300 domaingroup_hdl->iend.setValue(iend); 301 domaingroup_hdl->sendAttributToServer(domaingroup_hdl->iend) ; 262 302 } 263 303 … … 265 305 { 266 306 domaingroup_hdl->ni.setValue(ni); 307 domaingroup_hdl->sendAttributToServer(domaingroup_hdl->ni) ; 267 308 } 268 309 … … 270 311 { 271 312 domaingroup_hdl->jbegin.setValue(jbegin); 313 domaingroup_hdl->sendAttributToServer(domaingroup_hdl->jbegin) ; 272 314 } 273 315 … … 275 317 { 276 318 domaingroup_hdl->jend.setValue(jend); 319 domaingroup_hdl->sendAttributToServer(domaingroup_hdl->jend) ; 277 320 } 278 321 … … 280 323 { 281 324 domaingroup_hdl->nj.setValue(nj); 325 domaingroup_hdl->sendAttributToServer(domaingroup_hdl->nj) ; 282 326 } 283 327 … … 288 332 289 333 domaingroup_hdl->mask.setValue(mask_val); 334 domaingroup_hdl->sendAttributToServer(domaingroup_hdl->mask) ; 290 335 } 291 336 … … 293 338 { 294 339 domaingroup_hdl->data_dim.setValue(data_dim); 340 domaingroup_hdl->sendAttributToServer(domaingroup_hdl->data_dim) ; 295 341 } 296 342 … … 298 344 { 299 345 domaingroup_hdl->data_ni.setValue(data_ni); 346 domaingroup_hdl->sendAttributToServer(domaingroup_hdl->data_ni) ; 300 347 } 301 348 … … 303 350 { 304 351 domaingroup_hdl->data_nj.setValue(data_nj); 352 domaingroup_hdl->sendAttributToServer(domaingroup_hdl->data_nj) ; 305 353 } 306 354 … … 308 356 { 309 357 domaingroup_hdl->data_ibegin.setValue(data_ibegin); 358 domaingroup_hdl->sendAttributToServer(domaingroup_hdl->data_ibegin) ; 310 359 } 311 360 … … 313 362 { 314 363 domaingroup_hdl->data_jbegin.setValue(data_jbegin); 364 domaingroup_hdl->sendAttributToServer(domaingroup_hdl->data_jbegin) ; 315 365 } 316 366 … … 318 368 { 319 369 domaingroup_hdl->zoom_ni.setValue(zoom_ni); 370 domaingroup_hdl->sendAttributToServer(domaingroup_hdl->zoom_ni) ; 320 371 } 321 372 … … 323 374 { 324 375 domaingroup_hdl->zoom_nj.setValue(zoom_nj); 376 domaingroup_hdl->sendAttributToServer(domaingroup_hdl->zoom_nj) ; 325 377 } 326 378 … … 328 380 { 329 381 domaingroup_hdl->zoom_ibegin.setValue(zoom_ibegin); 382 domaingroup_hdl->sendAttributToServer(domaingroup_hdl->zoom_ibegin) ; 330 383 } 331 384 … … 333 386 { 334 387 domaingroup_hdl->zoom_jbegin.setValue(zoom_jbegin); 388 domaingroup_hdl->sendAttributToServer(domaingroup_hdl->zoom_jbegin) ; 335 389 } 336 390 … … 338 392 { 339 393 domaingroup_hdl->zoom_ni_loc.setValue(zoom_ni_loc); 394 domaingroup_hdl->sendAttributToServer(domaingroup_hdl->zoom_ni_loc) ; 340 395 } 341 396 … … 343 398 { 344 399 domaingroup_hdl->zoom_nj_loc.setValue(zoom_nj_loc); 400 domaingroup_hdl->sendAttributToServer(domaingroup_hdl->zoom_nj_loc) ; 345 401 } 346 402 … … 348 404 { 349 405 domaingroup_hdl->zoom_ibegin_loc.setValue(zoom_ibegin_loc); 406 domaingroup_hdl->sendAttributToServer(domaingroup_hdl->zoom_ibegin_loc) ; 350 407 } 351 408 … … 353 410 { 354 411 domaingroup_hdl->zoom_jbegin_loc.setValue(zoom_jbegin_loc); 412 domaingroup_hdl->sendAttributToServer(domaingroup_hdl->zoom_jbegin_loc) ; 355 413 } 356 414 … … 358 416 { 359 417 domaingroup_hdl->data_n_index.setValue(data_n_index); 418 domaingroup_hdl->sendAttributToServer(domaingroup_hdl->data_n_index) ; 360 419 } 361 420 … … 366 425 367 426 domaingroup_hdl->data_i_index.setValue(data_i_index_val); 427 domaingroup_hdl->sendAttributToServer(domaingroup_hdl->data_i_index) ; 368 428 } 369 429 … … 374 434 375 435 domaingroup_hdl->data_j_index.setValue(data_j_index_val); 436 domaingroup_hdl->sendAttributToServer(domaingroup_hdl->data_j_index) ; 376 437 } 377 438 … … 382 443 383 444 domaingroup_hdl->lonvalue.setValue(lonvalue_val); 445 domaingroup_hdl->sendAttributToServer(domaingroup_hdl->lonvalue) ; 384 446 } 385 447 … … 390 452 391 453 domaingroup_hdl->latvalue.setValue(latvalue_val); 454 domaingroup_hdl->sendAttributToServer(domaingroup_hdl->latvalue) ; 392 455 } 393 456 -
XMLIO_V2/dev/common/src/fortran/icfield.cpp
r286 r300 31 31 32 32 field_hdl->name.setValue(name_str); 33 field_hdl->sendAttributToServer(field_hdl->name) ; 33 34 } 34 35 … … 39 40 40 41 field_hdl->standard_name.setValue(standard_name_str); 42 field_hdl->sendAttributToServer(field_hdl->standard_name) ; 41 43 } 42 44 … … 47 49 48 50 field_hdl->long_name.setValue(long_name_str); 51 field_hdl->sendAttributToServer(field_hdl->long_name) ; 49 52 } 50 53 … … 55 58 56 59 field_hdl->unit.setValue(unit_str); 60 field_hdl->sendAttributToServer(field_hdl->unit) ; 61 57 62 } 58 63 … … 63 68 64 69 field_hdl->operation.setValue(operation_str); 70 field_hdl->sendAttributToServer(field_hdl->operation) ; 65 71 } 66 72 … … 71 77 72 78 field_hdl->freq_op.setValue(freq_op_str); 79 field_hdl->sendAttributToServer(field_hdl->freq_op) ; 73 80 } 74 81 … … 76 83 { 77 84 field_hdl->level.setValue(level); 85 field_hdl->sendAttributToServer(field_hdl->level) ; 78 86 } 79 87 … … 81 89 { 82 90 field_hdl->prec.setValue(prec); 91 field_hdl->sendAttributToServer(field_hdl->prec) ; 83 92 } 84 93 … … 86 95 { 87 96 field_hdl->enabled.setValue(enabled); 97 field_hdl->sendAttributToServer(field_hdl->enabled) ; 88 98 } 89 99 … … 94 104 95 105 field_hdl->domain_ref.setValue(domain_ref_str); 106 field_hdl->sendAttributToServer(field_hdl->domain_ref) ; 96 107 } 97 108 … … 102 113 103 114 field_hdl->axis_ref.setValue(axis_ref_str); 115 field_hdl->sendAttributToServer(field_hdl->axis_ref) ; 104 116 } 105 117 … … 110 122 111 123 field_hdl->grid_ref.setValue(grid_ref_str); 124 field_hdl->sendAttributToServer(field_hdl->grid_ref) ; 112 125 } 113 126 … … 118 131 119 132 field_hdl->field_ref.setValue(field_ref_str); 133 field_hdl->sendAttributToServer(field_hdl->field_ref) ; 120 134 } 121 135 … … 123 137 { 124 138 field_hdl->default_value.setValue(default_value); 139 field_hdl->sendAttributToServer(field_hdl->default_value) ; 125 140 } 126 141 … … 133 148 134 149 fieldgroup_hdl->name.setValue(name_str); 150 fieldgroup_hdl->sendAttributToServer(fieldgroup_hdl->name); 135 151 } 136 152 … … 141 157 142 158 fieldgroup_hdl->standard_name.setValue(standard_name_str); 159 fieldgroup_hdl->sendAttributToServer(fieldgroup_hdl->standard_name); 143 160 } 144 161 … … 149 166 150 167 fieldgroup_hdl->long_name.setValue(long_name_str); 168 fieldgroup_hdl->sendAttributToServer(fieldgroup_hdl->long_name); 151 169 } 152 170 … … 157 175 158 176 fieldgroup_hdl->unit.setValue(unit_str); 177 fieldgroup_hdl->sendAttributToServer(fieldgroup_hdl->unit); 159 178 } 160 179 … … 165 184 166 185 fieldgroup_hdl->operation.setValue(operation_str); 186 fieldgroup_hdl->sendAttributToServer(fieldgroup_hdl->operation); 167 187 } 168 188 … … 173 193 174 194 fieldgroup_hdl->freq_op.setValue(freq_op_str); 195 fieldgroup_hdl->sendAttributToServer(fieldgroup_hdl->freq_op); 175 196 } 176 197 … … 178 199 { 179 200 fieldgroup_hdl->level.setValue(level); 201 fieldgroup_hdl->sendAttributToServer(fieldgroup_hdl->level); 180 202 } 181 203 … … 183 205 { 184 206 fieldgroup_hdl->prec.setValue(prec); 207 fieldgroup_hdl->sendAttributToServer(fieldgroup_hdl->prec); 185 208 } 186 209 … … 188 211 { 189 212 fieldgroup_hdl->enabled.setValue(enabled); 213 fieldgroup_hdl->sendAttributToServer(fieldgroup_hdl->enabled); 190 214 } 191 215 … … 196 220 197 221 fieldgroup_hdl->domain_ref.setValue(domain_ref_str); 222 fieldgroup_hdl->sendAttributToServer(fieldgroup_hdl->domain_ref); 198 223 } 199 224 … … 204 229 205 230 fieldgroup_hdl->axis_ref.setValue(axis_ref_str); 231 fieldgroup_hdl->sendAttributToServer(fieldgroup_hdl->axis_ref); 206 232 } 207 233 … … 212 238 213 239 fieldgroup_hdl->grid_ref.setValue(grid_ref_str); 240 fieldgroup_hdl->sendAttributToServer(fieldgroup_hdl->grid_ref); 214 241 } 215 242 … … 220 247 221 248 fieldgroup_hdl->field_ref.setValue(field_ref_str); 249 fieldgroup_hdl->sendAttributToServer(fieldgroup_hdl->field_ref); 222 250 } 223 251 … … 225 253 { 226 254 fieldgroup_hdl->default_value.setValue(default_value); 255 fieldgroup_hdl->sendAttributToServer(fieldgroup_hdl->default_value); 227 256 } 228 257 -
XMLIO_V2/dev/common/src/fortran/icfile.cpp
r286 r300 31 31 32 32 file_hdl->name.setValue(name_str); 33 file_hdl->sendAttributToServer(file_hdl->name) ; 33 34 } 34 35 … … 39 40 40 41 file_hdl->description.setValue(description_str); 42 file_hdl->sendAttributToServer(file_hdl->description) ; 41 43 } 42 44 … … 47 49 48 50 file_hdl->name_suffix.setValue(name_suffix_str); 51 file_hdl->sendAttributToServer(file_hdl->name_suffix) ; 49 52 } 50 53 … … 55 58 56 59 file_hdl->output_freq.setValue(output_freq_str); 60 file_hdl->sendAttributToServer(file_hdl->output_freq) ; 57 61 } 58 62 … … 60 64 { 61 65 file_hdl->output_level.setValue(output_level); 66 file_hdl->sendAttributToServer(file_hdl->output_level) ; 62 67 } 63 68 … … 65 70 { 66 71 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) ; 67 82 } 68 83 … … 73 88 std::string name_str; 74 89 if (!cstr2string(name, name_size, name_str)) return; 75 if (!cstr2string(name, name_size, name_str)) return;76 90 77 91 filegroup_hdl->name.setValue(name_str); 92 filegroup_hdl->sendAttributToServer(filegroup_hdl->name) ; 78 93 } 79 94 … … 84 99 85 100 filegroup_hdl->description.setValue(description_str); 101 filegroup_hdl->sendAttributToServer(filegroup_hdl->description) ; 86 102 } 87 103 … … 92 108 93 109 filegroup_hdl->name_suffix.setValue(name_suffix_str); 110 filegroup_hdl->sendAttributToServer(filegroup_hdl->name_suffix) ; 94 111 } 95 112 … … 100 117 101 118 filegroup_hdl->output_freq.setValue(output_freq_str); 119 filegroup_hdl->sendAttributToServer(filegroup_hdl->output_freq) ; 102 120 } 103 121 … … 105 123 { 106 124 filegroup_hdl->output_level.setValue(output_level); 125 filegroup_hdl->sendAttributToServer(filegroup_hdl->output_level) ; 107 126 } 108 127 … … 110 129 { 111 130 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) ; 112 141 } 113 142 -
XMLIO_V2/dev/common/src/fortran/icgrid.cpp
r286 r300 31 31 32 32 grid_hdl->name.setValue(name_str); 33 grid_hdl->sendAttributToServer(name_str) ; 33 34 } 34 35 … … 39 40 40 41 grid_hdl->description.setValue(description_str); 42 grid_hdl->sendAttributToServer(description_str) ; 41 43 } 42 44 … … 47 49 48 50 grid_hdl->domain_ref.setValue(domain_ref_str); 51 grid_hdl->sendAttributToServer(domain_ref_str) ; 49 52 } 50 53 … … 55 58 56 59 grid_hdl->axis_ref.setValue(axis_ref_str); 60 grid_hdl->sendAttributToServer(axis_ref_str) ; 57 61 } 58 62 … … 65 69 66 70 gridgroup_hdl->name.setValue(name_str); 71 gridgroup_hdl->sendAttributToServer(gridgroup_hdl->name) ; 67 72 } 68 73 … … 73 78 74 79 gridgroup_hdl->description.setValue(description_str); 80 gridgroup_hdl->sendAttributToServer(gridgroup_hdl->description) ; 75 81 } 76 82 … … 81 87 82 88 gridgroup_hdl->domain_ref.setValue(domain_ref_str); 89 gridgroup_hdl->sendAttributToServer(gridgroup_hdl->domain_ref) ; 83 90 } 84 91 … … 89 96 90 97 gridgroup_hdl->axis_ref.setValue(axis_ref_str); 98 gridgroup_hdl->sendAttributToServer(gridgroup_hdl->axis_ref) ; 91 99 } 92 100 -
XMLIO_V2/dev/common/src/fortran/icxml_tree.cpp
r286 r300 43 43 { 44 44 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 } 53 57 54 58 void cxios_xml_tree_add_grid … … 56 60 { 57 61 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 } 65 72 } 66 73 … … 69 76 { 70 77 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 } 78 88 } 79 89 … … 82 92 { 83 93 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 } 91 104 } 92 105 … … 95 108 { 96 109 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 } 104 120 } 105 121 … … 108 124 { 109 125 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 } 120 137 } 121 138 … … 125 142 (XFieldGroupPtr parent_, XFieldGroupPtr * child_, const char * child_id, int child_id_size) 126 143 { 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 } 135 156 } 136 157 … … 139 160 { 140 161 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 } 148 173 } 149 174 … … 152 177 { 153 178 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 } 161 189 } 162 190 … … 165 193 { 166 194 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 } 174 205 } 175 206 … … 178 209 { 179 210 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 } 187 221 } 188 222 … … 191 225 { 192 226 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 } 203 238 } 204 239 -
XMLIO_V2/dev/common/src/fortran/idata.F90
r286 r300 7 7 INTERFACE ! Ne pas appeler directement/Interface FORTRAN 2003 <-> C99 8 8 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 9 36 SUBROUTINE cxios_init_ioserver(comm_client,comm_parent) BIND(C) 10 37 USE ISO_C_BINDING … … 15 42 SUBROUTINE cxios_finalize_ioserver BIND(C) 16 43 END SUBROUTINE cxios_finalize_ioserver 44 45 SUBROUTINE cxios_finalize BIND(C) 46 END SUBROUTINE cxios_finalize 17 47 18 48 SUBROUTINE cxios_dtreatment_start() BIND(C) … … 80 110 CONTAINS ! Fonctions disponibles pour les utilisateurs. 81 111 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) 84 118 IMPLICIT NONE 85 119 INCLUDE 'mpif.h' 86 INTEGER, INTENT(OUT),OPTIONAL :: return_comm87 INTEGER, INTENT(IN),OPTIONAL :: local_comm88 89 INTEGER :: comm_client90 INTEGER :: comm_parent91 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 92 126 IF (PRESENT(local_comm)) THEN 93 comm_parent=local_comm127 f_local_comm=local_comm 94 128 ELSE 95 comm_parent=MPI_COMM_WORLD129 f_local_comm = MPI_COMM_NULL 96 130 ENDIF 97 131 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 103 149 SUBROUTINE xios(finalize) 104 150 IMPLICIT NONE 105 151 106 CALL cxios_finalize _ioserver152 CALL cxios_finalize 107 153 108 154 END SUBROUTINE xios(finalize) … … 111 157 SUBROUTINE xios(close_context_definition)() 112 158 IMPLICIT NONE 113 CALL cxios_ dtreatment_start()159 CALL cxios_context_close_definition() 114 160 END SUBROUTINE xios(close_context_definition) 115 161 … … 117 163 SUBROUTINE xios(context_finalize)() 118 164 IMPLICIT NONE 119 CALL cxios_ dtreatment_end()165 CALL cxios_context_finalize() 120 166 END SUBROUTINE xios(context_finalize) 121 167 -
XMLIO_V2/dev/common/src/fortran/idate.F90
r286 r300 19 19 20 20 TYPE txios(time) 21 REAL(kind = 8) :: year , month, day, hour, minute, second21 REAL(kind = 8) :: year=0, month=0, day=0, hour=0, minute=0, second=0 22 22 END TYPE txios(time) 23 23 -
XMLIO_V2/dev/common/src/fortran/ifile.F90
r286 r300 35 35 36 36 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) 38 38 IMPLICIT NONE 39 39 TYPE(txios(file)) :: file_hdl … … 45 45 INTEGER , OPTIONAL, INTENT(IN) :: output_level 46 46 LOGICAL , OPTIONAL, INTENT(IN) :: enabled 47 47 CHARACTER(len = *), OPTIONAL, INTENT(IN) :: type 48 48 49 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) 50 51 51 52 END SUBROUTINE xios(set_file_attr) 52 53 53 54 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) 55 56 TYPE(txios(file)) , INTENT(IN) :: file_hdl 56 57 CHARACTER(len = *), OPTIONAL, INTENT(IN) :: name … … 60 61 INTEGER , OPTIONAL, INTENT(IN) :: output_level 61 62 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) 64 66 65 67 END SUBROUTINE xios(set_file_attr_hdl) 66 68 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_) 68 70 TYPE(txios(file)) , INTENT(IN) :: file_hdl 69 71 CHARACTER(len = *), OPTIONAL, INTENT(IN) :: name_ … … 74 76 LOGICAL(kind = 1) :: enabled__ 75 77 LOGICAL , OPTIONAL, INTENT(IN) :: enabled_ 76 78 CHARACTER(len = *), OPTIONAL, INTENT(IN) :: type_ 79 77 80 IF (PRESENT(name_)) THEN 78 81 CALL cxios_set_file_name(file_hdl%daddr, name_, len(name_)) … … 94 97 CALL cxios_set_file_enabled(file_hdl%daddr, enabled__) 95 98 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 97 104 END SUBROUTINE xios(set_file_attr_hdl_) 98 105 99 106 100 107 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) 102 109 IMPLICIT NONE 103 110 TYPE(txios(filegroup)) :: filegroup_hdl … … 109 116 INTEGER , OPTIONAL, INTENT(IN) :: output_level 110 117 LOGICAL , OPTIONAL, INTENT(IN) :: enabled 118 CHARACTER(len = *), OPTIONAL, INTENT(IN) :: type 111 119 112 120 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) 114 122 115 123 END SUBROUTINE xios(set_filegroup_attr) 116 124 117 125 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) 119 127 IMPLICIT NONE 120 128 TYPE(txios(filegroup)) , INTENT(IN) :: filegroup_hdl … … 125 133 INTEGER , OPTIONAL, INTENT(IN) :: output_level 126 134 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) 129 138 130 139 END SUBROUTINE xios(set_filegroup_attr_hdl) 131 140 132 141 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_) 134 144 IMPLICIT NONE 135 145 TYPE(txios(filegroup)) , INTENT(IN) :: filegroup_hdl … … 141 151 LOGICAL(kind = 1) :: enabled__ 142 152 LOGICAL , OPTIONAL, INTENT(IN) :: enabled_ 153 CHARACTER(len = *), OPTIONAL, INTENT(IN) :: type_ 143 154 144 155 IF (PRESENT(name_)) THEN … … 160 171 enabled__ = enabled_ 161 172 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_)) 162 177 END IF 163 178 -
XMLIO_V2/dev/common/src/fortran/ixios.F90
r286 r300 8 8 xios(is_valid_context) 9 9 10 USE idata, ONLY : xios(initialize), xios(finalize), xios(close_context_definition), & 10 USE idata, ONLY : xios(initialize),xios(init_server), xios(finalize), xios(context_initialize), & 11 xios(close_context_definition), & 11 12 xios(context_finalize), xios(send_field_r8_1d), xios(send_field_r8_2d), & 12 13 xios(send_field_r8_3d), xios(send_field_r4_1d), xios(send_field_r4_2d), & … … 40 41 xios(add_fieldtofile), xios(add_axisgroup), xios(add_filegroup), xios(add_gridgroup), & 41 42 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)46 43 47 44 … … 85 82 86 83 PUBLIC :: xios(get_handle) 84 PUBLIC :: xios(add_child) 87 85 88 86 PUBLIC :: xios(is_valid_context),xios(is_valid_domain), xios(is_valid_domaingroup),xios(is_valid_field), & … … 92 90 PUBLIC :: xios(set_current_context) 93 91 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) 95 94 96 95 END MODULE XIOS -
XMLIO_V2/dev/common/src/fortran/oasis_cinterface.cpp
r286 r300 16 16 } 17 17 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 19 26 void oasis_get_intracomm(MPI_Comm& comm_client_server,const std::string& server_id) 20 27 { … … 24 31 comm_client_server=MPI_Comm_f2c(f_comm) ; 25 32 } 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 } 27 41 } -
XMLIO_V2/dev/common/src/fortran/oasis_cinterface.hpp
r286 r300 9 9 void fxios_oasis_init(const char* server_id,int str_len) ; 10 10 void fxios_oasis_finalize(void) ; 11 void fxios_oasis_get_localcomm(MPI_Fint* f_comm) ; 11 12 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) ; 12 14 } 13 15 … … 16 18 void oasis_init(const std::string& server_id) ; 17 19 void oasis_finalize(void) ; 20 void oasis_get_localcomm(MPI_Comm& comm) ; 18 21 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) ; 19 23 } 20 24 #endif -
XMLIO_V2/dev/common/src/fortran/oasis_interface.F90
r286 r300 39 39 40 40 41 SUBROUTINE 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 57 END SUBROUTINE fxios_oasis_get_localcomm 58 59 60 61 41 62 SUBROUTINE fxios_oasis_get_intracomm(f_comm_client_server,client_id,str_len) BIND(C,NAME="fxios_oasis_get_intracomm") 42 63 USE, INTRINSIC :: ISO_C_BINDING … … 61 82 CALL prism_get_intracomm(comm_client_server,oasis_client_id,ierr) 62 83 #endif 63 PRINT *,"---> prism_get_intracomm ",oasis_client_id,comm_client_server,ierr 84 64 85 f_comm_client_server=comm_client_server 65 86 66 87 END SUBROUTINE fxios_oasis_get_intracomm 88 89 SUBROUTINE 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 114 END SUBROUTINE fxios_oasis_get_intercomm -
XMLIO_V2/dev/common/src/group_template.hpp
r274 r300 2 2 #define __XMLIO_CGroupTemplate__ 3 3 4 #include "xmlioserver_spl.hpp" 4 5 #include "declare_attribute.hpp" 6 #include "event_server.hpp" 7 #include "object_template.hpp" 5 8 6 9 namespace xmlioserver … … 23 26 24 27 public : 28 29 enum EEventId 30 { 31 EVENT_ID_CREATE_CHILD=200, EVENT_ID_CREATE_CHILD_GROUP 32 } ; 25 33 26 34 /// Spécifique /// … … 55 63 virtual void solveDescInheritance(const CAttributeMap * const parent = 0); 56 64 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 58 78 /// Destructeur /// 59 79 virtual ~CGroupTemplate(void); … … 82 102 } // namespace xmlioserver 83 103 104 //#include "group_template_impl.hpp" 105 84 106 #endif // __XMLIO_CGroupTemplate__ -
XMLIO_V2/dev/common/src/group_template_impl.hpp
r219 r300 1 1 #ifndef __XMLIO_CGroupTemplate_impl__ 2 2 #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 3 12 4 13 namespace xmlioserver … … 307 316 void CGroupTemplate<U, V, W>::solveRefInheritance(void) 308 317 { /* 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 // } 310 342 ///-------------------------------------------------------------- 311 343 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 312 465 } // namespace xmlioserver 313 466 -
XMLIO_V2/dev/common/src/main_server.cpp
r286 r300 14 14 15 15 16 16 17 // Point d'entrée du programme principal 17 18 … … 26 27 CTreeManager::SetCurrentContextId(StdString("xios")); 27 28 boost::shared_ptr<CVariable> var = CObjectFactory::GetObject<CVariable>("buffer_client_size"); 28 std::cout<<CObjectFactory::GetObject<CVariable>("xios","using_oasis")->getData<bool>()<<std::endl;29 29 30 30 // oasis_init(std::string("ionemo")) ; 31 // std::cout<<"Initialisation OASIS Ok"<<std::endl ;32 31 // oasis_get_intracomm(comm_parent,std::string("oceanx")) ; 33 // std::cout<<"Appel Oasis intracom Ok"<<std::endl ;34 32 CXIOSManager::Initialise(CXIOSManager::CLIENT_SERVER, &argc, &argv); 35 33 36 std::cout<<"Appel Dispatch client ?"<<std::endl ;37 std::cout<<comm_client<<" "<<comm_client_server<<" "<<comm_server<<" "<<comm_parent<<std::endl ;38 34 CMPIManager::DispatchClient(true, comm_client, comm_client_server, comm_server, comm_parent); 39 std::cout<<"Appel Dispatch client Ok"<<std::endl ;40 35 CXIOSManager::RunServer("Nemo", comm_client_server, comm_server); 41 36 CTreeManager::SetCurrentContextId(StdString("nemo")); -
XMLIO_V2/dev/common/src/manager/xios_manager.cpp
r286 r300 126 126 if (CMPIManager::IsMaster(comm_client_server)) 127 127 { 128 std::cout << " *************************************** " << std::endl129 << " * XmlIOServer (Client/Server) * " << std::endl130 << " *************************************** " << 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;139 128 140 129 xios_map<StdString, XIOSClient>::iterator … … 145 134 { 146 135 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 158 138 } 159 139 -
XMLIO_V2/dev/common/src/node/axis.cpp
r219 r300 4 4 #include "object_template_impl.hpp" 5 5 #include "group_template_impl.hpp" 6 #include "transfert_parameters.hpp" 6 7 7 8 namespace xmlioserver { -
XMLIO_V2/dev/common/src/node/context.cpp
r286 r300 1 1 #include "context.hpp" 2 3 2 #include "tree_manager.hpp" 4 3 … … 11 10 12 11 #include "data_treatment.hpp" 12 #include "context_client.hpp" 13 #include "context_server.hpp" 14 #include "nc4_data_output.hpp" 13 15 14 16 namespace xmlioserver { … … 19 21 CContext::CContext(void) 20 22 : CObjectTemplate<CContext>(), CContextAttributes() 21 , calendar() 23 , calendar(),hasClient(false),hasServer(false) 22 24 { /* Ne rien faire de plus */ } 23 25 24 26 CContext::CContext(const StdString & id) 25 27 : CObjectTemplate<CContext>(id), CContextAttributes() 26 , calendar() 28 , calendar(),hasClient(false),hasServer(false) 27 29 { /* Ne rien faire de plus */ } 28 30 29 31 CContext::~CContext(void) 30 { /* Ne rien faire de plus */ } 32 { 33 if (hasClient) delete client ; 34 if (hasServer) delete server ; 35 } 31 36 32 37 //---------------------------------------------------------------- … … 299 304 } 300 305 ///--------------------------------------------------------------- 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 302 581 } // namespace tree 303 582 } // namespace xmlioserver -
XMLIO_V2/dev/common/src/node/context.hpp
r219 r300 8 8 9 9 #include "declare_group.hpp" 10 //#include "context_client.hpp" 11 //#include "context_server.hpp" 12 #include "data_output.hpp" 13 14 #include <mpi.h> 10 15 11 16 namespace xmlioserver { … … 16 21 17 22 namespace xmlioserver { 23 class CContextClient ; 24 class CContextServer ; 25 18 26 namespace tree { 19 27 … … 22 30 class CContextAttributes; 23 31 class CContext; 24 32 25 33 ///-------------------------------------------------------------- 26 34 … … 36 44 , public CContextAttributes 37 45 { 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 38 53 /// typedef /// 39 54 typedef CObjectTemplate<CContext> SuperClass; … … 90 105 /// Test /// 91 106 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) ; 92 138 93 139 public : … … 100 146 virtual void fromBinary(StdIStream & is); 101 147 102 p rivate:148 public : 103 149 104 150 boost::shared_ptr<date::CCalendar> calendar; 105 151 boost::shared_ptr<data::CDataTreatment> datat; 152 153 std::vector<boost::shared_ptr<CFile> > enabledFiles; 154 106 155 107 156 }; // class CContext -
XMLIO_V2/dev/common/src/node/domain.cpp
r286 r300 8 8 9 9 #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" 12 14 13 15 namespace xmlioserver { … … 21 23 , ibegin_sub(), iend_sub(), jbegin_sub(), jend_sub() 22 24 , 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>()) 24 27 { /* Ne rien faire de plus */ } 25 28 … … 29 32 , ibegin_sub(), iend_sub(), jbegin_sub(), jend_sub() 30 33 , 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>()) 32 36 { /* Ne rien faire de plus */ } 33 37 … … 61 65 bool CDomain::isEmpty(void) const 62 66 { 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)); 65 69 } 66 70 … … 258 262 } 259 263 260 //~ std::cout << "-------------------" << std::endl261 //~ << "zoom : " << std::boolalpha << this->hasZoom() << std::endl262 //~ << "size : " << ni.getValue() << " X " << nj.getValue() << std::endl263 //~ << "it : " << ibegin.getValue() << ", " << iend.getValue() << std::endl264 //~ << "jt : " << jbegin.getValue() << ", " << jend.getValue() << std::endl265 //~ << "im : " << ibegin_mask << ", " << iend_mask << std::endl266 //~ << "jm : " << jbegin_mask << ", " << jend_mask << std::endl267 //~ << "-------------------" << std::endl;268 264 269 265 if (!mask.isEmpty()) … … 498 494 jbegin_zoom_srv = zoom_jbegin_loc.getValue(); 499 495 500 /*std::cout << "Rang du serveur :" << comm::CMPIManager::GetCommRank() << std::endl501 << "Begin serv : " << ibegin_serv << ", " << jbegin_serv << std::endl502 << "End serv : " << iend_serv << ", " << jend_serv << std::endl503 << "Zoom_loc begin : " << zoom_ibegin_loc << ", " << zoom_jbegin_loc << std::endl504 << "Zoom_loc size : " << zoom_ni_loc << ", " << zoom_nj_loc << std::endl;*/505 496 506 497 if (this->data_dim.getValue() == 2) … … 647 638 { 648 639 if (this->isChecked) return; 640 shared_ptr<CContext> context=CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId()) ; 649 641 650 642 this->checkGlobalDomain(); … … 653 645 654 646 this->checkZoom(); 655 656 if ( this->latvalue_sub.size() == 0)647 648 if (context->hasClient) 657 649 { // CÃŽté client uniquement 658 650 this->checkMask(); … … 678 670 this->completeLonLatClient(); 679 671 // } 672 this->completeMask(); 673 680 674 } 681 675 else 682 676 { // CÃŽté serveur uniquement 683 677 // 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 688 688 this->isChecked = true; 689 689 } 690 690 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 } 691 989 //---------------------------------------------------------------- 692 990 -
XMLIO_V2/dev/common/src/node/domain.hpp
r286 r300 7 7 8 8 #include "declare_group.hpp" 9 #include "event_client.hpp" 10 #include "event_server.hpp" 11 #include "buffer_in.hpp" 9 12 10 13 namespace xmlioserver { … … 30 33 , public CDomainAttributes 31 34 { 35 enum EEventId 36 { 37 EVENT_ID_SERVER_ATTRIBUT, EVENT_ID_LON_LAT 38 } ; 39 32 40 /// typedef /// 33 41 typedef CObjectTemplate<CDomain> SuperClass; … … 91 99 bool isEmpty(void) const; 92 100 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 93 121 public : 94 122 … … 97 125 void completeLonLatServer(void); 98 126 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) ; 99 135 100 136 /// Destructeur /// … … 117 153 std::vector<int> ibegin_zoom_sub, jbegin_zoom_sub, ni_zoom_sub, nj_zoom_sub; 118 154 std::vector<ARRAY(double, 1)> lonvalue_sub, latvalue_sub; 155 119 156 120 157 }; // class CDomain -
XMLIO_V2/dev/common/src/node/field.cpp
r286 r300 73 73 return (false); 74 74 } 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 } 76 190 //---------------------------------------------------------------- 77 191 … … 232 346 233 347 StdString id = this->getBaseFieldReference()->getId(); 234 boost::shared_ptr<CContext> _context =348 boost::shared_ptr<CContext> context = 235 349 CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId()); 236 350 … … 252 366 } 253 367 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 = 257 372 CDuration::FromString(this->file->output_freq.getValue()); 258 this->freq_write =373 this->freq_write_srv = 259 374 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)); 266 381 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) 271 387 { 272 388 this->freq_operation = CDuration::FromString(freq_op.getValue()); 273 389 this->freq_write = CDuration::FromString(this->file->output_freq.getValue()); 274 390 this->last_Write = boost::shared_ptr<xmlioserver::date::CDate> 275 (new date::CDate( _context->getCalendar()->getInitDate()));391 (new date::CDate(context->getCalendar()->getInitDate())); 276 392 this->last_operation = boost::shared_ptr<xmlioserver::date::CDate> 277 (new date::CDate( _context->getCalendar()->getInitDate()));393 (new date::CDate(context->getCalendar()->getInitDate())); 278 394 279 const CDuration toffset = this->freq_operation - freq_offset_ - _context->getCalendar()->getTimeStep();395 const CDuration toffset = this->freq_operation - freq_offset_ - context->getCalendar()->getTimeStep(); 280 396 *this->last_operation = *this->last_operation - toffset; 281 397 … … 409 525 } 410 526 } 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 } 412 545 ///------------------------------------------------------------------- 413 546 -
XMLIO_V2/dev/common/src/node/field.hpp
r286 r300 11 11 #include "declare_group.hpp" 12 12 #include "calendar_util.hpp" 13 //#include "context.hpp" 14 13 15 14 16 namespace xmlioserver { … … 23 25 class CFile; 24 26 class CGrid; 25 27 class CContext ; 26 28 ///-------------------------------------------------------------- 27 29 … … 48 50 typedef CFieldGroup RelGroup; 49 51 52 enum EEventId 53 { 54 EVENT_ID_UPDATE_DATA 55 } ; 56 50 57 /// Constructeurs /// 51 58 CField(void); … … 82 89 void incrementNStep(void); 83 90 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 90 93 bool updateDataServer 91 94 (const date::CDate & currDate, 92 95 const std::deque<ARRAY(double, 1)> storedClient); 93 94 public :96 97 public : 95 98 96 99 /// Test /// … … 112 115 113 116 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 : 116 128 117 129 /// Propriétés privées /// … … 123 135 124 136 date::CDuration freq_operation, freq_write; 137 date::CDuration freq_operation_srv, freq_write_srv; 125 138 126 139 StdSize nstep; 127 140 boost::shared_ptr<date::CDate> last_Write, last_operation; 141 boost::shared_ptr<date::CDate> last_Write_srv, last_operation_srv; 142 128 143 boost::shared_ptr<func::CFunctor> foperation; 144 map<int,boost::shared_ptr<func::CFunctor> > foperation_srv; 129 145 130 146 ARRAY(double, 1) data; 147 map<int,ARRAY(double,1)> data_srv ; 131 148 132 149 }; // class CField … … 153 170 154 171 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) 156 182 { 183 shared_ptr<CContext> context=CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId()) ; 184 const date::CDate & currDate = context->getCalendar()->getCurrentDate(); 157 185 const date::CDate opeDate = *last_operation + freq_operation; 158 186 const date::CDate writeDate = *last_Write + freq_write; 159 187 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;167 188 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 170 192 if (opeDate <= currDate) 171 193 { 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()) 174 195 { 175 this->data->resize(boost::extents[this->grid->storeIndex [0]->num_elements()]);196 this->data->resize(boost::extents[this->grid->storeIndex_client ->num_elements()]); 176 197 } 177 198 … … 181 202 182 203 *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; 184 205 } 185 206 … … 187 208 { 188 209 this->foperation->final(); 189 this->incrementNStep();190 210 *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() ; 192 213 return (true); 193 214 } 194 // std::cout << "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" << std::endl; 215 195 216 return (false); 196 } ;217 } 197 218 198 219 } // namespace tree -
XMLIO_V2/dev/common/src/node/file.cpp
r286 r300 7 7 #include "object_factory.hpp" 8 8 #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 9 14 10 15 namespace xmlioserver { … … 16 21 : CObjectTemplate<CFile>(), CFileAttributes() 17 22 , vFieldGroup(), data_out(), enabledFields() 18 { /* Ne rien faire de plus */}23 { setVirtualFieldGroup() ;} 19 24 20 25 CFile::CFile(const StdString & id) 21 26 : CObjectTemplate<CFile>(id), CFileAttributes() 22 27 , vFieldGroup(), data_out(), enabledFields() 23 { /* Ne rien faire de plus */}28 { setVirtualFieldGroup() ;} 24 29 25 30 CFile::~CFile(void) … … 62 67 this->enabledFields = this->getAllFields(); 63 68 64 std::cout<<"---> File :"<<this->name.getValue()<<std::endl ; 69 std::vector<boost::shared_ptr<CField> > newEnabledFields; 70 65 71 for ( it = this->enabledFields.begin() ; it != this->enabledFields.end(); it++ ) 66 72 { 67 73 if (!(*it)->enabled.isEmpty()) // Si l'attribut 'enabled' est défini ... 68 74 { 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; } 71 77 } 72 78 else // Si l'attribut 'enabled' n'est pas défini ... 73 79 { 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; } 76 82 } 77 83 78 84 if (!(*it)->level.isEmpty()) // Si l'attribut 'level' est défini ... 79 85 { 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; } 82 88 } 83 89 else // Si l'attribut 'level' n'est pas défini ... 84 90 { 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) ; 89 99 // Le champ est finalement actif, on y ajoute sa propre reference. 90 100 (*it)->refObject.push_back(*it); 91 101 // 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 ;93 102 (*it)->setRelFile(CObjectFactory::GetObject(this)); 94 103 (*it)->baseRefObject->refObject.push_back(*it); 95 104 // A faire, ajouter les references intermediaires... 96 105 } 106 enabledFields=newEnabledFields ; 97 107 98 108 return (this->enabledFields); … … 108 118 //---------------------------------------------------------------- 109 119 110 void CFile::setVirtualFieldGroup( const StdString & newVFieldGroupId)120 void CFile::setVirtualFieldGroup(void) 111 121 { 112 122 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 123 131 std::vector<boost::shared_ptr<CField> >::iterator it, end = this->enabledFields.end(); 124 132 133 AllDomainEmpty=true ; 125 134 for (it = this->enabledFields.begin() ;it != end; it++) 126 135 { 127 136 boost::shared_ptr<CField> field = *it; 128 this->data_out->writeFieldGrid(field);137 AllDomainEmpty&=field->grid->domain->isEmpty() ; 129 138 } 130 131 for (it = this->enabledFields.begin() ;it != end; it++)139 140 if (!AllDomainEmpty || type.getValue()=="one_file") 132 141 { 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(); 135 183 } 136 137 this->data_out->definition_end();138 184 } 139 185 140 186 void CFile::close(void) 141 187 { 142 this->data_out->closeFile(); 188 if (!AllDomainEmpty || type.getValue()=="one_file") 189 this->data_out->closeFile(); 143 190 } 144 191 //---------------------------------------------------------------- … … 150 197 { // Si la définition du fichier intégre des champs et si le fichier est identifié. 151 198 node.goToParentElement(); 152 this->setVirtualFieldGroup(this->getId());199 // this->setVirtualFieldGroup(this->getId()); 153 200 this->getVirtualFieldGroup()->parse(node, false); 154 201 } … … 234 281 << "[ renum = " << renum << "] Bad type !"); 235 282 236 this->setVirtualFieldGroup(this->getId());283 // this->setVirtualFieldGroup(this->getId()); 237 284 if (hasVFG)this->getVirtualFieldGroup()->fromBinary(is); 238 285 239 286 } 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 241 404 ///--------------------------------------------------------------- 242 405 -
XMLIO_V2/dev/common/src/node/file.hpp
r286 r300 5 5 #include "xmlioserver_spl.hpp" 6 6 #include "field.hpp" 7 #include "data_output.hpp" 7 8 #include "declare_group.hpp" 8 9 9 #include "data_output.hpp" 10 10 11 11 12 namespace xmlioserver { … … 34 35 typedef CObjectTemplate<CFile> SuperClass; 35 36 typedef CFileAttributes SuperClassAttribute; 36 37 37 38 public : 38 39 enum EEventId 40 { 41 EVENT_ID_ADD_FIELD=0,EVENT_ID_ADD_FIELD_GROUP 42 } ; 43 39 44 typedef CFileAttributes RelAttributes; 40 45 typedef CFileGroup RelGroup; … … 60 65 /// Mutateurs /// 61 66 void setVirtualFieldGroup(boost::shared_ptr<CFieldGroup> newVFieldGroup); 62 void setVirtualFieldGroup( const StdString & newVFieldGroupId);67 void setVirtualFieldGroup(void); 63 68 64 void initializeDataOutput(boost::shared_ptr<io::CDataOutput> dout);69 void createHeader(void); 65 70 void close(void) ; 66 71 … … 86 91 87 92 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) ; 88 104 89 105 private : -
XMLIO_V2/dev/common/src/node/grid.cpp
r286 r300 160 160 { 161 161 if (this->isChecked) return; 162 shared_ptr<CContext> context=CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId()) ; 163 CContextClient* client=context->client ; 164 162 165 this->solveDomainRef() ; 163 166 this->solveAxisRef() ; 164 if ( this->storeIndex.size() == 1)167 if (context->hasClient) 165 168 { 166 169 … … 176 179 this->out_l_index.push_front(out_l_index_); 177 180 } 178 this->computeIndexServer();181 // this->computeIndexServer(); 179 182 this->isChecked = true; 180 183 } … … 225 228 size = (this->hasAxis()) ? axis->size.getValue() : 1 ; 226 229 227 /*std::cout << ni << " : "228 << nj << " : "229 << size << std::endl;*/230 230 231 231 const int data_dim = domain->data_dim.getValue() , … … 238 238 data_j_index = domain->data_j_index.getValue() ; 239 239 240 /*std::cout << data_n_index << " : "241 << data_i_index << " : "242 << data_j_index << std::endl; */243 240 244 241 ARRAY(bool, 2) mask = domain->mask.getValue() ; … … 265 262 } 266 263 267 //std::cout << indexCount << std::endl;268 264 ARRAY_ASSIGN(this->storeIndex[0] , int, 1, [indexCount]); 269 265 ARRAY_ASSIGN(this->out_l_index[0], int, 1, [indexCount]); … … 271 267 ARRAY_ASSIGN(this->out_j_index[0], int, 1, [indexCount]); 272 268 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 278 274 279 275 for(int count = 0, indexCount = 0, l = 0; l < size; l++) … … 296 292 (*this->out_i_index[0])[indexCount] = i ; 297 293 (*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 ; 298 299 indexCount++ ; 299 300 } 300 301 } 301 302 } 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 319 306 } 320 307 … … 345 332 //---------------------------------------------------------------- 346 333 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] ; 385 360 } 386 361 387 362 //---------------------------------------------------------------- 363 388 364 389 365 void CGrid::storeField_arr 390 366 (const double * const data, ARRAY(double, 1) stored) const 391 367 { 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 394 370 stored->resize(boost::extents[size]) ; 395 371 for(StdSize i = 0; i < size; i++) 396 (*stored)[i] = data[(*storeIndex [0])[i]] ;372 (*stored)[i] = data[(*storeIndex_client)[i]] ; 397 373 } 398 374 … … 442 418 443 419 //--------------------------------------------------------------- 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 445 536 void CGrid::computeIndexServer(void) 446 537 { … … 468 559 const int jend_zoom_srv = jbegin_zoom_srv + zoom_nj_srv-1 ; 469 560 470 // std::cout<<"----> computeIndexServer !!"<<std::endl ;471 561 StdSize dn = 0; 472 562 for (StdSize j = 1; j < this->out_i_index.size(); j++) … … 503 593 } 504 594 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 ;512 595 513 596 if (comm::CMPIManager::IsClient()) … … 517 600 (*storeIndex_srv)[n] = (*storeIndex_cl)[m]; // Faux mais inutile dans le cas serveur. 518 601 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];524 602 (*out_i_index_srv)[n] = (*out_i_index_cl)[m] + ibegin_cl - 1 - (ibegin_srv + ibegin_zoom_srv - 1) + 1 ; 525 603 (*out_j_index_srv)[n] = (*out_j_index_cl)[m] + jbegin_cl - 1 - (jbegin_srv + jbegin_zoom_srv - 1) + 1 ; … … 542 620 543 621 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;547 622 } 548 623 … … 558 633 *std::max_element(out_j_index_srv->begin(), out_j_index_srv->end()); 559 634 560 // std::cout<< "[ grille = " << this->getId()561 // << ", ibegin_t = " << ibegin_t562 // << ", jbegin_t = " << jbegin_t563 // << ", iend_t = " << iend_t564 // << ", jend_t = " << jend_t565 // << ", zoom_ni_srv = " << zoom_ni_srv566 // << ", zoom_nj_srv = " << zoom_nj_srv567 // << ", nb subdomain = " << out_i_index.size()-1<<std::endl ;568 635 569 636 if ((ibegin_t < 0) || (jbegin_t < 0) || … … 623 690 } 624 691 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 } 625 700 ///--------------------------------------------------------------- 626 701 -
XMLIO_V2/dev/common/src/node/grid.hpp
r286 r300 41 41 typedef CGridGroup RelGroup; 42 42 43 enum EEventId 44 { 45 EVENT_ID_INDEX 46 } ; 47 43 48 /// Constructeurs /// 44 49 CGrid(void); … … 81 86 void inputFieldServer(const std::deque<ARRAY(double, 1)> storedClient, 82 87 ARRAY(double, 1) storedServer) const; 83 88 /* 84 89 template <StdSize n> 85 90 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 87 96 /// Destructeur /// 88 97 virtual ~CGrid(void); … … 102 111 CreateGrid(boost::shared_ptr<CDomain> domain, boost::shared_ptr<CAxis> axis); 103 112 104 p rotected:113 public : 105 114 106 115 /// Entrées-sorties de champs (interne) /// … … 113 122 void solveAxisRef(void); 114 123 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 115 130 public: 116 131 … … 126 141 std::deque<ARRAY(int, 1)> out_j_index ; 127 142 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 129 158 }; // class CGrid 130 159 -
XMLIO_V2/dev/common/src/node/node_enum.hpp
r219 r300 2 2 #define __XMLIO_NODE_ENUM__ 3 3 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_ 6 6 7 7 namespace xmlioserver … … 12 12 typedef enum _node_type 13 13 { 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 15 22 16 #include "node_type.conf"23 //#include "node_type.conf" 17 24 18 25 } ENodeType; -
XMLIO_V2/dev/common/src/node/variable.cpp
r274 r300 102 102 subdata = content.substr ( begindata, enddata-begindata); 103 103 104 //std::cout << "\"" << subid << "\":\"" << subdata << "\"" << std::endl;105 104 CGroupFactory::CreateChild(group_ptr, subid)->content = subdata; 106 105 } -
XMLIO_V2/dev/common/src/object_factory_impl.hpp
r286 r300 86 86 << "[ id = " << id << ", U = " << U::GetName() <<", context = "<<context<< " ] " 87 87 << " object is not referenced !"); 88 return (U::AllMapObj[ CObjectFactory::CurrContext][id]);88 return (U::AllMapObj[context][id]); 89 89 } 90 90 -
XMLIO_V2/dev/common/src/object_template.hpp
r286 r300 6 6 #include "attribute_map.hpp" 7 7 #include "node_enum.hpp" 8 #include "buffer_in.hpp" 9 #include "event_server.hpp" 10 #include "attribute.hpp" 8 11 9 12 namespace xmlioserver … … 23 26 typedef CObject SuperClass; 24 27 typedef T DerivedType; 28 29 enum EEventId 30 { 31 EVENT_ID_SEND_ATTRIBUTE=100 32 } ; 25 33 26 34 public : … … 46 54 /// Traitement statique /// 47 55 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) ; 48 60 49 61 /// Accesseur statique /// … … 53 65 /// Destructeur /// 54 66 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 56 73 protected : 57 74 … … 77 94 } // namespace xmlioserver 78 95 96 //#include "object_template_impl.hpp" 97 79 98 #endif // __XMLIO_CObjectTemplate__ -
XMLIO_V2/dev/common/src/object_template_impl.hpp
r286 r300 1 1 #ifndef __XMLIO_CObjectTemplate_impl__ 2 2 #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" 3 12 4 13 namespace xmlioserver … … 137 146 } 138 147 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 141 242 } // namespace xmlioserver 142 243 -
XMLIO_V2/dev/common/src/output/nc4_data_output.cpp
r292 r300 10 10 #include "xios_manager.hpp" 11 11 #include "context.hpp" 12 #include "context_server.hpp" 12 13 13 14 namespace xmlioserver … … 58 59 void CNc4DataOutput::writeDomain_(const boost::shared_ptr<tree::CDomain> domain) 59 60 { 61 shared_ptr<CContext> context=CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId()) ; 62 CContextServer* server=context->server ; 63 60 64 if (domain->IsWritten(this->filename)) return; 61 65 domain->checkAttributes(); 62 66 63 // if (domain->isEmpty()) return; 67 if (domain->isEmpty()) 68 if (SuperClass::type==MULTI_FILE) return ; 64 69 65 70 std::vector<StdString> dim0, dim1; … … 68 73 StdString lonid = StdString("lon_").append(domid); 69 74 StdString latid = StdString("lat_").append(domid); 70 StdString lonid_loc = ( comm::CMPIManager::GetCommSize(CXIOSManager::Comm_Server)> 1)75 StdString lonid_loc = (server->intraCommSize > 1) 71 76 ? StdString("lon_").append(domid).append("_local") 72 77 : lonid; 73 StdString latid_loc = ( comm::CMPIManager::GetCommSize(CXIOSManager::Comm_Server)> 1)78 StdString latid_loc = (server->intraCommSize > 1) 74 79 ? StdString("lat_").append(domid).append("_local") 75 80 : 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 82 88 83 89 switch (SuperClass::type) … … 85 91 case (MULTI_FILE) : 86 92 { 87 if (domain->isEmpty()) return;93 // if (domain->isEmpty()) return; 88 94 89 if ( comm::CMPIManager::GetCommSize(CXIOSManager::Comm_Server)> 1)95 if (server->intraCommSize > 1) 90 96 { 91 97 SuperClassWriter::addDimension(lonid, domain->zoom_ni.getValue()); … … 105 111 } 106 112 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, 115 121 domid); 116 122 } … … 135 141 dim0.push_back(lonid_loc); 136 142 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 } 148 155 149 156 //SuperClassWriter::setDefaultValue(maskid, &dvm); 150 157 151 158 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); 156 162 SuperClassWriter::definition_start(); 157 163 … … 195 201 else 196 202 { 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 ; 199 205 } 200 206 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); 203 209 SuperClassWriter::definition_start(); 204 210 … … 265 271 void CNc4DataOutput::writeField_(const boost::shared_ptr<tree::CField> field) 266 272 { 273 shared_ptr<CContext> context=CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId()) ; 274 CContextServer* server=context->server ; 275 267 276 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; 272 279 273 280 if (domain->isEmpty()) … … 279 286 StdString lonid = StdString("lon_").append(domid); 280 287 StdString latid = StdString("lat_").append(domid); 281 StdString lonid_loc = ( comm::CMPIManager::GetCommSize(CXIOSManager::Comm_Server)> 1)288 StdString lonid_loc = (server->intraCommSize > 1) 282 289 ? StdString("lon_").append(domid).append("_local") 283 290 : lonid; 284 StdString latid_loc = ( comm::CMPIManager::GetCommSize(CXIOSManager::Comm_Server)> 1)291 StdString latid_loc = (server->intraCommSize > 1) 285 292 ? StdString("lat_").append(domid).append("_local") 286 293 : latid; … … 288 295 ? field->name.getValue() : field->getBaseFieldReference()->getId(); 289 296 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 293 301 nc_type type = (!field->prec.isEmpty() && 294 302 ( field->prec.getValue() == 4)) … … 309 317 if (!grid->axis_ref.isEmpty()) 310 318 { 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(); 315 321 dims.push_back(axisid); 316 322 coodinates.push_back(axisid); … … 425 431 void CNc4DataOutput::closeFile_ (void) 426 432 { 427 std::cout<<"--> Close file "<<filename<<std::endl ;428 433 SuperClassWriter::close() ; 429 434 } … … 449 454 void CNc4DataOutput::writeFieldData_ (const boost::shared_ptr<tree::CField> field) 450 455 { 451 boost::shared_ptr<CGrid> grid =452 CObjectFactory::GetObject<CGrid>(field->grid_ref.getValue()); 453 boost::shared_ptr<C Domain> 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 ; 455 460 456 461 if(SuperClass::type==MULTI_FILE) if (domain->isEmpty()) return; 457 462 458 463 459 StdString fieldid = (!field->name.isEmpty()) 464 StdString fieldid = (!field->name.isEmpty()) 460 465 ? field->name.getValue() 461 466 : field->getBaseFieldReference()->getId(); 462 boost::shared_ptr<xmlioserver::tree::CContext> context =463 CObjectFactory::GetObject<xmlioserver::tree::CContext>464 (CObjectFactory::GetCurrentContextId());465 467 466 468 StdOStringStream oss; … … 468 470 << "_" << field->getRelFile()->output_freq.getValue(); 469 471 470 ARRAY(double, 1) field_data = field->getData();472 // ARRAY(double, 1) field_data = field->data_srv; 471 473 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); 473 475 474 476 if (grid->hasAxis()) // 3D 475 477 { 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); 479 481 switch (SuperClass::type) 480 482 { … … 497 499 { 498 500 // 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(); 501 503 } 502 504 SuperClassWriter::writeData(field_data3D, fieldid, true, field->getNStep()-1,&start,&count ); … … 509 511 else // 2D 510 512 { 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); 513 515 switch (SuperClass::type) 514 516 { … … 530 532 else 531 533 { 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 ; 534 536 } 537 535 538 SuperClassWriter::writeData(field_data2D, fieldid, true, field->getNStep()-1,&start,&count); 536 539 SuperClassWriter::writeData(time_data, oss.str(), true, field->getNStep()-1); -
XMLIO_V2/dev/common/src/output/onetcdf4.cpp
r286 r300 255 255 dimids.push_back(this->getDimension(dimid)); 256 256 } 257 std::cout<<"--> Var "<<name.c_str()<<std::endl ;258 257 CheckError(nc_def_var (grpid, name.c_str(), type, dimids.size(), &(dimids[0]), &retvalue)); 259 258 return (retvalue); … … 346 345 } 347 346 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;355 347 } 356 348 -
XMLIO_V2/dev/common/src/server.cpp
r286 r300 5 5 #include "duration.hpp" 6 6 #include "data_treatment.hpp" 7 #include "group_template.hpp" 7 8 #include "group_template_impl.hpp" 8 9 … … 62 63 if (((managerId_ != managerId) || (methodId_ != methodId) || (nbargs_ != nbargs)) && (i != 0 )) 63 64 { 64 //std::cout << managerId_ << "<->" << managerId << std::endl65 // << methodId_ << "<->" << methodId << std::endl66 // << nbargs_ << "<->" << nbargs << std::endl;67 65 ERROR("CServer::run(void)", << "[" << i << "] Les requêtes ne sont pas synchronisées !"); 68 66 } … … 77 75 { 78 76 case (0) : 79 // std::cout<<"--> Request initialize()"<<std::endl ;80 77 this->initialize(); 81 78 continue; 82 79 case (1) : 83 // std::cout<<"--> Request finalize()"<<std::endl ;84 80 this->finalize(); 85 81 return; …