OrthoCellAccessorWithHoles Class Reference

#include <orthocellaccessorwithholes.h>

Inheritance diagram for OrthoCellAccessorWithHoles:
Inheritance graph
[legend]
Collaboration diagram for OrthoCellAccessorWithHoles:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 ~OrthoCellAccessorWithHoles ()
unsigned vertex_index (VertexDirection3D dir)
unsigned face_index (FaceDirection3D dir)
unsigned face_index_up ()
unsigned face_index_down ()
unsigned face_index_left ()
unsigned face_index_right ()
unsigned face_index_front ()
unsigned face_index_back ()
unsigned face_raw_index (FaceDirection3D dir)
unsigned index () const
unsigned raw_index ()
unsigned neighbor_index (unsigned int dir) const
unsigned index_up ()
unsigned index_down ()
unsigned index_left ()
unsigned index_right ()
unsigned index_front ()
unsigned index_back ()
bool at_boundary ()
OrthoMesh::Face_It face (FaceDirection3D dir)
OrthoMesh::Cell_It neighbor (CellDirection3D dir)
bool advance (CellDirection3D dir)
unsigned advance (CellDirection3D dir, unsigned stps)

Protected Member Functions

 OrthoCellAccessorWithHoles (const OrthoMesh &mesh, unsigned rawIndex)
void operator++ (int)

Private Attributes

DelIndexLst::Iterator _delIt
DelIndexLst::Iterator _delItVert
DelIndexLst::Iterator _delItFcX
DelIndexLst::Iterator _delItFcY
DelIndexLst::Iterator _delItFcZ
Index _newIndex

Friends

class OrthoMesh
class IteratorAccessor< OrthoCellAccessorWithHoles >

Detailed Description

Definition at line 9 of file orthocellaccessorwithholes.h.


Constructor & Destructor Documentation

OrthoCellAccessorWithHoles::OrthoCellAccessorWithHoles ( const OrthoMesh mesh,
unsigned  rawIndex 
) [protected]

Definition at line 4 of file orthocellaccessorwithholes.cpp.

00005    :OrthoCellAccessor(mesh,rawIndex)
00006 {
00007   _delIt = mesh._delCellLst.findLUEntry(rawIndex);
00008   _delItFcX=mesh._delFaceLst.begin();
00009   _delItFcY=_delItFcX;
00010   _delItFcZ=_delItFcX;
00011   _delItVert=mesh._delVertLst.begin();
00012   _newIndex = mesh._delCellLst.adjustI(_index,_delIt);
00013 }

OrthoCellAccessorWithHoles::~OrthoCellAccessorWithHoles (  )  [inline]

Definition at line 23 of file orthocellaccessorwithholes.h.

00023 {}


Member Function Documentation

unsigned OrthoCellAccessorWithHoles::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

Parameters:
stps 
dir 
Returns:
The number of stps actually done by the cell.

Reimplemented from OrthoCellAccessor.

Definition at line 170 of file orthocellaccessorwithholes.cpp.

00171 {
00172   unsigned i;
00173   for (i=0;i<stps;i++)
00174   {
00175     if (!this->advance(dir))
00176     {
00177       return i;
00178     }
00179   }
00180   return i;
00181 }

bool OrthoCellAccessorWithHoles::advance ( CellDirection3D  dir  ) 

Reimplemented from OrthoCellAccessor.

Definition at line 132 of file orthocellaccessorwithholes.cpp.

00133 {
00134   OrthoCellAccessorWithHoles backTrack = *this;
00135   if (OrthoCellAccessor::advance(dir))
00136   {
00137     //We advance the cell as there was no holes.
00138     //Now calculate the index in the mesh with holes
00139     _newIndex=_pMesh->_delCellLst.adjustI(raw_index(),_delIt);
00140 
00141     //If _newIndex is invalid it means the neighbor cell is not a valid
00142     //cell because it is inside the well. So backtrack and return false
00143     if (_newIndex == OrthoMesh::INVALID_INDEX)
00144     {
00145       *this=backTrack;
00146       return false;
00147     }
00148     else
00149       return true;
00150   }
00151   else //Neighbor is out of the domain
00152   {
00153     return false;
00154   }
00155 }

bool OrthoCellAccessorWithHoles::at_boundary (  ) 

Use this function with caution. It is very expensive

Definition at line 99 of file orthocellaccessorwithholes.cpp.

OrthoMesh::Face_It OrthoCellAccessorWithHoles::face ( FaceDirection3D  dir  ) 

Reimplemented from OrthoCellAccessor.

Definition at line 115 of file orthocellaccessorwithholes.cpp.

00116 {
00117   OrthoFaceAccessorWithHoles faceAcc(*this,dir);
00118   return OrthoMesh::Face_It(faceAcc);
00119 }

unsigned OrthoCellAccessorWithHoles::face_index ( FaceDirection3D  dir  ) 

Index of the face in the direction dir from the cell

Definition at line 59 of file orthocellaccessorwithholes.cpp.

00060 {
00061   return _pMesh->getFaceIndexFromCell(dir,_i,_j,_k,_delItFcX,_delItFcY,_delItFcZ);
00062 }

unsigned OrthoCellAccessorWithHoles::face_index_back (  ) 

Index of the face in the direction back from the cell

Definition at line 90 of file orthocellaccessorwithholes.cpp.

00091 {
00092   return _pMesh->_delFaceLst.adjust(_i + (_j+1)*_pMesh->_fyYStride + _k*_pMesh->_fyZStride + _pMesh->_fyOff,_delItFcY);
00093 }

unsigned OrthoCellAccessorWithHoles::face_index_down (  ) 

Index of the face in the direction down from the cell

Definition at line 69 of file orthocellaccessorwithholes.cpp.

unsigned OrthoCellAccessorWithHoles::face_index_front (  ) 

Index of the face in the direction front from the cell

Definition at line 84 of file orthocellaccessorwithholes.cpp.

00085 {
00086   return _pMesh->_delFaceLst.adjust(_i + _j*_pMesh->_fyYStride + _k*_pMesh->_fyZStride + _pMesh->_fyOff,_delItFcY);
00087 
00088 }

unsigned OrthoCellAccessorWithHoles::face_index_left (  ) 

Index of the face in the direction left from the cell

Definition at line 74 of file orthocellaccessorwithholes.cpp.

00075 {
00076   return _pMesh->_delFaceLst.adjust(_i+_j*_pMesh->_fxYStride + _k*_pMesh->_fxZStride,_delItFcX);
00077 }

unsigned OrthoCellAccessorWithHoles::face_index_right (  ) 

Index of the face in the direction right from the cell

Definition at line 79 of file orthocellaccessorwithholes.cpp.

00080 {
00081   return _pMesh->_delFaceLst.adjust(_i + 1  + _j*_pMesh->_fxYStride + _k*_pMesh->_fxZStride,_delItFcX);
00082 }

unsigned OrthoCellAccessorWithHoles::face_index_up (  ) 

Index of the face in the direction up from the cell

Definition at line 64 of file orthocellaccessorwithholes.cpp.

00065 {
00066   return _pMesh->_delFaceLst.adjust(_i + _j*_pMesh->_fzYStride + (_k +1)*_pMesh->_fzZStride + _pMesh->_fzOff,_delItFcZ);
00067 }

unsigned OrthoCellAccessorWithHoles::face_raw_index ( FaceDirection3D  dir  )  [inline]

Definition at line 34 of file orthocellaccessorwithholes.h.

00034 {return OrthoCellAccessor::face_index(dir);}

unsigned OrthoCellAccessorWithHoles::index (  )  const [inline]

Index of the cell

Reimplemented from OrthoCellAccessor.

Definition at line 37 of file orthocellaccessorwithholes.h.

unsigned OrthoCellAccessorWithHoles::index_back (  ) 

Index of the cell in the direction back from the cell

Definition at line 238 of file orthocellaccessorwithholes.cpp.

00239 {
00240   assert(this->isValid());
00241   if (_j == _pMesh->_LastJ)
00242     return OrthoMesh::INVALID_INDEX;
00243   else
00244     return _pMesh->_delCellLst.adjustI(_index+_pMesh->_YStride,_delIt);
00245 
00246 }

unsigned OrthoCellAccessorWithHoles::index_down (  ) 

Index of the cell in the direction down from the cell

Definition at line 195 of file orthocellaccessorwithholes.cpp.

00196 {
00197   assert(this->isValid());
00198   if (_k == 0)
00199     return OrthoMesh::INVALID_INDEX;
00200   else
00201      return _pMesh->_delCellLst.adjustI(_index-_pMesh->_ZStride,_delIt);
00202 
00203 }

unsigned OrthoCellAccessorWithHoles::index_front (  ) 

Index of the cell in the direction front from the cell

Definition at line 226 of file orthocellaccessorwithholes.cpp.

00227 {
00228   assert(this->isValid());
00229   if (_j == 0)
00230     return OrthoMesh::INVALID_INDEX;
00231   else
00232     return _pMesh->_delCellLst.adjustI(_index-_pMesh->_YStride,_delIt);
00233 }

unsigned OrthoCellAccessorWithHoles::index_left (  ) 

Index of the cell in the direction left from the cell

Definition at line 205 of file orthocellaccessorwithholes.cpp.

00206 {
00207   assert(this->isValid());
00208   if (_i == 0)
00209     return OrthoMesh::INVALID_INDEX;
00210   else
00211     return _pMesh->_delCellLst.adjustI(_index-1,_delIt);
00212 }

unsigned OrthoCellAccessorWithHoles::index_right (  ) 

Index of the cell in the direction right from the cell

Definition at line 214 of file orthocellaccessorwithholes.cpp.

00215 {
00216   assert(this->isValid());
00217   if (_i == _pMesh->_LastI)
00218     return OrthoMesh::INVALID_INDEX;
00219   else
00220     return  _pMesh->_delCellLst.adjustI(_index+1,_delIt);
00221 
00222 }

unsigned OrthoCellAccessorWithHoles::index_up (  ) 

Index of the cell in the direction up from the cell

Definition at line 184 of file orthocellaccessorwithholes.cpp.

00185 {
00186   assert(this->isValid());
00187 
00188   if (_k == _pMesh->_LastK)
00189     return OrthoMesh::INVALID_INDEX;
00190   else
00191     return _pMesh->_delCellLst.adjustI(_index+_pMesh->_ZStride,_delIt);
00192 
00193 }

OrthoMesh::Cell_It OrthoCellAccessorWithHoles::neighbor ( CellDirection3D  dir  ) 

Reimplemented from OrthoCellAccessor.

Definition at line 122 of file orthocellaccessorwithholes.cpp.

00123 {
00124   OrthoCellAccessorWithHoles cell = *this;
00125   if (cell.advance(dir))
00126     return OrthoMesh::Cell_It(cell);
00127   else
00128     return _pMesh->end_cell();
00129 }

unsigned OrthoCellAccessorWithHoles::neighbor_index ( unsigned int  dir  )  const

Reimplemented from OrthoCellAccessor.

Definition at line 48 of file orthocellaccessorwithholes.cpp.

00049 {
00050   unsigned i=OrthoCellAccessor::neighbor_index(dir);
00051   if (i != OrthoMesh::invalidIndex())
00052     return _pMesh->_delCellLst.adjustI(OrthoCellAccessor::neighbor_index(dir),_delIt);
00053   else
00054     return OrthoMesh::invalidIndex();
00055 }

void OrthoCellAccessorWithHoles::operator++ ( int   )  [protected]

Reimplemented from OrthoCellAccessor.

Definition at line 15 of file orthocellaccessorwithholes.cpp.

00016 {
00017   OrthoCellAccessor &rawCell = *this;
00018   assert(rawCell.index() < _delIt->index());
00019   OrthoCellAccessor::operator++(0);
00020       
00021 
00022   if (rawCell.index() <  _delIt->index())
00023   {
00024     _newIndex = _delIt->adjust(rawCell.index());
00025     return;
00026   }
00027   else //we know that delIt->index() == rawCell.index()
00028   {
00029     do {
00030       OrthoCellAccessor::operator++(0);
00031       _delIt++;
00032         } while(rawCell.index() == _delIt->index());
00033       _newIndex = _delIt->adjust(rawCell.index());
00034   }
00035 }

unsigned OrthoCellAccessorWithHoles::raw_index (  )  [inline]

Index of the cell

Definition at line 38 of file orthocellaccessorwithholes.h.

unsigned OrthoCellAccessorWithHoles::vertex_index ( VertexDirection3D  dir  ) 

return the index of the vertice given the relative position of the vertex within the cell

Definition at line 42 of file orthocellaccessorwithholes.cpp.


Friends And Related Function Documentation

friend class IteratorAccessor< OrthoCellAccessorWithHoles > [friend]

Definition at line 13 of file orthocellaccessorwithholes.h.

friend class OrthoMesh [friend]

Reimplemented from OrthoCellAccessor.

Definition at line 12 of file orthocellaccessorwithholes.h.


Member Data Documentation

Definition at line 15 of file orthocellaccessorwithholes.h.

Definition at line 15 of file orthocellaccessorwithholes.h.

Definition at line 15 of file orthocellaccessorwithholes.h.

Definition at line 15 of file orthocellaccessorwithholes.h.

Definition at line 15 of file orthocellaccessorwithholes.h.

Definition at line 16 of file orthocellaccessorwithholes.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Generated on Sun Apr 8 23:13:25 2012 for CO2INJECTION by  doxygen 1.6.3