CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Bugs (http://www.cfd-online.com/Forums/openfoam-bugs/)
-   -   Segmentation Fault when using class based on KinematicParcel in parallel (http://www.cfd-online.com/Forums/openfoam-bugs/62437-segmentation-fault-when-using-class-based-kinematicparcel-parallel.html)

gschaider August 13, 2008 15:34

Version: 1.5 How to reprodu
 
Version: 1.5

How to reproduce: Using the rhoTurbTwinParcelFoam and the simplifiedSiwek-case. Decompose the case for 8 processors. The run fails at the first timestep with a segmentation fault:

[7] #6 Foam:http://www.cfd-online.com/OpenFOAM_D...part/proud.gifstream& Foam::operator<<>(Foam:http://www.cfd-online.com/OpenFOAM_D...part/proud.gifstream&, Foam::KinematicParcel<foam::basicthermoparcel> const&) at ~/OpenFOAM/OpenFOAM-1.5-debug/src/lagrangian/intermediate/lnInclude/KinematicPar celIO.C:218

The problem seems to be the line there
reinterpret_cast<const>(p.typeId()),
because typeID() is the only accessor-method in KinematicParcel that doesn't have a return-reference variant. So propably that cast trys to access the address of the returned temporary value (and the memory following it)

Possible fixes:

1. Quick and dirty: replace that line with
reinterpret_cast<const>(&p.typeId_)

2. Add a reference-variant for typeId() and do it like Thermo & ReactingParcel:
reinterpret_cast<const>(
&const_cast<kinematicparcel<parceltype>&>(p).typeI d()
),

mattijs August 18, 2008 06:18

Thanks - we put it in.
 
Thanks - we put it in.


All times are GMT -4. The time now is 17:53.