UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
UE::Geometry::TBlockedDenseGrid3< ElemType > Class Template Reference

#include <BlockedDenseGrid3.h>

+ Inheritance diagram for UE::Geometry::TBlockedDenseGrid3< ElemType >:

Public Types

typedef TBasicBlockedDenseGrid3< ElemType, BlockSizeBlockedDenseGridType
 
typedef TBlockedGrid3Layout< BlockSizeBlockedGrid3LayoutType
 
typedef TBlockData3< ElemType, BlockSizeBlockData3Type
 
- Public Types inherited from UE::Geometry::TBasicBlockedDenseGrid3< ElemType, 32 >
typedef TBlockedGrid3Layout< BlockSize_BlockedGrid3LayoutType
 
typedef TBlockData3< ElemType, BlockSize_BlockData3Type
 
- Public Types inherited from UE::Geometry::TBlockedGrid3Layout< BlockSize_ >
typedef TBlockData3Layout< BlockSize_FBlockData3Layout
 

Public Member Functions

 TBlockedDenseGrid3 ()
 
 TBlockedDenseGrid3 (int32 DimI, int32 DimJ, int32 DimK, ElemType InitialValue)
 
void Resize (int32 DimI, int32 DimJ, int32 DimK)
 
void Reset ()
 
void Reset (int32 DimI, int32 DimJ, int32 DimK, ElemType InitialValue)
 
bool IsValidIndex (FVector3i CellIJK) const
 
ElemType GetValueThreadSafe (int32 I, int32 J, int32 K)
 
ElemType GetValueThreadSafe (const FVector3i &CellIJK)
 
void SetValueThreadSafe (int32 I, int32 J, int32 K, ElemType NewValue)
 
void SetValueThreadSafe (const FVector3i &CellIJK, ElemType NewValue)
 
template<typename ProcessFunc >
void ProcessValueThreadSafe (int32 I, int32 J, int32 K, ProcessFunc Func)
 
template<typename ProcessFunc >
void ProcessValueThreadSafe (const FVector3i &CellIJK, ProcessFunc Func)
 
FVector3i ToIndex (int64 LinearIndex) const
 
int64 ToLinear (int32 X, int32 Y, int32 Z) const
 
int64 ToLinear (const FVector3i &IJK) const
 
- Public Member Functions inherited from UE::Geometry::TBasicBlockedDenseGrid3< ElemType, 32 >
 TBasicBlockedDenseGrid3 ()
 
 TBasicBlockedDenseGrid3 (int32 DimI, int32 DimJ, int32 DimK, ElemType InitialValue)
 
void Resize (int32 DimI, int32 DimJ, int32 DimK)
 
void Reset ()
 
void Reset (int32 DimI, int32 DimJ, int32 DimK, ElemType InitialValue)
 
ElemType GetValue (int32 I, int32 J, int32 K) const
 
ElemType GetValue (const FVector3i &CellIJK) const
 
void SetValue (int32 I, int32 J, int32 K, ElemType NewValue)
 
void SetValue (const FVector3i &CellIJK, ElemType NewValue)
 
void ProcessValue (int32 I, int32 J, int32 K, ProcessFunc Func)
 
void ProcessValue (const FVector3i &CellIJK, ProcessFunc Func)
 
bool PreAllocateFromSourceGrid (const TBasicBlockedDenseGrid3< OtherElemType, BlockSize > &SourceGrid)
 
int32 GetNumBlocks () const
 
- Public Member Functions inherited from UE::Geometry::TBlockedGrid3Layout< BlockSize_ >
 TBlockedGrid3Layout ()
 
 TBlockedGrid3Layout (int32 DimI, int32 DimJ, int32 DimK)
 
 TBlockedGrid3Layout (FVector3i Dims)
 
void Resize (int32 DimI, int32 DimJ, int32 DimK)
 
const FVector3iGetDimensions () const
 
const FVector3iGetBlockDimensions () const
 
FAxisAlignedBox3i Bounds () const
 
FAxisAlignedBox3i BoundsInclusive () const
 
int64 Size () const
 
bool IsValidIJK (const FVector3i &IJK) const
 
bool IsValidBlockIJK (const FVector3i &BlockIJK)
 
int32 IJKtoBlockIndex (const FVector3i &IJK) const
 
void GetBlockAndLocalIndex (const FVector3i &IJK, int32 &BlockIndexOut, int32 &LocalIndexOut) const
 
void GetBlockAndLocalIndex (int32 I, int32 J, int32 K, int32 &BlockIndexOut, int32 &LocalIndexOut) const
 
FVector3i BlockIndexToBlockIJK (const int32 BlockIndex) const
 
int32 BlockIJKToBlockIndex (const FVector3i &BlockIJK) const
 

Static Public Attributes

static constexpr int32 BlockSize = 32
 
static constexpr int32 BlockElemCount = BlockSize * BlockSize * BlockSize
 
- Static Public Attributes inherited from UE::Geometry::TBasicBlockedDenseGrid3< ElemType, 32 >
static constexpr int32 BlockSize
 
static constexpr int32 BlockElemCount
 
- Static Public Attributes inherited from UE::Geometry::TBlockedGrid3Layout< BlockSize_ >
static constexpr int32 BlockSize = BlockSize_
 
static constexpr int32 BlockElemCount = BlockSize * BlockSize * BlockSize
 

Protected Member Functions

FCriticalSectionGetBlockLock (int32 Index)
 
template<typename FuncType >
void WriteValueThreadSafe (int32 I, int32 J, int32 K, FuncType Func)
 
ElemType ReadValueThreadSafe (int32 I, int32 J, int32 K)
 
- Protected Member Functions inherited from UE::Geometry::TBasicBlockedDenseGrid3< ElemType, 32 >
FBlock3 & GetBlock (int32 Index)
 
const FBlock3 & GetBlock (int32 Index) const
 
bool IsBlockAllocated (const FBlock3 &Block) const
 
bool IsBlockAllocated (const int32 BlockIndex) const
 
BlockData3TypeTouchBlockData (const int32 BlockIndex)
 
void WriteValue (const int32 &BlockIndex, const int32 &LocalIndex, FuncType Func)
 
void WriteValue (int32 I, int32 J, int32 K, FuncType Func)
 
void WriteValueWithLock (const int32 &BlockIndex, const int32 &LocalIndex, FuncType Func, FCriticalSection *CriticalSection)
 
ElemType ReadValue (const int32 &BlockIndex, const int32 &LocalIndex) const
 
ElemType ReadValue (int32 I, int32 J, int32 K) const
 
ElemType ReadValueWithLock (const int32 &BlockIndex, const int32 &LocalIndex, FCriticalSection *CriticalSection)
 
bool AllocateTopologyUnionImpl (const OtherGridType &OtherGrid)
 

Protected Attributes

TArray< FCriticalSectionBlockLocks
 
- Protected Attributes inherited from UE::Geometry::TBasicBlockedDenseGrid3< ElemType, 32 >
ElemType DefaultValue
 
TArray< FBlock3 > Blocks
 
- Protected Attributes inherited from UE::Geometry::TBlockedGrid3Layout< BlockSize_ >
FVector3i BlockDimensions
 
FVector3i Dimensions
 

Detailed Description

template<typename ElemType>
class UE::Geometry::TBlockedDenseGrid3< ElemType >

TBlockedDenseGrid adds thread-safe access functions to the 3D blocked uniform grid, TBasicBlockedDenseGrid3. Blocked grid is extended by adding internally owned locks for each data block.

The grid is allocated in BlockSize^3 blocks on-demand (BlockSize is a compile-time constant) allowing very large grids to be used without having to pre-allocate all the memory, eg for sparse/narrow-band use cases.

For multi-threaded applications where memory is a premium, consider using TBlockedGrid3 (above) as it gives better control over the individual blocks and allows the caller to manage the lifetime of any locks used.

Member Typedef Documentation

◆ BlockData3Type

template<typename ElemType >
typedef TBlockData3<ElemType, BlockSize> UE::Geometry::TBlockedDenseGrid3< ElemType >::BlockData3Type

◆ BlockedDenseGridType

template<typename ElemType >
typedef TBasicBlockedDenseGrid3<ElemType, BlockSize> UE::Geometry::TBlockedDenseGrid3< ElemType >::BlockedDenseGridType

◆ BlockedGrid3LayoutType

template<typename ElemType >
typedef TBlockedGrid3Layout<BlockSize> UE::Geometry::TBlockedDenseGrid3< ElemType >::BlockedGrid3LayoutType

Constructor & Destructor Documentation

◆ TBlockedDenseGrid3() [1/2]

template<typename ElemType >
UE::Geometry::TBlockedDenseGrid3< ElemType >::TBlockedDenseGrid3 ( )
inline

Create empty grid

◆ TBlockedDenseGrid3() [2/2]

template<typename ElemType >
UE::Geometry::TBlockedDenseGrid3< ElemType >::TBlockedDenseGrid3 ( int32  DimI,
int32  DimJ,
int32  DimK,
ElemType  InitialValue 
)
inline

Create grid with specified domain.

Member Function Documentation

◆ GetBlockLock()

template<typename ElemType >
FCriticalSection * UE::Geometry::TBlockedDenseGrid3< ElemType >::GetBlockLock ( int32  Index)
inlineprotected

◆ GetValueThreadSafe() [1/2]

template<typename ElemType >
ElemType UE::Geometry::TBlockedDenseGrid3< ElemType >::GetValueThreadSafe ( const FVector3i CellIJK)
inline
Returns
the grid value at CellIJK, with internal locking, so it is safe to call this from multiple read & write threads

◆ GetValueThreadSafe() [2/2]

template<typename ElemType >
ElemType UE::Geometry::TBlockedDenseGrid3< ElemType >::GetValueThreadSafe ( int32  I,
int32  J,
int32  K 
)
inline
Returns
the grid value at (I,J,K), with internal locking, so it is safe to call this from multiple read & write threads

◆ IsValidIndex()

template<typename ElemType >
bool UE::Geometry::TBlockedDenseGrid3< ElemType >::IsValidIndex ( FVector3i  CellIJK) const
inline
Returns
true if the specified cell IJK is contained within the grid bounds.

◆ ProcessValueThreadSafe() [1/2]

template<typename ElemType >
template<typename ProcessFunc >
void UE::Geometry::TBlockedDenseGrid3< ElemType >::ProcessValueThreadSafe ( const FVector3i CellIJK,
ProcessFunc  Func 
)
inline

Call an external lambda with a reference to the grid value at CellIJK. Called as Func(ElemType&), so the caller can both read and write the grid cell

◆ ProcessValueThreadSafe() [2/2]

template<typename ElemType >
template<typename ProcessFunc >
void UE::Geometry::TBlockedDenseGrid3< ElemType >::ProcessValueThreadSafe ( int32  I,
int32  J,
int32  K,
ProcessFunc  Func 
)
inline

Call an external lambda with a reference to the grid value at (I,J,K). Called as Func(ElemType&), so the caller can both read and write the grid cell

note: if doing pure reads prefer the GetValue() methods because the ProcessValueThreadSafe method will allocate the underlying data block.

◆ ReadValueThreadSafe()

template<typename ElemType >
ElemType UE::Geometry::TBlockedDenseGrid3< ElemType >::ReadValueThreadSafe ( int32  I,
int32  J,
int32  K 
)
inlineprotected

◆ Reset() [1/2]

template<typename ElemType >
void UE::Geometry::TBlockedDenseGrid3< ElemType >::Reset ( )
inline

Discard all allocated blocks but retain grid dimensions

◆ Reset() [2/2]

template<typename ElemType >
void UE::Geometry::TBlockedDenseGrid3< ElemType >::Reset ( int32  DimI,
int32  DimJ,
int32  DimK,
ElemType  InitialValue 
)
inline

Reconfigure the grid to have the target dimensions and default value. This clears all the existing grid memory.

◆ Resize()

template<typename ElemType >
void UE::Geometry::TBlockedDenseGrid3< ElemType >::Resize ( int32  DimI,
int32  DimJ,
int32  DimK 
)
inline

Reconfigure the grid to have the target dimensions. This clears all the existing grid memory and resets the block-level default value.

◆ SetValueThreadSafe() [1/2]

template<typename ElemType >
void UE::Geometry::TBlockedDenseGrid3< ElemType >::SetValueThreadSafe ( const FVector3i CellIJK,
ElemType  NewValue 
)
inline

Set the grid value at CellIJK, with internal locking, so it is safe to call this from multiple read & write threads

◆ SetValueThreadSafe() [2/2]

template<typename ElemType >
void UE::Geometry::TBlockedDenseGrid3< ElemType >::SetValueThreadSafe ( int32  I,
int32  J,
int32  K,
ElemType  NewValue 
)
inline

Set the grid value at (I,J,K), with internal locking, so it is safe to call this from multiple read & write threads

◆ ToIndex()

template<typename ElemType >
FVector3i UE::Geometry::TBlockedDenseGrid3< ElemType >::ToIndex ( int64  LinearIndex) const
inline

Convert a grid cell id to CellIJK coordinates

◆ ToLinear() [1/2]

template<typename ElemType >
int64 UE::Geometry::TBlockedDenseGrid3< ElemType >::ToLinear ( const FVector3i IJK) const
inline

Convert grid CellIJK coordinates to a linear ID, note this id is independent of the actual internal data storage.

◆ ToLinear() [2/2]

template<typename ElemType >
int64 UE::Geometry::TBlockedDenseGrid3< ElemType >::ToLinear ( int32  X,
int32  Y,
int32  Z 
) const
inline

Convert grid CellIJK coordinates to a linear ID, note this id is independent of the actual internal data storage.

◆ WriteValueThreadSafe()

template<typename ElemType >
template<typename FuncType >
void UE::Geometry::TBlockedDenseGrid3< ElemType >::WriteValueThreadSafe ( int32  I,
int32  J,
int32  K,
FuncType  Func 
)
inlineprotected

Member Data Documentation

◆ BlockElemCount

template<typename ElemType >
constexpr int32 UE::Geometry::TBlockedDenseGrid3< ElemType >::BlockElemCount = BlockSize * BlockSize * BlockSize
staticconstexpr

◆ BlockLocks

template<typename ElemType >
TArray<FCriticalSection> UE::Geometry::TBlockedDenseGrid3< ElemType >::BlockLocks
protected

◆ BlockSize

template<typename ElemType >
constexpr int32 UE::Geometry::TBlockedDenseGrid3< ElemType >::BlockSize = 32
staticconstexpr

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