54 std::vector<int> & myRowGidOffsets)
58 std::vector<int> myRowOffsets(per_dof_row_basis.size());
59 for(std::size_t i=0;i<per_dof_row_basis.size();i++) {
60 myRowOffsets[i] = totalSz;
61 totalSz += per_dof_row_basis[i]->size();
67 myRowGidOffsets.resize(per_dof_row_basis.size());
68 for(std::size_t i=0;i<myRowGidOffsets.size();i++)
69 myRowGidOffsets[i] = rowMap->
GID(myRowOffsets[i]);
80 for(std::size_t i=0;i<per_dof_row_basis.size();i++)
81 totalSz += per_dof_row_basis[i]->size();
89 const std::vector<int> & myRowGidOffsets,
90 std::vector<int> & myColGidOffsets)
95 for(std::size_t i=0;i<myRowGidOffsets.size();i++)
96 adaptRowGids[i] = myRowGidOffsets[i];
101 adaptColGids.Import(adaptRowGids,importer,
Insert);
104 myColGidOffsets.resize(adaptColGids.MyLength());
105 for(std::size_t i=0;i<myColGidOffsets.size();i++)
106 myColGidOffsets[i] = adaptColGids[i];
121 int numStochDim = masterBasis->dimension();
128 stochColOrders(blkColMap);
131 for(std::size_t dof=0;dof<per_dof_row_basis.size();dof++) {
134 "Stokhos::adapt_utils::buildColBasisFunctions: Row basis must match dimension of master basis!");
137 = rowBasis->getCoordinateBases();
140 "Stokhos::adapt_utils::buildColBasisFunctions: Wrong number of dimensions from row basis!");
143 for(
int i=0;i<numStochDim;i++)
144 stochRowOrders[i+dof*numStochDim] = onedBasis[i]->order();
149 stochColOrders.Import(stochRowOrders,importer,
Insert);
152 = masterBasis->getCoordinateBases();
155 std::vector<int> polyOrder(numStochDim,0);
156 per_dof_col_basis.resize(blkColMap.NumMyElements());
157 for(std::size_t col=0;col<per_dof_col_basis.size();col++) {
158 int colOffset = numStochDim*col;
161 for(
int o=0;o<numStochDim;o++)
162 polyOrder[o] = stochColOrders[colOffset+o];
168 newBasisArray[dim] = oneDBasis->cloneWithOrder(polyOrder[dim]);
183 std::vector<int> myRowGidOffsets, myColGidOffsets;
185 return buildAdaptedGraph(determGraph,masterBasis,per_dof_row_basis,myRowGidOffsets,myColGidOffsets,onlyUseLinear,kExpOrder);
192 std::vector<int> & myRowGidOffsets,std::vector<int> & myColGidOffsets,
197 "Stokhos::adapt_utils::buildAdaptedGraph: per_dof_row_basis.size()!=determGraph.NumMyRows()");
199 myRowGidOffsets.clear();
200 myColGidOffsets.clear();
202 std::vector<Teuchos::RCP<const Stokhos::ProductBasis<int,double> > > per_dof_col_basis;
216 Cijk = masterBasis->computeTripleProductTensor();
218 Cijk = masterBasis->computeLinearTripleProductTensor();
222 std::vector<int> determGraphCols(maxNNZ);
223 std::vector<int> graphCols;
224 for(
int lRID=0;lRID<determGraph.
NumMyRows();lRID++) {
225 int gRID = determGraph.
GRID(lRID);
227 int rowOffsetIndex = myRowGidOffsets[lRID];
232 for(
int i=0;i<numIndices;i++) {
233 int gCID = determGraphCols[i];
234 int lCID = determGraph.
LCID(gCID);
235 int colOffsetIndex = myColGidOffsets[lCID];
238 *per_dof_col_basis[lCID],
239 onlyUseLinear,kExpOrder);
240 for(std::size_t basisRow=0;basisRow<interactGraph.
rowCount();basisRow++) {
241 const std::vector<std::size_t> & basisCols = interactGraph.
activeIndices(basisRow);
242 graphCols.resize(basisCols.size());
243 for(std::size_t
g=0;
g<basisCols.size();
g++)
244 graphCols[
g] = basisCols[
g] + colOffsetIndex;
Teuchos::RCP< Epetra_Map > buildAdaptedRowMap(const Epetra_Comm &Comm, const std::vector< Teuchos::RCP< const Stokhos::ProductBasis< int, double > > > &per_dof_row_basis)
const Epetra_Comm & Comm() const
int MyGlobalElements(int *MyGlobalElementList) const
void buildColBasisFunctions(const Epetra_CrsGraph &determGraph, const Teuchos::RCP< const Stokhos::ProductBasis< int, double > > &masterBasis, const std::vector< Teuchos::RCP< const Stokhos::ProductBasis< int, double > > > &per_dof_row_basis, std::vector< Teuchos::RCP< const Stokhos::ProductBasis< int, double > > > &per_dof_col_basis)
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
const Epetra_BlockMap & ColMap() const
const std::vector< std::size_t > & activeIndices(std::size_t i) const
Grab active indicies in graph for row i.
int InsertGlobalIndices(int_type GlobalRow, int NumIndices, int_type *Indices)
int MaxNumNonzeros() const
int NumMyElements() const
Teuchos::RCP< Epetra_CrsGraph > buildAdaptedGraph(const Epetra_CrsGraph &determGraph, const Teuchos::RCP< const Stokhos::ProductBasis< int, double > > &masterBasis, const std::vector< Teuchos::RCP< const Stokhos::ProductBasis< int, double > > > &per_dof_row_basis, bool onlyUseLinear=false, int kExpOrder=-1)
int LCID(int GCID_in) const
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Teuchos::RCP< Epetra_Map > buildAdaptedRowMapAndOffsets(const Epetra_Comm &Comm, const std::vector< Teuchos::RCP< const Stokhos::ProductBasis< int, double > > > &per_dof_row_basis, std::vector< int > &myRowGidOffsets)
const Epetra_BlockMap & RowMap() const
void buildAdaptedColOffsets(const Epetra_CrsGraph &determGraph, const std::vector< int > &myRowGidOffsets, std::vector< int > &myColGidOffsets)
const Epetra_Comm & Comm() const
int GRID(int LRID_in) const
std::size_t rowCount() const
What is the number of rows.
int ExtractGlobalRowCopy(int_type Row, int LenOfIndices, int &NumIndices, int_type *Indices) const
ScalarType g(const Teuchos::Array< ScalarType > &x, const ScalarType &y)