Page MenuHomec4science

Cell_8hpp_source.html
No OneTemporary

File Metadata

Created
Thu, Oct 31, 14:24

Cell_8hpp_source.html

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://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"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.16"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>PHPC - nBody project: /media/lmunier/Data/EPFL/Master/2eme_annee/Semestre_2/Parallel_and_High_Performance_Computing/phpc_nBody/src/Cell.hpp Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">PHPC - nBody project
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.16 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</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 id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="headertitle">
<div class="title">Cell.hpp</div> </div>
</div><!--header-->
<div class="contents">
<a href="Cell_8hpp.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span>&#160; </div><div class="line"><a name="l00010"></a><span class="lineno"> 10</span>&#160;<span class="preprocessor">#ifndef PHPC_NBODY_CELL_HPP</span></div><div class="line"><a name="l00011"></a><span class="lineno"> 11</span>&#160;<span class="preprocessor">#define PHPC_NBODY_CELL_HPP</span></div><div class="line"><a name="l00012"></a><span class="lineno"> 12</span>&#160; </div><div class="line"><a name="l00018"></a><span class="lineno"> 18</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="constants_8hpp.html">constants.hpp</a>&quot;</span></div><div class="line"><a name="l00019"></a><span class="lineno"> 19</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="Vector_8hpp.html">Vector.hpp</a>&quot;</span></div><div class="line"><a name="l00020"></a><span class="lineno"> 20</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="Tree_8hpp.html">Tree.hpp</a>&quot;</span></div><div class="line"><a name="l00021"></a><span class="lineno"> 21</span>&#160; </div><div class="line"><a name="l00025"></a><span class="lineno"> 25</span>&#160;<span class="keyword">using namespace </span><a class="code" href="namespacestd.html">std</a>;</div><div class="line"><a name="l00026"></a><span class="lineno"> 26</span>&#160; </div><div class="line"><a name="l00032"></a><span class="lineno"> 32</span>&#160;<span class="keyword">namespace </span><a class="code" href="namespaceTree.html">Tree</a> {</div><div class="line"><a name="l00039"></a><span class="lineno"> 39</span>&#160; <span class="keyword">template</span>&lt;<span class="keyword">typename</span> Type&gt;</div><div class="line"><a name="l00040"></a><span class="lineno"><a class="line" href="classTree_1_1Cell.html"> 40</a></span>&#160; <span class="keyword">class </span><a class="code" href="classTree_1_1Cell.html">Cell</a> : <span class="keyword">public</span> <a class="code" href="classTree_1_1AbstractType.html">AbstractType</a>&lt;Type&gt; {</div><div class="line"><a name="l00041"></a><span class="lineno"> 41</span>&#160; <span class="keyword">public</span>:</div><div class="line"><a name="l00049"></a><span class="lineno"><a class="line" href="classTree_1_1Cell.html#aea696dfadd4cb15026f9695afff44b2b"> 49</a></span>&#160; <span class="keyword">explicit</span> <a class="code" href="classTree_1_1Cell.html#aea696dfadd4cb15026f9695afff44b2b">Cell</a>(Type center = Type(), Type dim = Type(), Type mass_pos = Type()) :</div><div class="line"><a name="l00050"></a><span class="lineno"> 50</span>&#160; _center(center), _size(dim), _mass_pos(mass_pos) {}</div><div class="line"><a name="l00051"></a><span class="lineno"> 51</span>&#160; </div><div class="line"><a name="l00055"></a><span class="lineno"><a class="line" href="classTree_1_1Cell.html#a245d18d5845acdb347a1e9e0f16b1c1f"> 55</a></span>&#160; <a class="code" href="classTree_1_1Cell.html#a245d18d5845acdb347a1e9e0f16b1c1f">~Cell</a>()<span class="keyword"> override </span>{</div><div class="line"><a name="l00056"></a><span class="lineno"> 56</span>&#160; this-&gt;_parent = <span class="keyword">nullptr</span>;</div><div class="line"><a name="l00057"></a><span class="lineno"> 57</span>&#160; <span class="keyword">delete</span> this-&gt;_parent;</div><div class="line"><a name="l00058"></a><span class="lineno"> 58</span>&#160; </div><div class="line"><a name="l00059"></a><span class="lineno"> 59</span>&#160; <span class="keywordflow">for</span> (<span class="keyword">auto</span> n : this-&gt;_next)</div><div class="line"><a name="l00060"></a><span class="lineno"> 60</span>&#160; <span class="keyword">delete</span> n;</div><div class="line"><a name="l00061"></a><span class="lineno"> 61</span>&#160; </div><div class="line"><a name="l00062"></a><span class="lineno"> 62</span>&#160; this-&gt;_next.clear();</div><div class="line"><a name="l00063"></a><span class="lineno"> 63</span>&#160; }</div><div class="line"><a name="l00064"></a><span class="lineno"> 64</span>&#160; </div><div class="line"><a name="l00070"></a><span class="lineno"><a class="line" href="classTree_1_1Cell.html#a859971aba19dd8b9b91e668f22a5515e"> 70</a></span>&#160; <a class="code" href="namespaceTree.html#af3bca205e37bd9b9c4b2fdc38ba6d3ad">my_type</a> <a class="code" href="classTree_1_1Cell.html#a859971aba19dd8b9b91e668f22a5515e">get_type</a>()<span class="keyword"> override </span>{ <span class="keywordflow">return</span> <a class="code" href="namespaceTree.html#af3bca205e37bd9b9c4b2fdc38ba6d3ada23eab4d4abc1c5b4de5ff2243bd1d82f">CellT</a>; }</div><div class="line"><a name="l00071"></a><span class="lineno"> 71</span>&#160; </div><div class="line"><a name="l00078"></a><span class="lineno"><a class="line" href="classTree_1_1Cell.html#af21148788c828df1da95cac591a785aa"> 78</a></span>&#160; vector&lt;AbstractType &lt; Type&gt;* &gt; <a class="code" href="classTree_1_1Cell.html#af21148788c828df1da95cac591a785aa">get_next</a>()<span class="keyword"> override </span>{ <span class="keywordflow">return</span> this-&gt;_next; }</div><div class="line"><a name="l00079"></a><span class="lineno"> 79</span>&#160; </div><div class="line"><a name="l00089"></a><span class="lineno"><a class="line" href="classTree_1_1Cell.html#af7235dfa3cc04f2178305b0b0cf78088"> 89</a></span>&#160; Type <a class="code" href="classTree_1_1Cell.html#af7235dfa3cc04f2178305b0b0cf78088">get</a>(<a class="code" href="constants_8hpp.html#af2b8102aeac8f02ab62ac42828289569">property</a> p)<span class="keyword"> override </span>{</div><div class="line"><a name="l00090"></a><span class="lineno"> 90</span>&#160; <span class="keywordflow">switch</span> (p) {</div><div class="line"><a name="l00091"></a><span class="lineno"> 91</span>&#160; <span class="keywordflow">case</span> <a class="code" href="constants_8hpp.html#af2b8102aeac8f02ab62ac42828289569a2159ffbd3a68037511ab5ab4dd35ace7">CENTER</a> :</div><div class="line"><a name="l00092"></a><span class="lineno"> 92</span>&#160; <span class="keywordflow">return</span> this-&gt;_center;</div><div class="line"><a name="l00093"></a><span class="lineno"> 93</span>&#160; <span class="keywordflow">case</span> <a class="code" href="constants_8hpp.html#af2b8102aeac8f02ab62ac42828289569a6c8e5f290be4be86fd5e7048654b4a50">DIM</a> :</div><div class="line"><a name="l00094"></a><span class="lineno"> 94</span>&#160; <span class="keywordflow">return</span> this-&gt;_size;</div><div class="line"><a name="l00095"></a><span class="lineno"> 95</span>&#160; <span class="keywordflow">case</span> <a class="code" href="constants_8hpp.html#af2b8102aeac8f02ab62ac42828289569aef9ad485b29b65c89dd94b1fb31ad262">MASS_POS</a> :</div><div class="line"><a name="l00096"></a><span class="lineno"> 96</span>&#160; <span class="keywordflow">return</span> this-&gt;_mass_pos;</div><div class="line"><a name="l00097"></a><span class="lineno"> 97</span>&#160; <span class="keywordflow">default</span>:</div><div class="line"><a name="l00098"></a><span class="lineno"> 98</span>&#160; <span class="keywordflow">break</span>;</div><div class="line"><a name="l00099"></a><span class="lineno"> 99</span>&#160; }</div><div class="line"><a name="l00100"></a><span class="lineno"> 100</span>&#160; }</div><div class="line"><a name="l00101"></a><span class="lineno"> 101</span>&#160; </div><div class="line"><a name="l00111"></a><span class="lineno"><a class="line" href="classTree_1_1Cell.html#ae436db01b4cb7edfa7eee00408544155"> 111</a></span>&#160; <span class="keywordtype">void</span> <a class="code" href="classTree_1_1Cell.html#ae436db01b4cb7edfa7eee00408544155">set</a>(<a class="code" href="constants_8hpp.html#af2b8102aeac8f02ab62ac42828289569">property</a> p, Type vec)<span class="keyword"> override </span>{</div><div class="line"><a name="l00112"></a><span class="lineno"> 112</span>&#160; <span class="keywordflow">switch</span> (p) {</div><div class="line"><a name="l00113"></a><span class="lineno"> 113</span>&#160; <span class="keywordflow">case</span> <a class="code" href="constants_8hpp.html#af2b8102aeac8f02ab62ac42828289569a2159ffbd3a68037511ab5ab4dd35ace7">CENTER</a> :</div><div class="line"><a name="l00114"></a><span class="lineno"> 114</span>&#160; this-&gt;_center = vec;</div><div class="line"><a name="l00115"></a><span class="lineno"> 115</span>&#160; <span class="keywordflow">break</span>;</div><div class="line"><a name="l00116"></a><span class="lineno"> 116</span>&#160; <span class="keywordflow">case</span> <a class="code" href="constants_8hpp.html#af2b8102aeac8f02ab62ac42828289569a6c8e5f290be4be86fd5e7048654b4a50">DIM</a> :</div><div class="line"><a name="l00117"></a><span class="lineno"> 117</span>&#160; this-&gt;_size = vec;</div><div class="line"><a name="l00118"></a><span class="lineno"> 118</span>&#160; <span class="keywordflow">break</span>;</div><div class="line"><a name="l00119"></a><span class="lineno"> 119</span>&#160; <span class="keywordflow">case</span> <a class="code" href="constants_8hpp.html#af2b8102aeac8f02ab62ac42828289569aef9ad485b29b65c89dd94b1fb31ad262">MASS_POS</a> :</div><div class="line"><a name="l00120"></a><span class="lineno"> 120</span>&#160; this-&gt;_mass_pos = vec;</div><div class="line"><a name="l00121"></a><span class="lineno"> 121</span>&#160; <span class="keywordflow">break</span>;</div><div class="line"><a name="l00122"></a><span class="lineno"> 122</span>&#160; <span class="keywordflow">default</span>:</div><div class="line"><a name="l00123"></a><span class="lineno"> 123</span>&#160; <span class="keywordflow">break</span>;</div><div class="line"><a name="l00124"></a><span class="lineno"> 124</span>&#160; }</div><div class="line"><a name="l00125"></a><span class="lineno"> 125</span>&#160; }</div><div class="line"><a name="l00126"></a><span class="lineno"> 126</span>&#160; </div><div class="line"><a name="l00130"></a><span class="lineno"><a class="line" href="classTree_1_1Cell.html#aea6cc225e04be7a847fc7efbed7e8575"> 130</a></span>&#160; <span class="keywordtype">void</span> <a class="code" href="classTree_1_1Cell.html#aea6cc225e04be7a847fc7efbed7e8575">subdivide_tree</a>()<span class="keyword"> override </span>{</div><div class="line"><a name="l00131"></a><span class="lineno"> 131</span>&#160; <span class="keywordtype">bool</span> y = <span class="keyword">true</span>, z = <span class="keyword">false</span>;</div><div class="line"><a name="l00132"></a><span class="lineno"> 132</span>&#160; Type size = this-&gt;_size * 0.5;</div><div class="line"><a name="l00133"></a><span class="lineno"> 133</span>&#160; </div><div class="line"><a name="l00135"></a><span class="lineno"> 135</span>&#160; <span class="keywordflow">for</span> (<span class="keywordtype">int</span> n = 0; n &lt; pow(2, <a class="code" href="constants_8hpp.html#ae4abc233898f783a9cb9b8aea5ae5e37">NB_DIM</a>); n++) {</div><div class="line"><a name="l00137"></a><span class="lineno"> 137</span>&#160; <span class="keywordflow">if</span> (n % 2 == 0)</div><div class="line"><a name="l00138"></a><span class="lineno"> 138</span>&#160; y = !y;</div><div class="line"><a name="l00139"></a><span class="lineno"> 139</span>&#160; </div><div class="line"><a name="l00140"></a><span class="lineno"> 140</span>&#160; <span class="keywordflow">if</span> (n == 4)</div><div class="line"><a name="l00141"></a><span class="lineno"> 141</span>&#160; z = !z;</div><div class="line"><a name="l00142"></a><span class="lineno"> 142</span>&#160; </div><div class="line"><a name="l00143"></a><span class="lineno"> 143</span>&#160;<span class="preprocessor">#if NB_DIM == DIM_2</span></div><div class="line"><a name="l00144"></a><span class="lineno"> 144</span>&#160; Type center = Type(size.x * (0.5 * pow(-1, (n + 1) % 2)), size.y * (0.5 * pow(-1, y)));</div><div class="line"><a name="l00145"></a><span class="lineno"> 145</span>&#160;<span class="preprocessor">#elif NB_DIM == DIM_3</span></div><div class="line"><a name="l00146"></a><span class="lineno"> 146</span>&#160; Type center = Type(size.x*(0.5*pow(-1, (n+1)%2)), size.y*(0.5*pow(-1, y)), size.z*(0.5*pow(-1, z)));</div><div class="line"><a name="l00147"></a><span class="lineno"> 147</span>&#160;<span class="preprocessor">#endif</span></div><div class="line"><a name="l00148"></a><span class="lineno"> 148</span>&#160; </div><div class="line"><a name="l00149"></a><span class="lineno"> 149</span>&#160; center = this-&gt;_center + center;</div><div class="line"><a name="l00150"></a><span class="lineno"> 150</span>&#160; </div><div class="line"><a name="l00152"></a><span class="lineno"> 152</span>&#160; <span class="keyword">auto</span> next = <span class="keyword">new</span> <a class="code" href="classTree_1_1Cell.html">Cell&lt;Type&gt;</a>(center, size, center);</div><div class="line"><a name="l00153"></a><span class="lineno"> 153</span>&#160; this-&gt;_next.push_back(next);</div><div class="line"><a name="l00154"></a><span class="lineno"> 154</span>&#160; next-&gt;set_parent(<span class="keyword">this</span>);</div><div class="line"><a name="l00155"></a><span class="lineno"> 155</span>&#160; }</div><div class="line"><a name="l00156"></a><span class="lineno"> 156</span>&#160; }</div><div class="line"><a name="l00157"></a><span class="lineno"> 157</span>&#160; </div><div class="line"><a name="l00164"></a><span class="lineno"><a class="line" href="classTree_1_1Cell.html#a1d680cfdeba1e1bbc97ed7e0d606160e"> 164</a></span>&#160; <span class="keywordtype">void</span> <a class="code" href="classTree_1_1Cell.html#a1d680cfdeba1e1bbc97ed7e0d606160e">store_particle</a>(<a class="code" href="classTree_1_1AbstractType.html">AbstractType &lt;Type&gt;</a> *particle, <a class="code" href="classTree_1_1AbstractType.html">AbstractType &lt;Type&gt;</a> *prev_part)<span class="keyword"> override </span>{</div><div class="line"><a name="l00166"></a><span class="lineno"> 166</span>&#160; <span class="keywordflow">if</span> (this-&gt;_next.empty()) {</div><div class="line"><a name="l00167"></a><span class="lineno"> 167</span>&#160; this-&gt;_next.push_back(particle);</div><div class="line"><a name="l00168"></a><span class="lineno"> 168</span>&#160; </div><div class="line"><a name="l00169"></a><span class="lineno"> 169</span>&#160; particle-&gt;<a class="code" href="classTree_1_1AbstractType.html#a8b04149e350613d4c133c053b761f175">set_parent</a>(<span class="keyword">this</span>);</div><div class="line"><a name="l00170"></a><span class="lineno"> 170</span>&#160; particle-&gt;<a class="code" href="classTree_1_1AbstractType.html#ad7cceb10806bfdba07c934a970c2a3e5">update_cell</a>(<span class="keyword">true</span>);</div><div class="line"><a name="l00171"></a><span class="lineno"> 171</span>&#160; </div><div class="line"><a name="l00172"></a><span class="lineno"> 172</span>&#160; <span class="keywordflow">if</span> (prev_part != <span class="keyword">nullptr</span>) {</div><div class="line"><a name="l00173"></a><span class="lineno"> 173</span>&#160; particle = prev_part;</div><div class="line"><a name="l00174"></a><span class="lineno"> 174</span>&#160; prev_part = <span class="keyword">nullptr</span>;</div><div class="line"><a name="l00175"></a><span class="lineno"> 175</span>&#160; </div><div class="line"><a name="l00176"></a><span class="lineno"> 176</span>&#160; this-&gt;_parent-&gt;<a class="code" href="classTree_1_1AbstractType.html#a0abe13ac95cb5f0938189a1d461f06a4">store_particle</a>(particle, prev_part);</div><div class="line"><a name="l00177"></a><span class="lineno"> 177</span>&#160; }</div><div class="line"><a name="l00178"></a><span class="lineno"> 178</span>&#160; } </div><div class="line"><a name="l00179"></a><span class="lineno"> 179</span>&#160; <span class="keywordflow">else</span> <span class="keywordflow">if</span> (this-&gt;_next[0]-&gt;get_type() == <a class="code" href="namespaceTree.html#af3bca205e37bd9b9c4b2fdc38ba6d3adaae6da3ea39dc23179342990ff167ccb7">ParticleT</a>) {</div><div class="line"><a name="l00180"></a><span class="lineno"> 180</span>&#160; prev_part = this-&gt;_next[0];</div><div class="line"><a name="l00181"></a><span class="lineno"> 181</span>&#160; </div><div class="line"><a name="l00183"></a><span class="lineno"> 183</span>&#160; this-&gt;_next.clear();</div><div class="line"><a name="l00184"></a><span class="lineno"> 184</span>&#160; this-&gt;_m = 0.0f;</div><div class="line"><a name="l00185"></a><span class="lineno"> 185</span>&#160; this-&gt;_mass_pos = Type();</div><div class="line"><a name="l00186"></a><span class="lineno"> 186</span>&#160; prev_part-&gt;<a class="code" href="classTree_1_1AbstractType.html#a8b04149e350613d4c133c053b761f175">set_parent</a>(<span class="keyword">nullptr</span>);</div><div class="line"><a name="l00187"></a><span class="lineno"> 187</span>&#160; </div><div class="line"><a name="l00188"></a><span class="lineno"> 188</span>&#160; this-&gt;subdivide_tree();</div><div class="line"><a name="l00189"></a><span class="lineno"> 189</span>&#160; this-&gt;store_particle(particle, prev_part);</div><div class="line"><a name="l00190"></a><span class="lineno"> 190</span>&#160; } </div><div class="line"><a name="l00191"></a><span class="lineno"> 191</span>&#160; <span class="keywordflow">else</span> {</div><div class="line"><a name="l00192"></a><span class="lineno"> 192</span>&#160; <span class="keywordtype">int</span> cell_idx_1 = particle-&gt;<a class="code" href="classTree_1_1AbstractType.html#a133cc78f06baa5cd6de0536ce6293b27">find_cell_idx</a>(this-&gt;_center);</div><div class="line"><a name="l00193"></a><span class="lineno"> 193</span>&#160; </div><div class="line"><a name="l00194"></a><span class="lineno"> 194</span>&#160; particle-&gt;<a class="code" href="classTree_1_1AbstractType.html#a8b04149e350613d4c133c053b761f175">set_parent</a>(<span class="keyword">this</span>);</div><div class="line"><a name="l00195"></a><span class="lineno"> 195</span>&#160; particle-&gt;<a class="code" href="classTree_1_1AbstractType.html#ad7cceb10806bfdba07c934a970c2a3e5">update_cell</a>(<span class="keyword">true</span>);</div><div class="line"><a name="l00196"></a><span class="lineno"> 196</span>&#160; particle-&gt;<a class="code" href="classTree_1_1AbstractType.html#a8b04149e350613d4c133c053b761f175">set_parent</a>(<span class="keyword">nullptr</span>);</div><div class="line"><a name="l00197"></a><span class="lineno"> 197</span>&#160; </div><div class="line"><a name="l00198"></a><span class="lineno"> 198</span>&#160; this-&gt;get_next()[cell_idx_1]-&gt;store_particle(particle, prev_part);</div><div class="line"><a name="l00199"></a><span class="lineno"> 199</span>&#160; }</div><div class="line"><a name="l00200"></a><span class="lineno"> 200</span>&#160; }</div><div class="line"><a name="l00201"></a><span class="lineno"> 201</span>&#160; </div><div class="line"><a name="l00208"></a><span class="lineno"><a class="line" href="classTree_1_1Cell.html#ab175ea91ec54a35f4a3cccbdeb79bdff"> 208</a></span>&#160; <span class="keywordtype">void</span> <a class="code" href="classTree_1_1Cell.html#ab175ea91ec54a35f4a3cccbdeb79bdff">compute_load</a>(<a class="code" href="classTree_1_1AbstractType.html">AbstractType &lt;Type&gt;</a> *particle)<span class="keyword"> override </span>{</div><div class="line"><a name="l00209"></a><span class="lineno"> 209</span>&#160; Type tmp = this-&gt;_mass_pos - particle-&gt;<a class="code" href="classTree_1_1AbstractType.html#aa341d843f7ebfc7fb3f5383827e50712">get</a>(<a class="code" href="constants_8hpp.html#af2b8102aeac8f02ab62ac42828289569a91743bc3932693c4b8a6ca984e8a8437">POS</a>);</div><div class="line"><a name="l00210"></a><span class="lineno"> 210</span>&#160; <span class="keywordtype">float</span> d = max(tmp.norm(), <a class="code" href="constants_8hpp.html#a002b2f4894492820fe708b1b7e7c5e70">EPSILON</a>);</div><div class="line"><a name="l00211"></a><span class="lineno"> 211</span>&#160; particle-&gt;<a class="code" href="classTree_1_1AbstractType.html#a6f30d2de6725088207b9d5fbd49e07d8">set</a>(<a class="code" href="constants_8hpp.html#af2b8102aeac8f02ab62ac42828289569a972dbcdf74cff71e20bdcfb53be9c391">LOAD</a>, particle-&gt;<a class="code" href="classTree_1_1AbstractType.html#aa341d843f7ebfc7fb3f5383827e50712">get</a>(<a class="code" href="constants_8hpp.html#af2b8102aeac8f02ab62ac42828289569a972dbcdf74cff71e20bdcfb53be9c391">LOAD</a>) + tmp * (<a class="code" href="constants_8hpp.html#aed9ea78689ecce0b7264c02c7f8a9a54">G</a> * this-&gt;_m) / d);</div><div class="line"><a name="l00212"></a><span class="lineno"> 212</span>&#160; }</div><div class="line"><a name="l00213"></a><span class="lineno"> 213</span>&#160; </div><div class="line"><a name="l00217"></a><span class="lineno"><a class="line" href="classTree_1_1Cell.html#a15de536b381edf0a05654002310bdd1b"> 217</a></span>&#160; <span class="keywordtype">void</span> <a class="code" href="classTree_1_1Cell.html#a15de536b381edf0a05654002310bdd1b">del_level</a>()<span class="keyword"> override </span>{</div><div class="line"><a name="l00218"></a><span class="lineno"> 218</span>&#160; <span class="keywordflow">while</span> (!this-&gt;_next.empty()) {</div><div class="line"><a name="l00219"></a><span class="lineno"> 219</span>&#160; <span class="keyword">auto</span> next = this-&gt;_next.back();</div><div class="line"><a name="l00220"></a><span class="lineno"> 220</span>&#160; </div><div class="line"><a name="l00221"></a><span class="lineno"> 221</span>&#160; next-&gt;set_parent(<span class="keyword">nullptr</span>);</div><div class="line"><a name="l00222"></a><span class="lineno"> 222</span>&#160; <span class="keyword">delete</span> next-&gt;get_parent();</div><div class="line"><a name="l00223"></a><span class="lineno"> 223</span>&#160; </div><div class="line"><a name="l00224"></a><span class="lineno"> 224</span>&#160; this-&gt;_next.pop_back();</div><div class="line"><a name="l00225"></a><span class="lineno"> 225</span>&#160; <span class="keyword">delete</span> next;</div><div class="line"><a name="l00226"></a><span class="lineno"> 226</span>&#160; }</div><div class="line"><a name="l00227"></a><span class="lineno"> 227</span>&#160; </div><div class="line"><a name="l00228"></a><span class="lineno"> 228</span>&#160; this-&gt;_next.clear();</div><div class="line"><a name="l00229"></a><span class="lineno"> 229</span>&#160; }</div><div class="line"><a name="l00230"></a><span class="lineno"> 230</span>&#160; </div><div class="line"><a name="l00235"></a><span class="lineno"><a class="line" href="classTree_1_1Cell.html#a6bb8888a564f7b56f033de5c5c485241"> 235</a></span>&#160; <span class="keywordtype">void</span> <a class="code" href="classTree_1_1Cell.html#a6bb8888a564f7b56f033de5c5c485241">clear_next</a>()<span class="keyword"> override </span>{</div><div class="line"><a name="l00236"></a><span class="lineno"> 236</span>&#160; this-&gt;_next.clear();</div><div class="line"><a name="l00237"></a><span class="lineno"> 237</span>&#160; }</div><div class="line"><a name="l00238"></a><span class="lineno"> 238</span>&#160; </div><div class="line"><a name="l00239"></a><span class="lineno"> 239</span>&#160; <span class="keyword">private</span>:</div><div class="line"><a name="l00240"></a><span class="lineno"> 240</span>&#160; Type _center; </div><div class="line"><a name="l00241"></a><span class="lineno"> 241</span>&#160; Type _size; </div><div class="line"><a name="l00242"></a><span class="lineno"> 242</span>&#160; Type _mass_pos; </div><div class="line"><a name="l00244"></a><span class="lineno"> 244</span>&#160; vector&lt;AbstractType &lt; Type&gt;*&gt; _next{}; </div><div class="line"><a name="l00245"></a><span class="lineno"> 245</span>&#160; };</div><div class="line"><a name="l00246"></a><span class="lineno"> 246</span>&#160;}</div><div class="line"><a name="l00247"></a><span class="lineno"> 247</span>&#160; </div><div class="line"><a name="l00248"></a><span class="lineno"> 248</span>&#160;<span class="preprocessor">#endif //PHPC_NBODY_CELL_HPP</span></div></div><!-- fragment --></div><!-- contents -->
<div class="ttc" id="aclassTree_1_1AbstractType_html"><div class="ttname"><a href="classTree_1_1AbstractType.html">Tree::AbstractType</a></div><div class="ttdef"><b>Definition:</b> Tree.hpp:45</div></div>
<div class="ttc" id="aconstants_8hpp_html_af2b8102aeac8f02ab62ac42828289569a91743bc3932693c4b8a6ca984e8a8437"><div class="ttname"><a href="constants_8hpp.html#af2b8102aeac8f02ab62ac42828289569a91743bc3932693c4b8a6ca984e8a8437">POS</a></div><div class="ttdef"><b>Definition:</b> constants.hpp:58</div></div>
<div class="ttc" id="aconstants_8hpp_html_af2b8102aeac8f02ab62ac42828289569aef9ad485b29b65c89dd94b1fb31ad262"><div class="ttname"><a href="constants_8hpp.html#af2b8102aeac8f02ab62ac42828289569aef9ad485b29b65c89dd94b1fb31ad262">MASS_POS</a></div><div class="ttdef"><b>Definition:</b> constants.hpp:63</div></div>
<div class="ttc" id="aclassTree_1_1AbstractType_html_a133cc78f06baa5cd6de0536ce6293b27"><div class="ttname"><a href="classTree_1_1AbstractType.html#a133cc78f06baa5cd6de0536ce6293b27">Tree::AbstractType::find_cell_idx</a></div><div class="ttdeci">virtual int find_cell_idx(Type origin)</div><div class="ttdef"><b>Definition:</b> Tree.hpp:130</div></div>
<div class="ttc" id="aconstants_8hpp_html_af2b8102aeac8f02ab62ac42828289569a972dbcdf74cff71e20bdcfb53be9c391"><div class="ttname"><a href="constants_8hpp.html#af2b8102aeac8f02ab62ac42828289569a972dbcdf74cff71e20bdcfb53be9c391">LOAD</a></div><div class="ttdef"><b>Definition:</b> constants.hpp:60</div></div>
<div class="ttc" id="aclassTree_1_1Cell_html_af7235dfa3cc04f2178305b0b0cf78088"><div class="ttname"><a href="classTree_1_1Cell.html#af7235dfa3cc04f2178305b0b0cf78088">Tree::Cell::get</a></div><div class="ttdeci">Type get(property p) override</div><div class="ttdef"><b>Definition:</b> Cell.hpp:89</div></div>
<div class="ttc" id="aclassTree_1_1Cell_html_af21148788c828df1da95cac591a785aa"><div class="ttname"><a href="classTree_1_1Cell.html#af21148788c828df1da95cac591a785aa">Tree::Cell::get_next</a></div><div class="ttdeci">vector&lt; AbstractType&lt; Type &gt; * &gt; get_next() override</div><div class="ttdef"><b>Definition:</b> Cell.hpp:78</div></div>
<div class="ttc" id="aconstants_8hpp_html_aed9ea78689ecce0b7264c02c7f8a9a54"><div class="ttname"><a href="constants_8hpp.html#aed9ea78689ecce0b7264c02c7f8a9a54">G</a></div><div class="ttdeci">#define G</div><div class="ttdef"><b>Definition:</b> constants.hpp:37</div></div>
<div class="ttc" id="aconstants_8hpp_html_ae4abc233898f783a9cb9b8aea5ae5e37"><div class="ttname"><a href="constants_8hpp.html#ae4abc233898f783a9cb9b8aea5ae5e37">NB_DIM</a></div><div class="ttdeci">#define NB_DIM</div><div class="ttdef"><b>Definition:</b> constants.hpp:43</div></div>
<div class="ttc" id="aTree_8hpp_html"><div class="ttname"><a href="Tree_8hpp.html">Tree.hpp</a></div></div>
<div class="ttc" id="aclassTree_1_1Cell_html_aea6cc225e04be7a847fc7efbed7e8575"><div class="ttname"><a href="classTree_1_1Cell.html#aea6cc225e04be7a847fc7efbed7e8575">Tree::Cell::subdivide_tree</a></div><div class="ttdeci">void subdivide_tree() override</div><div class="ttdef"><b>Definition:</b> Cell.hpp:130</div></div>
<div class="ttc" id="aclassTree_1_1AbstractType_html_ad7cceb10806bfdba07c934a970c2a3e5"><div class="ttname"><a href="classTree_1_1AbstractType.html#ad7cceb10806bfdba07c934a970c2a3e5">Tree::AbstractType::update_cell</a></div><div class="ttdeci">virtual void update_cell(bool add)</div><div class="ttdef"><b>Definition:</b> Tree.hpp:159</div></div>
<div class="ttc" id="aclassTree_1_1AbstractType_html_a6f30d2de6725088207b9d5fbd49e07d8"><div class="ttname"><a href="classTree_1_1AbstractType.html#a6f30d2de6725088207b9d5fbd49e07d8">Tree::AbstractType::set</a></div><div class="ttdeci">virtual void set(property p, Type vec)</div><div class="ttdef"><b>Definition:</b> Tree.hpp:120</div></div>
<div class="ttc" id="anamespaceTree_html_af3bca205e37bd9b9c4b2fdc38ba6d3adaae6da3ea39dc23179342990ff167ccb7"><div class="ttname"><a href="namespaceTree.html#af3bca205e37bd9b9c4b2fdc38ba6d3adaae6da3ea39dc23179342990ff167ccb7">Tree::ParticleT</a></div><div class="ttdef"><b>Definition:</b> Tree.hpp:35</div></div>
<div class="ttc" id="aclassTree_1_1Cell_html_a1d680cfdeba1e1bbc97ed7e0d606160e"><div class="ttname"><a href="classTree_1_1Cell.html#a1d680cfdeba1e1bbc97ed7e0d606160e">Tree::Cell::store_particle</a></div><div class="ttdeci">void store_particle(AbstractType&lt; Type &gt; *particle, AbstractType&lt; Type &gt; *prev_part) override</div><div class="ttdef"><b>Definition:</b> Cell.hpp:164</div></div>
<div class="ttc" id="aclassTree_1_1AbstractType_html_a8b04149e350613d4c133c053b761f175"><div class="ttname"><a href="classTree_1_1AbstractType.html#a8b04149e350613d4c133c053b761f175">Tree::AbstractType::set_parent</a></div><div class="ttdeci">void set_parent(AbstractType&lt; Type &gt; *parent)</div><div class="ttdef"><b>Definition:</b> Tree.hpp:111</div></div>
<div class="ttc" id="aconstants_8hpp_html_af2b8102aeac8f02ab62ac42828289569a2159ffbd3a68037511ab5ab4dd35ace7"><div class="ttname"><a href="constants_8hpp.html#af2b8102aeac8f02ab62ac42828289569a2159ffbd3a68037511ab5ab4dd35ace7">CENTER</a></div><div class="ttdef"><b>Definition:</b> constants.hpp:62</div></div>
<div class="ttc" id="aclassTree_1_1Cell_html_ae436db01b4cb7edfa7eee00408544155"><div class="ttname"><a href="classTree_1_1Cell.html#ae436db01b4cb7edfa7eee00408544155">Tree::Cell::set</a></div><div class="ttdeci">void set(property p, Type vec) override</div><div class="ttdef"><b>Definition:</b> Cell.hpp:111</div></div>
<div class="ttc" id="aconstants_8hpp_html_af2b8102aeac8f02ab62ac42828289569a6c8e5f290be4be86fd5e7048654b4a50"><div class="ttname"><a href="constants_8hpp.html#af2b8102aeac8f02ab62ac42828289569a6c8e5f290be4be86fd5e7048654b4a50">DIM</a></div><div class="ttdef"><b>Definition:</b> constants.hpp:61</div></div>
<div class="ttc" id="anamespaceTree_html_af3bca205e37bd9b9c4b2fdc38ba6d3ada23eab4d4abc1c5b4de5ff2243bd1d82f"><div class="ttname"><a href="namespaceTree.html#af3bca205e37bd9b9c4b2fdc38ba6d3ada23eab4d4abc1c5b4de5ff2243bd1d82f">Tree::CellT</a></div><div class="ttdef"><b>Definition:</b> Tree.hpp:36</div></div>
<div class="ttc" id="aconstants_8hpp_html"><div class="ttname"><a href="constants_8hpp.html">constants.hpp</a></div></div>
<div class="ttc" id="anamespaceTree_html"><div class="ttname"><a href="namespaceTree.html">Tree</a></div></div>
<div class="ttc" id="aclassTree_1_1Cell_html_a245d18d5845acdb347a1e9e0f16b1c1f"><div class="ttname"><a href="classTree_1_1Cell.html#a245d18d5845acdb347a1e9e0f16b1c1f">Tree::Cell::~Cell</a></div><div class="ttdeci">~Cell() override</div><div class="ttdef"><b>Definition:</b> Cell.hpp:55</div></div>
<div class="ttc" id="aclassTree_1_1Cell_html_a859971aba19dd8b9b91e668f22a5515e"><div class="ttname"><a href="classTree_1_1Cell.html#a859971aba19dd8b9b91e668f22a5515e">Tree::Cell::get_type</a></div><div class="ttdeci">my_type get_type() override</div><div class="ttdef"><b>Definition:</b> Cell.hpp:70</div></div>
<div class="ttc" id="aclassTree_1_1Cell_html"><div class="ttname"><a href="classTree_1_1Cell.html">Tree::Cell</a></div><div class="ttdef"><b>Definition:</b> Cell.hpp:40</div></div>
<div class="ttc" id="aconstants_8hpp_html_a002b2f4894492820fe708b1b7e7c5e70"><div class="ttname"><a href="constants_8hpp.html#a002b2f4894492820fe708b1b7e7c5e70">EPSILON</a></div><div class="ttdeci">#define EPSILON</div><div class="ttdef"><b>Definition:</b> constants.hpp:38</div></div>
<div class="ttc" id="aclassTree_1_1Cell_html_a15de536b381edf0a05654002310bdd1b"><div class="ttname"><a href="classTree_1_1Cell.html#a15de536b381edf0a05654002310bdd1b">Tree::Cell::del_level</a></div><div class="ttdeci">void del_level() override</div><div class="ttdef"><b>Definition:</b> Cell.hpp:217</div></div>
<div class="ttc" id="aclassTree_1_1Cell_html_aea696dfadd4cb15026f9695afff44b2b"><div class="ttname"><a href="classTree_1_1Cell.html#aea696dfadd4cb15026f9695afff44b2b">Tree::Cell::Cell</a></div><div class="ttdeci">Cell(Type center=Type(), Type dim=Type(), Type mass_pos=Type())</div><div class="ttdef"><b>Definition:</b> Cell.hpp:49</div></div>
<div class="ttc" id="anamespacestd_html"><div class="ttname"><a href="namespacestd.html">std</a></div></div>
<div class="ttc" id="aconstants_8hpp_html_af2b8102aeac8f02ab62ac42828289569"><div class="ttname"><a href="constants_8hpp.html#af2b8102aeac8f02ab62ac42828289569">property</a></div><div class="ttdeci">property</div><div class="ttdef"><b>Definition:</b> constants.hpp:57</div></div>
<div class="ttc" id="aclassTree_1_1Cell_html_ab175ea91ec54a35f4a3cccbdeb79bdff"><div class="ttname"><a href="classTree_1_1Cell.html#ab175ea91ec54a35f4a3cccbdeb79bdff">Tree::Cell::compute_load</a></div><div class="ttdeci">void compute_load(AbstractType&lt; Type &gt; *particle) override</div><div class="ttdef"><b>Definition:</b> Cell.hpp:208</div></div>
<div class="ttc" id="aclassTree_1_1AbstractType_html_a0abe13ac95cb5f0938189a1d461f06a4"><div class="ttname"><a href="classTree_1_1AbstractType.html#a0abe13ac95cb5f0938189a1d461f06a4">Tree::AbstractType::store_particle</a></div><div class="ttdeci">virtual void store_particle(AbstractType&lt; Type &gt; *particle, AbstractType&lt; Type &gt; *prev_part)</div><div class="ttdef"><b>Definition:</b> Tree.hpp:181</div></div>
<div class="ttc" id="aclassTree_1_1AbstractType_html_aa341d843f7ebfc7fb3f5383827e50712"><div class="ttname"><a href="classTree_1_1AbstractType.html#aa341d843f7ebfc7fb3f5383827e50712">Tree::AbstractType::get</a></div><div class="ttdeci">virtual Type get(property p)=0</div></div>
<div class="ttc" id="anamespaceTree_html_af3bca205e37bd9b9c4b2fdc38ba6d3ad"><div class="ttname"><a href="namespaceTree.html#af3bca205e37bd9b9c4b2fdc38ba6d3ad">Tree::my_type</a></div><div class="ttdeci">my_type</div><div class="ttdef"><b>Definition:</b> Tree.hpp:34</div></div>
<div class="ttc" id="aVector_8hpp_html"><div class="ttname"><a href="Vector_8hpp.html">Vector.hpp</a></div></div>
<div class="ttc" id="aclassTree_1_1Cell_html_a6bb8888a564f7b56f033de5c5c485241"><div class="ttname"><a href="classTree_1_1Cell.html#a6bb8888a564f7b56f033de5c5c485241">Tree::Cell::clear_next</a></div><div class="ttdeci">void clear_next() override</div><div class="ttdef"><b>Definition:</b> Cell.hpp:235</div></div>
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.16
</small></address>
</body>
</html>

Event Timeline