Class: QgsMeshDataBlock

class qgis.core.QgsMeshDataBlock

Bases: sip.wrapper

Constructs an invalid block

QgsMeshDataBlock(type: QgsMeshDataBlock.DataType, count: int) Constructs a new block

QgsMeshDataBlock(QgsMeshDataBlock)

QgsMeshDataBlock is a block of integers/doubles that can be used to retrieve: active flags (e.g. face’s active integer flag) scalars (e.g. scalar dataset double values) vectors (e.g. vector dataset doubles x,y values)

data are implicitly shared, so the class can be quickly copied std.numeric_limits<double>.quiet_NaN() represents NODATA value

Data can be accessed all at once with values() (faster) or value by value (slower) with active() or value()

New in version 3.6:

Methods

active

Returns a value for active flag by the index For scalar and vector 2d the behavior is undefined

count

Number of items stored in the block

isValid

Whether the block is valid

setActive

Sets active flag values.

setValid

Sets block validity

setValues

Sets values

type

Type of data stored in the block

value

Returns a value represented by the index For active flag the behavior is undefined

values

Returns buffer to the array with values For vector it is pairs (x1, y1, x2, y2, .

Attributes

ActiveFlagInteger

ScalarDouble

Vector2DDouble

ActiveFlagInteger = 0
class DataType

Bases: int

ScalarDouble = 1
Vector2DDouble = 2
active(self, index: int) bool

Returns a value for active flag by the index For scalar and vector 2d the behavior is undefined

active(self) -> List[int] Returns active flag array

Even for active flag valid dataset, the returned array could be empty. This means that the data provider/dataset does not support active flag capability, so all faces are active by default.

For scalar and vector 2d the behavior is undefined

New in version 3.12.

Parameters

index (int) –

Return type

bool

count(self) int

Number of items stored in the block

Return type

int

isValid(self) bool

Whether the block is valid

Return type

bool

setActive(self, vals: Iterable[int])

Sets active flag values.

If the data provider/datasets does not have active flag capability (== all values are valid), just set block validity by setValid( True )

Parameters

vals (Iterable[int]) – value vector with size count()

For scalar and vector 2d the behavior is undefined

New in version 3.12.

setValid(self, valid: bool)

Sets block validity

Parameters

valid (bool) –

setValues(self, vals: Iterable[float])

Sets values

For scalar datasets, it must have size count() For vector datasets, it must have size 2 * count() For active flag the behavior is undefined

New in version 3.12.

Parameters

vals (Iterable[float]) –

type(self) QgsMeshDataBlock.DataType

Type of data stored in the block

Return type

QgsMeshDataBlock.DataType

value(self, index: int) QgsMeshDatasetValue

Returns a value represented by the index For active flag the behavior is undefined

Parameters

index (int) –

Return type

QgsMeshDatasetValue

values(self) List[float]

Returns buffer to the array with values For vector it is pairs (x1, y1, x2, y2, … )

New in version 3.12.

Return type

List[float]