FEI Package Browser (Single Doxygen Collection)
Version of the Day
Toggle main menu visibility
Loading...
Searching...
No Matches
test_utils
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
12
#include <
test_utils/test_Tables.hpp
>
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
22
test_Tables::test_Tables
(
MPI_Comm
comm)
23
:
tester
(comm)
24
{
25
}
26
27
test_Tables::~test_Tables
()
28
{
29
}
30
31
int
test_Tables::runtests
()
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
46
int
test_Tables::test1
()
47
{
48
int
len = 100;
49
50
snl_fei::RaggedTable<std::map<int,fei::ctg_set<int>
*>,
fei::ctg_set<int>
> ordTable(0,1);
51
snl_fei::RaggedTable<std::map<int,fei::ctg_set<int>
*>,
fei::ctg_set<int>
> ordTable2(0,1);
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
92
int
test_Tables::test2
()
93
{
94
return
(0);
95
}
96
97
int
test_Tables::test3
()
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
115
int
test_Tables::test4
()
116
{
117
return
(0);
118
}
ProcEqns
Definition
fei_ProcEqns.hpp:27
ProcEqns::addEqn
void addEqn(int eqnNumber, int proc)
Definition
fei_ProcEqns.cpp:65
fei::ctg_set
Definition
fei_ctg_set.hpp:39
snl_fei::RaggedTable
Definition
snl_fei_RaggedTable.hpp:29
snl_fei::RaggedTable::addIndices
void addIndices(int row, int numIndices, const int *indices)
Definition
snl_fei_RaggedTable.hpp:117
snl_fei::RaggedTable::equal
bool equal(const RaggedTable< MAP_TYPE, SET_TYPE > &rhs, bool quiet=true) const
Definition
snl_fei_RaggedTable.hpp:228
test_Tables::runtests
int runtests()
Definition
test_Tables.cpp:31
test_Tables::~test_Tables
virtual ~test_Tables()
Definition
test_Tables.cpp:27
test_Tables::test2
int test2()
Definition
test_Tables.cpp:92
test_Tables::test1
int test1()
Definition
test_Tables.cpp:46
test_Tables::test4
int test4()
Definition
test_Tables.cpp:115
test_Tables::test_Tables
test_Tables(MPI_Comm comm)
Definition
test_Tables.cpp:22
test_Tables::test3
int test3()
Definition
test_Tables.cpp:97
tester::tester
tester(MPI_Comm comm)
Definition
tester.cpp:17
tester::numProcs_
int numProcs_
Definition
tester.hpp:38
fei_ErrMacros.hpp
CHK_ERR
#define CHK_ERR(a)
Definition
fei_ErrMacros.hpp:26
fei_ProcEqns.hpp
fei_ctg_set.hpp
fei_macros.hpp
MPI_Comm
#define MPI_Comm
Definition
fei_mpi.h:56
snl_fei_RaggedTable.hpp
test_Tables.hpp
Generated by
1.17.0