Dear Wolfgang, Thank you for your response. That is exactly what I am trying to do via the deserialize function. I build an object of the desired derived type (based on the derived type data archived during the call to serialize()) and then assign it to the pointer at the receiving end. But the problem is that the deserialize function is never called by boost. I am not sure what hint it needs so as to call the deserialize function. Also, interestingly boost does not call both serialize() or deserialize() during the call to dealii::Utilities::unpack() but it does call serialize() during the call to dealii::Utilities::pack().
Any clues on how to achieve this would be really helpful. Best regards, Paras On Tue, Mar 5, 2024 at 5:40 PM Wolfgang Bangerth <bange...@colostate.edu> wrote: > On 3/5/24 07:46, Paras Kumar wrote: > > > > Within the context of an MPI parallel code, I need to broadcast the > > ConstitutiveParameters struct which contains std::unique pointer to the > base > > class StrainEnergyFuncParameters; cf. MWE file. > > > > Using the ideas discussed in the post > > https://groups.google.com/g/dealii/c/bmqTbs4ofHQ/m/aCuDpUekBAAJ, the > code > > works fine if the members are concrete derived classes since there the > > serialize function is enough. However, I get segmentation fault during > the > > unpack() call since the deserialize() function is not called. > > > > Running the attached MWE would explain the issue. > > > > Could someone please help in understanding how I could solve this issue? > > Yes, this can't work :-) In essence, you are packing up a pointer (=an > address > into memory space) on machine A, and unpack it on machine B. But on > machine B, > nothing useful is likely going to be stored at the location of the memory > address at which there was a useful object on machine A, and so when you > access the data stored at that location, you should not expect anything > good > to happen. > > You need to find a way to serialize/deserialize the data pointed to, not > the > pointer itself. > > Best > W. > > -- > ------------------------------------------------------------------------ > Wolfgang Bangerth email: bange...@colostate.edu > www: http://www.math.colostate.edu/~bangerth/ > > > -- > The deal.II project is located at http://www.dealii.org/ > For mailing list/forum options, see > https://groups.google.com/d/forum/dealii?hl=en > --- > You received this message because you are subscribed to the Google Groups > "deal.II User Group" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to dealii+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/dealii/e7423abb-b213-4575-b407-12d3a2d7d0f8%40colostate.edu > . > -- The deal.II project is located at http://www.dealii.org/ For mailing list/forum options, see https://groups.google.com/d/forum/dealii?hl=en --- You received this message because you are subscribed to the Google Groups "deal.II User Group" group. To unsubscribe from this group and stop receiving emails from it, send an email to dealii+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/dealii/CAEU6zmRSrEe4BW5P%2BNzRYo5dETfgVOYXdYEFBzah-09KP6hnzw%40mail.gmail.com.