Thank you for the fast answer. Am Dienstag, den 22.01.2008, 11:38 +0100 schrieb Anders Logg: > On Tue, Jan 22, 2008 at 11:09:27AM +0100, Anne Voigt wrote: > > > > Thank you. I now try to write my own Tensor by deriving from the > > GenericTensor class. Could you write me some information about the > > interface? > > Especially what the parameters of the function > > GenericTensor::get(..) and GenericTensor::set(..) are? It is not clear > > for me and I cannot find a documentation about it. > > > > Regards, > > Anne > > virtual void set(const real* block, > const uint* num_rows, > const uint* const * rows) = 0; > > block is an array with values to be set > > num_rows is an array of length rank() > > num_rows[i] is the number of "rows" to be set for axis i > > rows[i] is an array with the "rows" to be set for axis i > > the length of the array block is num_rows[0]*num_rows[1]*... > > For a matrix (rank = 2), the values will be set according to > > for (int i = 0; i < num_rows[0]; ++i) > for (int j = 0; j < num_rows[1]; ++j) > A[rows[i], rows[j]] = block[i*num_rows[1] + j];
When I understood it correctly, the last line should be: A[rows[0][i], rows[1][j]] = block[i*num_rows[1] + j]; Is this correct or did I a mistake? > For a rank 3 tensor, you have three loops etc. > > -- > Anders > > > > > > > > > > > Am Montag, den 21.01.2008, 16:40 +0100 schrieb Anders Logg: > > > > > On Sun, Jan 20, 2008 at 11:49:57AM +0100, Anne Voigt wrote: > > > > > > -----Ursprüngliche Nachricht----- > > > > > > Von: Ola Skavhaug [mailto:[EMAIL PROTECTED] > > > > > > Gesendet: Freitag, 18. Januar 2008 23:53 > > > > > > An: Anne Voigt; [email protected] > > > > > > Betreff: Re: [DOLFIN-dev] assemebling process for a trilinearform > > > > > > > > > > > > Anders Logg skrev den 18/01-2008 følgende: > > > > > > > On Fri, Jan 18, 2008 at 03:56:46PM +0100, Anne Voigt wrote: > > > > > > > > I just wanted to ask if there is any progress with the > > > > > > > > assembling > > > > > > > > process of a trilinearform. > > > > > > > > As a little reminder, here is what I wrote in December: > > > > > > > > I have the following problem. I defined a trilinearform with > > > > > > > > the help of > > > > > > > > FFC. Now I wanted to write the results into a 3D tensor which is > > > > > > > > assembled with the help of assemble.h . What I already did I > > > > > > > > implemented > > > > > > > > a subclass of GenericTensor called Tensor. But unfortunately I > > > > > > > > am still > > > > > > > > not able to assemble such a tenor. The reason is > > > > > > > > SparsityPatternBuilder.cpp which is not implemented for > > > > > > > > problems >2D: > > > > > > > > > > > > > > > > void SparsityPatternBuilder::build(SparsityPattern& > > > > > > > > sparsity_pattern, > > > > > > > > Mesh& mesh, > > > > > > > > UFC& ufc) > > > > > > > > { > > > > > > > > if (ufc.form.rank() == 0) > > > > > > > > scalarBuild(sparsity_pattern); > > > > > > > > else if (ufc.form.rank() == 1) > > > > > > > > vectorBuild(sparsity_pattern, ufc); > > > > > > > > else if (ufc.form.rank() == 2) > > > > > > > > matrixBuild(sparsity_pattern, mesh, ufc); > > > > > > > > else > > > > > > > > error("Cannot compute sparsity patterm for size > 2."); > > > > > > > > } > > > > > > > > > > > > > > > > I know that you all are very busy that's why I would be already > > > > > > > > pleased > > > > > > > > if you would be able to tell how much longer I may have to > > > > > > > > wait?! > > > > > > > > > > > > > > > > Thanks for your help > > > > > > > > Anne > > > > > > > > > > > > > > > > _______________________________________________ > > > > > > > > DOLFIN-dev mailing list > > > > > > > > [email protected] > > > > > > > > http://www.fenics.org/mailman/listinfo/dolfin-dev > > > > > > > > > > > > > > We're working on this. The hangup right now is to solve a problem > > > > > > > related to circular dependencies between matrix classes and matrix > > > > > > > factories (in particular for uBLAS where things are templated). > > > > > > > > > > > > > > We may have found a solution today (in particular Martin who has a > > > > > > > black belt in templates). Ola, did it work? > > > > > > > > > > > > Sure, it did. I have to compile DOLFIN using PETSc for all the part > > > > > > to > > > > > > fit together. I'll probably commit early next week. > > > > > > > > > > > > Ola > > > > > > > > > > > > > > > > > > Great news!!! Thanks to all of you. Now I can go ahead with my final > > > > > > thesis!!! :-) > > > > > > > > > > > > Anne > > > > > > > > > > ok, it might be fixed now. Try and see if you can make it work. > > > > > > > > > > What we've done (mostly Ola and Martin) is that we have added a method > > > > > factory() to the interfaces. These should for each backend return a > > > > > factory that knows how to create vectors and matrices, and sparsity > > > > > patterns for that backend. > > > > > > > > > > What you need to do to assemble into your own tensor is to implement > > > > > your own tensor class (subclass of GenericTensor), your own factory > > > > > (subclass of LinearAlgebraFactory) and your own sparsity pattern > > > > > (subclass of GenericSparsityPattern). > > > > > > > > > > The assembler will ask your tensor to return a factory and then it > > > > > will ask that factory to create a sparsity pattern. Before assembling > > > > > into your tensor, it will iterate over the elements and let you build > > > > > the sparsity pattern. Depending on how you have implemented your > > > > > tensor class, you may or may not want to actually build the sparsity > > > > > pattern. > > > > > > > > > > See if it works. > > > > > > > > > > > > > > > > _______________________________________________ > > DOLFIN-dev mailing list > > [email protected] > > http://www.fenics.org/mailman/listinfo/dolfin-dev > _______________________________________________ > DOLFIN-dev mailing list > [email protected] > http://www.fenics.org/mailman/listinfo/dolfin-dev > _______________________________________________ DOLFIN-dev mailing list [email protected] http://www.fenics.org/mailman/listinfo/dolfin-dev
