/***************************************************************************
                          simuri.h  -  description
                             -------------------
    begin                : Thu Sep 4 2003
    copyright            : (C) 2003 by r.n.
    email                : rniekamp@sc.cs.tu-bs.de
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/
/*
 	This simulation interface can be used by C, fortran and C++ codes  	
 	in order to use remote method invocation.
 	Using the C-Interface this method signatures are expanded to function 
 	Some notes for non C++ -programmer:
		- declaring a parameter as const ensures that this variable will not be changed by the
			this method 
		- declaring a method as const (at the end of the argument list) ensures that this 
			method will not change the state of the simulation
		- declaring a parameter as not as const but as an reference says that this variable will
			most likely be changed by this method 
	Remark:
	The enumeration of the methods yields only interrnal usage
*/

#ifndef _SIMURI_H_     
#define _SIMURI_H_     

#include <ctl.h>

# define CTL_Class simu

using namespace ctl;

# include CTL_ClassBegin

//// must be implemented ////

// init simu with "filename" as starter file
#		define CTL_Method1 void, init, (const string /*filename*/), 1

// get parameter
#		define CTL_Method2 void, getparam, (array<real8> /*p*/), 1

// set parameter
#		define CTL_Method3 void, setparam, (const array<real8> /*p*/), 1

// get primary variables into x
#   define CTL_Method4 void, getstate, (array<real8> /*x*/) const, 1

// set primary variables to x
#   define CTL_Method5 void, setstate, (const array<real8> /*x*/), 1

// set load of system
#   define CTL_Method6 void, setload, (const array<real8> /*load*/), 1

// get coupling indices i and values y (boundary cond. or load or. ...)
#   define CTL_Method7 void, getcoupling, (array<int4> /*i*/, array<real8> /*y*/) const, 2

// set coupling values y (boundary cond. or load or. ...)
#   define CTL_Method8 void, setcoupling, (const array<real8> /*y*/), 1

// compute residuum at given state and write it into r
#   define CTL_Method9 void, residuum, (array<real8> /*r*/) const, 1

// solve with given param, load, coupling values with at least accuracy
// and set new state; write the new state into x, the size into sx
#   define CTL_Method10 void, solve, (const real8 /*accuracy*/, array<real8> /*x*/), 2

//// might be implemented (but define at leat empty functions) ////

// compute a timetstep and set the new state; write the new state into x_new
#   define CTL_Method11 void, timestep, (const real8 /*dt*/, array<real8> /*x_new*/), 2

// compute the preconditioned vector of r and write it into pr
#   define CTL_Method12 void, precond, (const array<real8> /*r*/, array<real8> /*pr*/) const, 2

// compute the directional derivation in x0 in direction dx and write it into dr
#   define CTL_Method13 void, dirderivative, (const array<real8> /*x0*/, const array<real8> /*dx*/, array<real8> /*dr*/) const, 3

// evaluate the command cmd
#   define CTL_Method14 void, command, (const string /*cmd*/) const, 1

//// An assumption is that in each case: ////
////  the size of the output  is equal to the size of the input vectors ////

# include CTL_ClassEnd

#endif

// vim: ft=cpp
