#include #include #include #include #include "../matrix/matrix_types.h" #include "../matrix/matrix.h" #include "FEVtypes.h" #include "FEV.h" /* the recursive depth-first algorithm to follow pointers and create the p_struct arrays */ #define SIZE 16 p_face_t F_arr[SIZE]; p_edge_t E_arr[SIZE]; p_vertex_t V_arr[SIZE]; int type_counts[20]; /*indexed by FACE, EDGE, VERTEX codes*/ /* main() { face_t fakeit; FILE *FP; fakeit = fake_face(); FP = fopen("pstruct.data" ,"w"); printf("\n fp: %d \n", FP); face_to_file(FP, fakeit); fclose(FP); } */ void face_to_file(FILE *FP, face_t head_face) { /* this is top-level program to write out all vertices, edges, faces to file */ int head_index; int i; /* initialize pointer and type_count arrays */ /* depth-first traversal of data structure starts here*/ head_index = F_to_array (head_face); /* now just write out the arrays and their meta-info*/ fprintf(FP, "%d %d", FACE, head_index); /* then call p_face_to_file, etc. */ } int F_to_array(face_t aface) { int typeno, serialno; p_face_t new_p_face; /* creates p_struct for face, fills it up from original face_t face, but must call itself and and a similar version for edges to fill create more p_structs and get back their indices instead of the struct's pointers.*/ /* .... */ return serialno; } int E_to_array(edge_t aedge ) { int typeno, serialno; p_edge_t new_p_edge; /*similar*/ } int V_to_array(vertex_t avertex) { int typeno, serialno; p_vertex_t new_p_vertex; /*similar*/ /* uses original matrices */ } void p_face_to_file(FILE *FP, p_face_t p_face) /* terse face print*/ { /*writes out the face's numbers */ } void p_edge_to_file(FILE *FP, p_edge_t p_edge) /* terse face print*/ { } void p_vert_to_file(FILE *FP, p_vertex_t p_vert) { }