Computational routine
eng


inserzerovec

File content


/* 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.
 */
 
/* inserzerovec Scicos vectorial zero instertion
 * Type 4 simulation function ver 1.0 - scilab-2.6&2.7
 * 4 janvier 2005 - IRCOM GROUP - Author : A.Layec
 */

/* REVISION HISTORY :
 * $Log$
 */

#include <scicos/scicos_block.h>
#include "modnum_lib.h"


/* Cette fonction transforme un vecteur de taille Nu en un vecteur
 * de taile Ny, avec Ny>Nu, et en ajoutant des zéros dans l'espace > Nu
 *
 * Entrée régulière  : u[0..nu-1] : vecteur d'entrée de taille nu
 * sorties régulière : y[0..ny-1] : vecteur de sortie de taille ny
 */

/*prototype*/
void inserzerovec(scicos_block *block,int flag)
{
  /*Déclaration des variables*/
  double *y;
  double *u;
  int i,nu,ny,k;

  /*Récupération des adresses des ports réguliers*/
  y=(double *)block->outptr[0];
  u=(double *)block->inptr[0];

  /*Récupération des tailles des ports réguliers*/
  nu=block->insz[0];
  ny=block->outsz[0];

  /*recopie u[] dans y[]*/
  copyd_c(&nu,&u[0],&y[0]);

  /*ajoute les zéros*/
  for(i=nu;i<ny;i++) y[i]=0;
}