185 lines
11 KiB
HTML
Executable File
185 lines
11 KiB
HTML
Executable File
|
|
<!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>Getting Started — PyLaGriT 0.0.0 documentation</title>
|
|
<link rel="stylesheet" href="static/alabaster.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" />
|
|
<link rel="next" title="Stratigraphic Hex Mesh Tutorial" href="stratigraphic.html" />
|
|
<link rel="prev" title="PyLaGriT, Python interface for LaGriT" href="index.html" />
|
|
|
|
<link rel="stylesheet" href="static/custom.css" type="text/css" />
|
|
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9" />
|
|
|
|
</head><body>
|
|
|
|
|
|
<div class="document">
|
|
<div class="documentwrapper">
|
|
<div class="bodywrapper">
|
|
|
|
|
|
<div class="body" role="main">
|
|
|
|
<div class="section" id="getting-started">
|
|
<h1>Getting Started<a class="headerlink" href="#getting-started" title="Permalink to this headline">¶</a></h1>
|
|
<div class="section" id="installation">
|
|
<h2>Installation<a class="headerlink" href="#installation" title="Permalink to this headline">¶</a></h2>
|
|
<p>The Python module PyLaGriT allows LaGriT to be accessed interactively and in batch mode from Python.
|
|
To install PyLaGriT on your system, change to the PyLaGriT directory and run <code class="docutils literal notranslate"><span class="pre">python</span> <span class="pre">setup.py</span> <span class="pre">install</span></code>.
|
|
Alternatively, the PyLaGriT folder can be added to your <strong>PYTHONPATH</strong> environment variable.
|
|
Due to the use of the pexpect Python module, PyLaGriT does not work on Windows.
|
|
It has been tested on Mac and Linux operating systems.</p>
|
|
<p>Since PyLaGriT is simply a frontend for LaGriT, you will need a lagrit executable to use PyLaGriT.
|
|
To use the paraview and gmv methods, you will need ParaView (<a class="reference external" href="http://www.paraview.org">http://www.paraview.org</a>) and GMV (<a class="reference external" href="http://www.generalmeshviewer.com">http://www.generalmeshviewer.com</a>) installed, respectively.</p>
|
|
<p>To avoid specifying the LaGriT, ParaView, and GMV executable locations, copy the <strong>pylagritrc_example</strong> file:</p>
|
|
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1"># This is an example pylagritrc file. </span>
|
|
<span class="c1"># To use, change its name to pylagritrc or .pylagritrc, uncomment and modify attributes and move to your working directory or your home directory. </span>
|
|
<span class="c1"># The rc file in the working directory will take precedence over the one in your home directory. </span>
|
|
|
|
<span class="c1">#lagrit_exe : '/lagrit/executable/location/lagrit' </span>
|
|
<span class="c1">#gmv_exe : '/gmv/executable/location/gmv' </span>
|
|
<span class="c1">#paraview_exe : '/paraview/executable/location/paraview' </span>
|
|
</pre></div>
|
|
</div>
|
|
<p>in the PyLaGriT folder to your home directory or working directory changing its name to either <strong>pylagritrc</strong> or <strong>.pylagritrc</strong> and uncomment and change the path locations.</p>
|
|
</div>
|
|
<div class="section" id="simple-example">
|
|
<h2>Simple example<a class="headerlink" href="#simple-example" title="Permalink to this headline">¶</a></h2>
|
|
<p>The following is a PyLaGriT script for creating a simple cube shaped mesh using the <a class="reference internal" href="autodoc_pylagrit.html#pylagrit.PyLaGriT.gridder" title="pylagrit.PyLaGriT.gridder"><code class="xref py py-func docutils literal notranslate"><span class="pre">gridder</span></code></a> and <cite>connect <pylagrit.PyLaGriT.connect></cite> methods:</p>
|
|
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="c1"># Import PyLaGriT class from pylagrit module</span>
|
|
<span class="kn">from</span> <span class="nn">pylagrit</span> <span class="kn">import</span> <span class="n">PyLaGriT</span>
|
|
|
|
<span class="c1"># Create PyLaGriT object</span>
|
|
<span class="c1"># This assumes that pylagritrc is being used so that lagrit_exe option does not need to be specified</span>
|
|
<span class="n">l</span> <span class="o">=</span> <span class="n">PyLaGriT</span><span class="p">()</span>
|
|
|
|
<span class="c1"># Create x,y,z arrays for location of points</span>
|
|
<span class="n">x</span> <span class="o">=</span> <span class="nb">range</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="mi">5</span><span class="p">)</span>
|
|
<span class="n">y</span> <span class="o">=</span> <span class="nb">range</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="mi">5</span><span class="p">)</span>
|
|
<span class="n">z</span> <span class="o">=</span> <span class="nb">range</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="mi">5</span><span class="p">)</span>
|
|
|
|
<span class="c1"># Create mesh object using x,y,z arrays</span>
|
|
<span class="n">m</span> <span class="o">=</span> <span class="n">l</span><span class="o">.</span><span class="n">gridder</span><span class="p">(</span><span class="n">x</span><span class="p">,</span><span class="n">y</span><span class="p">,</span><span class="n">z</span><span class="p">)</span>
|
|
|
|
<span class="c1"># Connect points</span>
|
|
<span class="n">m</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
|
|
|
|
<span class="c1"># Visualize connected mesh using ParaView</span>
|
|
<span class="c1"># This assumes that pylagritrc is being used so that exe option does not need to be specified</span>
|
|
<span class="n">m</span><span class="o">.</span><span class="n">paraview</span><span class="p">()</span>
|
|
</pre></div>
|
|
</div>
|
|
<p>The script can be pasted line by line into a Python or IPython terminal, or saved in a file (e.g., <code class="docutils literal notranslate"><span class="pre">script.py</span></code>) and run on the command line as <code class="docutils literal notranslate"><span class="pre">python</span> <span class="pre">script.py</span></code>.</p>
|
|
<p>This will open up ParaView with the mesh loaded:</p>
|
|
<img alt="images/cube.png" src="images/cube.png" />
|
|
</div>
|
|
<div class="section" id="next-steps">
|
|
<h2>Next steps<a class="headerlink" href="#next-steps" title="Permalink to this headline">¶</a></h2>
|
|
<p>Additional example PyLaGriT scripts are provided in the PyLaGriT/examples folder and in the <a class="reference internal" href="autodoc.html#class-docs"><span class="std std-ref">Class Documentation</span></a>.</p>
|
|
<div class="section" id="combining-lagrit-and-python-functionality">
|
|
<h3>Combining LaGriT and Python functionality<a class="headerlink" href="#combining-lagrit-and-python-functionality" title="Permalink to this headline">¶</a></h3>
|
|
<p>An example of using PyLaGriT to facilitate looping over LaGriT functionality is described in the <a class="reference internal" href="autodoc_pylagrit.html#pylagrit.PyLaGriT.merge" title="pylagrit.PyLaGriT.merge"><code class="xref py py-func docutils literal notranslate"><span class="pre">merge</span> <span class="pre">method</span></code></a> documentation, where a mesh is successively copied, translated and merged into a larger mesh.
|
|
Other examples of usage are provided for other methods and more will be added in the future.</p>
|
|
</div>
|
|
<div class="section" id="user-defined-error-checking">
|
|
<h3>User defined error checking<a class="headerlink" href="#user-defined-error-checking" title="Permalink to this headline">¶</a></h3>
|
|
<p>Since PyLaGriT stores the LaGriT terminal output from each command in the PyLaGriT object attribute <code class="docutils literal notranslate"><span class="pre">before</span></code>, user-defined error checking can be easily implemented.
|
|
The example provided with the <a class="reference internal" href="autodoc_eltset.html#pylagrit.EltSet.refine" title="pylagrit.EltSet.refine"><code class="xref py py-func docutils literal notranslate"><span class="pre">refine</span> <span class="pre">method</span></code></a> demonstrates this by checking for the string <cite>The mesh is complete but could not include all points.</cite> in the LaGriT output using <code class="docutils literal notranslate"><span class="pre">lg.before</span></code>.
|
|
In this example, an error message is printed to the screen and the script is aborted.</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
|
|
<div class="sphinxsidebarwrapper">
|
|
<h1 class="logo"><a href="index.html">PyLaGriT</a></h1>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<h3>Navigation</h3>
|
|
<ul class="current">
|
|
<li class="toctree-l1 current"><a class="current reference internal" href="#">Getting Started</a><ul>
|
|
<li class="toctree-l2"><a class="reference internal" href="#installation">Installation</a></li>
|
|
<li class="toctree-l2"><a class="reference internal" href="#simple-example">Simple example</a></li>
|
|
<li class="toctree-l2"><a class="reference internal" href="#next-steps">Next steps</a></li>
|
|
</ul>
|
|
</li>
|
|
<li class="toctree-l1"><a class="reference internal" href="stratigraphic.html">Stratigraphic Hex Mesh Tutorial</a></li>
|
|
<li class="toctree-l1"><a class="reference internal" href="autodoc.html">Class Documentation</a></li>
|
|
</ul>
|
|
|
|
<div class="relations">
|
|
<h3>Related Topics</h3>
|
|
<ul>
|
|
<li><a href="index.html">Documentation overview</a><ul>
|
|
<li>Previous: <a href="index.html" title="previous chapter">PyLaGriT, Python interface for LaGriT</a></li>
|
|
<li>Next: <a href="stratigraphic.html" title="next chapter">Stratigraphic Hex Mesh Tutorial</a></li>
|
|
</ul></li>
|
|
</ul>
|
|
</div>
|
|
<div id="searchbox" style="display: none" role="search">
|
|
<h3>Quick search</h3>
|
|
<div class="searchformwrapper">
|
|
<form class="search" action="search.html" method="get">
|
|
<input type="text" name="q" />
|
|
<input type="submit" value="Go" />
|
|
<input type="hidden" name="check_keywords" value="yes" />
|
|
<input type="hidden" name="area" value="default" />
|
|
</form>
|
|
</div>
|
|
</div>
|
|
<script type="text/javascript">$('#searchbox').show(0);</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="clearer"></div>
|
|
</div>
|
|
<div class="footer">
|
|
©2016, Dylan R. Harp.
|
|
|
|
|
|
|
Powered by <a href="http://sphinx-doc.org/">Sphinx 1.8.5</a>
|
|
& <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a>
|
|
|
|
|
|
|
<a href="sources/gettingstarted.rst.txt"
|
|
rel="nofollow">Page source</a>
|
|
</div>
|
|
|
|
|
|
|
|
|
|
</body>
|
|
</html>
|