FEI Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
snl_fei_RaggedTable_specialize.cpp
Go to the documentation of this file.
1 /*--------------------------------------------------------------------*/
2 /* Copyright 2005 Sandia Corporation. */
3 /* Under the terms of Contract DE-AC04-94AL85000, there is a */
4 /* non-exclusive license for use of this work by or on behalf */
5 /* of the U.S. Government. Export of this program may require */
6 /* a license from the United States Government. */
7 /*--------------------------------------------------------------------*/
8 
9 #include <fei_macros.hpp>
11 
12 namespace snl_fei {
13 
16  : map_(firstKey, lastKey),
17  poolAllocatorSet_(),
18  dummy()
19 {
20  int len = lastKey-firstKey+1;
21  if (len > 0) {
23  for(int i=0; i<len; ++i) {
24  val.first = firstKey+i;
27  val.second = row;
28  map_.insert(val);
29  }
30  }
31 }
32 
34  : map_(src.map_),
35  poolAllocatorSet_()
36 {
37 }
38 
40  int numIndices,
41  const int* indices)
42 {
43  iterator m_end = map_.end();
44  iterator m_iter = map_.lower_bound(row);
45 
46  map_type::mapped_type mapped_indices = (*m_iter).second;
47 
48  if (mapped_indices == NULL) {
49  throw std::runtime_error("RaggedTable<MapContig>, NULL row.");
50  }
51 
52  for(int i=0; i<numIndices; ++i) {
53  mapped_indices->insert2(indices[i]);
54  }
55 }
56 
57 void
59  const int* rows,
60  int numIndices,
61  const int* indices)
62 {
63  iterator m_end = map_.end();
64  map_type::mapped_type mapped_indices = NULL;
65 
66  for(int i=0; i<numRows; ++i) {
67  int row = rows[i];
68  iterator m_iter = map_.lower_bound(row);
69 
70  mapped_indices = (*m_iter).second;
71  if (mapped_indices == NULL) {
72  throw std::runtime_error("RaggedTable<MapContig>, NULL row.");
73  }
74 
75  for(int j=0; j<numIndices; ++j) {
76  mapped_indices->insert2(indices[j]);
77  }
78  }
79 }
80 
81 void RaggedTable<MapContig<fei::ctg_set<int>*>,fei::ctg_set<int> >::addDiagonals(int numIndices,
82  const int* indices)
83 {
84  for(int i=0; i<numIndices; ++i) {
85  int ind = indices[i];
86  addIndices(ind, 1, &ind);
87  }
88 }
89 
90 }//namespace snl_fei
91 
fei_Pool_alloc< SET_TYPE > poolAllocatorSet_
std::pair< int, fei::ctg_set< int > * > value_type
void construct(U *p, const U &val)
pointer allocate(size_type n, const void *hint=NULL)
void insert2(const T &item)
static const_iterator end()