Datatypes

A set of simple POD structures.

struct Real3_int

Helper class for packing/unpacking real3 + integer into real4.

Public Functions

Real3_int(const Real3_int &x)

copy constructor

Real3_int &operator=(const Real3_int &x)

assignment operator

Real3_int()

defult constructor; NO default values!

Real3_int(real3 vecPart, integer intPart)

Constructor from vector and integer.

Real3_int(const real4 r4)

Constructor from 4 components vector; the last one will be reinterpreted to integer (not converted)

real4 toReal4() const

Return
reinterpreted values packed in a real4 (no conversion)

void mark()

Mark this object; see isMarked().

Does not modify the integer part

bool isMarked() const

Return
true if the object has been marked via mark()

Public Members

real3 v

vector part

integer i

integer part

Public Static Attributes

constexpr real mark_val = -8.0e10_r

A special value used to mark particles.

Marked particles will be deleted during cell list rebuild. For objects, objects with all particles marked will be removed during object redistribution.

struct Particle

Structure that holds position, velocity and global index of one particle.

Due to performance reasons it should be aligned to 16 bytes boundary, therefore 8 bytes = 2 integer numbers are extra. The integer fields are used to store the global index

Public Functions

Particle(const Particle &x)

Copy constructor uses efficient 16-bytes wide copies.

Particle &operator=(Particle x)

Assignment operator uses efficient 16-bytes wide copies.

Particle()

Default constructor.

Attention

The default constructor DOES NOT initialize any members!

void setId(int64_t id)

Set the global index of the particle.

int64_t getId() const

Return
the global index of the particle

Particle(const real4 r4, const real4 u4)

Construct a Particle from two real4 entries.

Parameters
  • r4: first three reals will be position (r), last one .w - i1 (reinterpreted, not converted)
  • u4: first three reals will be velocity (u), last one .w - i2 (reinterpreted, not converted)

void readCoordinate(const real4 *addr, const int pid)

read position from array and stores it internally

Parameters
  • addr: start of the array with size > pid
  • pid: particle index

void readVelocity(const real4 *addr, const int pid)

read velocity from array and stores it internally

Parameters
  • addr: pointer to the start of the array. Must be larger than pid
  • pid: particle index

Real3_int r2Real3_int() const

Return
packed r and i1 as Real3_int

real4 r2Real4() const

Helps writing particles back to real4 array.

Return
packed r and i1 as real4

Real3_int u2Real3_int() const

Return
packed u and i2 as Real3_int

real4 u2Real4() const

Helps writing particles back to real4 array.

Return
packed u and i2 as real4

void write2Real4(real4 *pos, real4 *vel, int pid) const

Helps writing particles back to real4 arrays.

Parameters
  • pos: destination array that contains positions
  • vel: destination array that contains velocities
  • pid: particle index

void mark()

mark the particle; this will erase its position information

bool isMarked() const

Return
true if the particle has been marked

Public Members

real3 r

position

integer i1

lower part of particle id

real3 u

velocity

integer i2 = {0}

higher part of particle id

struct Force

Structure that holds force as real4 (to reduce number of load/store instructions)

Due to performance reasons it should be aligned to 16 bytes boundary. The integer field is not reserved for anything at the moment

Public Functions

Force()

default constructor, does NOT initialize anything

Force(const real3 vecPart, int intPart)

Construct a Force from a vector part and an integer part.

Force(const real4 f4)

Construct a force from real4.

The 4th component will be reinterpreted as an integer (not converted)

real4 toReal4() const

Return
packed real part + integer part as real4

Public Members

real3 f

Force value.

integer i

extra integer variable (unused)

struct Stress

Store a symmetric stess tensor in 3 dimensions.

Since it is symmetric, only 6 components are needed (diagonal and upper part

Public Members

real xx

x diagonal term

real xy

xy upper term

real xz

xz upper term

real yy

y diagonal term

real yz

yz upper term

real zz

z diagonal term

struct COMandExtent

Contains the rigid object center of mass and bounding box Used e.g.

to decide which domain the objects belong to and what particles / cells are close to it

Public Members

real3 com

center of mass

real3 low

lower corner of the bounding box

real3 high

upper corner of the bounding box

struct ComQ

Contains coordinates of the center of mass and orientation of an object Used to initialize object positions.

Public Members

real3 r

object position

real4 q

quaternion that represents the orientation