From: Roy S. <roy...@ic...> - 2013-07-26 16:55:43
|
On Fri, 26 Jul 2013, Michael Povolotskyi wrote: > It seems to me that I'm doing something wrong with libmesh. Not "wrong", exactly, just unexpected. The original libMesh design didn't all you to add_anything() after initialization (except as you discovered, accidentally) and we've been fixing that piecemeal as developers discover need to. > EquationSystems es(mesh); > es.add_system(...); //add fist system > es.init(); > /* do domething with the first system*/ > > es.add_system(...); //ad second system > es.init(); > /* do domething with the second system*/ > > this used to work in the old version, but now what happens is that the > second system has 2 times more DOFs than it should. > I modified my code in such a way that instead of initializing es, I'm > initializing just the newly created system. > This seems to work. > > My question: > when it is appropriate to initialize the System object, and when one has > to initialize the EquationSystems object? I believe the current behavior is exactly as you discovered: each System and EquationSystems needs be initialized only once, nothing but init() does that for you, and the EquationSystems object is only capable of passing down the initialization call to systems it already knows about. The proper behavior (based on our other fixed add_foo() APIs) would be for add_system() to check whether the EquationSystems is already initialized, and if so to initialize the new system at that time. I don't have time to work on that at the moment, but we'd love a patch implementing it (or if you're pressed for time too, just a simple unit test which verifies the current behavior so we don't accidentally regress it for you further in the future). --- Roy |