00001 #ifndef ADJACENTNEIGHBOR_H 00002 #define ADJACENTNEIGHBOR_H 00003 00004 #include "Point3D.h" 00005 #include "Field3DIndex.h" 00006 #include <vector> 00007 00011 00012 00013 00014 00015 00016 00017 00018 00019 00020 namespace CompuCell3D{ 00021 00022 class AdjacentNeighbor{ 00023 public: 00024 explicit AdjacentNeighbor(): 00025 periodicX(false), 00026 periodicY(false), 00027 periodicZ(false) 00028 {} 00029 explicit AdjacentNeighbor(const Dim3D & _dim); 00030 ~AdjacentNeighbor(); 00031 void initialize(const Dim3D & _dim); 00032 00033 std::vector<long> const & getAdjNeighborOffsetVec()const {return adjNeighborOffsets;} 00034 std::vector<long> const & getAdjFace2FaceNeighborOffsetVec()const {return adjFace2FaceNeighborOffsets;} 00035 00036 std::vector<Point3D> const & getAdjNeighborOffsetVec(const Point3D & _pt )const{ 00037 //return adjNeighborOffsetsInner; 00038 if(isInner(_pt)){ 00039 return adjNeighborOffsetsInner; 00040 }else{ 00041 return adjNeighborOffsetsBoundary; 00042 } 00043 00044 } 00045 00046 std::vector<Point3D> const & getAdjFace2FaceNeighborOffsetVec(const Point3D & _pt)const{ 00047 //have to correct this function - as of now it gives segfault 00048 //return adjFace2FaceNeighborOffsetsInner; 00049 if(isInner(_pt)){ 00050 return adjFace2FaceNeighborOffsetsInner; 00051 }else{ 00052 return adjFace2FaceNeighborOffsetsBoundary; 00053 } 00054 00055 } 00056 00057 Dim3D getFieldDim() const {return fieldDim;} 00058 Field3DIndex const & getField3DIndex() const {return field3DIndex;} 00059 double distance(double,double,double); 00060 void setPeriodicX(); 00061 void setPeriodicY(); 00062 void setPeriodicZ(); 00063 bool isInner(const Point3D & _pt) const{ 00064 return ( _pt.x>0 && _pt.x<(fieldDim.x-1) 00065 && _pt.y>0 && _pt.y<(fieldDim.y-1) 00066 && _pt.z>0 && _pt.z<(fieldDim.z-1) 00067 ); 00068 } 00069 00070 protected: 00071 00072 std::vector<long> adjNeighborOffsets; 00073 std::vector<long> adjFace2FaceNeighborOffsets; 00074 std::vector<Point3D> adjNeighborOffsetsInner; 00075 std::vector<Point3D> adjNeighborOffsetsBoundary; 00076 std::vector<Point3D> adjFace2FaceNeighborOffsetsInner; 00077 std::vector<Point3D> adjFace2FaceNeighborOffsetsBoundary; 00078 bool periodicX; 00079 bool periodicY; 00080 bool periodicZ; 00081 Field3DIndex field3DIndex; 00082 int depth; 00083 Dim3D fieldDim; 00084 }; 00085 }; 00086 #endif
1.5.6