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