Ignore:
Timestamp:
07/24/15 16:40:05 (9 years ago)
Author:
rlacroix
Message:

Grid: Avoid some heap allocations and do various cleanups.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/src/node/field.cpp

    r645 r650  
    130130    CEventClient event(getType(), EVENT_ID_UPDATE_DATA); 
    131131 
    132     map<int, CArray<int,1>* >::iterator it; 
     132    map<int, CArray<int,1> >::iterator it; 
    133133    list<CMessage> list_msg; 
    134134    list<CArray<double,1> > list_data; 
     
    140140          for (it = grid->storeIndex_toSrv.begin(); it != grid->storeIndex_toSrv.end(); it++) 
    141141          { 
    142             int rank = (*it).first; 
    143             CArray<int,1>& index = *(it->second); 
     142            int rank = it->first; 
     143            CArray<int,1>& index = it->second; 
    144144 
    145145            list_msg.push_back(CMessage()); 
     
    159159      for (it = grid->storeIndex_toSrv.begin(); it != grid->storeIndex_toSrv.end(); it++) 
    160160      { 
    161         int rank = (*it).first; 
    162         CArray<int,1>& index = *(it->second); 
     161        int rank = it->first; 
     162        CArray<int,1>& index = it->second; 
    163163 
    164164        list_msg.push_back(CMessage()); 
     
    200200    if (data_srv.empty()) 
    201201    { 
    202       for (map<int, CArray<size_t, 1>* >::iterator it = grid->outIndexFromClient.begin(); it != grid->outIndexFromClient.end(); ++it) 
     202      for (map<int, CArray<size_t, 1> >::iterator it = grid->outIndexFromClient.begin(); it != grid->outIndexFromClient.end(); ++it) 
    203203      { 
    204204        int rank = it->first; 
    205         CArray<double,1> data_tmp(it->second->numElements()); 
    206         data_srv.insert( pair<int, CArray<double,1>* >(rank, new CArray<double,1>(data_tmp))); 
     205        data_srv.insert( pair<int, CArray<double,1>* >(rank, new CArray<double,1>(it->second.numElements()))); 
    207206        foperation_srv.insert(pair<int,boost::shared_ptr<func::CFunctor> >(rank,boost::shared_ptr<func::CFunctor>(new func::CInstant(*data_srv[rank])))); 
    208207      } 
     
    329328        if (data_srv.empty()) 
    330329        { 
    331           for (map<int, CArray<size_t, 1>* >::iterator it = grid->outIndexFromClient.begin(); it != grid->outIndexFromClient.end(); ++it) 
    332             data_srv.insert(pair<int, CArray<double,1>*>(it->first, new CArray<double,1>(it->second->numElements()))); 
     330          for (map<int, CArray<size_t, 1> >::iterator it = grid->outIndexFromClient.begin(); it != grid->outIndexFromClient.end(); ++it) 
     331            data_srv.insert(pair<int, CArray<double,1>*>(it->first, new CArray<double,1>(it->second.numElements()))); 
    333332        } 
    334333 
Note: See TracChangeset for help on using the changeset viewer.