Chombo + EB  3.2
KDStruct.H
Go to the documentation of this file.
1 /*
2 
3 LICENSE NOTICE
4 
5 This source code is a part of the Project X software library. Project X
6 solves partial differential equations
7 in multiple dimensions using an adaptive, discontinuous Galerkin finite
8 element method, and has been
9 specifically designed to solve the compressible Euler and Navier-Stokes
10 equations.
11 
12 Copyright © 2003-2007 Massachusetts Institute of Technology
13 
14 
15 
16 This library is free software; you can redistribute it and/or modify it
17 under the terms of the GNU Lesser
18 General Public License as published by the Free Software Foundation;
19 either version 2.1 of the License,
20 or (at your option) any later version.
21 
22 
23 
24 This library is distributed in the hope that it will be useful, but
25 WITHOUT ANY WARRANTY; without even the
26 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
27 See the GNU Lesser
28 General Public License in lgpl.txt for more details.
29 
30 
31 
32 You should have received a copy of the GNU Lesser General Public License
33 along with this library; if not, write
34 to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
35 Boston, MA 02111-1307 USA.
36 
37 This software was developed with the assistance of Government
38 sponsorship related to Government Contract
39 Number F33615-03-D-3306. The Government retains certain rights to this
40 software under that Contract.
41 
42 
43 For more information about Project X, please contact:
44 
45 
46 David L. Darmofal
47 Department of Aeronautics & Astronautics
48 Massachusetts Institute of Technology
49 77 Massachusetts Ave, Room 37-401
50 Cambridge, MA 02139
51 
52 Phone: (617) 258-0743
53 FAX: (617) 258-5143
54 
55 E-MAIL: [email protected]
56 URL: http://raphael.mit.edu
57 
58 */
59 
60 
61 #ifndef _KDSTRUCT_H_
62 #define _KDSTRUCT_H_
63 
64 #include "REAL.H"
65 #include "NamespaceHeader.H" // for Chombo
66 
67 /*!
68  \file PXKDStruct.h
69 
70  This header file defines the structures used to create KDTrees
71  and LinkedLists in ProjectX.
72 */
73 
74 
75 #define KD_MAX_DIM 4
76 
77 typedef struct _kdnode KDNode;
78 struct _kdnode {
79  void *data;
80  struct _kdnode *left, *right; /* negative/positive side */
84  unsigned char dir;
85 };
86 
87 typedef struct _resultnode ResultNode;
88 struct _resultnode {
89  //KDNode *item;
90  void *data; //ptr to data from the kdnode
91  Real *pos; //ptr to coordinates of kdnode
93  struct _resultnode *next;
94 };
95 
96 
97 typedef struct _kdtree KDTree;
98 struct _kdtree {
100  int dim;
102  /* value: -1 => destr == NULL == globalData, no node-based data to free
103  0 => destr != NULL, globalData == NULL, destr called on each node's data ptr
104  1 => destr != NULL, globalData != NULL, destr called on globalData ptr (only once)
105  */
106  void *globalData;
107  void (*destr)(void*); //function called to release memory
108 };
109 
110 typedef struct _kdres KDResult;
111 struct _kdres {
113  ResultNode *rlist, *riter;
114  int size;
115 };
116 
117 typedef struct _linkedlistnode LListNode;
119  void *data;
122 };
123 
124 typedef struct _linkedlisthead ListHead;
126  LListNode *llist, *listIter;
127  int size;
128  int ordered;
129  void (*destr)(void*);
130 };
131 
132 #include "NamespaceFooter.H" // for Chombo
133 #endif
Definition: KDStruct.H:78
int size
Definition: KDStruct.H:127
int dim
Definition: KDStruct.H:100
Definition: KDStruct.H:88
struct _kdnode * right
Definition: KDStruct.H:80
int ordered
Definition: KDStruct.H:128
void * data
Definition: KDStruct.H:119
void * data
Definition: KDStruct.H:79
Real * pos
Definition: KDStruct.H:91
char globalDestrFlag
Definition: KDStruct.H:101
Real xmin[KD_MAX_DIM]
Definition: KDStruct.H:82
Definition: KDStruct.H:98
struct _linkedlistnode * next
Definition: KDStruct.H:121
double Real
Definition: REAL.H:33
void * data
Definition: KDStruct.H:90
#define KD_MAX_DIM
Definition: KDStruct.H:75
Definition: KDStruct.H:111
int size
Definition: KDStruct.H:114
struct _kdnode * left
Definition: KDStruct.H:80
void * globalData
Definition: KDStruct.H:106
KDTree * tree
Definition: KDStruct.H:112
KDNode * root
Definition: KDStruct.H:99
Real key
Definition: KDStruct.H:120
struct _resultnode * next
Definition: KDStruct.H:93
Real pos[KD_MAX_DIM]
Definition: KDStruct.H:81
Definition: KDStruct.H:125
unsigned char dir
Definition: KDStruct.H:84
Real dist_sq
Definition: KDStruct.H:92
LListNode * llist
Definition: KDStruct.H:126
ResultNode * rlist
Definition: KDStruct.H:113
Definition: KDStruct.H:118
Real xmax[KD_MAX_DIM]
Definition: KDStruct.H:83