On 7 October 2014 14:50, Garth N. Wells <[email protected]> wrote: > > On Tue, 7 Oct, 2014 at 1:40 PM, Jan Blechta <[email protected]> wrote: >> >> On Tue, 07 Oct 2014 13:34:17 +0100 >> "Garth N. Wells" <[email protected]> wrote: >> >>> >>> >>> On Tue, 7 Oct, 2014 at 10:35 AM, Jan Blechta >>> <[email protected]> wrote: >>> > On Tue, 7 Oct 2014 10:23:21 +0100 >>> > "Garth N. Wells" <[email protected]> wrote: >>> > >>> >> >>> >> On 6 Oct 2014, at 16:38, Martin Sandve Alnæs <[email protected]> >>> >> wrote: >>> >> >>> >> > I think this is the best solution: >>> >> > >>> >> > 1) Require the user to close file objects deterministically. >>> >> > Relying on the del operator is not deterministic, we need to >>> >> support >>> >> > .close() and/or __enter__/__exit__ for the with statement in >>> >> dolfin. >>> >> > >>> >> >>> >> Sounds good. We can print a warning message from the File object >>> >> destructors if a file is not closed (this can later become an >>> >> error). >>> > >>> > Good idea, but maybe warning could be issued from __del__ operator >>> > if object was not properly destroyed/closed. In C++ layer >>> > everything is OK. >>> >>> There are some advantages to insisting on explicit file >>> opening/closing in the C++ interface too, particularly in parallel, >>> so we could reasonably keep the interface consistent across Python >>> and C++. >> >> >> Ok, but do you really want to stay so consistent and require explicit >> destruction of PETScVector / PETScMatrix? > > > It would nice to be consistent, but maybe we have to give up on that in this context. > > Garth
I don't see any advantages of deviating from the standard way to handle deterministic resource management in C++ with the RAII pattern? Martin
_______________________________________________ fenics mailing list [email protected] http://fenicsproject.org/mailman/listinfo/fenics
