#include <orthocellaccessor.h>
Public Member Functions | |
OrthoCellAccessor (const OrthoMesh &mesh, unsigned index) | |
OrthoCellAccessor (const OrthoMesh &mesh, unsigned i, unsigned j, unsigned k) | |
OrthoCellAccessor () | |
~OrthoCellAccessor () | |
bool | operator!= (OrthoCellAccessor &cell) const |
void | barycenter (Point3D &p) const |
Point3D | barycenter () const |
bool | containPoint (Point3D &p) const |
void | advance_inner () |
void | vertex (VertexDirection3D dir, Point3D &p) const |
Point3D | vertex (VertexDirection3D dir) const |
unsigned | vertex_index (VertexDirection3D dir) const |
unsigned | face_index (FaceDirection3D dir) const |
unsigned | face_index_up () const |
unsigned | face_index_bottom () const |
unsigned | face_index_left () const |
unsigned | face_index_right () const |
unsigned | face_index_front () const |
unsigned | face_index_back () const |
OrthoMesh::Raw_Face_It | face (FaceDirection3D dir) |
OrthoMesh::Raw_Cell_It | neighbor (CellDirection3D dir) |
unsigned | index () const |
unsigned | neighbor_index (unsigned int dir) const |
unsigned | index_up () const |
unsigned | index_bottom () const |
unsigned | index_left () const |
unsigned | index_right () const |
unsigned | index_front () const |
unsigned | index_back () const |
unsigned | advance (CellDirection3D dir, unsigned stps) |
bool | advance (CellDirection3D dir) |
unsigned | getI () const |
unsigned | getJ () const |
unsigned | getK () const |
bool | isValid () const |
bool | at_boundary () const |
const OrthoMesh & | getMesh () const |
double | volume () const |
Protected Member Functions | |
bool | advanceRight () |
bool | advanceLeft () |
bool | advanceUp () |
bool | advanceDown () |
bool | advanceBack () |
bool | advanceFront () |
void | operator++ (int) |
Protected Attributes | |
const OrthoMesh * | _pMesh |
unsigned | _i |
unsigned | _j |
unsigned | _k |
unsigned | _index |
Friends | |
class | OrthoMesh |
class | IteratorAccessor< OrthoCellAccessor > |
Definition at line 10 of file orthocellaccessor.h.
OrthoCellAccessor::OrthoCellAccessor | ( | const OrthoMesh & | mesh, | |
unsigned | index | |||
) |
OrthoCellAccessor::OrthoCellAccessor | ( | const OrthoMesh & | mesh, | |
unsigned | i, | |||
unsigned | j, | |||
unsigned | k | |||
) |
OrthoCellAccessor::OrthoCellAccessor | ( | ) |
OrthoCellAccessor::~OrthoCellAccessor | ( | ) | [inline] |
Definition at line 33 of file orthocellaccessor.h.
bool OrthoCellAccessor::advance | ( | CellDirection3D | dir | ) |
Reimplemented in OrthoCellAccessorWithHoles.
Definition at line 204 of file orthocellaccessor.cpp.
00205 { 00206 assert(dir <= 5); 00207 assert(this->isValid()); 00208 00209 switch(dir) 00210 { 00211 case LEFT_CELL: 00212 { 00213 return advanceLeft(); 00214 } 00215 case RIGHT_CELL: 00216 { 00217 return advanceRight(); 00218 } 00219 case FRONT_CELL: 00220 { 00221 return advanceFront(); 00222 } 00223 case BACK_CELL: 00224 { 00225 return advanceBack(); 00226 } 00227 case BOTTOM_CELL: 00228 { 00229 return advanceDown(); 00230 } 00231 case UP_CELL: 00232 { 00233 return advanceUp(); 00234 } 00235 default: 00236 throw new Exception("OrthoMesh::neighbor_index(): Invalid direction number"); 00237 } 00238 return true; 00239 }
unsigned OrthoCellAccessor::advance | ( | CellDirection3D | dir, | |
unsigned | stps | |||
) |
Advance the cell stps time in the dir direction.It the cell accessor reaches the end of the domain, the method finish in the boundary of the cell
stps | ||
dir |
Reimplemented in OrthoCellAccessorWithHoles.
Definition at line 187 of file orthocellaccessor.cpp.
00188 { 00189 unsigned i; 00190 for (i=0;i<stps;i++) 00191 { 00192 if (!this->advance(dir)) 00193 { 00194 return i; 00195 } 00196 } 00197 return i; 00198 }
void OrthoCellAccessor::advance_inner | ( | ) |
Definition at line 442 of file orthocellaccessor.cpp.
bool OrthoCellAccessor::advanceBack | ( | ) | [protected] |
bool OrthoCellAccessor::advanceDown | ( | ) | [protected] |
bool OrthoCellAccessor::advanceFront | ( | ) | [protected] |
bool OrthoCellAccessor::advanceLeft | ( | ) | [protected] |
Definition at line 254 of file orthocellaccessor.cpp.
bool OrthoCellAccessor::advanceRight | ( | ) | [protected] |
bool OrthoCellAccessor::advanceUp | ( | ) | [protected] |
bool OrthoCellAccessor::at_boundary | ( | ) | const |
Definition at line 88 of file orthocellaccessor.cpp.
Point3D OrthoCellAccessor::barycenter | ( | ) | const |
Definition at line 98 of file orthocellaccessor.cpp.
00099 { 00100 assert(this->isValid()); 00101 Point3D p; 00102 barycenter(p); 00103 return p; 00104 }
void OrthoCellAccessor::barycenter | ( | Point3D & | p | ) | const |
Definition at line 35 of file orthocellaccessor.cpp.
00036 { 00037 assert(_index < _pMesh->numRawCells()); 00038 _pMesh->getBarycenterFromCell(_i,_j,_k,p); 00039 }
bool OrthoCellAccessor::containPoint | ( | Point3D & | p | ) | const |
Definition at line 433 of file orthocellaccessor.cpp.
00434 { 00435 Point3D v1 = vertex(VERTEX_000); 00436 Point3D v2 = vertex(VERTEX_111); 00437 return NumericMethods::isInCube(p,v1,v2); 00438 00439 }
OrthoMesh::Raw_Face_It OrthoCellAccessor::face | ( | FaceDirection3D | dir | ) |
Reimplemented in OrthoCellAccessorWithHoles.
Definition at line 80 of file orthocellaccessor.cpp.
00081 { 00082 assert(this->isValid()); 00083 OrthoFaceAccessor face(*_pMesh,_pMesh->getFaceIndexFromCell(dir,_i,_j,_k)); 00084 return OrthoMesh::Raw_Face_It(face); 00085 }
unsigned OrthoCellAccessor::face_index | ( | FaceDirection3D | dir | ) | const |
Index of the face in the direction dir from the cell
Definition at line 74 of file orthocellaccessor.cpp.
unsigned OrthoCellAccessor::face_index_back | ( | ) | const |
Definition at line 344 of file orthocellaccessor.cpp.
00345 { 00346 return _i + (_j+1)*_pMesh->_fyYStride + _k*_pMesh->_fyZStride + _pMesh->_fyOff; 00347 }
unsigned OrthoCellAccessor::face_index_bottom | ( | ) | const |
Definition at line 322 of file orthocellaccessor.cpp.
00323 { 00324 return _i + _j*_pMesh->_fzYStride + _k*_pMesh->_fzZStride + _pMesh->_fzOff; 00325 }
unsigned OrthoCellAccessor::face_index_front | ( | ) | const |
Definition at line 338 of file orthocellaccessor.cpp.
00339 { 00340 return _i + _j*_pMesh->_fyYStride + _k*_pMesh->_fyZStride + _pMesh->_fyOff; 00341 00342 }
unsigned OrthoCellAccessor::face_index_left | ( | ) | const |
Definition at line 327 of file orthocellaccessor.cpp.
00328 { 00329 return _i + _j*_pMesh->_fxYStride + _k*_pMesh->_fxZStride; 00330 00331 }
unsigned OrthoCellAccessor::face_index_right | ( | ) | const |
Definition at line 333 of file orthocellaccessor.cpp.
00334 { 00335 return _i + 1 + _j*_pMesh->_fxYStride + _k*_pMesh->_fxZStride; 00336 }
unsigned OrthoCellAccessor::face_index_up | ( | ) | const |
Definition at line 317 of file orthocellaccessor.cpp.
00318 { 00319 return _i + _j*_pMesh->_fzYStride + (_k +1)*_pMesh->_fzZStride + _pMesh->_fzOff; 00320 }
unsigned OrthoCellAccessor::getI | ( | ) | const [inline] |
Definition at line 69 of file orthocellaccessor.h.
00069 {return _i;}
unsigned OrthoCellAccessor::getJ | ( | ) | const [inline] |
Definition at line 70 of file orthocellaccessor.h.
00070 {return _j;}
unsigned OrthoCellAccessor::getK | ( | ) | const [inline] |
Definition at line 71 of file orthocellaccessor.h.
00071 {return _k;}
const OrthoMesh& OrthoCellAccessor::getMesh | ( | ) | const [inline] |
Definition at line 74 of file orthocellaccessor.h.
00074 {return *_pMesh;}
unsigned OrthoCellAccessor::index | ( | ) | const [inline] |
Index of the cell
Reimplemented in OrthoCellAccessorWithHoles.
Definition at line 54 of file orthocellaccessor.h.
unsigned OrthoCellAccessor::index_back | ( | ) | const |
Definition at line 422 of file orthocellaccessor.cpp.
unsigned OrthoCellAccessor::index_bottom | ( | ) | const |
Definition at line 379 of file orthocellaccessor.cpp.
unsigned OrthoCellAccessor::index_front | ( | ) | const |
Definition at line 410 of file orthocellaccessor.cpp.
unsigned OrthoCellAccessor::index_left | ( | ) | const |
Definition at line 389 of file orthocellaccessor.cpp.
00390 { 00391 assert(this->isValid()); 00392 if (_i == 0) 00393 return OrthoMesh::INVALID_INDEX; 00394 else 00395 return _index-1; 00396 }
unsigned OrthoCellAccessor::index_right | ( | ) | const |
Definition at line 398 of file orthocellaccessor.cpp.
unsigned OrthoCellAccessor::index_up | ( | ) | const |
Definition at line 368 of file orthocellaccessor.cpp.
bool OrthoCellAccessor::isValid | ( | ) | const |
Definition at line 163 of file orthocellaccessor.cpp.
00164 { 00165 00166 return (_pMesh != NULL && _index < _pMesh->numRawCells()); 00167 }
OrthoMesh::Raw_Cell_It OrthoCellAccessor::neighbor | ( | CellDirection3D | dir | ) |
Reimplemented in OrthoCellAccessorWithHoles.
Definition at line 170 of file orthocellaccessor.cpp.
00171 { 00172 unsigned index = this->neighbor_index(dir); 00173 if (index == _pMesh->invalidIndex()) 00174 return _pMesh->end_raw_cell(); 00175 00176 OrthoCellAccessor result(*_pMesh,index); 00177 return OrthoMesh::Raw_Cell_It(result); 00178 }
unsigned OrthoCellAccessor::neighbor_index | ( | unsigned int | dir | ) | const |
Reimplemented in OrthoCellAccessorWithHoles.
Definition at line 107 of file orthocellaccessor.cpp.
00108 { 00109 assert(dir <= 5); 00110 assert(this->isValid()); 00111 00112 switch(dir) 00113 { 00114 case LEFT_CELL: 00115 { 00116 if (_i == 0) 00117 return OrthoMesh::INVALID_INDEX; 00118 else 00119 return _index-1; 00120 } 00121 case RIGHT_CELL: 00122 { 00123 if (_i == _pMesh->_nElemX-1) 00124 return OrthoMesh::INVALID_INDEX; 00125 else 00126 return _index+1; 00127 } 00128 case FRONT_CELL: 00129 { 00130 if (_j == 0) 00131 return OrthoMesh::INVALID_INDEX; 00132 else 00133 return _index-_pMesh->_YStride; 00134 } 00135 case BACK_CELL: 00136 { 00137 if (_j == _pMesh->_nElemY-1) 00138 return OrthoMesh::INVALID_INDEX; 00139 else 00140 return _index+_pMesh->_YStride; 00141 } 00142 case BOTTOM_CELL: 00143 { 00144 if (_k == 0) 00145 return OrthoMesh::INVALID_INDEX; 00146 else 00147 return _index-_pMesh->_ZStride; 00148 } 00149 case UP_CELL: 00150 { 00151 if (_k == _pMesh->_nElemZ-1) 00152 return OrthoMesh::INVALID_INDEX; 00153 else 00154 return _index+_pMesh->_ZStride; 00155 } 00156 default: 00157 throw new Exception("OrthoMesh::neighbor_index(): Invalid direction number"); 00158 } 00159 00160 }
bool OrthoCellAccessor::operator!= | ( | OrthoCellAccessor & | cell | ) | const |
Definition at line 358 of file orthocellaccessor.cpp.
00359 { 00360 assert(_index <= _pMesh->numRawCells()); 00361 assert(cell._index <= _pMesh->numRawCells()); 00362 return _index != cell._index; 00363 }
void OrthoCellAccessor::operator++ | ( | int | ) | [protected] |
Reimplemented in OrthoCellAccessorWithHoles.
Definition at line 56 of file orthocellaccessor.cpp.
Point3D OrthoCellAccessor::vertex | ( | VertexDirection3D | dir | ) | const |
Definition at line 49 of file orthocellaccessor.cpp.
void OrthoCellAccessor::vertex | ( | VertexDirection3D | dir, | |
Point3D & | p | |||
) | const |
Definition at line 42 of file orthocellaccessor.cpp.
unsigned OrthoCellAccessor::vertex_index | ( | VertexDirection3D | dir | ) | const |
return the index of the vertice given the relative position of the vertex within the cell
Definition at line 28 of file orthocellaccessor.cpp.
double OrthoCellAccessor::volume | ( | ) | const [inline] |
Definition at line 75 of file orthocellaccessor.h.
00075 {return _pMesh->cellVolume();}
friend class IteratorAccessor< OrthoCellAccessor > [friend] |
Definition at line 13 of file orthocellaccessor.h.
friend class OrthoMesh [friend] |
Reimplemented in OrthoCellAccessorWithHoles.
Definition at line 12 of file orthocellaccessor.h.
unsigned OrthoCellAccessor::_i [protected] |
Definition at line 18 of file orthocellaccessor.h.
unsigned OrthoCellAccessor::_index [protected] |
Definition at line 18 of file orthocellaccessor.h.
unsigned OrthoCellAccessor::_j [protected] |
Definition at line 18 of file orthocellaccessor.h.
unsigned OrthoCellAccessor::_k [protected] |
Definition at line 18 of file orthocellaccessor.h.
const OrthoMesh* OrthoCellAccessor::_pMesh [protected] |
Definition at line 17 of file orthocellaccessor.h.