Thanks Timo,

I've tried that already, it gets me the same matrix as if I do:

sparsity_pattern.block(i,j).reinit(dof_handler.n_dofs(),dof_handler.n_dofs(),0);

I can't get a definition for this "c_emptysparsity" that actually works as a
null block.



On Thu, Sep 23, 2010 at 8:05 PM, Timo Heister <
[email protected]> wrote:

> Hey fname? :-)
>
> does the following code do what you want?
>
> CompressedSparsityPattern c_emptysparsity(dof_handler.n_dofs());
> sparsity_pattern.block(i,j).copy_from(c_emptysparsity);
>
>
> --
> Timo Heister
> http://num.math.uni-goettingen.de/~heister<http://num.math.uni-goettingen.de/%7Eheister>
>
>
>
> On Tue, Sep 21, 2010 at 10:32 PM, fname lname <[email protected]>
> wrote:
> > Hello everyone
> >
> > I'm trying to make a block sparsity pattern for an uncoupled system, only
> > the blocks in the diagonal have nonzero elements.
> >
> > I can't find how to make a "null" sparsity block.
> >
> > ----------------------
> >
> > // I defined the spasity pattern of the nonzero blocks
> >
> >  CompressedSparsityPattern c_sparsity(dof_handler.n_dofs());
> >
> >  DoFTools::make_sparsity_pattern (dof_handler, c_sparsity);
> >
> > // Then the block sparsity pattern
> >
> >  sparsity_pattern.reinit(nd,nd);
> >
> > // then each block
> >
> >   for (int i=0; i<nd; ++i) {
> >     for (int j=0; j<nd; ++j) {
> >       if (i==j) {
> >     sparsity_pattern.block(i,j).copy_from(c_sparsity);
> >       } else {
> >
> >
> sparsity_pattern.block(i,j).reinit(dof_handler.n_dofs(),dof_handler.n_dofs(),0);
> > // here I should define a "null" block
> >       }
> >     }
> >   }
> >
> > _______________________________________________
> > dealii mailing list http://poisson.dealii.org/mailman/listinfo/dealii
> >
> >
>
_______________________________________________
dealii mailing list http://poisson.dealii.org/mailman/listinfo/dealii

Reply via email to