#pragma once #include #include PETSC_PRAGMA_DIAGNOSTIC_IGNORED_BEGIN("-Wsign-compare") #include #include #include #include #include #include PETSC_PRAGMA_DIAGNOSTIC_IGNORED_END() class WrapperHtool : public htool::VirtualGenerator { MatHtoolKernelFn *&kernel; PetscInt sdim; void *ctx; public: WrapperHtool(PetscInt dim, MatHtoolKernelFn *&g, void *kernelctx) : VirtualGenerator(), kernel(g), sdim(dim), ctx(kernelctx) { } void copy_submatrix(PetscInt M, PetscInt N, const PetscInt *rows, const PetscInt *cols, PetscScalar *ptr) const { #if !PetscDefined(HAVE_OPENMP) PetscFunctionBegin; #endif PetscCallAbort(PETSC_COMM_SELF, kernel(sdim, M, N, rows, cols, ptr, ctx)); #if !PetscDefined(HAVE_OPENMP) PetscFunctionReturnVoid(); #endif } }; struct Mat_Htool { PetscInt dim; PetscReal *gcoords_target; PetscReal *gcoords_source; PetscInt min_cluster_size; PetscReal epsilon; PetscReal eta; PetscInt depth[2]; PetscBool block_tree_consistency; MatHtoolCompressorType compressor; MatHtoolClusteringType clustering; MatHtoolKernelFn *kernel; void *kernelctx; WrapperHtool *wrapper; std::unique_ptr> target_cluster; std::unique_ptr> source_cluster; std::unique_ptr> distributed_operator_holder; }; struct MatHtoolKernelTranspose { Mat A; MatHtoolKernelFn *kernel; void *kernelctx; };