#include <velreader2d.h>
Public Member Functions | |
VelReader2D (std::string filename, OrthoMesh &mesh) | |
~VelReader2D () | |
virtual void | getVelocitiesAtFaces (Matrix &vel) |
virtual void | getNormalVelocityAtFaces (VecDouble &vFNC) |
virtual void | iterate (TransportBase &trans) |
virtual void | printOutput () |
Private Attributes | |
std::string | file |
OrthoMesh & | mesh |
VecDouble | m_vFNC |
Definition at line 9 of file velreader2d.h.
VelReader2D::VelReader2D | ( | std::string | filename, | |
OrthoMesh & | mesh | |||
) |
VelReader2D::~VelReader2D | ( | ) | [inline] |
Definition at line 19 of file velreader2d.h.
void VelReader2D::getNormalVelocityAtFaces | ( | VecDouble & | vFNC | ) | [virtual] |
Reimplemented from DynamicBase.
Definition at line 13 of file velreader2d.cpp.
00014 { 00015 vFNC=m_vFNC; 00016 00017 }
void VelReader2D::getVelocitiesAtFaces | ( | Matrix & | vel | ) | [virtual] |
Reimplemented from DynamicBase.
Definition at line 86 of file velreader2d.cpp.
00087 { 00088 assert(vel.m() == mesh.numFaces() && vel.n() == 3); 00089 00090 vel = 0.0; 00091 //Get the face iterator and the number of faces. 00092 OrthoMesh::Face_It face = mesh.begin_face(); 00093 OrthoMesh::Face_It endf = mesh.end_face(); 00094 00095 //For each face 00096 for (;face!=endf;face++) 00097 { 00098 vel(face->index(),face->getNormalOrientation()) = m_vFNC(face->index()); 00099 } 00100 00101 }
void VelReader2D::iterate | ( | TransportBase & | trans | ) | [virtual] |
Implements DynamicBase.
Definition at line 23 of file velreader2d.cpp.
00024 { 00025 00026 OrthoMesh::Cell_It cell = mesh.begin_cell(); 00027 OrthoMesh::Cell_It endc = mesh.end_cell(); 00028 std::ifstream indata; 00029 indata.open(file.c_str()); 00030 if (!indata) 00031 { 00032 throw new Exception("VelReader2D: File %s does not exist",file.c_str()); 00033 00034 } 00035 for(;cell!=endc;cell++) 00036 { 00037 double data1,data2,data3,data4; 00038 00039 /*indata.open(file.c_str()); 00040 if (!indata) 00041 { 00042 throw new Exception("VelReader2D: File %s does not exist",file.c_str()); 00043 00044 }*/ 00045 m_vFNC(cell->face_index_up()) = 0; 00046 m_vFNC(cell->face_index_bottom()) =0; 00047 /*indata >>data1; 00048 indata >>data2; 00049 indata >>data3; 00050 indata >>data4; 00051 m_vFNC(cell->face_index_left())=data1; 00052 m_vFNC(cell->face_index_right())=data2; 00053 m_vFNC(cell->face_index_front())=data3; 00054 m_vFNC(cell->face_index_back())=data4;*/ 00055 indata >>data1; 00056 if(indata.eof()) 00057 throw new Exception("VelReader2D:Data file has %d lines and we expected %d lines",cell->index()+1,m_vFNC.size()); 00058 00059 m_vFNC(cell->face_index_left())=-data1; 00060 indata >>data2; 00061 m_vFNC(cell->face_index_right())=data2; 00062 indata >>data3; 00063 m_vFNC(cell->face_index_front())=-data3; 00064 indata >>data4; 00065 m_vFNC(cell->face_index_back())=data4; 00066 //indata.close(); 00067 //throw new Exception("End of the file reached"); 00068 00069 } 00070 indata.close(); 00071 if(indata.eof()) 00072 throw new Exception("VelReader2D:Data file has more lines than expected. It should have %d lines",mesh.numCells()); 00073 00074 /*DEBUG PURPOSES 00075 cout<< "Printing m_vFNC vector"<< m_vFNC.size()<<"\n"; 00076 00077 for(int i= 0;i< m_vFNC.size();i++) 00078 { 00079 //throw new Exception("The face number:%d fluid field:%f\n ",i,m_vFNC(i)); 00080 cout<< "The face number: "<< i <<" fluid field: "<< m_vFNC(i)<< "\n"; 00081 }*/ 00082 00083 }
void VelReader2D::printOutput | ( | ) | [virtual] |
std::string VelReader2D::file [private] |
Definition at line 12 of file velreader2d.h.
VecDouble VelReader2D::m_vFNC [private] |
Definition at line 14 of file velreader2d.h.
OrthoMesh& VelReader2D::mesh [private] |
Definition at line 13 of file velreader2d.h.