p4est
1.0
|
00001 /* 00002 This file is part of p4est. 00003 p4est is a C library to manage a collection (a forest) of multiple 00004 connected adaptive quadtrees or octrees in parallel. 00005 00006 Copyright (C) 2010 The University of Texas System 00007 Written by Carsten Burstedde, Lucas C. Wilcox, and Tobin Isaac 00008 00009 p4est is free software; you can redistribute it and/or modify 00010 it under the terms of the GNU General Public License as published by 00011 the Free Software Foundation; either version 2 of the License, or 00012 (at your option) any later version. 00013 00014 p4est is distributed in the hope that it will be useful, 00015 but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00017 GNU General Public License for more details. 00018 00019 You should have received a copy of the GNU General Public License 00020 along with p4est; if not, write to the Free Software Foundation, Inc., 00021 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00022 */ 00023 00024 /* 00025 * This file provides an interface that is compatible 00026 * with the trilinear finite elements used in the Rhea code. 00027 */ 00028 00029 #ifndef P8EST_TRILINEAR_H 00030 #define P8EST_TRILINEAR_H 00031 00032 #include <p8est_nodes.h> 00033 #include <p8est_lnodes.h> 00034 00035 /* 00036 * BEGIN verbatim copy of trilinear_mesh_types.h from the Rhea code 00037 */ 00038 00039 #ifndef TRILINEAR_MESH_TYPES_H 00040 #define TRILINEAR_MESH_TYPES_H 00041 00042 #include <sc_containers.h> 00043 00044 /* 00045 * This file contains typedefs and macros related to the trilinear mesh. 00046 * It should not contain specific dependencies to either octor of p4est. 00047 */ 00048 00049 #ifndef OCTOR_TICKT_TYPES 00050 #define OCTOR_TICKT_TYPES 00051 00052 typedef int32_t tick_t; 00053 00054 typedef struct point_t 00055 { 00056 tick_t x, y, z; 00057 } 00058 point_t; 00059 00060 #endif /* !OCTOR_TICKT_TYPES */ 00061 00062 typedef int16_t trilinear_mesh_pid_t; 00063 00064 typedef enum 00065 { 00066 ANCHORED = 0, 00067 DANGLING_ON_XEDGE = -1, 00068 DANGLING_ON_YEDGE = -2, 00069 DANGLING_ON_ZEDGE = -3, 00070 DANGLING_ON_XFACE = -4, 00071 DANGLING_ON_YFACE = -5, 00072 DANGLING_ON_ZFACE = -6 00073 } 00074 trilinear_node_type_t; 00075 00076 typedef struct trilinear_elem_t 00077 { 00078 int32_t local_node_id[8]; /* indices into local node table */ 00079 tick_t lx, ly, lz; /* lower-left element coordinates */ 00080 tick_t size; /* size of the element in ticks */ 00081 void *data; /* pointer to its record, managed by octor */ 00082 } 00083 trilinear_elem_t; 00084 00088 typedef struct int32link_t 00089 { 00090 int32_t id; 00091 struct int32link_t *next; 00092 } 00093 int32link_t; 00094 00098 typedef struct trilinear_anode_t 00099 { 00100 point_t point; 00101 int64_t fvnid; 00102 int32link_t *share; /* processors that share this anchored node */ 00103 } 00104 trilinear_anode_t; 00105 00106 typedef struct trilinear_dnode_t 00107 { 00108 point_t point; 00109 int32_t type; 00110 int32_t local_anode_id[4]; /* _id[2] is -1 for an edge node */ 00111 } 00112 trilinear_dnode_t; 00113 00114 typedef union trilinear_node_t 00115 { 00116 point_t point; 00117 trilinear_anode_t anchored; 00118 trilinear_dnode_t dangling; 00119 } 00120 trilinear_node_t; 00121 00122 /* *INDENT-OFF* */ 00123 /* define below the smallest integer type that holds these flags */ 00124 typedef enum trilinear_boundary_enum 00125 { 00126 TRILINEAR_BOUNDARY_NONE = 0, 00127 TRILINEAR_BOUNDARY_IS_LEFT = 0x0001, 00128 TRILINEAR_BOUNDARY_IS_RIGHT = 0x0002, 00129 TRILINEAR_BOUNDARY_IS_FRONT = 0x0004, 00130 TRILINEAR_BOUNDARY_IS_BACK = 0x0008, 00131 TRILINEAR_BOUNDARY_IS_BOTTOM = 0x0010, 00132 TRILINEAR_BOUNDARY_IS_TOP = 0x0020, 00133 TRILINEAR_BOUNDARY_IS_EDGE = 0x0040, 00134 TRILINEAR_BOUNDARY_IS_CORNER = 0x0080, 00135 TRILINEAR_BOUNDARY_IS_ORIGIN = 0x0100, 00136 TRILINEAR_BOUNDARY_IS_3EDGE = 0x0200, 00137 TRILINEAR_BOUNDARY_IS_3CORNER = 0x0400, 00138 TRILINEAR_BOUNDARY_IS_PRDCX = 0x0800, 00139 TRILINEAR_BOUNDARY_IS_PRDCY = 0x1000, 00140 TRILINEAR_BOUNDARY_IS_PRDCZ = 0x2000, 00141 00142 TRILINEAR_BOUNDARY_IS_XBC = (TRILINEAR_BOUNDARY_IS_LEFT | 00143 TRILINEAR_BOUNDARY_IS_RIGHT), 00144 TRILINEAR_BOUNDARY_IS_YBC = (TRILINEAR_BOUNDARY_IS_FRONT | 00145 TRILINEAR_BOUNDARY_IS_BACK), 00146 TRILINEAR_BOUNDARY_IS_ZBC = (TRILINEAR_BOUNDARY_IS_BOTTOM | 00147 TRILINEAR_BOUNDARY_IS_TOP), 00148 TRILINEAR_BOUNDARY_IS_FACE = (TRILINEAR_BOUNDARY_IS_XBC | 00149 TRILINEAR_BOUNDARY_IS_YBC | 00150 TRILINEAR_BOUNDARY_IS_ZBC) 00151 } 00152 trilinear_boundary_enum_t; 00153 /* *INDENT-ON* */ 00154 00155 /* this integer is big enough to hold a trilinear_boundary_enum_t */ 00156 typedef uint16_t trilinear_boundary_flag_t; 00157 00167 typedef struct trilinear_element_info2 00168 { 00169 int8_t nanchored, ndangling; 00170 int8_t interior_only, interior_anchors_only; 00171 int8_t corner[8]; 00172 int8_t Qisdirect[8]; 00173 int32_t Qindices[8]; 00174 int64_t Qfvnids[8]; 00175 trilinear_boundary_flag_t Qboundary[8]; 00176 int8_t dQcolumn[8][4]; 00177 } 00178 trilinear_element_info2_t; 00179 00180 typedef struct trilinear_mesh_extra 00181 { 00182 int32_t shared_elem_num; 00183 int32_t *shared_elem_ids; 00184 trilinear_element_info2_t *info2; 00185 } 00186 trilinear_mesh_extra_t; 00187 00191 typedef struct trilinear_mesh_t 00192 { 00193 /* Global mesh statistics */ 00194 int64_t total_elem_num; 00195 int64_t total_node_num; 00196 int64_t total_anode_num; 00197 int64_t total_dnode_num; 00198 00199 /* Local mesh parameters */ 00200 int32_t local_elem_num; /* number of element on this processor */ 00201 int32_t local_node_num; /* number of anchored and dangling nodes */ 00202 00203 /* The first part of the node table contains anchored nodes. The free 00204 variables (anchored nodes) owned by a processor is clustered together 00205 with no holes within the first part of the table. 00206 00207 The second part of the node table contains dangling nodes. */ 00208 00209 int32_t local_anode_num; /* number of anchored nodes */ 00210 int32_t local_onode_num; /* number of owned anchored nodes */ 00211 int32_t local_dnode_num; /* number of dangling nodes */ 00212 00213 int32_t local_owned_offset; /* offset to the first 00214 owned anchored node */ 00215 00216 /* Memory allocated by Octor to hold the trilinear elements and nodes */ 00217 trilinear_elem_t *elem_table; 00218 trilinear_node_t *node_table; 00219 00220 /* Memory allocated for free variable interval table. Has 00221 (groupsize + 1) entries. The last entry records the total 00222 number of free variables plus 1 */ 00223 int64_t *fvnid_count_table; 00224 int64_t *fvnid_interval_table; 00225 int64_t *all_fvnid_start; 00226 00227 /* convenience variables pointing to the node table. 00228 Don't try to free the memory pointed to */ 00229 trilinear_node_t *anode_table; 00230 trilinear_node_t *onode_table; 00231 trilinear_node_t *dnode_table; 00232 00233 /* convenience variables recording the total number of free variables, 00234 the starting id and the ending id. identical on all processors */ 00235 int64_t global_fvnid_num; /* total number of fvnids */ 00236 int64_t global_fvnid_start; /* first global fvnid */ 00237 int64_t global_fvnid_end; /* last global fvnid */ 00238 00239 tick_t bounds[3][2]; 00240 tick_t sizes[3], minsize, maxsize; 00241 double ticksize; 00242 00243 sc_MPI_Comm mpicomm; 00244 int32_t mpisize, mpirank; 00245 int32_t recsize; 00246 00247 /* geometry type and element and node patch ids */ 00248 int8_t gid; 00249 trilinear_mesh_pid_t *elem_pids; 00250 trilinear_mesh_pid_t *node_pids; 00251 00252 /* placeholder pointers */ 00253 void (*destructor) (struct trilinear_mesh_t *); 00254 trilinear_mesh_extra_t *extra_info; 00255 00256 /* this is used in p4est only and must not be touched */ 00257 sc_mempool_t *sharer_pool; /* allocator for node sharers */ 00258 } 00259 trilinear_mesh_t; 00260 00295 typedef struct octor_neighor_t 00296 { 00297 int32_t face_neighbor_eid[6][4]; 00298 } 00299 octor_neighbor_t; 00300 00301 typedef struct phantom_elem_t 00302 { 00303 tick_t lx, ly, lz; 00304 tick_t size; 00305 int32_t owner_procid; /* remote processor id */ 00306 int32_t reid; /* element index on the remote processor */ 00307 } 00308 phantom_elem_t; 00309 00310 typedef struct octor_neighborhood_t 00311 { 00312 int32_t phantom_elem_num; 00313 phantom_elem_t *phantom_elem_table; 00314 00315 octor_neighbor_t *local_elem_neighbor_table; 00316 } 00317 octor_neighborhood_t; 00318 00319 #endif /* !TRILINEAR_MESH_TYPES_H */ 00320 00321 /* 00322 * END verbatim copy of trilinear_mesh_types.h from the Rhea code 00323 */ 00324 00325 SC_EXTERN_C_BEGIN; 00326 00329 trilinear_mesh_t *p8est_trilinear_mesh_new_from_nodes (p8est_t * p8est, 00330 p8est_nodes_t * 00331 nodes); 00332 00335 trilinear_mesh_t *p8est_trilinear_mesh_new_from_lnodes (p8est_t * p8est, 00336 p8est_lnodes_t * 00337 lnodes); 00340 void p8est_trilinear_mesh_destroy (trilinear_mesh_t * mesh); 00341 00342 SC_EXTERN_C_END; 00343 00344 #endif /* !P8EST_TRILINEAR_H */