本文整理汇总了C++中teuchos::RCP::LRID方法的典型用法代码示例。如果您正苦于以下问题:C++ RCP::LRID方法的具体用法?C++ RCP::LRID怎么用?C++ RCP::LRID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类teuchos::RCP
的用法示例。
在下文中一共展示了RCP::LRID方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ttime
int extract_matrices
(
Epetra_CrsMatrix *A, // i/p: A matrix
shylu_symbolic *ssym, // symbolic structure
shylu_data *data, // numeric structure, TODO: Required ?
shylu_config *config, // i/p: library configuration
bool insertValues // true implies values will be inserted and fill
// complete will be called. false implies values
// will be replaced.
)
{
Teuchos::RCP<Epetra_CrsMatrix> D = ssym->D;
Teuchos::RCP<Epetra_CrsMatrix> C = ssym->C;
Teuchos::RCP<Epetra_CrsMatrix> R = ssym->R;
Teuchos::RCP<Epetra_CrsMatrix> G = ssym->G;
Teuchos::RCP<Epetra_CrsGraph> Sg = ssym->Sg;
int *DColElems = data->DColElems;
int *gvals = data->gvals;
double Sdiagfactor = config->Sdiagfactor;
int *LeftIndex = new int[data->lmax];
double *LeftValues = new double[data->lmax];
int *RightIndex = new int[data->rmax];
double *RightValues = new double[data->rmax];
int err;
int lcnt, rcnt ;
int gcid;
int gid;
int *Ai;
double *Ax;
int nrows = A->RowMap().NumMyElements();
int *rows = A->RowMap().MyGlobalElements();
for (int i = 0; i < nrows ; i++)
{
int NumEntries;
err = A->ExtractMyRowView(i, NumEntries, Ax, Ai);
lcnt = 0; rcnt = 0;
// Place the entry in the correct sub matrix, Works only for sym
gid = rows[i];
int lcid;
for (int j = 0 ; j < NumEntries ; j++)
{ // O(nnz) ! Careful what you do inside
// Row permutation does not matter here
gcid = A->GCID(Ai[j]);
assert(gcid != -1);
//Either in D or R
if ((gvals[gid] != 1 && gvals[gcid] == 1)
|| (gvals[gid] == 1 && A->LRID(gcid) != -1 && gvals[gcid] == 1))
{
assert(lcnt < data->lmax);
if (insertValues)
LeftIndex[lcnt] = gcid;
else
{
//local column id
lcid = (gvals[gid] == 1 ? D->LCID(gcid) : R->LCID(gcid));
assert(lcid != -1);
LeftIndex[lcnt] = lcid;
}
LeftValues[lcnt++] = Ax[j];
}
else
{
assert(rcnt < data->rmax);
if (insertValues)
RightIndex[rcnt] = gcid;
else
{
//local column id
lcid = (gvals[gid] == 1 ? C->LCID(gcid) : G->LCID(gcid));
assert(lcid != -1);
RightIndex[rcnt] = lcid;
}
RightValues[rcnt++] = Ax[j];
}
}
if (gvals[gid] == 1)
{ // D or C row
if (insertValues)
{
err = D->InsertGlobalValues(gid, lcnt, LeftValues, LeftIndex);
assert(err == 0);
err = C->InsertGlobalValues(gid, rcnt, RightValues, RightIndex);
assert(err == 0);
}
else
{
err = D->ReplaceMyValues(D->LRID(gid), lcnt, LeftValues,
LeftIndex);
assert(err == 0);
err = C->ReplaceMyValues(C->LRID(gid), rcnt, RightValues,
RightIndex);
assert(err == 0);
}
}
else
//.........这里部分代码省略.........