From: Roy S. <roy...@ic...> - 2005-03-18 22:38:55
|
On Fri, 18 Mar 2005, KIRK, BENJAMIN (JSC-EG) (NASA) wrote: > I've attached an updated ex3.C showing how you can derive from System and > implement user_assembly() to assemble > your system. Similarly, you can implement user_initialization() to perform > any user-defined initialization you want. > > Clearly this makes it easier to get data to the assembly routines. > > Thoughts? It's an improvement over passing function pointers, but I'm sure we can abstract away more. In that whole assembly function, how many lines are problem specific? Just the equations themselves; everything before "Fe.resize()" and everything after the boundary conditions loop is boilerplate. If we make that boilerplate a standard function, and let the user override just a "cell_assembly" function that the standard assembly function calls once per active element, then not only does it make user code shorter but it gives us more options. Matrix-free methods could be turned on/off with a switch; residual-based error indicators could call the same cell_assembly function (after "faking" new boundary sides); libMesh code could choose to preeliminate interior degrees of freedom... it would even make hp adaptivity easier to write in the future, by moving the "all cells are the same FE type" assumption into libMesh code, where it can then be weakened without changing user code. The only concern I have is efficiency, but I doubt a function call (even one that may need a lot of arguments) is going to be much worse than the FE reinit and triply nested loops that already needs to be done per cell. --- Roy Stogner |