00001 #include "box.h"
00002 #include "face.h"
00003
00004 #include <iostream>
00005
00006 using std::cout;
00007
00008 Box::Box(int a,int b,int c)
00009 :f(),x(a),y(b),z(c)
00010 {
00011 }
00012
00019 void Box::printBox(double min_x,double min_y,double min_z) const
00020 {
00021 cout << "Box::printBox: index (x y z)["
00022 << x << " "
00023 << y << " "
00024 << z << "]\n"
00025 << "Box::printBox: "
00026 << "limits (xmin xmax ymin ymax zmin zmax)["
00027 << xmin(min_x) << " "
00028 << xmax(min_x) << " "
00029 << ymin(min_y) << " "
00030 << ymax(min_y) << " "
00031 << zmin(min_z) << " "
00032 << zmax(min_z) << "]\n";
00033 cout.flush();
00034 }
00035
00042 double Box::xmin(const double index) const
00043 {
00044 return index + SPACE_LENGTH*SCALE*x;
00045 }
00046
00053 double Box::xmax(const double index) const
00054 {
00055 return index + SPACE_LENGTH*SCALE*(x+1);
00056 }
00057
00064 double Box::ymin(const double index) const
00065 {
00066 return index + SPACE_LENGTH*SCALE*y;
00067 }
00068
00075 double Box::ymax(const double index) const
00076 {
00077 return index + SPACE_LENGTH*SCALE*(y+1);
00078 }
00079
00086 double Box::zmin(const double index) const
00087 {
00088 return index + SPACE_LENGTH*SCALE*z;
00089 }
00090
00097 double Box::zmax(const double index) const
00098 {
00099 return index + SPACE_LENGTH*SCALE*(z+1);
00100 }
00101
00107 fp_cit Box::begin (void) const
00108 {
00109 return f.begin();
00110 }
00111
00117 fp_cit Box::end (void) const
00118 {
00119 return f.end();
00120 }
00121
00126 int Box::getNumFaces (void) const
00127 {
00128 return f.size();
00129 }
00130
00134 void Box::sortFaces (void)
00135 {
00136 sort(f.begin(),f.end());
00137 }
00138
00143 void Box::removeFace (Face * face)
00144 {
00145
00146 std::pair<fp_it,fp_it> i = equal_range(f.begin(),f.end(),face);
00147
00148 if(i.first!=i.second)
00149 {
00150 f.erase(i.first);
00151 }
00152 }
00153
00158 void Box::addFace (Face * face)
00159 {
00160 f.push_back(face);
00161 }
00162
00166 void Box::clearFaces (void)
00167 {
00168 f.clear();
00169 }
00170