Questions about matrix

Hello, I have some questions.

What’s the meaning of the method “matrix”, “matrix_slice”, “xchg_matrix”? and where’s the definition of these methods?

Second, assuming the element u_{i}, how to get the left and right interface value (u^{+}{i-1/2} and u^{-} {i+1/2} ) of the current value?

And what’s the meaning of “nfacefpts”?

Hi @fei,

For all things matrix, start with pyfr/backends/base/

class Matrix(MatrixBase):
class MatrixSlice:
class XchgMatrix(Matrix):

Each device type derives specializations from these.

For nfacefpts, see pyfr/

After exploring those base classes, next step is to look at /pyfr/backends/*/ to see how these get hooked up for each device type.

For example, in pyfr/backends/cuda/ (Line 65)

# Register our data types and meta kernels
self.const_matrix_cls = types.CUDAConstMatrix
self.graph_cls = types.CUDAGraph
self.matrix_cls = types.CUDAMatrix
self.matrix_slice_cls = types.CUDAMatrixSlice
self.view_cls = types.CUDAView
self.xchg_matrix_cls = types.CUDAXchgMatrix
self.xchg_view_cls = types.CUDAXchgView
self.ordered_meta_kernel_cls = provider.CUDAOrderedMetaKernel
self.unordered_meta_kernel_cls = provider.CUDAUnorderedMetaKernel

So with regard to your question about “matrix”, “matrix_slice”, “xchg_matrix”,

matrix_cls = types.CUDAMatrix
matrix_slice_cls = types.CUDAMatrixSlice
xchg_matrix_cls = types.CUDAXchgMatrix

Likewise for each device type:

for HIP: pyfr/backends/hip/ (Line 61)
OpenMP: pyfr/backends/openmp/ (Line 40)
Metal: pyfr/backends/metal/ (Line 33)

Very neat architecture!

Yes, and what are these ‘matrix’ used for?

Also, the meaning of ‘nfacefpts’ is n faces of the element, is it right?