Boost logo

Ublas :

Subject: [ublas] FE assembly : a huge time time difference
From: Umut Tabak (u.tabak_at_[hidden])
Date: 2010-12-29 20:15:57

Dear all,

I was trying to read some system matrices from the commercial code ANSYS
to boost compressed_matrices (I saw the links of Gunther Winkler however
did not have the time to try yet), but the question is what is the
fastest way to assemble in FE sense,

In pseudo code notation, ke is the element matrix

K(dofs, dofs) = K(dofs, dofs) + ke

So some technical detail that might help, ANSYS stores the symmetric
element matrices such as the ones result from structural elements in
lower triangular format

I did some coding like below, as a first try however seems slow, and
thought that there should be a faster way to do this.

Should I use indirect_array to assign the submatrices of element
contributions or what should be the right way to do this?

Any pointers are appreciated.

Best wishes,

    unsigned r=0, sI = 0; // row, and startIndex
                          // for the lower triangular format
    // read the dofs to assign
    //dofIndxTable : dofs vector
    // vals the lower triangular matrix in col oriented order
    // reason why I use the slices here
    for( std::vector<int>::const_iterator rowIter = dofIndxTable.begin();
         rowIter != dofIndxTable.end(); ++rowIter

        vector_slice<vector <double> > vs( valsK, slice( sI, 1, r+1) );
        unsigned clSz = vs.size();
        unsigned c = 0;
        for( std::vector<int>::const_iterator colIter =
       (colIter != dofIndxTable.end() & c!=clSz); ++colIter ){
          if ( r == c)
              K( *rowIter-1, *colIter-1 ) += vs(c);
              K( *rowIter-1, *colIter-1 ) += vs(c);
              K( *colIter-1, *rowIter-1 ) += vs(c);
        sI += vs.size();