SPH
Classes | Functions
Storage.h File Reference

Container for storing particle quantities and materials. More...

#include "common/ForwardDecl.h"
#include "objects/Exceptions.h"
#include "objects/containers/Array.h"
#include "objects/containers/FlatMap.h"
#include "objects/wrappers/Flags.h"
#include "objects/wrappers/Function.h"
#include "objects/wrappers/Outcome.h"
#include "objects/wrappers/SharedPtr.h"
#include "quantities/QuantityIds.h"

Go to the source code of this file.

Classes

struct  StorageElement
 
struct  ConstStorageElement
 
class  StorageIterator
 Helper class for iterating over quantities stored in Storage. More...
 
class  ConstStorageIterator
 Helper class for iterating over quantities stored in Storage, const version. More...
 
class  StorageSequence
 Helper class, provides functions begin and end, returning iterators to the first and last quantity in Storage, respectively. More...
 
class  ConstStorageSequence
 Helper class, provides functions begin and end, returning const iterators to the first and last quantity in Storage, respectively. More...
 
class  IStorageUserData
 Base class for arbitrary data stored in the storage alongside particles. More...
 
class  InvalidStorageAccess
 Exception thrown when accessing missing quantities, casting to different types, etc. More...
 
class  Storage
 Container storing all quantities used within the simulations. More...
 

Functions

Box getBoundingBox (const Storage &storage, const Float radius=2._f)
 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...
 

Detailed Description

Container for storing particle quantities and materials.

Author
Pavel Sevecek (sevecek at sirrah.troja.mff.cuni.cz)
Date
2016-2021

Definition in file Storage.h.

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.