In your email,

Simply asking, after

--------------------------------------
sp_general.compress();
Mmasa.reinit(sp_general.block(0,0));
--------------------------------------

I would like to regenerate sp_general (same object of BlockSparsityPattern
Class) for mass matrix.

Main goal that I am now supposed to is to reduce the memory occupation
through separating into two part set of equations

If I set,

BlockSparsityPattern             sp0 , sp1;

so that, If I initialize first part matrix through sp0 sparsity patter,,
and second part is through sp1, there is no problem.  But,
BlockSparsityPattern class is "static" so that, the sparsity pattern of
two parts maybe still occupied local memory. I do not want to do like this
one.

In your code,

After this part,
Mmasa.reinit(sp_general.block(0,0));

Is there a way of doing the reinitialization the object (sp_general)?


On Thu, July 17, 2008 9:53 am, Isabel Gil wrote:
> Hi!
>
> I don't know if I have understood your problem correctly.
> Anyway, I put an example just in case, this one could help you (I put
> some comments):
>
> BlockSparsityPattern             sp_general;
>
> //The block matrix
> BlockSparseMatrix<double>          general;
>
> //The mass matrix
> SparseMatrix<double>             Mmasa;
>
> //Both matrices: general and Mmasa are going to use the same sp:
>
> sp_general.reinit(2,2);
> //2 because we want to work with velocities and pressure.
>
>   std::vector< unsigned int> size(2);
>   std::vector< unsigned int > dofs_per_component (DIMENSION+1);
>
>   DoFTools::count_dofs_per_component (dof_handler_total,
> dofs_per_component);
>
>   size[0]=dofs_per_component[0]+dofs_per_component[1]; //vel
>   size[1]=dofs_per_component[2]; //pre
>
>
> sp_general.block(0,0).reinit(size[0],size[0],dof_handler_total.max_couplings_between_dofs());
>
> sp_general.block(0,1).reinit(size[0],size[1],dof_handler_total.max_couplings_between_dofs());
>
> sp_general.block(1,0).reinit(size[1],size[0],dof_handler_total.max_couplings_between_dofs());
>
> sp_general.block(1,1).reinit(size[1],size[1],dof_handler_total.max_couplings_between_dofs());
>
>   sp_general.collect_sizes();
>
>   DoFTools::make_sparsity_pattern (dof_handler_total,sp_general);
>   sp_general.compress();
>
>  // When I want to create a mass matrix
>   Mmasa.reinit(sp_general.block(0,0));
>
>  //When I want to create a block matrix
>   general.reinit(sp_general);
>
> Best regards
> Isa
>
> [EMAIL PROTECTED] wrote:
>> I know that sp variable is in use by a sparse matrix..
>>
>> How do I generate new sp(sparsity pattern) with new matrix couplings?
>>
>> The destructor of sparsity pattern has been called??
>>
>> I am still wondering that...
>>
>> Could you give me a explain more?
>>
>>
>> On Thu, July 17, 2008 8:32 am, Isabel Gil wrote:
>>
>>> Hi!
>>>
>>> I think the problem you have is that the destructor of  Sparsity
>>> pattern
>>> has been called, however a variable of this class is yet in use by a
>>> Sparse Matrix, for example.
>>>
>>> Best regards
>>> Isa
>>>
>>> [EMAIL PROTECTED] wrote:
>>>
>>>> Dear All,
>>>>
>>>> Could we use block sparsity pattern again the same class?
>>>>
>>>> For example,
>>>>
>>>> I am solving the problem separated into two parts.
>>>>
>>>> One is for solving stoke equation, the other is for solving othres.
>>>>
>>>> In order to reduce the consumption of memory, I was supposed to
>>>> separate
>>>> into two sections, But, if I set as :
>>>>
>>>> BlockSparsityPattern sp;
>>>>
>>>> When I solve the stokes equation, I would like to generate pattern for
>>>> u-u
>>>> ,u-p, p-u couplings into sp sparsity pattern, After solving stokes
>>>> equation, I also generate only for mass matrix with same sparsity
>>>> pattern(sp).
>>>>
>>>> But, I found the error like
>>>>
>>>> ---------------------------------------------------------
>>>>
>>>> An error occurred in line <103> of file <source/subscriptor.cc> in
>>>> function
>>>>     virtual dealii::Subscriptor::~Subscriptor()
>>>> The violated condition was:
>>>>     counter == 0
>>>> The name and call sequence of the exception was:
>>>>     ExcInUse (counter, object_info->name(), infostring)
>>>> Additional Information:
>>>> Object of class N6dealii15SparsityPatternE is still used by 1 other
>>>> objects.
>>>>   from Subscriber SparseMatrix
>>>>
>>>> Stacktrace:
>>>> -----------
>>>> #0  /home/miranus/ysh/deal.II/lib/libbase.g.so:
>>>> dealii::Subscriptor::~Subscriptor()
>>>> #1  /home/miranus/ysh/deal.II/lib/liblac.g.so:
>>>> dealii::SparsityPattern::~SparsityPattern()
>>>> #2  /home/miranus/ysh/deal.II/lib/liblac.g.so:
>>>> dealii::BlockSparsityPatternBase<dealii::SparsityPattern>::reinit(unsigned
>>>> int, unsigned int)
>>>> #3  /home/miranus/ysh/deal.II/lib/libdeal_II_2d.g.so:
>>>> dealii::BlockSparsityPattern::reinit(unsigned int, unsigned int)
>>>> #4  /home/miranus/ysh/deal.II/lib/liblac.g.so:
>>>> dealii::BlockSparsityPattern::copy_from(dealii::BlockCompressedSetSparsityPattern
>>>> const&)
>>>> #5  ./testNoDG: StokOldrydB<2>::MakeSparseMatrix(unsigned int)
>>>> #6  ./testNoDG: StokOldrydB<2>::assembleSysOldrodBNODG(unsigned int)
>>>> #7  ./testNoDG: StokOldrydB<2>::run()
>>>> #8  ./testNoDG: main
>>>> --------------------------------------------------------
>>>>
>>>> Could we generate twice with same name of sparsity pattern/
>>>>
>>>> If I separate sparsitypatter name like sp0 , sp1 and then generate
>>>> them
>>>> each other, Total memory consumption is the sum of sp0, sp1?
>>>>
>>>> for example, If memory consumption of sp0 is 100 bytes, sp1 is 150
>>>> bytes,
>>>> total occupied memory for a generation of sparsity pattern is 250
>>>> bytes?
>>>>
>>>> If then, I have a problem of soring out to reduce memory problem.
>>>>
>>>> Could you give a advice?
>>>>
>>>> How could we reinitialize the SparsityPattern? and so on..
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>>
>>>>
>>
>>
>>
>
>



_______________________________________________

Reply via email to