KratosMultiphysics
KRATOS Multiphysics (Kratos) is a framework for building parallel, multi-disciplinary simulation software, aiming at modularity, extensibility, and high performance. Kratos is written in C++, and counts with an extensive Python interface.
List of all members
Kratos::Chunk Class Reference

Chunk is the smallest building block of Kratos memory management. More...

#include <chunk.h>

Collaboration diagram for Kratos::Chunk:

Public Types

Type Definitions
using BlockType = std::int64_t
 
using SizeType = std::size_t
 

Public Member Functions

Life Cycle
 Chunk ()=delete
 Default constructor is deleted. More...
 
 Chunk (Chunk const &rOther)=delete
 Copy constructor is deleted. More...
 
 Chunk (Chunk &&rOther)=delete
 
 Chunk (std::size_t BlockSizeInBytes, SizeType SizeInBytes) noexcept
 The constructor to be called. More...
 
 ~Chunk () noexcept
 Destructor is not virtual. This class can not be drived. More...
 
Operators
Chunkoperator= (Chunk const &rOther)=delete
 Assignment operator is deleted. More...
 
Access
SizeType GetNumberOfBlocks () const
 
SizeType GetNumberOfAvailableBlocks () const
 
const BlockTypepGetData () const
 
const BlockTypepDataBegin () const
 
const BlockTypepDataEnd () const
 
Inquiry
bool HasAvailableBlock () const
 
bool Has (const void *pThePointer) const
 
bool IsEmpty () const
 
bool IsFull ()
 
bool IsInitialized () const
 
bool IsReleased () const
 
void lock ()
 
void unlock ()
 
Input and output
std::string Info () const
 Turn back information as a string. More...
 
void PrintInfo (std::ostream &rOStream) const
 Print information about this object. More...
 
void PrintData (std::ostream &rOStream) const
 Print object's data. More...
 

Operations

void Initialize ()
 
void * Allocate ()
 This function does not throw and returns zero if cannot allocate. More...
 
void Deallocate (void *pPointrerToRelease)
 
void Release ()
 
std::size_t Size () const
 
std::size_t MemoryUsed () const
 
std::size_t MemoryOverhead () const
 

Detailed Description

Chunk is the smallest building block of Kratos memory management.

The memory management of Kratos is implemented based on the design given in Modern C++ Design by A. Alexandrescu and chunk is the lower layer of it holding a chunk of NumberOfBlocks objects of BlockSize. This implementation is designed for large chunk size (i.e. 1M) imposes more overhead than the reference for storing a header containing the chunk size and block size.

Member Typedef Documentation

◆ BlockType

using Kratos::Chunk::BlockType = std::int64_t

◆ SizeType

using Kratos::Chunk::SizeType = std::size_t

Constructor & Destructor Documentation

◆ Chunk() [1/4]

Kratos::Chunk::Chunk ( )
delete

Default constructor is deleted.

◆ Chunk() [2/4]

Kratos::Chunk::Chunk ( Chunk const &  rOther)
delete

Copy constructor is deleted.

◆ Chunk() [3/4]

Kratos::Chunk::Chunk ( Chunk &&  rOther)
delete

◆ Chunk() [4/4]

Kratos::Chunk::Chunk ( std::size_t  BlockSizeInBytes,
SizeType  SizeInBytes 
)
inlinenoexcept

The constructor to be called.

◆ ~Chunk()

Kratos::Chunk::~Chunk ( )
inlinenoexcept

Destructor is not virtual. This class can not be drived.

Member Function Documentation

◆ Allocate()

void* Kratos::Chunk::Allocate ( )
inline

This function does not throw and returns zero if cannot allocate.

◆ Deallocate()

void Kratos::Chunk::Deallocate ( void *  pPointrerToRelease)
inline

◆ GetNumberOfAvailableBlocks()

SizeType Kratos::Chunk::GetNumberOfAvailableBlocks ( ) const
inline

◆ GetNumberOfBlocks()

SizeType Kratos::Chunk::GetNumberOfBlocks ( ) const
inline

◆ Has()

bool Kratos::Chunk::Has ( const void *  pThePointer) const
inline

◆ HasAvailableBlock()

bool Kratos::Chunk::HasAvailableBlock ( ) const
inline

◆ Info()

std::string Kratos::Chunk::Info ( ) const
inline

Turn back information as a string.

◆ Initialize()

void Kratos::Chunk::Initialize ( )
inline

◆ IsEmpty()

bool Kratos::Chunk::IsEmpty ( ) const
inline

◆ IsFull()

bool Kratos::Chunk::IsFull ( )
inline

◆ IsInitialized()

bool Kratos::Chunk::IsInitialized ( ) const
inline

◆ IsReleased()

bool Kratos::Chunk::IsReleased ( ) const
inline

◆ lock()

void Kratos::Chunk::lock ( )
inline

◆ MemoryOverhead()

std::size_t Kratos::Chunk::MemoryOverhead ( ) const
inline

◆ MemoryUsed()

std::size_t Kratos::Chunk::MemoryUsed ( ) const
inline

◆ operator=()

Chunk& Kratos::Chunk::operator= ( Chunk const &  rOther)
delete

Assignment operator is deleted.

◆ pDataBegin()

const BlockType* Kratos::Chunk::pDataBegin ( ) const
inline

◆ pDataEnd()

const BlockType* Kratos::Chunk::pDataEnd ( ) const
inline

◆ pGetData()

const BlockType* Kratos::Chunk::pGetData ( ) const
inline

◆ PrintData()

void Kratos::Chunk::PrintData ( std::ostream &  rOStream) const
inline

Print object's data.

◆ PrintInfo()

void Kratos::Chunk::PrintInfo ( std::ostream &  rOStream) const
inline

Print information about this object.

◆ Release()

void Kratos::Chunk::Release ( )
inline

◆ Size()

std::size_t Kratos::Chunk::Size ( ) const
inline

◆ unlock()

void Kratos::Chunk::unlock ( )
inline

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