dolfin team mailing list archive
-
dolfin team
-
Mailing list archive
-
Message #08238
Re: Save the solutions in a matrix
On Mon, 2008-06-16 at 21:27 +0100, Garth N. Wells wrote:
> 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;
> >
I am trying to combine dolfin with a program written by me. The Data
(Different Solutions) I am getting will be the input for another program
which accepts a matrix as an input. so saving all solutions in separate
files would be inefficient and out of the question.
> 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
>
That seems good. I do not need to apply BC as I stated above , My
problem is that each time I am getting a solution (u1) this sould be
stored as the column of a matrix and this new matrix becomes an input
for another program. Could you please explain more what you realy mean
and How I can read the solutions( say u1 and u2) as two columns of a
uBlasMatrix? I had hard time doing that in dolfin
thank you
Hatef:)
> >
>
> _______________________________________________
> DOLFIN-dev mailing list
> DOLFIN-dev@xxxxxxxxxx
> http://www.fenics.org/mailman/listinfo/dolfin-dev
References