quintptr Container::getIdElementByName(const QString &name) const { PElement e = getElementByName(name); if (e) return e->getId(); return 0; }
Element* Document::getElementByName(const std::string& name, Element* ele) { if(ele->getTagName()==name) return ele; else { ElementList chi = ele->getChildElements(); for(unsigned int i=0;i<chi.size();i++) { Element* ele1 = getElementByName(name, chi.at(i)); if(ele1!=NULL) { return ele1; } } } return NULL; }
dolfin::FunctionSpace * FVFunctionSpaceWizard::getFunctionSpace( dolfin::Mesh* mesh) { ufc::finite_element* el; ufc::dofmap* dofmap; optionExists=false; std::cout << "Vals in wizard: \"" <<fieldType << "\" \"" << FEType<< "\" \"" << approxDeg << "\"" << std::endl; int FT = fieldType, FET=FEType, AD = approxDeg; for (int i=0; i < cr->map.size(); i++ ){ vector<string> m = cr->map[i]; if (cr->types[FT-1] == m[0] && cr->elems[FET-1] == m[1] && cr->approx[AD-1] == m[2] ){ std::cout << "Vals mpped to " << m[3] << std::endl; el =getElementByName(m[3]); dofmap = getDofByName(m[3]); optionExists=true; break; } } std::cout << "got element & dofmap ? " << optionExists << std::endl; if (optionExists){ dolfin::FiniteElement* elem = new dolfin::FiniteElement(boost::shared_ptr<ufc::finite_element>(el) ); std::cout << "elem created" << std::endl; dolfin::DofMap* dof = new dolfin::DofMap( boost::shared_ptr<ufc::dofmap>(dofmap) , *mesh ); std::cout << "dofmap created" << std::endl; dolfin::FunctionSpace* V = new dolfin::FunctionSpace( boost::shared_ptr<dolfin::Mesh>(mesh), boost::shared_ptr<dolfin::FiniteElement>(elem), boost::shared_ptr<dolfin::DofMap>(dof) ); std::cout << "FunctionSpace created" << std::endl; return V; } else { std::cout << "There is no configuration for options: \""<< cr->types[FT-1] << "\" \""<< cr->elems[FET-1] << "\" \"" << cr->approx[AD-1] <<"\""<< std::endl; } return NULL; }
Element* Document::getElementByName(const std::string& name) { return getElementByName(name, &(this->root)); }