OrthoMesh Class Reference

#include <orthomesh.h>

Collaboration diagram for OrthoMesh:
Collaboration graph
[legend]

List of all members.

Public Types

enum  NORMAL_AXIS { NORMAL_X = 0, NORMAL_Y = 1, NORMAL_Z = 2 }
typedef IteratorAccessor
< OrthoCellAccessorWithHoles
Cell_It
typedef IteratorAccessor
< OrthoFaceAccessorWithHoles
Face_It
typedef IteratorAccessor
< OrthoCellAccessor
Raw_Cell_It
typedef IteratorAccessor
< OrthoFaceAccessor
Raw_Face_It
typedef IteratorAccessor
< OrthoVerticeAccessor
Raw_Vertex_It
typedef IteratorAccessor
< OrthoVerticeAccessorWithHoles
Vertex_It
typedef IteratorAccessor
< CashOrthoFaceAccessor
Cash_Face_It
typedef InnerIteratorAccessor
< OrthoCellAccessor
Inner_Raw_Cell_It
typedef InnerIteratorAccessor
< OrthoFaceAccessor
Inner_Raw_Face_It

Public Member Functions

 OrthoMesh (Point3D p1, Point3D p2, unsigned nElemX, unsigned nElemY, unsigned nElemZ)
 OrthoMesh (Point3D &p1, Point3D &p2, unsigned nElemX, unsigned nElemY, unsigned nElemZ, VecWellInfo &wells)
void putWells (VecWellInfo &wells)
void buildCashInfo ()
 ~OrthoMesh ()
unsigned numRawCells () const
unsigned numRawFaces () const
unsigned numRawVertices () const
unsigned numCells () const
unsigned numFaces () const
unsigned numVertices () const
unsigned numGhostCells () const
unsigned numFacesAtBoundary () const
unsigned numElemX () const
unsigned numElemY () const
unsigned numElemZ () const
Point3D numElems () const
Point3D getP () const
Point3D getQ () const
void print (std::string fileName="")
Point3D getDX () const
double get_dx () const
double get_dy () const
double get_dz () const
VecWellInfo getWells ()
Face_It begin_face () const
Face_It get_face (unsigned index)
Cash_Face_It begin_cash_face ()
Cash_Face_It end_cash_face () const
Inner_Raw_Face_It begin_inner_raw_face ()
Inner_Raw_Face_It end_inner_raw_face ()
Face_It end_face () const
Cell_It begin_cell () const
Cell_It get_cell (unsigned index) const
Cell_It end_cell () const
Vertex_It begin_vertice () const
Vertex_It end_vertice () const
Vertex_It get_vertice (unsigned index) const
Raw_Cell_It begin_raw_cell () const
Inner_Raw_Cell_It begin_inner_raw_cell () const
Inner_Raw_Cell_It end_inner_raw_cell () const
Raw_Cell_It end_raw_cell () const
Raw_Face_It begin_raw_face () const
Raw_Face_It end_raw_face () const
Raw_Vertex_It begin_raw_vertice () const
Raw_Vertex_It end_raw_vertice () const
Vertex_It getNearestVertice (Point3D p)
bool nonZeroInwardNormalComponenentIsPositive (FaceDirection3D face_no) const
void projectCentralValuesAtVertices (const VecDouble &cValues, VecDouble &vValues) const
void projectVelocitiesInFacesToCells (Matrix &vel, const VecDouble &vNormalFaceVel)
void projectVelocitiesInFacesToVertices (Matrix &vel, const VecDouble &vNormalFaceVel)
void getMaxAbsVelocitiesInFacesByComponents (VecDouble &vel, const VecDouble &vNormalFaceVel)
double cellVolume () const
double cellMeasure () const
double meshVolume () const
void setCentralValuesFromFunction (Function3D &f, VecDouble &cValues, unsigned component=0)
void setCentralValuesFromFunction (Function3D &f, Matrix &MValuess)
void setFacesValuesFromFunction (Function3D &f, VecDouble &fValues, unsigned deg=0, bool bOnlyPrescribedBoundary=false)
void setFacesValuesFromFunction (Function3D &f, Matrix &MValues, const bool bOnlyAtBoundary=false)
double getIntegralAtCells (const VecDouble &cValues) const
double getIntegralAtVertices (const VecDouble &vValues) const
void getFacesInSlab (double Const, VecIndex &fIndices, unsigned dim)
void getFacesInYZSlab (double X, VecIndex &fIndices)
void getCellsIndicesInDomain (Function3D &f, VecIndex &vec)
void tagFacesInDomain (Function3D &f, VecTag &tags, char value)
void getFacesIndicesInDomain (Function3D &f, VecIndex &vec)
void printCells (VecIndex &vec, std::ostream &out)
void printCell (Cell_It cell, std::ostream &out)
double getGridTolerance ()
unsigned getFacesInYOffset ()
unsigned getFacesInZOffset ()
Cell_It getCellAt (Point3D &p)

Static Public Member Functions

static bool isValid (unsigned index)
static unsigned invalidIndex ()
static double getOutwardNormalOrientation (FaceDirection3D faceDir)

Static Public Attributes

static const unsigned FACES_PER_CELL = 6
static const unsigned VERTICES_PER_CELL = 8
static const unsigned INVALID_INDEX = UINT_MAX

Protected Member Functions

unsigned getCellIndexFromPosition (unsigned i, unsigned j, unsigned k) const
void getCellPositionFromIndex (unsigned index, unsigned &i, unsigned &j, unsigned &k) const
void getVerticePositionFromIndex (unsigned index, unsigned &i, unsigned &j, unsigned &k) const
unsigned getVerticeIndexFromPosition (unsigned i, unsigned j, unsigned k) const
void getFacePositionFromIndex (unsigned index, unsigned &i, unsigned &j, unsigned &k, NORMAL_AXIS &normal) const
Index getFaceIndexFromPosition (unsigned i, unsigned j, unsigned k, NORMAL_AXIS normal) const
void getBarycenterFromCell (unsigned i, unsigned j, unsigned k, Point3D &p) const
void getVerticeFromCell (VertexDirection3D dir, unsigned i, unsigned j, unsigned k, Point3D &p) const
unsigned getVerticeIndexFromCell (VertexDirection3D dir, unsigned i, unsigned j, unsigned k) const
unsigned getFaceIndexFromCell (FaceDirection3D dir, unsigned i, unsigned j, unsigned k) const
unsigned getFaceIndexFromCell (FaceDirection3D dirEnum, unsigned i, unsigned j, unsigned k, DelIndexLst::Iterator &itX, DelIndexLst::Iterator &itY, DelIndexLst::Iterator &itZ) const
void getFaceInfoFromCell (FaceDirection3D dirEnum, unsigned ci, unsigned cj, unsigned ck, unsigned *fi, unsigned *fj, unsigned *fk, unsigned *findex, NORMAL_AXIS *fnormal) const
bool isCellAtBoundary (unsigned i, unsigned j, unsigned k) const
Face_It get_face_from_raw_index (unsigned raw_index) const

Static Protected Member Functions

static void advanceIJK (unsigned &i, unsigned &j, unsigned &k, unsigned minI, unsigned maxI, unsigned minJ, unsigned maxJ)

Private Types

typedef std::vector
< FaceInfoCash >
::const_iterator 
FaceCellsTbl_It

Private Member Functions

void initOrthoMesh (Point3D &p1, Point3D &p2, unsigned nElemX, unsigned nElemY, unsigned nElemZ)

Private Attributes

VecWellInfo m_wells
Point3D _p1
Point3D _p2
Point3D _DX
Point3D _Barycenter0
double _dx
double _dy
double _dz
Point3D _fxP0
Point3D _fyP0
Point3D _fzP0
unsigned _nElemX
unsigned _nElemY
unsigned _nElemZ
unsigned _nElemXY
unsigned _nElemYZ
unsigned _nElemXZ
unsigned _numRawCells
unsigned _numInnerRawCells
unsigned _numRawVertices
unsigned _numRawFaces
unsigned _numCells
unsigned _numVertices
unsigned _numFaces
unsigned _numHGhostCells
unsigned _numRawGhostCells
unsigned _ZStride
unsigned _YStride
unsigned _ZVStride
unsigned _YVStride
unsigned _lastI
unsigned _lastJ
unsigned _lastK
unsigned _fxYStride
unsigned _fxZStride
unsigned _fyYStride
unsigned _fyZStride
unsigned _fzYStride
unsigned _fzZStride
unsigned _fyOff
unsigned _fzOff
unsigned _numFacesAtBoundary
unsigned _LastI
unsigned _LastJ
unsigned _LastK
unsigned _GhostLeftOff
unsigned _GhostRightOff
unsigned _GhostBottomOff
unsigned _GhostUpOff
unsigned _GhostFrontOff
unsigned _GhostBackOff
unsigned _HGhostLeftOff
unsigned _HGhostRightOff
unsigned _HGhostBottomOff
unsigned _HGhostUpOff
unsigned _HGhostFrontOff
unsigned _HGhostBackOff
unsigned _HGhostWellOff
double _faceArea [3]
double _faceAreaPerCellVol [3]
double _cellVolume
double _grid_tol
Index m_innerFacesChangeNormalIndex [3]
Index m_innerFacesChangeKOffset [3]
OrthoCellAccessor_pBeginCell
OrthoCellAccessor_pEndCell
OPointer< OrthoCellAccessor_pBeginInnerCell
OPointer< OrthoCellAccessor_pEndInnerCell
OrthoFaceAccessor_pBeginFace
OrthoFaceAccessor_pEndFace
OrthoFaceAccessor_pBeginInnerFace
OrthoVerticeAccessor_pBeginVert
OrthoVerticeAccessor_pEndVert
OrthoVerticeAccessorWithHoles_pBeginVertH
OrthoVerticeAccessorWithHoles_pEndVertH
OrthoCellAccessorWithHoles_pBeginCellH
OrthoCellAccessorWithHoles_pEndCellH
OrthoFaceAccessorWithHoles_pBeginFaceH
OrthoFaceAccessorWithHoles_pEndFaceH
DelIndexLst _delFaceLst
DelIndexLst _delVertLst
DelIndexLst _delCellLst
std::vector< FaceInfoCashm_vFCash
Index m_FaceStridesTbl [3][2]

Static Private Attributes

static const unsigned _VDirTbl [][3]

Friends

class OrthoCellAccessor
class OrthoCellAccessorWithHoles
class OrthoFaceAccessorWithHoles
class OrthoFaceAccessor
class OrthoVerticeAccessor
class OrthoVerticeAccessorWithHoles
class FaceInfoCash
class CashOrthoFaceAccessor
class UnitTests

Detailed Description

This is the class that implement an orthonormal mesh. The interface is like of a structured mesh but inside it there is no data structures containing the maps of vertices and it cells, faces and its cells and so on. The indices of cells, vertices and faces are calculated by formulas. It needs a little more compute time, but there is practically no memory requirements.

The numbering of the faces are a little tricky. First we split the faces in three sets. The one that has normal in the X direction, the other set are faces that have normal in the Y direction and the last set are the faces with normal in the Z direction. We start counting just the faces with normal in X start from cell 0 and growing first in X direction, then in Y and then in Z similarly with what we do when we count cells. Next we run again all the mesh counting the faces of the second set and finally we count the third one. Now that we have numbered each of the sets we have to find a way to enumerate all of the sets in just one sequence of indices. We have two options. Concatanate them counting all the faces in the first set than the second and third. This numeration is very simple and make easy many aspects of the computation. The other aproach is to use the mod % operator intercalating the indices of all the sets. The advantage is that we have more locality, in other way, the indices of faces geometrically near to each other are very close to each other. This can favor the Cash memory. The disadvantge is that to find the set of a index we need to make a division.

The numbering of cells and vertices is a count process growing in X then Y then Z direction starting from the origen whose coordinates are assumed to be the lowest possible in the domain.

Definition at line 159 of file orthomesh.h.


Member Typedef Documentation

Definition at line 246 of file orthomesh.h.

Definition at line 240 of file orthomesh.h.

Definition at line 241 of file orthomesh.h.

typedef std::vector<FaceInfoCash>::const_iterator OrthoMesh::FaceCellsTbl_It [private]

Definition at line 229 of file orthomesh.h.

Definition at line 248 of file orthomesh.h.

Definition at line 249 of file orthomesh.h.

Definition at line 242 of file orthomesh.h.

Definition at line 243 of file orthomesh.h.

Definition at line 244 of file orthomesh.h.

Definition at line 245 of file orthomesh.h.


Member Enumeration Documentation

Enumerator:
NORMAL_X 
NORMAL_Y 
NORMAL_Z 

Definition at line 236 of file orthomesh.h.

00236 {NORMAL_X=0,NORMAL_Y=1,NORMAL_Z=2};


Constructor & Destructor Documentation

OrthoMesh::OrthoMesh ( Point3D  p1,
Point3D  p2,
unsigned  nElemX,
unsigned  nElemY,
unsigned  nElemZ 
)

Definition at line 230 of file orthomesh.cpp.

00231 {
00232   initOrthoMesh(p1,p2,nElemX,nElemY,nElemZ);
00233 }

OrthoMesh::OrthoMesh ( Point3D p1,
Point3D p2,
unsigned  nElemX,
unsigned  nElemY,
unsigned  nElemZ,
VecWellInfo wells 
)

Definition at line 235 of file orthomesh.cpp.

00236 {
00237   initOrthoMesh(p1,p2,nElemX,nElemY,nElemZ);
00238   putWells(wells);
00239 }

OrthoMesh::~OrthoMesh (  ) 

Definition at line 241 of file orthomesh.cpp.

00242 {
00243   delete _pBeginCell;
00244   delete _pEndCell;
00245   delete _pEndFace;
00246   delete _pBeginFace;
00247 }


Member Function Documentation

void OrthoMesh::advanceIJK ( unsigned &  i,
unsigned &  j,
unsigned &  k,
unsigned  minI,
unsigned  maxI,
unsigned  minJ,
unsigned  maxJ 
) [static, protected]

A private function used mainly in the accessors of the mesh to advance the indices in IJK format. Advance means the next cell in the increasing direction of X, Y and Z

Parameters:
i (output) Indice i to be incremented
j (output) Indice j to be incremented
k (output) Indice k to be incremented
minI define the interval [minI,maxI] where the indice i changes
maxI define the interval [minI,maxI] where the indice i changes.
minJ define the interval [minJ,maxJ] where the indice j changes
maxJ define the interval [minJ,maxJ] where the indice j changes
Returns:

Definition at line 552 of file orthomesh.cpp.

00553 {
00554   if (i != maxI)
00555   {
00556     i++;
00557   }
00558   else
00559   {
00560     i=minI;
00561     if (j != maxJ)
00562     {
00563       j++;
00564     }
00565     else{
00566       j=minJ;
00567       k++;
00568     }
00569   }
00570 }

OrthoMesh::Cash_Face_It OrthoMesh::begin_cash_face (  ) 

Definition at line 705 of file orthomesh.cpp.

00706 {
00707   if (m_vFCash.size() ==0)
00708   {
00709     this->buildCashInfo();
00710   }
00711   return CashOrthoFaceAccessor(*this,m_vFCash.begin());
00712 }

OrthoMesh::Cell_It OrthoMesh::begin_cell (  )  const

Definition at line 575 of file orthomesh.cpp.

00576 {
00577   return Cell_It(*_pBeginCellH);
00578 }

OrthoMesh::Face_It OrthoMesh::begin_face (  )  const

Definition at line 629 of file orthomesh.cpp.

00630 {
00631   return Face_It(*_pBeginFaceH);
00632   
00633 }

OrthoMesh::Inner_Raw_Cell_It OrthoMesh::begin_inner_raw_cell (  )  const

Definition at line 581 of file orthomesh.cpp.

00582 {
00583   assert(_pBeginInnerCell);
00584   return Inner_Raw_Cell_It(*_pBeginInnerCell);
00585 }

OrthoMesh::Inner_Raw_Face_It OrthoMesh::begin_inner_raw_face (  ) 

Definition at line 686 of file orthomesh.cpp.

00687 {
00688   return Inner_Raw_Face_It(*_pBeginInnerFace);
00689 }

OrthoMesh::Raw_Cell_It OrthoMesh::begin_raw_cell (  )  const

Definition at line 607 of file orthomesh.cpp.

00608 {
00609   return Raw_Cell_It(*_pBeginCell);
00610 }

OrthoMesh::Raw_Face_It OrthoMesh::begin_raw_face (  )  const

Definition at line 681 of file orthomesh.cpp.

00682 {
00683   return Raw_Face_It(*_pBeginFace);
00684 }

OrthoMesh::Raw_Vertex_It OrthoMesh::begin_raw_vertice (  )  const

Definition at line 617 of file orthomesh.cpp.

00618 {
00619   return Raw_Vertex_It(*_pBeginVert);
00620 }

OrthoMesh::Vertex_It OrthoMesh::begin_vertice (  )  const

Definition at line 721 of file orthomesh.cpp.

00722 {
00723   return Vertex_It(*_pBeginVertH);
00724 }

void OrthoMesh::buildCashInfo (  ) 

Definition at line 1365 of file orthomesh.cpp.

01366 {
01367   
01368   m_vFCash.clear();
01369   m_vFCash.reserve(numFaces());
01370   Face_It endf = end_face();
01371   for (Face_It face = begin_face();face!=endf;face++)
01372   {
01373     struct FaceInfoCash info;
01374     face->getAdjCellIndices(info.c1,info.c2);
01375     info.normal=face->getNormalOrientation();
01376     m_vFCash.push_back(info);
01377   }
01378 }

double OrthoMesh::cellMeasure (  )  const [inline]

Definition at line 344 of file orthomesh.h.

00344 {return cellVolume();}

double OrthoMesh::cellVolume (  )  const [inline]

Definition at line 343 of file orthomesh.h.

00343 {return _cellVolume;}

OrthoMesh::Cash_Face_It OrthoMesh::end_cash_face (  )  const

Definition at line 714 of file orthomesh.cpp.

00715 {
00716   assert(m_vFCash.size() !=0);
00717   return CashOrthoFaceAccessor(*this,m_vFCash.end());
00718 }

OrthoMesh::Cell_It OrthoMesh::end_cell (  )  const

Definition at line 601 of file orthomesh.cpp.

00602 {
00603   return Cell_It(*_pEndCellH);
00604 }

OrthoMesh::Face_It OrthoMesh::end_face (  )  const

Definition at line 676 of file orthomesh.cpp.

00677 {
00678   return Face_It(*_pEndFaceH);
00679 }

OrthoMesh::Inner_Raw_Cell_It OrthoMesh::end_inner_raw_cell (  )  const

Definition at line 587 of file orthomesh.cpp.

00588 {
00589   assert(_pEndInnerCell);
00590   return Inner_Raw_Cell_It(*_pEndInnerCell);
00591 }

OrthoMesh::Inner_Raw_Face_It OrthoMesh::end_inner_raw_face (  ) 

Definition at line 691 of file orthomesh.cpp.

00692 {
00693   return Inner_Raw_Face_It(*_pEndFace);
00694 }

OrthoMesh::Raw_Cell_It OrthoMesh::end_raw_cell (  )  const

Definition at line 612 of file orthomesh.cpp.

00613 {
00614   return Raw_Cell_It(*_pEndCell);
00615 }

OrthoMesh::Raw_Face_It OrthoMesh::end_raw_face (  )  const

Definition at line 700 of file orthomesh.cpp.

00701 {
00702   return Raw_Face_It(*_pEndFace);
00703 }

OrthoMesh::Raw_Vertex_It OrthoMesh::end_raw_vertice (  )  const

Definition at line 622 of file orthomesh.cpp.

00623 {
00624   return Raw_Vertex_It(*_pEndVert);
00625 }

OrthoMesh::Vertex_It OrthoMesh::end_vertice (  )  const

Definition at line 726 of file orthomesh.cpp.

00727 {
00728   return Vertex_It(*_pEndVertH);
00729 }

OrthoMesh::Cell_It OrthoMesh::get_cell ( unsigned  index  )  const

Get cell from its index

Parameters:
index 
Returns:
The cell iterator corresponding to the index passed as parameter

Definition at line 659 of file orthomesh.cpp.

00660 {
00661   OrthoCellAccessorWithHoles acc(*this,_delCellLst.index_to_raw_index(index));
00662   return Cell_It(acc);
00663 
00664 }

double OrthoMesh::get_dx (  )  const [inline]

Definition at line 302 of file orthomesh.h.

00302 {return _dx;}

double OrthoMesh::get_dy (  )  const [inline]

Definition at line 303 of file orthomesh.h.

00303 {return _dy;}

double OrthoMesh::get_dz (  )  const [inline]

Definition at line 304 of file orthomesh.h.

00304 {return _dz;}

OrthoMesh::Face_It OrthoMesh::get_face ( unsigned  index  ) 

Get a face from its index.

Parameters:
index 
Returns:

Definition at line 649 of file orthomesh.cpp.

00650 {
00651   OrthoFaceAccessorWithHoles acc(*this,_delFaceLst.index_to_raw_index(index));
00652   return Face_It(acc);
00653 }

OrthoMesh::Face_It OrthoMesh::get_face_from_raw_index ( unsigned  raw_index  )  const [protected]

Get the face with the raw index of it.

Parameters:
raw_index 
Returns:

Definition at line 638 of file orthomesh.cpp.

00639 {
00640   OrthoFaceAccessorWithHoles acc(*this,raw_index);
00641   return Face_It(acc);
00642     
00643 }

OrthoMesh::Vertex_It OrthoMesh::get_vertice ( unsigned  index  )  const

Get vertice from its index

Parameters:
index 
Returns:
The vertice iterator corresponding to the index passed

Definition at line 669 of file orthomesh.cpp.

00670 {
00671   OrthoVerticeAccessorWithHoles acc(*this,_delVertLst.index_to_raw_index(index));
00672   return Vertex_It(acc);
00673 
00674 }

void OrthoMesh::getBarycenterFromCell ( unsigned  i,
unsigned  j,
unsigned  k,
Point3D p 
) const [protected]

Definition at line 300 of file orthomesh.cpp.

00301 {
00302   p[0]= _Barycenter0[0] +  i*_DX[0];
00303   p[1]= _Barycenter0[1] +  j*_DX[1];
00304   p[2]= _Barycenter0[2] +  k*_DX[2];
00305 }

OrthoMesh::Cell_It OrthoMesh::getCellAt ( Point3D p  ) 

Get Cell containing point p

Parameters:
p Point inside the mesh
Returns:
Cell that contains p.

Definition at line 1267 of file orthomesh.cpp.

01268 {
01269   Cell_It cell = this->begin_cell(),
01270     endc = this->end_cell();
01271   for (;cell!=endc;cell++)
01272   {
01273     if (cell->containPoint(p)) 
01274       return cell;
01275   }
01276   return endc;
01277 }

unsigned OrthoMesh::getCellIndexFromPosition ( unsigned  i,
unsigned  j,
unsigned  k 
) const [protected]

Definition at line 259 of file orthomesh.cpp.

00260 {
00261   assert( i < _nElemX && j < _nElemY && k < _nElemZ); 
00262   return k*_ZStride + j*_YStride + i;
00263   
00264 }

void OrthoMesh::getCellPositionFromIndex ( unsigned  index,
unsigned &  i,
unsigned &  j,
unsigned &  k 
) const [protected]

Definition at line 249 of file orthomesh.cpp.

00250 {
00251   assert(index < numRawCells()); 
00252   k = index/_ZStride;
00253   index = index%_ZStride;
00254   j = index/_YStride;
00255   i = index%_YStride;
00256 
00257 }

void OrthoMesh::getCellsIndicesInDomain ( Function3D f,
VecIndex vec 
)

Get a list of the indices of all cells whose barycenter is inside the domain of the function f.

Parameters:
f function
vec vector to contain the indices (output)

Definition at line 1247 of file orthomesh.cpp.

01248 {
01249   vec.clear();
01250   Cell_It cell = this->begin_cell(),
01251     endc = this->end_cell();
01252   for (;cell!=endc;cell++)
01253   {
01254     Point3D barycenter = cell->barycenter(); 
01255     if (f.isInDomain(barycenter))
01256     {
01257       vec.push_back(cell->index());
01258     }
01259     
01260   }
01261 }

Point3D OrthoMesh::getDX (  )  const [inline]

Definition at line 301 of file orthomesh.h.

00301 {return _DX;} 

unsigned OrthoMesh::getFaceIndexFromCell ( FaceDirection3D  dirEnum,
unsigned  i,
unsigned  j,
unsigned  k,
DelIndexLst::Iterator itX,
DelIndexLst::Iterator itY,
DelIndexLst::Iterator itZ 
) const [protected]

Extension of the other method with tha same name, but this one is designed for mesh with holes in it. The three iterators parameter it1,it2,it3 are used to find deleted cells in each of the three groups of faces. This is used mainly to speed the search using the locality principle. The user should initialize the iterators and use the same iterators in the same sequence every time we call this method

Parameters:
result 
i 
j 
k 
it1 
it2 
it3 
Returns:

Definition at line 437 of file orthomesh.cpp.

00439 {
00440   unsigned dir = (unsigned) dirEnum;
00441   if (dir < 2)
00442   {
00443     return  _delFaceLst.adjust(i + dir  + j*_fxYStride + k*_fxZStride,itX);
00444 
00445   }
00446   else if (dir < 4)
00447   {
00448     return  _delFaceLst.adjust(i + (j + dir - 2)*_fyYStride + k*_fyZStride + _fyOff,itY);
00449   }
00450   else
00451   {
00452     return _delFaceLst.adjust( i + j*_fzYStride + (k +dir-4)*_fzZStride + _fzOff,itZ);
00453   }
00454 }

unsigned OrthoMesh::getFaceIndexFromCell ( FaceDirection3D  dirEnum,
unsigned  i,
unsigned  j,
unsigned  k 
) const [protected]

The numbering of the faces are a little tricky. First we split the faces in three sets. The one that has normal in the X direction, the other set are faces that have normal in the Y direction and the last set are the faces with normal in the Z direction. We start counting just the faces with normal in X start from cell 0 and growing first in X direction, then in Y and then in Z similarly with what we do when we count cells. Next we run again all the mesh counting the faces of the second set and finally we count the third one. Now that we have numbered each of the sets we have to find a way to enumerate all of the sets in just one sequence of indices. We have two options. Concatanate them counting all the faces in the first set than the second and third. This numeration is very simple and make easy many aspects of the computation. The other aproach is to use the mod % operator intercalating the indices of all the sets. The advantage is that we have more locality, in other way, the indices of faces geometrically near to each other are very close to each other. This can favor the Cash memory. The disadvantge is that to find the set of a index we need to make a division.

Parameters:
dirEnum 
i 
j 
k 
Returns:

Definition at line 342 of file orthomesh.cpp.

00343 {
00344   unsigned dir = (unsigned) dirEnum;
00345   unsigned result;
00346   if (dir < 2)
00347   {
00348     result = i + dir  + j*_fxYStride + k*_fxZStride;
00349   }
00350   else if (dir < 4)
00351   {
00352     result = i + (j + dir - 2)*_fyYStride + k*_fyZStride;
00353     result += _fyOff;
00354   }
00355   else
00356   {
00357     result = i + j*_fzYStride + (k +dir-4)*_fzZStride;
00358     result+= _fzOff;
00359   }
00360   return result;
00361 }

Index OrthoMesh::getFaceIndexFromPosition ( unsigned  i,
unsigned  j,
unsigned  k,
NORMAL_AXIS  normal 
) const [protected]

Definition at line 498 of file orthomesh.cpp.

00499 {
00500   return i+m_FaceStridesTbl[normal][0]*j + m_FaceStridesTbl[normal][1]*k;
00501   
00502   
00503 }

void OrthoMesh::getFaceInfoFromCell ( FaceDirection3D  dirEnum,
unsigned  ci,
unsigned  cj,
unsigned  ck,
unsigned *  fi,
unsigned *  fj,
unsigned *  fk,
unsigned *  findex,
NORMAL_AXIS fnormal 
) const [protected]

The numbering of the faces are a little tricky. First we split the faces in three sets. The one that has normal in the X direction, the other set are faces that have normal in the Y direction and the last set are the faces with normal in the Z direction. We start counting just the faces with normal in X start from cell 0 and growing first in X direction, then in Y and then in Z similarly with what we do when we count cells. Next we run again all the mesh counting the faces of the second set and finally we count the third one. Now that we have numbered each of the sets we have to find a way to enumerate all of the sets in just one sequence of indices. We have two options. Concatanate them counting all the faces in the first set than the second and third. This numeration is very simple and make easy many aspects of the computation. The other aproach is to use the mod % operator intercalating the indices of all the sets. The advantage is that we have more locality, in other way, the indices of faces geometrically near to each other are very close to each other. This can favor the Cash memory. The disadvantge is that to find the set of a index we need to make a division.

Parameters:
dirEnum 
i 
j 
k 
Returns:

Definition at line 387 of file orthomesh.cpp.

00389 {
00390   unsigned dir = (unsigned) dirEnum;
00391   if (dir < 2)
00392   {
00393     *findex = ci + dir  + cj*_fxYStride + ck*_fxZStride;
00394     *fi=ci+dir;
00395     *fj=cj;
00396     *fk=ck;
00397     *fnormal=NORMAL_X;
00398   }
00399   else if (dir < 4)
00400   {
00401     *findex = ci + (cj + dir - 2)*_fyYStride + ck*_fyZStride;
00402     *findex += _fyOff;
00403     *fi=ci;
00404     *fj=cj+dir-2;
00405     *fk=ck;
00406     *fnormal=NORMAL_Y;
00407   }
00408   else
00409   {
00410     *findex = ci + cj*_fzYStride + (ck +dir-4)*_fzZStride;
00411     *findex+= _fzOff;
00412     *fi=ci;
00413     *fj=cj;
00414     *fk=ck+dir-4;
00415     *fnormal=NORMAL_Z;
00416   }
00417 }

void OrthoMesh::getFacePositionFromIndex ( unsigned  index,
unsigned &  i,
unsigned &  j,
unsigned &  k,
NORMAL_AXIS normal 
) const [protected]

Definition at line 465 of file orthomesh.cpp.

00466 {
00467   assert(index < numRawFaces());
00468   unsigned rm;
00469   if (index < _fyOff)
00470   {
00471     k  = index/_fxZStride;
00472     rm = index%_fxZStride; 
00473     j = rm/_fxYStride;
00474     i = rm%_fxYStride;
00475     normal = NORMAL_X;
00476   }
00477   else if (index < _fzOff)
00478   {
00479     index-=_fyOff;
00480     k  = index/_fyZStride;
00481     rm = index%_fyZStride; 
00482     j = rm/_fyYStride;
00483     i = rm%_fyYStride;
00484     normal = NORMAL_Y;
00485   }
00486   else
00487   {
00488     index-=_fzOff;
00489     k  = index/_fzZStride;
00490     rm = index%_fzZStride; 
00491     j = rm/_fzYStride;
00492     i = rm%_fzYStride;
00493     normal = NORMAL_Z;
00494   }
00495   
00496 }

void OrthoMesh::getFacesIndicesInDomain ( Function3D f,
VecIndex vec 
)

Definition at line 1303 of file orthomesh.cpp.

01304 {
01305   OrthoMesh::Face_It face    = begin_face();
01306   OrthoMesh::Face_It endFace = end_face();
01307   vec.clear();
01308 
01309   for (;face!=endFace;face++)
01310   {
01311     Point<3> P = face->barycenter();
01312     if (f.isInDomain(P,0))
01313       vec.push_back(face->index());
01314   }
01315 }

void OrthoMesh::getFacesInSlab ( double  Const,
VecIndex fIndices,
unsigned  dim 
)

Definition at line 1187 of file orthomesh.cpp.

01188 {
01189   OrthoMesh::Cell_It cell = begin_cell();
01190   OrthoMesh::Cell_It endc = end_cell();
01191   static FaceDirection3D OrthoFace[3][2] = { {LEFT_FACE  ,RIGHT_FACE},
01192                                               {FRONT_FACE ,BACK_FACE },
01193                                               {BOTTOM_FACE,UP_FACE   }};
01194   static CellDirection3D CellDir[3] = {RIGHT_CELL,BACK_CELL,UP_CELL};
01195 
01196   static CellDirection3D RunDim[3][2] = { {BACK_CELL  ,UP_CELL},
01197                                           {RIGHT_CELL  ,UP_CELL},
01198                                           {RIGHT_CELL  ,BACK_CELL}};
01199 
01200     
01201   double _tol = getDX()[dim]/4.0;
01202   fIndices.reserve(numElems()[(dim+1)%3]*numElems()[(dim-1)%3]);
01203   
01204   //First find the first face in the slab
01205   FaceDirection3D faceDir=OrthoFace[dim][0];
01206   OrthoMesh::Face_It face = cell->face(faceDir);
01207   if (!NumericMethods::a_equal(face->barycenter()[dim],Const,_tol))
01208   {
01209     faceDir = OrthoFace[dim][1];
01210     face=cell->face(faceDir);
01211     while (!NumericMethods::a_equal(face->barycenter()[dim],Const,_tol))
01212     {
01213       cell = cell->neighbor(CellDir[dim]);
01214       if (cell != endc)
01215       {
01216         face = cell->face(faceDir);
01217       }
01218       else
01219       {
01220         throw new Exception("OrthoMesh::getFacesInYZSlab(): Cant find the slab Dir %d = %g in the domain",dim,Const);
01221       }
01222     }
01223   }
01224 
01225   do {
01226     for(OrthoMesh::Cell_It cell2=cell;cell2 != endc;cell2=cell2->neighbor(RunDim[dim][0]))
01227       fIndices.push_back(cell2->face_index(faceDir));
01228   } while(cell->advance(RunDim[dim][1]));
01229 
01230 }

unsigned OrthoMesh::getFacesInYOffset (  )  [inline]

Definition at line 367 of file orthomesh.h.

00367 {return _fyOff;}

void OrthoMesh::getFacesInYZSlab ( double  X,
VecIndex fIndices 
)

This function is designed for distributed rectangle domains. In this way the domain are partitioned in slices cutted in the YZ plane alon the X axis. Depending of the distribution of elements in each subdomain the indices of the contact faces between two subdomains have different indices To communicate data between the domains we need to know the indices of the contact faces for each of the subdomains. To do this we use the function above which retrieves the faces indices in a YZ Slab and put in the vector parameter fIndices. The order of the indices are based in a geometry aproach. The first entry in the face index vector fIndices is the face with the braycenter having the lowest Y Z cordinate values. Than the cordinates are incremented in the Y direction than Z direction. In this way the faces in the vector of indices are ordered geometrically. So for the same YZ slab belonging to two different subdomains this method returns the indices with the same geometrically order. For example, if fInd1 contains the indices of the faces in a Slab X=20 in subdomain 1 and fInd2 contains the indices of the faces in the subdomain 2 for the Slab X=20, assuming that the two subdomain share common faces in this Slab, we garantee that fInd1[i] and fInd2[i] are the indices of two faces geometrically equal with the same location and format in 3D space.

Parameters:
X the X coordinate of the slab in the YZ plane
fIndices Vector to contain the indices of the faces in the YZ plane ordered such that the fIndices[i] correspond to the ith face counting from front to back, bottom to up (Y axis first, Z second)

Definition at line 1140 of file orthomesh.cpp.

01141 {
01142   OrthoMesh::Cell_It cell = begin_cell();
01143   OrthoMesh::Cell_It endc = end_cell();
01144 
01145   double x_tol = getDX()[0]/4.0;
01146   fIndices.reserve(numElemY()*numElemZ());
01147   
01148   //First find the first face in the slab
01149   OrthoMesh::Face_It face = cell->face(LEFT_FACE);
01150   FaceDirection3D faceDir;
01151   if (NumericMethods::a_equal(face->barycenter()[0],X,x_tol))
01152     faceDir=LEFT_FACE;
01153   else
01154   {
01155     faceDir = RIGHT_FACE;
01156     face=cell->face(RIGHT_FACE);
01157     while (!NumericMethods::a_equal(face->barycenter()[0],X,x_tol))
01158     {
01159       cell = cell->neighbor(RIGHT_CELL);
01160       if (cell != endc)
01161       {
01162         face = cell->face(RIGHT_FACE);
01163       }
01164       else
01165       {
01166         throw new Exception("OrthoMesh::getFacesInYZSlab(): Cant find the slab X= %g in the domain",X);
01167       }
01168     }
01169   }
01170 
01171   //Found the slab
01172   //Now run in Z direction 
01173   do {
01174     //For each Cell in Z, run in Y direction
01175     for(OrthoMesh::Cell_It cellY=cell;cellY != endc;cellY=cellY->neighbor(BACK_CELL))
01176       fIndices.push_back(cellY->face_index(faceDir));
01177   } while(cell->advance(UP_CELL));
01178   
01179   
01180   
01181 }

unsigned OrthoMesh::getFacesInZOffset (  )  [inline]

Definition at line 368 of file orthomesh.h.

00368 {return _fzOff;}

double OrthoMesh::getGridTolerance (  )  [inline]

Definition at line 366 of file orthomesh.h.

00366 {return _grid_tol;}

double OrthoMesh::getIntegralAtCells ( const VecDouble cValues  )  const

Get the integral of the field specified in cValues.This field is constant by parts in each cell such that cValues(i) means the index i of the cell.

Parameters:
cValues 
Returns:

Definition at line 986 of file orthomesh.cpp.

00987 {
00988   assert(cValues.size() == numCells());
00989   double acum=0.0;
00990   for (unsigned i=0;i<cValues.size();i++)
00991   {
00992     acum+=cValues(i);
00993   }
00994   return acum*cellVolume();
00995 }

double OrthoMesh::getIntegralAtVertices ( const VecDouble vValues  )  const

Definition at line 1500 of file orthomesh.cpp.

01501 {
01502   double acum=0.0;
01503   OrthoMesh::Cell_It cell = begin_cell();
01504   OrthoMesh::Cell_It endc = end_cell();
01505 
01506   for (  ;cell!=endc;cell++)
01507   {
01508   
01509     acum+= (vValues(cell->vertex_index(VERTEX_000)) +
01510             vValues(cell->vertex_index(VERTEX_001)) +
01511             vValues(cell->vertex_index(VERTEX_010)) +
01512             vValues(cell->vertex_index(VERTEX_011)) +
01513             vValues(cell->vertex_index(VERTEX_100)) +
01514             vValues(cell->vertex_index(VERTEX_101)) +
01515             vValues(cell->vertex_index(VERTEX_110)) +
01516             vValues(cell->vertex_index(VERTEX_111)))/8.0; 
01517     
01518   }
01519   return acum*cellVolume();
01520 }

void OrthoMesh::getMaxAbsVelocitiesInFacesByComponents ( VecDouble vel,
const VecDouble vNormalFaceVel 
)

Definition at line 1474 of file orthomesh.cpp.

01475 {
01476   assert(vel.size() == 3);
01477   assert(vNormalFaceVel.size() == numFaces());
01478   OrthoMesh::Face_It endf = end_face();
01479   vel=0.0;
01480   for (OrthoMesh::Face_It face = begin_face();face!=endf;face++)
01481   {
01482     unsigned normal = face->getNormalOrientation();
01483     double dd = fabs(vNormalFaceVel(face->index()));
01484     if ( vel(normal) < dd)
01485       vel(normal)=dd;
01486   }
01487 }

OrthoMesh::Vertex_It OrthoMesh::getNearestVertice ( Point3D  p  ) 

Obtain the nearest vertice of the point p.

Definition at line 1390 of file orthomesh.cpp.

01391 {
01392   assert(NumericMethods::isInCube(p,getP(),getQ()));
01393   p-=getP();
01394   unsigned i = round(p[0]/getDX()[0]);
01395   unsigned j = round(p[1]/getDX()[1]);
01396   unsigned k = round(p[2]/getDX()[2]);
01397   return OrthoVerticeAccessorWithHoles(*this,this->getVerticeIndexFromPosition(i,j,k));
01398 }

double OrthoMesh::getOutwardNormalOrientation ( FaceDirection3D  faceDir  )  [static]

Give the orientation of a face with respect to a cell, this function returns -1.0 if the outward normal of the face is pointing negative to the direction of the normal axis or 1.0 if not. This function can be undestood to be the value of the non zero component of the outward normal of the face. Remeber that a face can have two cells, for example if the face has normal aligned with the X, the normal is 1.0 if we consider the left cell (in this case the direction of the face is RIGHT_FACE), and -1.0 (LEFT_FACE) if you consider the right cell

Definition at line 1411 of file orthomesh.cpp.

01412 {
01413   static double tbl[] = {-1,1,-1,1,-1,1}; //THE TABLE OF CONVERSIONS
01414   return tbl[faceDir];
01415 }

Point3D OrthoMesh::getP (  )  const [inline]

Definition at line 296 of file orthomesh.h.

00296 {return _p1;}

Point3D OrthoMesh::getQ (  )  const [inline]

Definition at line 297 of file orthomesh.h.

00297 {return _p2;}

void OrthoMesh::getVerticeFromCell ( VertexDirection3D  dir,
unsigned  i,
unsigned  j,
unsigned  k,
Point3D p 
) const [protected]

Definition at line 292 of file orthomesh.cpp.

00293 {
00294   const unsigned *vDir = &(_VDirTbl[dir][0]); 
00295   p[0]=(i+vDir[0])*_DX[0];
00296   p[1]=(j+vDir[1])*_DX[1];
00297   p[2]=(k+vDir[2])*_DX[2];
00298 }

unsigned OrthoMesh::getVerticeIndexFromCell ( VertexDirection3D  dir,
unsigned  i,
unsigned  j,
unsigned  k 
) const [protected]

Definition at line 285 of file orthomesh.cpp.

00286 {
00287   const unsigned *vDir = &(_VDirTbl[dir][0]); 
00288   return (i+vDir[0]) + (j+vDir[1])*(_YVStride) + (k+vDir[2])*_ZVStride;
00289   
00290 }

unsigned OrthoMesh::getVerticeIndexFromPosition ( unsigned  i,
unsigned  j,
unsigned  k 
) const [protected]

Definition at line 278 of file orthomesh.cpp.

00279 {
00280   return i + j*_YVStride + k*_ZVStride;
00281 }

void OrthoMesh::getVerticePositionFromIndex ( unsigned  index,
unsigned &  i,
unsigned &  j,
unsigned &  k 
) const [protected]

Definition at line 268 of file orthomesh.cpp.

00269 {
00270   assert(index<numRawVertices());
00271   k=index/_ZVStride;
00272   index=index%_ZVStride;
00273   j=index/_YVStride;
00274   i=index%_YVStride;
00275   
00276 }

VecWellInfo OrthoMesh::getWells (  )  [inline]

Definition at line 305 of file orthomesh.h.

00305 {return m_wells;}

void OrthoMesh::initOrthoMesh ( Point3D p1,
Point3D p2,
unsigned  nElemX,
unsigned  nElemY,
unsigned  nElemZ 
) [private]

Definition at line 24 of file orthomesh.cpp.

00025  {
00026    _p1=p1;
00027    _p2=p2;
00028    _dx = _DX[0] = (_p2[0]-_p1[0])/((double) nElemX);
00029    _dy = _DX[1] = (_p2[1]-_p1[1])/((double) nElemY);
00030    _dz = _DX[2] = (_p2[2]-_p1[2])/((double) nElemZ);
00031    _cellVolume = _DX[0]*_DX[1]*_DX[2];
00032    
00033    _Barycenter0[0] =  _p1[0]+_DX[0]/2.0;
00034    _Barycenter0[1] =  _p1[1]+_DX[1]/2.0;
00035    _Barycenter0[2] =  _p1[2]+_DX[2]/2.0;
00036 
00037    _nElemX = nElemX;
00038    _nElemY = nElemY;
00039    _nElemZ = nElemZ;
00040 
00041    _LastI = nElemX-1;
00042    _LastJ = nElemY-1;
00043    _LastK = nElemZ-1;
00044 
00045    _nElemXY= nElemX*nElemY;
00046    _nElemXZ= nElemX*nElemZ;
00047    _nElemYZ= nElemY*nElemZ;
00048    
00049   
00050    
00051    _numRawCells = nElemX*nElemY*nElemZ;
00052    _numRawVertices=(nElemX+1)*(nElemY+1)*(nElemZ+1);
00053    _numInnerRawCells = ((nElemX > 2) ? nElemX-2 : 0)*((nElemY > 2) ? nElemY-2 : 0)*((nElemZ > 2) ? nElemZ-2 : 0);
00054 
00055 
00056    _ZStride = nElemX*nElemY;
00057    _YStride = nElemX;
00058 
00059 
00060 
00061    _ZVStride = (nElemX+1)*(nElemY+1);
00062    _YVStride = (nElemX+1);
00063 
00064    _fxYStride = nElemX+1;
00065    _fxZStride = (nElemX+1)*nElemY;
00066 
00067    _fyYStride = nElemX;
00068    _fyZStride = (nElemY+1)*nElemX;
00069 
00070    _fzYStride = nElemX;
00071    _fzZStride = nElemX*nElemY;
00072    
00073    _fyOff = (nElemX+1)*nElemY*nElemZ;
00074    _fzOff = _fyOff + nElemX*(nElemY+1)*nElemZ;
00075    _numRawFaces = (nElemX+1)*nElemY*nElemZ + nElemX*(nElemY+1)*nElemZ + nElemX*nElemY*(nElemZ+1);
00076 
00077    _numFaces    = _numRawFaces;
00078    _numVertices = _numRawVertices;
00079    _numCells    = _numRawCells;
00080    
00081    _numFacesAtBoundary = 2*(nElemX*nElemY + nElemX*nElemZ + nElemZ*nElemY); 
00082    
00083    _lastI = nElemX-1;
00084    _lastJ = nElemY-1;
00085    _lastK = nElemZ-1;
00086 
00087    _fxP0=_p1;
00088    _fxP0[0] += 0.0;
00089    _fxP0[1] += _DX[1]/2.0;
00090    _fxP0[2] += _DX[2]/2.0;
00091 
00092    _fyP0=_p1;
00093    _fyP0[0] += _DX[0]/2.0;
00094    _fyP0[1] += 0.0;
00095    _fyP0[2] += _DX[2]/2.0;
00096 
00097    _fzP0=_p1;
00098    _fzP0[0] += _DX[0]/2.0;
00099    _fzP0[1] += _DX[1]/2.0;
00100    _fzP0[2] += 0.0;
00101 
00102 
00103    _faceArea[NORMAL_X]=_DX[1]*_DX[2];
00104    _faceArea[NORMAL_Y]=_DX[0]*_DX[2];
00105    _faceArea[NORMAL_Z]=_DX[0]*_DX[1];
00106 
00107    _faceAreaPerCellVol[NORMAL_X]=1.0/_DX[0];
00108    _faceAreaPerCellVol[NORMAL_Y]=1.0/_DX[1];
00109    _faceAreaPerCellVol[NORMAL_Z]=1.0/_DX[2];
00110 
00111    //close the lists of deleted faces,cells and vertices
00112    _delFaceLst.close();
00113    _delCellLst.close();
00114    _delVertLst.close();
00115 
00116    _grid_tol = std::min(std::min(_DX[0],_DX[1]),_DX[2])/4.0;
00117    
00118 
00119 
00120    //Set the offsets to calculate indices of ghost cells. See OrthoFaceAccessor::ghostAdjCellIndices();
00121    _GhostLeftOff  = _numRawCells;
00122    _GhostRightOff = _GhostLeftOff  + _nElemYZ;
00123    _GhostFrontOff =_GhostRightOff  + _nElemYZ;
00124    _GhostBackOff  =_GhostFrontOff  + _nElemXZ;
00125    _GhostBottomOff= _GhostBackOff  + _nElemXZ;
00126    _GhostUpOff    = _GhostBottomOff+ _nElemXY;
00127 
00128    _numRawGhostCells = 2*(_nElemYZ + _nElemXY + _nElemXZ);
00129 
00130    _HGhostLeftOff   = _GhostLeftOff;
00131    _HGhostRightOff  = _GhostRightOff; 
00132    _HGhostFrontOff  = _GhostFrontOff;
00133    _HGhostBackOff   = _GhostBackOff;
00134    _HGhostBottomOff = _GhostBottomOff;
00135    _HGhostUpOff     = _GhostUpOff; 
00136 
00137    _numHGhostCells = _numRawGhostCells;
00138    
00139   
00140    
00141    //Set the iterators of the first and last elements
00142    //for the three geometries (vertices,cells,faces)
00143    _pBeginCell  = new OrthoCellAccessor(*this,0); 
00144    _pEndCell = new OrthoCellAccessor(*this,this->numRawCells()-1);
00145    (*_pEndCell)++;
00146    
00147    
00148    _pBeginFace  = new OrthoFaceAccessor(*this,0); 
00149    _pEndFace = new OrthoFaceAccessor(*this,this->numRawFaces()-1);
00150    (*_pEndFace)++;
00151 
00152    
00153 
00154 
00155    _pBeginVert  = new OrthoVerticeAccessor(*this,0); 
00156    _pEndVert = new OrthoVerticeAccessor(*this,this->numRawVertices()-1);
00157    (*_pEndVert)++;
00158 
00159 
00160 
00161 
00162    _pBeginCellH  = new OrthoCellAccessorWithHoles(*this,0); 
00163    _pEndCellH = new OrthoCellAccessorWithHoles(*this,this->numRawCells()-1);
00164    (*_pEndCellH)++;
00165 
00166    _pBeginFaceH  = new OrthoFaceAccessorWithHoles(*this,0); 
00167    _pEndFaceH = new OrthoFaceAccessorWithHoles(*this,this->numRawFaces()-1);
00168    (*_pEndFaceH)++;
00169 
00170 
00171    _pBeginVertH  = new OrthoVerticeAccessorWithHoles(*this,0); 
00172    _pEndVertH = new OrthoVerticeAccessorWithHoles(*this,this->numVertices()-1);
00173    (*_pEndVertH)++;
00174 
00175 
00176    //Set usefull tables. This tables are to avoid if then else conditions.
00177    //Some of theses tables are used by one or just two methods and the best
00178    //thing they are small and does not depende on the size of the mesh.
00179 
00180    //   m_faceIndexTable[NORMAL_X]
00181    m_FaceStridesTbl[NORMAL_X][0]=_fxYStride;   
00182    m_FaceStridesTbl[NORMAL_X][1]=_fxZStride;   
00183    m_FaceStridesTbl[NORMAL_Y][0]=_fyYStride;   
00184    m_FaceStridesTbl[NORMAL_Y][1]=_fyZStride;   
00185    m_FaceStridesTbl[NORMAL_Z][0]=_fzYStride;   
00186    m_FaceStridesTbl[NORMAL_Z][1]=_fzZStride;
00187 
00188 
00189    
00190 
00191    //This array is used in the OrthoFaceAccessor::advance_inner method 
00192    //m_innerFacesChangeKOffset is the  value of the offset you
00193    //need to add to the indice to go to the next J position.
00194    //m_innerFacesChangeKOffset is an array with offset for
00195    //each of the faces normal type (faces with normal_x, normal_y,normal_z)
00196    m_innerFacesChangeKOffset[NORMAL_X]=3;
00197    m_innerFacesChangeKOffset[NORMAL_Y]=2*(_nElemX)+1;
00198    m_innerFacesChangeKOffset[NORMAL_Z]=1;
00199 
00200 
00201    //This array is used in the OrthoFaceAccessor::advance_inner method 
00202    //It basically contains the indice of the next inner face when we
00203    //have an iterator at the last inner face with normal_x, normal_y
00204    //normal_z. So m_innerFacesChangeNormalOffset[NORMAL_X] is the indice
00205    //of the next inner face following the last inner face with normal_x.
00206    //That will be the indice of the face 1,1,1 with normal Y.
00207    //In the case of Z the next indice will be the invalid
00208    //cell with indice equal to _numRawFaces.
00209    m_innerFacesChangeNormalIndex[NORMAL_X]=_fyOff+_nElemX;
00210    m_innerFacesChangeNormalIndex[NORMAL_Y]=_fzOff+_nElemXY;
00211    m_innerFacesChangeNormalIndex[NORMAL_Z]=_numRawFaces;
00212    
00213 
00214    OrthoMesh::Raw_Cell_It cell = begin_raw_cell();
00215    while(cell != end_raw_cell() && cell->at_boundary())
00216      cell++;
00217    _pBeginInnerCell = new OrthoCellAccessor(*cell);
00218    _pEndInnerCell = new OrthoCellAccessor(*this,0,0,_LastK);
00219 
00220    OrthoMesh::Raw_Face_It face = begin_raw_face();
00221    OrthoMesh::Raw_Face_It endf = end_raw_face();
00222 
00223    while(face != end_raw_face() && face->at_boundary()) 
00224      face++;
00225    _pBeginInnerFace = new OrthoFaceAccessor(*face);
00226    
00227 
00228  }

static unsigned OrthoMesh::invalidIndex (  )  [inline, static]

Definition at line 336 of file orthomesh.h.

00336 {return INVALID_INDEX;}

bool OrthoMesh::isCellAtBoundary ( unsigned  i,
unsigned  j,
unsigned  k 
) const [protected]

Definition at line 459 of file orthomesh.cpp.

00460 {
00461   return (i==0 || j ==0 || k==0 || i == _lastI || j == _lastJ || k == _lastK);
00462 }

static bool OrthoMesh::isValid ( unsigned  index  )  [inline, static]

Definition at line 299 of file orthomesh.h.

00299 {return index != INVALID_INDEX;} 

double OrthoMesh::meshVolume (  )  const [inline]

Definition at line 345 of file orthomesh.h.

00345 {return numCells()*cellVolume();}       

bool OrthoMesh::nonZeroInwardNormalComponenentIsPositive ( FaceDirection3D  face_no  )  const

This is a very specific function and used just in the mixed formulation. So dont waste too much time with it, since its functionality is very restricted and used just one time in all the code. Give the position of the boundary face relative to the cell that contains it (e.g LEFT_FACE, BOTTOM_FACE..... ) this function returns true if the non zero component of the normal of the face pointing inward the domain is positive. Note that this makes sense only for meshes which the sides of the elements are parallel to the axis. Otherwise the normals will have more than one non-zero component. This method is used for classes that implements the MixedFormulation and receive a scalar function as boundary conditions for the velocities fields. Values of the scalar function represent the projection of the velocity field with the normal in the boundary face pointing in the direction of the domain

Parameters:
face_no index of the face relative to the cell that owns it.
Returns:

Definition at line 886 of file orthomesh.cpp.

00887 {
00888   //Remember that LEFT_FACE=0,RIGHT_FACE=1,FRONT_FACE=2,BACK_FACE=3,BOTTOM_FACE=4,UP_FACE=5
00889   static bool a[] = {1,0,1,0,1,0};
00890   assert(face_no < 6);
00891   return a[face_no];
00892 
00893   
00894 }

unsigned OrthoMesh::numCells (  )  const [inline]

Definition at line 287 of file orthomesh.h.

00287 {return _numCells;}

Point3D OrthoMesh::numElems (  )  const [inline]

Definition at line 295 of file orthomesh.h.

00295 {return Point3D(_nElemX,_nElemY,_nElemZ);}

unsigned OrthoMesh::numElemX (  )  const [inline]

Definition at line 292 of file orthomesh.h.

00292 {return _nElemX;}

unsigned OrthoMesh::numElemY (  )  const [inline]

Definition at line 293 of file orthomesh.h.

00293 {return _nElemY;}

unsigned OrthoMesh::numElemZ (  )  const [inline]

Definition at line 294 of file orthomesh.h.

00294 {return _nElemZ;}

unsigned OrthoMesh::numFaces (  )  const [inline]

Definition at line 288 of file orthomesh.h.

00288 {return _numFaces;}

unsigned OrthoMesh::numFacesAtBoundary (  )  const [inline]

Definition at line 291 of file orthomesh.h.

00291 {return _numFacesAtBoundary;}

unsigned OrthoMesh::numGhostCells (  )  const [inline]

Definition at line 290 of file orthomesh.h.

00290 {return _numHGhostCells;}

unsigned OrthoMesh::numRawCells (  )  const [inline]

Definition at line 284 of file orthomesh.h.

00284 {return _numRawCells;}

unsigned OrthoMesh::numRawFaces (  )  const [inline]

Definition at line 285 of file orthomesh.h.

00285 {return _numRawFaces;}

unsigned OrthoMesh::numRawVertices (  )  const [inline]

Definition at line 286 of file orthomesh.h.

00286 {return _numRawVertices;}

unsigned OrthoMesh::numVertices (  )  const [inline]

Definition at line 289 of file orthomesh.h.

00289 {return _numVertices;}

void OrthoMesh::print ( std::string  fileName = ""  ) 

Print information about the mesh to stdout.

Returns:

Definition at line 736 of file orthomesh.cpp.

00737 {
00738   
00739   FILE *file;
00740   if (fileName.empty())
00741     file=stdout;
00742   else
00743     file=fopen(fileName.c_str(),"w");
00744 
00745   Cell_It cell = begin_cell();
00746   Cell_It endc = end_cell();
00747   fprintf(file,"Domain: %g x %g x %g - %g %g %g\n",getP()[0],getP()[1],getP()[2],getQ()[0],getQ()[1],getQ()[2]); 
00748   fprintf(file,"Endc: %d\n",endc->index());
00749   fprintf(file,"NumRawCells: %d\n",numRawCells());
00750   fprintf(file,"NumCells: %d\n",numCells());
00751   fprintf(file,"Elems: %u x %u x %u\n",numElemX(),numElemY(),numElemZ());
00752   fprintf(file,"Steps: %g x %g x %g\n",getDX()[0],getDX()[1],getDX()[2]);
00753   for(;cell!=endc;cell++)
00754   {
00755     Point3D bc;
00756     cell->barycenter(bc);
00757     fprintf(file,"\n\n=====(%d, %d, %d)==============\n",cell->getI(),cell->getJ(),cell->getK());
00758     fprintf(file,"Cell: %u BC <%g, %g,%g>\n",cell->index(),bc[0],bc[1],bc[2]);
00759     fprintf(file,"VERTICE_000: %u\n",cell->vertex_index(VERTEX_000));
00760     fprintf(file,"VERTICE_100: %u\n",cell->vertex_index(VERTEX_100));
00761     fprintf(file,"VERTICE_010: %u\n",cell->vertex_index(VERTEX_010));
00762     fprintf(file,"VERTICE_110: %u\n",cell->vertex_index(VERTEX_110));
00763     fprintf(file,"VERTICE_001: %u\n",cell->vertex_index(VERTEX_001));
00764     fprintf(file,"VERTICE_101: %u\n",cell->vertex_index(VERTEX_101));
00765     fprintf(file,"VERTICE_011: %u\n",cell->vertex_index(VERTEX_011));
00766     fprintf(file,"VERTICE_111: %u\n",cell->vertex_index(VERTEX_111));
00767     fprintf(file,"LEFT_FACE  : %u\n",cell->face_index(LEFT_FACE));
00768     fprintf(file,"RIGHT_FACE : %u\n",cell->face_index(RIGHT_FACE));
00769     fprintf(file,"UP_FACE    : %u\n",cell->face_index(UP_FACE));
00770     fprintf(file,"BOTTOM_FACE: %u\n",cell->face_index(BOTTOM_FACE));
00771     fprintf(file,"FRONT_FACE : %u\n",cell->face_index(FRONT_FACE));
00772     fprintf(file,"BACK_FACE  : %u\n",cell->face_index(BACK_FACE));
00773   }
00774 
00775   fprintf(file,"===================\n   FACES\n=================\n");
00776   //Now iterate the faces
00777   Face_It face = begin_face();
00778   Face_It endf = end_face();
00779 
00780   for(;face!=endf;face++)
00781   {
00782     unsigned c1,c2;
00783     face->getAdjCellIndices(c1,c2);
00784     Point3D bc;
00785     face->barycenter(bc);
00786     fprintf(file,"\n\n=====(%d, %d, %d)==============\n",face->getI(),face->getJ(),face->getK());
00787     fprintf(file,"Face: %u\nBC <%g, %g,%g>\n",face->index(),bc[0],bc[1],bc[2]);
00788     if (c1 == OrthoMesh::INVALID_INDEX)
00789       fprintf(file,"CELL1: none\n");
00790     else
00791       fprintf(file,"CELL1: %u\n",c1);
00792     if (c2 == OrthoMesh::INVALID_INDEX)
00793       fprintf(file,"CELL2: none\n");
00794     else
00795       fprintf(file,"CELL2: %u\n",c2);
00796     fprintf(file,"Normal: ");
00797     switch (face->getNormalOrientation())
00798     {
00799     case NORMAL_X:
00800       fprintf(file,"X\n");
00801       break;
00802     case NORMAL_Y:
00803       fprintf(file,"Y\n");
00804       break;
00805     case NORMAL_Z:
00806       fprintf(file,"Z\n");
00807       break;
00808     default:
00809       abort();
00810     }
00811     fprintf(file,"At Boundary: ");
00812     if (face->at_boundary())
00813       fprintf(file,"true\n");
00814     else
00815       fprintf(file,"false\n");
00816     
00817   }
00818   if (!fileName.empty())
00819     fclose(file);
00820   
00821 }

void OrthoMesh::printCell ( Cell_It  cell,
std::ostream &  out 
)

Definition at line 1328 of file orthomesh.cpp.

01329 {
01330   char str[500];
01331   sprintf(str,"==== Cell %d ====\n",cell->index());
01332   out << str;
01333   out << "Barycenter: " << cell->barycenter() << std::endl;
01334   //     cout << "0 = " <<  cell->vertex(0) << endl;
01335   //     cout << "1 = " <<  cell->vertex(1) << endl;
01336   //     cout << "2 = " <<  cell->vertex(2) << endl;
01337   //     cout << "3 = " <<  cell->vertex(3) << endl;
01338   //     cout << "4 = " <<  cell->vertex(4) << endl;
01339   //     cout << "5 = " <<  cell->vertex(5) << endl;
01340   //     cout << "6 = " <<  cell->vertex(6) << endl;
01341   //     cout << "7 = " <<  cell->vertex(7) << endl;
01342 
01343   out << "V000 = "  << cell->vertex_index(VERTEX_000) <<  ") " << cell->vertex(VERTEX_000)  << std::endl;
01344   out << "V100 = " << cell->vertex_index(VERTEX_100) <<  ") " << cell->vertex(VERTEX_100) << std::endl;
01345   out << "V110 = " << cell->vertex_index(VERTEX_110) <<  ") " << cell->vertex(VERTEX_110) << std::endl;
01346   out << "V010 = " << cell->vertex_index(VERTEX_010) <<  ") " << cell->vertex(VERTEX_010) << std::endl;
01347   out << "V001 = " << cell->vertex_index(VERTEX_001) <<  ") " << cell->vertex(VERTEX_001) << std::endl;
01348   out << "V101 = " << cell->vertex_index(VERTEX_101) <<  ") " << cell->vertex(VERTEX_101) << std::endl;
01349   out << "V111 = " << cell->vertex_index(VERTEX_111) <<  ") " << cell->vertex(VERTEX_111) << std::endl;
01350   out << "V011 = " << cell->vertex_index(VERTEX_011) <<  ") " << cell->vertex(VERTEX_011) << std::endl;
01351 
01352   out << "RIGHT_FACE  " << cell->face_index (RIGHT_FACE) << ")" << std::endl;
01353   out << "LEFT_FACE   " << cell->face_index  (LEFT_FACE) << ")"  << std::endl;
01354   out << "FRONT_FACE  " << cell->face_index (FRONT_FACE) << ")" << std::endl;
01355   out << "BACK_FACE   " << cell->face_index  (BACK_FACE) << ")"  << std::endl;
01356   out << "BOTTOM_FACE " << cell->face_index(BOTTOM_FACE) << ")"<< std::endl;
01357   out << "UP_FACE     " << cell->face_index    (UP_FACE) << ")"    << std::endl;
01358 
01359 
01360 }

void OrthoMesh::printCells ( VecIndex vec,
std::ostream &  out 
)

Definition at line 1319 of file orthomesh.cpp.

01320 {
01321   for (unsigned i = 0;i<vec.size();i++)
01322   {
01323     out <<  i << ")";
01324     printCell(get_cell(vec[i]),out);
01325   }
01326 }

void OrthoMesh::projectCentralValuesAtVertices ( const VecDouble cValues,
VecDouble vValues 
) const

Given a solution (cValues) for each cell of the mesh, interpolate these values at the vertices and store it in the vector vValues indexed by the vertices indexes. In the case of the DealOrthoMesh, the values at vertices are simple the arithmetic media of the cells` values surrounding the vertices

Parameters:
vValues To contain the values at vertices
cValues Values at cells

Definition at line 905 of file orthomesh.cpp.

00906 {
00907   //Check the size of the vectors;
00908   assert(vValues.size() == numVertices());
00909   assert(cValues.size() == numCells());
00910 
00911   //This vector is a counter of the number of cells contributing to each vertice
00912   //It is initialized as zero.
00913   std::vector<char> nCellsPerVertice(numVertices(),0);
00914 
00915   //Initialize the values of the vector vValues.
00916   vValues=0.0;
00917 
00918   Cell_It endc = end_cell();
00919   for (Cell_It cell = begin_cell();cell != endc;cell++)
00920   {
00921     vValues(cell->vertex_index(VERTEX_000)) += cValues(cell->index());
00922     vValues(cell->vertex_index(VERTEX_001)) += cValues(cell->index());
00923     vValues(cell->vertex_index(VERTEX_010)) += cValues(cell->index());
00924     vValues(cell->vertex_index(VERTEX_011)) += cValues(cell->index());
00925     vValues(cell->vertex_index(VERTEX_100)) += cValues(cell->index());
00926     vValues(cell->vertex_index(VERTEX_101)) += cValues(cell->index());
00927     vValues(cell->vertex_index(VERTEX_110)) += cValues(cell->index());
00928     vValues(cell->vertex_index(VERTEX_111)) += cValues(cell->index());
00929 
00930     nCellsPerVertice[cell->vertex_index(VERTEX_000)]++;
00931     nCellsPerVertice[cell->vertex_index(VERTEX_001)]++;
00932     nCellsPerVertice[cell->vertex_index(VERTEX_010)]++;
00933     nCellsPerVertice[cell->vertex_index(VERTEX_011)]++;
00934     nCellsPerVertice[cell->vertex_index(VERTEX_100)]++;
00935     nCellsPerVertice[cell->vertex_index(VERTEX_101)]++;
00936     nCellsPerVertice[cell->vertex_index(VERTEX_110)]++;
00937     nCellsPerVertice[cell->vertex_index(VERTEX_111)]++;
00938 
00939   }
00940 
00941   //Now in vValues we have the sum of all sunrounding cells
00942   //and in nCellsPerVertice the number of cells sunrounding the vertices.
00943   //Rember that these number of cells sunrounding a vertice can differ
00944   //for vertices at boundary.
00945   for (unsigned i =0;i<vValues.size();i++)
00946       vValues(i)/=nCellsPerVertice[i];
00947 }

void OrthoMesh::projectVelocitiesInFacesToCells ( Matrix vel,
const VecDouble vNormalFaceVel 
)

Definition at line 1420 of file orthomesh.cpp.

01421 {
01422   assert(vel.m() == numCells() && vel.n() == 3);
01423   assert(vNormalFaceVel.size() == numFaces());
01424   OrthoMesh::Cell_It endc = end_cell();
01425 
01426   for (OrthoMesh::Cell_It cell = begin_cell();cell!=endc;cell++)
01427   {
01428     int i = cell->index();
01429     vel(i,0) = (vNormalFaceVel(cell->face_index(LEFT_FACE))    + vNormalFaceVel(cell->face_index(RIGHT_FACE)))/2.0;
01430     vel(i,1) = (vNormalFaceVel(cell->face_index(FRONT_FACE))   + vNormalFaceVel(cell->face_index(BACK_FACE)))/2.0;
01431     vel(i,2) = (vNormalFaceVel(cell->face_index(BOTTOM_FACE))  + vNormalFaceVel(cell->face_index(UP_FACE)))/2.0;
01432   }
01433 
01434 }

void OrthoMesh::projectVelocitiesInFacesToVertices ( Matrix vel,
const VecDouble vNormalFaceVel 
)

Definition at line 1445 of file orthomesh.cpp.

01446 {
01447   assert(Vel.m() == numVertices());
01448   assert(Vel.n() == 3);
01449   assert(vNormalFaceVel.size() == numFaces());
01450   char M[numVertices()][3];
01451   memset(M,0,3*numVertices());
01452   OrthoMesh::Face_It endf = end_face();
01453   Vel=0.0;
01454   for (OrthoMesh::Face_It face = begin_face();face!=endf;face++)
01455   {
01456     Vel(face->vertex_index_00(),face->getNormalOrientation())+=vNormalFaceVel(face->index());
01457     Vel(face->vertex_index_01(),face->getNormalOrientation())+=vNormalFaceVel(face->index());
01458     Vel(face->vertex_index_10(),face->getNormalOrientation())+=vNormalFaceVel(face->index());
01459     Vel(face->vertex_index_11(),face->getNormalOrientation())+=vNormalFaceVel(face->index());
01460 
01461     M[face->vertex_index_00()][face->getNormalOrientation()]+=1;
01462     M[face->vertex_index_01()][face->getNormalOrientation()]+=1;
01463     M[face->vertex_index_10()][face->getNormalOrientation()]+=1;
01464     M[face->vertex_index_11()][face->getNormalOrientation()]+=1;
01465   }
01466   for (unsigned i=0;i<numVertices();i++)
01467   {
01468     Vel(i,0)/=M[i][0];
01469     Vel(i,1)/=M[i][1];
01470     Vel(i,2)/=M[i][2];
01471   }
01472 }

void OrthoMesh::putWells ( VecWellInfo wells  ) 

Definition at line 1033 of file orthomesh.cpp.

01034 {
01035   m_wells=wells;
01036   Point3D DX_4 = this->getDX();
01037   Point3D DX = this->getDX();
01038   DX_4[0]/=4.0;
01039   DX_4[1]/=4.0;
01040   DX_4[2]/=4.0;
01041   std::vector<Index> vInnerWellCells;
01042   
01043   DelIndexLst delCellLst,delVertLst,delFaceLst;
01044   for (unsigned i=0;i<wells.size();i++)
01045   {
01046       WellInfo well = wells[i];
01047       well.P+=DX_4;
01048       well.Q-=DX_4;
01049       Raw_Cell_It endc = end_raw_cell();
01050       Point3D p;
01051       for(Raw_Cell_It cell = begin_raw_cell();cell != endc;cell++)
01052       {
01053         cell->barycenter(p);
01054         if (well.isPointInWell(p))
01055           delCellLst.addIndex(cell->index(),wells[i].isInnerCell(p,DX));
01056       }
01057 
01058       Raw_Vertex_It endv = end_raw_vertice();
01059       for(Raw_Vertex_It vert = begin_raw_vertice();vert != endv;vert++)
01060       {
01061         if (well.isPointInWell(vert->getPoint()))
01062             delVertLst.addIndex(vert->index());
01063       }
01064       
01065       Raw_Face_It endf = end_raw_face();
01066       for (Raw_Face_It face = begin_raw_face();face != endf;face++)
01067       {
01068         if (well.isPointInWell(face->barycenter()))
01069             delFaceLst.addIndex(face->index());
01070       }
01071   }
01072 
01073   delCellLst.close();
01074   delVertLst.close();
01075   delFaceLst.close();
01076   
01077   _delCellLst = delCellLst;
01078   _delVertLst = delVertLst;
01079   _delFaceLst = delFaceLst;
01080   
01081   _numFaces   -= _delFaceLst.size();
01082   _numCells   -= _delCellLst.size();
01083   _numVertices-= _delVertLst.size();
01084 
01085   delete _pBeginCellH;
01086   delete _pEndCellH;
01087   _pBeginCellH  = new OrthoCellAccessorWithHoles(*this,0); 
01088    _pEndCellH = new OrthoCellAccessorWithHoles(*this,this->numRawCells()-1);
01089    (*_pEndCellH)++;
01090 
01091    delete _pBeginFaceH;
01092    delete _pEndFaceH;
01093    _pBeginFaceH  = new OrthoFaceAccessorWithHoles(*this,0); 
01094    _pEndFaceH = new OrthoFaceAccessorWithHoles(*this,this->numRawFaces()-1);
01095    (*_pEndFaceH)++;
01096 
01097 
01098    delete _pBeginVertH;
01099    delete _pEndVertH;
01100    _pBeginVertH  = new OrthoVerticeAccessorWithHoles(*this,0); 
01101    _pEndVertH = new OrthoVerticeAccessorWithHoles(*this,this->numVertices()-1);
01102    (*_pEndVertH)++;
01103 
01104   
01105    _HGhostLeftOff  = _numRawCells-delCellLst.getNumInnerGhostCells();
01106    _HGhostRightOff = _HGhostLeftOff   + _nElemYZ;
01107    _HGhostFrontOff = _HGhostRightOff  + _nElemYZ;
01108    _HGhostBackOff  = _HGhostFrontOff  + _nElemXZ;
01109    _HGhostBottomOff= _HGhostBackOff   + _nElemXZ;
01110    _HGhostUpOff    = _HGhostBottomOff + _nElemXY;
01111    _HGhostWellOff=_numCells;
01112 
01113 
01114    _numHGhostCells = 2*(_nElemYZ + _nElemXY + _nElemXZ) + delCellLst.size() - delCellLst.getNumInnerGhostCells();
01115    
01116 }

void OrthoMesh::setCentralValuesFromFunction ( Function3D f,
Matrix MValues 
)

Eval the function f at the central values in the cell, storing the values of each component in the matrix Mvalue

Parameters:
f Function to be evaluated.
MValues Matirx containing the central values.
component The component of the method. Pre: Number of columns of Matrix equal the number of components of f

Definition at line 854 of file orthomesh.cpp.

00855 {
00856   assert(MValues.m() == numCells());
00857   assert(MValues.n() == f.n_components());
00858          
00859   Cell_It cell = this->begin_cell(),
00860     endc = this->end_cell();
00861   Point<DIM> BC;     
00862   for (;cell!=endc;cell++)
00863   {
00864     BC = cell->barycenter();
00865     for (unsigned cmp=0;cmp<f.n_components();cmp++)
00866       MValues(cell->index(),cmp)=f(BC,cmp);
00867   }
00868 
00869 
00870 }

void OrthoMesh::setCentralValuesFromFunction ( Function3D f,
VecDouble cValues,
unsigned  component = 0 
)

Eval the function f at the central values in the cell, storing the solution in the vector cValues.

Parameters:
f Function to be evaluated.
cValues Vector containing the central values.
component The component of the method.

Definition at line 832 of file orthomesh.cpp.

00833 {
00834   assert(cValues.size() == numCells());
00835          
00836   Cell_It cell = this->begin_cell(),
00837     endc = this->end_cell();
00838   Point<DIM> BC;     
00839   for (;cell!=endc;cell++)
00840   {
00841     BC = cell->barycenter();
00842     cValues(cell->index())=f(BC,component);
00843   }
00844 
00845 }

void OrthoMesh::setFacesValuesFromFunction ( Function3D f,
Matrix MValues,
const bool  bOnlyAtBoundary = false 
)

Eval all the components of the function f at the faces midpoints storing the values in the Matrix fValues.

Parameters:
f Function to be evaluated.
fValues Matrix to contain the values. The Matrix must have the size [numFaces() x f.num_components()]
bOnlyAtBoundary If the function must be evaluated only in the boundary faces.
Returns:

Definition at line 1006 of file orthomesh.cpp.

01007 {
01008   assert(MValues.m() == numFaces());
01009   assert(MValues.n() == f.n_components());
01010   
01011   Face_It face    = begin_face();
01012   Face_It endFace = end_face();
01013   
01014   for (;face!=endFace;face++)
01015   {
01016     if (bOnlyAtBoundary && !face->at_boundary()) 
01017       continue;
01018 
01019     Point<3> P = face->barycenter();
01020     unsigned faceIndex = face->index();
01021     for (unsigned deg=0;deg<f.n_components();deg++)
01022     {
01023       MValues(faceIndex,deg) = f(P,deg);
01024     }
01025   }
01026 }

void OrthoMesh::setFacesValuesFromFunction ( Function3D f,
VecDouble fValues,
unsigned  deg = 0,
bool  bOnlyPrescribedBoundary = false 
)

Eval the function f at the faces midpoints storing the values in the vector fValues.

Parameters:
f Function to be evaluated.
fValues Vector to contain the values.
deg The number of the component of the function f to be stored in fValues.
bOnlyAtBoundary If this flag is true the function is evaluated only in the boundary faces and only in the faces where the method f.boundary_type(Point X) returns the value PRESCRIBED_BOUNDARY_CONDITION.
Returns:

Definition at line 960 of file orthomesh.cpp.

00961 {
00962   assert(fValues.size() == numFaces());
00963   OrthoMesh::Face_It face    = begin_face();
00964   OrthoMesh::Face_It endFace = end_face();
00965   Point3D P;
00966   for (;face!=endFace;face++)
00967   {
00968     if (bOnlyPrescribedBoundary && !face->at_boundary()) 
00969       continue;
00970 
00971     face->barycenter(P);
00972     if (!f.isInDomain(P,deg))
00973       continue;
00974     else
00975       fValues(face->index())=f(P,deg);
00976   }
00977 }

void OrthoMesh::tagFacesInDomain ( Function3D f,
VecTag tags,
char  value 
)

Tag faces inside the domain of f using the value value.

Parameters:
f Function
tags Vector of tags
value Value to tag
Returns:

Definition at line 1287 of file orthomesh.cpp.

01288 {
01289   assert(tags.size() == numFaces());
01290   OrthoMesh::Face_It face    = begin_face();
01291   OrthoMesh::Face_It endFace = end_face();
01292 
01293 
01294   
01295   for (;face!=endFace;face++)
01296   {
01297     Point<3> P = face->barycenter();
01298     if (f.isInDomain(P,0))
01299       tags[face->index()] = value;
01300   }
01301 }


Friends And Related Function Documentation

friend class CashOrthoFaceAccessor [friend]

Definition at line 168 of file orthomesh.h.

friend class FaceInfoCash [friend]

Definition at line 167 of file orthomesh.h.

friend class OrthoCellAccessor [friend]

Definition at line 161 of file orthomesh.h.

friend class OrthoCellAccessorWithHoles [friend]

Definition at line 162 of file orthomesh.h.

friend class OrthoFaceAccessor [friend]

Definition at line 164 of file orthomesh.h.

friend class OrthoFaceAccessorWithHoles [friend]

Definition at line 163 of file orthomesh.h.

friend class OrthoVerticeAccessor [friend]

Definition at line 165 of file orthomesh.h.

friend class OrthoVerticeAccessorWithHoles [friend]

Definition at line 166 of file orthomesh.h.

friend class UnitTests [friend]

Definition at line 169 of file orthomesh.h.


Member Data Documentation

Definition at line 176 of file orthomesh.h.

double OrthoMesh::_cellVolume [private]

Definition at line 205 of file orthomesh.h.

Definition at line 223 of file orthomesh.h.

Definition at line 221 of file orthomesh.h.

Definition at line 222 of file orthomesh.h.

double OrthoMesh::_dx [private]

Definition at line 177 of file orthomesh.h.

Definition at line 176 of file orthomesh.h.

double OrthoMesh::_dy [private]

Definition at line 177 of file orthomesh.h.

double OrthoMesh::_dz [private]

Definition at line 177 of file orthomesh.h.

double OrthoMesh::_faceArea[3] [private]

Definition at line 203 of file orthomesh.h.

double OrthoMesh::_faceAreaPerCellVol[3] [private]

Definition at line 204 of file orthomesh.h.

Definition at line 178 of file orthomesh.h.

unsigned OrthoMesh::_fxYStride [private]

Definition at line 195 of file orthomesh.h.

unsigned OrthoMesh::_fxZStride [private]

Definition at line 195 of file orthomesh.h.

unsigned OrthoMesh::_fyOff [private]

Definition at line 196 of file orthomesh.h.

Definition at line 178 of file orthomesh.h.

unsigned OrthoMesh::_fyYStride [private]

Definition at line 195 of file orthomesh.h.

unsigned OrthoMesh::_fyZStride [private]

Definition at line 195 of file orthomesh.h.

unsigned OrthoMesh::_fzOff [private]

Definition at line 196 of file orthomesh.h.

The barycenter of the first face with normal X,Y,Z respectively

Definition at line 178 of file orthomesh.h.

unsigned OrthoMesh::_fzYStride [private]

Definition at line 195 of file orthomesh.h.

unsigned OrthoMesh::_fzZStride [private]

Definition at line 195 of file orthomesh.h.

unsigned OrthoMesh::_GhostBackOff [private]

Definition at line 199 of file orthomesh.h.

unsigned OrthoMesh::_GhostBottomOff [private]

Definition at line 199 of file orthomesh.h.

unsigned OrthoMesh::_GhostFrontOff [private]

Definition at line 199 of file orthomesh.h.

unsigned OrthoMesh::_GhostLeftOff [private]

Definition at line 199 of file orthomesh.h.

unsigned OrthoMesh::_GhostRightOff [private]

Definition at line 199 of file orthomesh.h.

unsigned OrthoMesh::_GhostUpOff [private]

Definition at line 199 of file orthomesh.h.

double OrthoMesh::_grid_tol [private]

Definition at line 206 of file orthomesh.h.

unsigned OrthoMesh::_HGhostBackOff [private]

Definition at line 200 of file orthomesh.h.

unsigned OrthoMesh::_HGhostBottomOff [private]

Definition at line 200 of file orthomesh.h.

unsigned OrthoMesh::_HGhostFrontOff [private]

Definition at line 200 of file orthomesh.h.

unsigned OrthoMesh::_HGhostLeftOff [private]

Definition at line 200 of file orthomesh.h.

unsigned OrthoMesh::_HGhostRightOff [private]

Definition at line 200 of file orthomesh.h.

unsigned OrthoMesh::_HGhostUpOff [private]

Definition at line 200 of file orthomesh.h.

unsigned OrthoMesh::_HGhostWellOff [private]

Definition at line 201 of file orthomesh.h.

unsigned OrthoMesh::_LastI [private]

Definition at line 198 of file orthomesh.h.

unsigned OrthoMesh::_lastI [private]

Definition at line 194 of file orthomesh.h.

unsigned OrthoMesh::_LastJ [private]

Definition at line 198 of file orthomesh.h.

unsigned OrthoMesh::_lastJ [private]

Definition at line 194 of file orthomesh.h.

unsigned OrthoMesh::_LastK [private]

Definition at line 198 of file orthomesh.h.

unsigned OrthoMesh::_lastK [private]

Definition at line 194 of file orthomesh.h.

unsigned OrthoMesh::_nElemX [private]

Definition at line 179 of file orthomesh.h.

unsigned OrthoMesh::_nElemXY [private]

Definition at line 180 of file orthomesh.h.

unsigned OrthoMesh::_nElemXZ [private]

Definition at line 180 of file orthomesh.h.

unsigned OrthoMesh::_nElemY [private]

Definition at line 179 of file orthomesh.h.

unsigned OrthoMesh::_nElemYZ [private]

Definition at line 180 of file orthomesh.h.

unsigned OrthoMesh::_nElemZ [private]

Definition at line 179 of file orthomesh.h.

unsigned OrthoMesh::_numCells [private]

Definition at line 185 of file orthomesh.h.

unsigned OrthoMesh::_numFaces [private]

Definition at line 187 of file orthomesh.h.

unsigned OrthoMesh::_numFacesAtBoundary [private]

Definition at line 197 of file orthomesh.h.

unsigned OrthoMesh::_numHGhostCells [private]

Definition at line 188 of file orthomesh.h.

unsigned OrthoMesh::_numInnerRawCells [private]

Definition at line 182 of file orthomesh.h.

unsigned OrthoMesh::_numRawCells [private]

Definition at line 181 of file orthomesh.h.

unsigned OrthoMesh::_numRawFaces [private]

Definition at line 184 of file orthomesh.h.

unsigned OrthoMesh::_numRawGhostCells [private]

Definition at line 189 of file orthomesh.h.

unsigned OrthoMesh::_numRawVertices [private]

Definition at line 183 of file orthomesh.h.

unsigned OrthoMesh::_numVertices [private]

Definition at line 186 of file orthomesh.h.

Definition at line 175 of file orthomesh.h.

Definition at line 175 of file orthomesh.h.

Definition at line 213 of file orthomesh.h.

Definition at line 218 of file orthomesh.h.

Definition at line 215 of file orthomesh.h.

Definition at line 219 of file orthomesh.h.

Definition at line 214 of file orthomesh.h.

Definition at line 215 of file orthomesh.h.

Definition at line 216 of file orthomesh.h.

Definition at line 217 of file orthomesh.h.

Definition at line 213 of file orthomesh.h.

Definition at line 218 of file orthomesh.h.

Definition at line 215 of file orthomesh.h.

Definition at line 219 of file orthomesh.h.

Definition at line 214 of file orthomesh.h.

Definition at line 216 of file orthomesh.h.

Definition at line 217 of file orthomesh.h.

const unsigned OrthoMesh::_VDirTbl [static, private]
Initial value:
 {{0,0,0},
                                                {1,0,0},
                                                {0,1,0},
                                                {1,1,0},
                                                {0,0,1},
                                                {1,0,1},
                                                {0,1,1},
                                                {1,1,1}}

Definition at line 174 of file orthomesh.h.

unsigned OrthoMesh::_YStride [private]

Definition at line 191 of file orthomesh.h.

unsigned OrthoMesh::_YVStride [private]

Definition at line 193 of file orthomesh.h.

unsigned OrthoMesh::_ZStride [private]

Definition at line 190 of file orthomesh.h.

unsigned OrthoMesh::_ZVStride [private]

Definition at line 192 of file orthomesh.h.

const unsigned OrthoMesh::FACES_PER_CELL = 6 [static]

Definition at line 237 of file orthomesh.h.

const unsigned OrthoMesh::INVALID_INDEX = UINT_MAX [static]

Definition at line 239 of file orthomesh.h.

Definition at line 275 of file orthomesh.h.

Definition at line 210 of file orthomesh.h.

Definition at line 209 of file orthomesh.h.

std::vector<FaceInfoCash> OrthoMesh::m_vFCash [private]

Definition at line 228 of file orthomesh.h.

Definition at line 173 of file orthomesh.h.

const unsigned OrthoMesh::VERTICES_PER_CELL = 8 [static]

Definition at line 238 of file orthomesh.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:26 2012 for CO2INJECTION by  doxygen 1.6.3