<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.14"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Exodus: /test/testwt-localization.C</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
  $(document).ready(initResizable);
/* @license-end */</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">Exodus
   &#160;<span id="projectnumber">7.10</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.14 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('_2test_2testwt-localization_8C-example.html','');});
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle">
<div class="title">/test/testwt-localization.C</div>  </div>
</div><!--header-->
<div class="contents">
<div class="fragment"><div class="line"><span class="comment">/*</span></div><div class="line"><span class="comment"> * Copyright (c) 2005-2017 National Technology &amp; Engineering Solutions</span></div><div class="line"><span class="comment"> * of Sandia, LLC (NTESS).  Under the terms of Contract DE-NA0003525 with</span></div><div class="line"><span class="comment"> * NTESS, the U.S. Government retains certain rights in this software.</span></div><div class="line"><span class="comment"> *</span></div><div class="line"><span class="comment"> * Redistribution and use in source and binary forms, with or without</span></div><div class="line"><span class="comment"> * modification, are permitted provided that the following conditions are</span></div><div class="line"><span class="comment"> * met:</span></div><div class="line"><span class="comment"> *</span></div><div class="line"><span class="comment"> *     * Redistributions of source code must retain the above copyright</span></div><div class="line"><span class="comment"> *       notice, this list of conditions and the following disclaimer.</span></div><div class="line"><span class="comment"> *</span></div><div class="line"><span class="comment"> *     * Redistributions in binary form must reproduce the above</span></div><div class="line"><span class="comment"> *       copyright notice, this list of conditions and the following</span></div><div class="line"><span class="comment"> *       disclaimer in the documentation and/or other materials provided</span></div><div class="line"><span class="comment"> *       with the distribution.</span></div><div class="line"><span class="comment"> *</span></div><div class="line"><span class="comment"> *     * Neither the name of NTESS nor the names of its</span></div><div class="line"><span class="comment"> *       contributors may be used to endorse or promote products derived</span></div><div class="line"><span class="comment"> *       from this software without specific prior written permission.</span></div><div class="line"><span class="comment"> *</span></div><div class="line"><span class="comment"> * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS</span></div><div class="line"><span class="comment"> * &quot;AS IS&quot; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT</span></div><div class="line"><span class="comment"> * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR</span></div><div class="line"><span class="comment"> * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT</span></div><div class="line"><span class="comment"> * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,</span></div><div class="line"><span class="comment"> * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT</span></div><div class="line"><span class="comment"> * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,</span></div><div class="line"><span class="comment"> * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY</span></div><div class="line"><span class="comment"> * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT</span></div><div class="line"><span class="comment"> * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE</span></div><div class="line"><span class="comment"> * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</span></div><div class="line"><span class="comment"> *</span></div><div class="line"><span class="comment"> */</span></div><div class="line"></div><div class="line"><span class="preprocessor">#include &lt;array&gt;</span></div><div class="line"><span class="preprocessor">#include &lt;iostream&gt;</span></div><div class="line"><span class="preprocessor">#include &lt;numeric&gt;</span></div><div class="line"><span class="preprocessor">#include &lt;stdio.h&gt;</span></div><div class="line"><span class="preprocessor">#include &lt;stdlib.h&gt;</span></div><div class="line"><span class="preprocessor">#include &lt;string.h&gt;</span></div><div class="line"><span class="preprocessor">#include &lt;string&gt;</span></div><div class="line"></div><div class="line"><span class="preprocessor">#include &quot;<a class="code" href="exodusII_8h.html">exodusII.h</a>&quot;</span></div><div class="line"></div><div class="line"><span class="preprocessor">#define STRINGIFY(x) #x</span></div><div class="line"><span class="preprocessor">#define TOSTRING(x) STRINGIFY(x)</span></div><div class="line"><span class="preprocessor">#define EXCHECK(funcall)                                                                           \</span></div><div class="line"><span class="preprocessor">  do {                                                                                             \</span></div><div class="line"><span class="preprocessor">    if ((error = (funcall)) != NC_NOERR) {                                                         \</span></div><div class="line"><span class="preprocessor">      fprintf(stderr, &quot;ERROR Calling %s, error = %d\n&quot;, TOSTRING(funcall), error);                 \</span></div><div class="line"><span class="preprocessor">      ex_close(exoid);                                                                             \</span></div><div class="line"><span class="preprocessor">      exit(-1);                                                                                    \</span></div><div class="line"><span class="preprocessor">    }                                                                                              \</span></div><div class="line"><span class="preprocessor">  } while (0)</span></div><div class="line"></div><div class="line"><span class="keywordtype">int</span> main(<span class="keywordtype">int</span> argc, <span class="keywordtype">char</span> **argv)</div><div class="line">{</div><div class="line">  <a name="a0"></a><a class="code" href="exodusII_8h.html#a8f47bbb035d32bbafc594c5ed3c00403">ex_opts</a>(<a name="a1"></a><a class="code" href="exodusII_8h.html#a8e04765c48d2d3c6806dc89d6c3db1feae2153f7d84ce02bf6947dae81018d5d9">EX_VERBOSE</a>);</div><div class="line"></div><div class="line">  <span class="comment">/* Specify compute and i/o word size */</span></div><div class="line"></div><div class="line">  <span class="keywordtype">int</span> CPU_word_size = 8; <span class="comment">/* sizeof(float) */</span></div><div class="line">  <span class="keywordtype">int</span> IO_word_size  = 8; <span class="comment">/* (4 bytes) */</span></div><div class="line">  <span class="keywordtype">int</span> <a name="a2"></a><a class="code" href="ex__put__elem__var__tab_8c.html#af10dacfa214e2575bb2e0ee407c242e0">error</a>;</div><div class="line"></div><div class="line">  <span class="comment">/* create EXODUS II file */</span></div><div class="line"></div><div class="line">  <span class="keywordtype">int</span> exoid = <a name="a3"></a><a class="code" href="exodusII_8h.html#a37c928f7e30c333ee7c704d04f7e3a87">ex_create</a>(<span class="stringliteral">&quot;test.exo&quot;</span>,     <span class="comment">/* filename path */</span></div><div class="line">                        <a name="a4"></a><a class="code" href="group__FileVars.html#gadeed66ded179e51a8858254052a76ba4">EX_CLOBBER</a>,     <span class="comment">/* create mode */</span></div><div class="line">                        &amp;CPU_word_size, <span class="comment">/* CPU float word size in bytes */</span></div><div class="line">                        &amp;IO_word_size); <span class="comment">/* I/O float word size in bytes */</span></div><div class="line"></div><div class="line">  <span class="comment">/* initialize file with parameters */</span></div><div class="line">  constexpr <span class="keywordtype">int</span> num_dim       = 3;</div><div class="line">  constexpr <span class="keywordtype">int</span> num_nodes     = 64;</div><div class="line">  constexpr <span class="keywordtype">int</span> num_elem      = 9;</div><div class="line">  constexpr <span class="keywordtype">int</span> num_elem_blk  = 3;</div><div class="line">  constexpr <span class="keywordtype">int</span> num_node_sets = 0;</div><div class="line">  constexpr <span class="keywordtype">int</span> num_side_sets = 0;</div><div class="line">  std::string   title         = <span class="stringliteral">&quot;This is a test&quot;</span>;</div><div class="line"></div><div class="line">  <a name="a5"></a><a class="code" href="ex__copy_8c.html#aa2e0fbcf16ac768c9978cff9920e8e9a">EXCHECK</a>(<a name="a6"></a><a class="code" href="exodusII_8h.html#aad1d6ddd57d1fa8f94da25d505e8c7ba">ex_put_init</a>(exoid, title.c_str(), num_dim, num_nodes, num_elem, num_elem_blk,</div><div class="line">                      num_node_sets, num_side_sets));</div><div class="line"></div><div class="line">  <span class="comment">/* write nodal coordinates values and names to database */</span></div><div class="line"></div><div class="line">  <span class="comment">/* Quad #1 */</span></div><div class="line">  std::array&lt;double, num_nodes&gt; x;</div><div class="line">  std::array&lt;double, num_nodes&gt; y;</div><div class="line">  std::array&lt;double, num_nodes&gt; z;</div><div class="line"></div><div class="line">  x[0] = 0.00;</div><div class="line">  x[1] = 0.75;</div><div class="line">  x[2] = 1.50;</div><div class="line">  x[3] = 2.25;</div><div class="line">  x[4] = 3.00;</div><div class="line"></div><div class="line">  x[5] = x[0];</div><div class="line">  x[6] = 1.125;</div><div class="line">  x[7] = 1.625;</div><div class="line">  x[8] = 3.000;</div><div class="line"></div><div class="line">  x[9]  = x[0];</div><div class="line">  x[10] = 0.50;</div><div class="line">  x[11] = 1.00;</div><div class="line">  x[12] = x[2];</div><div class="line">  x[13] = 2.00;</div><div class="line">  x[14] = 2.50;</div><div class="line">  x[15] = 3.00;</div><div class="line"></div><div class="line">  x[16] = x[10];</div><div class="line">  x[17] = x[11];</div><div class="line">  x[18] = x[12];</div><div class="line">  x[19] = x[13];</div><div class="line">  x[20] = x[14];</div><div class="line"></div><div class="line">  x[21] = x[11];</div><div class="line">  x[22] = x[13];</div><div class="line">  x[23] = 0.0;</div><div class="line">  x[24] = x[6];</div><div class="line">  x[25] = x[7];</div><div class="line">  x[26] = 3.0;</div><div class="line"></div><div class="line">  x[27] = x[0];</div><div class="line">  x[28] = x[1];</div><div class="line">  x[29] = x[2];</div><div class="line">  x[30] = x[3];</div><div class="line">  x[31] = x[4];</div><div class="line"></div><div class="line">  y[0] = y[1] = y[2] = y[3] = y[4] = 0.00;</div><div class="line">  y[5]                             = 0.75;</div><div class="line">  y[6]                             = 0.50;</div><div class="line">  y[7]                             = y[6];</div><div class="line">  y[8]                             = y[5];</div><div class="line"></div><div class="line">  y[9]  = 1.50;</div><div class="line">  y[10] = 1.25;</div><div class="line">  y[11] = y[12] = y[13] = 1.00;</div><div class="line">  y[14]                 = y[10];</div><div class="line">  y[15]                 = y[9];</div><div class="line"></div><div class="line">  y[16] = 1.75;</div><div class="line">  y[17] = y[18] = y[19] = 2.00;</div><div class="line">  y[20]                 = y[16];</div><div class="line"></div><div class="line">  y[21] = y[22] = y[9];</div><div class="line">  y[23] = y[26] = 2.25;</div><div class="line">  y[24] = y[25] = 2.50;</div><div class="line"></div><div class="line">  y[27] = y[28] = y[29] = y[30] = y[31] = 3.0;</div><div class="line"></div><div class="line">  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; num_nodes / 2; i++) {</div><div class="line">    z[i] = 0.0;</div><div class="line"></div><div class="line">    x[i + num_nodes / 2] = x[i];</div><div class="line">    y[i + num_nodes / 2] = y[i];</div><div class="line">    z[i + num_nodes / 2] = 1.0;</div><div class="line">  }</div><div class="line"></div><div class="line">  <a class="code" href="ex__copy_8c.html#aa2e0fbcf16ac768c9978cff9920e8e9a">EXCHECK</a>(<a name="a7"></a><a class="code" href="exodusII_8h.html#a7b04e195e3fa979ba07470b860d70145">ex_put_coord</a>(exoid, x.data(), y.data(), z.data()));</div><div class="line"></div><div class="line">  std::array&lt;const char *, 3&gt; coord_names = {{<span class="stringliteral">&quot;xcoor&quot;</span>, <span class="stringliteral">&quot;ycoor&quot;</span>, <span class="stringliteral">&quot;zcoor&quot;</span>}};</div><div class="line"></div><div class="line">  <a class="code" href="ex__copy_8c.html#aa2e0fbcf16ac768c9978cff9920e8e9a">EXCHECK</a>(<a name="a8"></a><a class="code" href="exodusII_8h.html#a5aa680de654224107fa67a0e019b6bd1">ex_put_coord_names</a>(exoid, (<span class="keywordtype">char</span> **)coord_names.data()));</div><div class="line"></div><div class="line">  std::array&lt;ex_block, num_elem_blk&gt; blocks;</div><div class="line"></div><div class="line">  blocks[0].id                  = 10;</div><div class="line">  blocks[0].type                = <a name="a9"></a><a class="code" href="exodusII_8h.html#a1f649ed288d305ab55773ffd1d220490aecdd2cbb9f2805c308dedb77c6ebe286">EX_ELEM_BLOCK</a>;</div><div class="line">  blocks[0].num_entry           = 4;</div><div class="line">  blocks[0].num_nodes_per_entry = 16;</div><div class="line"></div><div class="line">  blocks[1].id                  = 20;</div><div class="line">  blocks[1].type                = <a class="code" href="exodusII_8h.html#a1f649ed288d305ab55773ffd1d220490aecdd2cbb9f2805c308dedb77c6ebe286">EX_ELEM_BLOCK</a>;</div><div class="line">  blocks[1].num_entry           = 4;</div><div class="line">  blocks[1].num_nodes_per_entry = 12;</div><div class="line"></div><div class="line">  blocks[2].id                  = 30;</div><div class="line">  blocks[2].type                = <a class="code" href="exodusII_8h.html#a1f649ed288d305ab55773ffd1d220490aecdd2cbb9f2805c308dedb77c6ebe286">EX_ELEM_BLOCK</a>;</div><div class="line">  blocks[2].num_entry           = 1;</div><div class="line">  blocks[2].num_nodes_per_entry = 16;</div><div class="line"></div><div class="line">  strncpy(blocks[0].<a name="a10"></a><a class="code" href="structex__block.html#a7f53d2602122f3101a26b4d3cd306915">topology</a>, <span class="stringliteral">&quot;hex&quot;</span>, 32);</div><div class="line">  strncpy(blocks[1].<a class="code" href="structex__block.html#a7f53d2602122f3101a26b4d3cd306915">topology</a>, <span class="stringliteral">&quot;wedge&quot;</span>, 32);</div><div class="line">  strncpy(blocks[2].<a class="code" href="structex__block.html#a7f53d2602122f3101a26b4d3cd306915">topology</a>, <span class="stringliteral">&quot;hex&quot;</span>, 32);</div><div class="line"></div><div class="line">  std::array&lt;const char *, num_elem_blk&gt; block_names{{<span class="stringliteral">&quot;block_10&quot;</span>, <span class="stringliteral">&quot;block_20&quot;</span>, <span class="stringliteral">&quot;block_30&quot;</span>}};</div><div class="line"></div><div class="line">  <a class="code" href="ex__copy_8c.html#aa2e0fbcf16ac768c9978cff9920e8e9a">EXCHECK</a>(<a name="a11"></a><a class="code" href="exodusII_8h.html#aca77ecebfa9dad39ba97ec76a14b3364">ex_put_block_params</a>(exoid, num_elem_blk, blocks.data()));</div><div class="line"></div><div class="line">  <span class="comment">/* Write element block names */</span></div><div class="line">  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; num_elem_blk; i++) {</div><div class="line">    <a class="code" href="ex__copy_8c.html#aa2e0fbcf16ac768c9978cff9920e8e9a">EXCHECK</a>(<a name="a12"></a><a class="code" href="exodusII_8h.html#a9f3c7c8c26e49556f86534f4460e0cf0">ex_put_name</a>(exoid, <a class="code" href="exodusII_8h.html#a1f649ed288d305ab55773ffd1d220490aecdd2cbb9f2805c308dedb77c6ebe286">EX_ELEM_BLOCK</a>, blocks[i].<span class="keywordtype">id</span>, block_names[i]));</div><div class="line">  }</div><div class="line"></div><div class="line">  <span class="comment">/* write element connectivity */</span></div><div class="line">  std::array&lt;int, 64&gt; connect0{{1,  3,  12, 10, 2,  7,  11, 6,  3,  5,  16, 14, 4,  9,  15, 8,</div><div class="line">                                10, 18, 30, 28, 17, 25, 29, 24, 20, 16, 32, 30, 21, 27, 31, 26}};</div><div class="line">  std::array&lt;int, 48&gt; connect1{{3,  14, 12, 8,  13, 7,  14, 16, 20, 15, 21, 23,</div><div class="line">                                18, 20, 30, 19, 26, 25, 10, 12, 18, 11, 22, 17}};</div><div class="line">  std::array&lt;int, 16&gt; connect2{{12, 14, 20, 18, 13, 23, 19, 22}};</div><div class="line"></div><div class="line">  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; blocks[0].num_entry * blocks[0].num_nodes_per_entry / 2; i++) {</div><div class="line">    connect0[i + 32] = connect0[i] + 32;</div><div class="line">  }</div><div class="line"></div><div class="line">  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; blocks[1].num_entry * blocks[1].num_nodes_per_entry / 2; i++) {</div><div class="line">    connect1[i + 24] = connect1[i] + 32;</div><div class="line">  }</div><div class="line"></div><div class="line">  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; blocks[2].num_entry * blocks[2].num_nodes_per_entry / 2; i++) {</div><div class="line">    connect2[i + 8] = connect2[i] + 32;</div><div class="line">  }</div><div class="line"></div><div class="line">  <a class="code" href="ex__copy_8c.html#aa2e0fbcf16ac768c9978cff9920e8e9a">EXCHECK</a>(<a name="a13"></a><a class="code" href="exodusII_8h.html#a359b6d011348ed04746217e67612f3c1">ex_put_conn</a>(exoid, <a class="code" href="exodusII_8h.html#a1f649ed288d305ab55773ffd1d220490aecdd2cbb9f2805c308dedb77c6ebe286">EX_ELEM_BLOCK</a>, blocks[0].<span class="keywordtype">id</span>, connect0.data(), NULL, NULL));</div><div class="line">  <a class="code" href="ex__copy_8c.html#aa2e0fbcf16ac768c9978cff9920e8e9a">EXCHECK</a>(<a class="code" href="exodusII_8h.html#a359b6d011348ed04746217e67612f3c1">ex_put_conn</a>(exoid, <a class="code" href="exodusII_8h.html#a1f649ed288d305ab55773ffd1d220490aecdd2cbb9f2805c308dedb77c6ebe286">EX_ELEM_BLOCK</a>, blocks[1].<span class="keywordtype">id</span>, connect1.data(), NULL, NULL));</div><div class="line">  <a class="code" href="ex__copy_8c.html#aa2e0fbcf16ac768c9978cff9920e8e9a">EXCHECK</a>(<a class="code" href="exodusII_8h.html#a359b6d011348ed04746217e67612f3c1">ex_put_conn</a>(exoid, <a class="code" href="exodusII_8h.html#a1f649ed288d305ab55773ffd1d220490aecdd2cbb9f2805c308dedb77c6ebe286">EX_ELEM_BLOCK</a>, blocks[2].<span class="keywordtype">id</span>, connect2.data(), NULL, NULL));</div><div class="line"></div><div class="line">  <span class="comment">/* write information records; test empty and just blank-filled records */</span></div><div class="line">  constexpr <span class="keywordtype">int</span>                      num_info = 3;</div><div class="line">  std::array&lt;const char *, num_info&gt; info;</div><div class="line"></div><div class="line">  info[0] = <span class="stringliteral">&quot;This is the first information record.&quot;</span>;</div><div class="line">  info[1] = <span class="stringliteral">&quot;&quot;</span>;</div><div class="line">  info[2] = <span class="stringliteral">&quot;                                     &quot;</span>;</div><div class="line"></div><div class="line">  <a class="code" href="ex__copy_8c.html#aa2e0fbcf16ac768c9978cff9920e8e9a">EXCHECK</a>(<a name="a14"></a><a class="code" href="exodusII_8h.html#a16d75c04427a26326070625c5116a934">ex_put_info</a>(exoid, num_info, (<span class="keywordtype">char</span> **)info.data()));</div><div class="line"></div><div class="line">  <span class="comment">/* write results variables parameters and names */</span></div><div class="line">  <span class="keyword">const</span> <span class="keywordtype">int</span> num_glo_vars = 1;</div><div class="line"></div><div class="line">  std::array&lt;const char *, 4&gt; var_names;</div><div class="line">  var_names[0] = <span class="stringliteral">&quot;glo_vars&quot;</span>;</div><div class="line"></div><div class="line">  <a class="code" href="ex__copy_8c.html#aa2e0fbcf16ac768c9978cff9920e8e9a">EXCHECK</a>(<a name="a15"></a><a class="code" href="group__ResultsData.html#gac8b76bb57f2ab1e4cbca7aef29b6ae91">ex_put_variable_param</a>(exoid, <a name="a16"></a><a class="code" href="exodusII_8h.html#a1f649ed288d305ab55773ffd1d220490a890b3a596358b8fe3bee8771f4ac84ac">EX_GLOBAL</a>, num_glo_vars));</div><div class="line">  <a class="code" href="ex__copy_8c.html#aa2e0fbcf16ac768c9978cff9920e8e9a">EXCHECK</a>(<a name="a17"></a><a class="code" href="group__ResultsData.html#gae487ed3a7cd9dcef6eca2ca6dac0f48b">ex_put_variable_names</a>(exoid, <a class="code" href="exodusII_8h.html#a1f649ed288d305ab55773ffd1d220490a890b3a596358b8fe3bee8771f4ac84ac">EX_GLOBAL</a>, num_glo_vars, (<span class="keywordtype">char</span> **)var_names.data()));</div><div class="line"></div><div class="line">  <span class="keyword">const</span> <span class="keywordtype">int</span> num_nod_vars = 2;</div><div class="line">  <span class="comment">/*              12345678901234567890123456789012 */</span></div><div class="line">  var_names[0] = <span class="stringliteral">&quot;node_variable_a_very_long_name_0&quot;</span>;</div><div class="line">  var_names[1] = <span class="stringliteral">&quot;nod_var1&quot;</span>;</div><div class="line"></div><div class="line">  <a class="code" href="ex__copy_8c.html#aa2e0fbcf16ac768c9978cff9920e8e9a">EXCHECK</a>(<a class="code" href="group__ResultsData.html#gac8b76bb57f2ab1e4cbca7aef29b6ae91">ex_put_variable_param</a>(exoid, <a name="a18"></a><a class="code" href="exodusII_8h.html#a1f649ed288d305ab55773ffd1d220490a7976e7fb59368794c38ff5da95b19873">EX_NODAL</a>, num_nod_vars));</div><div class="line">  <a class="code" href="ex__copy_8c.html#aa2e0fbcf16ac768c9978cff9920e8e9a">EXCHECK</a>(<a class="code" href="group__ResultsData.html#gae487ed3a7cd9dcef6eca2ca6dac0f48b">ex_put_variable_names</a>(exoid, <a class="code" href="exodusII_8h.html#a1f649ed288d305ab55773ffd1d220490a7976e7fb59368794c38ff5da95b19873">EX_NODAL</a>, num_nod_vars, (<span class="keywordtype">char</span> **)var_names.data()));</div><div class="line"></div><div class="line">  <span class="keyword">const</span> <span class="keywordtype">int</span> num_ele_vars = 3;</div><div class="line">  <span class="comment">/*              0        1         2         3   */</span></div><div class="line">  <span class="comment">/*              12345678901234567890123456789012 */</span></div><div class="line">  var_names[0] = <span class="stringliteral">&quot;this_variable_name_is_short&quot;</span>;</div><div class="line">  var_names[1] = <span class="stringliteral">&quot;this_variable_name_is_just_right&quot;</span>;</div><div class="line">  var_names[2] = <span class="stringliteral">&quot;this_variable_name_is_tooooo_long&quot;</span>;</div><div class="line"></div><div class="line">  <a class="code" href="ex__copy_8c.html#aa2e0fbcf16ac768c9978cff9920e8e9a">EXCHECK</a>(<a class="code" href="group__ResultsData.html#gac8b76bb57f2ab1e4cbca7aef29b6ae91">ex_put_variable_param</a>(exoid, <a class="code" href="exodusII_8h.html#a1f649ed288d305ab55773ffd1d220490aecdd2cbb9f2805c308dedb77c6ebe286">EX_ELEM_BLOCK</a>, num_ele_vars));</div><div class="line">  <a class="code" href="ex__copy_8c.html#aa2e0fbcf16ac768c9978cff9920e8e9a">EXCHECK</a>(<a class="code" href="group__ResultsData.html#gae487ed3a7cd9dcef6eca2ca6dac0f48b">ex_put_variable_names</a>(exoid, <a class="code" href="exodusII_8h.html#a1f649ed288d305ab55773ffd1d220490aecdd2cbb9f2805c308dedb77c6ebe286">EX_ELEM_BLOCK</a>, num_ele_vars, (<span class="keywordtype">char</span> **)var_names.data()));</div><div class="line"></div><div class="line">  <span class="comment">// for each time step, write the analysis results;</span></div><div class="line">  <span class="comment">// the code below fills the arrays glob_var_vals,</span></div><div class="line">  <span class="comment">// nodal_var_vals, and elem_var_vals with values for debugging purposes;</span></div><div class="line">  <span class="keywordtype">int</span>       whole_time_step = 1;</div><div class="line">  <span class="keyword">const</span> <span class="keywordtype">int</span> num_time_steps  = 10;</div><div class="line"></div><div class="line">  std::array&lt;double, num_glo_vars&gt; glob_var_vals;</div><div class="line">  std::array&lt;double, num_nodes&gt;    nodal_var_vals;</div><div class="line">  std::array&lt;double, 4&gt;            elem_var_vals;</div><div class="line"></div><div class="line">  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; num_time_steps; i++) {</div><div class="line">    <span class="keywordtype">double</span> time_value = (float)(i + 1) / 100.;</div><div class="line"></div><div class="line">    <span class="comment">/* write time value */</span></div><div class="line">    <a class="code" href="ex__copy_8c.html#aa2e0fbcf16ac768c9978cff9920e8e9a">EXCHECK</a>(<a name="a19"></a><a class="code" href="exodusII_8h.html#a2052c8728dac97589b94d9947e645797">ex_put_time</a>(exoid, whole_time_step, &amp;time_value));</div><div class="line"></div><div class="line">    <span class="comment">// write global variables</span></div><div class="line">    <span class="keywordflow">for</span> (<span class="keywordtype">int</span> j = 0; j &lt; num_glo_vars; j++) {</div><div class="line">      glob_var_vals[j] = (float)(j + 2) * time_value;</div><div class="line">    }</div><div class="line"></div><div class="line">    <a class="code" href="ex__copy_8c.html#aa2e0fbcf16ac768c9978cff9920e8e9a">EXCHECK</a>(</div><div class="line">        <a name="a20"></a><a class="code" href="exodusII_8h.html#afa1d828867b436631e99a63fd5ddbf05">ex_put_var</a>(exoid, whole_time_step, <a class="code" href="exodusII_8h.html#a1f649ed288d305ab55773ffd1d220490a890b3a596358b8fe3bee8771f4ac84ac">EX_GLOBAL</a>, 1, 1, num_glo_vars, glob_var_vals.data()));</div><div class="line"></div><div class="line">    <span class="comment">// write nodal variables</span></div><div class="line">    <span class="keywordflow">for</span> (<span class="keywordtype">int</span> k = 1; k &lt;= num_nod_vars; k++) {</div><div class="line">      <span class="keywordflow">for</span> (<span class="keywordtype">int</span> j = 0; j &lt; num_nodes; j++) {</div><div class="line">        nodal_var_vals[j] = (float)k + ((<span class="keywordtype">float</span>)(j + 1) * time_value);</div><div class="line">      }</div><div class="line">      <a class="code" href="ex__copy_8c.html#aa2e0fbcf16ac768c9978cff9920e8e9a">EXCHECK</a>(<a class="code" href="exodusII_8h.html#afa1d828867b436631e99a63fd5ddbf05">ex_put_var</a>(exoid, whole_time_step, <a class="code" href="exodusII_8h.html#a1f649ed288d305ab55773ffd1d220490a7976e7fb59368794c38ff5da95b19873">EX_NODAL</a>, k, 1, num_nodes, nodal_var_vals.data()));</div><div class="line">    }</div><div class="line"></div><div class="line">    <span class="comment">// write element variables</span></div><div class="line">    <span class="keywordflow">for</span> (<span class="keywordtype">int</span> k = 1; k &lt;= num_ele_vars; k++) {</div><div class="line">      <span class="keywordflow">for</span> (<span class="keywordtype">int</span> j = 0; j &lt; num_elem_blk; j++) {</div><div class="line">        <span class="keywordflow">for</span> (<span class="keywordtype">int</span> m = 0; m &lt; blocks[j].num_entry; m++) {</div><div class="line">          elem_var_vals[m] = (float)(k + 1) + (float)(j + 2) + ((float)(m + 1) * time_value);</div><div class="line">        }</div><div class="line">        <a class="code" href="ex__copy_8c.html#aa2e0fbcf16ac768c9978cff9920e8e9a">EXCHECK</a>(<a class="code" href="exodusII_8h.html#afa1d828867b436631e99a63fd5ddbf05">ex_put_var</a>(exoid, whole_time_step, <a class="code" href="exodusII_8h.html#a1f649ed288d305ab55773ffd1d220490aecdd2cbb9f2805c308dedb77c6ebe286">EX_ELEM_BLOCK</a>, k, blocks[j].<span class="keywordtype">id</span>,</div><div class="line">                           blocks[j].<a name="a21"></a><a class="code" href="structex__block.html#a619b2c434a69bf79fd803b318d00a0a3">num_entry</a>, elem_var_vals.data()));</div><div class="line">      }</div><div class="line">    }</div><div class="line"></div><div class="line">    whole_time_step++;</div><div class="line"></div><div class="line">    <span class="comment">// update the data file; this should be done at the end of every time step</span></div><div class="line">    <span class="comment">// to ensure that no data is lost if the analysis dies</span></div><div class="line">    <a class="code" href="ex__copy_8c.html#aa2e0fbcf16ac768c9978cff9920e8e9a">EXCHECK</a>(<a name="a22"></a><a class="code" href="exodusII_8h.html#afffa0ac5ec86658fb22ed6af7f5530cc">ex_update</a>(exoid));</div><div class="line">  }</div><div class="line"></div><div class="line">  <span class="comment">// close the EXODUS files</span></div><div class="line">  <a class="code" href="ex__copy_8c.html#aa2e0fbcf16ac768c9978cff9920e8e9a">EXCHECK</a>(<a name="a23"></a><a class="code" href="exodusII_8h.html#abccf733ba6ef7e8a51595eb34c4f94ff">ex_close</a>(exoid));</div><div class="line">  <span class="keywordflow">return</span> 0;</div><div class="line">}</div></div><!-- fragment --> </div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="footer">Generated by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.14 </li>
  </ul>
</div>
</body>
</html>
