Skip to content
Snippets Groups Projects
Commit 2c8dea8a authored by Sebastian Eibl's avatar Sebastian Eibl
Browse files

[API] renaming of sync modes to make them clearer

COPY -> ON_GHOST_CREATION
MIGRATION -> ON_OWNERSHIP_CHANGE
parent 2ecf9675
No related merge requests found
......@@ -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")
......
......@@ -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")
......
......@@ -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):
......
......@@ -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()
......
......@@ -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")
......
......@@ -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 %}
......
......@@ -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 %}
......
......@@ -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 %}
......
......@@ -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
{
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment