snl_fei_RaggedTable_specialize.hpp

00001 #ifndef _snl_fei_RaggedTable_specialize_hpp_
00002 #define _snl_fei_RaggedTable_specialize_hpp_
00003 
00004 /*--------------------------------------------------------------------*/
00005 /*    Copyright 2005 Sandia Corporation.                              */
00006 /*    Under the terms of Contract DE-AC04-94AL85000, there is a       */
00007 /*    non-exclusive license for use of this work by or on behalf      */
00008 /*    of the U.S. Government.  Export of this program may require     */
00009 /*    a license from the United States Government.                    */
00010 /*--------------------------------------------------------------------*/
00011 
00012 #include <fei_macros.hpp>
00013 #include <snl_fei_RaggedTable.hpp>
00014 #include <fei_ctg_set.hpp>
00015 #include <snl_fei_MapContig.hpp>
00016 
00017 namespace snl_fei {
00018 
00020 template<>
00021 class RaggedTable<MapContig<fei::ctg_set<int>*>,fei::ctg_set<int> >
00022   : public fei::IndexTable {
00023 public:
00024   RaggedTable(int firstKey, int lastKey);
00025 
00026   RaggedTable(const RaggedTable<MapContig<fei::ctg_set<int>*>,fei::ctg_set<int> >& src);
00027 
00028   typedef MapContig<fei::ctg_set<int>*> map_type;
00029   typedef fei::ctg_set<int> row_type;
00030   typedef map_type::iterator iterator;
00031 
00032   virtual ~RaggedTable()
00033   {
00034     iterator it = begin();
00035     iterator it_end = end();
00036     for(; it!=it_end; ++it) {
00037       poolAllocatorSet_.destroy( (*it).second );
00038       poolAllocatorSet_.deallocate( (*it).second, 1 );
00039     }
00040   }
00041 
00042   void addDiagonals(int numIndices,
00043                     const int* indices);
00044 
00045   void addIndices(int row,
00046                   int numIndices,
00047                   const int* indices);
00048 
00049   void addIndices(int numRows,
00050                   const int* rows,
00051                   int numIndices,
00052                   const int* indices);
00053 
00054   map_type& getMap() { return( map_ ); }
00055 
00056   row_type* getRow(int row)
00057   {
00058     iterator m_end = map_.end();
00059     iterator m_iter = map_.find(row);
00060     return( m_end == m_iter ? NULL : (*m_iter).second );
00061   }
00062 
00063   iterator begin() { return( map_.begin() ); }
00064 
00065   iterator end() { return( map_.end() ); }
00066 
00067  private:
00068   map_type map_;
00069   fei_Pool_alloc<row_type> poolAllocatorSet_;
00070   row_type dummy;
00071 };//RaggedTable<MapContig<fei::ctg_set<int>*> >
00072 
00073 }//namespace snl_fei
00074 #endif
00075 

Generated on Tue Jul 13 09:27:46 2010 for FEI by  doxygen 1.4.7