test_bl_cg_complex_hb.cpp File Reference

#include "BelosConfigDefs.hpp"
#include "BelosLinearProblem.hpp"
#include "BelosOutputManager.hpp"
#include "BelosStatusTestMaxIters.hpp"
#include "BelosStatusTestResNorm.hpp"
#include "BelosStatusTestOutputter.hpp"
#include "BelosStatusTestCombo.hpp"
#include "BelosBlockCG.hpp"
#include "Teuchos_CommandLineProcessor.hpp"
#include "MyMultiVec.hpp"
#include "MyBetterOperator.hpp"

Include dependency graph for test_bl_cg_complex_hb.cpp:

Include dependency graph

Go to the source code of this file.

Typedefs

typedef ScalarTraits< ST > SCT
typedef SCT::magnitudeType MT
typedef Belos::MultiVec< ST > MV
typedef Belos::Operator< ST > OP
typedef Belos::MultiVecTraits<
ST, MV
MVT
typedef Belos::OperatorTraits<
ST, MV, OP
OPT

Functions

int main (int argc, char *argv[])
std::string filename ("mhd1280b.cua")
CommandLineProcessor cmdp (false, true)
cmdp setOption ("verbose","quiet",&verbose,"Print messages and results.")
cmdp setOption ("frequency",&frequency,"Solvers frequency for printing residuals (#iters).")
cmdp setOption ("filename",&filename,"Filename for Harwell-Boeing test matrix.")
cmdp setOption ("tol",&tol,"Relative residual tolerance used by CG solver.")
cmdp setOption ("num-rhs",&numrhs,"Number of right-hand sides to be solved for.")
cmdp setOption ("block-size",&blockSize,"Block size to be used by CG solver.")
 if (cmdp.parse(argc, argv)!=CommandLineProcessor::PARSE_SUCCESSFUL)
 if (proc_verbose)
 if (!verbose) frequency
test3 set_resNormStatusTest (rcp(&test2, false))
test3 set_outputManager (MyOM)
MyBlockCG Solve ()
 if (MyTest->GetStatus()!=Belos::Converged)

Variables

ST ONE = SCT::one()
int info = 0
int MyPID = 0
bool verbose = false proc_verbose = false
int frequency = -1
int numrhs = 1
int blockSize = 1
MT tol = 1.0e-5
 proc_verbose = verbose && (MyPID==0)
cout<< "This test requires
Triutils. Please configure
with --enable-triutils."<
< endl;if(MyPID==0){cout<
< "End Result: TEST FAILED"<
< endl;}return-1;int dim,
dim2, nnz;double *dvals;int
*colptr,*rowind;ST *cvals;nnz=-1;info=readHB_newmat_double(filename.c_str(),&dim,&dim2,
&nnz,&colptr,&rowind,&dvals);if(info==0||nnz< 0){if(MyPID==0){cout<< "Error reading '"<
< filename<< "'"<< endl;cout<
< "End Result: TEST FAILED"<
< endl;}return-1;}cvals=new
ST 
SetVerbosity [nnz];for(int ii=0;ii< nnz;ii++){cvals[ii]=ST(dvals[ii *2], dvals[ii *2+1]);}RefCountPtr< MyBetterOperator< ST > > A=rcp(new MyBetterOperator< ST >dim, colptr, nnz, rowind, cvals));int maxits=dim/blockSize;RefCountPtr< MyMultiVec< ST > > soln=rcp(new MyMultiVec< ST >dim, numrhs));RefCountPtr< MyMultiVec< ST > > rhs=rcp(new MyMultiVec< ST >dim, numrhs));if(numrhs==1){MVT::MvInit(*soln, SCT::one());OPT::Apply(*A,*soln,*rhs);MVT::MvInit(*soln, SCT::zero());}else{MVT::MvRandom(*soln);OPT::Apply(*A,*soln,*rhs);MVT::MvInit(*soln, SCT::zero());}RefCountPtr< Belos::LinearProblem< ST, MV, OP > > MyLP=rcp(new Belos::LinearProblem< ST, MV, OP > A, soln, rhs));MyLP->SetBlockSize(blockSize);RefCountPtr< Belos::OutputManager< ST > > MyOM=rcp(new Belos::OutputManager< ST > MyPID));if(verbose){MyOM->(Belos::Errors+Belos::Warnings+Belos::TimingDetails+Belos::FinalSummary)
Belos::StatusTestMaxIters<
ST, MV, OP
test1 (maxits)
Belos::StatusTestResNorm<
ST, MV, OP
test2 (tol)
Belos::StatusTestOutputter<
ST, MV, OP
test3 (frequency, false)
RefCountPtr< Belos::StatusTestCombo<
ST, MV, OP > > 
MyTest = rcp( new Belos::StatusTestCombo<ST,MV,OP>( Belos::StatusTestCombo<ST,MV,OP>::OR, test1, test3 ) )
Belos::BlockCG< ST, MV, OPMyBlockCG (MyLP, MyTest, MyOM)


Typedef Documentation

typedef ScalarTraits<ST> SCT
 

Definition at line 69 of file test_bl_cg_complex_hb.cpp.

typedef SCT::magnitudeType MT
 

Definition at line 70 of file test_bl_cg_complex_hb.cpp.

typedef Belos::MultiVec<ST> MV
 

Definition at line 71 of file test_bl_cg_complex_hb.cpp.

typedef Belos::Operator<ST> OP
 

Definition at line 72 of file test_bl_cg_complex_hb.cpp.

typedef Belos::MultiVecTraits<ST,MV> MVT
 

Definition at line 73 of file test_bl_cg_complex_hb.cpp.

typedef Belos::OperatorTraits<ST,MV,OP> OPT
 

Definition at line 74 of file test_bl_cg_complex_hb.cpp.


Function Documentation

int main int  argc,
char *  argv[]
 

Definition at line 55 of file test_bl_cg_complex_hb.cpp.

std::string filename "mhd1280b.cua"   ) 
 

CommandLineProcessor cmdp false  ,
true 
 

cmdp setOption "verbose"  ,
"quiet"  ,
verbose,
"Print messages and results." 
 

cmdp setOption "frequency"  ,
frequency,
"Solvers frequency for printing residuals (#iters)." 
 

cmdp setOption "filename"  ,
filename,
"Filename for Harwell-Boeing test matrix." 
 

cmdp setOption "tol"  ,
tol,
"Relative residual tolerance used by CG solver." 
 

cmdp setOption "num-rhs ,
numrhs,
"Number of right-hand sides to be solved for." 
 

cmdp setOption "block-size"  ,
blockSize,
"Block size to be used by CG solver." 
 

if cmdp.parse(argc, argv)!  = CommandLineProcessor::PARSE_SUCCESSFUL  ) 
 

Definition at line 103 of file test_bl_cg_complex_hb.cpp.

if proc_verbose   ) 
 

Definition at line 111 of file test_bl_cg_complex_hb.cpp.

if verbose  ) 
 

test3 set_resNormStatusTest rcp &,  false  ) 
 

test3 set_outputManager MyOM   ) 
 

MyBlockCG Solve  ) 
 

if MyTest->GetStatus()!  = Belos::Converged  ) 
 

Definition at line 238 of file test_bl_cg_complex_hb.cpp.


Variable Documentation

ST ONE = SCT::one()
 

Definition at line 75 of file test_bl_cg_complex_hb.cpp.

int info = 0
 

Definition at line 77 of file test_bl_cg_complex_hb.cpp.

int MyPID = 0
 

Definition at line 78 of file test_bl_cg_complex_hb.cpp.

bool verbose = false proc_verbose = false
 

Definition at line 89 of file test_bl_cg_complex_hb.cpp.

int frequency = -1
 

Definition at line 90 of file test_bl_cg_complex_hb.cpp.

int numrhs = 1
 

Definition at line 91 of file test_bl_cg_complex_hb.cpp.

int blockSize = 1
 

Definition at line 92 of file test_bl_cg_complex_hb.cpp.

MT tol = 1.0e-5
 

Definition at line 94 of file test_bl_cg_complex_hb.cpp.

proc_verbose = verbose && (MyPID==0)
 

Definition at line 110 of file test_bl_cg_complex_hb.cpp.

cout<< "This test requires Triutils. Please configure with --enable-triutils." << endl; if (MyPID==0) { cout << "End Result: TEST FAILED" << endl; } return -1; int dim,dim2,nnz; double *dvals; int *colptr,*rowind; ST *cvals; nnz = -1; info = readHB_newmat_double(filename.c_str(),&dim,&dim2,&nnz, &colptr,&rowind,&dvals); if (info == 0 || nnz < 0) { if (MyPID==0) { cout << "Error reading '" << filename << "'" << endl; cout << "End Result: TEST FAILED" << endl; } return -1; } cvals = new ST SetVerbosity[nnz]; for (int ii=0; ii<nnz; ii++) { cvals[ii] = ST(dvals[ii*2],dvals[ii*2+1]); } RefCountPtr< MyBetterOperator<ST> > A = rcp( new MyBetterOperator<ST>dim,colptr,nnz,rowind,cvals) ); int maxits = dim/blockSize; RefCountPtr<MyMultiVec<ST> > soln = rcp( new MyMultiVec<ST>dim,numrhs) ); RefCountPtr<MyMultiVec<ST> > rhs = rcp( new MyMultiVec<ST>dim,numrhs) ); if (numrhs == 1) { MVT::MvInit( *soln, SCT::one() ); OPT::Apply( *A, *soln, *rhs ); MVT::MvInit( *soln, SCT::zero() ); } else { MVT::MvRandom( *soln ); OPT::Apply( *A, *soln, *rhs ); MVT::MvInit( *soln, SCT::zero() ); } RefCountPtr<Belos::LinearProblem<ST,MV,OP> > MyLP = rcp( new Belos::LinearProblem<ST,MV,OP> A, soln, rhs ) ); MyLP->SetBlockSize( blockSize ); RefCountPtr<Belos::OutputManager<ST> > MyOM = rcp( new Belos::OutputManager<ST> MyPID ) ); if (verbose) { MyOM->(Belos::Errors+Belos::Warnings+Belos::TimingDetails+Belos::FinalSummary)
 

Definition at line 194 of file test_bl_cg_complex_hb.cpp.

Belos::StatusTestMaxIters<ST,MV,OP> test1(maxits)
 

Belos::StatusTestResNorm<ST,MV,OP> test2(tol)
 

Belos::StatusTestOutputter<ST,MV,OP> test3(frequency, false)
 

RefCountPtr<Belos::StatusTestCombo<ST,MV,OP> > MyTest = rcp( new Belos::StatusTestCombo<ST,MV,OP>( Belos::StatusTestCombo<ST,MV,OP>::OR, test1, test3 ) )
 

Definition at line 205 of file test_bl_cg_complex_hb.cpp.

Belos::BlockCG<ST,MV,OP> MyBlockCG(MyLP, MyTest, MyOM)
 


Generated on Thu Sep 18 12:30:22 2008 for Belos Package Browser (Single Doxygen Collection) by doxygen 1.3.9.1