graphlow.core.MeshTopology.map_cell_to_point#
- MeshTopology.map_cell_to_point(x_cell: T, mode: Literal['sum', 'mean', 'conservative'], method: Literal['segment', 'sparse'] = 'segment') T#
Map cell field to point.
- Parameters:
- x_cellT
Tensor of shape
(n_cells, ...).- mode“sum” | “mean” | “conservative”
Mapping mode.
"sum"Sum of cell values that are connected to the point.
"mean"Row-normalized PC operator.
The point value is computed as the arithmetic average of the values of the cells connected to the point:
\[x_{\text{point}} = \frac{1}{\operatorname{deg}(p)} \sum_{C \ni p} x_{\text{cell}}\]where \(\operatorname{deg}(p)\) is the number of cells connected to point \(p\).
This corresponds to a local averaging over the cell stencil around each point. Each neighboring cell contributes equally, regardless of the number of points in that cell. In general, this method does not guarantee global conservation of the total quantity.
"conservative"Column-normalized PC operator.
The point value is obtained by distributing each cell value equally among the points connected to that cell:
\[x_{\text{point}} = \sum_{C \ni p} \left(\frac{1}{\operatorname{deg}(C)}\right) x_{\text{cell}}\]where \(\operatorname{deg}(C)\) is the number of points in cell \(C\).
Each cell contributes its value conservatively to its vertices, and the total sum over points equals the total sum over cells, making this formulation suitable for conservative transfers.
- method“segment” | “sparse”
Mapping method. Default is “segment”.
"segment"Computes the reduction without explicitly constructing the PC 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 PC matrix with the cell values. It depends strongly on backend implementation quality but it can be beneficial when the PC matrix is used repeatedly.
- Returns:
- T
Tensor of shape
(n_points, ...).