Skip to content

Commit

Permalink
Generating symmetric tensors in 3d was broken due to bug which instea…
Browse files Browse the repository at this point in the history
…d returned 2d equivalents. This was possibly completely missed in 3d where people were immediately taking the invariant of the results.

Also some minor documentation updates.
  • Loading branch information
jmansour committed Mar 8, 2017
1 parent 04ea9a5 commit 1629e77
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 25 deletions.
2 changes: 1 addition & 1 deletion docs/api_doc/_modules/underworld.html
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ <h1>Source code for underworld</h1><div class="highlight"><pre>
<span class="sd">on a geological timescale.</span>
<span class="sd">&quot;&quot;&quot;</span>

<span class="n">__version__</span> <span class="o">=</span> <span class="s2">&quot;2.3.0-dev&quot;</span>
<span class="n">__version__</span> <span class="o">=</span> <span class="s2">&quot;2.2.1b&quot;</span>

<span class="c1"># ok, first need to change default python dlopen flags to global</span>
<span class="c1"># this is because when python imports the module, the shared libraries are loaded as RTLD_LOCAL</span>
Expand Down
12 changes: 5 additions & 7 deletions docs/api_doc/_modules/underworld/function/misc.html
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ <h1>Source code for underworld.function.misc</h1><div class="highlight"><pre>
<span class="sd"> </span>
<span class="sd"> Parameters</span>
<span class="sd"> ----------</span>
<span class="sd"> value: int,float,bool. (iterables permitted)</span>
<span class="sd"> value: int,float,bool, iterable</span>
<span class="sd"> The value the function should return. Note that iterable objects</span>
<span class="sd"> which contain valid types are permitted, but must be homogeneous</span>
<span class="sd"> in their type.</span>
Expand Down Expand Up @@ -248,14 +248,13 @@ <h1>Source code for underworld.function.misc</h1><div class="highlight"><pre>

<div class="viewcode-block" id="max"><a class="viewcode-back" href="../../../underworld.function.misc.html#underworld.function.misc.max">[docs]</a><span class="k">class</span> <span class="nc">max</span><span class="p">(</span><span class="n">_Function</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot; </span>
<span class="sd"> max function. Returns the maximum of the results returned from </span>
<span class="sd"> its two argument function.</span>
<span class="sd"> Returns the maximum of the results returned from its two argument function.</span>
<span class="sd"> </span>
<span class="sd"> Parameters</span>
<span class="sd"> ----------</span>
<span class="sd"> fn1: underworld.function.Function</span>
<span class="sd"> First argument function. Function must return a float type.</span>
<span class="sd"> fn1: underworld.function.Function</span>
<span class="sd"> fn2: underworld.function.Function</span>
<span class="sd"> Second argument function. Function must return a float type.</span>
<span class="sd"> </span>
<span class="sd"> Example</span>
Expand Down Expand Up @@ -305,14 +304,13 @@ <h1>Source code for underworld.function.misc</h1><div class="highlight"><pre>

<div class="viewcode-block" id="min"><a class="viewcode-back" href="../../../underworld.function.misc.html#underworld.function.misc.min">[docs]</a><span class="k">class</span> <span class="nc">min</span><span class="p">(</span><span class="n">_Function</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot; </span>
<span class="sd"> min function. Returns the minimum of the results returned from</span>
<span class="sd"> its two argument function.</span>
<span class="sd"> Returns the minimum of the results returned from its two argument function.</span>
<span class="sd"> </span>
<span class="sd"> Parameters</span>
<span class="sd"> ----------</span>
<span class="sd"> fn1: underworld.function.Function</span>
<span class="sd"> First argument function. Function must return a float type.</span>
<span class="sd"> fn1: underworld.function.Function</span>
<span class="sd"> fn2: underworld.function.Function</span>
<span class="sd"> Second argument function. Function must return a float type.</span>
<span class="sd"> </span>
<span class="sd"> Example</span>
Expand Down
16 changes: 7 additions & 9 deletions docs/api_doc/underworld.function.misc.html
Original file line number Diff line number Diff line change
Expand Up @@ -163,13 +163,13 @@ <h3>classes:<a class="headerlink" href="#classes" title="Permalink to this headl
</colgroup>
<tbody valign="top">
<tr class="row-odd"><td><a class="reference internal" href="#underworld.function.misc.max" title="underworld.function.misc.max"><code class="xref py py-obj docutils literal"><span class="pre">underworld.function.misc.max</span></code></a></td>
<td>max function. Returns the maximum of the results returned from</td>
<td>Returns the maximum of the results returned from its two argument function.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#underworld.function.misc.constant" title="underworld.function.misc.constant"><code class="xref py py-obj docutils literal"><span class="pre">underworld.function.misc.constant</span></code></a></td>
<td>This function returns a constant value.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#underworld.function.misc.min" title="underworld.function.misc.min"><code class="xref py py-obj docutils literal"><span class="pre">underworld.function.misc.min</span></code></a></td>
<td>min function. Returns the minimum of the results returned from</td>
<td>Returns the minimum of the results returned from its two argument function.</td>
</tr>
</tbody>
</table>
Expand All @@ -183,15 +183,14 @@ <h3>classes:<a class="headerlink" href="#id1" title="Permalink to this headline"
<dt id="underworld.function.misc.max">
<em class="property">class </em><code class="descclassname">underworld.function.misc.</code><code class="descname">max</code><span class="sig-paren">(</span><em>fn1</em>, <em>fn2</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/underworld/function/misc.html#max"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#underworld.function.misc.max" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">underworld.function._function.Function</span></code></p>
<p>max function. Returns the maximum of the results returned from
its two argument function.</p>
<p>Returns the maximum of the results returned from its two argument function.</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>fn1</strong> (<a class="reference internal" href="underworld.function.html#underworld.function.Function" title="underworld.function.Function"><em>underworld.function.Function</em></a>) &#8211; First argument function. Function must return a float type.</li>
<li><strong>fn1</strong> &#8211; Second argument function. Function must return a float type.</li>
<li><strong>fn2</strong> (<a class="reference internal" href="underworld.function.html#underworld.function.Function" title="underworld.function.Function"><em>underworld.function.Function</em></a>) &#8211; Second argument function. Function must return a float type.</li>
</ul>
</td>
</tr>
Expand Down Expand Up @@ -238,7 +237,7 @@ <h3>classes:<a class="headerlink" href="#id1" title="Permalink to this headline"
<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"><strong>value</strong> (<em>int</em><em>,</em><em>float</em><em>,</em><em>bool.</em><em> (</em><em>iterables permitted</em><em>)</em><em></em>) &#8211; The value the function should return. Note that iterable objects
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>value</strong> (<em>int</em><em>,</em><em>float</em><em>,</em><em>bool</em><em>, </em><em>iterable</em>) &#8211; The value the function should return. Note that iterable objects
which contain valid types are permitted, but must be homogeneous
in their type.</td>
</tr>
Expand Down Expand Up @@ -279,15 +278,14 @@ <h3>classes:<a class="headerlink" href="#id1" title="Permalink to this headline"
<dt id="underworld.function.misc.min">
<em class="property">class </em><code class="descclassname">underworld.function.misc.</code><code class="descname">min</code><span class="sig-paren">(</span><em>fn1</em>, <em>fn2</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/underworld/function/misc.html#min"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#underworld.function.misc.min" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">underworld.function._function.Function</span></code></p>
<p>min function. Returns the minimum of the results returned from
its two argument function.</p>
<p>Returns the minimum of the results returned from its two argument function.</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>fn1</strong> (<a class="reference internal" href="underworld.function.html#underworld.function.Function" title="underworld.function.Function"><em>underworld.function.Function</em></a>) &#8211; First argument function. Function must return a float type.</li>
<li><strong>fn1</strong> &#8211; Second argument function. Function must return a float type.</li>
<li><strong>fn2</strong> (<a class="reference internal" href="underworld.function.html#underworld.function.Function" title="underworld.function.Function"><em>underworld.function.Function</em></a>) &#8211; Second argument function. Function must return a float type.</li>
</ul>
</td>
</tr>
Expand Down
2 changes: 1 addition & 1 deletion libUnderworld/Underworld/Function/src/Tensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ Fn::TensorFunc::func Fn::TensorFunc::getFunction( IOsptr sample_input )
if ( _partFunc == get_symmetric ) {
if (iotype!=FunctionIO::Tensor)
throw std::invalid_argument("TensorFunc expects Tensor input for 'get_symmetric' function.");
unsigned outsize = (dim = 2) ? 3 : 6;
unsigned outsize = (dim==2) ? 3 : 6;
std::shared_ptr<IO_double> _output_sp = std::make_shared<IO_double>(outsize,FunctionIO::SymmetricTensor);
IO_double* _output = _output_sp.get();
return [_output,_output_sp,_func,dim](IOsptr input)->IOsptr {
Expand Down
12 changes: 5 additions & 7 deletions underworld/function/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class constant(_Function):
Parameters
----------
value: int,float,bool. (iterables permitted)
value: int,float,bool, iterable
The value the function should return. Note that iterable objects
which contain valid types are permitted, but must be homogeneous
in their type.
Expand Down Expand Up @@ -117,14 +117,13 @@ def _GetIOForPyInput(self, value):

class max(_Function):
"""
max function. Returns the maximum of the results returned from
its two argument function.
Returns the maximum of the results returned from its two argument function.
Parameters
----------
fn1: underworld.function.Function
First argument function. Function must return a float type.
fn1: underworld.function.Function
fn2: underworld.function.Function
Second argument function. Function must return a float type.
Example
Expand Down Expand Up @@ -174,14 +173,13 @@ def __init__(self, fn1, fn2, **kwargs):

class min(_Function):
"""
min function. Returns the minimum of the results returned from
its two argument function.
Returns the minimum of the results returned from its two argument function.
Parameters
----------
fn1: underworld.function.Function
First argument function. Function must return a float type.
fn1: underworld.function.Function
fn2: underworld.function.Function
Second argument function. Function must return a float type.
Example
Expand Down

0 comments on commit 1629e77

Please sign in to comment.