On Wed, 1 Oct 2008, John Peterson wrote: > Static may not even be required. I think a single system with 3 > different matrix assembly "branches" is what you want.
John is probably exactly right. In the worst case, if one of your systems has a constant matrix, having to reassemble it over and over again will waste a few CPU cycles... but even then it may be worth it to save the memory cost of the entire matrix. > for (qp) > for (i) > for (j) > switch (system_num) // A variable you define to order the 3 systems > case 1: > K(i,j) += something; break; > case 2: > K(i,j) += something else; break; > end switch > end j > end i > end qp I think putting the switch statement outside the for loops is slightly more efficient, if matrix assembly time ever becomes a noticeable issue (as it did for one app of mine). > I've done this in the past to assemble different right-hand side > vectors depending on whether I was solving the main system or an > auxiliary arclength continuation system of equations. It should be > straightforward to extend that to the matrix assembly itself as in the > pseudocode above. It is straightforward, and I have no excuse for not thinking of it and mentioning it myself. From my first shear thinning flow code: void assemble_stokes (EquationSystems& es, const std::string& system_name) { if (find_vorticity) { assemble_vorticity(es, system_name); return; } assemble_stokes() built the residual and jacobian of the Navier-Stokes system to solve; assemble_vorticity built a linear system to project the vorticity into the same smooth space for plotting. --- Roy ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Libmesh-users mailing list Libmesh-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libmesh-users