Looks like the tool to list the examples in the manual pages is broken since 
it didn't find these other examples, I'll take a look at it.

  There is also a discussion in the users manual

$ git grep MatlabEngine | grep ex
src/docs/tex/manual/part2.tex:PetscMatlabEngineCreate(MPI_Comm comm,char 
*machine,PetscMatlabEngine *e);
src/docs/tex/manual/part2.tex:PetscMatlabEnginePut(PetscMatlabEngine 
e,PetscObject obj);
src/docs/tex/manual/part2.tex:PetscMatlabEngineGet(PetscMatlabEngine 
e,PetscObject obj);
src/docs/tex/manual/part2.tex:PetscMatlabEnginePutArray(PetscMatlabEngine e,int 
m,int n,PetscScalar *array,char *name);
src/docs/tex/manual/part2.tex:PetscMatlabEngineGetArray(PetscMatlabEngine e,int 
m,int n,PetscScalar *array,char *name);
src/docs/tex/manual/part2.tex:PetscMatlabEngineEvaluate(PetscMatlabEngine,"format",...);
src/docs/tex/manual/part2.tex:PetscMatlabEngineEvaluate(PetscMatlabEngine,"x = 
\%g *y + z;",avalue);
src/docs/tex/manual/part2.tex:PetscMatlabEngineGetOutput(PetscMatlabEngine,char 
**);
src/docs/tex/manual/part2.tex:PetscMatlabEnginedPrintOutput(PetscMatlabEngine,FILE*).
src/snes/tutorials/ex5.c:  ierr = 
PetscMatlabEnginePut(PETSC_MATLAB_ENGINE_(comm),(PetscObject)localX);CHKERRQ(ierr);
src/snes/tutorials/ex5.c:  ierr = 
PetscMatlabEngineEvaluate(PETSC_MATLAB_ENGINE_(comm),"localF=ex5m(localX,%18.16e,%18.16e,%18.16e)",hx,hy,lambda);CHKERRQ(ierr);
src/snes/tutorials/ex5.c:  ierr = 
PetscMatlabEngineGet(PETSC_MATLAB_ENGINE_(comm),(PetscObject)localF);CHKERRQ(ierr);
src/sys/tests/ex16.c:static char help[] = "Demonstrates 
PetscMatlabEngineXXX()\n";
src/sys/tests/ex16.c:  ierr = 
PetscMatlabEngineGetOutput(PETSC_MATLAB_ENGINE_(PETSC_COMM_WORLD),&output);CHKERRQ(ierr);
src/sys/tests/ex16.c:  ierr = 
PetscMatlabEngineEvaluate(PETSC_MATLAB_ENGINE_(PETSC_COMM_WORLD),"MPI_Comm_rank");CHKERRQ(ierr);
src/sys/tests/ex16.c:    ierr = 
PetscMatlabEngineEvaluate(PETSC_MATLAB_ENGINE_(PETSC_COMM_WORLD),user);CHKERRQ(ierr);
src/vec/vec/tests/ex31.c:static const char help[] = "Demonstrates 
PetscMatlabEngineXXX()\n";
src/vec/vec/tests/ex31.c:  ierr = 
PetscMatlabEngineGetOutput(PETSC_MATLAB_ENGINE_WORLD,&output);
src/vec/vec/tests/ex31.c:  ierr = 
PetscMatlabEngineEvaluate(PETSC_MATLAB_ENGINE_WORLD,"MPI_Comm_rank");
src/vec/vec/tests/ex31.c:  ierr = 
PetscMatlabEnginePut(PETSC_MATLAB_ENGINE_WORLD,(PetscObject)x);CHKERRQ(ierr);
src/vec/vec/tests/ex31.c:  ierr = 
PetscMatlabEngineEvaluate(PETSC_MATLAB_ENGINE_WORLD,"x = x + MPI_Comm_rank;\n");
src/vec/vec/tests/ex31.c:  ierr = 
PetscMatlabEngineGet(PETSC_MATLAB_ENGINE_WORLD,(PetscObject)x);CHKERRQ(ierr);
src/vec/vec/tests/ex31.c:  ierr = 
PetscMatlabEngineEvaluate(PETSC_MATLAB_ENGINE_WORLD,"whos\n");CHKERRQ(ierr);

> On Jun 8, 2020, at 8:26 PM, Amneet Bhalla <[email protected]> wrote:
> 
> Great!
> 
> Clicking on some of the functions pointed me to this example
> https://www.mcs.anl.gov/petsc/petsc-3.13/src/snes/tutorials/ex5.c.html 
> <https://www.mcs.anl.gov/petsc/petsc-3.13/src/snes/tutorials/ex5.c.html>
> 
> Are there more examples, which are perhaps simpler than the above, which I 
> can refer to? 
> 
> On Mon, Jun 8, 2020 at 5:51 PM Barry Smith <[email protected] 
> <mailto:[email protected]>> wrote:
> 
>   You should use the PetscMatlabEngine 
> https://www.mcs.anl.gov/petsc/petsc-3.13/docs/manualpages/Sys/PetscMatlabEngine.html
>  
> <https://www.mcs.anl.gov/petsc/petsc-3.13/docs/manualpages/Sys/PetscMatlabEngine.html>
> 
>   Barry
> 
> 
>> On Jun 8, 2020, at 7:09 PM, Amneet Bhalla <[email protected] 
>> <mailto:[email protected]>> wrote:
>> 
>> Hi Folks,
>> 
>> My parallel application written in C++ (which also uses PETSc library for 
>> linear solvers) requires calling control and optimization toolbox of MATLAB 
>> at every time step to get a small number of double values. Likewise the 
>> MATLAB function will need to know some values from the parallel C++ 
>> application to return those doubles. I'm wondering if there is a recommended 
>> way of calling MATLAB from parallel C/C++/Fortran codes, and if PETSc has 
>> some interface that could be leveraged for this exchange. 
>> 
>> Thanks,
>> -- 
>> --Amneet 
>> 
>> 
>> 
> 
> 
> 
> -- 
> --Amneet 
> 
> 
> 

Reply via email to