19 #include "EpetraExt_BlockUtility.h"
28 namespace MatrixFreeOperatorUnitTest {
40 Epetra_Object::SetTracebackMode(2);
49 for (
int i=0; i<d; i++) {
57 basis->computeTripleProductTensor();
68 int num_spatial_procs = -1;
69 int num_procs = globalComm->
NumProc();
71 num_spatial_procs = num_procs / 2;
73 parallelParams.
set(
"Number of Spatial Processors", num_spatial_procs);
102 *x_map, *stoch_row_map, *sg_comm));
104 *f_map, *stoch_row_map, *sg_comm));
107 const int num_indices = num_x;
110 int indices[num_indices];
111 for (
int j=0;
j<num_indices;
j++)
112 indices[
j] = x_overlap_map->
GID(
j);
124 basis, sg_overlap_map, x_map, f_map,
sg_f_map, sg_comm));
125 for (
int block=0; block<basis->size(); block++) {
129 "Indices are not local!");
130 double values[num_indices];
132 for (
int j=0;
j<num_indices;
j++) {
133 indices[
j] = x_overlap_map->
GID(
j);
134 values[
j] = 0.1*(i+1)*(
j+1)*(block+1);
139 mat_sg->setCoeffPtr(block, mat);
147 sg_comm, basis, epetraCijk, x_map, f_map,
170 diff.Update(1.0, result1, -1.0, result2, 0.0);
174 out <<
"Apply infinity norm of difference: " << nrm << std::endl;
175 out <<
"Matrix-free result = " << std::endl << result1 << std::endl
176 <<
"Assebled result = " << std::endl << result2 << std::endl;
188 diff.Update(1.0, result1, -1.0, result2, 0.0);
192 out <<
"Apply-transpose infinity norm of difference: " << nrm << std::endl;
193 out <<
"Matrix-free result = " << std::endl << result1 << std::endl
194 <<
"Assebled result = " << std::endl << result2 << std::endl;
KOKKOS_INLINE_FUNCTION PCE< Storage > fabs(const PCE< Storage > &a)
An Epetra operator representing the block stochastic Galerkin operator.
A container class storing an orthogonal polynomial whose coefficients are vectors, operators, or in general any type that would have an expensive copy constructor.
virtual int SetUseTranspose(bool UseTranspose)=0
Teuchos::RCP< const EpetraExt::MultiComm > getMultiComm() const
Get global comm.
virtual void setupOperator(const Teuchos::RCP< Stokhos::EpetraOperatorOrthogPoly > &poly)
Setup operator.
TEUCHOS_UNIT_TEST(Stokhos_MatrixFreeOperator, ApplyUnitTest)
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
ParameterList & set(std::string const &name, T &&value, std::string const &docString="", RCP< const ParameterEntryValidator > const &validator=null)
bool IndicesAreLocal() const
virtual int SetUseTranspose(bool UseTranspose)
Set to true if the transpose of the operator is requested.
int InsertGlobalIndices(int_type GlobalRow, int NumIndices, int_type *Indices)
Teuchos::RCP< const Epetra_Comm > getStochasticComm() const
Get stochastic comm.
int FillComplete(bool OptimizeDataStorage=true)
Teuchos::RCP< const Stokhos::EpetraSparse3Tensor > getEpetraCijk() const
Get Epetra Cijk.
int NumMyElements() const
Teuchos::RCP< Stokhos::MatrixFreeOperator > mat_free_op
static int runUnitTestsFromMain(int argc, char *argv[])
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Teuchos::RCP< const Epetra_BlockMap > getStochasticRowMap() const
Get stochastic row map.
virtual int Apply(const Epetra_MultiVector &Input, Epetra_MultiVector &Result) const
Wrap Apply() to add a timer.
virtual int Apply(const Epetra_MultiVector &Input, Epetra_MultiVector &Result) const
Returns the result of a Epetra_Operator applied to a Epetra_MultiVector Input in Result as described ...
Legendre polynomial basis.
int main(int argc, char **argv)
virtual int NumProc() const =0
Teuchos::RCP< const Epetra_Map > sg_f_map
Teuchos::RCP< Stokhos::FullyAssembledOperator > assembled_op
Teuchos::RCP< const Epetra_Comm > getSpatialComm() const
Get spatial comm.
virtual void setupOperator(const Teuchos::RCP< Stokhos::EpetraOperatorOrthogPoly > &poly)
Setup operator.
Teuchos::RCP< const Epetra_Map > sg_x_map
int ReplaceMyValues(int MyRow, int NumEntries, const double *Values, const int *Indices)
An Epetra operator representing the block stochastic Galerkin operator generated by fully assembling ...