53 #include "EpetraExt_BlockUtility.h"
62 namespace MatrixFreeOperatorUnitTest {
74 Epetra_Object::SetTracebackMode(2);
83 for (
int i=0; i<d; i++) {
91 basis->computeTripleProductTensor();
102 int num_spatial_procs = -1;
103 int num_procs = globalComm->
NumProc();
105 num_spatial_procs = num_procs / 2;
107 parallelParams.
set(
"Number of Spatial Processors", num_spatial_procs);
136 *x_map, *stoch_row_map, *sg_comm));
138 *f_map, *stoch_row_map, *sg_comm));
141 const int num_indices = num_x;
144 int indices[num_indices];
145 for (
int j=0;
j<num_indices;
j++)
146 indices[
j] = x_overlap_map->
GID(
j);
158 basis, sg_overlap_map, x_map, f_map,
sg_f_map, sg_comm));
159 for (
int block=0; block<basis->size(); block++) {
163 "Indices are not local!");
164 double values[num_indices];
166 for (
int j=0;
j<num_indices;
j++) {
167 indices[
j] = x_overlap_map->
GID(
j);
168 values[
j] = 0.1*(i+1)*(
j+1)*(block+1);
173 mat_sg->setCoeffPtr(block, mat);
181 sg_comm, basis, epetraCijk, x_map, f_map,
204 diff.Update(1.0, result1, -1.0, result2, 0.0);
208 out <<
"Apply infinity norm of difference: " << nrm << std::endl;
209 out <<
"Matrix-free result = " << std::endl << result1 << std::endl
210 <<
"Assebled result = " << std::endl << result2 << std::endl;
222 diff.Update(1.0, result1, -1.0, result2, 0.0);
226 out <<
"Apply-transpose infinity norm of difference: " << nrm << std::endl;
227 out <<
"Matrix-free result = " << std::endl << result1 << std::endl
228 <<
"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.
ParameterList & set(std::string const &name, T const &value, std::string const &docString="", RCP< const ParameterEntryValidator > const &validator=null)
TEUCHOS_UNIT_TEST(Stokhos_MatrixFreeOperator, ApplyUnitTest)
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
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 ...