<!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"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.12"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>DFNgen: removeFractures.cpp 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="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</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">DFNgen
   &#160;<span id="projectnumber">2.0</span>
   </div>
   <div id="projectbrief">DFN Model Generator</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.12 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('remove_fractures_8cpp_source.html','');});
</script>
<div id="doc-content">
<!-- 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 class="header">
  <div class="headertitle">
<div class="title">removeFractures.cpp</div>  </div>
</div><!--header-->
<div class="contents">
<a href="remove_fractures_8cpp.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;<span class="preprocessor">#include &quot;<a class="code" href="remove_fractures_8h.html">removeFractures.h</a>&quot;</span></div><div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="computational_geometry_8h.html">computationalGeometry.h</a>&quot;</span></div><div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="structures_8h.html">structures.h</a>&quot;</span></div><div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="input_8h.html">input.h</a>&quot;</span></div><div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="preprocessor">#include &lt;vector&gt;</span></div><div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;<span class="preprocessor">#include &lt;algorithm&gt;</span></div><div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;<span class="preprocessor">#include &lt;iostream&gt;</span></div><div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;</div><div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="comment">/***********************************************************************/</span></div><div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;<span class="comment">/***********  Remove Fractures Smaller Than Minimum Size  **************/</span></div><div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<span class="comment">// Function is designed to be used AFTER DFN generation</span></div><div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;<span class="comment">// Originally created to compare the difference in distributions </span></div><div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;<span class="comment">// if small fractures were removed after a DFN was generated </span></div><div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;<span class="comment">// as opposed limiting their insertion during DFN generation.</span></div><div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;<span class="comment">//</span></div><div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;<span class="comment">// The minimum size options in the input files will still be used. </span></div><div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;<span class="comment">// If the user wishes to also removeFractures after DFN generation,</span></div><div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;<span class="comment">// &#39;minSize&#39; here must be larger than the minimum size fractures in the </span></div><div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;<span class="comment">// input file. Fratrues with radii less than &#39;minSize&#39; will be removed</span></div><div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;<span class="comment">// after DFN has been created.</span></div><div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;<span class="comment">// Arg 1: Minimum size. All fractures smaller than &#39;minSize&#39; will be</span></div><div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;<span class="comment">//        removed.</span></div><div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;<span class="comment">// Arg 2: Array of accepted polygons</span></div><div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;<span class="comment">// Arg 3: Array of accepted intersections</span></div><div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160;<span class="comment">// Arg 4: Array of all triple intersection points</span></div><div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160;<span class="comment">// Arg 5: Stats structure (DFN Statisctics) </span></div><div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;<span class="comment">//</span></div><div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;<span class="comment">// NOTE: Must be executed before getCluster()</span></div><div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160;<span class="comment">//       This funciton rebuilds the DFN. Using getCluster() before this </span></div><div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;<span class="comment">//       funciton executes causes undefined behavior. </span></div><div class="line"><a name="l00031"></a><span class="lineno"><a class="line" href="remove_fractures_8h.html#a016a4a3e0104523549279e6f6cf6c6d8">   31</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="remove_fractures_8cpp.html#a016a4a3e0104523549279e6f6cf6c6d8">removeFractures</a>(<span class="keywordtype">double</span> minSize, std::vector&lt;Poly&gt; &amp;acceptedPolys, std::vector&lt;IntPoints&gt; &amp;intPts, std::vector&lt;Point&gt; triplePoints, <a class="code" href="struct_stats.html">Stats</a> &amp;pstats) {</div><div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;</div><div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160;    std::vector&lt;Poly&gt; finalPolyList;</div><div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160;    </div><div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160;    <span class="comment">// Clear GroupData</span></div><div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160;    pstats.<a class="code" href="struct_stats.html#ae4c56b074f1d02cc1ce798790fc9dcab">groupData</a>.clear();</div><div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;    <span class="comment">// Clear FractGroup </span></div><div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;    pstats.<a class="code" href="struct_stats.html#a15b646bf15b9fa5aad461bf8fb9d27ff">fractGroup</a>.clear();</div><div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160;    <span class="comment">// Clear Triple Points</span></div><div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160;    triplePoints.clear(); </div><div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;    <span class="comment">// Clear IntPoints</span></div><div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160;    intPts.clear();</div><div class="line"><a name="l00043"></a><span class="lineno">   43</span>&#160;</div><div class="line"><a name="l00044"></a><span class="lineno">   44</span>&#160;    <span class="comment">// Re-init nextGroupNum</span></div><div class="line"><a name="l00045"></a><span class="lineno">   45</span>&#160;    pstats.<a class="code" href="struct_stats.html#ac4e4a2e4e084716a6dbd3ce08461282f">nextGroupNum</a> = 1;</div><div class="line"><a name="l00046"></a><span class="lineno">   46</span>&#160;</div><div class="line"><a name="l00047"></a><span class="lineno">   47</span>&#160;    <span class="keywordflow">for</span> (<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i = 0; i &lt; acceptedPolys.size(); i++) {</div><div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;</div><div class="line"><a name="l00049"></a><span class="lineno">   49</span>&#160;        <span class="keywordflow">if</span> (acceptedPolys[i].xradius &lt; minSize) {</div><div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160;            <span class="keyword">delete</span>[] acceptedPolys[i].vertices;</div><div class="line"><a name="l00051"></a><span class="lineno">   51</span>&#160;            <span class="keywordflow">continue</span>;</div><div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160;        }</div><div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160;</div><div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160;        <a class="code" href="struct_poly.html">Poly</a> newPoly = acceptedPolys[i];</div><div class="line"><a name="l00055"></a><span class="lineno">   55</span>&#160;</div><div class="line"><a name="l00056"></a><span class="lineno">   56</span>&#160;        newPoly.<a class="code" href="struct_poly.html#add8e39b7f48274757f46c80014aaeb6b">groupNum</a> = 0; <span class="comment">// Reset cluster group number </span></div><div class="line"><a name="l00057"></a><span class="lineno">   57</span>&#160;    </div><div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160;        newPoly.<a class="code" href="struct_poly.html#aa6c373c49a4e0ab7c83a353a9f8cf518">intersectionIndex</a>.clear(); <span class="comment">// Remove ref to old intersections</span></div><div class="line"><a name="l00059"></a><span class="lineno">   59</span>&#160;</div><div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160;        <span class="comment">// Find line of intersection and FRAM check</span></div><div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160;        <span class="keywordtype">int</span> rejectCode = <a class="code" href="computational_geometry_8cpp.html#a38a8c322dba7d8518a4c3206cd55a5f6">intersectionChecking</a>(newPoly, finalPolyList, intPts, pstats, triplePoints);</div><div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160;</div><div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;        <span class="comment">// IF POLY ACCEPTED:</span></div><div class="line"><a name="l00064"></a><span class="lineno">   64</span>&#160;        <span class="keywordflow">if</span> (rejectCode == 0) { <span class="comment">// Intersections are ok</span></div><div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160;</div><div class="line"><a name="l00066"></a><span class="lineno">   66</span>&#160;            <span class="comment">// SAVING POLYGON (intersection and triple points saved witchin intersectionChecking())        </span></div><div class="line"><a name="l00067"></a><span class="lineno">   67</span>&#160;            finalPolyList.push_back(newPoly); <span class="comment">// SAVE newPoly to accepted polys list</span></div><div class="line"><a name="l00068"></a><span class="lineno">   68</span>&#160;        }</div><div class="line"><a name="l00069"></a><span class="lineno">   69</span>&#160;</div><div class="line"><a name="l00070"></a><span class="lineno">   70</span>&#160;        <span class="keywordflow">else</span> { <span class="comment">// Poly rejected</span></div><div class="line"><a name="l00071"></a><span class="lineno">   71</span>&#160;</div><div class="line"><a name="l00072"></a><span class="lineno">   72</span>&#160;            std::cout &lt;&lt; <span class="stringliteral">&quot;\nError rebuilding dfn, previously accepted fracture was rejected during DFN rebuild.\n&quot;</span>;</div><div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160;        }</div><div class="line"><a name="l00074"></a><span class="lineno">   74</span>&#160;    }</div><div class="line"><a name="l00075"></a><span class="lineno">   75</span>&#160;</div><div class="line"><a name="l00076"></a><span class="lineno">   76</span>&#160;    std::cout &lt;&lt; <span class="stringliteral">&quot;Rebuilding DFN complete.\n&quot;</span>;</div><div class="line"><a name="l00077"></a><span class="lineno">   77</span>&#160;</div><div class="line"><a name="l00078"></a><span class="lineno">   78</span>&#160;    acceptedPolys.clear();</div><div class="line"><a name="l00079"></a><span class="lineno">   79</span>&#160;    acceptedPolys = finalPolyList;</div><div class="line"><a name="l00080"></a><span class="lineno">   80</span>&#160;}</div><div class="line"><a name="l00081"></a><span class="lineno">   81</span>&#160;</div><div class="line"><a name="l00082"></a><span class="lineno">   82</span>&#160;</div><div class="ttc" id="computational_geometry_8h_html"><div class="ttname"><a href="computational_geometry_8h.html">computationalGeometry.h</a></div></div>
<div class="ttc" id="struct_poly_html_add8e39b7f48274757f46c80014aaeb6b"><div class="ttname"><a href="struct_poly.html#add8e39b7f48274757f46c80014aaeb6b">Poly::groupNum</a></div><div class="ttdeci">unsigned int groupNum</div><div class="ttdef"><b>Definition:</b> <a href="structures_8h_source.html#l00030">structures.h:30</a></div></div>
<div class="ttc" id="input_8h_html"><div class="ttname"><a href="input_8h.html">input.h</a></div></div>
<div class="ttc" id="struct_poly_html"><div class="ttname"><a href="struct_poly.html">Poly</a></div><div class="ttdef"><b>Definition:</b> <a href="structures_8h_source.html#l00012">structures.h:12</a></div></div>
<div class="ttc" id="structures_8h_html"><div class="ttname"><a href="structures_8h.html">structures.h</a></div></div>
<div class="ttc" id="struct_stats_html_a15b646bf15b9fa5aad461bf8fb9d27ff"><div class="ttname"><a href="struct_stats.html#a15b646bf15b9fa5aad461bf8fb9d27ff">Stats::fractGroup</a></div><div class="ttdeci">std::vector&lt; struct FractureGroups &gt; fractGroup</div><div class="ttdef"><b>Definition:</b> <a href="structures_8h_source.html#l00374">structures.h:374</a></div></div>
<div class="ttc" id="struct_stats_html_ae4c56b074f1d02cc1ce798790fc9dcab"><div class="ttname"><a href="struct_stats.html#ae4c56b074f1d02cc1ce798790fc9dcab">Stats::groupData</a></div><div class="ttdeci">std::vector&lt; struct GroupData &gt; groupData</div><div class="ttdef"><b>Definition:</b> <a href="structures_8h_source.html#l00376">structures.h:376</a></div></div>
<div class="ttc" id="struct_stats_html_ac4e4a2e4e084716a6dbd3ce08461282f"><div class="ttname"><a href="struct_stats.html#ac4e4a2e4e084716a6dbd3ce08461282f">Stats::nextGroupNum</a></div><div class="ttdeci">unsigned long long int nextGroupNum</div><div class="ttdef"><b>Definition:</b> <a href="structures_8h_source.html#l00336">structures.h:336</a></div></div>
<div class="ttc" id="struct_stats_html"><div class="ttname"><a href="struct_stats.html">Stats</a></div><div class="ttdef"><b>Definition:</b> <a href="structures_8h_source.html#l00277">structures.h:277</a></div></div>
<div class="ttc" id="struct_poly_html_aa6c373c49a4e0ab7c83a353a9f8cf518"><div class="ttname"><a href="struct_poly.html#aa6c373c49a4e0ab7c83a353a9f8cf518">Poly::intersectionIndex</a></div><div class="ttdeci">std::vector&lt; unsigned int &gt; intersectionIndex</div><div class="ttdef"><b>Definition:</b> <a href="structures_8h_source.html#l00098">structures.h:98</a></div></div>
<div class="ttc" id="remove_fractures_8cpp_html_a016a4a3e0104523549279e6f6cf6c6d8"><div class="ttname"><a href="remove_fractures_8cpp.html#a016a4a3e0104523549279e6f6cf6c6d8">removeFractures</a></div><div class="ttdeci">void removeFractures(double minSize, std::vector&lt; Poly &gt; &amp;acceptedPolys, std::vector&lt; IntPoints &gt; &amp;intPts, std::vector&lt; Point &gt; triplePoints, Stats &amp;pstats)</div><div class="ttdef"><b>Definition:</b> <a href="remove_fractures_8cpp_source.html#l00031">removeFractures.cpp:31</a></div></div>
<div class="ttc" id="computational_geometry_8cpp_html_a38a8c322dba7d8518a4c3206cd55a5f6"><div class="ttname"><a href="computational_geometry_8cpp.html#a38a8c322dba7d8518a4c3206cd55a5f6">intersectionChecking</a></div><div class="ttdeci">int intersectionChecking(struct Poly &amp;newPoly, std::vector&lt; Poly &gt; &amp;acceptedPoly, std::vector&lt; IntPoints &gt; &amp;intPtsList, struct Stats &amp;pstats, std::vector&lt; Point &gt; &amp;triplePoints)</div><div class="ttdef"><b>Definition:</b> <a href="computational_geometry_8cpp_source.html#l00870">computationalGeometry.cpp:870</a></div></div>
<div class="ttc" id="remove_fractures_8h_html"><div class="ttname"><a href="remove_fractures_8h.html">removeFractures.h</a></div></div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="remove_fractures_8cpp.html">removeFractures.cpp</a></li>
    <li class="footer">Generated by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.12 </li>
  </ul>
</div>
</body>
</html>
