10 #include <fei_macros.hpp>
12 #include <test_utils/test_EqnCommMgr.hpp>
13 #include <fei_CommUtils.hpp>
16 #include <fei_ProcEqns.hpp>
17 #include <fei_EqnBuffer.hpp>
18 #include <fei_EqnCommMgr.hpp>
21 #define fei_file "test_EqnCommMgr.cpp"
22 #include <fei_ErrMacros.hpp>
24 test_EqnCommMgr::test_EqnCommMgr(MPI_Comm comm)
29 test_EqnCommMgr::~test_EqnCommMgr()
33 int test_EqnCommMgr::runtests()
42 int test_EqnCommMgr::test1()
51 int firstLocalEqn = localProc*numLocalEqns;
55 for(
int p=0; p<numProcs; p++) {
56 if (p == localProc)
continue;
58 for(
int i=0; i<numLocalEqns; i++) {
59 if (p != 2) eqnCommMgr->
addLocalEqn(firstLocalEqn+i, p);
64 eqnCommMgr->setNumRHSs(1);
67 for(p=0; p<numProcs; p++) {
68 if (p == localProc)
continue;
70 for(
int i=0; i<numLocalEqns; i++) {
71 int eqn = p*numLocalEqns + i;
73 eqnCommMgr->addRemoteIndices(eqn, p, &eqn, 1);
77 CHK_ERR( eqnCommMgr->exchangeIndices() );
80 for(p=0; p<numProcs; p++) {
81 if (p == localProc)
continue;
83 for(
int i=0; i<numLocalEqns; i++) {
84 int eqn = p*numLocalEqns + i;
86 eqnCommMgr->addSolnValues(&eqn, &zero, 1);
92 std::vector<int>& localEqns = eqnCommMgr->localEqnNumbers();
93 std::vector<int>& localEqnsCopy = eCopy->localEqnNumbers();
95 if (localEqns != localEqnsCopy) {
99 eqnCommMgr->exchangeSoln();
101 eqnCommMgr->resetCoefs();
109 int test_EqnCommMgr::test2()
111 FEI_COUT <<
"testing ProcEqns...";
115 procEqns.
addEqn(0, localProc_);
116 procEqns.
addEqn(1, localProc_);
117 procEqns.
addEqn(2, localProc_);
119 procEqns.
addEqn(3, 2, localProc_+1);
120 procEqns.
addEqn(4, 2, localProc_+1);
121 procEqns.
addEqn(5, 2, localProc_+1);
128 if (eqnsPerProc != eqnsPerProcCopy) {
134 FEI_COUT << FEI_ENDL;
138 int test_EqnCommMgr::test3()
143 int test_EqnCommMgr::test4()
std::vector< int > & eqnsPerProcPtr()
void addEqn(int eqnNumber, int proc)
void addLocalEqn(int eqnNumber, int srcProc)
int localProc(MPI_Comm comm)
int numProcs(MPI_Comm comm)