diff --git a/apps/benchmarks/GranularGas/GenerateModule.py b/apps/benchmarks/GranularGas/GenerateModule.py index 573be3b4273e0885b35e5d6e39db2e6d4864c004..1e98dd07eb9d5a2d3a1e9b16d9d3fdf13125af98 100755 --- a/apps/benchmarks/GranularGas/GenerateModule.py +++ b/apps/benchmarks/GranularGas/GenerateModule.py @@ -36,17 +36,17 @@ if __name__ == '__main__': ps.addProperty("position", "walberla::mesa_pd::Vec3", defValue="real_t(0)", syncMode="ALWAYS") ps.addProperty("linearVelocity", "walberla::mesa_pd::Vec3", defValue="real_t(0)", syncMode="ALWAYS") - ps.addProperty("invMass", "walberla::real_t", defValue="real_t(1)", syncMode="COPY") + ps.addProperty("invMass", "walberla::real_t", defValue="real_t(1)", syncMode="ON_GHOST_CREATION") ps.addProperty("force", "walberla::mesa_pd::Vec3", defValue="real_t(0)", syncMode="NEVER") - ps.addProperty("shapeID", "size_t", defValue="", syncMode="COPY") + ps.addProperty("shapeID", "size_t", defValue="", syncMode="ON_GHOST_CREATION") ps.addProperty("rotation", "walberla::mesa_pd::Rot3", defValue="", syncMode="ALWAYS") ps.addProperty("angularVelocity", "walberla::mesa_pd::Vec3", defValue="real_t(0)", syncMode="ALWAYS") ps.addProperty("torque", "walberla::mesa_pd::Vec3", defValue="real_t(0)", syncMode="NEVER") - ps.addProperty("type", "uint_t", defValue="0", syncMode="COPY") + ps.addProperty("type", "uint_t", defValue="0", syncMode="ON_GHOST_CREATION") - ps.addProperty("flags", "walberla::mesa_pd::data::particle_flags::FlagT", defValue="", syncMode="COPY") + ps.addProperty("flags", "walberla::mesa_pd::data::particle_flags::FlagT", defValue="", syncMode="ON_GHOST_CREATION") ps.addProperty("nextParticle", "int", defValue="-1", syncMode="NEVER") ps.addInclude("blockforest/BlockForest.h") diff --git a/python/mesa_pd.py b/python/mesa_pd.py index c4ba4e61ae2faeb121ef953b493d28bb7c73b2cf..17c03fb8d7d9104f9b9c76546622982331b6f92f 100755 --- a/python/mesa_pd.py +++ b/python/mesa_pd.py @@ -38,22 +38,22 @@ if __name__ == '__main__': ps.addProperty("position", "walberla::mesa_pd::Vec3", defValue="real_t(0)", syncMode="ALWAYS") ps.addProperty("linearVelocity", "walberla::mesa_pd::Vec3", defValue="real_t(0)", syncMode="ALWAYS") - ps.addProperty("invMass", "walberla::real_t", defValue="real_t(1)", syncMode="COPY") + ps.addProperty("invMass", "walberla::real_t", defValue="real_t(1)", syncMode="ON_GHOST_CREATION") ps.addProperty("force", "walberla::mesa_pd::Vec3", defValue="real_t(0)", syncMode="NEVER") - ps.addProperty("oldForce", "walberla::mesa_pd::Vec3", defValue="real_t(0)", syncMode="MIGRATION") + ps.addProperty("oldForce", "walberla::mesa_pd::Vec3", defValue="real_t(0)", syncMode="ON_OWNERSHIP_CHANGE") - ps.addProperty("shapeID", "size_t", defValue="", syncMode="COPY") + ps.addProperty("shapeID", "size_t", defValue="", syncMode="ON_GHOST_CREATION") ps.addProperty("rotation", "walberla::mesa_pd::Rot3", defValue="", syncMode="ALWAYS") ps.addProperty("angularVelocity", "walberla::mesa_pd::Vec3", defValue="real_t(0)", syncMode="ALWAYS") ps.addProperty("torque", "walberla::mesa_pd::Vec3", defValue="real_t(0)", syncMode="NEVER") - ps.addProperty("oldTorque", "walberla::mesa_pd::Vec3", defValue="real_t(0)", syncMode="MIGRATION") + ps.addProperty("oldTorque", "walberla::mesa_pd::Vec3", defValue="real_t(0)", syncMode="ON_OWNERSHIP_CHANGE") ps.addInclude("blockforest/BlockForest.h") ps.addProperty("currentBlock", "blockforest::BlockID", defValue="", syncMode="NEVER") - ps.addProperty("type", "uint_t", defValue="0", syncMode="COPY") + ps.addProperty("type", "uint_t", defValue="0", syncMode="ON_GHOST_CREATION") - ps.addProperty("flags", "walberla::mesa_pd::data::particle_flags::FlagT", defValue="", syncMode="COPY") + ps.addProperty("flags", "walberla::mesa_pd::data::particle_flags::FlagT", defValue="", syncMode="ON_GHOST_CREATION") ps.addProperty("nextParticle", "int", defValue="-1", syncMode="NEVER") ps.addProperty("oldContactHistory", "std::map<walberla::id_t, walberla::mesa_pd::data::ContactHistory>", defValue="", syncMode="ALWAYS") diff --git a/python/mesa_pd/Property.py b/python/mesa_pd/Property.py index 20b3bc8d7325af62babb6128239523cddc367afe..d0da37d9fe21109f5ec01c307ca7e3ccf99de2b5 100644 --- a/python/mesa_pd/Property.py +++ b/python/mesa_pd/Property.py @@ -21,8 +21,8 @@ class Property: default value the property should be initialized with syncMode : str 'NEVER', this property does not have to be synced - 'COPY', this property must be synced on creation - 'MIGRATION', this property must be synced when the ownership changes + 'ON_GHOST_CREATION', this property must be synced on creation + 'ON_OWNERSHIP_CHANGE', this property must be synced when the ownership changes 'ALWAYS', this property has to be synced in every iteration dim : int dimensions of the property @@ -36,7 +36,7 @@ class Property: if not (acc in ["g","s","r"]): raise RuntimeError("{} is not a valid access specifier in {}".format(acc, access)) - if (not syncMode in ["NEVER", "COPY", "MIGRATION", "ALWAYS"]): + if (not syncMode in ["NEVER", "ON_GHOST_CREATION", "ON_OWNERSHIP_CHANGE", "ALWAYS"]): raise RuntimeError(TerminalColor.RED + "{} is no valid sync for property: {}".format(syncMode, name) + TerminalColor.DEFAULT) if (dim < 1): diff --git a/python/mesa_pd/data/ParticleStorage.py b/python/mesa_pd/data/ParticleStorage.py index 21c21c381bd657def2210cf79e63924dd25fa70c..5dd9d7703cb74918fb78af86234b653b7a34b361 100644 --- a/python/mesa_pd/data/ParticleStorage.py +++ b/python/mesa_pd/data/ParticleStorage.py @@ -12,10 +12,10 @@ class ParticleStorage(Container): self.addProperty("uid", "walberla::id_t", defValue = "UniqueID<data::Particle>::invalidID()", syncMode="ALWAYS") self.addProperty("position", "walberla::mesa_pd::Vec3", defValue = "real_t(0)", syncMode="ALWAYS") - self.addProperty("interactionRadius", "walberla::real_t", defValue = "real_t(0)", syncMode="COPY") - self.addProperty("flags", "walberla::mesa_pd::data::particle_flags::FlagT", defValue = "", syncMode="COPY") - self.addProperty("owner", "int", defValue = "-1", syncMode="COPY") - self.addProperty("ghostOwners", "std::unordered_set<walberla::mpi::MPIRank>", defValue = "", syncMode="MIGRATION") + self.addProperty("interactionRadius", "walberla::real_t", defValue = "real_t(0)", syncMode="ON_GHOST_CREATION") + self.addProperty("flags", "walberla::mesa_pd::data::particle_flags::FlagT", defValue = "", syncMode="ON_GHOST_CREATION") + self.addProperty("owner", "int", defValue = "-1", syncMode="ON_GHOST_CREATION") + self.addProperty("ghostOwners", "std::unordered_set<walberla::mpi::MPIRank>", defValue = "", syncMode="ON_OWNERSHIP_CHANGE") def generate(self, path): self.unrollDimension() diff --git a/python/mesa_pd/data/ShapeStorage.py b/python/mesa_pd/data/ShapeStorage.py index f299b89d3b56a7398fb712e4a1f608ba2344f42d..74b4f598e7b869cd00c621f042dee61da83862c9 100644 --- a/python/mesa_pd/data/ShapeStorage.py +++ b/python/mesa_pd/data/ShapeStorage.py @@ -5,7 +5,7 @@ from ..utility import generateFile class ShapeStorage: def __init__(self, p, shapes): - p.addProperty("shapeID", "size_t", defValue="", syncMode="COPY") + p.addProperty("shapeID", "size_t", defValue="", syncMode="ON_GHOST_CREATION") p.addProperty("rotation", "walberla::mesa_pd::Rot3", defValue="", syncMode="ALWAYS") p.addProperty("angularVelocity", "walberla::mesa_pd::Vec3", defValue="real_t(0)", syncMode="ALWAYS") p.addProperty("torque", "walberla::mesa_pd::Vec3", defValue="real_t(0)", syncMode="NEVER") diff --git a/python/mesa_pd/templates/mpi/notifications/ParseMessage.templ.h b/python/mesa_pd/templates/mpi/notifications/ParseMessage.templ.h index b144ddbdde45dfe7412152c864e82353515f7665..69ea479ea6806aad83dbecaf9d00e610969bdbc8 100644 --- a/python/mesa_pd/templates/mpi/notifications/ParseMessage.templ.h +++ b/python/mesa_pd/templates/mpi/notifications/ParseMessage.templ.h @@ -135,7 +135,7 @@ void ParseMessage::operator()(int sender, pIt->setOwner(receiver_); data::particle_flags::unset(pIt->getFlagsRef(), data::particle_flags::GHOST); {%- for prop in properties %} - {%- if prop.syncMode in ["MIGRATION"] %} + {%- if prop.syncMode in ["ON_OWNERSHIP_CHANGE"] %} pIt->set{{prop.name | capFirst}}(objparam.{{prop.name}}_); {%- endif %} {%- endfor %} diff --git a/python/mesa_pd/templates/mpi/notifications/ParticleCopyNotification.templ.h b/python/mesa_pd/templates/mpi/notifications/ParticleCopyNotification.templ.h index c2ea7d768bf5471c725bf4e2e4a53c3a1de5e093..caea4028886901eba9a8e0649be5fb671f42b0fa 100644 --- a/python/mesa_pd/templates/mpi/notifications/ParticleCopyNotification.templ.h +++ b/python/mesa_pd/templates/mpi/notifications/ParticleCopyNotification.templ.h @@ -41,7 +41,7 @@ namespace mesa_pd { /** * A complete particle copy for a new ghost particle. * - * Copies all properties marked COPY or ALWAYS. + * Copies all properties marked ON_GHOST_CREATION or ALWAYS. */ class ParticleCopyNotification { @@ -49,7 +49,7 @@ public: struct Parameters { {%- for prop in properties %} - {%- if prop.syncMode in ["COPY", "ALWAYS"] %} + {%- if prop.syncMode in ["ON_GHOST_CREATION", "ALWAYS"] %} {{prop.type}} {{prop.name}} {{'{'}}{{prop.defValue}}{{'}'}}; {%- endif %} {%- endfor %} @@ -65,7 +65,7 @@ inline data::ParticleStorage::iterator createNewParticle(data::ParticleStorage& auto pIt = ps.create(data.uid); {%- for prop in properties %} - {%- if prop.syncMode in ["COPY", "ALWAYS"] %} + {%- if prop.syncMode in ["ON_GHOST_CREATION", "ALWAYS"] %} pIt->set{{prop.name | capFirst}}(data.{{prop.name}}); {%- endif %} {%- endfor %} @@ -96,7 +96,7 @@ mpi::GenericSendBuffer<T,G>& operator<<( mpi::GenericSendBuffer<T,G> & buf, cons { buf.addDebugMarker( "cn" ); {%- for prop in properties %} - {%- if prop.syncMode in ["COPY", "ALWAYS"] %} + {%- if prop.syncMode in ["ON_GHOST_CREATION", "ALWAYS"] %} buf << obj.particle_.get{{prop.name | capFirst}}(); {%- endif %} {%- endfor %} @@ -108,7 +108,7 @@ mpi::GenericRecvBuffer<T>& operator>>( mpi::GenericRecvBuffer<T> & buf, mesa_pd: { buf.readDebugMarker( "cn" ); {%- for prop in properties %} - {%- if prop.syncMode in ["COPY", "ALWAYS"] %} + {%- if prop.syncMode in ["ON_GHOST_CREATION", "ALWAYS"] %} buf >> objparam.{{prop.name}}; {%- endif %} {%- endfor %} diff --git a/python/mesa_pd/templates/mpi/notifications/ParticleMigrationNotification.templ.h b/python/mesa_pd/templates/mpi/notifications/ParticleMigrationNotification.templ.h index 3e78ed0b725c1397ae3da636491b30cc9a2722d1..3ca6e41de648bc20658156f348011ebd82a1dad5 100644 --- a/python/mesa_pd/templates/mpi/notifications/ParticleMigrationNotification.templ.h +++ b/python/mesa_pd/templates/mpi/notifications/ParticleMigrationNotification.templ.h @@ -46,7 +46,7 @@ public: struct Parameters { id_t uid_; {%- for prop in properties %} - {%- if prop.syncMode in ["MIGRATION"] %} + {%- if prop.syncMode in ["ON_OWNERSHIP_CHANGE"] %} {{prop.type}} {{prop.name}}_ {{'{'}}{{prop.defValue}}{{'}'}}; {%- endif %} {%- endfor %} @@ -81,7 +81,7 @@ mpi::GenericSendBuffer<T,G>& operator<<( mpi::GenericSendBuffer<T,G> & buf, cons buf.addDebugMarker( "mn" ); buf << obj.particle_.getUid(); {%- for prop in properties %} - {%- if prop.syncMode in ["MIGRATION"] %} + {%- if prop.syncMode in ["ON_OWNERSHIP_CHANGE"] %} buf << obj.particle_.get{{prop.name | capFirst}}(); {%- endif %} {%- endfor %} @@ -94,7 +94,7 @@ mpi::GenericRecvBuffer<T>& operator>>( mpi::GenericRecvBuffer<T> & buf, mesa_pd: buf.readDebugMarker( "mn" ); buf >> objparam.uid_; {%- for prop in properties %} - {%- if prop.syncMode in ["MIGRATION"] %} + {%- if prop.syncMode in ["ON_OWNERSHIP_CHANGE"] %} buf >> objparam.{{prop.name}}_; {%- endif %} {%- endfor %} diff --git a/src/mesa_pd/mpi/notifications/ParticleCopyNotification.h b/src/mesa_pd/mpi/notifications/ParticleCopyNotification.h index 5fdb79680bce3c05a36fc1f3db6b99fd13062939..bba3bcd179ade81faca207394c67906146d6e7aa 100644 --- a/src/mesa_pd/mpi/notifications/ParticleCopyNotification.h +++ b/src/mesa_pd/mpi/notifications/ParticleCopyNotification.h @@ -41,7 +41,7 @@ namespace mesa_pd { /** * A complete particle copy for a new ghost particle. * - * Copies all properties marked COPY or ALWAYS. + * Copies all properties marked ON_GHOST_CREATION or ALWAYS. */ class ParticleCopyNotification {