MCPcopy Create free account
hub / github.com/devosoft/avida / migration_message

Class migration_message

avida-core/source/main/cMultiProcessWorld.cc:59–89  ·  view source on GitHub ↗

! Message that is sent from one cMultiProcessWorld to another during organism migration. */

Source from the content-addressed store, hash-verified

57 migration.
58 */
59struct migration_message {
60 //! Default constructor.
61 migration_message() { }
62
63 //! Initializing constructor.
64 migration_message(cOrganism* org, const cPopulationCell& cell, double merit, int lineage)
65 : _merit(merit), _lineage(lineage) {
66 _genome = org->GetGenome().AsString();
67 cell.GetPosition(_x, _y);
68 _generation = org->GetPhenotype().GetGeneration();
69 }
70
71 //! Finish unpacking an organism from this message.
72 void unpack(cOrganism* org) {
73 org->UpdateMerit(cAvidaContext& ctx, _merit);
74 org->GetPhenotype().SetGeneration(_generation);
75 }
76
77 //! Serializer, used to (de)marshal organisms for migration.
78 template<class Archive>
79 void serialize(Archive & ar, const unsigned int version) {
80 ar & _genome & _merit & _lineage & _x & _y & _generation;
81 }
82
83 std::string _genome; //!< Genome of the migrating organism.
84 double _merit; //!< Merit of this organism in its originating population.
85 int _lineage; //!< Lineage label of this organism in its orginating population.
86 int _x; //!< X-coordinate of the cell from which this migrant originated.
87 int _y; //!< Y-coordinate of the cell from which this migrant originated.
88 int _generation; //!< Generation of this organism.
89};
90
91
92/*! Create and initialize a cMultiProcessWorld.

Callers 1

MigrateOrganismMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected