FEI Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
test_Tables.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 
10 #include <fei_macros.hpp>
11 
13 
14 #include <snl_fei_RaggedTable.hpp>
15 #include <fei_ProcEqns.hpp>
16 #include <fei_ctg_set.hpp>
17 #include <map>
18 #undef fei_file
19 #define fei_file "test_Tables.cpp"
20 #include <fei_ErrMacros.hpp>
21 
23  : tester(comm)
24 {
25 }
26 
28 {
29 }
30 
32 {
33  //This class doesn't have any parallel tests. The Table objects are
34  //purely serial objects, so only run tests if numProcs_==1.
35  if (numProcs_ > 1) {
36  return(0);
37  }
38 
39  CHK_ERR( test1() );
40  CHK_ERR( test2() );
41  CHK_ERR( test3() );
42  CHK_ERR( test4() );
43  return(0);
44 }
45 
47 {
48  int len = 100;
49 
52 
53  std::vector<int> keys(len), values(len);
54  int i;
55  for(i=0; i<len; ++i) {
56  keys[i] = i;
57  values[i] = i;
58 
59  ordTable.addIndices(i, 1, &i);
60  }
61 
62  keys.push_back(len);
63  values.push_back(len);
64  ++len;
65 
66  ordTable.addIndices(len, &keys[0], len, &values[0] );
67 
68  bool same = ordTable.equal(ordTable2, true);
69  if (same) {
70  return(-1);
71  }
72 
73  for(i=0; i<len; ++i) {
74  keys[i] = i;
75  values[i] = i;
76 
77  ordTable2.addIndices(i, 1, &i);
78  }
79 
80  same = ordTable.equal(ordTable2, true);
81 
82  ordTable2.addIndices(len, &keys[0], len, &values[0] );
83 
84  same = ordTable.equal(ordTable2, false);
85  if (!same) {
86  return(-2);
87  }
88 
89  return(0);
90 }
91 
93 {
94  return(0);
95 }
96 
98 {
99  int len = 100;
100 
101  ProcEqns peqns;
102 
103  std::vector<int> keys(len), values(len);
104  for(int i=0; i<len; ++i) {
105  keys[i] = i;
106  values[i] = i;
107 
108  peqns.addEqn(i, i);
109  peqns.addEqn(i, i, len-i);
110  }
111 
112  return(0);
113 }
114 
116 {
117  return(0);
118 }
int runtests()
Definition: test_Tables.cpp:31
void addEqn(int eqnNumber, int proc)
#define MPI_Comm
Definition: fei_mpi.h:56
virtual ~test_Tables()
Definition: test_Tables.cpp:27
int numProcs_
Definition: tester.hpp:38
test_Tables(MPI_Comm comm)
Definition: test_Tables.cpp:22
void addIndices(int row, int numIndices, const int *indices)
bool equal(const RaggedTable< MAP_TYPE, SET_TYPE > &rhs, bool quiet=true) const
#define CHK_ERR(a)