Changeset 277


Ignore:
Timestamp:
09/20/11 18:10:41 (13 years ago)
Author:
hozdoba
Message:
 
Location:
XMLIO_V2/dev/dev_rv
Files:
1 added
12 edited

Legend:

Unmodified
Added
Removed
  • XMLIO_V2/dev/dev_rv/src/xmlio/attribute_map.cpp

    r206 r277  
    9696                                                   it != attributes.end(); 
    9797                                                   it ++) 
     98         { 
    9899            if ((*it).first.compare(StdString("id")) != 0 && 
    99100                (*it).first.compare(StdString("src"))!= 0) 
     
    102103               CAttributeMap::operator[]((*it).first)->fromString((*it).second); 
    103104            } 
     105         } 
    104106      } 
    105107       
  • XMLIO_V2/dev/dev_rv/src/xmlio/group_factory.hpp

    r152 r277  
    1010#include "object_factory.hpp" 
    1111#include "group_template.hpp" 
     12#include "xml_parser.hpp" 
    1213 
    1314namespace xmlioserver 
  • XMLIO_V2/dev/dev_rv/src/xmlio/group_parser.hpp

    r152 r277  
    1313 
    1414      StdString name = node.getElementName(); 
     15      xml::THashAttributes attributes = node.getAttributes(); 
    1516      if (withAttr) 
     17      { 
    1618         CGroupTemplate<U, V, W>::SuperClass::parse(node); 
     19         if (attributes.end() != attributes.find("src")) 
     20         { 
     21            StdIFStream ifs ( attributes["src"].c_str() , StdIFStream::in ); 
     22            if (!ifs.good()) 
     23               ERROR("CGroupTemplate<U, V, W>::parse(xml::CXMLNode & node, bool withAttr)", 
     24                     << "[ filename = " << attributes["src"] << " ] Bad xml stream !"); 
     25            xml::CXMLParser::ParseInclude(ifs, *this); 
     26         } 
     27      } 
    1728 
    1829      // PARSING POUR GESTION DES ENFANTS 
    19       xml::THashAttributes attributes; 
    2030      boost::shared_ptr<V> group_ptr = (this->hasId()) 
    2131         ? CObjectFactory::GetObject<V>(this->getId()) 
     
    6171                  << "\' ne peut contenir qu'un objet de type \'" << V::GetName() 
    6272                  << "\' ou de type \'" << U::GetName() 
    63                   << "\' !"); 
     73                  << "\' (reçu : " << name << ") !"); 
    6474 
    6575         } while (node.goToNextElement()); 
  • XMLIO_V2/dev/dev_rv/src/xmlio/main_server.cpp

    r276 r277  
    3535         CMPIManager ::DispatchClient(false, comm_client, comm_client_server,  comm_server); 
    3636         CTreeManager::ParseFile("iodef.xml"); 
     37         CTreeManager::SetCurrentContextId("context1"); 
    3738         boost::shared_ptr<CContext> context = 
    3839             CObjectFactory::GetObject<CContext>("context1"); 
    3940         xios_set_timestep(0, 0, 0, 1, 0, 0); 
    4041         xios_dtreatment_start(context.get(), 0, comm_client_server, -1); 
     42 
    4143         for (int i = 0; i < 200; i++) 
    4244         { 
  • XMLIO_V2/dev/dev_rv/src/xmlio/node/context.cpp

    r276 r277  
    107107 
    108108      // PARSING POUR GESTION DES ENFANTS 
    109       xml::THashAttributes attributes; 
     109      xml::THashAttributes attributes = node.getAttributes(); 
     110 
     111      if (attributes.end() != attributes.find("src")) 
     112      { 
     113         StdIFStream ifs ( attributes["src"].c_str() , StdIFStream::in ); 
     114         if (!ifs.good()) 
     115            ERROR("CContext::parse(xml::CXMLNode & node)", 
     116                  << "[ filename = " << attributes["src"] << " ] Bad xml stream !"); 
     117         xml::CXMLParser::ParseInclude(ifs, *this); 
     118      } 
    110119 
    111120      if (node.getElementName().compare(CContext::GetName())) 
  • XMLIO_V2/dev/dev_rv/src/xmlio/node/domain.cpp

    r276 r277  
    519519                      ni_cl = iend_sub[k] - ibegin_sub[k] + 1; 
    520520                       
    521             for (int i = zoom_ibegin_cl - 1; i < zoom_ibegin_cl + zoom_ni_cl - 1; i++) 
     521            for (int i = 0; i < zoom_ni_cl; i++) 
    522522            { 
    523                for (int j = zoom_jbegin_cl-1; j < zoom_jbegin_cl + zoom_nj_cl - 1; j++) 
     523               for (int j = 0; j < zoom_nj_cl; j++) 
    524524               { 
    525                   int ii = i - (ibegin_serv - 1) + (zoom_ibegin_cl - 1) - (ibegin_zoom_srv - 1); 
    526                   int jj = j - (jbegin_serv - 1) + (zoom_jbegin_cl - 1) - (jbegin_zoom_srv - 1); 
     525                  int ii = i /*- (ibegin_serv - 1)*/ + (zoom_ibegin_cl - 1) - (ibegin_zoom_srv - 1); 
     526                  int jj = j /*- (jbegin_serv - 1)*/ + (zoom_jbegin_cl - 1) - (jbegin_zoom_srv - 1); 
    527527                  (*lonvalue_temp)[ii + jj * zoom_ni_serv] = 
    528                   (*lonvalue_loc)[i + j * ni_cl];               
     528                  (*lonvalue_loc)[i + j * zoom_ni_cl]; 
    529529                  (*latvalue_temp)[ii + jj * zoom_ni_serv] =  
    530                   (*latvalue_loc)[i + j * ni_cl]; 
     530                  (*latvalue_loc)[i + j * zoom_ni_cl]; 
    531531               } 
    532532            } 
     
    547547                      zoom_jbegin_cl = jbegin_zoom_sub[k], zoom_nj_cl = nj_zoom_sub[k]; 
    548548                       
    549             for (int i = zoom_ibegin_cl - 1; i < zoom_ibegin_cl + zoom_ni_cl - 1; i++) 
    550                (*lonvalue_temp)[i - (ibegin_serv - 1) + (zoom_ibegin_cl - 1) - (ibegin_zoom_srv - 1)] = 
     549            for (int i = 0; i < zoom_ni_cl; i++) 
     550               (*lonvalue_temp)[i /*- (ibegin_serv - 1)*/ + (zoom_ibegin_cl - 1) - (ibegin_zoom_srv - 1)] = 
    551551               (*lonvalue_loc)[i]; 
    552552                
    553             for (int j = zoom_jbegin_cl-1; j < zoom_jbegin_cl + zoom_nj_cl - 1; j++) 
    554                (*latvalue_temp)[j - (jbegin_serv - 1) + (zoom_jbegin_cl - 1) - (jbegin_zoom_srv - 1)] = 
     553            for (int j = 0; j < zoom_nj_cl; j++) 
     554               (*latvalue_temp)[j /*- (jbegin_serv - 1)*/ + (zoom_jbegin_cl - 1) - (jbegin_zoom_srv - 1)] = 
    555555               (*latvalue_loc)[j]; 
    556556         }        
  • XMLIO_V2/dev/dev_rv/src/xmlio/node/grid.cpp

    r276 r277  
    477477            (*storeIndex_srv)[n]  = (*storeIndex_cl)[m]; // Faux mais inutile dans le cas serveur. 
    478478            (*out_i_index_srv)[n] = (*out_i_index_cl)[m]  
    479                                   /*+ (ibegin_cl - 1)*/ - (ibegin_srv - 1) + (ibegin_zoom_cl - 1) - (ibegin_zoom_srv - 1);  
     479                                  /*+ (ibegin_cl - 1) - (ibegin_srv - 1)*/ + (ibegin_zoom_cl - 1) - (ibegin_zoom_srv - 1); 
    480480            (*out_j_index_srv)[n] = (*out_j_index_cl)[m] 
    481                                   /*+ (jbegin_cl - 1)*/ - (jbegin_srv - 1) + (jbegin_zoom_cl - 1) - (jbegin_zoom_srv - 1); 
     481                                  /*+ (jbegin_cl - 1) - (jbegin_srv - 1)*/ + (jbegin_zoom_cl - 1) - (jbegin_zoom_srv - 1); 
    482482            (*out_l_index_srv)[n] = (*out_l_index_cl)[m]; 
    483483         } 
  • XMLIO_V2/dev/dev_rv/src/xmlio/output/nc4_data_output.cpp

    r276 r277  
    7777         StdString lonid     = StdString("lon_").append(domid); 
    7878         StdString latid     = StdString("lat_").append(domid); 
    79          StdString lonid_loc = StdString("lon_").append(domid).append("_local"); 
    80          StdString latid_loc = StdString("lat_").append(domid).append("_local"); 
     79         StdString lonid_loc = (comm::CMPIManager::GetCommSize(CXIOSManager::Comm_Server) > 1) 
     80                             ? StdString("lon_").append(domid).append("_local") 
     81                             : lonid; 
     82         StdString latid_loc = (comm::CMPIManager::GetCommSize(CXIOSManager::Comm_Server) > 1) 
     83                             ? StdString("lat_").append(domid).append("_local") 
     84                             : latid; 
    8185         StdString maskid    = StdString("mask_").append(domid).append("_local"); 
    8286 
     
    8690         bool isCurvilinear = (domain->lonvalue.getValue()->size() == ssize); 
    8791 
    88          SuperClassWriter::addDimension(lonid, domain->ni_glo.getValue()); 
    89          SuperClassWriter::addDimension(latid, domain->nj_glo.getValue()); 
     92         if (comm::CMPIManager::GetCommSize(CXIOSManager::Comm_Server) > 1) 
     93         { 
     94            SuperClassWriter::addDimension(lonid, domain->zoom_ni.getValue()); 
     95            SuperClassWriter::addDimension(latid, domain->zoom_nj.getValue()); 
     96         } 
    9097 
    9198         if (isCurvilinear) 
     
    229236         StdString lonid     = StdString("lon_").append(domid); 
    230237         StdString latid     = StdString("lat_").append(domid); 
    231          StdString lonid_loc = StdString("lon_").append(domid).append("_local"); 
    232          StdString latid_loc = StdString("lat_").append(domid).append("_local"); 
     238         StdString lonid_loc = (comm::CMPIManager::GetCommSize(CXIOSManager::Comm_Server) > 1) 
     239                             ? StdString("lon_").append(domid).append("_local") 
     240                             : lonid; 
     241         StdString latid_loc = (comm::CMPIManager::GetCommSize(CXIOSManager::Comm_Server) > 1) 
     242                             ? StdString("lat_").append(domid).append("_local") 
     243                             : latid; 
    233244         StdString fieldid   = (!field->name.isEmpty()) 
    234245                             ? field->name.getValue() : field->getBaseFieldReference()->getId(); 
  • XMLIO_V2/dev/dev_rv/src/xmlio/xml_node.cpp

    r272 r277  
    1111      CXMLNode::CXMLNode(rapidxml::xml_node<char> * const root) 
    1212         : node(root) 
     13         , level(0) 
    1314      { /* Ne rien faire de plus */ } 
    1415 
     
    4849               else if (nextElement->type() == rapidxml::node_element) 
    4950               {  
    50                   node = nextElement;  
     51                  node = nextElement; 
     52                  level++; 
    5153                  return (!retvalue);  
    5254               } 
     
    5961      { 
    6062         bool retvalue = false; 
    61          if (!(this->getElementName().compare(CXMLNode::RootName))) 
     63         if (!(this->getElementName().compare(CXMLNode::RootName)) || (level == 0)) 
    6264            return (retvalue); 
    6365         node = node->parent(); 
     66         level--; 
    6467         return (!retvalue); 
    6568      } 
  • XMLIO_V2/dev/dev_rv/src/xmlio/xml_node.hpp

    r272 r277  
    4646 
    4747            rapidxml::xml_node<char> * node; 
     48            int level; 
    4849 
    4950            static StdString RootName; 
  • XMLIO_V2/dev/dev_rv/src/xmlio/xml_parser.cpp

    r173 r277  
    11#include "xml_parser.hpp" 
     2 
     3#include "context.hpp" 
    24 
    35#include "attribute_template_impl.hpp" 
     
    1214 
    1315      void CXMLParser::ParseFile(const StdString & filename) 
    14       { StdIFStream ifs ( filename.c_str() , StdIFStream::in ); 
    15         CXMLParser::ParseStream(ifs); } 
     16      { 
     17         StdIFStream ifs ( filename.c_str() , StdIFStream::in ); 
     18         CXMLParser::ParseStream(ifs); 
     19      } 
    1620 
    1721      void CXMLParser::ParseString(const StdString & xmlContent) 
     
    8690         } 
    8791      } 
     92 
    8893   }// namespace xml 
    8994} // namespace xmlioserver 
  • XMLIO_V2/dev/dev_rv/src/xmlio/xml_parser.hpp

    r157 r277  
    44/// xmlioserver headers /// 
    55#include "xmlioserver_spl.hpp" 
     6#include "exception.hpp" 
    67#include "xml_node.hpp" 
    7 #include "context.hpp" 
     8 
    89 
    910namespace xmlioserver 
     
    1920            static void ParseString(const StdString & xmlContent); 
    2021            static void ParseStream(StdIStream & stream); 
     22            template <class T> 
     23               static inline void ParseInclude(StdIStream & stream, T & object); 
    2124 
    2225      }; //class CXMLParser 
     26 
     27      template <class T> 
     28         void CXMLParser::ParseInclude(StdIStream & stream, T& object) 
     29      { 
     30         StdOStringStream oss; 
     31         while(!stream.eof() && !stream.fail ()) 
     32            oss.put(stream.get()); 
     33         try 
     34         { 
     35            const StdString xmlcontent( oss.str(), 0, oss.str().size()-1 ); 
     36            rapidxml::xml_document<char> doc; 
     37            doc.parse<0>(const_cast<char*>(xmlcontent.c_str())); 
     38            CXMLNode node(doc.first_node()); 
     39            object.parse(node); 
     40         } 
     41         catch (rapidxml::parse_error & exc) 
     42         { 
     43            ERROR("CXMLParser::ParseStream(StdIStream & stream)", 
     44                  << "RapidXML error : " << exc.what() << " !"); 
     45         } 
     46      } 
    2347 
    2448   }// namespace xml 
Note: See TracChangeset for help on using the changeset viewer.