Ignore:
Timestamp:
Nov 22, 2011, 9:22:10 PM (14 years ago)
Author:
Julian Iseringhausen <isering@…>
Children:
facba0
Parents:
66f24d
Message:

Major vmg update.

git-svn-id: https://svn.version.fz-juelich.de/scafacos/trunk@1136 5161e1c8-67bf-11de-9fd5-51895aff932f

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/base/has_tempgrids.hpp

    r66f24d rdfed1c  
    33 * @author Julian Iseringhausen <isering@ins.uni-bonn.de>
    44 * @date   Tue Apr  5 21:00:56 2011
    5  * 
     5 *
    66 * @brief  Provides an arbitrary number of temporary grids,
    77 *         accessible by an integer key.
    8  * 
     8 *
    99 */
    1010
     
    2525  virtual ~HasTempGrids()
    2626  {
    27     for (std::map<int, VMG::TempGrid*>::iterator iter = grids.begin(); iter != grids.end(); ++iter)
     27    for (std::map<int, TempGrid*>::iterator iter = grids_1.begin(); iter != grids_1.end(); ++iter)
     28      delete iter->second;
     29
     30    for (std::map<const Grid*, TempGrid*>::iterator iter = grids_2.begin(); iter != grids_2.end(); ++iter)
    2831      delete iter->second;
    2932  }
    3033
    3134protected:
    32   VMG::TempGrid* GetTempGrid(int key)
     35  TempGrid* GetTempGrid(int key)
    3336  {
    34     std::map<int, VMG::TempGrid*>::iterator iter = grids.find(key);
     37    std::map<int, TempGrid*>::iterator iter = grids_1.find(key);
    3538
    36     if (iter != grids.end())
    37       return iter->second;
    38     else {
    39       VMG::TempGrid* temp = new VMG::TempGrid();
    40       grids.insert(std::pair<int,VMG::TempGrid*>(key, temp));
    41       return temp;
    42     }
     39    if (iter == grids_1.end())
     40      iter = grids_1.insert(std::pair<int, TempGrid*>(key, new TempGrid())).first;
     41
     42    return iter->second;
     43  }
     44
     45  TempGrid* GetTempGrid(const Grid* key)
     46  {
     47    std::map<const Grid*, TempGrid*>::iterator iter = grids_2.find(key);
     48
     49    if (iter == grids_2.end())
     50      iter = grids_2.insert(std::pair<const Grid*, TempGrid*>(key, new TempGrid())).first;
     51
     52    return iter->second;
    4353  }
    4454
    4555private:
    46   std::map<int,VMG::TempGrid*> grids;
     56  std::map<int, TempGrid*> grids_1;
     57  std::map<const Grid*, TempGrid*> grids_2;
    4758};
    4859
Note: See TracChangeset for help on using the changeset viewer.