array operations

This commit is contained in:
Joachim Schoeberl 2013-04-02 20:31:02 +00:00
parent c46329ebf7
commit 27861d15a0
3 changed files with 35 additions and 5 deletions

View File

@ -1702,9 +1702,9 @@ namespace netgen
const float * bmax, const float * bmax,
Array<int> & pis) const Array<int> & pis) const
{ {
static Array<inttn6> stack(10000); // static Array<inttn6> stack(10000);
// stack.SetSize (10000);
stack.SetSize (10000); ArrayMem<inttn6,10000> stack(10000);
pis.SetSize(0); pis.SetSize(0);
stack[0].node = root; stack[0].node = root;
@ -1717,7 +1717,6 @@ namespace netgen
int dir = stack[stacks].dir; int dir = stack[stacks].dir;
stacks--; stacks--;
if (node->pi != -1) if (node->pi != -1)
{ {
if (node->data[0] > bmax[0] || if (node->data[0] > bmax[0] ||
@ -1728,8 +1727,10 @@ namespace netgen
node->data[5] < bmin[5]) node->data[5] < bmin[5])
; ;
else else
{
pis.Append (node->pi); pis.Append (node->pi);
} }
}
int ndir = (dir+1) % 6; int ndir = (dir+1) % 6;
@ -2112,6 +2113,18 @@ namespace netgen
Box3dTree :: Box3dTree (const Box<3> & abox)
{
boxpmin = abox.PMin();
boxpmax = abox.PMax();
float tpmin[6], tpmax[6];
for (int i = 0; i < 3; i++)
{
tpmin[i] = tpmin[i+3] = boxpmin(i);
tpmax[i] = tpmax[i+3] = boxpmax(i);
}
tree = new ADTree6 (tpmin, tpmax);
}
Box3dTree :: Box3dTree (const Point<3> & apmin, const Point<3> & apmax) Box3dTree :: Box3dTree (const Point<3> & apmin, const Point<3> & apmax)
{ {

View File

@ -466,6 +466,7 @@ class Box3dTree
ADTree6 * tree; ADTree6 * tree;
Point<3> boxpmin, boxpmax; Point<3> boxpmin, boxpmax;
public: public:
Box3dTree (const Box<3> & abox);
Box3dTree (const Point<3> & apmin, const Point<3> & apmax); Box3dTree (const Point<3> & apmin, const Point<3> & apmax);
~Box3dTree (); ~Box3dTree ();
void Insert (const Point<3> & bmin, const Point<3> & bmax, int pi); void Insert (const Point<3> & bmin, const Point<3> & bmax, int pi);

View File

@ -239,6 +239,22 @@ namespace netgen
} }
} }
template <typename T1, typename T2>
void Set (const IndirectArray<T1, T2> & points)
{
Set (points[points.Begin()]);
for (int i = points.Begin()+1; i < points.End(); i++)
Add (points[i]);
}
template <typename T1, typename T2>
void Add (const IndirectArray<T1, T2> & points)
{
for (int i = points.Begin(); i < points.End(); i++)
Add (points[i]);
}
Point<D> Center () const Point<D> Center () const
{ {
Point<D> c; Point<D> c;