The other day I asked about Systems without variables in them.... after working this way for a few days I've found that system::init() and system::reinit() don't quite work properly with zero variables in the system. The problems are really only exhibited in debug mode... tripping asserts, etc. Everything works well in optimized.
In order to fix this I've mad a couple of changes, but I don't just want to commit them without a little bit of discussion (since those two functions are so important). Here's what I've changed System::init() to: void System::init () { // First initialize any required data this->init_data(); //If no variables have been added to this system //don't do anything if(!this->n_vars()) return; // Then call the user-provided intialization function this->user_initialization(); } Essentially it's just a short-circuiting before the user_initialization() call. The problem is that project_vector doesn't work properly with zero variables in the system... this fixes it. In case you're wondering you _do_ have to do init_data() or else you'll trip some initialized() tests in PetscVector later on (sometimes when the System is getting destroyed). I've also made the same change to System::reinit()... just short circuiting the whole function.... there really is no reason to do any reiniting if there are no variables in the system.... With these two changes I can now properly debug runs containing a System without variables... Does anyone see issues with these changes or have better suggestions? Derek ------------------------------------------------------------------------------ _______________________________________________ Libmesh-devel mailing list Libmesh-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libmesh-devel