20 std::vector<int> & myRowGidOffsets)
24 std::vector<int> myRowOffsets(per_dof_row_basis.size());
25 for(std::size_t i=0;i<per_dof_row_basis.size();i++) {
26 myRowOffsets[i] = totalSz;
27 totalSz += per_dof_row_basis[i]->size();
33 myRowGidOffsets.resize(per_dof_row_basis.size());
34 for(std::size_t i=0;i<myRowGidOffsets.size();i++)
35 myRowGidOffsets[i] = rowMap->
GID(myRowOffsets[i]);
46 for(std::size_t i=0;i<per_dof_row_basis.size();i++)
47 totalSz += per_dof_row_basis[i]->size();
55 const std::vector<int> & myRowGidOffsets,
56 std::vector<int> & myColGidOffsets)
61 for(std::size_t i=0;i<myRowGidOffsets.size();i++)
62 adaptRowGids[i] = myRowGidOffsets[i];
67 adaptColGids.Import(adaptRowGids,importer,
Insert);
70 myColGidOffsets.resize(adaptColGids.MyLength());
71 for(std::size_t i=0;i<myColGidOffsets.size();i++)
72 myColGidOffsets[i] = adaptColGids[i];
87 int numStochDim = masterBasis->dimension();
94 stochColOrders(blkColMap);
97 for(std::size_t dof=0;dof<per_dof_row_basis.size();dof++) {
100 "Stokhos::adapt_utils::buildColBasisFunctions: Row basis must match dimension of master basis!");
103 = rowBasis->getCoordinateBases();
106 "Stokhos::adapt_utils::buildColBasisFunctions: Wrong number of dimensions from row basis!");
109 for(
int i=0;i<numStochDim;i++)
110 stochRowOrders[i+dof*numStochDim] = onedBasis[i]->order();
115 stochColOrders.Import(stochRowOrders,importer,
Insert);
118 = masterBasis->getCoordinateBases();
121 std::vector<int> polyOrder(numStochDim,0);
122 per_dof_col_basis.resize(blkColMap.NumMyElements());
123 for(std::size_t col=0;col<per_dof_col_basis.size();col++) {
124 int colOffset = numStochDim*col;
127 for(
int o=0;o<numStochDim;o++)
128 polyOrder[o] = stochColOrders[colOffset+o];
134 newBasisArray[dim] = oneDBasis->cloneWithOrder(polyOrder[dim]);
149 std::vector<int> myRowGidOffsets, myColGidOffsets;
151 return buildAdaptedGraph(determGraph,masterBasis,per_dof_row_basis,myRowGidOffsets,myColGidOffsets,onlyUseLinear,kExpOrder);
158 std::vector<int> & myRowGidOffsets,std::vector<int> & myColGidOffsets,
163 "Stokhos::adapt_utils::buildAdaptedGraph: per_dof_row_basis.size()!=determGraph.NumMyRows()");
165 myRowGidOffsets.clear();
166 myColGidOffsets.clear();
168 std::vector<Teuchos::RCP<const Stokhos::ProductBasis<int,double> > > per_dof_col_basis;
182 Cijk = masterBasis->computeTripleProductTensor();
184 Cijk = masterBasis->computeLinearTripleProductTensor();
188 std::vector<int> determGraphCols(maxNNZ);
189 std::vector<int> graphCols;
190 for(
int lRID=0;lRID<determGraph.
NumMyRows();lRID++) {
191 int gRID = determGraph.
GRID(lRID);
193 int rowOffsetIndex = myRowGidOffsets[lRID];
198 for(
int i=0;i<numIndices;i++) {
199 int gCID = determGraphCols[i];
200 int lCID = determGraph.
LCID(gCID);
201 int colOffsetIndex = myColGidOffsets[lCID];
204 *per_dof_col_basis[lCID],
205 onlyUseLinear,kExpOrder);
206 for(std::size_t basisRow=0;basisRow<interactGraph.
rowCount();basisRow++) {
207 const std::vector<std::size_t> & basisCols = interactGraph.
activeIndices(basisRow);
208 graphCols.resize(basisCols.size());
209 for(std::size_t
g=0;
g<basisCols.size();
g++)
210 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)