graphlow.core.MeshTopology.map_point_to_cell#

MeshTopology.map_point_to_cell(x_point: T, mode: Literal['sum', 'mean', 'conservative'], method: Literal['segment', 'sparse'] = 'segment') T#

Map point field to cell.

Parameters:
x_pointT

Tensor of shape (n_points, ...).

mode“sum” | “mean” | “conservative”

Mapping mode.

"sum"

Sum of point values in each cell.

"mean"

Row-normalized CP operator.

The cell value is computed as the simple average of the values at the points connected to the cell:

\[x_{\text{cell}} = \frac{1}{\operatorname{deg}(C)} \sum_{p \in C} x_{\text{point}}\]

where \(\operatorname{deg}(C)\) is the number of points connected to cell \(C\).

This corresponds to a local arithmetic averaging over the cell stencil. It treats each point in the cell equally, regardless of how many cells that point belongs to. In general, this method does not guarantee global conservation of the total quantity.

"conservative"

Column-normalized CP operator.

The cell value is obtained by distributing each point value equally among the cells connected to that point:

\[x_{\text{cell}} = \sum_{p \in C} \left(\frac{1}{\operatorname{deg}(p)}\right) x_{\text{point}}\]

where \(\operatorname{deg}(p)\) is the number of cells connected to point \(p\).

Each point contributes its value conservatively to its neighboring cells, and the total sum over cells equals the total sum over points, making this formulation suitable for conservative transfers.

method“segment” | “sparse”

Mapping method. Default is “segment”.

"segment"

Computes the reduction without explicitly constructing the CP matrix. It is typically more memory efficient, especially on GPU. In most practical settings, this method is recommended.

"sparse"

Computes the reduction by multiplying the CP matrix with the point values. It depends strongly on backend implementation quality but it can be beneficial when the CP matrix is used repeatedly.

Returns:
T

Tensor of shape (n_cells, ...).