To enable a bit more modularity, automatic multithreading, etc., as I've mentioned before, I'd like to change the DiffSystem/FEMSystem interface.
Right now, the library has methods like: DiffSystem::element_residual() Which, overridden by the user, can access DiffSystem member variables with state information (like time) and solution information (like elem_solution) to fill residual information (like elem_residual and elem_jacobian). This is general enough that we could write structured finite difference methods on top of it if we wanted to. But for now, we all use the only important subclass, FEMSystem, which adds more member variables with FEM (or if you wanted, cell-centered FVM) specific information - the FE, Quadrature rule, and Elem classes, for example. That's fine, but now I'd like to move all those member variables into a method argument: DiffSystem::element_residual(DiffContext&) So that, in particular, different threads can work on different DiffContext objects at the same time without creating multiple systems. We'd then move FEMSystem-specific member variables into a FEMContext subclass of DiffContext, and users whose FEMSystem subclasses add new member variables would add them to "CahnHilliardContext" or some such. People with more C++ intuition than I are already seeing the problem that arises? If BSys subclasses ASys, and BCon subclasses ACon, then BSys::method(BCon&) is not an implementation of ASys::method(ACon&), and for our purposes BSys::method() won't work with just an ACon&. Worse: if ASys is FEMSystem and BSys is UserInventedSystem, then there's no way for ASys to even create a BCon to pass in. My workaround ideas aren't great: Declare BSys::method(ACon&), and force everyone to cast to BCon? This forces new users to write hideous code - either with the overhead of dynamic_cast, or with hackish-looking C-style pointer casts. Create a factory method ACon& ASys::factory(), have BSys reimplement it to return BCon (and require that any users who need more context do the same), and have ASys call this factory for each thread that needs a context? Anyone have any better ideas? --- Roy ------------------------------------------------------------------------------ Check out the new SourceForge.net Marketplace. It is the best place to buy or sell services for just about anything Open Source. http://p.sf.net/sfu/Xq1LFB _______________________________________________ Libmesh-devel mailing list Libmesh-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libmesh-devel