Computational routine
eng
comp
/* Modnumlib Scicos interfacing function
* Copyright (C) 2009-2011 Alan Layec
*
* This library 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 library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/* comp Scicos sign comparison block
* Type 4 simulation function - scilab-3.0
* IRCOM GROUP - Author : A.Layec
*/
/* REVISION HISTORY :
* $Log$
*/
#include "modnum_lib.h"
#include <scicos/scicos_block.h>
/* Cette fonction de simulation realise la comparaison de signe
* du vecteur d'entrée. Le vecteur de sortie prend les valeurs
* +- ampl suivant le signe du vecteur d'entrée.
* Si le paramètre rpar est un vecteur on appelle compv_c
* si c'est un scalaire on appelle comp_c.
*
* entrée régulière : u[0..nu-1] vecteur d'entrée
* sortie régulière : y[0..ny-1] vecteur de sortie
* entrée évènementielle : Heritage ou explicite
* sortie évènementeille : néant
*
* paramètre entier : néant
* paramètre réel : rpar[0] ou rpar[0..nu-1] amplitude de sortie
*/
/*Prototype*/
void comp(scicos_block *block,int flag)
{
/*déclaration*/
double *u,*y;
/*récupération des adresses des ports réguliers*/
u=(double *)block->inptr[0];
y=(double *)block->outptr[0];
if(flag==1)
{
if (block->nrpar==1)
/*Appel comp_c*/
comp_c(&block->insz[0],&block->rpar[0],&u[0],&y[0]);
else
/*Appel compv_c*/
compv_c(&block->insz[0],&block->rpar[0],&u[0],&y[0]);
}
}