I have seen other libraries with a release+asserts mode. I don't think having a third variant of the deal.II internals makes a lot of sense, but one could talk about having a compile option for it.
If you want something like Assert() in release mode inside your programs, you could easily do something like this (steal it from base/exceptions.h): #if defined(DEBUG) || defined(MODERATE) #define ModerateAssert(cond, exc) \ { \ if (!(cond)) \ ::dealii::deal_II_exceptions::internals:: \ issue_error(::dealii::deal_II_exceptions::internals::abort_on_exception,\ __FILE__, __LINE__, __PRETTY_FUNCTION__, #cond, #exc, exc); \ } #else #define ModerateAssert(cond, exc) \ {} #endif On Sun, Dec 3, 2017 at 5:17 PM, RAJAT ARORA <rajat.arora9...@gmail.com> wrote: > Hello all, > > This is more of a discussion than a question. > > I was wondering if there is a need for a new class which does something like > Assert (Lets call it myAssert for now). Its function is as defined below. > > While developing an application code, once I am confident that I am not > making a mistake using any of the deal.ii functions (no Asserts are > triggered), I switch to release mode.However, there can still be bugs in my > own code: physical or just programming based. > > So, lets say my code is bug free from deal.ii point of view (No internal > Asserts), I want to find a problem in my own code. > Lets say that I want to find when in time does a variable become negative > and why? > > > I dont want to use Assert as it causes huge overhead which is not needed at > the moment. So, the best thing would be to run code in release mode > and use AssertThrow or print commands to find source of error. Now, once the > bug is fixed, all the manual Asserthrow needs to be removed or commented. If > they are ever needed again, they need to be uncommented again and this could > span several files. > > So, my point is if there is a new class "myAssert" that can function just > like Assert but in release mode. > > One solution could be having a new mode : like debug and release, > "Moderate" mode, where only user-defined myAsserts + AsserThrow will be > checked. > > So when build in moderate mode: myAssert (+ Asserthrow) would work like > "Assert". This is just to avoid huge overhead that debug mode will cause > because of all internal checks. > > When built in release mode: No myAssert would be checked. (AssertThrow will > still be active). > > The other way to thing about this is to have a new mode "Mode 3": where no > Asserts or AssertThrow will be checked. In this case, AssertThrow behaves as > "myAssert" class. > > At the moment, I am not sure if that would be helpful to everyone or not but > I am certainly interested in something like that. > If there exists something like that in deal.ii currenlty, please let me > know. > > Thanks. > > > > > -- > The deal.II project is located at > https://urldefense.proofpoint.com/v2/url?u=http-3A__www.dealii.org_&d=DwIBaQ&c=Ngd-ta5yRYsqeUsEDgxhcqsYYY1Xs5ogLxWPA_2Wlc4&r=4k7iKXbjGC8LfYxVJJXiaYVu6FRWmEjX38S7JmlS9Vw&m=VspQ49D-XAgpTdrNH5ZSCeSLmdpzK74m-d3BpN8f5H8&s=T6PlLJxIzn0vg-6jF89N4FxbTJUkDqQcZnTPnZA4d9Q&e= > > For mailing list/forum options, see > https://urldefense.proofpoint.com/v2/url?u=https-3A__groups.google.com_d_forum_dealii-3Fhl-3Den&d=DwIBaQ&c=Ngd-ta5yRYsqeUsEDgxhcqsYYY1Xs5ogLxWPA_2Wlc4&r=4k7iKXbjGC8LfYxVJJXiaYVu6FRWmEjX38S7JmlS9Vw&m=VspQ49D-XAgpTdrNH5ZSCeSLmdpzK74m-d3BpN8f5H8&s=6HOrQfIAELQIdTaYt-pGeNDIVL2kIqBC-oO7tBGJoto&e= > > --- > 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 dealii+unsubscr...@googlegroups.com. > For more options, visit > https://urldefense.proofpoint.com/v2/url?u=https-3A__groups.google.com_d_optout&d=DwIBaQ&c=Ngd-ta5yRYsqeUsEDgxhcqsYYY1Xs5ogLxWPA_2Wlc4&r=4k7iKXbjGC8LfYxVJJXiaYVu6FRWmEjX38S7JmlS9Vw&m=VspQ49D-XAgpTdrNH5ZSCeSLmdpzK74m-d3BpN8f5H8&s=mlLuQj3_EKeFWtkVOo_6AHKGS4pzYHEwAkIK3cbItt4&e= > . -- Timo Heister http://www.math.clemson.edu/~heister/ -- 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 dealii+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.