18 #include "EpetraExt_BlockUtility.h"
20 #include "Kokkos_Timer.hpp"
33 template<
typename IntType >
40 return k + N * ( j + N * i );
43 template <
typename ordinal >
46 std::vector< std::vector<ordinal> > & graph )
48 graph.resize( N * N * N , std::vector<ordinal>() );
52 for (
int i = 0 ; i < (int) N ; ++i ) {
53 for (
int j = 0 ;
j < (int) N ; ++
j ) {
54 for (
int k = 0 ; k < (int) N ; ++k ) {
58 graph[row].reserve(27);
60 for (
int ii = -1 ; ii < 2 ; ++ii ) {
61 for (
int jj = -1 ; jj < 2 ; ++jj ) {
62 for (
int kk = -1 ; kk < 2 ; ++kk ) {
63 if ( 0 <= i + ii && i + ii < (
int) N &&
64 0 <=
j + jj &&
j + jj < (
int) N &&
65 0 <= k + kk && k + kk < (
int) N ) {
68 graph[row].push_back(col);
71 total += graph[row].size();
78 run_test(
const int p,
const int d,
const int nGrid,
const int nIter,
92 for (
int i=0; i<d; i++)
95 int stoch_length = basis->size();
113 rcp(EpetraExt::BlockUtility::GenerateBlockMap(
114 *map, *stoch_row_map, *sg_comm));
118 map, map, sg_map, sg_map,
125 basis, sg_A_overlap_map, map, map, sg_map, sg_comm));
126 for (
int i=0; i<stoch_length; i++) {
130 A_sg_blocks->setCoeffPtr(i, A);
136 basis, stoch_row_map, map, sg_map, sg_comm));
139 basis, stoch_row_map, map, sg_map, sg_comm));
145 for (
int iter=0; iter<nIter; ++iter)
148 const double t = clock.seconds() / ((
double) nIter );
150 const double gflops = 1.0e-9 * flops / t;
152 if (globalComm->
MyPID() == 0)
153 std::cout << nGrid <<
" , "
167 MPI_Init(&argc,&argv);
180 if (globalComm->
MyPID() == 0)
181 std::cout << std::endl
183 <<
"\"#Variable\" , "
184 <<
"\"PolyDegree\" , "
186 <<
"\"MXV GFLOPS\" , "
190 const int nGrid = 32;
193 const int fem_length = nGrid * nGrid * nGrid;
195 std::vector< std::vector<int> > fem_graph;
200 for (
int i=0; i<num_my_GIDs; ++i) {
201 int row = my_GIDs[i];
202 int num_indices = fem_graph[row].size();
203 int *indices = &(fem_graph[row][0]);
210 for (
int d=1; d<=12; ++d)
211 run_test(p, d, nGrid, nIter, globalComm, map, graph);
216 for (
int d=1; d<=6; ++d)
217 run_test(p, d, nGrid, nIter, globalComm, map, graph);
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.
Multivariate orthogonal polynomial basis generated from a total order tensor product of univariate po...
Teuchos::RCP< const EpetraExt::MultiComm > getMultiComm() const
Get global comm.
Data structure storing a sparse 3-tensor C(i,j,k) in a a compressed format.
ordinal generate_fem_graph(ordinal N, std::vector< std::vector< ordinal > > &graph)
int MyGlobalElements(int *MyGlobalElementList) const
void init(const value_type &val)
Initialize coefficients.
Teuchos::RCP< EpetraExt::BlockVector > getBlockVector()
Get block vector.
IntType map_fem_graph_coord(const IntType &N, const IntType &i, const IntType &j, const IntType &k)
int InsertGlobalIndices(int_type GlobalRow, int NumIndices, int_type *Indices)
virtual int MyPID() const =0
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.
Stokhos::LegendreBasis< int, double > basis_type
int PutScalar(double ScalarConstant)
int NumMyElements() const
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Teuchos::RCP< const Epetra_BlockMap > getStochasticRowMap() const
Get stochastic row map.
A container class storing an orthogonal polynomial whose coefficients are vectors, operators, or in general any type that would have an expensive copy constructor.
#define TEUCHOS_STANDARD_CATCH_STATEMENTS(VERBOSE, ERR_STREAM, SUCCESS_FLAG)
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 ...
std::vector< double > run_test(const size_t num_cpu, const size_t num_core_per_cpu, const size_t num_threads_per_core, const size_t p, const size_t d, const size_t nGrid, const size_t nIter, const bool symmetric, SG_Alg sg_alg, const std::vector< double > &perf1=std::vector< double >())
Legendre polynomial basis.
Stokhos::Sparse3Tensor< int, double > Cijk_type
int main(int argc, char **argv)
Abstract base class for 1-D orthogonal polynomials.
double countApplyFlops() const
Return number of FLOPS for each call to Apply()
A comparison functor implementing a strict weak ordering based lexographic ordering.
Teuchos::RCP< const Epetra_Comm > getSpatialComm() const
Get spatial comm.
virtual void setupOperator(const Teuchos::RCP< Stokhos::EpetraOperatorOrthogPoly > &poly)
Setup operator.