Actual source code: zsys.c

  1: /*$Id: zsys.c,v 1.97 2001/10/04 18:48:06 balay Exp $*/

 3:  #include src/fortran/custom/zpetsc.h
 4:  #include petscsys.h
 5:  #include petscengine.h

  7: #ifdef PETSC_HAVE_FORTRAN_CAPS
  8: #define petscgetcputime_           PETSCGETCPUTIME
  9: #define petscfopen_                PETSCFOPEN
 10: #define petscfclose_               PETSCFCLOSE
 11: #define petscfprintf_              PETSCFPRINTF
 12: #define petscsynchronizedfprintf_  PETSCSYNCHRONIZEDFPRINTF
 13: #define petscsynchronizedflush_    PETSCSYNCHRONIZEDFLUSH
 14: #define chkmemfortran_             CHKMEMFORTRAN
 15: #define petscattachdebugger_       PETSCATTACHDEBUGGER
 16: #define petscobjectsetname_        PETSCOBJECTSETNAME
 17: #define petscobjectdestroy_        PETSCOBJECTDESTROY
 18: #define petscobjectgetcomm_        PETSCOBJECTGETCOMM
 19: #define petscobjectgetname_        PETSCOBJECTGETNAME
 20: #define petscgetflops_             PETSCGETFLOPS
 21: #define petscerror_                PETSCERROR
 22: #define petscrandomcreate_         PETSCRANDOMCREATE
 23: #define petscrandomdestroy_        PETSCRANDOMDESTROY
 24: #define petscrandomgetvalue_       PETSCRANDOMGETVALUE
 25: #define petsctrvalid_              PETSCTRVALID
 26: #define petscrealview_             PETSCREALVIEW
 27: #define petscintview_              PETSCINTVIEW
 28: #define petscsequentialphasebegin_ PETSCSEQUENTIALPHASEBEGIN
 29: #define petscsequentialphaseend_   PETSCSEQUENTIALPHASEEND
 30: #define petsctrlog_                PETSCTRLOG
 31: #define petscmemcpy_               PETSCMEMCPY
 32: #define petsctrdump_               PETSCTRDUMP
 33: #define petsctrlogdump_            PETSCTRLOGDUMP
 34: #define petscmemzero_              PETSCMEMZERO
 35: #define petscbinaryopen_           PETSCBINARYOPEN
 36: #define petscbinaryread_           PETSCBINARYREAD
 37: #define petscbinarywrite_          PETSCBINARYWRITE
 38: #define petscbinaryclose_          PETSCBINARYCLOSE
 39: #define petscbinaryseek_           PETSCBINARYSEEK
 40: #define petscfixfilename_          PETSCFIXFILENAME
 41: #define petscstrncpy_              PETSCSTRNCPY
 42: #define petscbarrier_              PETSCBARRIER
 43: #define petscsynchronizedflush_    PETSCSYNCHRONIZEDFLUSH
 44: #define petscsplitownership_       PETSCSPLITOWNERSHIP
 45: #define petscsplitownershipblock_  PETSCSPLITOWNERSHIPBLOCK
 46: #define petscobjectgetnewtag_      PETSCOBJECTGETNEWTAG
 47: #define petsccommgetnewtag_        PETSCCOMMGETNEWTAG
 48: #define petscfptrap_               PETSCFPTRAP
 49: #define petscoffsetfortran_        PETSCOFFSETFORTRAN
 50: #define petscmatlabenginecreate_      PETSCMATLABENGINECREATE
 51: #define petscmatlabenginedestroy_     PETSCMATLABENGINEDESTROY
 52: #define petscmatlabengineevaluate_    PETSCMATLABENGINEEVALUATE
 53: #define petscmatlabenginegetoutput_   PETSCMATLABENGINEGETOUTPUT
 54: #define petscmatlabengineprintoutput_ PETSCMATLABENGINEPRINTOUTPUT
 55: #define petscmatlabengineput_         PETSCMATLABENGINEPUT
 56: #define petscmatlabengineget_         PETSCMATLABENGINEGET
 57: #define petscmatlabengineputarray_    PETSCMATLABENGINEPUTARRAY
 58: #define petscmatlabenginegetarray_    PETSCMATLABENGINEGETARRAY
 59: #define petscgetresidentsetsize_      PETSCGETRESIDENTSETSIZE
 60: #define petsctrspace_                 PETSCTRSPACE
 61: #define petscviewerasciiprintf_       PETSCVIEWERASCIIPRINTF
 62: #define petscviewerasciisynchronizedprintf_       PETSCVIEWERASCIISYNCHRONIZEDPRINTF
 63: #define petscviewerasciisettab_       PETSCVIEWERASCIISETTAB
 64: #define petscviewerasciipushtab_      PETSCVIEWERASCIIPUSHTAB
 65: #define petscviewerasciipoptab_       PETSCVIEWERASCIIPOPTAB
 66: #define petscviewerasciiusetabs_      PETSCVIEWERASCIIUSETABS
 67: #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE)
 68: #define petscfopen_                   petscfopen
 69: #define petscfclose_                  petscfclose
 70: #define petscfprintf_                 petscfprintf
 71: #define petscsynchronizedfprintf_     petscsynchronizedfprintf
 72: #define petscsynchronizedflush_       petscsynchronizedflush
 73: #define petscmatlabenginecreate_      petscmatlabenginecreate
 74: #define petscmatlabenginedestroy_     petscmatlabenginedestroy
 75: #define petscmatlabengineevaluate_    petscmatlabengineevaluate
 76: #define petscmatlabenginegetoutput_   petscmatlabenginegetoutput
 77: #define petscmatlabengineprintoutput_ petscmatlabengineprintoutput
 78: #define petscmatlabengineput_         petscmatlabengineput
 79: #define petscmatlabengineget_         petscmatlabengineget
 80: #define petscmatlabengineputarray_    petscmatlabengineputarray
 81: #define petscmatlabenginegetarray_    petscmatlabenginegetarray
 82: #define petscoffsetfortran_        petscoffsetfortran     
 83: #define chkmemfortran_             chkmemfortran
 84: #define petscobjectgetnewtag_      petscobjectgetnewtag
 85: #define petsccommgetnewtag_        petsccommgetnewtag
 86: #define petscsplitownership_       petscsplitownership
 87: #define petscsplitownershipblock_  petscsplitownershipblock
 88: #define petscbarrier_              petscbarrier
 89: #define petscstrncpy_              petscstrncpy
 90: #define petscfixfilename_          petscfixfilename
 91: #define petsctrlog_                petsctrlog
 92: #define petscattachdebugger_       petscattachdebugger
 93: #define petscobjectsetname_        petscobjectsetname
 94: #define petscobjectdestroy_        petscobjectdestroy
 95: #define petscobjectgetcomm_        petscobjectgetcomm
 96: #define petscobjectgetname_        petscobjectgetname
 97: #define petscgetflops_             petscgetflops 
 98: #define petscerror_                petscerror
 99: #define petscrandomcreate_         petscrandomcreate
100: #define petscrandomdestroy_        petscrandomdestroy
101: #define petscrandomgetvalue_       petscrandomgetvalue
102: #define petsctrvalid_              petsctrvalid
103: #define petscrealview_             petscrealview
104: #define petscintview_              petscintview
105: #define petscsequentialphasebegin_ petscsequentialphasebegin
106: #define petscsequentialphaseend_   petscsequentialphaseend
107: #define petscmemcpy_               petscmemcpy
108: #define petsctrdump_               petsctrdump
109: #define petsctrlogdump_            petsctlogrdump
110: #define petscmemzero_              petscmemzero
111: #define petscbinaryopen_           petscbinaryopen
112: #define petscbinaryread_           petscbinaryread
113: #define petscbinarywrite_          petscbinarywrite
114: #define petscbinaryclose_          petscbinaryclose
115: #define petscbinaryseek_           petscbinaryseek
116: #define petscsynchronizedflush_    petscsynchronizedflush
117: #define petscfptrap_               petscfptrap
118: #define petscgetcputime_           petscgetcputime
119: #define petscgetresidentsetsize_   petscgetresidentsetsize
120: #define petsctrspace_              petsctrspace
121: #define petscviewerasciiprintf_    petscviewerasciiprintf
122: #define petscviewerasciisynchronizedprintf_    petscviewerasciisynchronizedprintf
123: #define petscviewerasciisettab_ petscviewerasciisettab
124: #define petscviewerasciipushtab_ petscviewerasciipushtab
125: #define petscviewerasciipoptab_ petscviewerasciipoptab
126: #define petscviewerasciiusetabs_ petscviewerasciiusetabs

128: #endif

130: EXTERN_C_BEGIN
131: /*
132:     integer i_x,i_y,shift
133:     Vec     x,y
134:     PetscScalar  v_x(1),v_y(1)

136:     call VecGetArray(x,v_x,i_x,ierr)
137:     if (x .eq. y) then
138:       call PetscOffsetFortran(y_v,x_v,shift,ierr)
139:       i_y = i_x + shift
140:     else 
141:       call VecGetArray(y,v_y,i_y,ierr)
142:     endif
143: */

145: void PETSC_STDCALL petscviewerasciisettab_(PetscViewer *viewer,int *tabs,int *ierr)
146: {
147:   *PetscViewerASCIISetTab(*viewer,*tabs);
148: }

150: void PETSC_STDCALL petscviewerasciipushtab_(PetscViewer *viewer,int *ierr)
151: {
152:   *PetscViewerASCIIPushTab(*viewer);
153: }

155: void PETSC_STDCALL petscviewerasciipoptab_(PetscViewer *viewer,int *ierr)
156: {
157:   *PetscViewerASCIIPopTab(*viewer);
158: }

160: void PETSC_STDCALL petscviewerasciiusetabs_(PetscViewer *viewer,PetscTruth *flg,int *ierr)
161: {
162:   *PetscViewerASCIIUseTabs(*viewer,*flg);
163: }

165: void PETSC_STDCALL petscviewerasciiprintf_(PetscViewer *viewer,CHAR str PETSC_MIXED_LEN(len1),int *ierr PETSC_END_LEN(len1))
166: {
167:   char *c1;

169:   FIXCHAR(str,len1,c1);
170:   *PetscViewerASCIIPrintf(*viewer,c1);
171:   FREECHAR(str,c1);
172: }

174: void PETSC_STDCALL petscviewerasciisynchronizedprintf_(PetscViewer *viewer,CHAR str PETSC_MIXED_LEN(len1),int *ierr PETSC_END_LEN(len1))
175: {
176:   char *c1;

178:   FIXCHAR(str,len1,c1);
179:   *PetscViewerASCIISynchronizedPrintf(*viewer,c1);
180:   FREECHAR(str,c1);
181: }

183: void PETSC_STDCALL petsctrspace_(PetscLogDouble *space,PetscLogDouble *fr,PetscLogDouble *maxs, int *ierr)
184: {
185:   *PetscTrSpace(space,fr,maxs);
186: }

188: void PETSC_STDCALL petscgetresidentsetsize_(PetscLogDouble *foo, int *ierr)
189: {
190:   *PetscGetResidentSetSize(foo);
191: }

193: void PETSC_STDCALL petscoffsetfortran_(PetscScalar *x,PetscScalar *y,int *shift,int *ierr)
194: {
195:   *0;
196:   *shift = y - x;
197: }

199: void PETSC_STDCALL petscgetcputime_(PetscLogDouble *t, int *ierr)
200: {
201:   *PetscGetCPUTime(t);
202: }

204: void PETSC_STDCALL petscfopen_(MPI_Comm *comm,CHAR fname PETSC_MIXED_LEN(len1),CHAR fmode PETSC_MIXED_LEN(len2),
205:                                FILE **file,int *ierr PETSC_END_LEN(len1) PETSC_END_LEN(len2))
206: {
207:   char *c1,*c2;

209:   FIXCHAR(fname,len1,c1);
210:   FIXCHAR(fmode,len2,c2);
211:   *PetscFOpen((MPI_Comm)PetscToPointerComm(*comm),c1,c2,file);
212:   FREECHAR(fname,c1);
213:   FREECHAR(fmode,c2);
214: }
215: 
216: void PETSC_STDCALL petscfclose_(MPI_Comm *comm,FILE **file,int *ierr)
217: {
218:   *PetscFClose((MPI_Comm)PetscToPointerComm(*comm),*file);
219: }

221: void PETSC_STDCALL petscsynchronizedflush_(MPI_Comm *comm,int *ierr)
222: {
223:   *PetscSynchronizedFlush((MPI_Comm)PetscToPointerComm(*comm));
224: }

226: void PETSC_STDCALL petscfprintf_(MPI_Comm *comm,FILE **file,CHAR fname PETSC_MIXED_LEN(len1),int *ierr PETSC_END_LEN(len1))
227: {
228:   char *c1;

230:   FIXCHAR(fname,len1,c1);
231:   *PetscFPrintf((MPI_Comm)PetscToPointerComm(*comm),*file,c1);
232:   FREECHAR(fname,c1);
233: }

235: void PETSC_STDCALL petscsynchronizedfprintf_(MPI_Comm *comm,FILE **file,CHAR fname PETSC_MIXED_LEN(len1),int *ierr PETSC_END_LEN(len1))
236: {
237:   char *c1;

239:   FIXCHAR(fname,len1,c1);
240:   *PetscSynchronizedFPrintf((MPI_Comm)PetscToPointerComm(*comm),*file,c1);
241:   FREECHAR(fname,c1);
242: }

244: void PETSC_STDCALL petscsetfptrap_(PetscFPTrap *flag,int *ierr)
245: {
246:   *PetscSetFPTrap(*flag);
247: }

249: void PETSC_STDCALL petscobjectgetnewtag_(PetscObject *obj,int *tag,int *ierr)
250: {
251:   *PetscObjectGetNewTag(*obj,tag);
252: }

254: void PETSC_STDCALL petsccommgetnewtag_(MPI_Comm *comm,int *tag,int *ierr)
255: {
256:   *PetscCommGetNewTag((MPI_Comm)PetscToPointerComm(*comm),tag);
257: }

259: void PETSC_STDCALL petscsplitownershipblock_(MPI_Comm *comm,int *bs,int *n,int *N,int *ierr)
260: {
261:   *PetscSplitOwnershipBlock((MPI_Comm)PetscToPointerComm(*comm),*bs,n,N);
262: }
263: void PETSC_STDCALL petscsplitownership_(MPI_Comm *comm,int *n,int *N,int *ierr)
264: {
265:   *PetscSplitOwnership((MPI_Comm)PetscToPointerComm(*comm),n,N);
266: }

268: void PETSC_STDCALL petscbarrier_(PetscObject *obj,int *ierr)
269: {
270:   *PetscBarrier(*obj);
271: }

273: void PETSC_STDCALL petscstrncpy_(CHAR s1 PETSC_MIXED_LEN(len1),CHAR s2 PETSC_MIXED_LEN(len2),int *n,
274:                                  int *ierr PETSC_END_LEN(len1) PETSC_END_LEN(len2))
275: {
276:   char *t1,*t2;
277:   int  m;

279: #if defined(PETSC_USES_CPTOFCD)
280:   t1 = _fcdtocp(s1);
281:   t2 = _fcdtocp(s2);
282:   m = *n; if (_fcdlen(s1) < m) m = _fcdlen(s1); if (_fcdlen(s2) < m) m = _fcdlen(s2);
283: #else
284:   t1 = s1;
285:   t2 = s2;
286:   m = *n; if (len1 < m) m = len1; if (len2 < m) m = len2;
287: #endif
288:   *PetscStrncpy(t1,t2,m);
289: }

291: void PETSC_STDCALL petscfixfilename_(CHAR filein PETSC_MIXED_LEN(len1),CHAR fileout PETSC_MIXED_LEN(len2),
292:                                      int *ierr PETSC_END_LEN(len1) PETSC_END_LEN(len2))
293: {
294:   int  i,n;
295:   char *in,*out;

297: #if defined(PETSC_USES_CPTOFCD)
298:   in  = _fcdtocp(filein);
299:   out = _fcdtocp(fileout);
300:   n   = _fcdlen (filein);
301: #else
302:   in  = filein;
303:   out = fileout;
304:   n   = len1;
305: #endif

307:   for (i=0; i<n; i++) {
308: #if defined(PARCH_win32)
309:     if (in[i] == '/') out[i] = '\';
310: #else
311:     if (in[i] == '\') out[i] = '/';
312: #endif
313:     else out[i] = in[i];
314:   }
315:   out[i] = 0;
316: }

318: void PETSC_STDCALL petscbinaryopen_(CHAR name PETSC_MIXED_LEN(len),int *type,int *fd,
319:                                     int *ierr PETSC_END_LEN(len))
320: {
321:   char *c1;

323:   FIXCHAR(name,len,c1);
324:   *PetscBinaryOpen(c1,*type,fd);
325:   FREECHAR(name,c1);
326: }

328: void PETSC_STDCALL petscbinarywrite_(int *fd,void *p,int *n,PetscDataType *type,int *istemp,int *ierr)
329: {
330:   *PetscBinaryWrite(*fd,p,*n,*type,*istemp);
331: }

333: void PETSC_STDCALL petscbinaryread_(int *fd,void *p,int *n,PetscDataType *type,int *ierr)
334: {
335:   *PetscBinaryRead(*fd,p,*n,*type);
336: }

338: void PETSC_STDCALL petscbinaryseek_(int *fd,int *size,PetscBinarySeekType *whence,int *offset,int *ierr)
339: {
340:   *PetscBinarySeek(*fd,*size,*whence,offset);
341: }

343: void PETSC_STDCALL petscbinaryclose_(int *fd,int *ierr)
344: {
345:   *PetscBinaryClose(*fd);
346: }

348: /* ---------------------------------------------------------------------------------*/
349: void PETSC_STDCALL petscmemzero_(void *a,int *n,int *ierr)
350: {
351:   *PetscMemzero(a,*n);
352: }

354: void PETSC_STDCALL petsctrdump_(int *ierr)
355: {
356:   *PetscTrDump(stdout);
357: }
358: void PETSC_STDCALL petsctrlogdump_(int *ierr)
359: {
360:   *PetscTrLogDump(stdout);
361: }

363: void PETSC_STDCALL petscmemcpy_(int *out,int *in,int *length,int *ierr)
364: {
365:   *PetscMemcpy(out,in,*length);
366: }

368: void PETSC_STDCALL petsctrlog_(int *ierr)
369: {
370:   *PetscTrLog();
371: }

373: /*
374:         This version does not do a malloc 
375: */
376: static char FIXCHARSTRING[1024];
377: #if defined(PETSC_USES_CPTOFCD)
378: #include <fortran.h>

380: #define CHAR _fcd
381: #define FIXCHARNOMALLOC(a,n,b) 
382: { 
383:   b = _fcdtocp(a); 
384:   n = _fcdlen (a); 
385:   if (b == PETSC_NULL_CHARACTER_Fortran) { 
386:       b = 0; 
387:   } else {  
388:     while((n > 0) && (b[n-1] == ' ')) n--; 
389:     b = FIXCHARSTRING; 
390:     *PetscStrncpy(b,_fcdtocp(a),n); 
391:     if (*ierr) return; 
392:     b[n] = 0; 
393:   } 
394: }

396: #else

398: #define CHAR char*
399: #define FIXCHARNOMALLOC(a,n,b) 
400: {
401:   if (a == PETSC_NULL_CHARACTER_Fortran) { 
402:     b = a = 0; 
403:   } else { 
404:     while((n > 0) && (a[n-1] == ' ')) n--; 
405:     if (a[n] != 0) { 
406:       b = FIXCHARSTRING; 
407:       *PetscStrncpy(b,a,n); 
408:       if (*ierr) return; 
409:       b[n] = 0; 
410:     } else b = a;
411:   } 
412: }

414: #endif

416: void PETSC_STDCALL chkmemfortran_(int *line,CHAR file PETSC_MIXED_LEN(len),int *ierr PETSC_END_LEN(len))
417: {
418:   char *c1;

420:   FIXCHARNOMALLOC(file,len,c1);
421:   *PetscTrValid(*line,"Userfunction",c1," ");
422: }

424: void PETSC_STDCALL petsctrvalid_(int *ierr)
425: {
426:   *PetscTrValid(0,"Unknown Fortran",0,0);
427: }

429: void PETSC_STDCALL petscrandomgetvalue_(PetscRandom *r,PetscScalar *val,int *ierr)
430: {
431:   *PetscRandomGetValue(*r,val);
432: }


435: void PETSC_STDCALL petscobjectgetname_(PetscObject *obj,CHAR name PETSC_MIXED_LEN(len),
436:                                        int *ierr PETSC_END_LEN(len))
437: {
438:   char *tmp;
439:   *PetscObjectGetName(*obj,&tmp);
440: #if defined(PETSC_USES_CPTOFCD)
441:   {
442:   char *t = _fcdtocp(name);
443:   int  len1 = _fcdlen(name);
444:   *PetscStrncpy(t,tmp,len1);if (*ierr) return;
445:   }
446: #else
447:   *PetscStrncpy(name,tmp,len);if (*ierr) return;
448: #endif
449: }

451: void PETSC_STDCALL petscobjectdestroy_(PetscObject *obj,int *ierr)
452: {
453:   *PetscObjectDestroy(*obj);
454: }

456: void PETSC_STDCALL petscobjectgetcomm_(PetscObject *obj,int *comm,int *ierr)
457: {
458:   MPI_Comm c;
459:   *PetscObjectGetComm(*obj,&c);
460:   *(int*)comm = PetscFromPointerComm(c);
461: }

463: void PETSC_STDCALL petscattachdebugger_(int *ierr)
464: {
465:   *PetscAttachDebugger();
466: }

468: void PETSC_STDCALL petscobjectsetname_(PetscObject *obj,CHAR name PETSC_MIXED_LEN(len),
469:                                        int *ierr PETSC_END_LEN(len))
470: {
471:   char *t1;

473:   FIXCHAR(name,len,t1);
474:   *PetscObjectSetName(*obj,t1);
475:   FREECHAR(name,t1);
476: }

478: void PETSC_STDCALL petscerror_(int *number,int *p,CHAR message PETSC_MIXED_LEN(len),
479:                                int *ierr PETSC_END_LEN(len))
480: {
481:   char *t1;
482:   FIXCHAR(message,len,t1);
483:   *PetscError(-1,"fortran_interface_unknown_file",0,0,*number,*p,t1);
484:   FREECHAR(message,t1);
485: }

487: void PETSC_STDCALL petscgetflops_(PetscLogDouble *d,int *ierr)
488: {
489: #if defined(PETSC_USE_LOG)
490:   *PetscGetFlops(d);
491: #else
492:   0;
493:   *d     = 0.0;
494: #endif
495: }

497: void PETSC_STDCALL petscrandomcreate_(MPI_Comm *comm,PetscRandomType *type,PetscRandom *r,int *ierr)
498: {
499:   *PetscRandomCreate((MPI_Comm)PetscToPointerComm(*comm),*type,r);
500: }

502: void PETSC_STDCALL petscrandomdestroy_(PetscRandom *r,int *ierr)
503: {
504:   *PetscRandomDestroy(*r);
505: }

507: void PETSC_STDCALL petscrealview_(int *n,PetscReal *d,int *viwer,int *ierr)
508: {
509:   *PetscRealView(*n,d,0);
510: }

512: void PETSC_STDCALL petscintview_(int *n,int *d,int *viwer,int *ierr)
513: {
514:   *PetscIntView(*n,d,0);
515: }

517: void PETSC_STDCALL petscsequentialphasebegin_(MPI_Comm *comm,int *ng,int *ierr){
518: *PetscSequentialPhaseBegin(
519:         (MPI_Comm)PetscToPointerComm(*comm),*ng);
520: }
521: void PETSC_STDCALL petscsequentialphaseend_(MPI_Comm *comm,int *ng,int *ierr){
522: *PetscSequentialPhaseEnd(
523:         (MPI_Comm)PetscToPointerComm(*comm),*ng);
524: }


527: #if defined(PETSC_HAVE_MATLAB_ENGINE) && !defined(PETSC_USE_COMPLEX) && !defined(PETSC_USE_SINGLE)

529: void PETSC_STDCALL petscmatlabenginecreate_(MPI_Comm *comm,CHAR m PETSC_MIXED_LEN(len),PetscMatlabEngine *e,
530:                                             int *ierr PETSC_END_LEN(len))
531: {
532:   char *ms;

534:   FIXCHAR(m,len,ms);
535:   *PetscMatlabEngineCreate((MPI_Comm)PetscToPointerComm(*comm),ms,e);
536:   FREECHAR(m,ms);
537: }

539: void PETSC_STDCALL petscmatlabenginedestroy_(PetscMatlabEngine *e,int *ierr)
540: {
541:   *PetscMatlabEngineDestroy(*e);
542: }

544: void PETSC_STDCALL petscmatlabengineevaluate_(PetscMatlabEngine *e,CHAR m PETSC_MIXED_LEN(len),
545:                                               int *ierr PETSC_END_LEN(len))
546: {
547:   char *ms;
548:   FIXCHAR(m,len,ms);
549:   *PetscMatlabEngineEvaluate(*e,ms);
550:   FREECHAR(m,ms);
551: }

553: void PETSC_STDCALL petscmatlabengineput_(PetscMatlabEngine *e,PetscObject *o,int *ierr)
554: {
555:   *PetscMatlabEnginePut(*e,*o);
556: }

558: void PETSC_STDCALL petscmatlabengineget_(PetscMatlabEngine *e,PetscObject *o,int *ierr)
559: {
560:   *PetscMatlabEngineGet(*e,*o);
561: }

563: void PETSC_STDCALL petscmatlabengineputarray_(PetscMatlabEngine *e,int *m,int *n,PetscScalar *a,
564:                                               CHAR s PETSC_MIXED_LEN(len),int *ierr PETSC_END_LEN(len))
565: {
566:   char *ms;
567:   FIXCHAR(s,len,ms);
568:   *PetscMatlabEnginePutArray(*e,*m,*n,a,ms);
569:   FREECHAR(s,ms);
570: }

572: void PETSC_STDCALL petscmatlabenginegetarray_(PetscMatlabEngine *e,int *m,int *n,PetscScalar *a,
573:                                               CHAR s PETSC_MIXED_LEN(len),int *ierr PETSC_END_LEN(len))
574: {
575:   char *ms;
576:   FIXCHAR(s,len,ms);
577:   *PetscMatlabEngineGetArray(*e,*m,*n,a,ms);
578:   FREECHAR(s,ms);
579: }

581: #endif
582: /*
583: EXTERN int PetscMatlabEngineGetOutput(PetscMatlabEngine,char **);
584: EXTERN int PetscMatlabEnginePrintOutput(PetscMatlabEngine,FILE*);
585: */

587: EXTERN_C_END