38 #include "ac/getopt.h"
67 std::cerr <<
"usage: cctest [-d] [-m <solver>] [-t <nthreads>]"
71 std::cerr <<
"\tno solvers available!!!" << std::endl;
74 std::cerr <<
"\t<solver>={" <<
solvers[0];
75 for (
unsigned i = 1; solvers[i]; i++) {
76 std::cerr <<
"|" << solvers[i];
78 std::cerr <<
"}" << std::endl;
85 main(
int argc,
char *argv[])
94 int opt =
getopt(argc, argv,
"dm:t:");
121 if (solver == NULL) {
125 if (strcasecmp(solver,
"superlu") == 0) {
127 #ifdef USE_SUPERLU_MT
129 typedef ParSuperLUSparseCCSolutionManager<DirCColMatrixHandler<0> > CCMH;
133 typedef ParSuperLUSparseCCSolutionManager<CColMatrixHandler<0> > CCMH;
138 typedef SuperLUSparseCCSolutionManager<DirCColMatrixHandler<0> > CCMH;
142 typedef SuperLUSparseCCSolutionManager<CColMatrixHandler<0> > CCMH;
147 std::cerr <<
"need --with-superlu to use SuperLU library"
152 }
else if (strcasecmp(solver,
"y12") == 0) {
155 typedef Y12SparseCCSolutionManager<DirCColMatrixHandler<1> > CCMH;
159 typedef Y12SparseCCSolutionManager<CColMatrixHandler<1> > CCMH;
163 std::cerr <<
"need --with-y12 to use y12m library"
168 }
else if (strcasecmp(solver,
"umfpack") == 0
169 || strcasecmp(solver,
"umfpack3") == 0) {
172 typedef UmfpackSparseCCSolutionManager<DirCColMatrixHandler<0> > CCMH;
176 typedef UmfpackSparseCCSolutionManager<CColMatrixHandler<0> > CCMH;
180 std::cerr <<
"need --with-umfpack to use Umfpack library"
186 std::cerr <<
"unknown solver '" << solver <<
"'" << std::endl;
190 std::cout <<
"using " << solver <<
" solver..." << std::endl;
200 std::cout.setf(std::ios::scientific);
201 std::cout.precision(p);
218 pM->operator()(1, 1) = m11;
219 pM->operator()(2, 2) = m22;
220 pM->operator()(3, 3) = m33;
222 pM->operator()(1, 2) = d;
223 pM->operator()(2, 1) = d;
224 pM->operator()(2, 3) = d;
225 pM->operator()(3, 2) = d;
228 pV->operator()(1) = b1;
229 pV->operator()(2) = b2;
230 pV->operator()(3) = b3;
233 std::cerr <<
"need to rebuild matrix..." << std::endl;
238 std::cerr <<
"build failure" << std::endl;
244 std::cout <<
"solution " << count <<
"..." << std::endl;
249 std::cerr <<
"solution failure" << std::endl;
254 <<
"{x1} [" << std::setw(w) << m11
255 <<
"," << std::setw(w) << d
256 <<
"," << std::setw(w) << 0.
257 <<
"]^-1 {" << std::setw(w) << b1
258 <<
"} {" << std::setw(w) << (*px)(1) <<
"}" << std::endl
259 <<
"{x2} = ["<< std::setw(w) << d
260 <<
"," << std::setw(w) << m22
261 <<
"," << std::setw(w) << d
262 <<
"] {" << std::setw(w) << b2
263 <<
"} = {" << std::setw(w) << (*px)(2) <<
"}" << std::endl
264 <<
"{x3} [" << std::setw(w) << 0.
265 <<
"," << std::setw(w) << d
266 <<
"," << std::setw(w) << m33
267 <<
"] {" << std::setw(w) << b3
268 <<
"} {" << std::setw(w) << (*px)(3) <<
"}" << std::endl;
virtual VectorHandler * pResHdl(void) const =0
virtual void Reset(void)=0
const LinSol::solver_t solver[]
virtual MatrixHandler * pMatHdl(void) const =0
virtual void MatrReset(void)=0
virtual void Solve(void)=0
virtual void MatrInitialize(void)
#define SAFENEWWITHCONSTRUCTOR(pnt, item, constructor)
int main(int argc, char *argv[])
int getopt(int argc, char *const argv[], const char *opts)
virtual VectorHandler * pSolHdl(void) const =0