From: Tom C. <Tho...@na...> - 2013-07-16 12:02:42
|
Hi Chris, This should be possible. Probably the issue you are encountering is that the framework maintains a global (private) variable called "globalExceptionList", which must be initialized prior to using asserts/exceptions. This is an exception (pun not intended) to the usual rule of encapsulation for the framework. I decided that having an extra _mandatory_ argument on every assert would be too cumbersome, so instead I pretend that Fortran has an exception stack. Even if we made the preprocessor @assert* insert the extra argument automatically, you'd still encounter the initialization problem though. If you add to your program somewhere the call: call initializeGlobalExceptionList() it will probably fix the issue you are seeing. Ordinarily this call is inside pFUnit_mod::initialize(). In fact, unless you are using MPI, this is the _only_ thing initialize() actually does. If this does not address your concern, please send a reproducer and we'll look more closely. Cheers, - Tom On Jul 16, 2013, at 6:46 AM, Christoph Piefke <cpiefke@Koraktor> wrote: > Hi there Tom, > > I was wondering, if it is still possible to use asserts via 'use > Assert_mod' somewhere in my own code. > > I tried it just by plugging it in the following way and I got an error: > <code> > use assert_mod > > call assertEqual(A,B,tolerance=1.0d-10) > </code> > > forrtl: severe (153): allocatable array or pointer is not allocated > Image PC Routine Line Source > o1.x 00000000006BF67E Unknown Unknown > Unknown > o1.x 00000000006BE116 Unknown Unknown > Unknown > o1.x 000000000067C962 Unknown Unknown > Unknown > o1.x 000000000063762B Unknown Unknown > Unknown > o1.x 0000000000662363 Unknown Unknown > unknown > o1.x 000000000060800C privateexception_ 138 > Exception.F90 > o1.x 0000000000607458 privateexception_ 123 > Exception.F90 > o1.x 000000000060E9AC exception_mod_mp_ 371 > Exception.F90 > o1.x 0000000000587410 sertcomplex_modas 9768 > AssertComplex.F90 > o1.x 0000000000586DC5 assertcomplex_mod 9732 > AssertComplex.F90 > o1.x 0000000000584921 assertcomplex_mod 9662 > AssertComplex.F90 > > > > And a following question: Could it be possibly done to make the assertion > throw a warning instead of an error? > > Kind regards, Chris > > ------------------------------------------------------------------------------ > See everything from the browser to the database with AppDynamics > Get end-to-end visibility with application monitoring from AppDynamics > Isolate bottlenecks and diagnose root cause in seconds. > Start your free trial of AppDynamics Pro today! > http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk > _______________________________________________ > Pfunit-support mailing list > Pfu...@li... > https://lists.sourceforge.net/lists/listinfo/pfunit-support Thomas Clune, Ph. D. <Tho...@na...> Chief, Software Systems Support Office Code 610.3 NASA GSFC 301-286-4635 MS 610.8 B33-C128 <http://ssso.gsfc.nasa.gov> Greenbelt, MD 20771 |