ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/REPOS_ERICCA/magic/lib/diamesh/src/r3d_rechnoe.cpp
Revision: 283
Committed: Tue Sep 13 21:11:20 2011 UTC (13 years, 8 months ago) by francois
File size: 7903 byte(s)
Log Message:
structure de l'écriture

File Contents

# User Rev Content
1 francois 283 /* nouvelle startegie : on teste */
2     #include <stdio.h>
3     #include "r3d_struct.h"
4     #include "m3d_const.h"
5     #include "m3d_hotes.h"
6     #include "prototype2.h"
7     extern int debug;
8     extern int visu ;
9     extern float crit_min ;
10     extern GEST_MEM *gest_r ;
11     /* routine de recherche d'un noeud */
12     int r3d_rechnoe(int *vec_p,float *tab_crit,FACE *face,FACE **tab_front,NOEUD **nresu)
13     {
14     int hist ;
15     int nb_face, i, j ;
16     TETRAEDRE *tetra1, *tetra2 ;
17     FACE *finter[1000] ;
18     FACE *fdel ;
19    
20     *nresu = NULL ;
21     j = 0 ;
22     while (*nresu == NULL)
23     {
24     switch (vec_p[j])
25     {
26     /* ***************************************************************** */
27     /* ----------------------------------------------------------------- */
28     /* RECHERCHE D'UN POINT CONNECTABLE */
29     /* ----------------------------------------------------------------- */
30     /* ***************************************************************** */
31     case FAUX :
32     *nresu = NULL ;
33     return(VRAI) ;
34     case RECH :
35     if (!r3d_rech(face,nresu,tab_crit[j],&hist))
36     {
37     if (debug) printf("%s\n"," Erreur r3d_rech R3D_RECHNOE ") ;
38     return(FAUX) ;
39     }
40     j++ ;
41     break ;
42     case GENE :
43     /* ***************************************************************** */
44     /* ----------------------------------------------------------------- */
45     /* GENERATION D'UN POINT CONNECTABLE */
46     /* ----------------------------------------------------------------- */
47     /* ***************************************************************** */
48    
49     if (!r3d_gene(face,nresu,&hist,tab_crit[j]))
50     {
51     if (debug) printf("%s\n"," Erreur r3d_gene R3D_RECHNOE ") ;
52     return(FAUX) ;
53     }
54     j++ ;
55     break ;
56     /* ***************************************************************** */
57     /* ----------------------------------------------------------------- */
58     /* RECHERCHE D'UN POINT CONNECTABLE ET DESTRUCTION */
59     /* ----------------------------------------------------------------- */
60     /* ***************************************************************** */
61     case RECH_DEL :
62     nb_face = 0 ;
63     /* reperage des faces avec lesquelles, il y a intersection */
64    
65     if (!r3d_rech2(face,nresu,tab_crit[j],&hist,finter,&nb_face))
66     {
67     if (debug) printf("%s\n"," Erreur r3d_rech2 R3D_RECHNOE ") ;
68     return(FAUX) ;
69     }
70     j++ ;
71     /* destruction des faces : destruction des tetra : face->tetra1 et face->tetra2 */
72    
73     for (i=0;i<nb_face;i++)
74     {
75     fdel = finter[i] ;
76     if (finter[i] == NULL)
77     {
78     if (debug) printf("%s\n"," Erreur face a detruire nulle R3D_RECHNOE ") ;
79     return(FAUX) ;
80     }
81     tetra1 = fdel->tetra1 ;
82     tetra2 = fdel->tetra2 ;
83     if (tetra1!=NULL)
84     {
85     if (tetra1->mark!=KILLED)
86     {
87     if (!r3d_d_tetra(tetra1,tab_front))
88     {
89     if (debug) printf("%s\n"," Erreur r3d_d_tetra R3D_RECHNOE ") ;
90     if (debug) printf(" tetra1 %d mark = %d \n",tetra1->num,tetra1->mark) ;
91     if ((debug) && (tetra2!=NULL))
92     printf(" tetra2 %d mark = %d \n",tetra2->num,tetra2->mark) ;
93     return(FAUX) ;
94     }
95     /* insertion en tete */
96     }
97     }
98     if (tetra2!=NULL)
99     {
100     if (tetra2->mark!=KILLED)
101     {
102     if (!r3d_d_tetra(tetra2,tab_front))
103     {
104     if (debug) printf("%s\n"," Erreur r3d_d_tetra R3D_RECHNOE ") ;
105     if (debug) printf(" tetra2 %d mark = %d \n",tetra2->num,tetra2->mark) ;
106     if ((debug) && (tetra1!=NULL))
107     printf(" tetra1 %d mark = %d \n",tetra1->num,tetra1->mark) ;
108     return(FAUX) ;
109     }
110     }
111     }
112     }
113     break ;
114    
115     /* ***************************************************************** */
116     /* ----------------------------------------------------------------- */
117     /* GENERATION D'UN POINT CONNECTABLE ET DESTRUCTION */
118     /* ----------------------------------------------------------------- */
119     /* ***************************************************************** */
120     case GENE_DEL :
121     if (face->hist != 0)
122     {
123     j++ ;
124     break ;
125     }
126     nb_face = 0 ;
127     if (!r3d_gene2(face,nresu,&hist,finter,&nb_face,tab_crit[j]))
128     {
129     if (debug) printf("%s\n"," Erreur r3d_gene2 R3D_RECHNOE ") ;
130     return(FAUX) ;
131     }
132     j++ ;
133     /* destruction des faces : destruction des tetra : face->tetra1 et face->tetra2 */
134    
135     for (i=0;i<nb_face;i++)
136     {
137     fdel = finter[i] ;
138     if (fdel == NULL)
139     {
140     if (debug) printf("%s\n"," Erreur face a detruire nulle R3D_RECHNOE ") ;
141     return(FAUX) ;
142     }
143     tetra1 = fdel->tetra1 ;
144     tetra2 = fdel->tetra2 ;
145     if (tetra1!=NULL)
146     {
147     if (tetra1->mark!=KILLED)
148     {
149     if (!r3d_d_tetra(tetra1,tab_front))
150     {
151     if (debug) printf("%s\n"," Erreur r3d_d_tetra R3D_RECHNOE ") ;
152     if (debug) printf(" tetra1 %d mark = %d \n",tetra1->num,tetra1->mark) ;
153     if ((debug) && (tetra2!=NULL))
154     printf(" tetra2 %d mark = %d \n",tetra2->num,tetra2->mark) ;
155     return(FAUX) ;
156     }
157     }
158     }
159     if (tetra2!=NULL)
160     {
161     if (tetra2->mark!=KILLED)
162     {
163     if (!r3d_d_tetra(tetra2,tab_front))
164     {
165     if (debug) printf("%s\n"," Erreur r3d_d_tetra R3D_RECHNOE ") ;
166     if (debug) printf(" tetra2 %d mark = %d \n",tetra2->num,tetra2->mark) ;
167     if ((debug) && (tetra1!=NULL))
168     printf(" tetra1 %d mark = %d \n",tetra1->num,tetra1->mark) ;
169     return(FAUX) ;
170     }
171     }
172     }
173     }
174     break ;
175     }
176     }
177    
178     /* pas de solution */
179     if (*nresu == NULL)
180     {
181     return(VRAI) ;
182     }
183    
184     /* ***************************************************************** */
185     /* ----------------------------------------------------------------- */
186     /* MISE A JOUR DU FRONT */
187     /* ----------------------------------------------------------------- */
188     /* ***************************************************************** */
189    
190     if (*nresu!=NULL)
191     {
192     if (!r3d_update(face,*nresu,tab_front,&hist))
193     {
194     if (debug) printf("%s\n"," Erreur r3d_update R3D_RECHNOE ") ;
195     return(FAUX) ;
196     }
197     }
198     return(VRAI) ;
199     }