PageRenderTime 93ms CodeModel.GetById 32ms RepoModel.GetById 0ms app.codeStats 0ms

/contrib/exodusii/5.22b/exodus/cbind/test/testwt_ss.c

https://bitbucket.org/vijaysm/libmesh
C | 835 lines | 414 code | 151 blank | 270 comment | 24 complexity | 838ecf97d41fa0753816aa31af244c12 MD5 | raw file
Possible License(s): LGPL-2.1, BSD-3-Clause, GPL-3.0, MPL-2.0-no-copyleft-exception, GPL-2.0
  1. /*
  2. * Copyright (c) 2005 Sandia Corporation. Under the terms of Contract
  3. * DE-AC04-94AL85000 with Sandia Corporation, the U.S. Governement
  4. * retains certain rights in this software.
  5. *
  6. * Redistribution and use in source and binary forms, with or without
  7. * modification, are permitted provided that the following conditions are
  8. * met:
  9. *
  10. * * Redistributions of source code must retain the above copyright
  11. * notice, this list of conditions and the following disclaimer.
  12. *
  13. * * Redistributions in binary form must reproduce the above
  14. * copyright notice, this list of conditions and the following
  15. * disclaimer in the documentation and/or other materials provided
  16. * with the distribution.
  17. *
  18. * * Neither the name of Sandia Corporation nor the names of its
  19. * contributors may be used to endorse or promote products derived
  20. * from this software without specific prior written permission.
  21. *
  22. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  23. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  24. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  25. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  26. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  27. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  28. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  29. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  30. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  31. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  32. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  33. *
  34. */
  35. /*****************************************************************************
  36. *
  37. * testwt_ss - test write an ExodusII database file
  38. *
  39. * author - Sandia National Laboratories
  40. * Larry A. Schoof - Original
  41. * Vic Yarberry - Added headers and error logging
  42. * 7/7/93 Modified for use with Exodus 2.00
  43. *
  44. *
  45. * environment - UNIX
  46. *
  47. * entry conditions -
  48. *
  49. * exit conditions -
  50. *
  51. * revision history -
  52. *
  53. * This is a test program for the C binding of the EXODUS II
  54. * database write routines.
  55. *
  56. *
  57. *****************************************************************************/
  58. #include <stdlib.h>
  59. #include <stdio.h>
  60. /* #include "netcdf.h" */
  61. #include "exodusII.h"
  62. int main (int argc, char **argv)
  63. {
  64. int exoid, num_dim, num_nodes, num_elem, num_elem_blk;
  65. int num_elem_in_block[10], num_nodes_per_elem[10];
  66. int num_node_sets, num_side_sets, error;
  67. int *connect;
  68. int node_list[100],elem_list[100],side_list[100];
  69. int ebids[10], ids[10];
  70. int num_nodes_per_set[10], num_elem_per_set[10];
  71. int num_df_per_set[10];
  72. int df_ind[10], node_ind[10], elem_ind[10];
  73. int num_qa_rec, num_info;
  74. int CPU_word_size,IO_word_size;
  75. float x[100], y[100], z[100];
  76. float dist_fact[100];
  77. char *coord_names[3], *qa_record[2][4], *info[3];
  78. ex_opts (EX_VERBOSE|EX_ABORT);
  79. /* Specify compute and i/o word size */
  80. CPU_word_size = 0; /* sizeof(float) */
  81. IO_word_size = 4; /* (4 bytes) */
  82. /* create EXODUS II file */
  83. exoid = ex_create ("test.exo", /* filename path */
  84. EX_CLOBBER, /* create mode */
  85. &CPU_word_size, /* CPU float word size in bytes */
  86. &IO_word_size); /* I/O float word size in bytes */
  87. printf ("after ex_create for test.exo, exoid = %d\n", exoid);
  88. printf (" cpu word size: %d io word size: %d\n",CPU_word_size,IO_word_size);
  89. /* ncopts = NC_VERBOSE; */
  90. /* initialize file with parameters */
  91. num_dim = 3;
  92. num_nodes = 33;
  93. num_elem = 8;
  94. num_elem_blk = 8;
  95. num_node_sets = 2;
  96. num_side_sets = 9;
  97. error = ex_put_init (exoid, "This is a test", num_dim, num_nodes, num_elem,
  98. num_elem_blk, num_node_sets, num_side_sets);
  99. printf ("after ex_put_init, error = %d\n", error);
  100. if (error) {
  101. ex_close (exoid);
  102. exit(-1);
  103. }
  104. /* write nodal coordinates values and names to database */
  105. /* Quad #1 */
  106. x[0] = 0.0; y[0] = 0.0; z[0] = 0.0;
  107. x[1] = 1.0; y[1] = 0.0; z[1] = 0.0;
  108. x[2] = 1.0; y[2] = 1.0; z[2] = 0.0;
  109. x[3] = 0.0; y[3] = 1.0; z[3] = 0.0;
  110. /* Quad #2 */
  111. x[4] = 1.0; y[4] = 0.0; z[4] = 0.0;
  112. x[5] = 2.0; y[5] = 0.0; z[5] = 0.0;
  113. x[6] = 2.0; y[6] = 1.0; z[6] = 0.0;
  114. x[7] = 1.0; y[7] = 1.0; z[7] = 0.0;
  115. /* Hex #1 */
  116. x[8] = 0.0; y[8] = 0.0; z[8] = 0.0;
  117. x[9] = 10.0; y[9] = 0.0; z[9] = 0.0;
  118. x[10] = 10.0; y[10] = 0.0; z[10] =-10.0;
  119. x[11] = 1.0; y[11] = 0.0; z[11] =-10.0;
  120. x[12] = 1.0; y[12] = 10.0; z[12] = 0.0;
  121. x[13] = 10.0; y[13] = 10.0; z[13] = 0.0;
  122. x[14] = 10.0; y[14] = 10.0; z[14] =-10.0;
  123. x[15] = 1.0; y[15] = 10.0; z[15] =-10.0;
  124. /* Tetra #1 */
  125. x[16] = 0.0; y[16] = 0.0; z[16] = 0.0;
  126. x[17] = 1.0; y[17] = 0.0; z[17] = 5.0;
  127. x[18] = 10.0; y[18] = 0.0; z[18] = 2.0;
  128. x[19] = 7.0; y[19] = 5.0; z[19] = 3.0;
  129. /* Wedge #1 */
  130. x[20] = 3.0; y[20] = 0.0; z[20] = 6.0;
  131. x[21] = 6.0; y[21] = 0.0; z[21] = 0.0;
  132. x[22] = 0.0; y[22] = 0.0; z[22] = 0.0;
  133. x[23] = 3.0; y[23] = 2.0; z[23] = 6.0;
  134. x[24] = 6.0; y[24] = 2.0; z[24] = 2.0;
  135. x[25] = 0.0; y[25] = 2.0; z[25] = 0.0;
  136. /* Tetra #2 */
  137. x[26] = 2.7; y[26] = 1.7; z[26] = 2.7;
  138. x[27] = 6.0; y[27] = 1.7; z[27] = 3.3;
  139. x[28] = 5.7; y[28] = 1.7; z[28] = 1.7;
  140. x[29] = 3.7; y[29] = 0.0; z[29] = 2.3;
  141. /* TriShell #1 */
  142. x[30] = 2.7; y[30] = 1.7; z[30] = 2.7;
  143. x[31] = 6.0; y[31] = 1.7; z[31] = 3.3;
  144. x[32] = 5.7; y[32] = 1.7; z[32] = 1.7;
  145. error = ex_put_coord (exoid, x, y, z);
  146. printf ("after ex_put_coord, error = %d\n", error);
  147. if (error) {
  148. ex_close (exoid);
  149. exit(-1);
  150. }
  151. coord_names[0] = "xcoor";
  152. coord_names[1] = "ycoor";
  153. coord_names[2] = "zcoor";
  154. error = ex_put_coord_names (exoid, coord_names);
  155. printf ("after ex_put_coord_names, error = %d\n", error);
  156. if (error) {
  157. ex_close (exoid);
  158. exit(-1);
  159. }
  160. /* write element block parameters */
  161. num_elem_in_block[0] = 1;
  162. num_elem_in_block[1] = 1;
  163. num_elem_in_block[2] = 1;
  164. num_elem_in_block[3] = 1;
  165. num_elem_in_block[4] = 1;
  166. num_elem_in_block[5] = 1;
  167. num_elem_in_block[6] = 1;
  168. num_elem_in_block[7] = 1;
  169. num_nodes_per_elem[0] = 4; /* elements in block #1 are 4-node quads */
  170. num_nodes_per_elem[1] = 4; /* elements in block #2 are 4-node quads */
  171. num_nodes_per_elem[2] = 8; /* elements in block #3 are 8-node hexes */
  172. num_nodes_per_elem[3] = 4; /* elements in block #4 are 4-node tetras */
  173. num_nodes_per_elem[4] = 6; /* elements in block #5 are 6-node wedges */
  174. num_nodes_per_elem[5] = 8; /* elements in block #6 are 8-node tetras */
  175. num_nodes_per_elem[6] = 4; /* elements in block #7 are 4-node shells */
  176. num_nodes_per_elem[7] = 3; /* elements in block #8 are 3-node shells */
  177. ebids[0] = 10;
  178. ebids[1] = 11;
  179. ebids[2] = 12;
  180. ebids[3] = 13;
  181. ebids[4] = 14;
  182. ebids[5] = 15;
  183. ebids[6] = 16;
  184. ebids[7] = 17;
  185. error = ex_put_elem_block (exoid, ebids[0], "quad", num_elem_in_block[0],
  186. num_nodes_per_elem[0], 1);
  187. printf ("after ex_put_elem_block, error = %d\n", error);
  188. if (error) {
  189. ex_close (exoid);
  190. exit(-1);
  191. }
  192. error = ex_put_elem_block (exoid, ebids[1], "quad", num_elem_in_block[1],
  193. num_nodes_per_elem[1], 1);
  194. printf ("after ex_put_elem_block, error = %d\n", error);
  195. if (error) {
  196. ex_close (exoid);
  197. exit(-1);
  198. }
  199. error = ex_put_elem_block (exoid, ebids[2], "hex", num_elem_in_block[2],
  200. num_nodes_per_elem[2], 1);
  201. printf ("after ex_put_elem_block, error = %d\n", error);
  202. if (error) {
  203. ex_close (exoid);
  204. exit(-1);
  205. }
  206. error = ex_put_elem_block (exoid, ebids[3], "tetra", num_elem_in_block[3],
  207. num_nodes_per_elem[3], 1);
  208. printf ("after ex_put_elem_block, error = %d\n", error);
  209. if (error) {
  210. ex_close (exoid);
  211. exit(-1);
  212. }
  213. error = ex_put_elem_block (exoid, ebids[4], "wedge", num_elem_in_block[4],
  214. num_nodes_per_elem[4], 1);
  215. printf ("after ex_put_elem_block, error = %d\n", error);
  216. if (error) {
  217. ex_close (exoid);
  218. exit(-1);
  219. }
  220. error = ex_put_elem_block (exoid, ebids[5], "tetra", num_elem_in_block[5],
  221. num_nodes_per_elem[5], 1);
  222. printf ("after ex_put_elem_block, error = %d\n", error);
  223. if (error) {
  224. ex_close (exoid);
  225. exit(-1);
  226. }
  227. error = ex_put_elem_block (exoid, ebids[6], "shell", num_elem_in_block[6],
  228. num_nodes_per_elem[6], 1);
  229. printf ("after ex_put_elem_block, error = %d\n", error);
  230. if (error) {
  231. ex_close (exoid);
  232. exit(-1);
  233. }
  234. error = ex_put_elem_block (exoid, ebids[7], "triangle",
  235. num_elem_in_block[7], num_nodes_per_elem[7], 1);
  236. printf ("after ex_put_elem_block, error = %d\n", error);
  237. if (error) {
  238. ex_close (exoid);
  239. exit(-1);
  240. }
  241. /* write element connectivity */
  242. connect = (int *) calloc(8, sizeof(int));
  243. connect[0] = 1; connect[1] = 2; connect[2] = 3; connect[3] = 4;
  244. error = ex_put_elem_conn (exoid, ebids[0], connect);
  245. printf ("after ex_put_elem_conn, error = %d\n", error);
  246. if (error) {
  247. ex_close (exoid);
  248. exit(-1);
  249. }
  250. connect[0] = 5; connect[1] = 6; connect[2] = 7; connect[3] = 8;
  251. error = ex_put_elem_conn (exoid, ebids[1], connect);
  252. printf ("after ex_put_elem_conn, error = %d\n", error);
  253. if (error) {
  254. ex_close (exoid);
  255. exit(-1);
  256. }
  257. connect[0] = 9; connect[1] = 10; connect[2] = 11; connect[3] = 12;
  258. connect[4] = 13; connect[5] = 14; connect[6] = 15; connect[7] = 16;
  259. error = ex_put_elem_conn (exoid, ebids[2], connect);
  260. printf ("after ex_put_elem_conn, error = %d\n", error);
  261. if (error) {
  262. ex_close (exoid);
  263. exit(-1);
  264. }
  265. connect[0] = 17; connect[1] = 18; connect[2] = 19; connect[3] = 20;
  266. error = ex_put_elem_conn (exoid, ebids[3], connect);
  267. printf ("after ex_put_elem_conn, error = %d\n", error);
  268. if (error) {
  269. ex_close (exoid);
  270. exit(-1);
  271. }
  272. connect[0] = 21; connect[1] = 22; connect[2] = 23;
  273. connect[3] = 24; connect[4] = 25; connect[5] = 26;
  274. error = ex_put_elem_conn (exoid, ebids[4], connect);
  275. printf ("after ex_put_elem_conn, error = %d\n", error);
  276. if (error) {
  277. ex_close (exoid);
  278. exit(-1);
  279. }
  280. connect[0] = 17; connect[1] = 18; connect[2] = 19; connect[3] = 20;
  281. connect[4] = 27; connect[5] = 28; connect[6] = 30; connect[7] = 29;
  282. error = ex_put_elem_conn (exoid, ebids[5], connect);
  283. printf ("after ex_put_elem_conn, error = %d\n", error);
  284. if (error) {
  285. ex_close (exoid);
  286. exit(-1);
  287. }
  288. connect[0] = 1; connect[1] = 2; connect[2] = 3; connect[3] = 4;
  289. error = ex_put_elem_conn (exoid, ebids[6], connect);
  290. printf ("after ex_put_elem_conn, error = %d\n", error);
  291. if (error) {
  292. ex_close (exoid);
  293. exit(-1);
  294. }
  295. connect[0] = 30; connect[1] = 31; connect[2] = 32;
  296. error = ex_put_elem_conn (exoid, ebids[7], connect);
  297. printf ("after ex_put_elem_conn, error = %d\n", error);
  298. if (error) {
  299. ex_close (exoid);
  300. exit(-1);
  301. }
  302. free (connect);
  303. /* write individual side sets */
  304. /* side set #1 - quad */
  305. /* THIS SECTION IS COMMENTED OUT
  306. error = ex_put_side_set_param (exoid, 30, 2, 4);
  307. printf ("after ex_put_side_set_param, error = %d\n", error);
  308. if (error) {
  309. ex_close (exoid);
  310. exit(-1);
  311. }
  312. elem_list[0] = 2; elem_list[1] = 2;
  313. side_list[0] = 4; side_list[1] = 2;
  314. dist_fact[0] = 30.0; dist_fact[1] = 30.1; dist_fact[2] = 30.2;
  315. dist_fact[3] = 30.3;
  316. error = ex_put_side_set (exoid, 30, elem_list, side_list);
  317. printf ("after ex_put_side_set, error = %d\n", error);
  318. if (error) {
  319. ex_close (exoid);
  320. exit(-1);
  321. }
  322. error = ex_put_side_set_dist_fact (exoid, 30, dist_fact);
  323. printf ("after ex_put_side_set_dist_fact, error = %d\n", error);
  324. if (error) {
  325. ex_close (exoid);
  326. exit(-1);
  327. }
  328. END COMMENTED OUT SECTION */
  329. /* side set #2 - quad, spanning 2 elements */
  330. /* THIS SECTION IS COMMENTED OUT
  331. error = ex_put_side_set_param (exoid, 31, 2, 4);
  332. printf ("after ex_put_side_set_param, error = %d\n", error);
  333. if (error) {
  334. ex_close (exoid);
  335. exit(-1);
  336. }
  337. elem_list[0] = 1; elem_list[1] = 2;
  338. side_list[0] = 2; side_list[1] = 3;
  339. dist_fact[0] = 31.0; dist_fact[1] = 31.1; dist_fact[2] = 31.2;
  340. dist_fact[3] = 31.3;
  341. error = ex_put_side_set (exoid, 31, elem_list, side_list);
  342. printf ("after ex_put_side_set, error = %d\n", error);
  343. if (error) {
  344. ex_close (exoid);
  345. exit(-1);
  346. }
  347. error = ex_put_side_set_dist_fact (exoid, 31, dist_fact);
  348. printf ("after ex_put_side_set_dist_fact, error = %d\n", error);
  349. if (error) {
  350. ex_close (exoid);
  351. exit(-1);
  352. }
  353. END COMMENTED OUT SECTION */
  354. /* side set #3 - hex */
  355. /* THIS SECTION IS COMMENTED OUT
  356. error = ex_put_side_set_param (exoid, 32, 7, 0);
  357. printf ("after ex_put_side_set_param, error = %d\n", error);
  358. if (error) {
  359. ex_close (exoid);
  360. exit(-1);
  361. }
  362. elem_list[0] = 3; elem_list[1] = 3;
  363. elem_list[2] = 3; elem_list[3] = 3;
  364. elem_list[4] = 3; elem_list[5] = 3;
  365. elem_list[6] = 3;
  366. side_list[0] = 5; side_list[1] = 3;
  367. side_list[2] = 3; side_list[3] = 2;
  368. side_list[4] = 4; side_list[5] = 1;
  369. side_list[6] = 6;
  370. error = ex_put_side_set (exoid, 32, elem_list, side_list);
  371. printf ("after ex_put_side_set, error = %d\n", error);
  372. if (error) {
  373. ex_close (exoid);
  374. exit(-1);
  375. }
  376. END COMMENTED OUT SECTION */
  377. /* side set #4 - 4-node tetras */
  378. /* THIS SECTION IS COMMENTED OUT
  379. error = ex_put_side_set_param (exoid, 33, 4, 0);
  380. printf ("after ex_put_side_set_param, error = %d\n", error);
  381. if (error) {
  382. ex_close (exoid);
  383. exit(-1);
  384. }
  385. elem_list[0] = 4; elem_list[1] = 4;
  386. elem_list[2] = 4; elem_list[3] = 4;
  387. side_list[0] = 1; side_list[1] = 2;
  388. side_list[2] = 3; side_list[3] = 4;
  389. error = ex_put_side_set (exoid, 33, elem_list, side_list);
  390. printf ("after ex_put_side_set, error = %d\n", error);
  391. if (error) {
  392. ex_close (exoid);
  393. exit(-1);
  394. }
  395. END COMMENTED OUT SECTION */
  396. /* side set #5 - shells; front and back faces */
  397. /* THIS SECTION IS COMMENTED OUT
  398. error = ex_put_side_set_param (exoid, 34, 2, 0);
  399. printf ("after ex_put_side_set_param, error = %d\n", error);
  400. if (error) {
  401. ex_close (exoid);
  402. exit(-1);
  403. }
  404. elem_list[0] = 7; elem_list[1] = 7;
  405. side_list[0] = 1; side_list[1] = 2;
  406. error = ex_put_side_set (exoid, 34, elem_list, side_list);
  407. printf ("after ex_put_side_set, error = %d\n", error);
  408. if (error) {
  409. ex_close (exoid);
  410. exit(-1);
  411. }
  412. END COMMENTED OUT SECTION */
  413. /* side set #6 - shells; edges */
  414. /* THIS SECTION IS COMMENTED OUT
  415. error = ex_put_side_set_param (exoid, 35, 4, 0);
  416. printf ("after ex_put_side_set_param, error = %d\n", error);
  417. if (error) {
  418. ex_close (exoid);
  419. exit(-1);
  420. }
  421. elem_list[0] = 7; elem_list[1] = 7;
  422. elem_list[2] = 7; elem_list[3] = 7;
  423. side_list[0] = 3; side_list[1] = 4;
  424. side_list[2] = 5; side_list[3] = 6;
  425. error = ex_put_side_set (exoid, 35, elem_list, side_list);
  426. printf ("after ex_put_side_set, error = %d\n", error);
  427. if (error) {
  428. ex_close (exoid);
  429. exit(-1);
  430. }
  431. END COMMENTED OUT SECTION */
  432. /* write concatenated side sets; this produces the same information as
  433. * the above code which writes individual side sets
  434. */
  435. ids[0] = 30;
  436. ids[1] = 31;
  437. ids[2] = 32;
  438. ids[3] = 33;
  439. ids[4] = 34;
  440. ids[5] = 35;
  441. ids[6] = 36;
  442. ids[7] = 37;
  443. ids[8] = 38;
  444. /* side set #1 - NULL side set */
  445. /* do nothing except set num_elem_per_set to 0 */
  446. /* side set #2 - NULL side set */
  447. /* do nothing except set num_elem_per_set to 0 */
  448. /* side set #3 - quad; 2 sides */
  449. node_list[0] = 8; node_list[1] = 5;
  450. elem_list[0] = 2;
  451. node_list[2] = 6; node_list[3] = 7;
  452. elem_list[1] = 2;
  453. /* side set #4 - quad; 2 sides spanning 2 elements */
  454. node_list[4] = 2; node_list[5] = 3;
  455. elem_list[2] = 1;
  456. node_list[6] = 7; node_list[7] = 8;
  457. elem_list[3] = 2;
  458. /* side set #5 - hex; 7 sides */
  459. node_list[8] = 9; node_list[9] = 12;
  460. node_list[10] = 11; node_list[11] = 10;
  461. elem_list[4] = 3;
  462. node_list[12] = 11; node_list[13] = 12;
  463. node_list[14] = 16; node_list[15] = 15;
  464. elem_list[5] = 3;
  465. node_list[16] = 16; node_list[17] = 15;
  466. node_list[18] = 11; node_list[19] = 12;
  467. elem_list[6] = 3;
  468. node_list[20] = 10; node_list[21] = 11;
  469. node_list[22] = 15; node_list[23] = 14;
  470. elem_list[7] = 3;
  471. node_list[24] = 13; node_list[25] = 16;
  472. node_list[26] = 12; node_list[27] = 9;
  473. elem_list[8] = 3;
  474. node_list[28] = 14; node_list[29] = 13;
  475. node_list[30] = 9; node_list[31] = 10;
  476. elem_list[9] = 3;
  477. node_list[32] = 16; node_list[33] = 13;
  478. node_list[34] = 14; node_list[35] = 15;
  479. elem_list[10] = 3;
  480. /* side set #6 - 4-node tetras; 4 sides */
  481. node_list[36] = 17; node_list[37] = 18;
  482. node_list[38] = 20;
  483. elem_list[11] = 4;
  484. node_list[39] = 18; node_list[40] = 19;
  485. node_list[41] = 20;
  486. elem_list[12] = 4;
  487. node_list[42] = 17; node_list[43] = 20;
  488. node_list[44] = 19;
  489. elem_list[13] = 4;
  490. node_list[45] = 17; node_list[46] = 19;
  491. node_list[47] = 18;
  492. elem_list[14] = 4;
  493. /* side set #7 - shells; front and back faces */
  494. node_list[48] = 1; node_list[49] = 2;
  495. node_list[50] = 3; node_list[51] = 4;
  496. elem_list[15] = 7;
  497. node_list[52] = 4; node_list[53] = 3;
  498. node_list[54] = 2; node_list[55] = 1;
  499. elem_list[16] = 7;
  500. /* side set #8 - shells; 4 edges */
  501. node_list[56] = 1; node_list[57] = 2;
  502. elem_list[17] = 7;
  503. node_list[58] = 2; node_list[59] = 3;
  504. elem_list[18] = 7;
  505. node_list[60] = 3; node_list[61] = 4;
  506. elem_list[19] = 7;
  507. node_list[62] = 4; node_list[63] = 1;
  508. elem_list[20] = 7;
  509. /* side set #9 -- 3-node shells -- front and back */
  510. node_list[64] = 30;
  511. node_list[65] = 31;
  512. node_list[66] = 32;
  513. elem_list[21] = 8;
  514. node_list[67] = 32;
  515. node_list[68] = 31;
  516. node_list[69] = 30;
  517. elem_list[22] = 8;
  518. /* set up indices */
  519. node_ind[0] = 0;
  520. node_ind[1] = 0;
  521. node_ind[2] = 0;
  522. node_ind[3] = 4;
  523. node_ind[4] = 8;
  524. node_ind[5] = 36;
  525. node_ind[6] = 48;
  526. node_ind[7] = 56;
  527. node_ind[8] = 64;
  528. num_elem_per_set[0] = 0;
  529. num_elem_per_set[1] = 0;
  530. num_elem_per_set[2] = 2;
  531. num_elem_per_set[3] = 2;
  532. num_elem_per_set[4] = 7;
  533. num_elem_per_set[5] = 4;
  534. num_elem_per_set[6] = 2;
  535. num_elem_per_set[7] = 4;
  536. num_elem_per_set[8] = 2;
  537. num_nodes_per_set[0] = 0;
  538. num_nodes_per_set[1] = 0;
  539. num_nodes_per_set[2] = 4;
  540. num_nodes_per_set[3] = 4;
  541. num_nodes_per_set[4] = 28;
  542. num_nodes_per_set[5] = 12;
  543. num_nodes_per_set[6] = 8;
  544. num_nodes_per_set[7] = 8;
  545. num_nodes_per_set[8] = 6;
  546. elem_ind[0] = 0;
  547. elem_ind[1] = 0;
  548. elem_ind[2] = 0;
  549. elem_ind[3] = 2;
  550. elem_ind[4] = 4;
  551. elem_ind[5] = 11;
  552. elem_ind[6] = 15;
  553. elem_ind[7] = 17;
  554. elem_ind[8] = 21;
  555. error = ex_cvt_nodes_to_sides(exoid,
  556. num_elem_per_set,
  557. num_nodes_per_set,
  558. elem_ind,
  559. node_ind,
  560. elem_list,
  561. node_list,
  562. side_list);
  563. printf ("after ex_cvt_nodes_to_sides, error = %d\n", error);
  564. if (error) {
  565. ex_close (exoid);
  566. exit(-1);
  567. }
  568. num_df_per_set[0] = 0;
  569. num_df_per_set[1] = 0;
  570. num_df_per_set[2] = 4;
  571. num_df_per_set[3] = 4;
  572. num_df_per_set[4] = 0;
  573. num_df_per_set[5] = 0;
  574. num_df_per_set[6] = 0;
  575. num_df_per_set[7] = 0;
  576. num_df_per_set[8] = 0;
  577. df_ind[0] = 0;
  578. df_ind[1] = 0;
  579. df_ind[2] = 0;
  580. df_ind[3] = 4;
  581. df_ind[4] = 0;
  582. df_ind[5] = 0;
  583. df_ind[6] = 0;
  584. df_ind[7] = 0;
  585. df_ind[8] = 0;
  586. dist_fact[0] = 30.0; dist_fact[1] = 30.1;
  587. dist_fact[2] = 30.2; dist_fact[3] = 30.3;
  588. dist_fact[4] = 31.0; dist_fact[5] = 31.1;
  589. dist_fact[6] = 31.2; dist_fact[7] = 31.3;
  590. error = ex_put_concat_side_sets (exoid, ids, num_elem_per_set,
  591. num_df_per_set, elem_ind, df_ind,
  592. elem_list, side_list, dist_fact);
  593. printf ("after ex_put_concat_side_sets, error = %d\n", error);
  594. if (error) {
  595. ex_close (exoid);
  596. exit(-1);
  597. }
  598. /* THIS SECTION IS COMMENTED OUT
  599. END COMMENTED OUT SECTION */
  600. /* write QA records; test empty and just blank-filled records */
  601. num_qa_rec = 2;
  602. qa_record[0][0] = "TESTWT";
  603. qa_record[0][1] = "testwt";
  604. qa_record[0][2] = "07/07/93";
  605. qa_record[0][3] = "15:41:33";
  606. qa_record[1][0] = "";
  607. qa_record[1][1] = " ";
  608. qa_record[1][2] = "";
  609. qa_record[1][3] = " ";
  610. error = ex_put_qa (exoid, num_qa_rec, qa_record);
  611. printf ("after ex_put_qa, error = %d\n", error);
  612. if (error) {
  613. ex_close (exoid);
  614. exit(-1);
  615. }
  616. /* write information records; test empty and just blank-filled records */
  617. num_info = 3;
  618. info[0] = "This is the first information record.";
  619. info[1] = "";
  620. info[2] = " ";
  621. error = ex_put_info (exoid, num_info, info);
  622. printf ("after ex_put_info, error = %d\n", error);
  623. if (error) {
  624. ex_close (exoid);
  625. exit(-1);
  626. }
  627. /* close the EXODUS files
  628. */
  629. error = ex_close (exoid);
  630. printf ("after ex_close, error = %d\n", error);
  631. if (error) {
  632. ex_close (exoid);
  633. exit(-1);
  634. }
  635. return 0;
  636. }