[Dune] build a BCRSMatix C = A + B

abdeladhim tahimi abdeladhim.tahimi at gmail.com
Sat Aug 1 04:51:24 CEST 2015


dear dune developers,

a have a question about building a BCRSMatrix that I would be thankful if
someone could enlighten me about.

I have 3 BCRSMatrix instances A, B and C
A and B have different sparsity patterns given explicitly and C is the sum
of A and B. Is there a way to C get built without having to define
explicitly its sparcity pattern (deduce the sparcity pattern of C
implicitly through its definition (C = A + B)?

here is my example:
   typedef Dune::BCRSMatrix<Dune::FieldMatrix<double,1,1> > ScalarMatrix;

   ScalarMatrix A(2,2,ScalarMatrix::random);
   A.setrowsize(0,1);
   A.endrowsizes();
   A.addindex(0,0);
   A.endindices();
   Dune::printmatrix(std::cout, A, "A", "row");

   ScalarMatrix B(2,2,ScalarMatrix::random);
   B.setrowsize(1,1);
   B.endrowsizes();
   B.addindex(1,1);
   B.endindices();
   Dune::printmatrix(std::cout, B, "B", "row");

   ScalarMatrix C(2,2,ScalarMatrix::implicit/*unkown*//*random*/);
   // C = A + B;
    // don't know what to do to build C?!!
   Dune::printmatrix(std::cout, C, "C", "row");

Thanks for your help!

Adim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.dune-project.org/pipermail/dune/attachments/20150731/13ae8323/attachment.htm>


More information about the Dune mailing list