SPH
Public Types | Public Member Functions | List of all members
HexagonalPacking Class Reference

Hexagonal close packing. More...

#include <Distribution.h>

Inheritance diagram for HexagonalPacking:
IDistribution Polymorphic

Public Types

enum class  Options { SORTED = 1 << 0 , CENTER = 1 << 1 , SPH5_COMPATIBILITY = 1 << 2 }
 

Public Member Functions

 HexagonalPacking (const Flags< Options > flags=Options::CENTER)
 
 HexagonalPacking (const Flags< Options > flags, Function< bool(Float)> progressCallback)
 
virtual Array< Vectorgenerate (IScheduler &scheduler, const Size n, const IDomain &domain) const override
 Generates the requested number of particles in the domain. More...
 
- Public Member Functions inherited from Polymorphic
virtual ~Polymorphic ()
 

Detailed Description

Hexagonal close packing.

Definition at line 72 of file Distribution.h.

Member Enumeration Documentation

◆ Options

Enumerator
SORTED 

Particles are sorted using its Morton code.

    If used, particles close in space are also close in memory. Otherwise, particles are sorted along
    x axis, secondary along y and z axes. 
CENTER 

Move particle lattice so that their center of mass matches center of domain.

    This assumes all particles have the same mass. Note that with this options, generated particles
    does not have to be strictly inside given domain. 
SPH5_COMPATIBILITY 

Generates the grid to match code SPH5 for 1-1 comparison.

    Not that this will generate significantly more particles than requested (approximately by
    factor 1.4). 

Definition at line 74 of file Distribution.h.

Constructor & Destructor Documentation

◆ HexagonalPacking() [1/2]

HexagonalPacking::HexagonalPacking ( const Flags< Options flags = Options::CENTER)
explicit

Definition at line 123 of file Distribution.cpp.

◆ HexagonalPacking() [2/2]

HexagonalPacking::HexagonalPacking ( const Flags< Options flags,
Function< bool(Float)>  progressCallback 
)

Definition at line 126 of file Distribution.cpp.

Member Function Documentation

◆ generate()

Array< Vector > HexagonalPacking::generate ( IScheduler scheduler,
const Size  n,
const IDomain domain 
) const
overridevirtual

Generates the requested number of particles in the domain.

Function shall also set the smoothing lenghts of the generated particles in the 4th components of the returned vectors.

Parameters
schedulerScheduler that can be used for parallelization.
nExpected number of generated particles.
domainComputational domain where the vertices are distributed
Returns
Output array of vertices. The total number of vertices can slightly differ from n.
Note
This method is expected to be called once at the beginning of the run, so we can return allocated array without worrying about performance costs here.

Implements IDistribution.

Definition at line 130 of file Distribution.cpp.


The documentation for this class was generated from the following files: