File: esys.escript.datamanager.html

package info (click to toggle)
python-escript 5.6-10
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 144,304 kB
  • sloc: python: 592,074; cpp: 136,909; ansic: 18,675; javascript: 9,411; xml: 3,384; sh: 738; makefile: 207
file content (275 lines) | stat: -rw-r--r-- 16,568 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275

<!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="X-UA-Compatible" content="IE=Edge" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>esys.escript.datamanager Package &#8212; esys.escript 5.6 documentation</title>
    <link rel="stylesheet" href="_static/classic.css" type="text/css" />
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
    
    <script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
    <script type="text/javascript" src="_static/jquery.js"></script>
    <script type="text/javascript" src="_static/underscore.js"></script>
    <script type="text/javascript" src="_static/doctools.js"></script>
    <script type="text/javascript" src="_static/language_data.js"></script>
    
    <link rel="index" title="Index" href="genindex.html" />
    <link rel="search" title="Search" href="search.html" /> 
  </head><body>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="nav-item nav-item-0"><a href="index.html">esys.escript 5.6 documentation</a> &#187;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body" role="main">
            
  <div class="section" id="module-esys.escript.datamanager">
<span id="esys-escript-datamanager-package"></span><h1>esys.escript.datamanager Package<a class="headerlink" href="#module-esys.escript.datamanager" title="Permalink to this headline">¶</a></h1>
<ul class="simple">
<li></li>
</ul>
<div class="section" id="classes">
<h2>Classes<a class="headerlink" href="#classes" title="Permalink to this headline">¶</a></h2>
<ul class="simple">
<li><a class="reference internal" href="#esys.escript.datamanager.DataManager" title="esys.escript.datamanager.DataManager"><code class="xref py py-obj docutils literal notranslate"><span class="pre">DataManager</span></code></a></li>
</ul>
<dl class="class">
<dt id="esys.escript.datamanager.DataManager">
<em class="property">class </em><code class="descclassname">esys.escript.datamanager.</code><code class="descname">DataManager</code><span class="sig-paren">(</span><em>formats=[0], work_dir='.', restart_prefix='restart', do_restart=True</em><span class="sig-paren">)</span><a class="headerlink" href="#esys.escript.datamanager.DataManager" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
<p>Escript data import/export manager.</p>
<p>Example:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">dm</span><span class="o">=</span><span class="n">DataManager</span><span class="p">(</span><span class="n">formats</span><span class="o">=</span><span class="p">[</span><span class="n">DataManager</span><span class="o">.</span><span class="n">RESTART</span><span class="p">,</span><span class="n">DataManager</span><span class="o">.</span><span class="n">VTK</span><span class="p">])</span>
<span class="k">if</span> <span class="n">dm</span><span class="o">.</span><span class="n">hasData</span><span class="p">():</span>
    <span class="n">dom</span> <span class="o">=</span> <span class="n">dm</span><span class="o">.</span><span class="n">getDomain</span><span class="p">()</span>
    <span class="n">time</span> <span class="o">=</span> <span class="n">dm</span><span class="o">.</span><span class="n">getValue</span><span class="p">(</span><span class="s2">&quot;time&quot;</span><span class="p">)</span>
    <span class="n">dt</span> <span class="o">=</span> <span class="n">dm</span><span class="o">.</span><span class="n">getValue</span><span class="p">(</span><span class="s2">&quot;dt&quot;</span><span class="p">)</span>
    <span class="n">T</span> <span class="o">=</span> <span class="n">dm</span><span class="o">.</span><span class="n">getValue</span><span class="p">(</span><span class="s2">&quot;T&quot;</span><span class="p">)</span>
    <span class="n">u</span> <span class="o">=</span> <span class="n">dm</span><span class="o">.</span><span class="n">getValue</span><span class="p">(</span><span class="s2">&quot;u&quot;</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
    <span class="n">T</span> <span class="o">=</span> <span class="o">...</span>
    <span class="n">u</span> <span class="o">=</span> <span class="o">...</span>
<span class="n">dm</span><span class="o">.</span><span class="n">addData</span><span class="p">(</span><span class="n">time</span><span class="o">=</span><span class="n">time</span><span class="p">,</span><span class="n">dt</span><span class="o">=</span><span class="n">dt</span><span class="p">,</span><span class="n">T</span><span class="o">=</span><span class="n">T</span><span class="p">,</span><span class="n">u</span><span class="o">=</span><span class="n">u</span><span class="p">)</span> <span class="c1"># add data and variables</span>
<span class="n">dm</span><span class="o">.</span><span class="n">setTime</span><span class="p">(</span><span class="n">time</span><span class="p">)</span>                    <span class="c1"># set the simulation timestamp</span>
<span class="n">dm</span><span class="o">.</span><span class="n">export</span><span class="p">()</span>                         <span class="c1"># write out data</span>
</pre></div>
</div>
<dl class="method">
<dt id="esys.escript.datamanager.DataManager.__init__">
<code class="descname">__init__</code><span class="sig-paren">(</span><em>formats=[0], work_dir='.', restart_prefix='restart', do_restart=True</em><span class="sig-paren">)</span><a class="headerlink" href="#esys.escript.datamanager.DataManager.__init__" title="Permalink to this definition">¶</a></dt>
<dd><p>Initialises the data manager. If do_restart is True and a restart
directory is found the contained data is loaded (hasData() returns True)
otherwise restart directories are removed (hasData() returns False).
Values are only written to disk when export() is called.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>formats</strong> – A list of export file formats to use. Allowed values
are RESTART, SILO, VISIT, VTK.</li>
<li><strong>work_dir</strong> – top-level directory where files are exported to</li>
<li><strong>restart_prefix</strong> – prefix for restart directories. Will be used to
load restart files (if do_restart is True) and
store new restart files (if RESTART is used)</li>
<li><strong>do_restart</strong> – whether to attempt to load restart files</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="attribute">
<dt id="esys.escript.datamanager.DataManager.RESTART">
<code class="descname">RESTART</code><em class="property"> = 0</em><a class="headerlink" href="#esys.escript.datamanager.DataManager.RESTART" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="attribute">
<dt id="esys.escript.datamanager.DataManager.SILO">
<code class="descname">SILO</code><em class="property"> = 1</em><a class="headerlink" href="#esys.escript.datamanager.DataManager.SILO" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="attribute">
<dt id="esys.escript.datamanager.DataManager.VISIT">
<code class="descname">VISIT</code><em class="property"> = 2</em><a class="headerlink" href="#esys.escript.datamanager.DataManager.VISIT" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="attribute">
<dt id="esys.escript.datamanager.DataManager.VTK">
<code class="descname">VTK</code><em class="property"> = 3</em><a class="headerlink" href="#esys.escript.datamanager.DataManager.VTK" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="esys.escript.datamanager.DataManager.addData">
<code class="descname">addData</code><span class="sig-paren">(</span><em>**data</em><span class="sig-paren">)</span><a class="headerlink" href="#esys.escript.datamanager.DataManager.addData" title="Permalink to this definition">¶</a></dt>
<dd><p>Adds ‘escript.Data’ objects and other data to be exported to this
manager.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Note:</th><td class="field-body">This method does not make copies of Data objects so
any modifications will be carried over until export() is called.</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="esys.escript.datamanager.DataManager.export">
<code class="descname">export</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#esys.escript.datamanager.DataManager.export" title="Permalink to this definition">¶</a></dt>
<dd><p>Executes the actual data export. Depending on the formats parameter
used in the constructor all data added by addData() is written to disk
(RESTART,SILO,VTK) or made available through the VisIt simulation
interface (VISIT).</p>
</dd></dl>

<dl class="method">
<dt id="esys.escript.datamanager.DataManager.getCycle">
<code class="descname">getCycle</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#esys.escript.datamanager.DataManager.getCycle" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns the export cycle (=number of times export() has been called)</p>
</dd></dl>

<dl class="method">
<dt id="esys.escript.datamanager.DataManager.getDomain">
<code class="descname">getDomain</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#esys.escript.datamanager.DataManager.getDomain" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns the domain as recovered from restart files.</p>
</dd></dl>

<dl class="method">
<dt id="esys.escript.datamanager.DataManager.getValue">
<code class="descname">getValue</code><span class="sig-paren">(</span><em>value_name</em><span class="sig-paren">)</span><a class="headerlink" href="#esys.escript.datamanager.DataManager.getValue" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns an ‘escript.Data’ object or other value that has been loaded
from restart files.</p>
</dd></dl>

<dl class="method">
<dt id="esys.escript.datamanager.DataManager.hasData">
<code class="descname">hasData</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#esys.escript.datamanager.DataManager.hasData" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns True if the manager holds data for restart</p>
</dd></dl>

<dl class="method">
<dt id="esys.escript.datamanager.DataManager.setCheckpointFrequency">
<code class="descname">setCheckpointFrequency</code><span class="sig-paren">(</span><em>freq</em><span class="sig-paren">)</span><a class="headerlink" href="#esys.escript.datamanager.DataManager.setCheckpointFrequency" title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the number of calls to export() before new restart files are
generated.</p>
</dd></dl>

<dl class="method">
<dt id="esys.escript.datamanager.DataManager.setDomain">
<code class="descname">setDomain</code><span class="sig-paren">(</span><em>domain</em><span class="sig-paren">)</span><a class="headerlink" href="#esys.escript.datamanager.DataManager.setDomain" title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the domain without adding data.</p>
</dd></dl>

<dl class="method">
<dt id="esys.escript.datamanager.DataManager.setMeshLabels">
<code class="descname">setMeshLabels</code><span class="sig-paren">(</span><em>x</em>, <em>y</em>, <em>z=''</em><span class="sig-paren">)</span><a class="headerlink" href="#esys.escript.datamanager.DataManager.setMeshLabels" title="Permalink to this definition">¶</a></dt>
<dd><p>Sets labels for the mesh axes. These are currently only used by the
Silo exporter.</p>
</dd></dl>

<dl class="method">
<dt id="esys.escript.datamanager.DataManager.setMeshUnits">
<code class="descname">setMeshUnits</code><span class="sig-paren">(</span><em>x</em>, <em>y</em>, <em>z=''</em><span class="sig-paren">)</span><a class="headerlink" href="#esys.escript.datamanager.DataManager.setMeshUnits" title="Permalink to this definition">¶</a></dt>
<dd><p>Sets units for the mesh axes. These are currently only used by the
Silo exporter.</p>
</dd></dl>

<dl class="method">
<dt id="esys.escript.datamanager.DataManager.setMetadataSchemaString">
<code class="descname">setMetadataSchemaString</code><span class="sig-paren">(</span><em>schema</em>, <em>metadata=''</em><span class="sig-paren">)</span><a class="headerlink" href="#esys.escript.datamanager.DataManager.setMetadataSchemaString" title="Permalink to this definition">¶</a></dt>
<dd><p>Sets metadata namespaces and the corresponding metadata.
Only used for the VTK file format at the moment.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>schema</strong> – A dictionary that maps namespace prefixes to namespace
names, e.g. {‘gml’:’<a class="reference external" href="http://www.opengis.net/gml">http://www.opengis.net/gml</a>’}</li>
<li><strong>metadata</strong> – The actual metadata string which will be enclosed in
‘&lt;MetaData&gt;’ tags.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="esys.escript.datamanager.DataManager.setTime">
<code class="descname">setTime</code><span class="sig-paren">(</span><em>time</em><span class="sig-paren">)</span><a class="headerlink" href="#esys.escript.datamanager.DataManager.setTime" title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the simulation timestamp.</p>
</dd></dl>

</dd></dl>

</div>
<div class="section" id="functions">
<h2>Functions<a class="headerlink" href="#functions" title="Permalink to this headline">¶</a></h2>
</div>
<div class="section" id="others">
<h2>Others<a class="headerlink" href="#others" title="Permalink to this headline">¶</a></h2>
</div>
<div class="section" id="packages">
<h2>Packages<a class="headerlink" href="#packages" title="Permalink to this headline">¶</a></h2>
<div class="toctree-wrapper compound">
</div>
</div>
</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
        <div class="sphinxsidebarwrapper">
  <h3><a href="index.html">Table of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#">esys.escript.datamanager Package</a><ul>
<li><a class="reference internal" href="#classes">Classes</a></li>
<li><a class="reference internal" href="#functions">Functions</a></li>
<li><a class="reference internal" href="#others">Others</a></li>
<li><a class="reference internal" href="#packages">Packages</a></li>
</ul>
</li>
</ul>

        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="nav-item nav-item-0"><a href="index.html">esys.escript 5.6 documentation</a> &#187;</li> 
      </ul>
    </div>
    <div class="footer" role="contentinfo">
        &#169; Copyright 2012-2014, Author.
      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.8.4.
    </div>
  </body>
</html>