On Mon, Aug 22, 2016 at 7:53 AM, Mike Marchywka <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? -- John ------------------------------------------------------------------------------ _______________________________________________ Libmesh-users mailing list Libmesh-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libmesh-users