Date: 2026-03-31T05:46:03+00:00

Actual source code: petscviennacl.h

      1: #pragma once

      3: #include <petscvec.h>

      5: /* MANSEC = Vec */

      7: #if defined(PETSC_HAVE_CUDA)
      8:   #define VIENNACL_WITH_CUDA
      9: #endif

     11: #if defined(PETSC_HAVE_OPENCL)
     12:   #define VIENNACL_WITH_OPENCL
     13: #endif

     15: #if defined(PETSC_HAVE_OPENMP)
     16:   #define VIENNACL_WITH_OPENMP
     17: #endif

     19: #include <viennacl/forwards.h>
     20: #include <viennacl/vector_proxy.hpp>
     21: #include <viennacl/vector.hpp>

     23: PETSC_EXTERN PetscErrorCode VecViennaCLGetArray(Vec v, viennacl::vector<PetscScalar> **a);
     24: PETSC_EXTERN PetscErrorCode VecViennaCLRestoreArray(Vec v, viennacl::vector<PetscScalar> **a);

     26: PETSC_EXTERN PetscErrorCode VecViennaCLGetArrayRead(Vec v, const viennacl::vector<PetscScalar> **a);
     27: PETSC_EXTERN PetscErrorCode VecViennaCLRestoreArrayRead(Vec v, const viennacl::vector<PetscScalar> **a);

     29: PETSC_EXTERN PetscErrorCode VecViennaCLGetArrayWrite(Vec v, viennacl::vector<PetscScalar> **a);
     30: PETSC_EXTERN PetscErrorCode VecViennaCLRestoreArrayWrite(Vec v, viennacl::vector<PetscScalar> **a);

     32: PETSC_EXTERN PetscErrorCode VecCreateSeqViennaCLWithArray(MPI_Comm, PetscInt, PetscInt, const viennacl::vector<PetscScalar> *, Vec *);
     33: PETSC_EXTERN PetscErrorCode VecCreateSeqViennaCLWithArrays(MPI_Comm, PetscInt, PetscInt, const PetscScalar *, const viennacl::vector<PetscScalar> *, Vec *);
     34: PETSC_EXTERN PetscErrorCode VecCreateMPIViennaCLWithArray(MPI_Comm, PetscInt, PetscInt, PetscInt, const viennacl::vector<PetscScalar> *, Vec *);
     35: PETSC_EXTERN PetscErrorCode VecCreateMPIViennaCLWithArrays(MPI_Comm, PetscInt, PetscInt, PetscInt, const PetscScalar *, const viennacl::vector<PetscScalar> *, Vec *);

     37: PETSC_EXTERN PetscErrorCode VecViennaCLPlaceArray(Vec, const viennacl::vector<PetscScalar> *);
     38: PETSC_EXTERN PetscErrorCode VecViennaCLResetArray(Vec);