1 /* Scicos
2 *
3 * Copyright (C) INRIA - METALAU Project <scicos@inria.fr>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 *
19 * See the file ./license.txt
20 */
21 /*--------------------------------------------------------------------------*/
22 #include "dynlib_scicos_blocks.h"
23
zcross2(int * flag,int * nevprt,double * t,double xd[],double x[],int * nx,double z[],int * nz,double tvec[],int * ntvec,double rpar[],int * nrpar,int ipar[],int * nipar,double u[],int * nu,double g[],int * ng)24 SCICOS_BLOCKS_IMPEXP void zcross2(int *flag, int *nevprt,
25 double *t, double xd[],
26 double x[], int *nx,
27 double z[], int *nz,
28 double tvec[], int *ntvec,
29 double rpar[], int *nrpar,
30 int ipar[], int *nipar,
31 double u[], int *nu,
32 double g[], int *ng)
33 {
34 int i = 0, j = 0;
35 int surface_matched = 0, exist_enabled_surface = 0;
36 exist_enabled_surface = 0;
37
38 if ((*flag == 3) && (*nevprt < 0))
39 {
40 for (i = 0; i < *ntvec; i++)
41 {
42 surface_matched = 1;
43 exist_enabled_surface = 0;
44
45 for (j = 0; j < *ng; j++)
46 {
47 if (rpar[(*ng + 1)*i + j] != 0)
48 {
49 exist_enabled_surface = 1;
50 if ((rpar[(*ng + 1)*i + j]*g[j]) <= 0)
51 {
52 surface_matched = 0;
53 }
54 }
55 }
56
57 if (( surface_matched == 1) && (exist_enabled_surface == 1))
58 {
59 tvec[i] = *t + rpar[(*ng + 1) * i + *ng];
60 }
61 else
62 {
63 tvec[i] = -1;
64 }
65 }
66 }
67 else
68 {
69 if (*flag == 9)
70 {
71 for (i = 0; i < *ng; i++)
72 {
73 g[i] = u[i];
74 }
75 }
76 }
77 }
78 /*--------------------------------------------------------------------------*/
79