ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/REPOS_ERICCA/magic/lib/diamesh/src/m3d_rechnoe.cpp
Revision: 253
Committed: Tue Jul 13 19:40:46 2010 UTC (14 years, 10 months ago) by francois
File size: 6768 byte(s)
Log Message:
changement de hiearchie et utilisation de ccmake + mise a jour

File Contents

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