00001 #include "eqvart.h"
00002
00003 double EqVarT::getSolValue(Vector<double> &sol)
00004 {
00005 unsigned i;
00006 unsigned n_dofs_per_cell = m_fev->get_fe().dofs_per_cell;
00007 double result=0.0;
00008 for (i=0;i<n_dofs_per_cell;i++)
00009 {
00010 result+=sol(m_dofIndices[i])*m_fev->shape_value(i,m_qPoint);
00011 }
00012 return result;
00013 }
00014
00015 double EqVarT::getCoefSolValue(unsigned index,VecDouble &sol)
00016 {
00017 return sol(m_dofIndices[index]);
00018 }
00019
00020 double EqVarT::getSolGradComponent(Vector<double> &sol,int component)
00021 {
00022 unsigned i;
00023 unsigned n_dofs_per_cell = m_fev->get_fe().dofs_per_cell;
00024 double result=0.0;
00025 for (i=0;i<n_dofs_per_cell;i++)
00026 {
00027 result+=sol(m_dofIndices[i])*m_fev->shape_grad(i,m_qPoint)[component];
00028 }
00029 return result;
00030 }
00031
00032
00033 Tensor<1,DIM> EqVarT::getSolGrad(VecDouble &sol)
00034 {
00035 unsigned i;
00036 unsigned n_dofs_per_cell = m_fev->get_fe().dofs_per_cell;
00037 Tensor<1,DIM> result;
00038 result.clear();
00039 for (i=0;i<n_dofs_per_cell;i++)
00040 {
00041 result+=sol(m_dofIndices[i])*m_fev->shape_grad(i,m_qPoint);
00042 }
00043 return result;
00044 }
00045
00046
00047
00048
00049
00050
00051
00052 double EqVarT::getValueByCellIndex(const VecDouble &sol)
00053 {
00054 return sol(getCell()->index());
00055 }
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067 void EqVarT::setFaceValues(FEFaceValues<DIM> *face_values)
00068 {
00069 m_face_values = face_values;
00070 }
00071
00072 void EqVarT::setFeValue(FEValues<DIM> *fe)
00073 {
00074 m_fev = fe;
00075 }
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086 double EqVarT::localNeumannBoundary(unsigned i)
00087 {
00088 i=0;
00089 assert(0);
00090 return NAN;
00091 }
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102 double EqVarT::localEqVar(unsigned i,unsigned j)
00103 {
00104 printf("EqvarT::localEqVar = This function shoud never be called. The childrens must override this functions\nAbortting...\n");
00105 abort();
00106 return NAN;
00107 }
00108
00109 double EqVarT::localRhs(unsigned i)
00110 {
00111 printf("EqvarT::localRhs = This function shoud never be called. The childrens must override this functions\nAbortting...\n");
00112 abort();
00113 return NAN;
00114
00115 }
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125 unsigned EqVarT::component(unsigned i)
00126 {
00127
00128 assert(validFeValues());
00129 return m_fev->get_fe().system_to_component_index(i).first;
00130 }
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140 double EqVarT::shape_div(unsigned i)
00141 {
00142 assert(validFeValues());
00143 assert(!m_fev->get_fe().is_primitive());
00144 return m_fev->shape_grad_component(i,getQPoint(),0)[0] + m_fev->shape_grad_component(i,getQPoint(),1)[1];
00145 }