Why is evaluate_diffusion() declared as const? When removing the const-keyword, compilation works fine (running not tested yet).
Am Donnerstag, 3. August 2017 13:08:47 UTC+2 schrieb Wolfgang Bangerth: > > On 08/03/2017 03:16 AM, 'Maxi Miller' via deal.II User Group wrote: > > I am following example 52 for writing code which should solve a system > of > > three equations. In it I can rewrite my equations such that my source > term is > > zero, but my matrices on the left side are depending on time, which > means that > > I have to reassemble the system matrix and the inverse system matrix at > every > > time step. Is that a good idea, or rather performance-degrading? > > Like all performance questions, it is not worth thinking about them > *unless > you have concrete evidence* that your performance is too slow for what you > want to do. For example, if your solver takes 90% of the time, then it > doesn't > make sense to look at the run time of the assembly. > > > Furthermore I then have to call > > | > > assemble_system(time) > > | > > in the function > > | > > evaluate_diffusion(constdoubletime,constVector<double>&y) > > | > > but compilation fails with > > | > > error:passing ‘constStep52::Diffusion<3>’as‘this’argument discards > qualifiers > > [-fpermissive] > > assemble_system(time); > > | > > but why? And how can I fix that? > > Your evaluate_diffusion() function is declared as `const`. But you can > only > call `const` functions from `const` functions, so you are not allowed to > call > the non-`const` function assemble_system(). > > Best > W. > > -- > ------------------------------------------------------------------------ > Wolfgang Bangerth email: [email protected] > <javascript:> > www: http://www.math.colostate.edu/~bangerth/ > > -- The deal.II project is located at http://www.dealii.org/ For mailing list/forum options, see https://groups.google.com/d/forum/dealii?hl=en --- You received this message because you are subscribed to the Google Groups "deal.II User Group" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
