00001 #include "poissoneqvar.h"
00002
00003 const Index PoissonEqVar::m_local_dof_face_cell_map[6][4] = {{0,2,4,6},
00004 {1,3,5,7},
00005 {0,1,4,5},
00006 {2,3,6,7},
00007 {0,1,2,3},
00008 {4,5,6,7}};
00009
00010
00011
00012 PoissonEqVar::PoissonEqVar(OrthoMesh &mesh)
00013 :m_FE(1),m_cQG(2),m_fQG(2),
00014 m_global_dofs_map(OrthoMesh::VERTICES_PER_CELL),m_mesh(mesh)
00015 {
00016 initFEValues(m_mesh,m_FE,m_cQG,m_fQG, update_quadrature_points|update_gradients|update_JxW_values|update_values, update_JxW_values|update_values|update_quadrature_points);
00017 m_pFS=NULL;
00018
00019 }
00020
00021
00022
00023
00024
00025
00026 Index PoissonEqVar::local_face_to_local_cell_map(Index face,Index local_dof_face)
00027 {
00028 assert(face < OrthoMesh::FACES_PER_CELL);
00029 assert(local_dof_face<n_dofs_per_face());
00030 return m_local_dof_face_cell_map[face][local_dof_face];
00031 }
00032
00033
00034 Point3D PoissonEqVar::get_global_dof_position(Index cDof)
00035 {
00036 return getCell()->vertex(static_cast<VertexDirection3D>(cDof));
00037 }
00038
00039
00040 Index PoissonEqVar::local_dof_component(Index cDof)
00041 {
00042 return 0;
00043 }
00044
00045
00046 const VecIndex& PoissonEqVar::local_to_global_dofs_map()
00047 {
00048 return m_global_dofs_map;
00049 }
00050
00051
00052 PoissonEqVar::~PoissonEqVar()
00053 {
00054 DealFEWrapper::clear();
00055
00056 }
00057
00058
00059 double PoissonEqVar::localEqVar(unsigned i,unsigned j,unsigned qPoint)
00060 {
00061 return m_currK*shape_grad(i,qPoint)*shape_grad(j,qPoint)*JxW(qPoint);
00062 }
00063
00064
00065 double PoissonEqVar::localRHS(unsigned i,unsigned qPoint)
00066 {
00067 assert(m_pFS);
00068 Function3D &fs=*m_pFS;
00069 Point3D pt = get_qpoint(qPoint);
00070 return shape_value(i,qPoint)*fs(pt)*JxW(qPoint);
00071 }
00072
00073
00074 bool PoissonEqVar::nullProduct(unsigned i,unsigned j)
00075 {
00076 return false;
00077 }
00078
00079
00080 void PoissonEqVar::setCell(OrthoMesh::Cell_It &cell)
00081 {
00082 DealFEWrapper::setCell(cell);
00083
00084
00085 for (unsigned v=0;v<OrthoMesh::VERTICES_PER_CELL;v++)
00086 {
00087 m_global_dofs_map[v]=cell->vertex_index(static_cast<VertexDirection3D>(v));
00088 }
00089 }
00090
00091
00092
00093
00094 double PoissonEqVar::localNeummanCondition(unsigned face_no,unsigned face_local_dof,unsigned qPoint,Function3D &fN)
00095 {
00096 Point3D X = get_face_qpoint(qPoint);
00097 return fN(X)*shape_value_face(face_no,face_local_dof,qPoint)*JxWFace(qPoint);
00098 }
00099
00100
00101