00001 00005 class DegFreeFE : public HandleId 00006 00007 { 00008 public: 00009 00010 Handle(FieldsFE) fields; 00011 Handle(GridFE) mesh; 00012 00013 private: 00014 00015 Handle(BasisFuncGrid) test_func; 00016 00017 int ntotdof; 00018 int ntoteqs; 00019 int nelmdof; 00020 int nelmeqs; 00021 int nno_grid; 00022 int ndof_per_node; 00023 00024 VecSimple(NUMT) ebc; 00025 00026 00027 MatSimple(int) loc2glob_arr; 00028 MatSimple(int) u2x; 00029 MatSimple(int) x2u; 00030 00031 00032 bool interpret_ess_bc_as_zero; 00033 bool no_ess_bc; 00034 00035 00036 bool modify_mat_due2essBC; 00037 bool modify_vec_due2essBC; 00038 bool symm_mod_due2essBC; 00039 bool unit_mat_diagonal_due2essBC; 00040 bool keep_dof_due2essBC; 00041 00042 bool special_numbering; 00043 00044 00045 00046 bool test_func_is_ok; 00047 00048 void initSpecialNumbering (); 00049 void initGeneralNumbering (); 00050 00051 public: 00052 00053 DegFreeFE (const GridFE& grid, int ndof_per_node = 1); 00054 DegFreeFE (FieldsFE& collection); 00055 DegFreeFE (FieldFE& f); 00056 DegFreeFE () {} 00057 ~DegFreeFE (); 00058 00059 bool redim (const GridFE& grid, int ndof_per_node = 1); 00060 bool redim (FieldsFE& collection); 00061 bool redim (FieldFE& f); 00062 00063 bool generalNumbering () const { return notbool(special_numbering); } 00064 bool specialNumbering () const { return special_numbering; } 00065 void printNumbering (Os os) const; 00066 00067 bool ok () const; 00068 bool update (); 00069 00070 GridFE& grid (); 00071 const GridFE& grid () const; 00072 00073 int getNoDofInElm (int e) const 00074 { return specialNumbering() ? 00075 mesh->getNoNodesInElm(e)*ndof_per_node : nelmdof; } 00076 int getNoEqsInElm (int e) const 00077 { return specialNumbering() ? 00078 mesh->getNoNodesInElm(e)*ndof_per_node : nelmeqs; } 00079 int getTotalNoDof () const { return ntotdof; } 00080 int getTotalNoEqs () const { return ntoteqs; } 00081 int loc2glob (int e, int element_dof) const; 00082 int loc2globDof (int e, int element_dof) const 00083 { return loc2glob (e, element_dof); } 00084 int loc2globEqs (int e, int element_dof) const 00085 { return test_func_is_ok ? 00086 test_func->loc2glob (e, element_dof) : loc2glob (e, element_dof);} 00087 void loc2glob (VecSimple(int)& l2g, int e) const; 00088 void loc2globDof (VecSimple(int)& l2g, int e) const 00089 { loc2glob (l2g, e); } 00090 void loc2globEqs (VecSimple(int)& l2g, int e) const 00091 { test_func_is_ok ? test_func->loc2glob(l2g,e) : loc2glob(l2g,e); } 00092 int getNoDofPerNode () const { return ndof_per_node; } 00093 int globalDegFree (int field_value_no, int field_no) const 00094 { return fields2dof (field_value_no, field_no); } 00095 00096 void attachTestFuncDescription (const BasisFuncGrid& test_functions); 00097 00098 bool noEssBC () const { return getbool(!ebc.ok() || no_ess_bc); } 00099 bool getEssBC (int iglobdof, NUMT& ebc_value) const; 00100 void getEssBC (VecSimple(bool)& essential_dof) const; 00101 void printEssBC (Os os, int output_level = 1); 00102 00103 void initEssBC (); 00104 void fillEssBC (int globdof, NUMT ebc_value); 00105 00106 00107 void fillEssBC (int field_dof, int field_no, NUMT ebc_value); 00108 00109 void insertEssBC 00110 (VecSimple(NUMT)& u, bool account4multiplicity = false); 00111 00112 00113 00114 void updateMatrixPrm (Matrix(prm_NUMT)& mat_prm); 00115 00116 00117 void fillEssBC2zero (); 00118 void unfillEssBC2zero (); 00119 bool zeroInterpretationOfEssBC () const 00120 { return interpret_ess_bc_as_zero; } 00121 00122 00123 void field2vec (const FieldFE& f, Vec(NUMT)& x); 00124 void vec2field (const Vec(NUMT)& x, FieldFE& f); 00125 void field2vec (const FieldsFE& f, Vec(NUMT)& x); 00126 void vec2field (const Vec(NUMT)& x, FieldsFE& f); 00127 int fields2dof (int field_dof, int field_no) const; 00128 void dof2fields (int global_dof, int& field_dof, int& field_no) const; 00129 00130 int computeHalfBandwidth (); 00131 int getHalfBandwidth (); 00132 00133 00134 00135 Vec(NUMT) b_mod; 00136 VecSimple(int) nelm_contr; 00137 void initAssemble (); 00138 00139 void modifyMatDue2essBC (bool onoff); 00140 bool modifyMatDue2essBC () const { return modify_mat_due2essBC; } 00141 void modifyVecDue2essBC (bool onoff); 00142 bool modifyVecDue2essBC () const { return modify_vec_due2essBC; } 00143 void symmModDue2essBC (bool onoff); 00144 bool symmModDue2essBC () const { return symm_mod_due2essBC; } 00145 void unitMatDiagonalDue2essBC (bool onoff); 00146 bool unitMatDiagonalDue2essBC () const 00147 { return unit_mat_diagonal_due2essBC; } 00148 void keepDofDue2essBC (bool onoff); 00149 bool keepDofDue2essBC () const { return keep_dof_due2essBC; } 00150 00151 COPY_CONSTRUCTOR(DegFreeFE); 00152 00153 ASSIGNMENT_OPERATOR(DegFreeFE); 00154 00155 private: 00156 00157 int halfbw; 00158 int specHalfBandwidth () const; 00159 int genHalfBandwidth () const; 00160 void init (); 00161 }; 00162 00163 class SparseDS; 00164 00165 00166 00167 extern void makeSparsityPattern 00168 ( 00169 SparseDS& ds, 00170 const Ptv(int)& divisions, 00171 int npt_per_div, 00172 int ndof_per_pt 00173 ); 00174 00175 00176 00177 00178 00179 extern void makeSparsityPattern (SparseDS& ds, const DegFreeFE& dof); 00180 00181 00182 00183 extern void makeSparsityPattern 00184 ( SparseDS& ds, 00185 const DegFreeFE& idof, 00186 const DegFreeFE& jdof 00187 ); 00188 00189 00190 00191 00192 00193 extern void makeSparsityPattern (VecSort(int)& offset, int& ndiags, 00194 const DegFreeFE& dof); 00195 00196 00197