46#include "Thyra_DefaultScaledAdjointLinearOp.hpp"
47#include "Thyra_DefaultMultipliedLinearOp.hpp"
48#include "Thyra_DefaultDiagonalLinearOp.hpp"
49#include "Thyra_VectorStdOps.hpp"
50#include "Thyra_TestingTools.hpp"
51#include "Thyra_LinearOpTester.hpp"
55#include "EpetraExt_readEpetraLinearSystem.h"
67# include "Epetra_MpiComm.h"
69# include "Epetra_SerialComm.h"
82using Thyra::VectorBase;
83using Thyra::LinearOpBase;
84using Thyra::createMember;
85using Thyra::LinearOpTester;
91std::string matrixFile =
"";
97 "matrix-file", &matrixFile,
98 "Defines the Epetra_CrsMatrix to read in." );
103buildADOperator(
int scenario,
const Teuchos::RCP<
const Thyra::LinearOpBase<double> > &
A,
104 const double vecScale, std::ostream & out)
113 d = createMember(
A->domain(),
"d");
115 d = createMember(
A->range(),
"d");
116 V_S( d.
ptr(), vecScale );
122 M = multiply( scale(scalea,
A), scale(scaled,diagonal(d)),
"M" );
123 out <<
" Testing A*D" << std::endl;
126 M = multiply( scale(scaled,diagonal(d)), scale(scalea,
A),
"M" );
127 out <<
" Testing D*A" << std::endl;
130 M = multiply(
A, scale(scaled,diagonal(d)),
"M" );
131 out <<
" Testing adj(A)*D" << std::endl;
134 M = multiply( scale(scaled,diagonal(d)),
A,
"M" );
135 out <<
" Testing D*adj(A)" << std::endl;
140 out <<
"\nM = " << *M;
147 out <<
"\nReading linear system in Epetra format from the file \'"<<matrixFile<<
"\'\n";
150 Epetra_MpiComm comm(MPI_COMM_WORLD);
152 Epetra_SerialComm comm;
157 EpetraExt::readEpetraLinearSystem( matrixFile, comm, &epetra_A, NULL, NULL, NULL );
158 EpetraExt::readEpetraLinearSystem( matrixFile, comm, &epetra_B, NULL, NULL, NULL );
175 M = multiply(
A,scale(3.9,diagonal(d)));
178 M = multiply(scale(3.0,diagonal(d)),scale(9.0,
B));
181 M = multiply(
B,scale(3.0,diagonal(d)),scale(9.0,
B));
191 out <<
"\nReading linear system in Epetra format from the file \'"<<matrixFile<<
"\'\n";
194 Epetra_MpiComm comm(MPI_COMM_WORLD);
196 Epetra_SerialComm comm;
199 EpetraExt::readEpetraLinearSystem( matrixFile, comm, &epetra_A, NULL, NULL, NULL );
210 for(
int scenario=1;scenario<=2;scenario++) {
211 out <<
"**********************************************************" << std::endl;
212 out <<
"**************** Starting Scenario = " << scenario << std::endl;
213 out <<
"**********************************************************" << std::endl;
231 M = buildADOperator(scenario,
A,4.5,out);
232 BD_transformer->transform( *M, M_explicit.
ptr() );
235 M = buildADOperator(scenario,
A,7.5,out);
236 BD_transformer->transform( *M, M_explicit.
ptr() );
242 out <<
"\nM_explicit = " << *M_explicit;
248 LinearOpTester<double> M_explicit_tester;
249 M_explicit_tester.show_all_tests(
true);;
251 const bool result = M_explicit_tester.compare( *M, *M_explicit, Teuchos::inoutArg(out) );
252 if (!result) success =
false;
263 out <<
"\nReading linear system in Epetra format from the file \'"<<matrixFile<<
"\'\n";
266 Epetra_MpiComm comm(MPI_COMM_WORLD);
268 Epetra_SerialComm comm;
271 EpetraExt::readEpetraLinearSystem( matrixFile, comm, &epetra_A, NULL, NULL, NULL );
284 for(
int scenario=1;scenario<=4;scenario++) {
285 out <<
"**********************************************************" << std::endl;
286 out <<
"**************** Starting Scenario = " << scenario << std::endl;
287 out <<
"**********************************************************" << std::endl;
299 BD_transformer->isCompatible(*M);
306 BD_transformer->transform( *M, M_explicit.
ptr() );
308 out <<
"\nM_explicit = " << *M_explicit;
314 LinearOpTester<double> M_explicit_tester;
315 M_explicit_tester.show_all_tests(
true);
317 const bool result = M_explicit_tester.compare( *M, *M_explicit, Teuchos::inoutArg(out) );
318 if (!result) success =
false;
TEUCHOS_UNIT_TEST(Comm, Issue1029)
#define TEST_EQUALITY(v1, v2)
void setOption(const char option_true[], const char option_false[], bool *option_val, const char documentation[]=NULL)
static CommandLineProcessor & getCLP()
RCP< const EpetraLinearOp > epetraLinearOp(const RCP< const Epetra_Operator > &op, EOpTransp opTrans=NOTRANS, EApplyEpetraOpAs applyAs=EPETRA_OP_APPLY_APPLY, EAdjointEpetraOp adjointSupport=EPETRA_OP_ADJOINT_SUPPORTED, const RCP< const VectorSpaceBase< double > > &range=Teuchos::null, const RCP< const VectorSpaceBase< double > > &domain=Teuchos::null)
Dynamically allocate a nonconst EpetraLinearOp to wrap a const Epetra_Operator object.
#define TEUCHOS_ASSERT(assertion_test)
Teuchos::RCP< Epetra_Operator > get_Epetra_Operator(LinearOpBase< double > &op)
Full specialization for Scalar=double.