1 /***************************************************************************** 2 * Copyright (c) 2019 FrontISTR Commons 3 * This software is released under the MIT License, see LICENSE.txt 4 *****************************************************************************/ 5 6 #ifndef HECMW_VIS_SF_GEOM_H_INCLUDED 7 #define HECMW_VIS_SF_GEOM_H_INCLUDED 8 9 /* 10 #include <stdio.h> 11 #include <stdlib.h> 12 #include <math.h> 13 #include <string.h> 14 #include <memory.h> 15 #include <ctype.h> 16 #include "hecmw_struct.h" 17 #include "hecmw_util.h" 18 #include "hecmw_io.h" 19 */ 20 #include "hecmw_vis_psf_rendering.h" 21 /* 22 #include "hecmw_vis_comm_util.h" 23 */ 24 25 #define MASTER_PE 0 26 27 #define EPSILON 0.00000001 28 29 #define TABLE_SIZE 100 30 31 #define VERTEX_PACK 50 32 33 #define POLYGON_PACK 100 34 35 #define VERTEX_KIND 27 36 37 #define HEX_N_NODE 8 38 39 #define HEX_N_FACE 6 40 41 #define HEX_NODE_INDEX 255 /* 2^8 */ 42 43 #define HEX_FACE_INDEX 63 /* 2^6 */ 44 45 #define PRISM_N_NODE 6 46 47 #define PRISM_N_FACE 5 48 49 #define PRISM_NODE_INDEX 63 /* 2^6 */ 50 51 #define PRISM_FACE_INDEX 31 /* 2^5 */ 52 53 #define TETRA_N_NODE 4 54 55 #define TETRA_N_FACE 4 56 57 #define TETRA_NODE_INDEX 15 /* 2^4 */ 58 59 #define TETRA_FACE_INDEX 15 /* 2^4 */ 60 61 #define MAX_N_NODE 20 62 63 #define HASH_TABLE_SIZE 10000 64 65 #define NUM_CONTROL_PSF 73 66 /* 67 #define MAX_LINE_LEN 256 68 #define buffer_size 300 69 #define UCD_NUM_CELL_TYPES 8 70 #define UCD_LABEL_LEN 1024 71 */ 72 73 typedef struct _psf_link_struct { 74 int num_of_psf; 75 76 struct surface_module *sf; 77 78 Parameter_rendering *sr; 79 struct _psf_link_struct *next_psf; 80 int stat_para[NUM_CONTROL_PSF]; 81 int visual_start_step; 82 int visual_end_step; 83 84 int visual_interval_step; 85 86 } PSF_link; 87 88 struct surface_module { 89 int surface_style; 90 char group_name[128]; 91 int defined_style; 92 char data_comp_name[128]; 93 int data_comp; 94 char data_subcomp_name[128]; 95 int data_subcomp; 96 double iso_value; 97 int method; 98 double point[3]; 99 double radius; 100 double length[3]; 101 double coef[10]; 102 int display_method; 103 char color_comp_name[128]; 104 int color_comp; 105 char color_subcomp_name[128]; 106 int color_subcomp; 107 int isoline_number; 108 double specified_color; 109 int normalize_flag; 110 int range_output; 111 char range_filename[128]; 112 113 int deform_display_on; 114 115 int disp_comp; 116 117 char disp_comp_name[128]; 118 119 double disp_scale; 120 double real_disp_scale; 121 122 int initial_style; 123 124 int deform_style; 125 126 double initial_line_color[3]; 127 128 double deform_line_color[3]; 129 130 int output_type; 131 }; 132 133 typedef struct _surface_module_struct { 134 int surface_style; 135 char *group_name; 136 int defined_style; 137 int data_comp; 138 int data_subcomp; 139 double iso_value; 140 int color_comp; 141 int color_subcomp; 142 int cross_type; 143 double cont_equ[10]; 144 int display_way; 145 double rgbrange[3]; 146 int isonumber; 147 double specified_color; 148 149 int output_type; 150 int opacity_choice; 151 double opacity; 152 153 int deform_display_on; 154 155 int disp_comp; 156 157 char disp_comp_name[128]; 158 159 double disp_scale; 160 double real_disp_scale; 161 int initial_style; 162 163 int deform_style; 164 165 double initial_line_color[3]; 166 167 double deform_line_color[3]; 168 } Surface; 169 170 typedef struct _result_struct { 171 int n_vertex; 172 int n_patch; 173 double *vertex; 174 int *patch; 175 double *color; 176 double *disp; 177 } Result; 178 179 typedef struct _fgeom_struct { 180 double x; 181 double y; 182 double z; 183 } Fgeom; 184 185 typedef struct _triangle_struct { int vertex[3]; } Triangle; 186 187 typedef struct _isoline_struct { 188 Fgeom point[2]; 189 struct _isoline_struct *nextline; 190 } Isoline; 191 192 typedef struct _isohead_struct { 193 int linenum; 194 struct _isoline_struct *nextline; 195 } Isohead; 196 197 typedef struct _point_struct { 198 int ident; 199 double field; 200 double cdata; 201 double disp[3]; 202 Fgeom geom; 203 int locator; 204 int bdflag; 205 int info; 206 struct _point_struct *nextpoint; 207 } Point; 208 209 typedef struct _polygon_struct { 210 int type; 211 int *plist; 212 struct _polygon_struct *nextpolygon; 213 int elem_id[2]; 214 int bdflag; 215 } Polygon; 216 /* type: 0 then polygon is owned by alpha isosurface 217 1 then polygon is owned by beta isosurface 218 2 then polygon is owned by cross section */ 219 /* *plist = {a,b,c,d,e,....} : a is number of vertex, 220 b,c,d,c,... is array of vertex(left turn) */ 221 /* flag : $B6-3&$NMWAG$+$I$&$+(B */ 222 223 typedef struct _polygon_obj_struct { 224 int verts_num; 225 double *field; 226 double *verts; 227 unsigned long *colors; 228 int *plist; 229 } Polygon_obj; 230 231 typedef struct _CS_polygon_struct { 232 Polygon_obj *alpha_obj; 233 Polygon_obj *cross_obj; 234 double area; 235 double volume; 236 double integral; 237 } CS_polygon_obj; 238 239 typedef struct _cube_polygons_struct { 240 int verts_num; 241 int verts[VERTEX_KIND]; /* 8 + 12 + 7 */ 242 int **isosurf; /* terminator is -1 */ 243 } Cube_polygons; 244 245 typedef struct _rotation_info_struct { 246 unsigned char face[6]; 247 unsigned char grid_point[8]; 248 unsigned char edge[12]; 249 unsigned char inside[7]; 250 } Rotation_info; 251 252 typedef struct _cell_struct { 253 double axis[3 * 8]; 254 double s_data[8]; 255 double c_data[8]; 256 double disp[3 * 8]; 257 double v_data[3 * 8]; 258 int elem_id[2]; 259 } Cell; 260 261 typedef struct _tetra_struct { 262 double axis[3 * 4]; 263 double s_data[4]; 264 double c_data[4]; 265 double disp[3 * 4]; 266 double v_data[3 * 4]; 267 int elem_id[2]; 268 int local_vid[4]; 269 } Tetra; 270 271 typedef struct _prism_struct { 272 double axis[3 * 6]; 273 double s_data[6]; 274 double c_data[6]; 275 double disp[3 * 6]; 276 double v_data[3 * 6]; 277 int elem_id[2]; 278 int local_vid[6]; 279 } Prism; 280 281 /* 282 typedef struct _overlap_struct { 283 int index; 284 int elem_id[2]; 285 int verts_num; 286 int *verts; 287 struct _overlap_struct *next_elem; 288 } Overlap; 289 */ 290 291 typedef struct _vertex_struct { 292 int index; 293 double x; 294 double y; 295 double z; 296 double color; 297 double disp[3]; 298 struct _vertex_struct *next_verts; 299 } Vertex; 300 typedef struct _overlap_struct { 301 int index; 302 int elem_id[2]; 303 int verts_num; 304 int *verts; 305 struct _overlap_struct *next_elem; 306 } Overlap; 307 308 /* 309 typedef struct _elem_no { 310 int peID; 311 int localID; 312 } Elem_no; 313 */ 314 315 typedef struct _hash_table_struct { 316 int elemID; 317 int faceID; 318 struct _hash_table_struct *next_elem; 319 } Hash_table; 320 321 typedef struct _boundary_patch_struct { 322 int type; 323 /* 3== tri 4==quad */ 324 double vertex[4 * 3]; 325 double color[4]; 326 double disp[4 * 3]; 327 struct _boundary_patch_struct *next_patch; 328 } Boundary_patch; 329 330 typedef struct _point_tetra_struct { 331 int ident; 332 double cdata; 333 double disp[3]; 334 double geom[3]; 335 336 struct _point_tetra_struct *nextpoint; 337 } Tetra_point; 338 339 typedef struct _patch_tetra_struct { 340 int patch[3]; 341 struct _patch_tetra_struct *next_patch; 342 } Patch_tetra; 343 344 typedef struct _head_patch_tetra_struct { 345 int num_patch; 346 Patch_tetra *patch_link; 347 } Head_patch_tetra; 348 349 typedef struct _hash_vertex_struct { 350 int ident; 351 double geom[3]; 352 struct _hash_vertex_struct *next_vertex; 353 } Hash_vertex; 354 355 typedef struct _connect_inf { 356 int *index_connect; 357 int *connect; 358 } Connect_inf; 359 360 #endif /* HECMW_VIS_SF_GEOM_H_INCLUDED */ 361