Functions

gs_get_problems.cpp File Reference

#include <oct.h>
#include <stdio.h>
#include <stdlib.h>
#include "grpc.h"
#include "gs_oct.h"
Include dependency graph for gs_get_problems.cpp:

Go to the source code of this file.

Functions

 DEFUN_DLD (gs_problems, args, nargout,"Octave client for GridSolve")

Function Documentation

DEFUN_DLD ( gs_problems  ,
args  ,
nargout  ,
"Octave client for GridSolve"   
)

Definition at line 22 of file gs_get_problems.cpp.

                                                                      {
    octave_value_list bad_retval;   //bad return value
    grpc_error_t status;            //GridRPC status/error code
    char *info[1];


    //meaningless return value for error condition
    //or those calls that do not make grpc function call
    for (int i = 0; i < nargout; i++) {
        bad_retval(i) = Matrix(0, 0);
    }

    //initialize the GridSolve environment
    status = grpc_initialize(NULL);
    if (status != GRPC_NO_ERROR && status != GRPC_ALREADY_INITIALIZED) {
        fprintf(stderr, "%s\n", grpc_error_string(status));
        return bad_retval;
    }

    //number of input arguments
    int nargin = args.length();

    //display the list of available GridSolve problems
    if ((status = grpc_get_problems(info)) != GRPC_NO_ERROR) {
        fprintf(stderr, "%s\n", grpc_error_string(status));
    } else { //print out the list
        printf("GridSolve - List of available problems:\n");
        printf("%s\n", info[0]);
    }

    //finalize and clean up
    grpc_finalize();
    return bad_retval;
}

Here is the call graph for this function: