| 1 |
// @HEADER |
| 2 |
// ***************************************************************************** |
| 3 |
// Pamgen Package |
| 4 |
// |
| 5 |
// Copyright 2004 NTESS and the Pamgen contributors. |
| 6 |
// SPDX-License-Identifier: LGPL-2.1-or-later |
| 7 |
// ***************************************************************************** |
| 8 |
// @HEADER |
| 9 |
|
| 10 |
#include <cstring> |
| 11 |
#include <stdlib.h> |
| 12 |
#include "pamgen_im_exodusII.h" |
| 13 |
#include "pamgen_mesh_specification.h" |
| 14 |
#include <strings.h> |
| 15 |
#include <stdio.h> |
| 16 |
|
| 17 |
|
| 18 |
/*****************************************************************************/ |
| 19 |
int im_ex_get_init (int /* im_exoid */, |
| 20 |
char *title, |
| 21 |
int *num_dim, |
| 22 |
int *num_nodes, |
| 23 |
int *num_elem, |
| 24 |
int *num_elem_blk, |
| 25 |
int *num_node_sets, |
| 26 |
int *num_side_sets) |
| 27 |
/*****************************************************************************/ |
| 28 |
{ |
| 29 |
ms_lt::Mesh_Specification * ms = ms_lt::Mesh_Specification::first_ms_static_storage; |
| 30 |
if(!ms)return -1; |
| 31 |
const std::string tit = ms->Title(); |
| 32 |
strcpy(title,tit.c_str()); |
| 33 |
*num_dim = ms->getMSI(ms_lt::Mesh_Specification::DIM); |
| 34 |
*num_nodes = ms->getMSI(ms_lt::Mesh_Specification::NUM_NODES); |
| 35 |
*num_elem = ms->getMSI(ms_lt::Mesh_Specification::NUM_ELEMENTS); |
| 36 |
*num_elem_blk = ms->getMSI(ms_lt::Mesh_Specification::NUM_BLOCKS); |
| 37 |
*num_node_sets = ms->getMSI(ms_lt::Mesh_Specification::NUM_NODE_SETS); |
| 38 |
*num_side_sets = ms->getMSI(ms_lt::Mesh_Specification::NUM_SIDE_SETS); |
| 39 |
|
| 40 |
return 0; |
| 41 |
} |
| 42 |
|
| 43 |
/*****************************************************************************/ |
| 44 |
int im_ex_inquire (int /* exoid */, |
| 45 |
int req_info, |
| 46 |
int *ret_int, |
| 47 |
float *ret_float, |
| 48 |
char *ret_char) |
| 49 |
/*****************************************************************************/ |
| 50 |
{ |
| 51 |
char errmsg[MAX_ERR_LENGTH]; |
| 52 |
|
| 53 |
ms_lt::Mesh_Specification * ms = ms_lt::Mesh_Specification::first_ms_static_storage; |
| 54 |
if(!ms)return -1; |
| 55 |
|
| 56 |
|
| 57 |
switch (req_info) |
| 58 |
{ |
| 59 |
|
| 60 |
case IM_EX_INQ_API_VERS: |
| 61 |
*ret_float = 0.1; |
| 62 |
break; |
| 63 |
|
| 64 |
case IM_EX_INQ_TITLE: |
| 65 |
{ |
| 66 |
/* returns the title of the database */ |
| 67 |
const std::string tit = ms->Title(); |
| 68 |
strcpy(ret_char,tit.c_str()); |
| 69 |
|
| 70 |
break; |
| 71 |
} |
| 72 |
case IM_EX_INQ_DIM: |
| 73 |
*ret_int = ms->getMSI(ms_lt::Mesh_Specification::DIM); |
| 74 |
|
| 75 |
break; |
| 76 |
|
| 77 |
case IM_EX_INQ_NODES: |
| 78 |
*ret_int = ms->getMSI(ms_lt::Mesh_Specification::NUM_NODES); |
| 79 |
|
| 80 |
break; |
| 81 |
|
| 82 |
case IM_EX_INQ_ELEM: |
| 83 |
*ret_int = ms->getMSI(ms_lt::Mesh_Specification::NUM_ELEMENTS); |
| 84 |
|
| 85 |
break; |
| 86 |
|
| 87 |
case IM_EX_INQ_ELEM_BLK: |
| 88 |
*ret_int = ms->getMSI(ms_lt::Mesh_Specification::NUM_BLOCKS); |
| 89 |
|
| 90 |
break; |
| 91 |
|
| 92 |
case IM_EX_INQ_NODE_SETS: |
| 93 |
*ret_int = ms->getMSI(ms_lt::Mesh_Specification::NUM_NODE_SETS); |
| 94 |
break; |
| 95 |
|
| 96 |
case IM_EX_INQ_NS_NODE_LEN: |
| 97 |
*ret_int = 0; |
| 98 |
/* returns the length of the concatenated node sets node list */ |
| 99 |
break; |
| 100 |
|
| 101 |
case IM_EX_INQ_NS_DF_LEN: |
| 102 |
/* returns the length of the concatenated node sets dist factor list */ |
| 103 |
*ret_int = 0; |
| 104 |
break; |
| 105 |
|
| 106 |
case IM_EX_INQ_SIDE_SETS: |
| 107 |
|
| 108 |
/* returns the number of side sets */ |
| 109 |
*ret_int = ms->getMSI(ms_lt::Mesh_Specification::NUM_SIDE_SETS); |
| 110 |
|
| 111 |
|
| 112 |
break; |
| 113 |
|
| 114 |
case IM_EX_INQ_SS_ELEM_LEN: |
| 115 |
*ret_int = 0; |
| 116 |
break; |
| 117 |
|
| 118 |
case IM_EX_INQ_SS_NODE_LEN: |
| 119 |
*ret_int = ms->getMSI(ms_lt::Mesh_Specification::NUM_SIDE_SET_NODES); |
| 120 |
/* returns the length of the concatenated side sets node list */ |
| 121 |
break; |
| 122 |
|
| 123 |
case IM_EX_INQ_SS_DF_LEN: |
| 124 |
*ret_int = 0; |
| 125 |
/* returns the length of the concatenated side sets df factor */ |
| 126 |
break; |
| 127 |
|
| 128 |
|
| 129 |
case IM_EX_INQ_QA: |
| 130 |
/* returns the number of QA records */ |
| 131 |
*ret_int = ms->getMSI(ms_lt::Mesh_Specification::NUM_QA_RECORDS); |
| 132 |
|
| 133 |
|
| 134 |
break; |
| 135 |
|
| 136 |
case IM_EX_INQ_INFO: |
| 137 |
/* returns the number of information records */ |
| 138 |
*ret_int = ms->getMSI(ms_lt::Mesh_Specification::NUM_INFO_RECORDS); |
| 139 |
|
| 140 |
break; |
| 141 |
|
| 142 |
case IM_EX_INQ_TIME: |
| 143 |
|
| 144 |
return -1; |
| 145 |
break; |
| 146 |
case IM_EX_INQ_EB_PROP: |
| 147 |
/* returns the number of element block properties */ |
| 148 |
*ret_int = 0; |
| 149 |
break; |
| 150 |
|
| 151 |
case IM_EX_INQ_NS_PROP: |
| 152 |
*ret_int = 0; |
| 153 |
/* returns the number of node set properties */ |
| 154 |
break; |
| 155 |
|
| 156 |
case IM_EX_INQ_SS_PROP: |
| 157 |
*ret_int = 0; |
| 158 |
/* returns the number of side set properties */ |
| 159 |
break; |
| 160 |
|
| 161 |
case IM_EX_INQ_ELEM_MAP: |
| 162 |
|
| 163 |
/* returns the number of element maps */ |
| 164 |
return -1; |
| 165 |
|
| 166 |
break; |
| 167 |
|
| 168 |
case IM_EX_INQ_EM_PROP: |
| 169 |
|
| 170 |
/* returns the number of element map properties */ |
| 171 |
return -1; |
| 172 |
break; |
| 173 |
|
| 174 |
case IM_EX_INQ_NODE_MAP: |
| 175 |
|
| 176 |
/* returns the number of node maps */ |
| 177 |
return -1; |
| 178 |
break; |
| 179 |
|
| 180 |
case IM_EX_INQ_NM_PROP: |
| 181 |
/* returns the number of element map properties */ |
| 182 |
return -1; |
| 183 |
break; |
| 184 |
|
| 185 |
default: |
| 186 |
*ret_int = 0; |
| 187 |
sprintf(errmsg, "Error: invalid inquiry %d", req_info); |
| 188 |
return(-1); |
| 189 |
} |
| 190 |
return (0); |
| 191 |
} |
| 192 |
|
| 193 |
/*****************************************************************************/ |
| 194 |
int im_ex_get_coord (int /* exoid */, |
| 195 |
void *x_coor, |
| 196 |
void *y_coor, |
| 197 |
void *z_coor) |
| 198 |
/*****************************************************************************/ |
| 199 |
{ |
| 200 |
ms_lt::Mesh_Specification * ms = ms_lt::Mesh_Specification::first_ms_static_storage; |
| 201 |
if(!ms)return -1; |
| 202 |
|
| 203 |
int num_nds = ms->getMSI(ms_lt::Mesh_Specification::NUM_NODES); |
| 204 |
int dim = ms->getMSI(ms_lt::Mesh_Specification::DIM); |
| 205 |
|
| 206 |
double * x = (double *)x_coor; |
| 207 |
double * y = (double *)y_coor; |
| 208 |
double * z = (double *)z_coor; |
| 209 |
|
| 210 |
const double * the_coords = ms->Coord(); |
| 211 |
for(int i = 0; i < num_nds; i ++){ |
| 212 |
x[i] = the_coords[i]; |
| 213 |
y[i] = the_coords[i+num_nds]; |
| 214 |
if(dim == 3)z[i] = the_coords[i+2*num_nds]; |
| 215 |
} |
| 216 |
|
| 217 |
return 0; |
| 218 |
} |
| 219 |
|
| 220 |
/*****************************************************************************/ |
| 221 |
int im_ex_get_coord_names (int /* exoid */, |
| 222 |
char **coord_names) |
| 223 |
/*****************************************************************************/ |
| 224 |
{ |
| 225 |
ms_lt::Mesh_Specification * ms = ms_lt::Mesh_Specification::first_ms_static_storage; |
| 226 |
if(!ms)return -1; |
| 227 |
|
| 228 |
std::string * cnames = ms->getMSPSA(ms_lt::Mesh_Specification::COORDINATE_NAMES);//ms->Coordinate_Names(); |
| 229 |
int dim = ms->getMSI(ms_lt::Mesh_Specification::DIM); |
| 230 |
if(dim >=1)strcpy(coord_names[0],cnames[0].c_str()); |
| 231 |
if(dim >=2)strcpy(coord_names[1],cnames[1].c_str()); |
| 232 |
if(dim >=3)strcpy(coord_names[2],cnames[2].c_str()); |
| 233 |
|
| 234 |
return 0; |
| 235 |
} |
| 236 |
|
| 237 |
/*****************************************************************************/ |
| 238 |
int im_ex_get_map (int /* exoid */, int *elem_map) |
| 239 |
/*****************************************************************************/ |
| 240 |
{ |
| 241 |
ms_lt::Mesh_Specification * ms = ms_lt::Mesh_Specification::first_ms_static_storage; |
| 242 |
if(!ms)return -1; |
| 243 |
|
| 244 |
const long long * the_map = ms->getMSP(ms_lt::Mesh_Specification::ELEM_ORDER_MAP); |
| 245 |
int num_elem = ms->getMSI(ms_lt::Mesh_Specification::NUM_ELEMENTS); |
| 246 |
for(int i = 0; i < num_elem; i ++)elem_map[i] = the_map[i]; |
| 247 |
|
| 248 |
return 0; |
| 249 |
} |
| 250 |
|
| 251 |
/*****************************************************************************/ |
| 252 |
int im_ex_get_elem_num_map (int /* exoid */, |
| 253 |
int *elem_map) |
| 254 |
/*****************************************************************************/ |
| 255 |
{ |
| 256 |
ms_lt::Mesh_Specification * ms = ms_lt::Mesh_Specification::first_ms_static_storage; |
| 257 |
if(!ms)return -1; |
| 258 |
|
| 259 |
int num_elem = ms->getMSI(ms_lt::Mesh_Specification::NUM_ELEMENTS); |
| 260 |
const long long * gen = ms->getMSP(ms_lt::Mesh_Specification::GLOBAL_ELEMENT_NUMBERS); |
| 261 |
|
| 262 |
for(int i = 0; i < num_elem; i ++)elem_map[i] = gen[i]; |
| 263 |
|
| 264 |
return 0; |
| 265 |
} |
| 266 |
|
| 267 |
/*****************************************************************************/ |
| 268 |
int im_ex_get_node_num_map (int /* exoid */, |
| 269 |
int *node_map) |
| 270 |
/*****************************************************************************/ |
| 271 |
{ |
| 272 |
ms_lt::Mesh_Specification * ms = ms_lt::Mesh_Specification::first_ms_static_storage; |
| 273 |
if(!ms)return -1; |
| 274 |
|
| 275 |
int num_nds = ms->getMSI(ms_lt::Mesh_Specification::NUM_NODES); |
| 276 |
const long long * gnn = ms->getMSP(ms_lt::Mesh_Specification::GLOBAL_NODE_NUMBERS);//Global_Node_Numbers(); |
| 277 |
|
| 278 |
for(int i = 0; i < num_nds; i ++)node_map[i] = gnn[i]; |
| 279 |
|
| 280 |
return 0; |
| 281 |
} |
| 282 |
|
| 283 |
/*****************************************************************************/ |
| 284 |
int im_ex_get_elem_blk_ids (int /* exoid */, int *ids) |
| 285 |
/*****************************************************************************/ |
| 286 |
{ |
| 287 |
ms_lt::Mesh_Specification * ms = ms_lt::Mesh_Specification::first_ms_static_storage; |
| 288 |
if(!ms)return -1; |
| 289 |
|
| 290 |
int nb = ms->getMSI(ms_lt::Mesh_Specification::NUM_BLOCKS); |
| 291 |
const long long * bid_arr = ms->getMSP(ms_lt::Mesh_Specification::BLOCK_ID); |
| 292 |
|
| 293 |
for(int i = 0; i < nb; i ++)ids[i] = bid_arr[i]; |
| 294 |
|
| 295 |
return 0; |
| 296 |
} |
| 297 |
|
| 298 |
/*****************************************************************************/ |
| 299 |
int im_ex_get_elem_block (int /* exoid */, |
| 300 |
int elem_blk_id, |
| 301 |
char *elem_type, |
| 302 |
int *num_elem_this_blk, |
| 303 |
int *num_nodes_per_elem, |
| 304 |
int *num_attr) |
| 305 |
/*****************************************************************************/ |
| 306 |
{ |
| 307 |
ms_lt::Mesh_Specification * ms = ms_lt::Mesh_Specification::first_ms_static_storage; |
| 308 |
if(!ms)return -1; |
| 309 |
|
| 310 |
int nb = ms->getMSI(ms_lt::Mesh_Specification::NUM_BLOCKS); |
| 311 |
const long long * bid_arr = ms->getMSP(ms_lt::Mesh_Specification::BLOCK_ID); |
| 312 |
|
| 313 |
// get the index |
| 314 |
int el_blk_index = -1; |
| 315 |
for(int i = 0; i < nb; i ++)if(elem_blk_id == bid_arr[i])el_blk_index = i; |
| 316 |
if(el_blk_index == -1)return -1; |
| 317 |
|
| 318 |
const std::string * el_typ = ms->getMSPSA(ms_lt::Mesh_Specification::ELEMENT_TYPES); |
| 319 |
strcpy(elem_type,el_typ[el_blk_index].c_str()); |
| 320 |
|
| 321 |
const long long * nbe = ms->getMSP(ms_lt::Mesh_Specification::ELEMENTS_IN_BLOCK); |
| 322 |
*num_elem_this_blk = nbe[el_blk_index]; |
| 323 |
|
| 324 |
const long long * nnpe = ms->getMSP(ms_lt::Mesh_Specification::NODES_PER_ELEMENT); |
| 325 |
*num_nodes_per_elem = nnpe[el_blk_index]; |
| 326 |
|
| 327 |
const long long * natr = ms->getMSP(ms_lt::Mesh_Specification::ELEMENT_ATTRIBUTES); |
| 328 |
*num_attr = natr[el_blk_index]; |
| 329 |
|
| 330 |
return 0; |
| 331 |
} |
| 332 |
|
| 333 |
|
| 334 |
|
| 335 |
// int im_ex_get_elem_attr (int exoid, |
| 336 |
// int elem_blk_id, |
| 337 |
// void *attrib) |
| 338 |
// { |
| 339 |
// ms_lt::Mesh_Specification * ms = ms_lt::Mesh_Specification::first_ms_static_storage; |
| 340 |
// if(!ms)return -1; |
| 341 |
// int nb = ms->getMSI(ms_lt::Mesh_Specification::NUM_BLOCKS); |
| 342 |
|
| 343 |
|
| 344 |
// return 0; |
| 345 |
// } |
| 346 |
|
| 347 |
/*****************************************************************************/ |
| 348 |
int im_ex_get_elem_conn (int /* exoid */, |
| 349 |
int elem_blk_id, |
| 350 |
int *connect) |
| 351 |
/*****************************************************************************/ |
| 352 |
{ |
| 353 |
ms_lt::Mesh_Specification * ms = ms_lt::Mesh_Specification::first_ms_static_storage; |
| 354 |
if(!ms)return -1; |
| 355 |
|
| 356 |
int nb = ms->getMSI(ms_lt::Mesh_Specification::NUM_BLOCKS); |
| 357 |
const long long * bid_arr = ms->getMSP(ms_lt::Mesh_Specification::BLOCK_ID); |
| 358 |
|
| 359 |
// get the index |
| 360 |
int el_blk_index = -1; |
| 361 |
for(int i = 0; i < nb; i ++)if(elem_blk_id == bid_arr[i])el_blk_index = i; |
| 362 |
if(el_blk_index == -1)return -1; |
| 363 |
|
| 364 |
const long long * const * enl = ms->getMSPP(ms_lt::Mesh_Specification::ELMT_NODE_LINKAGE);//Element_Node_Linkage(); |
| 365 |
const long long * nbe = ms->getMSP(ms_lt::Mesh_Specification::ELEMENTS_IN_BLOCK); |
| 366 |
const long long * nnpe_arr = ms->getMSP(ms_lt::Mesh_Specification::NODES_PER_ELEMENT); |
| 367 |
int nnpe = nnpe_arr[el_blk_index]; |
| 368 |
int nel = nbe[el_blk_index]; |
| 369 |
|
| 370 |
for(int i = 0; i < nel*nnpe; i ++)connect[i] = enl[el_blk_index][i]; |
| 371 |
|
| 372 |
return 0; |
| 373 |
} |
| 374 |
|
| 375 |
/*****************************************************************************/ |
| 376 |
int im_ex_get_node_set_ids (int /* exoid */, |
| 377 |
int *ids) |
| 378 |
/*****************************************************************************/ |
| 379 |
{ |
| 380 |
ms_lt::Mesh_Specification * ms = ms_lt::Mesh_Specification::first_ms_static_storage; |
| 381 |
if(!ms)return -1; |
| 382 |
|
| 383 |
int nns = ms->getMSI(ms_lt::Mesh_Specification::NUM_NODE_SETS); |
| 384 |
const long long * ids_arr = ms->getMSP(ms_lt::Mesh_Specification::NODE_SET_ID); |
| 385 |
for(int i = 0; i < nns; i ++)ids[i] = ids_arr[i]; |
| 386 |
|
| 387 |
return 0; |
| 388 |
} |
| 389 |
|
| 390 |
/*****************************************************************************/ |
| 391 |
int get_ss_index(int ssid) |
| 392 |
/*****************************************************************************/ |
| 393 |
{ |
| 394 |
ms_lt::Mesh_Specification * ms = ms_lt::Mesh_Specification::first_ms_static_storage; |
| 395 |
if(!ms)return -1; |
| 396 |
|
| 397 |
int nss = ms->getMSI(ms_lt::Mesh_Specification::NUM_SIDE_SETS); |
| 398 |
const long long * ids_arr = ms->getMSP(ms_lt::Mesh_Specification::SIDE_SET_ID); |
| 399 |
for(int i = 0; i < nss; i ++) |
| 400 |
if(ssid == ids_arr[i]) |
| 401 |
return i; |
| 402 |
|
| 403 |
return -1; |
| 404 |
} |
| 405 |
|
| 406 |
/*****************************************************************************/ |
| 407 |
int get_ns_index(int nsid) |
| 408 |
/*****************************************************************************/ |
| 409 |
{ |
| 410 |
ms_lt::Mesh_Specification * ms = ms_lt::Mesh_Specification::first_ms_static_storage; |
| 411 |
if(!ms)return -1; |
| 412 |
|
| 413 |
int nns = ms->getMSI(ms_lt::Mesh_Specification::NUM_NODE_SETS); |
| 414 |
const long long * ids_arr = ms->getMSP(ms_lt::Mesh_Specification::NODE_SET_ID); |
| 415 |
for(int i = 0; i < nns; i ++) |
| 416 |
if(nsid == ids_arr[i]) |
| 417 |
return i; |
| 418 |
|
| 419 |
return -1; |
| 420 |
} |
| 421 |
|
| 422 |
/*****************************************************************************/ |
| 423 |
int im_ex_get_side_set_ids (int /* exoid */, |
| 424 |
int *ids) |
| 425 |
/*****************************************************************************/ |
| 426 |
{ |
| 427 |
ms_lt::Mesh_Specification * ms = ms_lt::Mesh_Specification::first_ms_static_storage; |
| 428 |
if(!ms)return -1; |
| 429 |
int nss = ms->getMSI(ms_lt::Mesh_Specification::NUM_SIDE_SETS); |
| 430 |
|
| 431 |
const long long * ids_arr = ms->getMSP(ms_lt::Mesh_Specification::SIDE_SET_ID); |
| 432 |
for(int i = 0; i < nss; i ++)ids[i] = ids_arr[i]; |
| 433 |
return 0; |
| 434 |
} |
| 435 |
|
| 436 |
/*****************************************************************************/ |
| 437 |
int im_ex_get_node_set_param (int /* exoid */, |
| 438 |
int node_set_id, |
| 439 |
int * num_nodes_in_set, |
| 440 |
int * num_dist_in_set) |
| 441 |
/*****************************************************************************/ |
| 442 |
{ |
| 443 |
ms_lt::Mesh_Specification * ms = ms_lt::Mesh_Specification::first_ms_static_storage; |
| 444 |
if(!ms)return -1; |
| 445 |
|
| 446 |
int ns_index = get_ns_index(node_set_id); |
| 447 |
if(ns_index == -1)return -1; |
| 448 |
|
| 449 |
const long long * nn_in_set = ms->getMSP(ms_lt::Mesh_Specification::NUM_NODES_IN_NODE_SET); |
| 450 |
*num_nodes_in_set = nn_in_set[ns_index]; |
| 451 |
|
| 452 |
const long long * nn_df_in_set = ms->getMSP(ms_lt::Mesh_Specification::NUM_DF_IN_NODE_SET); |
| 453 |
*num_dist_in_set = nn_df_in_set[ns_index]; |
| 454 |
|
| 455 |
return 0; |
| 456 |
} |
| 457 |
|
| 458 |
/*****************************************************************************/ |
| 459 |
int im_ex_get_side_set_param (int /* exoid */, |
| 460 |
int side_set_id, |
| 461 |
int * num_side_in_set, |
| 462 |
int * num_dist_in_set) |
| 463 |
/*****************************************************************************/ |
| 464 |
{ |
| 465 |
ms_lt::Mesh_Specification * ms = ms_lt::Mesh_Specification::first_ms_static_storage; |
| 466 |
if(!ms)return -1; |
| 467 |
|
| 468 |
int ss_index = get_ss_index(side_set_id); |
| 469 |
if(ss_index == -1)return -1; |
| 470 |
|
| 471 |
const long long * ns_in_set = ms->getMSP(ms_lt::Mesh_Specification::NUM_ELEMENTS_IN_SIDE_SET); |
| 472 |
*num_side_in_set = ns_in_set[ss_index]; |
| 473 |
|
| 474 |
const long long * ss_df_in_set = ms->getMSP(ms_lt::Mesh_Specification::NUM_DF_IN_SIDE_SET); |
| 475 |
*num_dist_in_set = ss_df_in_set[ss_index]; |
| 476 |
|
| 477 |
return 0; |
| 478 |
} |
| 479 |
|
| 480 |
/*****************************************************************************/ |
| 481 |
int im_ex_get_node_set (int /* exoid */, |
| 482 |
int node_set_id, |
| 483 |
int *node_set_node_list) |
| 484 |
/*****************************************************************************/ |
| 485 |
{ |
| 486 |
ms_lt::Mesh_Specification * ms = ms_lt::Mesh_Specification::first_ms_static_storage; |
| 487 |
if(!ms)return -1; |
| 488 |
|
| 489 |
int ns_index = get_ns_index(node_set_id); |
| 490 |
if(ns_index == -1)return -1; |
| 491 |
|
| 492 |
const long long * nn_in_set = ms->getMSP(ms_lt::Mesh_Specification::NUM_NODES_IN_NODE_SET); |
| 493 |
int num_nds_in_set = nn_in_set[ns_index]; |
| 494 |
|
| 495 |
const long long * const * ns_arr = ms->getMSPP(ms_lt::Mesh_Specification::NODE_SET_NODES);//Node_Set_Nodes(); |
| 496 |
for(int i = 0; i < num_nds_in_set; i ++)node_set_node_list[i] = ns_arr[ns_index][i]; |
| 497 |
|
| 498 |
return 0; |
| 499 |
} |
| 500 |
|
| 501 |
/*****************************************************************************/ |
| 502 |
int im_ex_get_side_set (int /* exoid */, |
| 503 |
int side_set_id, |
| 504 |
int *side_set_elem_list, |
| 505 |
int *side_set_side_list) |
| 506 |
/*****************************************************************************/ |
| 507 |
{ |
| 508 |
ms_lt::Mesh_Specification * ms = ms_lt::Mesh_Specification::first_ms_static_storage; |
| 509 |
if(!ms)return -1; |
| 510 |
|
| 511 |
int ss_index = get_ss_index(side_set_id); |
| 512 |
if(ss_index == -1)return -1; |
| 513 |
|
| 514 |
const long long * ne_in_set = ms->getMSP(ms_lt::Mesh_Specification::NUM_ELEMENTS_IN_SIDE_SET); |
| 515 |
int num_fcs_in_set = ne_in_set[ss_index]; |
| 516 |
|
| 517 |
const long long * const * ss_arr = ms->getMSPP(ms_lt::Mesh_Specification::SIDE_SET_ELEMENTS); |
| 518 |
for(int i = 0; i < num_fcs_in_set; i ++)side_set_elem_list[i] = ss_arr[ss_index][i]; |
| 519 |
|
| 520 |
const long long * const * ssf_arr = ms->getMSPP(ms_lt::Mesh_Specification::SIDE_SET_FACES); |
| 521 |
for(int i = 0; i < num_fcs_in_set; i ++)side_set_side_list[i] = ssf_arr[ss_index][i]; |
| 522 |
|
| 523 |
return 0; |
| 524 |
} |
| 525 |
|
| 526 |
/*****************************************************************************/ |
| 527 |
int im_ex_get_side_set_node_list(int /* exoid */, |
| 528 |
int side_set_id, |
| 529 |
int *side_set_node_cnt_list, |
| 530 |
int *side_set_node_list) |
| 531 |
/*****************************************************************************/ |
| 532 |
{ |
| 533 |
ms_lt::Mesh_Specification * ms = ms_lt::Mesh_Specification::first_ms_static_storage; |
| 534 |
if(!ms)return -1; |
| 535 |
|
| 536 |
int ss_index = get_ss_index(side_set_id); |
| 537 |
if(ss_index == -1)return -1; |
| 538 |
|
| 539 |
const long long * ne_in_set = ms->getMSP(ms_lt::Mesh_Specification::NUM_ELEMENTS_IN_SIDE_SET); |
| 540 |
int num_fcs_in_set = ne_in_set[ss_index]; |
| 541 |
|
| 542 |
const long long * const * ssnc = ms->getMSPP(ms_lt::Mesh_Specification::SIDE_SET_NODE_COUNTER); |
| 543 |
for(int i = 0; i < num_fcs_in_set; i ++)side_set_node_cnt_list[i] = ssnc[ss_index][i]; |
| 544 |
|
| 545 |
const long long * nn_in_sset = ms->getMSP(ms_lt::Mesh_Specification::NUM_NODES_IN_SIDE_SET); |
| 546 |
int nn = nn_in_sset[ss_index]; |
| 547 |
|
| 548 |
const long long * const * ssn = ms->getMSPP(ms_lt::Mesh_Specification::SIDE_SET_NODES); |
| 549 |
for(int i = 0; i < nn; i ++)side_set_node_list[i] = ssn[ss_index][i]; |
| 550 |
|
| 551 |
return 0; |
| 552 |
} |
| 553 |
|
| 554 |
/*****************************************************************************/ |
| 555 |
int im_ex_get_qa (int /* exoid */, |
| 556 |
char *qa_record[][4]) |
| 557 |
/*****************************************************************************/ |
| 558 |
{ |
| 559 |
ms_lt::Mesh_Specification * ms = ms_lt::Mesh_Specification::first_ms_static_storage; |
| 560 |
if(!ms)return -1; |
| 561 |
|
| 562 |
int num_qa = ms->getMSI(ms_lt::Mesh_Specification::NUM_QA_RECORDS); |
| 563 |
|
| 564 |
typedef std::string QA_Record[4]; |
| 565 |
|
| 566 |
const QA_Record * qa_recs = ms->QA_Records(); |
| 567 |
|
| 568 |
for(int i = 0; i < num_qa; i++){ |
| 569 |
for(int j = 0; j < 4; j++){ |
| 570 |
strcpy(qa_record[i][j],qa_recs[i][j].c_str()); |
| 571 |
} |
| 572 |
} |
| 573 |
|
| 574 |
return 0; |
| 575 |
} |
| 576 |
|
| 577 |
/*****************************************************************************/ |
| 578 |
int im_ex_get_info (int /* exoid */, char **info) |
| 579 |
/*****************************************************************************/ |
| 580 |
{ |
| 581 |
ms_lt::Mesh_Specification * ms = ms_lt::Mesh_Specification::first_ms_static_storage; |
| 582 |
if(!ms)return -1; |
| 583 |
|
| 584 |
int num_info = ms->getMSI(ms_lt::Mesh_Specification::NUM_INFO_RECORDS); |
| 585 |
const std::string * info_strings = ms->getMSPSA(ms_lt::Mesh_Specification::INFO_STRINGS); |
| 586 |
|
| 587 |
for(int i = 0; i < num_info; i ++){ |
| 588 |
strcpy(info[i],info_strings[i].c_str()); |
| 589 |
} |
| 590 |
|
| 591 |
|
| 592 |
return 0; |
| 593 |
} |
| 594 |
/*****************************************************************************/ |
| 595 |
int im_ex_get_elem_blk_parent_mesh (int /* exoid */, int *ids) |
| 596 |
/*****************************************************************************/ |
| 597 |
{ |
| 598 |
ms_lt::Mesh_Specification * ms = ms_lt::Mesh_Specification::first_ms_static_storage; |
| 599 |
if(!ms)return -1; |
| 600 |
|
| 601 |
int nb = ms->getMSI(ms_lt::Mesh_Specification::NUM_BLOCKS); |
| 602 |
const long long * bid_arr = ms->getMSP(ms_lt::Mesh_Specification::BLOCK_PARENT_MESHES); |
| 603 |
|
| 604 |
for(int i = 0; i < nb; i ++)ids[i] = bid_arr[i]; |
| 605 |
|
| 606 |
return 0; |
| 607 |
} |
| 608 |
|
| 609 |
/*****************************************************************************/ |
| 610 |
int im_ex_get_ns_parent_mesh (int /* exoid */, int *ids) |
| 611 |
/*****************************************************************************/ |
| 612 |
{ |
| 613 |
ms_lt::Mesh_Specification * ms = ms_lt::Mesh_Specification::first_ms_static_storage; |
| 614 |
if(!ms)return -1; |
| 615 |
|
| 616 |
int nb = ms->getMSI(ms_lt::Mesh_Specification::NUM_NODE_SETS); |
| 617 |
const long long * bid_arr = ms->getMSP(ms_lt::Mesh_Specification::NODESET_PARENT_MESHES); |
| 618 |
|
| 619 |
for(int i = 0; i < nb; i ++)ids[i] = bid_arr[i]; |
| 620 |
|
| 621 |
return 0; |
| 622 |
} |
| 623 |
/*****************************************************************************/ |
| 624 |
int im_ex_get_ss_parent_mesh (int /* exoid */, int *ids) |
| 625 |
/*****************************************************************************/ |
| 626 |
{ |
| 627 |
ms_lt::Mesh_Specification * ms = ms_lt::Mesh_Specification::first_ms_static_storage; |
| 628 |
if(!ms)return -1; |
| 629 |
|
| 630 |
int nb = ms->getMSI(ms_lt::Mesh_Specification::NUM_SIDE_SETS); |
| 631 |
const long long * bid_arr = ms->getMSP(ms_lt::Mesh_Specification::SIDESET_PARENT_MESHES); |
| 632 |
|
| 633 |
for(int i = 0; i < nb; i ++)ids[i] = bid_arr[i]; |
| 634 |
|
| 635 |
return 0; |
| 636 |
} |