xref: /petsc/include/petscmatlab.h (revision a496304597bacff3545e802853d69e8765312868)
1de580fa9SBarry Smith /*
2e3c5b3baSBarry Smith     Defines an interface to the MATLAB Engine from PETSc
3de580fa9SBarry Smith */
4*a4963045SJacob Faibussowitsch #pragma once
5de580fa9SBarry Smith 
6ac09b921SBarry Smith /* SUBMANSEC = Sys */
7ac09b921SBarry Smith 
8014dd563SJed Brown PETSC_EXTERN PetscClassId MATLABENGINE_CLASSID;
9de580fa9SBarry Smith 
10de580fa9SBarry Smith /*S
11e3c5b3baSBarry Smith      PetscMatlabEngine - Object used to communicate with MATLAB
12de580fa9SBarry Smith 
13de580fa9SBarry Smith    Level: intermediate
14de580fa9SBarry Smith 
152fcac7c0SBarry Smith    Notes:
162fcac7c0SBarry Smith    `Mat`s transferred between PETSc and MATLAB and vis versa are transposed in the other space
17ddcfb6fcSBarry Smith    (this is because MATLAB uses compressed column format and PETSc uses compressed row format)
18ddcfb6fcSBarry Smith 
192fcac7c0SBarry Smith    One must `./configure` PETSc with  `--with-matlab [-with-matlab-dir=matlab_root_directory]` to
202fcac7c0SBarry Smith    use this capability
212fcac7c0SBarry Smith 
22db781477SPatrick Sanan .seealso: `PetscMatlabEngineCreate()`, `PetscMatlabEngineDestroy()`, `PetscMatlabEngineEvaluate()`,
23db781477SPatrick Sanan           `PetscMatlabEngineGetOutput()`, `PetscMatlabEnginePut()`, `PetscMatlabEngineGet()`,
24db781477SPatrick Sanan           `PetscMatlabEnginePrintOutput()`, `PetscMatlabEnginePutArray()`, `PetscMatlabEngineGetArray()`,
25db781477SPatrick Sanan           `PETSC_MATLAB_ENGINE_()`, `PETSC_MATLAB_ENGINE_SELF`, `PETSC_MATLAB_ENGINE_WORLD`
26de580fa9SBarry Smith S*/
27de580fa9SBarry Smith typedef struct _p_PetscMatlabEngine *PetscMatlabEngine;
28de580fa9SBarry Smith 
29014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscMatlabEngineCreate(MPI_Comm, const char[], PetscMatlabEngine *);
30014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscMatlabEngineDestroy(PetscMatlabEngine *);
31014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscMatlabEngineEvaluate(PetscMatlabEngine, const char[], ...);
32014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscMatlabEngineGetOutput(PetscMatlabEngine, char **);
33014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscMatlabEnginePrintOutput(PetscMatlabEngine, FILE *);
34014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscMatlabEnginePut(PetscMatlabEngine, PetscObject);
35014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscMatlabEngineGet(PetscMatlabEngine, PetscObject);
36014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscMatlabEnginePutArray(PetscMatlabEngine, int, int, const PetscScalar *, const char[]);
37014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscMatlabEngineGetArray(PetscMatlabEngine, int, int, PetscScalar *, const char[]);
38de580fa9SBarry Smith 
39014dd563SJed Brown PETSC_EXTERN PetscMatlabEngine PETSC_MATLAB_ENGINE_(MPI_Comm);
40de580fa9SBarry Smith 
41de580fa9SBarry Smith /*MC
42de580fa9SBarry Smith   PETSC_MATLAB_ENGINE_WORLD - same as PETSC_MATLAB_ENGINE_(PETSC_COMM_WORLD)
43de580fa9SBarry Smith 
4487497f52SBarry Smith   Level: intermediate
4587497f52SBarry Smith 
4687497f52SBarry Smith .seealso: `PetscMatlabEngine`, `PETSC_MATLAB_ENGINE_()`, `PETSC_MATLAB_ENGINE_SELF`
47de580fa9SBarry Smith M*/
48de580fa9SBarry Smith #define PETSC_MATLAB_ENGINE_WORLD PETSC_MATLAB_ENGINE_(PETSC_COMM_WORLD)
49de580fa9SBarry Smith 
50de580fa9SBarry Smith /*MC
51de580fa9SBarry Smith   PETSC_MATLAB_ENGINE_SELF - same as PETSC_MATLAB_ENGINE_(PETSC_COMM_SELF)
52de580fa9SBarry Smith 
5387497f52SBarry Smith   Level: intermediate
5487497f52SBarry Smith 
5587497f52SBarry Smith .seealso: `PetscMatlabEngine`, `PETSC_MATLAB_ENGINE_()`, `PETSC_MATLAB_ENGINE_WORLD`
56de580fa9SBarry Smith M*/
57de580fa9SBarry Smith #define PETSC_MATLAB_ENGINE_SELF PETSC_MATLAB_ENGINE_(PETSC_COMM_SELF)
58