Copying this to the list since it involves a coding error that is very
easy to make...

>> I think the following line is problematic:
>>
>> // Solucion actual del problema no lineal --> V
>> AutoPtr<NumericVector<Number> > V (system.solution);
>>
>> This constructs an AutoPtr "V" from the existing AutoPtr
>> system.solution using the copy constructor. When that happens,
>> ownership of the system solution vector is released to V, and when V
>> goes out of scope, the vector will be destroyed... I think this is
>> the main problem with the code, but there were a couple of other
>> things:
>>
>> .) Make sure to close V after the call to V->add(Uold) and Uold after
>> the call to Uold.add(*V). These *might* not be bugs in serial code,
>> but they definitely will be in parallel.

> I have replaced
> AutoPtr<NumericVector<Number> >  V (system.solution);
> by
> AutoPtr<NumericVector<Number> >  V (system.solution->clone());
>
> and it works! but still left a lot of things to do, for instance: to check
> my formulation and, as you have mentionned before, to replace some sentences
> like Uold.add(*V), that could be a source of future bugs. How should I add a
> vector in order to avoid problems with parallel codes?

Uold.add(*V) is fine, you just need to be sure and call Uold.close()
so that the addition can be properly communicated in parallel.

-- 
John

------------------------------------------------------------------------------
Got Input?   Slashdot Needs You.
Take our quick survey online.  Come on, we don't ask for help often.
Plus, you'll get a chance to win $100 to spend on ThinkGeek.
http://p.sf.net/sfu/slashdot-survey
_______________________________________________
Libmesh-users mailing list
Libmesh-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libmesh-users

Reply via email to