ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/REPOS_ERICCA/acismesh/m3d_enreg.cpp
Revision: 1
Committed: Mon Jun 11 22:53:07 2007 UTC (17 years, 11 months ago)
File size: 3414 byte(s)
Log Message:

File Contents

# Content
1 /*****************************************************************
2
3 m3d_enreg.c Type:Func
4
5 Enregistrement du maillage volumique
6
7 Date de creation : Fri Aug 1 11:10:21 1997
8
9 Derniere version : Fri Aug 1 11:10:21 1997
10
11
12
13
14
15
16
17 Vincent FRANCOIS
18
19 *****************************************************************/
20
21
22
23
24
25 /**************************/
26 /* include */
27 #include <stdio.h>
28 #include <string.h>
29 #include "const.h"
30 #include "struct.h"
31 #include "struct3d.h"
32 #include "memoire.h"
33 #include "prototype.h"
34
35
36 /**************************/
37 /* variables globales */
38 extern struct s_mesh *mesh;
39 extern struct environnement env;
40
41
42
43 /**************************/
44 /* programme principal */
45
46 void m3d_enreg(int type)
47 {
48 FILE *fic;
49 int i,nb;
50 struct s_noeud *no,*no1,*no2,*no3,*no4;
51 struct s_tetra *tet;
52 struct s_front3d *ft;
53 char string[255];
54 int nb_noeud,nb_tetra;
55
56 if (type==2)
57 {
58 strcpy(string,env.fich);
59 string[strlen(string)-4]=0;
60 strcat(string,"f_2D.mai");
61 fic=fopen(string,"wt");
62 fprintf(fic,"%d %d \n",mesh->nb_noeud,mesh->nb_front3d);
63 for (i=0;i<mesh->nb_noeud;i++)
64 {
65 no=ADRESSE(i,noeud,mesh->);
66 fprintf(fic,"%d %f %f %f\n",i+1,no->x,no->y,no->z);
67 }
68 for (i=0;i<12;i++)
69 {
70 ft=mesh->tete_front3d[i];
71 while (ft!=NULL)
72 {
73 fprintf(fic,"3 %d %d %d\n",ft->n1+1,ft->n2+1,ft->n3+1);
74 ft=ft->suivant;
75 }
76 }
77 fclose(fic);
78 return;
79 }
80 strcpy(string,env.fich);
81 string[strlen(string)-4]=0;
82 if (type==1) strcat(string,"c_3D.mai");
83 else strcat(string,"_3D.mai");
84 fic=fopen(string,"wt");
85 nb_noeud=0;
86 nb_tetra=0;
87 for (i=0;i<mesh->nb_noeud;i++)
88 {
89 no=ADRESSE(i,noeud,mesh->);
90 if (no->etat==ACTIF) nb_noeud++;
91 }
92 for (i=0;i<mesh->nb_tetra;i++)
93 {
94 tet=ADRESSE(i,tetra,mesh->);
95 if (tet->etat==ACTIF) nb_tetra++;
96 }
97 fprintf(fic,"%d %d \n",nb_noeud,nb_tetra);
98 nb=0;
99 for (i=0;i<mesh->nb_noeud;i++)
100 {
101 no=ADRESSE(i,noeud,mesh->);
102 no->renum=(-5);
103 if (no->etat==ACTIF)
104 {
105 fprintf(fic,"%d %f %f %f\n",nb+1,no->x,no->y,no->z);
106 no->renum=nb;
107 nb++;
108 }
109 }
110 for (i=0;i<mesh->nb_tetra;i++)
111 {
112 tet=ADRESSE(i,tetra,mesh->);
113 if (tet->etat==ACTIF)
114 {
115 no1=ADRESSE(tet->n1,noeud,mesh->);
116 no2=ADRESSE(tet->n2,noeud,mesh->);
117 no3=ADRESSE(tet->n3,noeud,mesh->);
118 no4=ADRESSE(tet->n4,noeud,mesh->);
119 fprintf(fic,"4 %d %d %d %d\n",no1->renum+1,no2->renum+1,no3->renum+1,no4->renum+1);
120 }
121 }
122 fclose(fic);
123 }
124