Sophie

Sophie

distrib > Fedora > 14 > x86_64 > by-pkgid > 1099e73f16f15ba3cf656e619f52a447 > files > 173

ompl-devel-0.9.5-1.fc14.x86_64.rpm

<!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"/>
<title>OMPL: src/ompl/datastructures/GridB.h Source File</title>
<meta name="author" content="Ioan A. Șucan, Mark Moll, Lydia E. Kavraki">
<link rel="stylesheet" href="../css/screen.css" type="text/css" media="screen, projection">
<link rel="stylesheet" href="../css/print.css" type="text/css" media="print">
<!--[if lt IE 7]>
<script type="text/javascript" src="../js/jquery/jquery.js"></script>
<script type="text/javascript" src="../js/jquery/jquery.dropdown.js"></script>
<![endif]-->
<script type="text/javaScript" src="search/search.js"></script>
<script type="text/javascript">
  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-9156598-2']);
  _gaq.push(['_trackPageview']);
  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();
</script>
</head>
<body onload='searchBox.OnSelectItem(0);'>
<script type="text/javascript"><!--
var searchBox = new SearchBox("searchBox", "search",false,'Search API');
--></script>
<div class="navigation" id="top">
  <div class="tabs" id="ompltitle">
    <ul class="tablist">
      <li>The Open Motion Planning Library</li>
      <li id="searchli">
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search API" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)"
               onblur="searchBox.OnSearchFieldFocus(false)"
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>

  <ul id="nav" class="dropdown">
    <li class="first"><a href="index.html">Home</a></li>
    <li><a href="download.html">Download</a></li>
    <li><a href="documentation.html">Documentation</a></li>
    <li><span class="dir">Code API</span>
      <ul>
        <li><a href="api_overview.html">API Overview</a></li>
        <li><a href="namespaces.html">Namespaces</a></li>
        <li><a href="annotated.html">Classes</a></li>
        <li><a href="files.html">Files</a></li>
        <li><a href="dirs.html">Directories</a></li>
      </ul>
    </li>
    <li><span class="dir">Community</span>
      <ul>
        <li><a href="developers.html">Developers</a></li>
        <li><a href="thirdparty.html">Contributions</a></li>
        <li><a href="education.html">Education</a></li>
        <li><a href="gallery.html">Gallery</a></li>
      </ul>
    </li>
    <li><span class="dir">About</span>
      <ul>
        <li><a href="license.html">License</a></li>
        <li><a href="citations.html">Citations</a></li>
        <li><a href="acknowledgements.html">Acknowledgments</a></li>
        <li><a href="contact.html">Contact Us</a></li>
      </ul>
    </li>
  </ul>
</div>

<!--- window showing the filter options -->
<div id="MSearchSelectWindow"
  onmouseover="return searchBox.OnSearchSelectShow()"
  onmouseout="return searchBox.OnSearchSelectHide()"
  onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerator</a></div>

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

<div class="container">
  <div class="span-22 push-2 first last">
  <div>
<!-- Generated by Doxygen 1.7.4 -->
<script type="text/javascript"><!--
var searchBox = new SearchBox("searchBox", "search",false,'Search');
--></script>
  <div id="nav-path" class="navpath">
    <ul>
      <li class="navelem"><a class="el" href="dir_f5421e52a658cd938113ed6044324834.html">src</a>      </li>
      <li class="navelem"><a class="el" href="dir_ae92c2ff78847f0cb49b545f9089bbbc.html">ompl</a>      </li>
      <li class="navelem"><a class="el" href="dir_bcc018587a1660af6e54d7cc713e88f2.html">datastructures</a>      </li>
    </ul>
  </div>
</div>
<div class="header">
  <div class="headertitle">
<div class="title">GridB.h</div>  </div>
</div>
<div class="contents">
<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*********************************************************************</span>
<a name="l00002"></a>00002 <span class="comment">* Software License Agreement (BSD License)</span>
<a name="l00003"></a>00003 <span class="comment">*</span>
<a name="l00004"></a>00004 <span class="comment">*  Copyright (c) 2008, Willow Garage, Inc.</span>
<a name="l00005"></a>00005 <span class="comment">*  All rights reserved.</span>
<a name="l00006"></a>00006 <span class="comment">*</span>
<a name="l00007"></a>00007 <span class="comment">*  Redistribution and use in source and binary forms, with or without</span>
<a name="l00008"></a>00008 <span class="comment">*  modification, are permitted provided that the following conditions</span>
<a name="l00009"></a>00009 <span class="comment">*  are met:</span>
<a name="l00010"></a>00010 <span class="comment">*</span>
<a name="l00011"></a>00011 <span class="comment">*   * Redistributions of source code must retain the above copyright</span>
<a name="l00012"></a>00012 <span class="comment">*     notice, this list of conditions and the following disclaimer.</span>
<a name="l00013"></a>00013 <span class="comment">*   * Redistributions in binary form must reproduce the above</span>
<a name="l00014"></a>00014 <span class="comment">*     copyright notice, this list of conditions and the following</span>
<a name="l00015"></a>00015 <span class="comment">*     disclaimer in the documentation and/or other materials provided</span>
<a name="l00016"></a>00016 <span class="comment">*     with the distribution.</span>
<a name="l00017"></a>00017 <span class="comment">*   * Neither the name of the Willow Garage nor the names of its</span>
<a name="l00018"></a>00018 <span class="comment">*     contributors may be used to endorse or promote products derived</span>
<a name="l00019"></a>00019 <span class="comment">*     from this software without specific prior written permission.</span>
<a name="l00020"></a>00020 <span class="comment">*</span>
<a name="l00021"></a>00021 <span class="comment">*  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS</span>
<a name="l00022"></a>00022 <span class="comment">*  &quot;AS IS&quot; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT</span>
<a name="l00023"></a>00023 <span class="comment">*  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS</span>
<a name="l00024"></a>00024 <span class="comment">*  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE</span>
<a name="l00025"></a>00025 <span class="comment">*  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,</span>
<a name="l00026"></a>00026 <span class="comment">*  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,</span>
<a name="l00027"></a>00027 <span class="comment">*  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;</span>
<a name="l00028"></a>00028 <span class="comment">*  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER</span>
<a name="l00029"></a>00029 <span class="comment">*  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT</span>
<a name="l00030"></a>00030 <span class="comment">*  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN</span>
<a name="l00031"></a>00031 <span class="comment">*  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE</span>
<a name="l00032"></a>00032 <span class="comment">*  POSSIBILITY OF SUCH DAMAGE.</span>
<a name="l00033"></a>00033 <span class="comment">*********************************************************************/</span>
<a name="l00034"></a>00034 
<a name="l00035"></a>00035 <span class="comment">/* Author: Ioan Sucan */</span>
<a name="l00036"></a>00036 
<a name="l00037"></a>00037 <span class="preprocessor">#ifndef OMPL_DATASTRUCTURES_GRID_B_</span>
<a name="l00038"></a>00038 <span class="preprocessor"></span><span class="preprocessor">#define OMPL_DATASTRUCTURES_GRID_B_</span>
<a name="l00039"></a>00039 <span class="preprocessor"></span>
<a name="l00040"></a>00040 <span class="preprocessor">#include &quot;ompl/datastructures/GridN.h&quot;</span>
<a name="l00041"></a>00041 <span class="preprocessor">#include &quot;ompl/datastructures/BinaryHeap.h&quot;</span>
<a name="l00042"></a>00042 
<a name="l00043"></a>00043 <span class="keyword">namespace </span>ompl
<a name="l00044"></a>00044 {
<a name="l00045"></a>00045 
<a name="l00048"></a>00048     <span class="keyword">template</span> &lt; <span class="keyword">typename</span> _T,
<a name="l00049"></a>00049                <span class="keyword">class </span>LessThanExternal = std::less&lt;_T&gt;,
<a name="l00050"></a>00050                <span class="keyword">class </span>LessThanInternal = LessThanExternal &gt;
<a name="l00051"></a><a class="code" href="classompl_1_1GridB.html">00051</a>     <span class="keyword">class </span><a class="code" href="classompl_1_1GridB.html" title="This class defines a grid that keeps track of its boundary: it distinguishes between interior and ext...">GridB</a> : <span class="keyword">public</span> <a class="code" href="classompl_1_1GridN.html" title="Representation of a grid where cells keep track of how many neighbors they have.">GridN</a>&lt;_T&gt;
<a name="l00052"></a>00052     {
<a name="l00053"></a>00053     <span class="keyword">public</span>:
<a name="l00054"></a>00054 
<a name="l00056"></a><a class="code" href="classompl_1_1GridB.html#a7fd1b48d2b5451f40c57f4e3fba4e4c3">00056</a>         <span class="keyword">typedef</span> <span class="keyword">typename</span> <a class="code" href="structompl_1_1GridN_1_1Cell.html" title="Definition of a cell in this grid.">GridN&lt;_T&gt;::Cell</a>      <a class="code" href="classompl_1_1GridB.html#a7fd1b48d2b5451f40c57f4e3fba4e4c3" title="Definition of a cell in this grid.">Cell</a>;
<a name="l00057"></a>00057 
<a name="l00059"></a><a class="code" href="classompl_1_1GridB.html#a8af7231656ec5aac513048369d7388d8">00059</a>         <span class="keyword">typedef</span> <span class="keyword">typename</span> <a class="code" href="classompl_1_1GridN.html#a44c57859eaebc6bdc3c9c453662ac252" title="The datatype for arrays of cells.">GridN&lt;_T&gt;::CellArray</a> <a class="code" href="classompl_1_1GridB.html#a8af7231656ec5aac513048369d7388d8" title="The datatype for arrays of cells.">CellArray</a>;
<a name="l00060"></a>00060 
<a name="l00062"></a><a class="code" href="classompl_1_1GridB.html#ae1ffa2705f26a8916307afa7b020ba49">00062</a>         <span class="keyword">typedef</span> <span class="keyword">typename</span> <a class="code" href="classompl_1_1GridN.html#ae15a0d9d76a01bc9f98afbed8ce23342" title="Datatype for cell coordinates.">GridN&lt;_T&gt;::Coord</a>     <a class="code" href="classompl_1_1GridB.html#ae1ffa2705f26a8916307afa7b020ba49" title="Datatype for cell coordinates.">Coord</a>;
<a name="l00063"></a>00063 
<a name="l00064"></a>00064     <span class="keyword">protected</span>:
<a name="l00065"></a>00065 
<a name="l00067"></a>00067         <span class="comment">// the type of cell here needs an extra pointer to allow the updatable heap to work fast</span>
<a name="l00068"></a>00068         <span class="comment">// however, this stays hidden from the user</span>
<a name="l00069"></a>00069         <span class="keyword">struct </span>CellX : <span class="keyword">public</span> <a class="code" href="classompl_1_1GridB.html#a7fd1b48d2b5451f40c57f4e3fba4e4c3" title="Definition of a cell in this grid.">Cell</a>
<a name="l00070"></a>00070         {
<a name="l00071"></a>00071             CellX(<span class="keywordtype">void</span>) : <a class="code" href="classompl_1_1GridB.html#a7fd1b48d2b5451f40c57f4e3fba4e4c3" title="Definition of a cell in this grid.">Cell</a>()
<a name="l00072"></a>00072             {
<a name="l00073"></a>00073             }
<a name="l00074"></a>00074 
<a name="l00075"></a>00075             <span class="keyword">virtual</span> ~CellX(<span class="keywordtype">void</span>)
<a name="l00076"></a>00076             {
<a name="l00077"></a>00077             }
<a name="l00078"></a>00078 
<a name="l00079"></a>00079             <span class="keywordtype">void</span> *heapElement;
<a name="l00080"></a>00080         };
<a name="l00081"></a>00081 
<a name="l00083"></a>00083 
<a name="l00084"></a>00084     <span class="keyword">public</span>:
<a name="l00085"></a>00085 
<a name="l00087"></a><a class="code" href="classompl_1_1GridB.html#a1023a1ca22bfe01e260ed8c975407aea">00087</a>         <span class="keyword">typedef</span> void (*<a class="code" href="classompl_1_1GridB.html#a1023a1ca22bfe01e260ed8c975407aea">EventCellUpdate</a>)(<a class="code" href="classompl_1_1GridB.html#a7fd1b48d2b5451f40c57f4e3fba4e4c3" title="Definition of a cell in this grid.">Cell</a>*, <span class="keywordtype">void</span>*);
<a name="l00088"></a>00088 
<a name="l00090"></a>00090         <span class="keyword">explicit</span>
<a name="l00091"></a><a class="code" href="classompl_1_1GridB.html#a6f51bf34a19905e875d6bdffa3246b11">00091</a>         <a class="code" href="classompl_1_1GridB.html#a6f51bf34a19905e875d6bdffa3246b11" title="Constructor.">GridB</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> dimension) : <a class="code" href="classompl_1_1GridN.html" title="Representation of a grid where cells keep track of how many neighbors they have.">GridN</a>&lt;_T&gt;(dimension)
<a name="l00092"></a>00092         {
<a name="l00093"></a>00093             <a class="code" href="classompl_1_1GridB.html#a3f5dabc334b16206f08ca6845b750e17" title="Set the update procedure for the heaps of internal and external cells.">setupHeaps</a>();
<a name="l00094"></a>00094         }
<a name="l00095"></a>00095 
<a name="l00096"></a>00096         <span class="keyword">virtual</span> ~<a class="code" href="classompl_1_1GridB.html" title="This class defines a grid that keeps track of its boundary: it distinguishes between interior and ext...">GridB</a>(<span class="keywordtype">void</span>)
<a name="l00097"></a>00097         {
<a name="l00098"></a>00098             <a class="code" href="classompl_1_1GridB.html#a600b0fb6110d0a9cd0c8a2d65bbec4e8" title="Clear the data from both heaps.">clearHeaps</a>();
<a name="l00099"></a>00099         }
<a name="l00100"></a>00100 
<a name="l00103"></a><a class="code" href="classompl_1_1GridB.html#a89bffe3573ef977f63b4ab4ff7759705">00103</a>         <span class="keywordtype">void</span> <a class="code" href="classompl_1_1GridB.html#a89bffe3573ef977f63b4ab4ff7759705">onCellUpdate</a>(<a class="code" href="classompl_1_1GridB.html#a1023a1ca22bfe01e260ed8c975407aea">EventCellUpdate</a> event, <span class="keywordtype">void</span> *arg)
<a name="l00104"></a>00104         {
<a name="l00105"></a>00105             <a class="code" href="classompl_1_1GridB.html#a21a662edc0904ba14495d44b2088669f" title="Pointer to function to be called when a cell needs to be updated.">eventCellUpdate_</a> = event;
<a name="l00106"></a>00106             <a class="code" href="classompl_1_1GridB.html#ab229dc7aca157fe152411fe75ad2f73f" title="Data to be passed to function pointer above.">eventCellUpdateData_</a> = arg;
<a name="l00107"></a>00107         }
<a name="l00108"></a>00108 
<a name="l00110"></a><a class="code" href="classompl_1_1GridB.html#a904761417572e6715c13028ba5c3ee13">00110</a>         <a class="code" href="classompl_1_1GridB.html#a7fd1b48d2b5451f40c57f4e3fba4e4c3" title="Definition of a cell in this grid.">Cell</a>* <a class="code" href="classompl_1_1GridB.html#a904761417572e6715c13028ba5c3ee13" title="Return the cell that is at the top of the heap maintaining internal cells.">topInternal</a>(<span class="keywordtype">void</span>)<span class="keyword"> const</span>
<a name="l00111"></a>00111 <span class="keyword">        </span>{
<a name="l00112"></a>00112             <a class="code" href="classompl_1_1GridB.html#a7fd1b48d2b5451f40c57f4e3fba4e4c3" title="Definition of a cell in this grid.">Cell</a>* top = <span class="keyword">static_cast&lt;</span><a class="code" href="classompl_1_1GridB.html#a7fd1b48d2b5451f40c57f4e3fba4e4c3" title="Definition of a cell in this grid.">Cell</a>*<span class="keyword">&gt;</span>(<a class="code" href="classompl_1_1GridB.html#a00fa01d1103ced09fb7ee3ebee187665" title="The heap of interior cells.">internal_</a>.<a class="code" href="classompl_1_1BinaryHeap.html#a4288f352550d26811383a45b2a9fb6e7" title="Return the top element. NULL for an empty heap.">top</a>()-&gt;data);
<a name="l00113"></a>00113             <span class="keywordflow">return</span> top ? top : <a class="code" href="classompl_1_1GridB.html#af42768c3fa822baeddc138924ac26d50" title="Return the cell that is at the top of the heap maintaining external cells.">topExternal</a>();
<a name="l00114"></a>00114         }
<a name="l00115"></a>00115 
<a name="l00117"></a><a class="code" href="classompl_1_1GridB.html#af42768c3fa822baeddc138924ac26d50">00117</a>         <a class="code" href="classompl_1_1GridB.html#a7fd1b48d2b5451f40c57f4e3fba4e4c3" title="Definition of a cell in this grid.">Cell</a>* <a class="code" href="classompl_1_1GridB.html#af42768c3fa822baeddc138924ac26d50" title="Return the cell that is at the top of the heap maintaining external cells.">topExternal</a>(<span class="keywordtype">void</span>)<span class="keyword"> const</span>
<a name="l00118"></a>00118 <span class="keyword">        </span>{
<a name="l00119"></a>00119             <a class="code" href="classompl_1_1GridB.html#a7fd1b48d2b5451f40c57f4e3fba4e4c3" title="Definition of a cell in this grid.">Cell</a>* top = <span class="keyword">static_cast&lt;</span><a class="code" href="classompl_1_1GridB.html#a7fd1b48d2b5451f40c57f4e3fba4e4c3" title="Definition of a cell in this grid.">Cell</a>*<span class="keyword">&gt;</span>(<a class="code" href="classompl_1_1GridB.html#afede0d811f4f9b53abc0f1945b871516" title="The heap of external cells.">external_</a>.<a class="code" href="classompl_1_1BinaryHeap.html#a4288f352550d26811383a45b2a9fb6e7" title="Return the top element. NULL for an empty heap.">top</a>()-&gt;data);
<a name="l00120"></a>00120             <span class="keywordflow">return</span> top ? top : <a class="code" href="classompl_1_1GridB.html#a904761417572e6715c13028ba5c3ee13" title="Return the cell that is at the top of the heap maintaining internal cells.">topInternal</a>();
<a name="l00121"></a>00121         }
<a name="l00122"></a>00122 
<a name="l00124"></a><a class="code" href="classompl_1_1GridB.html#aacfbc62700a1a97f5312d8ea58ff5ca2">00124</a>         <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classompl_1_1GridB.html#aacfbc62700a1a97f5312d8ea58ff5ca2" title="Return the number of internal cells.">countInternal</a>(<span class="keywordtype">void</span>)<span class="keyword"> const</span>
<a name="l00125"></a>00125 <span class="keyword">        </span>{
<a name="l00126"></a>00126             <span class="keywordflow">return</span> <a class="code" href="classompl_1_1GridB.html#a00fa01d1103ced09fb7ee3ebee187665" title="The heap of interior cells.">internal_</a>.<a class="code" href="classompl_1_1BinaryHeap.html#af04187686dd607db2bca3e8bf45b8d12" title="Get the number of elements in the heap.">size</a>();
<a name="l00127"></a>00127         }
<a name="l00128"></a>00128 
<a name="l00130"></a><a class="code" href="classompl_1_1GridB.html#af91a6687eea882c5f07f7679d94a08b5">00130</a>         <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classompl_1_1GridB.html#af91a6687eea882c5f07f7679d94a08b5" title="Return the number of external cells.">countExternal</a>(<span class="keywordtype">void</span>)<span class="keyword"> const</span>
<a name="l00131"></a>00131 <span class="keyword">        </span>{
<a name="l00132"></a>00132             <span class="keywordflow">return</span> <a class="code" href="classompl_1_1GridB.html#afede0d811f4f9b53abc0f1945b871516" title="The heap of external cells.">external_</a>.<a class="code" href="classompl_1_1BinaryHeap.html#af04187686dd607db2bca3e8bf45b8d12" title="Get the number of elements in the heap.">size</a>();
<a name="l00133"></a>00133         }
<a name="l00134"></a>00134 
<a name="l00136"></a><a class="code" href="classompl_1_1GridB.html#a63f2125ed08e7f46a199fe1782482a06">00136</a>         <span class="keywordtype">double</span> <a class="code" href="classompl_1_1GridB.html#a63f2125ed08e7f46a199fe1782482a06" title="Return the fraction of external cells.">fracExternal</a>(<span class="keywordtype">void</span>)<span class="keyword"> const</span>
<a name="l00137"></a>00137 <span class="keyword">        </span>{
<a name="l00138"></a>00138             <span class="keywordflow">return</span> <a class="code" href="classompl_1_1GridB.html#afede0d811f4f9b53abc0f1945b871516" title="The heap of external cells.">external_</a>.<a class="code" href="classompl_1_1BinaryHeap.html#a486a10e941494a63e5dea950e90f39bf" title="Check if the heap is empty.">empty</a>() ? 0.0 : (double)(<a class="code" href="classompl_1_1GridB.html#afede0d811f4f9b53abc0f1945b871516" title="The heap of external cells.">external_</a>.<a class="code" href="classompl_1_1BinaryHeap.html#af04187686dd607db2bca3e8bf45b8d12" title="Get the number of elements in the heap.">size</a>()) / (<span class="keywordtype">double</span>)(<a class="code" href="classompl_1_1GridB.html#afede0d811f4f9b53abc0f1945b871516" title="The heap of external cells.">external_</a>.<a class="code" href="classompl_1_1BinaryHeap.html#af04187686dd607db2bca3e8bf45b8d12" title="Get the number of elements in the heap.">size</a>() + <a class="code" href="classompl_1_1GridB.html#a00fa01d1103ced09fb7ee3ebee187665" title="The heap of interior cells.">internal_</a>.<a class="code" href="classompl_1_1BinaryHeap.html#af04187686dd607db2bca3e8bf45b8d12" title="Get the number of elements in the heap.">size</a>());
<a name="l00139"></a>00139         }
<a name="l00140"></a>00140 
<a name="l00142"></a><a class="code" href="classompl_1_1GridB.html#a70a922c149cb89db3f0b24f463c41a04">00142</a>         <span class="keywordtype">double</span> <a class="code" href="classompl_1_1GridB.html#a70a922c149cb89db3f0b24f463c41a04" title="Return the fraction of internal cells.">fracInternal</a>(<span class="keywordtype">void</span>)<span class="keyword"> const</span>
<a name="l00143"></a>00143 <span class="keyword">        </span>{
<a name="l00144"></a>00144             <span class="keywordflow">return</span> 1.0 - <a class="code" href="classompl_1_1GridB.html#a63f2125ed08e7f46a199fe1782482a06" title="Return the fraction of external cells.">fracExternal</a>();
<a name="l00145"></a>00145         }
<a name="l00146"></a>00146 
<a name="l00148"></a><a class="code" href="classompl_1_1GridB.html#aceb50d07f1b2bdb195df8ef2c06999e7">00148</a>         <span class="keywordtype">void</span> <a class="code" href="classompl_1_1GridB.html#aceb50d07f1b2bdb195df8ef2c06999e7" title="Update the position in the heaps for a particular cell.">update</a>(<a class="code" href="classompl_1_1GridB.html#a7fd1b48d2b5451f40c57f4e3fba4e4c3" title="Definition of a cell in this grid.">Cell</a>* cell)
<a name="l00149"></a>00149         {
<a name="l00150"></a>00150             <a class="code" href="classompl_1_1GridB.html#a21a662edc0904ba14495d44b2088669f" title="Pointer to function to be called when a cell needs to be updated.">eventCellUpdate_</a>(cell, <a class="code" href="classompl_1_1GridB.html#ab229dc7aca157fe152411fe75ad2f73f" title="Data to be passed to function pointer above.">eventCellUpdateData_</a>);
<a name="l00151"></a>00151             <span class="keywordflow">if</span> (cell-&gt;border)
<a name="l00152"></a>00152                 <a class="code" href="classompl_1_1GridB.html#afede0d811f4f9b53abc0f1945b871516" title="The heap of external cells.">external_</a>.<a class="code" href="classompl_1_1BinaryHeap.html#a8114dc53c4239fe0e199106386898ce3" title="Update an element in the heap.">update</a>(reinterpret_cast&lt;typename externalBHeap::Element*&gt;
<a name="l00153"></a>00153                                   (static_cast&lt;CellX*&gt;(cell)-&gt;heapElement));
<a name="l00154"></a>00154             <span class="keywordflow">else</span>
<a name="l00155"></a>00155                 <a class="code" href="classompl_1_1GridB.html#a00fa01d1103ced09fb7ee3ebee187665" title="The heap of interior cells.">internal_</a>.<a class="code" href="classompl_1_1BinaryHeap.html#a8114dc53c4239fe0e199106386898ce3" title="Update an element in the heap.">update</a>(reinterpret_cast&lt;typename internalBHeap::Element*&gt;
<a name="l00156"></a>00156                                   (static_cast&lt;CellX*&gt;(cell)-&gt;heapElement));
<a name="l00157"></a>00157         }
<a name="l00158"></a>00158 
<a name="l00160"></a><a class="code" href="classompl_1_1GridB.html#ab7ffc08ce1a2547b5adbfad0672d4935">00160</a>         <span class="keywordtype">void</span> <a class="code" href="classompl_1_1GridB.html#ab7ffc08ce1a2547b5adbfad0672d4935" title="Update all cells and reconstruct the heaps.">updateAll</a>(<span class="keywordtype">void</span>)
<a name="l00161"></a>00161         {
<a name="l00162"></a>00162             std::vector&lt; Cell* &gt; cells;
<a name="l00163"></a>00163             this-&gt;<a class="code" href="classompl_1_1GridN.html#a1bc2efb9f3533a98381ee2e12da28117" title="Get the set of instantiated cells in the grid.">getCells</a>(cells);
<a name="l00164"></a>00164             <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = cells.size() - 1 ; i &gt;= 0 ; --i)
<a name="l00165"></a>00165                 <a class="code" href="classompl_1_1GridB.html#a21a662edc0904ba14495d44b2088669f" title="Pointer to function to be called when a cell needs to be updated.">eventCellUpdate_</a>(cells[i], <a class="code" href="classompl_1_1GridB.html#ab229dc7aca157fe152411fe75ad2f73f" title="Data to be passed to function pointer above.">eventCellUpdateData_</a>);
<a name="l00166"></a>00166             <a class="code" href="classompl_1_1GridB.html#afede0d811f4f9b53abc0f1945b871516" title="The heap of external cells.">external_</a>.<a class="code" href="classompl_1_1BinaryHeap.html#aa1e483f2aea8cacf7f0ae4587d212eb2" title="Rebuild the heap.">rebuild</a>();
<a name="l00167"></a>00167             <a class="code" href="classompl_1_1GridB.html#a00fa01d1103ced09fb7ee3ebee187665" title="The heap of interior cells.">internal_</a>.<a class="code" href="classompl_1_1BinaryHeap.html#aa1e483f2aea8cacf7f0ae4587d212eb2" title="Rebuild the heap.">rebuild</a>();
<a name="l00168"></a>00168         }
<a name="l00169"></a>00169 
<a name="l00171"></a><a class="code" href="classompl_1_1GridB.html#a13473103dede044e44d731b094ea6515">00171</a>         <span class="keyword">virtual</span> <a class="code" href="classompl_1_1GridB.html#a7fd1b48d2b5451f40c57f4e3fba4e4c3" title="Definition of a cell in this grid.">Cell</a>* <a class="code" href="classompl_1_1GridB.html#a13473103dede044e44d731b094ea6515" title="Create a cell but do not add it to the grid; update neighboring cells however.">createCell</a>(<span class="keyword">const</span> <a class="code" href="classompl_1_1Grid.html#ada6a72bd91ec78dd8a0806c00055d917" title="Definition of a coordinate within this grid.">Coord</a>&amp; coord, <a class="code" href="classompl_1_1Grid.html#a75eda082fd346c84697130d347c1eb2f" title="The datatype for arrays of cells.">CellArray</a> *nbh = NULL)
<a name="l00172"></a>00172         {
<a name="l00173"></a>00173             CellX* cell = <span class="keyword">new</span> CellX();
<a name="l00174"></a>00174             cell-&gt;coord = coord;
<a name="l00175"></a>00175 
<a name="l00176"></a>00176             <a class="code" href="classompl_1_1Grid.html#a75eda082fd346c84697130d347c1eb2f" title="The datatype for arrays of cells.">CellArray</a> *list = nbh ? nbh : <span class="keyword">new</span> <a class="code" href="classompl_1_1GridB.html#a8af7231656ec5aac513048369d7388d8" title="The datatype for arrays of cells.">CellArray</a>();
<a name="l00177"></a>00177             this-&gt;<a class="code" href="classompl_1_1GridN.html#adfe8ed73a5dc1ce935e9abf51d91682b" title="Get the list of neighbors for a given cell.">neighbors</a>(cell-&gt;coord, *list);
<a name="l00178"></a>00178 
<a name="l00179"></a>00179             <span class="keywordflow">for</span> (<span class="keyword">typename</span> CellArray::iterator cl = list-&gt;begin() ; cl != list-&gt;end() ; ++cl)
<a name="l00180"></a>00180             {
<a name="l00181"></a>00181                 CellX* c = <span class="keyword">static_cast&lt;</span>CellX*<span class="keyword">&gt;</span>(*cl);
<a name="l00182"></a>00182                 <span class="keywordtype">bool</span> wasBorder = c-&gt;border;
<a name="l00183"></a>00183                 c-&gt;neighbors++;
<a name="l00184"></a>00184                 <span class="keywordflow">if</span> (c-&gt;border &amp;&amp; c-&gt;neighbors &gt;= <a class="code" href="classompl_1_1GridN.html" title="Representation of a grid where cells keep track of how many neighbors they have.">GridN&lt;_T&gt;::interiorCellNeighborsLimit_</a>)
<a name="l00185"></a>00185                     c-&gt;border = <span class="keyword">false</span>;
<a name="l00186"></a>00186 
<a name="l00187"></a>00187                 <a class="code" href="classompl_1_1GridB.html#a21a662edc0904ba14495d44b2088669f" title="Pointer to function to be called when a cell needs to be updated.">eventCellUpdate_</a>(c, <a class="code" href="classompl_1_1GridB.html#ab229dc7aca157fe152411fe75ad2f73f" title="Data to be passed to function pointer above.">eventCellUpdateData_</a>);
<a name="l00188"></a>00188 
<a name="l00189"></a>00189                 <span class="keywordflow">if</span> (c-&gt;border)
<a name="l00190"></a>00190                     <a class="code" href="classompl_1_1GridB.html#afede0d811f4f9b53abc0f1945b871516" title="The heap of external cells.">external_</a>.<a class="code" href="classompl_1_1BinaryHeap.html#a8114dc53c4239fe0e199106386898ce3" title="Update an element in the heap.">update</a>(reinterpret_cast&lt;typename externalBHeap::Element*&gt;(c-&gt;heapElement));
<a name="l00191"></a>00191                 <span class="keywordflow">else</span>
<a name="l00192"></a>00192                 {
<a name="l00193"></a>00193                     <span class="keywordflow">if</span> (wasBorder)
<a name="l00194"></a>00194                     {
<a name="l00195"></a>00195                         <a class="code" href="classompl_1_1GridB.html#afede0d811f4f9b53abc0f1945b871516" title="The heap of external cells.">external_</a>.<a class="code" href="classompl_1_1BinaryHeap.html#a56848811174698cd9a907e1128e6ce02" title="Remove a specific element.">remove</a>(reinterpret_cast&lt;typename externalBHeap::Element*&gt;(c-&gt;heapElement));
<a name="l00196"></a>00196                         <a class="code" href="classompl_1_1GridB.html#a00fa01d1103ced09fb7ee3ebee187665" title="The heap of interior cells.">internal_</a>.<a class="code" href="classompl_1_1BinaryHeap.html#a7712c8909b596a4d12e0080960bd0274" title="Add a new element.">insert</a>(c);
<a name="l00197"></a>00197                     }
<a name="l00198"></a>00198                     <span class="keywordflow">else</span>
<a name="l00199"></a>00199                         <a class="code" href="classompl_1_1GridB.html#a00fa01d1103ced09fb7ee3ebee187665" title="The heap of interior cells.">internal_</a>.<a class="code" href="classompl_1_1BinaryHeap.html#a8114dc53c4239fe0e199106386898ce3" title="Update an element in the heap.">update</a>(reinterpret_cast&lt;typename internalBHeap::Element*&gt;(c-&gt;heapElement));
<a name="l00200"></a>00200                 }
<a name="l00201"></a>00201             }
<a name="l00202"></a>00202 
<a name="l00203"></a>00203             cell-&gt;neighbors = <a class="code" href="classompl_1_1GridN.html#ab065311737237a3731d41e0cbc4e1b76" title="Compute how many sides of a coordinate touch the boundaries of the grid.">GridN&lt;_T&gt;::numberOfBoundaryDimensions</a>(cell-&gt;coord) + list-&gt;size();
<a name="l00204"></a>00204             <span class="keywordflow">if</span> (cell-&gt;border &amp;&amp; cell-&gt;neighbors &gt;= <a class="code" href="classompl_1_1GridN.html" title="Representation of a grid where cells keep track of how many neighbors they have.">GridN&lt;_T&gt;::interiorCellNeighborsLimit_</a>)
<a name="l00205"></a>00205                 cell-&gt;border = <span class="keyword">false</span>;
<a name="l00206"></a>00206 
<a name="l00207"></a>00207             <span class="keywordflow">if</span> (!nbh)
<a name="l00208"></a>00208                 <span class="keyword">delete</span> list;
<a name="l00209"></a>00209 
<a name="l00210"></a>00210             <span class="keywordflow">return</span> <span class="keyword">static_cast&lt;</span><a class="code" href="classompl_1_1GridB.html#a7fd1b48d2b5451f40c57f4e3fba4e4c3" title="Definition of a cell in this grid.">Cell</a>*<span class="keyword">&gt;</span>(cell);
<a name="l00211"></a>00211         }
<a name="l00212"></a>00212 
<a name="l00214"></a><a class="code" href="classompl_1_1GridB.html#a2d028cfdf6233f097ff43fd70591896b">00214</a>         <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classompl_1_1GridB.html#a2d028cfdf6233f097ff43fd70591896b" title="Add the cell to the grid.">add</a>(<a class="code" href="classompl_1_1GridB.html#a7fd1b48d2b5451f40c57f4e3fba4e4c3" title="Definition of a cell in this grid.">Cell</a>* cell)
<a name="l00215"></a>00215         {
<a name="l00216"></a>00216             CellX* ccell = <span class="keyword">static_cast&lt;</span>CellX*<span class="keyword">&gt;</span>(cell);
<a name="l00217"></a>00217             <a class="code" href="classompl_1_1GridB.html#a21a662edc0904ba14495d44b2088669f" title="Pointer to function to be called when a cell needs to be updated.">eventCellUpdate_</a>(ccell, <a class="code" href="classompl_1_1GridB.html#ab229dc7aca157fe152411fe75ad2f73f" title="Data to be passed to function pointer above.">eventCellUpdateData_</a>);
<a name="l00218"></a>00218 
<a name="l00219"></a>00219             <a class="code" href="classompl_1_1GridB.html#a2d028cfdf6233f097ff43fd70591896b" title="Add the cell to the grid.">GridN&lt;_T&gt;::add</a>(cell);
<a name="l00220"></a>00220 
<a name="l00221"></a>00221             <span class="keywordflow">if</span> (cell-&gt;border)
<a name="l00222"></a>00222                 <a class="code" href="classompl_1_1GridB.html#afede0d811f4f9b53abc0f1945b871516" title="The heap of external cells.">external_</a>.<a class="code" href="classompl_1_1BinaryHeap.html#a7712c8909b596a4d12e0080960bd0274" title="Add a new element.">insert</a>(ccell);
<a name="l00223"></a>00223             <span class="keywordflow">else</span>
<a name="l00224"></a>00224                 <a class="code" href="classompl_1_1GridB.html#a00fa01d1103ced09fb7ee3ebee187665" title="The heap of interior cells.">internal_</a>.<a class="code" href="classompl_1_1BinaryHeap.html#a7712c8909b596a4d12e0080960bd0274" title="Add a new element.">insert</a>(ccell);
<a name="l00225"></a>00225         }
<a name="l00226"></a>00226 
<a name="l00228"></a><a class="code" href="classompl_1_1GridB.html#a35d8377f870c0e03fca9f2839d863165">00228</a>         <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <span class="keyword">remove</span>(<a class="code" href="classompl_1_1GridB.html#a7fd1b48d2b5451f40c57f4e3fba4e4c3" title="Definition of a cell in this grid.">Cell</a>* cell)
<a name="l00229"></a>00229         {
<a name="l00230"></a>00230             <span class="keywordflow">if</span> (cell)
<a name="l00231"></a>00231             {
<a name="l00232"></a>00232                 <a class="code" href="classompl_1_1Grid.html#a75eda082fd346c84697130d347c1eb2f" title="The datatype for arrays of cells.">CellArray</a> *list = <span class="keyword">new</span> <a class="code" href="classompl_1_1GridB.html#a8af7231656ec5aac513048369d7388d8" title="The datatype for arrays of cells.">CellArray</a>();
<a name="l00233"></a>00233                 this-&gt;<a class="code" href="classompl_1_1GridN.html#adfe8ed73a5dc1ce935e9abf51d91682b" title="Get the list of neighbors for a given cell.">neighbors</a>(cell-&gt;coord, *list);
<a name="l00234"></a>00234 
<a name="l00235"></a>00235                 <span class="keywordflow">for</span> (<span class="keyword">typename</span> CellArray::iterator cl = list-&gt;begin() ; cl != list-&gt;end() ; ++cl)
<a name="l00236"></a>00236                 {
<a name="l00237"></a>00237                     CellX* c = <span class="keyword">static_cast&lt;</span>CellX*<span class="keyword">&gt;</span>(*cl);
<a name="l00238"></a>00238                     <span class="keywordtype">bool</span> wasBorder = c-&gt;border;
<a name="l00239"></a>00239                     c-&gt;neighbors--;
<a name="l00240"></a>00240                     <span class="keywordflow">if</span> (!c-&gt;border &amp;&amp; c-&gt;neighbors &lt; <a class="code" href="classompl_1_1GridN.html" title="Representation of a grid where cells keep track of how many neighbors they have.">GridN&lt;_T&gt;::interiorCellNeighborsLimit_</a>)
<a name="l00241"></a>00241                         c-&gt;border = <span class="keyword">true</span>;
<a name="l00242"></a>00242 
<a name="l00243"></a>00243                     <a class="code" href="classompl_1_1GridB.html#a21a662edc0904ba14495d44b2088669f" title="Pointer to function to be called when a cell needs to be updated.">eventCellUpdate_</a>(c, <a class="code" href="classompl_1_1GridB.html#ab229dc7aca157fe152411fe75ad2f73f" title="Data to be passed to function pointer above.">eventCellUpdateData_</a>);
<a name="l00244"></a>00244 
<a name="l00245"></a>00245                     <span class="keywordflow">if</span> (c-&gt;border)
<a name="l00246"></a>00246                     {
<a name="l00247"></a>00247                         <span class="keywordflow">if</span> (wasBorder)
<a name="l00248"></a>00248                             <a class="code" href="classompl_1_1GridB.html#afede0d811f4f9b53abc0f1945b871516" title="The heap of external cells.">external_</a>.<a class="code" href="classompl_1_1BinaryHeap.html#a8114dc53c4239fe0e199106386898ce3" title="Update an element in the heap.">update</a>(reinterpret_cast&lt;typename externalBHeap::Element*&gt;(c-&gt;heapElement));
<a name="l00249"></a>00249                         <span class="keywordflow">else</span>
<a name="l00250"></a>00250                         {
<a name="l00251"></a>00251                             <a class="code" href="classompl_1_1GridB.html#a00fa01d1103ced09fb7ee3ebee187665" title="The heap of interior cells.">internal_</a>.<a class="code" href="classompl_1_1BinaryHeap.html#a56848811174698cd9a907e1128e6ce02" title="Remove a specific element.">remove</a>(reinterpret_cast&lt;typename internalBHeap::Element*&gt;(c-&gt;heapElement));
<a name="l00252"></a>00252                             <a class="code" href="classompl_1_1GridB.html#afede0d811f4f9b53abc0f1945b871516" title="The heap of external cells.">external_</a>.<a class="code" href="classompl_1_1BinaryHeap.html#a7712c8909b596a4d12e0080960bd0274" title="Add a new element.">insert</a>(c);
<a name="l00253"></a>00253                         }
<a name="l00254"></a>00254                     }
<a name="l00255"></a>00255                     <span class="keywordflow">else</span>
<a name="l00256"></a>00256                         <a class="code" href="classompl_1_1GridB.html#a00fa01d1103ced09fb7ee3ebee187665" title="The heap of interior cells.">internal_</a>.<a class="code" href="classompl_1_1BinaryHeap.html#a8114dc53c4239fe0e199106386898ce3" title="Update an element in the heap.">update</a>(reinterpret_cast&lt;typename internalBHeap::Element*&gt;(c-&gt;heapElement));
<a name="l00257"></a>00257                 }
<a name="l00258"></a>00258 
<a name="l00259"></a>00259                 <span class="keyword">delete</span> list;
<a name="l00260"></a>00260 
<a name="l00261"></a>00261                 <span class="keyword">typename</span> <a class="code" href="classompl_1_1GridN.html" title="Representation of a grid where cells keep track of how many neighbors they have.">GridN&lt;_T&gt;::CoordHash::iterator</a> pos = <a class="code" href="classompl_1_1GridN.html" title="Representation of a grid where cells keep track of how many neighbors they have.">GridN&lt;_T&gt;::hash_</a>.find(&amp;cell-&gt;coord);
<a name="l00262"></a>00262                 <span class="keywordflow">if</span> (pos != <a class="code" href="classompl_1_1GridN.html" title="Representation of a grid where cells keep track of how many neighbors they have.">GridN&lt;_T&gt;::hash_</a>.<a class="code" href="classompl_1_1Grid.html#ac5d360c8fa02bd6ec58aa8cbbc450dd7" title="Return the end() iterator for the grid.">end</a>())
<a name="l00263"></a>00263                 {
<a name="l00264"></a>00264                     <a class="code" href="classompl_1_1GridN.html" title="Representation of a grid where cells keep track of how many neighbors they have.">GridN&lt;_T&gt;::hash_</a>.erase(pos);
<a name="l00265"></a>00265                     CellX* cx = <span class="keyword">static_cast&lt;</span>CellX*<span class="keyword">&gt;</span>(cell);
<a name="l00266"></a>00266                     <span class="keywordflow">if</span> (cx-&gt;border)
<a name="l00267"></a>00267                         <a class="code" href="classompl_1_1GridB.html#afede0d811f4f9b53abc0f1945b871516" title="The heap of external cells.">external_</a>.<a class="code" href="classompl_1_1BinaryHeap.html#a56848811174698cd9a907e1128e6ce02" title="Remove a specific element.">remove</a>(reinterpret_cast&lt;typename externalBHeap::Element*&gt;(cx-&gt;heapElement));
<a name="l00268"></a>00268                     <span class="keywordflow">else</span>
<a name="l00269"></a>00269                         <a class="code" href="classompl_1_1GridB.html#a00fa01d1103ced09fb7ee3ebee187665" title="The heap of interior cells.">internal_</a>.<a class="code" href="classompl_1_1BinaryHeap.html#a56848811174698cd9a907e1128e6ce02" title="Remove a specific element.">remove</a>(reinterpret_cast&lt;typename internalBHeap::Element*&gt;(cx-&gt;heapElement));
<a name="l00270"></a>00270                     <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l00271"></a>00271                 }
<a name="l00272"></a>00272             }
<a name="l00273"></a>00273             <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00274"></a>00274         }
<a name="l00275"></a>00275 
<a name="l00276"></a><a class="code" href="classompl_1_1GridB.html#a99febb9d816320dc306778a4e0f5d0b0">00276</a>         <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classompl_1_1GridB.html#a99febb9d816320dc306778a4e0f5d0b0" title="Clear all cells in the grid.">clear</a>(<span class="keywordtype">void</span>)
<a name="l00277"></a>00277         {
<a name="l00278"></a>00278             <a class="code" href="classompl_1_1GridB.html#a99febb9d816320dc306778a4e0f5d0b0" title="Clear all cells in the grid.">GridN&lt;_T&gt;::clear</a>();
<a name="l00279"></a>00279             <a class="code" href="classompl_1_1GridB.html#a600b0fb6110d0a9cd0c8a2d65bbec4e8" title="Clear the data from both heaps.">clearHeaps</a>();
<a name="l00280"></a>00280         }
<a name="l00281"></a>00281 
<a name="l00282"></a><a class="code" href="classompl_1_1GridB.html#a08fa3fdf1d4a74a1bdab9d99ca5e8925">00282</a>         <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classompl_1_1GridB.html#a08fa3fdf1d4a74a1bdab9d99ca5e8925" title="Print information about the data in this grid structure.">status</a>(std::ostream &amp;out = std::cout)<span class="keyword"> const</span>
<a name="l00283"></a>00283 <span class="keyword">        </span>{
<a name="l00284"></a>00284             <a class="code" href="classompl_1_1GridB.html#a08fa3fdf1d4a74a1bdab9d99ca5e8925" title="Print information about the data in this grid structure.">GridN&lt;_T&gt;::status</a>(out);
<a name="l00285"></a>00285             out &lt;&lt; <a class="code" href="classompl_1_1GridB.html#aacfbc62700a1a97f5312d8ea58ff5ca2" title="Return the number of internal cells.">countInternal</a>() &lt;&lt; <span class="stringliteral">&quot; internal cells&quot;</span> &lt;&lt; std::endl;
<a name="l00286"></a>00286             out &lt;&lt; <a class="code" href="classompl_1_1GridB.html#af91a6687eea882c5f07f7679d94a08b5" title="Return the number of external cells.">countExternal</a>() &lt;&lt; <span class="stringliteral">&quot; external cells&quot;</span> &lt;&lt; std::endl;
<a name="l00287"></a>00287         }
<a name="l00288"></a>00288 
<a name="l00289"></a>00289     <span class="keyword">protected</span>:
<a name="l00290"></a>00290 
<a name="l00292"></a><a class="code" href="classompl_1_1GridB.html#a21a662edc0904ba14495d44b2088669f">00292</a>         <a class="code" href="classompl_1_1GridB.html#a1023a1ca22bfe01e260ed8c975407aea">EventCellUpdate</a>          <a class="code" href="classompl_1_1GridB.html#a21a662edc0904ba14495d44b2088669f" title="Pointer to function to be called when a cell needs to be updated.">eventCellUpdate_</a>;
<a name="l00293"></a>00293 
<a name="l00295"></a><a class="code" href="classompl_1_1GridB.html#ab229dc7aca157fe152411fe75ad2f73f">00295</a>         <span class="keywordtype">void</span>                    *<a class="code" href="classompl_1_1GridB.html#ab229dc7aca157fe152411fe75ad2f73f" title="Data to be passed to function pointer above.">eventCellUpdateData_</a>;
<a name="l00296"></a>00296 
<a name="l00298"></a><a class="code" href="classompl_1_1GridB.html#a24ba3c3dfcd76b0f7f79006252e18928">00298</a>         <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classompl_1_1GridB.html#a24ba3c3dfcd76b0f7f79006252e18928" title="Default no-op update routine for a cell.">noCellUpdate</a>(<a class="code" href="classompl_1_1GridB.html#a7fd1b48d2b5451f40c57f4e3fba4e4c3" title="Definition of a cell in this grid.">Cell</a>*, <span class="keywordtype">void</span>*)
<a name="l00299"></a>00299         {
<a name="l00300"></a>00300         }
<a name="l00301"></a>00301 
<a name="l00303"></a><a class="code" href="classompl_1_1GridB.html#a3f5dabc334b16206f08ca6845b750e17">00303</a>         <span class="keywordtype">void</span> <a class="code" href="classompl_1_1GridB.html#a3f5dabc334b16206f08ca6845b750e17" title="Set the update procedure for the heaps of internal and external cells.">setupHeaps</a>(<span class="keywordtype">void</span>)
<a name="l00304"></a>00304         {
<a name="l00305"></a>00305             <a class="code" href="classompl_1_1GridB.html#a21a662edc0904ba14495d44b2088669f" title="Pointer to function to be called when a cell needs to be updated.">eventCellUpdate_</a>     = &amp;<a class="code" href="classompl_1_1GridB.html#a24ba3c3dfcd76b0f7f79006252e18928" title="Default no-op update routine for a cell.">noCellUpdate</a>;
<a name="l00306"></a>00306             <a class="code" href="classompl_1_1GridB.html#ab229dc7aca157fe152411fe75ad2f73f" title="Data to be passed to function pointer above.">eventCellUpdateData_</a> = NULL;
<a name="l00307"></a>00307             <a class="code" href="classompl_1_1GridB.html#a00fa01d1103ced09fb7ee3ebee187665" title="The heap of interior cells.">internal_</a>.<a class="code" href="classompl_1_1BinaryHeap.html#adb5a517c064a3844a47cc873fddea796" title="Set the event that gets called after insertion.">onAfterInsert</a>(&amp;<a class="code" href="classompl_1_1GridB.html#a5d5d287741c00a9dba43113064f867d1" title="Routine used internally for keeping track of binary heap elements for internal cells.">setHeapElementI</a>, NULL);
<a name="l00308"></a>00308             <a class="code" href="classompl_1_1GridB.html#afede0d811f4f9b53abc0f1945b871516" title="The heap of external cells.">external_</a>.<a class="code" href="classompl_1_1BinaryHeap.html#adb5a517c064a3844a47cc873fddea796" title="Set the event that gets called after insertion.">onAfterInsert</a>(&amp;<a class="code" href="classompl_1_1GridB.html#ae2fb49e37b99d8f9e224c17577f5c622" title="Routine used internally for keeping track of binary heap elements for external cells.">setHeapElementE</a>, NULL);
<a name="l00309"></a>00309         }
<a name="l00310"></a>00310 
<a name="l00312"></a><a class="code" href="classompl_1_1GridB.html#a600b0fb6110d0a9cd0c8a2d65bbec4e8">00312</a>         <span class="keywordtype">void</span> <a class="code" href="classompl_1_1GridB.html#a600b0fb6110d0a9cd0c8a2d65bbec4e8" title="Clear the data from both heaps.">clearHeaps</a>(<span class="keywordtype">void</span>)
<a name="l00313"></a>00313         {
<a name="l00314"></a>00314             <a class="code" href="classompl_1_1GridB.html#a00fa01d1103ced09fb7ee3ebee187665" title="The heap of interior cells.">internal_</a>.<a class="code" href="classompl_1_1BinaryHeap.html#a318edd8b65126de610e0f11138f8c147" title="Clear the heap.">clear</a>();
<a name="l00315"></a>00315             <a class="code" href="classompl_1_1GridB.html#afede0d811f4f9b53abc0f1945b871516" title="The heap of external cells.">external_</a>.<a class="code" href="classompl_1_1BinaryHeap.html#a318edd8b65126de610e0f11138f8c147" title="Clear the heap.">clear</a>();
<a name="l00316"></a>00316         }
<a name="l00317"></a>00317 
<a name="l00319"></a><a class="code" href="structompl_1_1GridB_1_1LessThanInternalCell.html">00319</a>         <span class="keyword">struct </span><a class="code" href="structompl_1_1GridB_1_1LessThanInternalCell.html" title="Define order for internal cells.">LessThanInternalCell</a>
<a name="l00320"></a>00320         {
<a name="l00321"></a>00321             <span class="keywordtype">bool</span> operator()(<span class="keyword">const</span> CellX* <span class="keyword">const</span> a, <span class="keyword">const</span> CellX* <span class="keyword">const</span> b)<span class="keyword"> const</span>
<a name="l00322"></a>00322 <span class="keyword">            </span>{
<a name="l00323"></a>00323                 <span class="keywordflow">return</span> lt_(a-&gt;data, b-&gt;data);
<a name="l00324"></a>00324             }
<a name="l00325"></a>00325 
<a name="l00326"></a>00326         <span class="keyword">private</span>:
<a name="l00327"></a>00327             LessThanInternal lt_;
<a name="l00328"></a>00328         };
<a name="l00329"></a>00329 
<a name="l00331"></a><a class="code" href="structompl_1_1GridB_1_1LessThanExternalCell.html">00331</a>         <span class="keyword">struct </span><a class="code" href="structompl_1_1GridB_1_1LessThanExternalCell.html" title="Define order for external cells.">LessThanExternalCell</a>
<a name="l00332"></a>00332         {
<a name="l00333"></a>00333             <span class="keywordtype">bool</span> operator()(<span class="keyword">const</span> CellX* <span class="keyword">const</span> a, <span class="keyword">const</span> CellX* <span class="keyword">const</span> b)<span class="keyword"> const</span>
<a name="l00334"></a>00334 <span class="keyword">            </span>{
<a name="l00335"></a>00335                 <span class="keywordflow">return</span> lt_(a-&gt;data, b-&gt;data);
<a name="l00336"></a>00336             }
<a name="l00337"></a>00337         <span class="keyword">private</span>:
<a name="l00338"></a>00338             LessThanExternal lt_;
<a name="l00339"></a>00339         };
<a name="l00340"></a>00340 
<a name="l00342"></a><a class="code" href="classompl_1_1GridB.html#abf7cedc47aa3e2b2cb87986fcdf9ed44">00342</a>         <span class="keyword">typedef</span> <a class="code" href="classompl_1_1BinaryHeap.html">BinaryHeap&lt; CellX*, LessThanInternalCell &gt;</a> <a class="code" href="classompl_1_1GridB.html#abf7cedc47aa3e2b2cb87986fcdf9ed44" title="Datatype for a heap of cells containing interior cells.">internalBHeap</a>;
<a name="l00343"></a>00343 
<a name="l00345"></a><a class="code" href="classompl_1_1GridB.html#a01bc4d75a25963312eecd700ed643399">00345</a>         <span class="keyword">typedef</span> <a class="code" href="classompl_1_1BinaryHeap.html">BinaryHeap&lt; CellX*, LessThanExternalCell &gt;</a> <a class="code" href="classompl_1_1GridB.html#a01bc4d75a25963312eecd700ed643399" title="Datatype for a heap of cells containing exterior cells.">externalBHeap</a>;
<a name="l00346"></a>00346 
<a name="l00348"></a><a class="code" href="classompl_1_1GridB.html#a5d5d287741c00a9dba43113064f867d1">00348</a>         <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classompl_1_1GridB.html#a5d5d287741c00a9dba43113064f867d1" title="Routine used internally for keeping track of binary heap elements for internal cells.">setHeapElementI</a>(<span class="keyword">typename</span> internalBHeap::Element* element, <span class="keywordtype">void</span> *)
<a name="l00349"></a>00349         {
<a name="l00350"></a>00350             element-&gt;data-&gt;heapElement = <span class="keyword">reinterpret_cast&lt;</span><span class="keywordtype">void</span>*<span class="keyword">&gt;</span>(element);
<a name="l00351"></a>00351         }
<a name="l00352"></a>00352 
<a name="l00354"></a><a class="code" href="classompl_1_1GridB.html#ae2fb49e37b99d8f9e224c17577f5c622">00354</a>         <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classompl_1_1GridB.html#ae2fb49e37b99d8f9e224c17577f5c622" title="Routine used internally for keeping track of binary heap elements for external cells.">setHeapElementE</a>(<span class="keyword">typename</span> externalBHeap::Element* element, <span class="keywordtype">void</span> *)
<a name="l00355"></a>00355         {
<a name="l00356"></a>00356             element-&gt;data-&gt;heapElement = <span class="keyword">reinterpret_cast&lt;</span><span class="keywordtype">void</span>*<span class="keyword">&gt;</span>(element);
<a name="l00357"></a>00357         }
<a name="l00358"></a>00358 
<a name="l00360"></a><a class="code" href="classompl_1_1GridB.html#a00fa01d1103ced09fb7ee3ebee187665">00360</a>         <a class="code" href="classompl_1_1BinaryHeap.html">internalBHeap</a> <a class="code" href="classompl_1_1GridB.html#a00fa01d1103ced09fb7ee3ebee187665" title="The heap of interior cells.">internal_</a>;
<a name="l00361"></a>00361 
<a name="l00363"></a><a class="code" href="classompl_1_1GridB.html#afede0d811f4f9b53abc0f1945b871516">00363</a>         <a class="code" href="classompl_1_1BinaryHeap.html">externalBHeap</a> <a class="code" href="classompl_1_1GridB.html#afede0d811f4f9b53abc0f1945b871516" title="The heap of external cells.">external_</a>;
<a name="l00364"></a>00364     };
<a name="l00365"></a>00365 
<a name="l00366"></a>00366 }
<a name="l00367"></a>00367 
<a name="l00368"></a>00368 <span class="preprocessor">#endif</span>
</pre></div></div>
</div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerator</a></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>

<div class="footer span-22 push-2 last">
  <a href="http://www.kavrakilab.org">Physical and Biological Computing Group</a> &bull;
  <a href="http://www.cs.rice.edu">Department of Computer Science</a> &bull;
  <a href="http://www.rice.edu">Rice University</a><br>
  <div class="gray">Generated on Sun Oct 9 2011 23:04:29 by&#160;<a href="http://www.doxygen.org/index.html">doxygen</a> 1.7.4</div>
</div>
</div>
</body>
</html>