<span id="the-fortranfile-module"></span><h1>the fortranfile module<a class="headerlink" href="#module-pNbody.fortranfile" title="Permalink to this headline">¶</a></h1>
<p>Defines a file-derived class to read/write Fortran unformatted files.</p>
<p>The assumption is that a Fortran unformatted file is being written by
the Fortran runtime as a sequence of records. Each record consists of
an integer (of the default size [usually 32 or 64 bits]) giving the
length of the following data in bytes, then the data itself, then the
same integer as before.</p>
<div class="section" id="examples">
<h2>Examples<a class="headerlink" href="#examples" title="Permalink to this headline">¶</a></h2>
<dl class="docutils">
<dt>To use the default endian and precision settings, one can just do::</dt>
<tt class="descname">HEADER_PREC</tt><a class="headerlink" href="#pNbody.fortranfile.FortranFile.HEADER_PREC" title="Permalink to this definition">¶</a></dt>
<dd><p>Possible header precisions are ‘h’, ‘i’, ‘l’, ‘q’</p>
</dd></dl>
<dl class="method">
<dt id="pNbody.fortranfile.FortranFile.readInts">
<tt class="descname">readInts</tt><big>(</big><em>prec='i'</em><big>)</big><a class="headerlink" href="#pNbody.fortranfile.FortranFile.readInts" title="Permalink to this definition">¶</a></dt>
<tt class="descname">readReals</tt><big>(</big><em>prec='f'</em><big>)</big><a class="headerlink" href="#pNbody.fortranfile.FortranFile.readReals" title="Permalink to this definition">¶</a></dt>
<tt class="descname">readRecord</tt><big>(</big><big>)</big><a class="headerlink" href="#pNbody.fortranfile.FortranFile.readRecord" title="Permalink to this definition">¶</a></dt>
<tt class="descname">readString</tt><big>(</big><big>)</big><a class="headerlink" href="#pNbody.fortranfile.FortranFile.readString" title="Permalink to this definition">¶</a></dt>
<tt class="descname">writeInts</tt><big>(</big><em>ints</em>, <em>prec='i'</em><big>)</big><a class="headerlink" href="#pNbody.fortranfile.FortranFile.writeInts" title="Permalink to this definition">¶</a></dt>
<dd><p>Write an array of integers in given precision</p>
<tt class="descname">writeReals</tt><big>(</big><em>reals</em>, <em>prec='f'</em><big>)</big><a class="headerlink" href="#pNbody.fortranfile.FortranFile.writeReals" title="Permalink to this definition">¶</a></dt>
<dd><p>Write an array of floats in given precision</p>
<tt class="descname">writeRecord</tt><big>(</big><em>s</em><big>)</big><a class="headerlink" href="#pNbody.fortranfile.FortranFile.writeRecord" title="Permalink to this definition">¶</a></dt>
<tt class="descname">writeString</tt><big>(</big><em>s</em><big>)</big><a class="headerlink" href="#pNbody.fortranfile.FortranFile.writeString" title="Permalink to this definition">¶</a></dt>