00001 /**************************************************************************** 00002 * * 00003 * Program: FDDlib * 00004 * Version: 1.1 * 00005 * * 00006 * Copyright (C) 2002 - 2004 by Eric Miller and Dana Brooks * 00007 * All rights reserved. * 00008 * * 00009 * This software is Version 1.1 of the fddlib tomography toolbox. * 00010 * It is not to be redistributed or used for any commercial purpose * 00011 * without the prior written consent of the authors and Northeastern * 00012 * University. * 00013 * * 00014 * This software is provided as is, and any express or implied warranties, * 00015 * including but not limited to the implied warranty of merchantability * 00016 * and the implied warranty of fitness for a particular purpose, are dis- * 00017 * claimed. In no event shall the authors or Northeastern University be * 00018 * liable for any direct, indirect, incidental, special, exemplary, or * 00019 * consequential damages (including but not limited to procurement of * 00020 * substitute goods or services; loss of use, data, or profits; or busi- * 00021 * ness interruption) however caused and on any theory of liability, * 00022 * whether in contract, strict liability, or tort (including negligence or * 00023 * otherwise) arising in any way from the use of this software, even if * 00024 * advised of the possibility of such damage. * 00025 * * 00026 * Portions of this code benefit from ideas from Kyle Guilbert, Greg * 00027 * Boverman, Derek Uluski, David Kaeli, and Jennifer Black * 00028 * * 00029 ****************************************************************************/ 00030 00031 #ifndef _CART_NODE2D_H_ 00032 #define _CART_NODE2D_H_ 00033 00034 #include <vector> 00035 #include <string> 00036 #include <stdlib.h> 00037 #include <math.h> 00038 #include "Location2D.h" 00039 #include "Property.h" 00040 #include "grid_enums.h" 00041 #include "Complex.h" 00042 00043 namespace FDDlib { 00044 00048 class CartesianNode2D { 00049 00050 protected: 00051 00053 Location2D location_; 00054 00056 std::vector<CartesianNode2D*> neighbors_; 00057 00059 Property *property_; 00060 00062 Location2D normalVector_; 00063 00065 int linearIndex_; 00066 00071 bool activeNeighbor(direction2D dir) const; 00072 00074 static const int UNKNOWN_LIN_INDEX = -2; 00075 00076 00077 public: 00078 00080 static const int INACTIVE_LIN_INDEX = -1; 00081 00085 CartesianNode2D(const Location2D& location) throw(std::string); 00086 00088 Location2D getLocation() const; 00089 00091 int getNumNeighbors() const; 00092 00097 void setNeighbor(direction2D dir, CartesianNode2D* node) throw(std::string); 00098 00103 CartesianNode2D* getNeighbor(direction2D dir) const throw(std::string); 00104 00108 void setProperty(Property* prop); 00109 00111 Property* getProperty() const; 00112 00117 void setNormalVector(const Location2D& normalVector); 00118 00120 Location2D getNormalVector() const; 00121 00125 double distanceTo(const CartesianNode2D& node) const; 00126 00132 bool compareLocation(const CartesianNode2D& node) const; 00133 00135 bool isBorderNode() const; 00136 00141 void setLinearIndex(int linearIndex) throw(std::string); 00142 00146 int getLinearIndex() const throw(std::string); 00147 00148 }; 00149 00150 } 00151 00152 #endif
1.2.18