void App::init_element_cache() { if(element_cache!=NULL) delete element_cache; element_cache=NULL; element_cache=new std::vector<ElementCache<double,DIM> > (fem_space->n_element()); //element_cache->resize(fem_space->n_element()); fe_space_t::ElementIterator the_ele = fem_space->beginElement(), end_ele = fem_space->endElement(); for (;the_ele != end_ele;++ the_ele) { GET_ELEMENT_CACHE(*the_ele); GeometryBM & geo=the_ele->geometry(); u_int acc=3; uint n_vtx=geo.n_vertex(); if(n_vtx==3) acc=5; else acc=3; double tmp_vol = the_ele->templateElement().volume(); const QuadratureInfo<DIM>& qi = the_ele->findQuadratureInfo(acc); n_q_pnt = qi.n_quadraturePoint(); std::vector<double> jacobian = the_ele->local_to_global_jacobian(qi.quadraturePoint()); q_pnt = the_ele->local_to_global(qi.quadraturePoint()); bas_val = the_ele->basis_function_value(q_pnt); bas_grad = the_ele->basis_function_gradient(q_pnt); ele_dof = the_ele->dof(); vol =0; Jxw.resize(n_q_pnt); for (int l = 0;l < n_q_pnt;l ++) { Jxw[l] = tmp_vol*jacobian[l]*qi.weight(l); vol += Jxw[l]; } } }
void SCL::init_element_cache() { element_cache.resize(fem_space->n_element()); fe_space_t::ElementIterator the_ele = fem_space->beginElement(), end_ele = fem_space->endElement(); for (;the_ele != end_ele;++ the_ele) { GET_ELEMENT_CACHE(*the_ele); double tmp_vol = the_ele->templateElement().volume(); const QuadratureInfo<DIM>& qi = the_ele->findQuadratureInfo(1); n_q_pnt = qi.n_quadraturePoint(); std::vector<double> jacobian = the_ele->local_to_global_jacobian(qi.quadraturePoint()); q_pnt = the_ele->local_to_global(qi.quadraturePoint()); bas_val = the_ele->basis_function_value(q_pnt); vol = 0; Jxw.resize(n_q_pnt); for (int l = 0;l < n_q_pnt;l ++) { Jxw[l] = tmp_vol*jacobian[l]*qi.weight(l); vol += Jxw[l]; } } }