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