00001 00002 // File : CELL.h 00004 // 00005 // Copyright 2006 00006 // The University of North Carolina at Chapel Hill 00007 // 00009 // 00010 // Permission to use, copy, modify, distribute and sell this software and its 00011 // documentation for any purpose is hereby granted without fee, provided that 00012 // the above copyright notice appear in all copies and that both that copyright 00013 // notice and this permission notice appear in supporting documentation. 00014 // Binaries may be compiled with this software without any royalties or 00015 // restrictions. 00016 // 00017 // The University of North Carolina at Chapel Hill makes no representations 00018 // about the suitability of this software for any purpose. It is provided 00019 // "as is" without express or implied warranty. 00020 // 00021 00022 #ifndef CELL_H 00023 #define CELL_H 00024 #include <cstdlib> 00025 00029 enum CELL_STATE {EMPTY, NEGATIVE, POSITIVE, REPULSOR, ATTRACTOR}; 00030 00034 class CELL 00035 { 00036 public: 00038 CELL(float north, 00039 float east, 00040 float south, 00041 float west, 00042 CELL* parent = NULL, 00043 int depth = 0); 00044 00046 CELL(int depth = 0); 00047 00049 ~CELL(); 00050 00052 00064 CELL* children[4]; 00065 00067 00076 float bounds[4]; 00077 00079 00099 CELL* neighbors[8]; 00100 00102 00121 float stencil[9]; 00122 00123 float center[2]; 00124 int depth; 00125 bool candidate; 00126 00127 CELL* parent; 00128 CELL_STATE state; 00129 00130 void refine(); 00131 00133 // solver-related variables 00135 bool boundary; 00136 float potential; 00137 float b; 00138 float residual; 00139 int index; 00140 00142 // neighbor lookups 00144 CELL* northNeighbor(); 00145 CELL* southNeighbor(); 00146 CELL* westNeighbor(); 00147 CELL* eastNeighbor(); 00148 }; 00149 00150 #endif
1.4.6