On Jun 16 2008, Anders Logg wrote:

>On Sat, Jun 14, 2008 at 05:31:56PM -0400, Hatef Monajemi wrote:
>> 
>> Hello,
>> 
>> I am trying to solve a problem with different parameters; I am having a
>> loop and each time I am getting a solution vector (say Function u1) and
>> I need to save each vector as a column of an arbitrary matrix in dolfin
>> (say Matrix S). I would appreciate if you let me know how it is
>> possible. I tried the following scheme:
>> 
>> Loop over i:
>> 
>> Matrix S;
>> d=u1.vector();
>> 
>> for(j)
>> {  
>>   S(i,j)=d(j);
>> {
>> 
>> But it is not going to work! any help on this matter is appreciated.
>> 
>> 
>> Hatef:)
>
>Accessing columns in our sparse matrices is very inefficient. You
>could use a dense matrix, but I suggest storing each solution to a
>separate file as a Function:
>
>  file << u1;
>

Columns can be accessed efficiently using a uBlasMatrix with an underlying 
uBLAS column-major matrix, e.g.

  uBlasMatrix<ublas_sparse_matrix_cmajor> A;

What won't then work well is zeroing rows to apply boundary conditions.

Garth

>

_______________________________________________
DOLFIN-dev mailing list
[email protected]
http://www.fenics.org/mailman/listinfo/dolfin-dev

Reply via email to