Maybe one question would be , "why not provide SparseMatrix with a templated 
add_matrix method
that only requires the dense matrix equivalent to support (i,j) ?" Similar 
signature for the vector and
method shown below, 

> dof_map.constrain_element_matrix_and_vector (Ke, Fe, dof_indices)

Is there a performance or other issue? This would make it easier for the user 
to manage
memory for his arrays but that could be good or bad :)

Thanks.


----------------------------------------
> From: marchy...@hotmail.com
> To: jwpeter...@gmail.com
> Date: Mon, 22 Aug 2016 10:51:22 -0400
> CC: libmesh-users@lists.sourceforge.net
> Subject: Re: [Libmesh-users] DenseSubMatrix and DenseSubVector lack of ctor 
> and operators
>
>
>
>
>
>
> ________________________________
>> From: jwpeter...@gmail.com
>> Date: Mon, 22 Aug 2016 08:28:18 -0600
>> Subject: Re: [Libmesh-users] DenseSubMatrix and DenseSubVector lack of
>> ctor and operators
>> To: marchy...@hotmail.com
>> CC: libmesh-users@lists.sourceforge.net
>>
>>
>>
>> On Mon, Aug 22, 2016 at 7:53 AM, Mike Marchywka
>> <marchy...@hotmail.com<mailto:marchy...@hotmail.com>> wrote:
>> I was trying to move some code around related to the vars typically
>> called Ke and Fe
>> but encountered several errors due to missing ctor or operators such as
>> assignment.
>> Can someone comment on the benefit of or need for these restrictions?
>>
>> I think you are probably referring to a default constructor for
>> DenseSubMatrix, i.e. one that does not need a reference to a parent
>> matrix in order to be created? I don't think this is a good
>> idea/necessary, as it would introduce extra bookkeeping and potentially
>> make DenseSubMatrix too easy to use incorrectly...
>>
>>
>> I was trying to clean up
>> my own code a bit and debating about how to handle things which seem to often
>> be compile time constants. One possibility is to create a code generator that
>> creates specific c++ code for a given set of conditions. This is ok if
>> there are some
>> compiler optimizations that just not easy with other approaches. Thanks.
>>
>>
>>
>> DMN Ke; DVN Fe;
>> //DSM Ke_var; DSV Fe_var;
>> DSM Ke_var; // [mla.nvar][mla.nvar];
>> DSV Fe_var; // [mla.nvar] ;
>> // InitMats(Ke,Fe,Ke_var,Fe_var,mla.nvar);
>>
>> What specifically is a compile-time constant limitation here from libmesh?
>>
>>
>>
>> //const IdxTy dofsz=dof_indices.size();
>> //const IdxTy dofsz=mla.di.dof_indices_var[0].size();
>> //Ke.resize (dofsz,dofsz); Fe.resize (dofsz);
>> /*
>> DSM Ke_var[mla.nvar][mla.nvar] =
>> {
>> { DSM(Ke), DSM(Ke), DSM(Ke), DSM(Ke)},
>> { DSM(Ke), DSM(Ke), DSM(Ke), DSM(Ke)},
>> { DSM(Ke), DSM(Ke), DSM(Ke), DSM(Ke)},
>> { DSM(Ke), DSM(Ke), DSM(Ke), DSM(Ke)}
>> };
>>
>> DSV Fe_var[mla.nvar] = {DSV(Fe), DSV(Fe), DSV(Fe), DSV(Fe) };
>>
>> Are you just wanting to know how to create dynamically-size 2D arrays
>> at runtime?
>
> Yes, I guess that would do it but then the question is why
> the examples differ from that method. Certainly compile time
> does give the compiler more opportunities to optimize.
>
> There is any object that can do this internally,
>
> Ty * Ke_var_data = new Ty[n*m] ?
>
> and I would have guessed that for best performance you have some way of 
> organizing memory.
>
>>From what I have now, I only need to be able to interface to these things 
>>from the
> function that assembles the FEM RHS and LHS,
>
> dof_map.constrain_element_matrix_and_vector (Ke, Fe, dof_indices);
> system.matrix->add_matrix (Ke, dof_indices);
> system.rhs->add_vector (Fe, dof_indices);
>
> I could probably check the documentation but are any of there templated or 
> accept iterators
> or do they require these libmesh DenseSub types?
>
> Thanks.
>
>
>>
>> --
>> John
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Libmesh-users mailing list
> Libmesh-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/libmesh-users
                                          
------------------------------------------------------------------------------
_______________________________________________
Libmesh-users mailing list
Libmesh-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libmesh-users

Reply via email to