Object Belonging checkers

See also the user interface.

Base class

class ObjectBelongingChecker : public mirheo::MirSimulationObject

Mark or split particles which are inside of a given ObjectVector.

The user must call setup() exactly once before any call of checkInner() or splitByBelonging().

Subclassed by mirheo::ObjectVectorBelongingChecker

Public Functions

ObjectBelongingChecker(const MirState *state, const std::string &name)

Construct a ObjectBelongingChecker object.

Parameters
  • state: Simulation state.
  • name: Name of the bouncer.

virtual void splitByBelonging(ParticleVector *src, ParticleVector *pvIn, ParticleVector *pvOut, cudaStream_t stream) = 0

Split a ParticleVector into inside and outside particles.

The

pvIn and pvOut ParticleVector can be set to nullptr, in which case they will be ignored. If pvIn and src point to the same object, pvIn will contain only inside particles of src in the end. Otherwise, pvIn will contain its original particles additionally to the inside particles of src. If pvOut and src point to the same object, pvOut will contain only outside particles of src in the end. Otherwise, pvOut will contain its original particles additionally to the outside particles of src.
Parameters
  • src: The particles to split.
  • pvIn: Buffer that will contain the inside particles.
  • pvOut: Buffer that will contain the outside particles.
  • stream: Stream used for the execution.

This method will die if the type of pvIn, pvOut and src have a different type.

Must be called after setup().

virtual void checkInner(ParticleVector *pv, CellList *cl, cudaStream_t stream) = 0

Prints number of inside and outside particles in the log as a Info entry.

Additionally, this will compute the inside/outside tags of the particles and store it inside this object instance.

Parameters
  • pv: The particles to check.
  • cl: Cell lists of pv.
  • stream: Stream used for execution.

Must be called after setup().

virtual void setup(ObjectVector *ov) = 0

Register the ObjectVector that defines inside and outside.

Parameters

virtual std::vector<std::string> getChannelsToBeExchanged() const

Return the channels of the registered ObjectVector to be exchanged before splitting.

virtual ObjectVector *getObjectVector() = 0

Return the registered ObjectVector.

Derived classes

class ObjectVectorBelongingChecker : public mirheo::ObjectBelongingChecker

ObjectBelongingChecker base implementation.

Subclassed by mirheo::MeshBelongingChecker, mirheo::RodBelongingChecker, mirheo::ShapeBelongingChecker< Shape >

Public Functions

ObjectVectorBelongingChecker(const MirState *state, const std::string &name)

Construct a ObjectVectorBelongingChecker object.

Parameters
  • state: Simulation state.
  • name: Name of the bouncer.

void splitByBelonging(ParticleVector *src, ParticleVector *pvIn, ParticleVector *pvOut, cudaStream_t stream)

Split a ParticleVector into inside and outside particles.

The

pvIn and pvOut ParticleVector can be set to nullptr, in which case they will be ignored. If pvIn and src point to the same object, pvIn will contain only inside particles of src in the end. Otherwise, pvIn will contain its original particles additionally to the inside particles of src. If pvOut and src point to the same object, pvOut will contain only outside particles of src in the end. Otherwise, pvOut will contain its original particles additionally to the outside particles of src.
Parameters
  • src: The particles to split.
  • pvIn: Buffer that will contain the inside particles.
  • pvOut: Buffer that will contain the outside particles.
  • stream: Stream used for the execution.

This method will die if the type of pvIn, pvOut and src have a different type.

Must be called after setup().

void checkInner(ParticleVector *pv, CellList *cl, cudaStream_t stream)

Prints number of inside and outside particles in the log as a Info entry.

Additionally, this will compute the inside/outside tags of the particles and store it inside this object instance.

Parameters
  • pv: The particles to check.
  • cl: Cell lists of pv.
  • stream: Stream used for execution.

Must be called after setup().

void setup(ObjectVector *ov)

Register the ObjectVector that defines inside and outside.

Parameters

std::vector<std::string> getChannelsToBeExchanged() const

Return the channels of the registered ObjectVector to be exchanged before splitting.

ObjectVector *getObjectVector()

Return the registered ObjectVector.

class MeshBelongingChecker : public mirheo::ObjectVectorBelongingChecker

Check in/out status of particles against an ObjectVector with a triangle mesh.

class RodBelongingChecker : public mirheo::ObjectVectorBelongingChecker

Check in/out status of particles against a RodObjectVector.

Public Functions

RodBelongingChecker(const MirState *state, const std::string &name, real radius)

Construct a RodBelongingChecker object.

Parameters
  • state: Simulation state.
  • name: Name of the bouncer.
  • radius: The radius of the rod. Must be positive.

template <class Shape>
class ShapeBelongingChecker : public mirheo::ObjectVectorBelongingChecker

Check in/out status of particles against a RigidShapedObjectVector.

Template Parameters
  • Shape: The AnalyticShape that represent the shape of the objects.