signum.c File Reference

#include "scicos_block.h"
#include <math.h>

Include dependency graph for signum.c:

Go to the source code of this file.

Functions

void signum (scicos_block *block, int flag)


Function Documentation

void signum ( scicos_block block,
int  flag 
)

Definition at line 4 of file signum.c.

References get_phase_simulation(), i, scicos_block::inptr, scicos_block::insz, j, and scicos_block::ng.

00005 {
00006   int i,j;
00007   if (flag==1){
00008     for(i=0;i<block->insz[0];++i){
00009       if (get_phase_simulation()==1||block->ng==0) {
00010         if (block->inptr[0][i]<0){
00011           j=2;
00012         } else if (block->inptr[0][i]>0){
00013           j=1;
00014         }else{
00015           j=0;
00016         }
00017       }else {
00018         j=block->mode[i];
00019       }
00020       if (j==1){
00021         block->outptr[0][i]=1.0;
00022       } else if(j==2){
00023         block->outptr[0][i]=-1.0;
00024       }else{
00025         block->outptr[0][i]=0.0;
00026       }
00027     }
00028   }else if (flag==9){
00029     for(i=0;i<block->insz[0];++i){
00030       block->g[i]=block->inptr[0][i];
00031       if (get_phase_simulation()==1) {
00032         if(block->g[i]<0){
00033           block->mode[i]=2;
00034         }else{
00035           block->mode[i]=1;
00036         }
00037       }
00038     }
00039   }
00040 }

Here is the call graph for this function:


Generated on Sun Mar 4 16:12:23 2007 for Scilab [trunk] by  doxygen 1.5.1