On 11/14/2011 07:32 AM, David Knezevic wrote:
>
>
> On 11/14/2011 01:06 AM, Jed Brown wrote:
>> On Sun, Nov 13, 2011 at 22:45, Roy Stogner<[email protected]>  
>> wrote:
>>
>>> The libMesh terminate handler catches C++ exceptions; gdb intercepts
>>> segfaults... but on PETSc errors, we've got nothing in place to catch
>>> the problem before program exit.  My workaround has always been to
>>> re-run and step through the program manually, but in hindsight I
>>> suppose we ought to be figuring out something appropriate to give to
>>> PetscPushErrorHandler()?
>>>
>> You could do that. I just have
>>
>> "break PetscError"
>>
>> in my ~/.gdbinit. That way when I run in the debugger, it automatically
>> stops at the first error. You can also -run_in_debugger which also sets
>> this up. Or use -on_error_attach_debugger which has a similar effect, 
>> but
>> runs full speed up until an error is encountered.
>>
>> David,
>>
>> void RBSCMConstruction::load_matrix_B()
>> {
>>    // Load the operators from the RBConstruction
>>    EquationSystems&  es = this->get_equation_systems();
>>    RBConstruction&  rb_system = 
>> es.get_system<RBConstruction>(RB_system_name);
>>
>>    matrix_B->zero();
>>    matrix_B->add(1.,*rb_system.get_inner_product_matrix());
>> }
>>
>> Could you manage to call MatCopy() here instead? The problem is that the
>> matrix isn't assembled yet, we don't know the preallocation. I haven't
>> figured out how you were creating this matrix (such that it got here 
>> while
>> still being set as unassembled), but it would be cleaner to just call
>> MatCopy() in this circumstances.
>
> Certainly, thanks for the suggestion Jed. The idea is that we're just 
> copying the assembled matrix over from rb_system to provide the "right 
> hand side" matrix for RBSCMConstruction (which derives from EigenSystem).
>
> Would I have to use the raw PETSc MatCopy() though? I don't see a 
> libMesh wrapper for it, and using SparseMatrix's operator= gives a 
> memory leak... this is why I was doing the "zero" then "add" (which is 
> presumably horribly inefficient, but at least it's not PETSc-specific...)

Or, to follow up on that thought, perhaps a copy method should be added 
to SparseMatrix?

David


------------------------------------------------------------------------------
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1
_______________________________________________
Libmesh-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libmesh-users

Reply via email to