SPH
Functions
Storage.cpp File Reference
#include "quantities/Storage.h"
#include "objects/Exceptions.h"
#include "physics/Eos.h"
#include "quantities/IMaterial.h"
#include "quantities/Iterate.h"
#include "system/Factory.h"
#include "system/Profiler.h"

Go to the source code of this file.

Functions

Box getBoundingBox (const Storage &storage, const Float radius)
 Convenience function to get the bounding box of all particles. More...
 
Vector getCenterOfMass (const Storage &storage)
 Returns the center of mass of all particles. More...
 
void setPersistentIndices (Storage &storage)
 Adds or updates a quantity holding particle indices to the storage. More...
 

Function Documentation

◆ getBoundingBox()

Box getBoundingBox ( const Storage storage,
const Float  radius = 2._f 
)

Convenience function to get the bounding box of all particles.

This takes into account particle radii, using given kernel radius.

Definition at line 832 of file Storage.cpp.

◆ getCenterOfMass()

Vector getCenterOfMass ( const Storage storage)

Returns the center of mass of all particles.

Function can be called even if the storage does not store particle masses, in which case all particles are assumed to have equal mass.

Definition at line 842 of file Storage.cpp.

◆ setPersistentIndices()

void setPersistentIndices ( Storage storage)

Adds or updates a quantity holding particle indices to the storage.

The indices are accessible through quantity QuantityId::PERSISTENT_INDEX. Initially, particle are numbered from 0 to #particleCnt - 1, but the indices are persistent, meaning they remain unchanged when removing particles from the storage. When a particle is removed from the storage, its index can be then re-used by another particle added into the storage.

When merging two storages, indices remain unchanged in the storage where the particles are into, but they are reset in the storage being merged, as they could be collisions of indices. Same goes to particles added via duplicate function.

Definition at line 865 of file Storage.cpp.