On Tue, Jul 3, 2012 at 10:25 AM, David Knezevic
<dkneze...@seas.harvard.edu> wrote:
>
> On 07/03/2012 10:16 AM, David Knezevic wrote:
>
> Or even easier is to put the stiffness matrix part of your assembly
> inside an "if" statement and use equation_systems.parameters to
> determine whether or not to do the matrix assembly.

So I gather I'd do something like this:

// Misc. setup ...

equation_systems.get_system("My
system").attach_assemble_function(my_assemble_function);

for (int vecNum = 0; vecNum < numVecs; vecNum++) {
   equation_systems.set<int>("vecNum") = vecNum;
   equation_systems.init(); // Does this need to be inside the loop,
right before the solve?
   equation_systems.get_system("My system").solve();
}

...

void my_assemble_function(EquationSystems& es, const std::string& system_name) {
    // Misc. setup ...

    if es.parameters.get<int>("vecNum") == 0 {
          // Code for assembling stiffness matrix
    }

    // Code for assembling force vector
}

For this to work, whatever stiffness matrix was created during the
first call to my_assemble_function would have to persist until
subsequent calls. Are you sure the stiffness matrix isn't destroyed by
calls to init() or whatever other bookkeeping precedes the call to the
assembly function?

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Libmesh-users mailing list
Libmesh-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libmesh-users

Reply via email to