[MOAB-dev] r5662 - MOAB/trunk/src/moab/point_locater
rhl6856 at mcs.anl.gov
rhl6856 at mcs.anl.gov
Fri Aug 3 13:37:19 CDT 2012
Author: rhl6856
Date: 2012-08-03 13:37:19 -0500 (Fri, 03 Aug 2012)
New Revision: 5662
Modified:
MOAB/trunk/src/moab/point_locater/element_tree.hpp
Log:
much more progress on element tree
Modified: MOAB/trunk/src/moab/point_locater/element_tree.hpp
===================================================================
--- MOAB/trunk/src/moab/point_locater/element_tree.hpp 2012-08-03 18:37:19 UTC (rev 5661)
+++ MOAB/trunk/src/moab/point_locater/element_tree.hpp 2012-08-03 18:37:19 UTC (rev 5662)
@@ -14,6 +14,8 @@
#include <algorithm>
#include <deque>
#include <bitset>
+#include <numeric>
+#include <cmath>
#ifndef ELEMENT_TREE_HPP
#define ELEMENT_TREE_HPP
@@ -37,6 +39,8 @@
typedef typename std::vector< double> Vector;
Box(): max(3,0.0), min(3,0.0){}
Box( const Box & from): max( from.max), min( from.min){}
+ template< typename Iterator>
+ Box( Iterator begin, Iterator end):max( begin,end), min(begin,end){}
Box& operator=( const Box & from){
max = from.max;
min = from.min;
@@ -55,27 +59,27 @@
template< typename Data>
struct Split_comparator {
- //max - min for correctness. it *might* be slightly slower
- //but that is unlikely. compiler should optimize this.
+ //we minimizes ||left| - |right|| + |middle|^2
const std::size_t split_objective( const Data & a) const {
- const int max = 2*(a.sizes[ 2]>a.sizes[ 0]);
- return (a.sizes[ max] -a.sizes[ 2*(1-(max==2))]) +
- a.sizes[ 1]*a.sizes[ 1];
+ const int max = 2*(a.second.sizes[ 2]>a.second.sizes[ 0]);
+ return (a.second.sizes[ max] -a.second.sizes[ 2*(1-(max==2))]) +
+ a.second.sizes[ 1]*a.second.sizes[ 1];
}
bool operator()( const Data & a, const Data & b) const {
return split_objective( a) < split_objective( b);
}
};
-template< typename _Entity_handles>
+template< typename _Entity_handles, typename _Entities>
class Node{
//public types:
public:
typedef _Entity_handles Entity_handles;
+ typedef _Entities Entities;
//private types:
More information about the moab-dev
mailing list