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

#include <BlockedDenseGrid3.h>

+ Inheritance diagram for UE::Geometry::TBasicBlockedDenseGrid3< ElemType, BlockSize_ >:

Classes

struct  FBlock3
 

Public Types

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

Public Member Functions

 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)
 
template<typename ProcessFunc >
void ProcessValue (int32 I, int32 J, int32 K, ProcessFunc Func)
 
template<typename ProcessFunc >
void ProcessValue (const FVector3i &CellIJK, ProcessFunc Func)
 
template<typename OtherElemType >
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 = BlockSize_
 
static constexpr int32 BlockElemCount = BlockSize * BlockSize * BlockSize
 
- Static Public Attributes inherited from UE::Geometry::TBlockedGrid3Layout< BlockSize_ >
static constexpr int32 BlockSize = BlockSize_
 
static constexpr int32 BlockElemCount = BlockSize * BlockSize * BlockSize
 

Protected Member Functions

FBlock3GetBlock (int32 Index)
 
const FBlock3GetBlock (int32 Index) const
 
bool IsBlockAllocated (const FBlock3 &Block) const
 
bool IsBlockAllocated (const int32 BlockIndex) const
 
BlockData3TypeTouchBlockData (const int32 BlockIndex)
 
template<typename FuncType >
void WriteValue (const int32 &BlockIndex, const int32 &LocalIndex, FuncType Func)
 
template<typename FuncType >
void WriteValue (int32 I, int32 J, int32 K, FuncType Func)
 
template<typename FuncType >
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)
 
template<typename OtherGridType >
bool AllocateTopologyUnionImpl (const OtherGridType &OtherGrid)
 

Protected Attributes

ElemType DefaultValue = (ElemType)0
 
TArray< FBlock3Blocks
 
- Protected Attributes inherited from UE::Geometry::TBlockedGrid3Layout< BlockSize_ >
FVector3i BlockDimensions
 
FVector3i Dimensions
 

Friends

template<class OtherElemType , int32 OtherBlockSize>
class TBasicBlockedDenseGrid3
 

Detailed Description

template<typename ElemType, int32 BlockSize_>
class UE::Geometry::TBasicBlockedDenseGrid3< ElemType, BlockSize_ >

TBasicBlockedDenseGrid3 represents a 3D blocked uniform grid.

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.

Block-level default values are returned when querying a grid cell in an unallocated block.

For multi-threaded applications consider using the derived classes TBlockedDenseGrid3 which manages internal locks, or TBlockedGrid3 with your own lock provider.

Member Typedef Documentation

◆ BlockData3Type

template<typename ElemType , int32 BlockSize_>
typedef TBlockData3<ElemType, BlockSize_> UE::Geometry::TBasicBlockedDenseGrid3< ElemType, BlockSize_ >::BlockData3Type

◆ BlockedGrid3LayoutType

template<typename ElemType , int32 BlockSize_>
typedef TBlockedGrid3Layout<BlockSize_> UE::Geometry::TBasicBlockedDenseGrid3< ElemType, BlockSize_ >::BlockedGrid3LayoutType

Constructor & Destructor Documentation

◆ TBasicBlockedDenseGrid3() [1/2]

template<typename ElemType , int32 BlockSize_>
UE::Geometry::TBasicBlockedDenseGrid3< ElemType, BlockSize_ >::TBasicBlockedDenseGrid3 ( )
inline

Create empty grid

◆ TBasicBlockedDenseGrid3() [2/2]

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

Create grid with specified domain.

Member Function Documentation

◆ AllocateTopologyUnionImpl()

template<typename ElemType , int32 BlockSize_>
template<typename OtherGridType >
bool UE::Geometry::TBasicBlockedDenseGrid3< ElemType, BlockSize_ >::AllocateTopologyUnionImpl ( const OtherGridType OtherGrid)
inlineprotected

◆ GetBlock() [1/2]

template<typename ElemType , int32 BlockSize_>
FBlock3 & UE::Geometry::TBasicBlockedDenseGrid3< ElemType, BlockSize_ >::GetBlock ( int32  Index)
inlineprotected

◆ GetBlock() [2/2]

template<typename ElemType , int32 BlockSize_>
const FBlock3 & UE::Geometry::TBasicBlockedDenseGrid3< ElemType, BlockSize_ >::GetBlock ( int32  Index) const
inlineprotected

◆ GetNumBlocks()

template<typename ElemType , int32 BlockSize_>
int32 UE::Geometry::TBasicBlockedDenseGrid3< ElemType, BlockSize_ >::GetNumBlocks ( ) const
inline
Returns
the total number of block units form the spatial decomposition of the grid. Note these block may not all be allocated

◆ GetValue() [1/2]

template<typename ElemType , int32 BlockSize_>
ElemType UE::Geometry::TBasicBlockedDenseGrid3< ElemType, BlockSize_ >::GetValue ( const FVector3i CellIJK) const
inline
Returns
the grid value at CellIJK. Note this is safe to call from multiple read threads (but not if simultaneously writing!)

◆ GetValue() [2/2]

template<typename ElemType , int32 BlockSize_>
ElemType UE::Geometry::TBasicBlockedDenseGrid3< ElemType, BlockSize_ >::GetValue ( int32  I,
int32  J,
int32  K 
) const
inline
Returns
the grid value at (I,J,K)

◆ IsBlockAllocated() [1/2]

template<typename ElemType , int32 BlockSize_>
bool UE::Geometry::TBasicBlockedDenseGrid3< ElemType, BlockSize_ >::IsBlockAllocated ( const FBlock3 Block) const
inlineprotected
Returns
true if Block has an allocated block data buffer

◆ IsBlockAllocated() [2/2]

template<typename ElemType , int32 BlockSize_>
bool UE::Geometry::TBasicBlockedDenseGrid3< ElemType, BlockSize_ >::IsBlockAllocated ( const int32  BlockIndex) const
inlineprotected
Returns
true if the specified Block has an allocated block data buffer

◆ PreAllocateFromSourceGrid()

template<typename ElemType , int32 BlockSize_>
template<typename OtherElemType >
bool UE::Geometry::TBasicBlockedDenseGrid3< ElemType, BlockSize_ >::PreAllocateFromSourceGrid ( const TBasicBlockedDenseGrid3< OtherElemType, BlockSize > &  SourceGrid)
inline

Pre-allocate the grid blocks that also exist in SourceGrid of the same dimensions. This is useful in grid-processing algorithms where parallel grid operations can be done without locking if the blocks are already allocated.

Returns
false on failure (e.g. different sized grids), otherwise true.

◆ ProcessValue() [1/2]

template<typename ElemType , int32 BlockSize_>
template<typename ProcessFunc >
void UE::Geometry::TBasicBlockedDenseGrid3< ElemType, BlockSize_ >::ProcessValue ( 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

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

◆ ProcessValue() [2/2]

template<typename ElemType , int32 BlockSize_>
template<typename ProcessFunc >
void UE::Geometry::TBasicBlockedDenseGrid3< ElemType, BlockSize_ >::ProcessValue ( 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 ProcessValue method will allocate the underlying data block.

◆ ReadValue() [1/2]

template<typename ElemType , int32 BlockSize_>
ElemType UE::Geometry::TBasicBlockedDenseGrid3< ElemType, BlockSize_ >::ReadValue ( const int32 BlockIndex,
const int32 LocalIndex 
) const
inlineprotected

◆ ReadValue() [2/2]

template<typename ElemType , int32 BlockSize_>
ElemType UE::Geometry::TBasicBlockedDenseGrid3< ElemType, BlockSize_ >::ReadValue ( int32  I,
int32  J,
int32  K 
) const
inlineprotected

◆ ReadValueWithLock()

template<typename ElemType , int32 BlockSize_>
ElemType UE::Geometry::TBasicBlockedDenseGrid3< ElemType, BlockSize_ >::ReadValueWithLock ( const int32 BlockIndex,
const int32 LocalIndex,
FCriticalSection CriticalSection 
)
inlineprotected

◆ Reset() [1/2]

template<typename ElemType , int32 BlockSize_>
void UE::Geometry::TBasicBlockedDenseGrid3< ElemType, BlockSize_ >::Reset ( )
inline

Discard all allocated blocks but retain grid dimensions. This also resets the block-level default values.

◆ Reset() [2/2]

template<typename ElemType , int32 BlockSize_>
void UE::Geometry::TBasicBlockedDenseGrid3< ElemType, BlockSize_ >::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, and resets default values to the specified InitialValue.

◆ Resize()

template<typename ElemType , int32 BlockSize_>
void UE::Geometry::TBasicBlockedDenseGrid3< ElemType, BlockSize_ >::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.

◆ SetValue() [1/2]

template<typename ElemType , int32 BlockSize_>
void UE::Geometry::TBasicBlockedDenseGrid3< ElemType, BlockSize_ >::SetValue ( const FVector3i CellIJK,
ElemType  NewValue 
)
inline

Set the grid value at CellIJK

◆ SetValue() [2/2]

template<typename ElemType , int32 BlockSize_>
void UE::Geometry::TBasicBlockedDenseGrid3< ElemType, BlockSize_ >::SetValue ( int32  I,
int32  J,
int32  K,
ElemType  NewValue 
)
inline

Set the grid value at (I,J,K)

◆ TouchBlockData()

template<typename ElemType , int32 BlockSize_>
BlockData3Type & UE::Geometry::TBasicBlockedDenseGrid3< ElemType, BlockSize_ >::TouchBlockData ( const int32  BlockIndex)
inlineprotected

return a reference to the block data buffer associated with the specified block, allocating if needed

◆ WriteValue() [1/2]

template<typename ElemType , int32 BlockSize_>
template<typename FuncType >
void UE::Geometry::TBasicBlockedDenseGrid3< ElemType, BlockSize_ >::WriteValue ( const int32 BlockIndex,
const int32 LocalIndex,
FuncType  Func 
)
inlineprotected

◆ WriteValue() [2/2]

template<typename ElemType , int32 BlockSize_>
template<typename FuncType >
void UE::Geometry::TBasicBlockedDenseGrid3< ElemType, BlockSize_ >::WriteValue ( int32  I,
int32  J,
int32  K,
FuncType  Func 
)
inlineprotected

◆ WriteValueWithLock()

template<typename ElemType , int32 BlockSize_>
template<typename FuncType >
void UE::Geometry::TBasicBlockedDenseGrid3< ElemType, BlockSize_ >::WriteValueWithLock ( const int32 BlockIndex,
const int32 LocalIndex,
FuncType  Func,
FCriticalSection CriticalSection 
)
inlineprotected

Friends And Related Symbol Documentation

◆ TBasicBlockedDenseGrid3

template<typename ElemType , int32 BlockSize_>
template<class OtherElemType , int32 OtherBlockSize>
friend class TBasicBlockedDenseGrid3
friend

Member Data Documentation

◆ BlockElemCount

template<typename ElemType , int32 BlockSize_>
constexpr int32 UE::Geometry::TBasicBlockedDenseGrid3< ElemType, BlockSize_ >::BlockElemCount = BlockSize * BlockSize * BlockSize
staticconstexpr

◆ Blocks

template<typename ElemType , int32 BlockSize_>
TArray<FBlock3> UE::Geometry::TBasicBlockedDenseGrid3< ElemType, BlockSize_ >::Blocks
protected

◆ BlockSize

template<typename ElemType , int32 BlockSize_>
constexpr int32 UE::Geometry::TBasicBlockedDenseGrid3< ElemType, BlockSize_ >::BlockSize = BlockSize_
staticconstexpr

◆ DefaultValue

template<typename ElemType , int32 BlockSize_>
ElemType UE::Geometry::TBasicBlockedDenseGrid3< ElemType, BlockSize_ >::DefaultValue = (ElemType)0
protected

The value to use to initialize new blocks


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