[Trilinos-Users] Epetra_VbrMatrix -- Input Coefficients?

John Mitchell jamitch at sandia.gov
Wed Mar 17 17:04:49 MDT 2010


Hi,

Any help would be appreciated. 

I'm trying to populate the entries in a Epetra_VbrMatrix.  I'm having 
trouble getting past the "EndSubmitEntries()" function.   I get a 
non-zero return value from this function on the first row?

There seems to be a lot of "preconditions" for getting a matrix to work 
and I must not be quite satisfying those conditions. 

Not sure if I am properly initializing the graph.  I used FillComplete() 
so that indices would be local thus allowing me to "SumIntoMyValues()"

As a starter, I just created a SerialDenseMatrix to populate each block 
entry;

I have rowMap and a colMap -- in general these are different.  But the 
size of each element is vectorNDF.

Exact code is below.

Thanks,
John

     const int vectorNDF=3;
    Epetra_BlockMap rowMap   = ...
    Epetra_BlockMap colMap = ...
    int *numNeigh = (int*)list.getNumNeigh();
    Epetra_CrsGraph graph(Copy,rowMap,colMap,numNeigh); 
graph.FillComplete();
    Epetra_VbrMatrix m(Copy,graph);
    for(int row=0;row<rowMap.NumMyElements();row++){
        int numCol = list.getNumNeigh(row);
        BOOST_CHECK(s[row]==numCol);
        int *cols = (int*)list.getNeighborhood(row);
        int err = m.BeginSumIntoMyValues(row,numCol,cols);
        if(0!=err){
            std::cerr << "Error m.BeginSumIntoMyValues(row,numCol,cols);";
            std::exit(-1);
        }
        /*
         * loop over columns in row and submit block entry
         */

        for(int col=0;col<numCol;col++){
            err=0;
            Epetra_SerialDenseMatrix k(vectorNDF,vectorNDF);
            err = m.SubmitBlockEntry(k);
            if(0!=err){
                std::cerr << "Error m.SubmitBlockEntry(k);";
                std::exit(-1);
            }

        }
        err = m.EndSubmitEntries();
        if(0!=err){
            std::cerr << "Error m.EndSubmitEntries();";
            std::exit(-1);
        }
    }



More information about the Trilinos-Users mailing list