00001 /* 00002 00003 LICENSE NOTICE 00004 00005 This source code is a part of the Project X software library. Project X 00006 solves partial differential equations 00007 in multiple dimensions using an adaptive, discontinuous Galerkin finite 00008 element method, and has been 00009 specifically designed to solve the compressible Euler and Navier-Stokes 00010 equations. 00011 00012 Copyright © 2003-2007 Massachusetts Institute of Technology 00013 00014 00015 00016 This library is free software; you can redistribute it and/or modify it 00017 under the terms of the GNU Lesser 00018 General Public License as published by the Free Software Foundation; 00019 either version 2.1 of the License, 00020 or (at your option) any later version. 00021 00022 00023 00024 This library is distributed in the hope that it will be useful, but 00025 WITHOUT ANY WARRANTY; without even the 00026 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00027 See the GNU Lesser 00028 General Public License in lgpl.txt for more details. 00029 00030 00031 00032 You should have received a copy of the GNU Lesser General Public License 00033 along with this library; if not, write 00034 to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, 00035 Boston, MA 02111-1307 USA. 00036 00037 This software was developed with the assistance of Government 00038 sponsorship related to Government Contract 00039 Number F33615-03-D-3306. The Government retains certain rights to this 00040 software under that Contract. 00041 00042 00043 For more information about Project X, please contact: 00044 00045 00046 David L. Darmofal 00047 Department of Aeronautics & Astronautics 00048 Massachusetts Institute of Technology 00049 77 Massachusetts Ave, Room 37-401 00050 Cambridge, MA 02139 00051 00052 Phone: (617) 258-0743 00053 FAX: (617) 258-5143 00054 00055 E-MAIL: [email protected] 00056 URL: http://raphael.mit.edu 00057 00058 */ 00059 00060 00061 #ifndef _KDSTRUCT_H_ 00062 #define _KDSTRUCT_H_ 00063 00064 #include "REAL.H" 00065 #include "NamespaceHeader.H" // for Chombo 00066 00067 /*! 00068 \file PXKDStruct.h 00069 00070 This header file defines the structures used to create KDTrees 00071 and LinkedLists in ProjectX. 00072 */ 00073 00074 00075 #define KD_MAX_DIM 4 00076 00077 typedef struct _kdnode KDNode; 00078 struct _kdnode { 00079 void *data; 00080 struct _kdnode *left, *right; /* negative/positive side */ 00081 Real pos[KD_MAX_DIM]; 00082 Real xmin[KD_MAX_DIM]; 00083 Real xmax[KD_MAX_DIM]; 00084 unsigned char dir; 00085 }; 00086 00087 typedef struct _resultnode ResultNode; 00088 struct _resultnode { 00089 //KDNode *item; 00090 void *data; //ptr to data from the kdnode 00091 Real *pos; //ptr to coordinates of kdnode 00092 Real dist_sq; 00093 struct _resultnode *next; 00094 }; 00095 00096 00097 typedef struct _kdtree KDTree; 00098 struct _kdtree { 00099 KDNode *root; 00100 int dim; 00101 char globalDestrFlag; 00102 /* value: -1 => destr == NULL == globalData, no node-based data to free 00103 0 => destr != NULL, globalData == NULL, destr called on each node's data ptr 00104 1 => destr != NULL, globalData != NULL, destr called on globalData ptr (only once) 00105 */ 00106 void *globalData; 00107 void (*destr)(void*); //function called to release memory 00108 }; 00109 00110 typedef struct _kdres KDResult; 00111 struct _kdres { 00112 KDTree *tree; 00113 ResultNode *rlist, *riter; 00114 int size; 00115 }; 00116 00117 typedef struct _linkedlistnode LListNode; 00118 struct _linkedlistnode { 00119 void *data; 00120 Real key; 00121 struct _linkedlistnode *next; 00122 }; 00123 00124 typedef struct _linkedlisthead ListHead; 00125 struct _linkedlisthead { 00126 LListNode *llist, *listIter; 00127 int size; 00128 int ordered; 00129 void (*destr)(void*); 00130 }; 00131 00132 #include "NamespaceFooter.H" // for Chombo 00133 #endif