VecIncBC Class Reference

#include <vecincbc.h>

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

List of all members.

Public Types

typedef VecIncAccess
< VecIncBCData >
::data_iterator 
data_iterator

Public Member Functions

 VecIncBC ()
void rewind ()
unsigned bc_dim ()
bool get_ref_bc (Index index, VecDoubleRef &vSw)
double * get_bc_ptr (Index index)
bool has_bc (Index index)
bool copy_bc (Index index, VecDouble &vSw)
void set_bc_from_function (OrthoMesh &mesh, Function3D &f)
 ~VecIncBC ()

Protected Member Functions

void reinit (Index nBC, Index vectors_size)
void add_bc (Index faceIndex, Index nearCell, const VecDouble &bc)
unsigned get_bcvector_size ()

Private Attributes

Index _vectors_size
std::vector< double > m_v
VecIncAccess< VecIncBCData >
::iterator 
it

Friends

std::ostream & operator<< (std::ostream &out, VecIncBC &vbc)

Detailed Description

VectorBC

Definition at line 28 of file vecincbc.h.


Member Typedef Documentation

Reimplemented from VecIncAccess< VecIncBCData >.

Definition at line 40 of file vecincbc.h.


Constructor & Destructor Documentation

VecIncBC::VecIncBC (  )  [inline]

Definition at line 46 of file vecincbc.h.

00046 :it(begin()){_vectors_size=0;}

VecIncBC::~VecIncBC (  )  [inline]

Definition at line 54 of file vecincbc.h.

00054 {}


Member Function Documentation

void VecIncBC::add_bc ( Index  faceIndex,
Index  nearCell,
const VecDouble bc 
) [protected]

Definition at line 16 of file vecincbc.cpp.

00017 {
00018   for (Index i=0;i<_vectors_size;i++)
00019     m_v.push_back(bc(i));
00020   this->push_back(faceIndex,VecIncBCData(&(m_v.back())-_vectors_size +1,nearCell));
00021 }

unsigned VecIncBC::bc_dim (  )  [inline]

Definition at line 48 of file vecincbc.h.

00048 {return _vectors_size;}

bool VecIncBC::copy_bc ( Index  index,
VecDouble vSw 
)

Definition at line 89 of file vecincbc.cpp.

00090 {
00091   assert(vSw.size() == _vectors_size);
00092   assert(vSw.is_owner());
00093   VecIncBCData *data = it.inc_search(index);
00094   if (data)
00095   {
00096     const double *pd=data->p;
00097     for (unsigned i=0;i<_vectors_size;i++)
00098       vSw(i)=pd[i];
00099     return true;
00100   }
00101   else
00102     return false;
00103   
00104 
00105 }

double * VecIncBC::get_bc_ptr ( Index  index  ) 

Definition at line 141 of file vecincbc.cpp.

00142 {
00143   VecIncBCData *data = it.inc_search(index);
00144   return (data) ? data->p : NULL;
00145 }

unsigned VecIncBC::get_bcvector_size (  )  [inline, protected]

Definition at line 37 of file vecincbc.h.

00037 {return _vectors_size;}

bool VecIncBC::get_ref_bc ( Index  index,
VecDoubleRef vSw 
)

Definition at line 75 of file vecincbc.cpp.

00076 {
00077   assert(vSw.size() == _vectors_size);
00078   VecIncBCData *data = it.inc_search(index);
00079   if (data)
00080   {
00081     vSw.setData(data->p);
00082     return true;
00083   }
00084   else
00085     return false;
00086   
00087 }

bool VecIncBC::has_bc ( Index  index  ) 

Definition at line 109 of file vecincbc.cpp.

00110 {
00111     return it.inc_search(index)!=NULL;
00112 }

void VecIncBC::reinit ( Index  nBC,
Index  vectors_size 
) [protected]

Definition at line 5 of file vecincbc.cpp.

00006 {
00007   _vectors_size=vectors_size;
00008   m_v.clear();
00009   m_v.reserve(nBC*vectors_size);
00010   this->reserve(nBC);
00011 }

void VecIncBC::rewind (  ) 

Definition at line 67 of file vecincbc.cpp.

00068 {
00069   assert(!m_v.empty());
00070   it=begin();
00071 }

void VecIncBC::set_bc_from_function ( OrthoMesh mesh,
Function3D f 
)

Definition at line 25 of file vecincbc.cpp.

00026 {
00027   OrthoMesh::Face_It  face = mesh.begin_face();
00028   OrthoMesh::Face_It  end = mesh.end_face();
00029   Point3D P;
00030   VecDouble v(f.getImageDim());
00031   unsigned nBC=0;
00032   for (;face!=end;face++)
00033   {
00034     if (face->at_boundary())
00035     {
00036        face->barycenter(P);
00037         if (!f.isInDomain(P))
00038           continue;
00039         else
00040           nBC++;
00041     }
00042   }
00043   printf("Reinit BC to %u\n",nBC);
00044   reinit(nBC,f.getImageDim());
00045 
00046   for (face=mesh.begin_face();face!=end;face++)
00047   {
00048     if (face->at_boundary())
00049     {
00050        face->barycenter(P);
00051         if (!f.isInDomain(P))
00052           continue;
00053         else
00054         {
00055           unsigned dim = f.getImageDim();
00056           for (unsigned j=0;j<dim;j++)
00057             v(j)=f(P,j);
00058           unsigned c1,c2;
00059           face->getValidCellIndices(c1,c2);
00060           add_bc(face->index(),c1,v);
00061         }
00062     }
00063   }
00064 }


Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  out,
VecIncBC vbc 
) [friend]

Definition at line 115 of file vecincbc.cpp.

00116 {
00117   //VecIncBC::iterator it = vbc.begin();
00118   std::vector<VecIncBC::Node >::const_iterator it = vbc.m_list.begin();
00119   std::vector<VecIncBC::Node >::const_iterator itlast = vbc.m_list.end();
00120   itlast--;
00121   while(it != itlast)
00122   {
00123     out << it->index <<") " << "Near Cell" << it->data.nearCell << " Add: " <<  it->data.p << ": ";
00124     for (unsigned i=0;i<vbc._vectors_size;i++)
00125     {
00126       out << it->data.p[i] << " ";
00127     }
00128     out << std::endl;
00129     it++;
00130   }
00131   return out;
00132 }


Member Data Documentation

Definition at line 31 of file vecincbc.h.

VecIncAccess<VecIncBCData>::iterator VecIncBC::it [private]

Definition at line 33 of file vecincbc.h.

std::vector<double> VecIncBC::m_v [private]

Definition at line 32 of file vecincbc.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:33 2012 for CO2INJECTION by  doxygen 1.6.3