Hi Bruno! The problem with the dof.clear() in `state` is that python tries to clean `geo` before. If `state` would be cleaned first it would be OK.
I guess that what you propose is the best option, i.e., to encapsulate things so the clean up is done the proper order, the problem is that there could be more of these dependences. I will take care, and if necessary I will explicitly force the clean up with `del`. Thank you very much! Sebas. El miércoles, 15 de febrero de 2017, 14:11:22 (UTC+1), Bruno Turcksin escribió: > > 2017-02-15 6:53 GMT-05:00 Sebastian.Gonzalez-Pintor <sego...@gmail.com > <javascript:>>: > > I have been thinking, and the problem is that I do not know when to do > the > > `dof.clear()`. In my case `dof` belongs to an instance (state) that > still > > exists when python try to remove the instance containing the > `triangulation` > > (geo). The only way I can think the problem can be solved would be by > > explicitly mentioning the order to delete the objects. I will try to ask > > more people around to see if I can find other solution, and then I will > post > > it here. > You want to add dof.clear() in the destructor of the object that owns > the triangulation that way you can clear the DoFHandler before the > Triangulation is destroyed. So you will have to change your > interface... Another thing you could try is something like this: > > def run(inp,geo): > state = pystate.State1D(inp, geo); > equation = pyeqfactory.EqFactory1D.New(state) > eigenprob = pyeigenprobfactory.EigenProbFactory1D.New(state, equation) > solver = pyeigensolver.EigenSolver1D(state, eigenprob) > > inp = pyinput.Input("heter1d/1d1g_heter") > geo = pygeom.ProbGeom1D(inp) > run(inp,geo) > > when you exit run, all the object should (hopefully) be destroyed, > then you can safely destroy geo. > > Best, > > Bruno > -- 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.