FEI Package Browser (Single Doxygen Collection) Version of the Day
Loading...
Searching...
No Matches
test_PointBlockMap.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_iostream.hpp>
10
13
14#undef fei_file
15#define fei_file "test_PointBlockMap.cpp"
16#include <fei_ErrMacros.hpp>
17
22
26
28{
29 CHK_ERR( test1() );
30 CHK_ERR( test2() );
31 CHK_ERR( test3() );
32 CHK_ERR( test4() );
33 return(0);
34}
35
37{
39
40 CHK_ERR( pbMap.setEqn(0, 0) );
41 CHK_ERR( pbMap.setEqn(1, 0) );
42 CHK_ERR( pbMap.setEqn(2, 0) );
43 CHK_ERR( pbMap.setEqn(3, 1) );
44 CHK_ERR( pbMap.setEqn(4, 1) );
45 CHK_ERR( pbMap.setEqn(5, 2) );
46
47 CHK_ERR( pbMap.setBlkEqnSize(0, 3) );
48 CHK_ERR( pbMap.setBlkEqnSize(1, 2) );
49 CHK_ERR( pbMap.setBlkEqnSize(2, 1) );
50
51 int blkEqnOffset = pbMap.getBlkEqnOffset(1,3);
52 if (blkEqnOffset != 0) {
53 ERReturn(-1);
54 }
55
56 int size = pbMap.getBlkEqnSize(1);
57 if (size != 2) {
58 ERReturn(-1);
59 }
60
61 int blkSize, ptEqn;
62 CHK_ERR( pbMap.getBlkEqnInfo(1, ptEqn, blkSize) );
63 if (ptEqn != 3) {
64 ERReturn(-1);
65 }
66 if (blkSize != 2) {
67 ERReturn(-1);
68 }
69
70 int blkEqn = pbMap.eqnToBlkEqn(4);
71 if (blkEqn != 1) {
72 ERReturn(-1);
73 }
74
75 if (pbMap.isExactlyBlkEqn(4)) {
76 ERReturn(-1);
77 }
78
79 int blkOffset;
80 CHK_ERR( pbMap.getPtEqnInfo(4, blkEqn, blkOffset) );
81 if (blkEqn != 1) {
82 ERReturn(-1);
83 }
84
85 if (blkOffset != 1) {
86 ERReturn(-1);
87 }
88
89 if (!pbMap.isExactlyBlkEqn(3)) {
90 ERReturn(-1);
91 }
92
93 int maxBlkSize = pbMap.getMaxBlkEqnSize();
94 if (maxBlkSize == 0) {
95 ERReturn(-1);
96 }
97
98 return(0);
99}
100
102{
104
105 CHK_ERR( pbMap.setEqn(0, 0) );
106 CHK_ERR( pbMap.setEqn(1, 0) );
107 CHK_ERR( pbMap.setEqn(2, 0) );
108 CHK_ERR( pbMap.setEqn(3, 1) );
109 CHK_ERR( pbMap.setEqn(4, 1) );
110 CHK_ERR( pbMap.setEqn(5, 2) );
111
112 CHK_ERR( pbMap.setBlkEqnSize(0, 3) );
113 CHK_ERR( pbMap.setBlkEqnSize(1, 2) );
114 CHK_ERR( pbMap.setBlkEqnSize(2, 1) );
115
116 std::map<int,std::pair<int,int> >* blkEqns = pbMap.getBlkEqns();
117
118 std::map<int,std::pair<int,int> >::const_iterator
119 iter = blkEqns->begin(),
120 iter_end = blkEqns->end();
121
122 for(; iter != iter_end; ++iter) {
123 if ((*iter).first < 0) {
124 CHK_ERR( -1 );
125 }
126 }
127
128 return(0);
129}
130
132{
133 return(0);
134}
135
137{
138 return(0);
139}
int setEqn(int ptEqn, int blkEqn)
int getBlkEqnInfo(int blkEqn, int &ptEqn, int &blkSize)
int getPtEqnInfo(int ptEqn, int &blkEqn, int &blkOffset)
int setBlkEqnSize(int blkEqn, int size)
std::map< int, std::pair< int, int > > * getBlkEqns()
int getBlkEqnOffset(int blkEqn, int ptEqn)
test_PointBlockMap(MPI_Comm comm)
#define ERReturn(a)
#define CHK_ERR(a)
#define MPI_Comm
Definition fei_mpi.h:56