void ConvectionDiffusionFE<TDomain>:: prep_err_est_elem_loop(const ReferenceObjectID roid, const int si) { // get the error estimator data object and check that it is of the right type // we check this at this point in order to be able to dispense with this check later on // (i.e. in prep_err_est_elem and compute_err_est_A_elem()) if (this->m_spErrEstData.get() == NULL) { UG_THROW("No ErrEstData object has been given to this ElemDisc!"); } err_est_type* err_est_data = dynamic_cast<err_est_type*>(this->m_spErrEstData.get()); if (!err_est_data) { UG_THROW("Dynamic cast to SideAndElemErrEstData failed." << std::endl << "Make sure you handed the correct type of ErrEstData to this discretization."); } // set local positions static const int refDim = TElem::dim; // get local IPs size_t numSideIPs, numElemIPs; const MathVector<refDim>* sideIPs; const MathVector<refDim>* elemIPs; try { numSideIPs = err_est_data->num_all_side_ips(roid); numElemIPs = err_est_data->num_elem_ips(roid); sideIPs = err_est_data->template side_local_ips<refDim>(roid); elemIPs = err_est_data->template elem_local_ips<refDim>(roid); if (!sideIPs || !elemIPs) return; // are NULL if TElem is not of the same dim as TDomain } UG_CATCH_THROW("Integration points for error estimator cannot be set."); // set local IPs in imports m_imDiffusion.template set_local_ips<refDim>(sideIPs, numSideIPs, false); m_imVelocity.template set_local_ips<refDim>(sideIPs, numSideIPs, false); m_imFlux.template set_local_ips<refDim>(sideIPs, numSideIPs, false); m_imSource.template set_local_ips<refDim>(elemIPs, numElemIPs, false); m_imVectorSource.template set_local_ips<refDim>(sideIPs, numSideIPs, false); m_imReactionRate.template set_local_ips<refDim>(elemIPs, numElemIPs, false); m_imReaction.template set_local_ips<refDim>(elemIPs, numElemIPs, false); m_imMassScale.template set_local_ips<refDim>(elemIPs, numElemIPs, false); m_imMass.template set_local_ips<refDim>(elemIPs, numElemIPs, false); // store values of shape functions in local IPs LagrangeP1<typename reference_element_traits<TElem>::reference_element_type> trialSpace = Provider<LagrangeP1<typename reference_element_traits<TElem>::reference_element_type> >::get(); m_shapeValues.resize(numElemIPs, numSideIPs, trialSpace.num_sh()); for (size_t ip = 0; ip < numElemIPs; ip++) trialSpace.shapes(m_shapeValues.shapesAtElemIP(ip), elemIPs[ip]); for (size_t ip = 0; ip < numSideIPs; ip++) trialSpace.shapes(m_shapeValues.shapesAtSideIP(ip), sideIPs[ip]); }
void FV1InnerBoundaryElemDisc<TDomain>:: prep_err_est_elem_loop(const ReferenceObjectID roid, const int si) { // get the error estimator data object and check that it is of the right type // we check this at this point in order to be able to dispense with this check later on // (i.e. in prep_err_est_elem and compute_err_est_A_elem()) if (this->m_spErrEstData.get() == NULL) { UG_THROW("No ErrEstData object has been given to this ElemDisc!"); } err_est_type* err_est_data = dynamic_cast<err_est_type*>(this->m_spErrEstData.get()); if (!err_est_data) { UG_THROW("Dynamic cast to MultipleSideAndElemErrEstData failed." << std::endl << "Make sure you handed the correct type of ErrEstData to this discretization."); } if (!err_est_data->equal_side_order()) { UG_THROW("The underlying error estimator data objects of this discretization's " "error estimator do not all have the same integration orders. This case " "is not supported by the implementation. If you need it, implement!"); } if (err_est_data->num() < 1) { UG_THROW("No underlying error estimator data objects present. No IPs can be determined."); } // set local positions if (!TFVGeom::usesHangingNodes) { static const int refDim = TElem::dim; // get local IPs size_t numSideIPs; const MathVector<refDim>* sideIPs; try { numSideIPs = err_est_data->get(0)->num_side_ips(roid); sideIPs = err_est_data->get(0)->template side_local_ips<refDim>(roid); } UG_CATCH_THROW("Integration points for error estimator cannot be set."); // store values of shape functions in local IPs LagrangeP1<typename reference_element_traits<TElem>::reference_element_type> trialSpace = Provider<LagrangeP1<typename reference_element_traits<TElem>::reference_element_type> >::get(); m_shapeValues.resize(numSideIPs, trialSpace.num_sh()); for (size_t ip = 0; ip < numSideIPs; ip++) trialSpace.shapes(m_shapeValues.shapesAtSideIP(ip), sideIPs[ip]); } }
/** * * @param _filename the 'relative' script name. \sa GetAbsoluteUGScriptFilename * @param bDistributedLoad true if loading should be done in parallel * @param bThrowOnError true if errors should be thrown as UGError, else as return false * @return true if script could be found and read, false (or UGError) if not */ bool LoadUGScript(const char *_filename, bool bDistributedLoad, bool bThrowOnError) { PROFILE_FUNC(); string filename=_filename; string absoluteFilename=filename; //UG_LOG("LoadUGScript("<<filename<<", "<<(bDistributedLoad?"true":"false") << "\n"); bool bSuccess = true; std::vector<char> file; #ifdef UG_PARALLEL if(pcl::NumProcs() == 1) bDistributedLoad = false; if(pcl::ProcRank() == 0 || bDistributedLoad==false) bSuccess = GetAbsoluteUGScriptFilename(filename, absoluteFilename); bSuccess = pcl::AllProcsTrue(bSuccess); #else bSuccess = GetAbsoluteUGScriptFilename(filename, absoluteFilename); #endif if(bSuccess == false) { if(bThrowOnError) { UG_THROW("Couldn't find script " << _filename << endl << "Search paths: " << GetAbsoluteUGScriptFilenamePaths() << endl); } return false; } #ifdef UG_PARALLEL if(pcl::ParallelReadFile(absoluteFilename, file, true, bDistributedLoad) == false) #else if(ReadFile(absoluteFilename.c_str(), file, true) == false) #endif { if(bThrowOnError) { UG_THROW("Couldn't read script " << absoluteFilename << endl); } return false; } // the current script working path is the path of the script std::string curPath = PathFromFilename(absoluteFilename); PathProvider::push_current_path(curPath); { // parse and execute the script. bSuccess = ParseAndExecuteBuffer(&file[0], (string("@")+absoluteFilename).c_str()); } PathProvider::pop_current_path(); return bSuccess; }
LagrangeP1<ReferencePyramid>::shape_type LagrangeP1<ReferencePyramid>:: shape(size_t i, const MathVector<dim>& x) const { switch(i) { case 0 : if (x[0] > x[1]) return((1.0-x[0])*(1.0-x[1]) + x[2]*(x[1]-1.0)); else return((1.0-x[0])*(1.0-x[1]) + x[2]*(x[0]-1.0)); case 1 : if (x[0] > x[1]) return(x[0]*(1.0-x[1]) - x[2]*x[1]); else return(x[0]*(1.0-x[1]) - x[2]*x[0]); case 2 : if (x[0] > x[1]) return(x[0]*x[1] + x[2]*x[1]); else return(x[0]*x[1] + x[2]*x[0]); case 3 : if (x[0] > x[1]) return((1.0-x[0])*x[1] - x[2]*x[1]); else return((1.0-x[0])*x[1] - x[2]*x[0]); case 4 : return(x[2]); default: UG_THROW("LagrangeP1: Invalid shape fct index: "<<i); } };
void AdaptionSurfaceGridFunction<TDomain>::detach_entries() { if(m_spGrid.invalid()) UG_THROW("Grid missing") if(m_spGrid->has_attachment<TElem>(m_aValue)) m_spGrid->detach_from<TElem>(m_aValue); }
void ValueDataExport<dim>::check_setup() const { if((int)this->function_group().size() != 1) UG_THROW("ValueDataExport: Expected to work on "<<1<<" function, " "but only set "<<this->function_group().size()<<" ("<< this->function_group().names()<<")."); }
void ConvectionDiffusionFE<TDomain>:: prep_elem_loop(const ReferenceObjectID roid, const int si) { if( m_imSourceExpl.data_given() || m_imReactionExpl.data_given() || m_imReactionRateExpl.data_given()) UG_THROW("ConvectionDiffusionFE: Explicit terms not implemented."); // request geometry TFEGeom& geo = GeomProvider<TFEGeom>::get(m_lfeID, m_quadOrder); // prepare geometry for type and order try{ geo.update_local(roid, m_lfeID, m_quadOrder); }UG_CATCH_THROW("ConvectionDiffusion::prep_elem_loop:" " Cannot update Finite Element Geometry."); // set local positions static const int refDim = TElem::dim; m_imDiffusion.template set_local_ips<refDim>(geo.local_ips(), geo.num_ip(), false); m_imVelocity.template set_local_ips<refDim>(geo.local_ips(), geo.num_ip(), false); m_imFlux.template set_local_ips<refDim>(geo.local_ips(), geo.num_ip(), false); m_imSource.template set_local_ips<refDim>(geo.local_ips(), geo.num_ip(), false); m_imVectorSource.template set_local_ips<refDim>(geo.local_ips(), geo.num_ip(), false); m_imReactionRate.template set_local_ips<refDim>(geo.local_ips(), geo.num_ip(), false); m_imReaction.template set_local_ips<refDim>(geo.local_ips(), geo.num_ip(), false); m_imMassScale.template set_local_ips<refDim>(geo.local_ips(), geo.num_ip(), false); m_imMass.template set_local_ips<refDim>(geo.local_ips(), geo.num_ip(), false); }
number FracturedMediaRefiner<TGrid, TAPosition>:: aspect_ratio(Face* f) { if(!m_aaPos.valid()) UG_THROW("A position attachment has to be specified before this method is called."); EdgeDescriptor ed; f->edge_desc(0, ed); number eMin = EdgeLength(&ed, m_aaPos); number eMax = eMin; for(size_t i = 1; i < f->num_edges(); ++i){ f->edge_desc(i, ed); number len = EdgeLength(&ed, m_aaPos); if(len < eMin) eMin = len; else if(len > eMax) eMax = len; } if(eMax <= 0) return 0; return eMin / eMax; }
void ConvectionDiffusionFE<TDomain>:: compute_err_est_M_elem(const LocalVector& u, GridObject* elem, const MathVector<dim> vCornerCoords[], const number& scale) { // note: mass parts only enter volume term err_est_type* err_est_data = dynamic_cast<err_est_type*>(this->m_spErrEstData.get()); if (err_est_data->surface_view().get() == NULL) {UG_THROW("Error estimator has NULL surface view.");} MultiGrid* pErrEstGrid = (MultiGrid*) (err_est_data->surface_view()->subset_handler()->multi_grid()); typename MultiGrid::traits<typename SideAndElemErrEstData<TDomain>::elem_type>::secure_container elem_list; pErrEstGrid->associated_elements_sorted(elem_list, (TElem*) elem); if (elem_list.size() != 1) UG_THROW ("Mismatch of numbers of sides in 'ConvectionDiffusionFE::compute_err_est_elem'"); // request geometry static const TFEGeom& geo = GeomProvider<TFEGeom>::get(); // loop integration points try { for (size_t ip = 0; ip < err_est_data->num_elem_ips(elem->reference_object_id()); ip++) { number total = 0.0; // mass scale // if (m_imMassScale.data_given()) { number val = 0.0; for (size_t sh = 0; sh < geo.num_sh(); sh++) val += u(_C_,sh) * m_shapeValues.shapeAtElemIP(sh,ip); total += m_imMassScale[ip] * val; } // mass // if (m_imMass.data_given()) { total += m_imMass[ip]; } (*err_est_data)(elem_list[0],ip) += scale * total; } } UG_CATCH_THROW("Values for the error estimator could not be assembled at every IP." << std::endl << "Maybe wrong type of ErrEstData object? This implementation needs: SideAndElemErrEstData."); }
void ConvectionDiffusionFVCR<TDomain>:: prepare_setting(const std::vector<LFEID>& vLfeID, bool bNonRegularGrid) { // check number if(vLfeID.size() != 1) UG_THROW("ConvectionDiffusion: Wrong number of functions given. " "Need exactly "<<1); if(vLfeID[0].order() != 1 || vLfeID[0].type() != LFEID::CROUZEIX_RAVIART) UG_THROW("ConvectionDiffusion FVCR Scheme only implemented for 1st order."); // remember m_bNonRegularGrid = bNonRegularGrid; // update assemble functions register_all_funcs(m_bNonRegularGrid); }
void ConvectionDiffusionFVCR<TDomain>:: prep_elem_loop(const ReferenceObjectID roid, const int si) { if(m_imFlux.data_given()) UG_THROW("ConvectionDiffusionFVCR: Flux import not implemented."); if( m_imSourceExpl.data_given() || m_imReactionExpl.data_given() || m_imReactionRateExpl.data_given()) UG_THROW("ConvectionDiffusionFVCR: Explicit terms not implemented."); // set local positions if(!TFVGeom::usesHangingNodes) { static const int refDim = TElem::dim; static TFVGeom& geo = GeomProvider<TFVGeom>::get(); geo.update_local_data(); m_imDiffusion.template set_local_ips<refDim>(geo.scvf_local_ips(), geo.num_scvf_ips(), false); m_imVelocity.template set_local_ips<refDim>(geo.scvf_local_ips(), geo.num_scvf_ips(), false); m_imSource.template set_local_ips<refDim>(geo.scv_local_ips(), geo.num_scv_ips(), false); m_imReactionRate.template set_local_ips<refDim>(geo.scv_local_ips(), geo.num_scv_ips(), false); m_imReaction.template set_local_ips<refDim>(geo.scv_local_ips(), geo.num_scv_ips(), false); m_imMassScale.template set_local_ips<refDim>(geo.scv_local_ips(), geo.num_scv_ips(), false); m_imMass.template set_local_ips<refDim>(geo.scv_local_ips(), geo.num_scv_ips(), false); } // check, that upwind has been set // if(m_spConvShape.invalid()) // UG_THROW("ConvectionDiffusion::prep_elem_loop:" // " Upwind has not been set."); // init upwind for element type // if(!m_spConvShape->template set_geometry_type<TFVGeom>()) // UG_THROW("ConvectionDiffusion::prep_elem_loop:" // " Cannot init upwind for element type."); }
void ConvectionDiffusionFE<TDomain>:: prepare_setting(const std::vector<LFEID>& vLfeID, bool bNonRegularGrid) { // check number of fcts if(vLfeID.size() != 1) UG_THROW("ConvectionDiffusion: Wrong number of functions given. " "Need exactly "<<1); // check that not ADAPTIVE if(vLfeID[0].order() < 1) UG_THROW("ConvectionDiffusion: Adaptive order not implemented."); // set order m_lfeID = vLfeID[0]; if(!m_bQuadOrderUserDef) m_quadOrder = 2*m_lfeID.order()+1; register_all_funcs(m_lfeID, m_quadOrder); }
void NeumannBoundaryFE<TDomain>:: prepare_setting(const std::vector<LFEID>& vLfeID, bool bNonRegularGrid) { // check number if(vLfeID.size() != 1) UG_THROW("NeumannBoundaryFE: needs exactly 1 function."); // check that not ADAPTIVE if(vLfeID[0].order() < 1) UG_THROW("NeumannBoundaryFE: Adaptive order not implemented."); // set order m_lfeID = vLfeID[0]; m_order = vLfeID[0].order(); m_quadOrder = 2*m_order+1; register_all_funcs(m_order); }
void CheckAssociatedVolumesOfEdges(Grid& g) { // VOLOPT_STORE_ASSOCIATED_EDGES has to be enabled, so that this method makes sense... if(!g.option_is_enabled(EDGEOPT_STORE_ASSOCIATED_VOLUMES)){ UG_LOG("WARNING: Autoenabling EDGEOPT_STORE_ASSOCIATED_VOLUMES in CheckAssociatedVolumesOfEdges.\n"); g.enable_options(EDGEOPT_STORE_ASSOCIATED_VOLUMES); } g.begin_marking(); // iterate over all volumes for(EdgeIterator iter = g.edges_begin(); iter != g.edges_end(); ++iter){ Edge* e = *iter; g.clear_marks(); // get all associated volumes std::vector<Volume*> vols; CollectAssociated(vols, g, e); // iterate over them and mark them. Make sure none is marked twice. for(size_t i = 0; i < vols.size(); ++i){ if(g.is_marked(vols[i])){ UG_THROW("Volume is contained in associated volumes of edge twice!"); } g.mark(vols[i]); } // now iterate over associated volumes of all corner vertices of e // and make sure that each is marked Edge::ConstVertexArray vrts = e->vertices(); for(size_t i_vrt = 0; i_vrt < e->num_vertices(); ++i_vrt){ CollectAssociated(vols, g, vrts[i_vrt]); for(size_t i_vol = 0; i_vol < vols.size(); ++i_vol){ if(VolumeContains(vols[i_vol], e)){ if(!g.is_marked(vols[i_vol])){ UG_THROW("Volume is contained in edge but not in edge's associated-volume-container!"); } } } } } g.end_marking(); }
const typename GridLayoutMap::Types<TType>::Layout& GridLayoutMap:: get_layout(const Key& key) const { const typename Types<TType>::Map& m = get_layout_map<TType>(); typename Types<TType>::Map::const_iterator iter = m.find(key); if(iter == m.end()){ UG_THROW("The specified layout can not be found in the GridLayoutMap."); } return iter->second; }
void SchurPrecond<TAlgebra>:: schur_solve_skeleton(vector_type &u_skeleton, const vector_type &f_skeleton) { SCHUR_PROFILE_BEGIN(SchurSolverStep_SchurSolve); UG_DLOG(SchurDebug, 3, "\n% 'SchurPrecond::step() - skeleton solve':"); if(!f_skeleton.has_storage_type(PST_ADDITIVE)) { UG_THROW("ERROR: In 'SchurPrecond::step':Inadequate storage format of 'f_skeleton'.\n"); } if (!m_spSkeletonSolver->apply(u_skeleton, f_skeleton)) { UG_LOG("SchurPrecond: Failed to solve skeleton system!\n"); } if(!u_skeleton.has_storage_type(PST_CONSISTENT)) { UG_THROW("ERROR: In 'SchurPrecond::step':Inadequate storage format of 'u_skeleton'.\n"); } //UG_LOG("\nu_skeleton="); UG_LOG_Vector<vector_type>(u_skeleton); }
void OrderDownwind(ApproximationSpace<TDomain>& approxSpace, const std::vector<number>& vVel, number threshold) { static const int dim = TDomain::dim; if(vVel.size() != dim){ UG_THROW("OrderDownstream: Velocity field of dimension " << dim << " expected, got "<< vVel.size()); } OrderDownwind<TDomain>(approxSpace, SmartPtr<ConstUserVector<dim> >(new ConstUserVector<dim>(vVel)), threshold ); }
void LagrangeP1<ReferenceEdge>:: grad(grad_type& value, size_t i, const MathVector<dim>& x) const { switch(i) { case 0: value[0] = -1.0; break; case 1: value[0] = 1.0; break; default: UG_THROW("LagrangeP1: Invalid shape fct index: "<<i); } }
LagrangeP1<ReferenceEdge>::shape_type LagrangeP1<ReferenceEdge>:: shape(size_t i, const MathVector<dim>& x) const { switch(i) { case 0: return (1.-x[0]); case 1: return x[0]; default: UG_THROW("LagrangeP1: Invalid shape fct index: "<<i); } };
bool LagrangeP1<ReferenceEdge>:: position(size_t i, MathVector<dim>& value) const { switch(i) { case 0: value[0] = 0.0; return true; case 1: value[0] = 1.0; return true; default: UG_THROW("LagrangeP1: Invalid shape fct index: "<<i); } return true; }
void AdaptiveRegularRefiner_MultiGrid:: remove_closure_elements() { // remove all closure elements from the current grid if(!multi_grid()){ UG_THROW("AdaptiveRegularRefiner_MultiGrid has to be associated with a grid!"); } EraseSelectedObjects(m_closureElems); }
void FV1InnerBoundaryElemDisc<TDomain>:: prepare_setting(const std::vector<LFEID>& vLfeID, bool bNonRegularGrid) { // check that Lagrange 1st order for(size_t i = 0; i < vLfeID.size(); ++i) if(vLfeID[i].type() != LFEID::LAGRANGE || vLfeID[i].order() != 1) UG_THROW("FV1InnerBoundary: 1st order lagrange expected."); // update assemble functions m_bNonRegularGrid = bNonRegularGrid; register_all_fv1_funcs(); }
void SetBoundaryRefinementRule(std::string bndRefRule) { bndRefRule = ToLower(bndRefRule); if(bndRefRule.compare("linear") == 0) SetBoundaryRefinementRule(LINEAR); else if(bndRefRule.compare("subdiv_loop") == 0) SetBoundaryRefinementRule(SUBDIV_LOOP); else if(bndRefRule.compare("subdiv_vol") == 0) SetBoundaryRefinementRule(SUBDIV_VOL); else UG_THROW("ERROR in SetBoundaryRefinementRule: Unknown boundary refinement rule! Known rules are: 'linear', 'subdiv_loop' or 'subdiv_vol'."); }
std::pair<GridBaseObjectId, int> CustomQuadrilateral<ConcreteQuadrilateralType, BaseClass>:: get_opposing_object(Vertex* vrt) const { for(int i = 0; i < 4; ++i){ if(vrt == m_vertices[i]){ return make_pair(VERTEX, (i + 2) % 4); } } UG_THROW("The given vertex is not contained in the given face."); }
std::pair<GridBaseObjectId, int> CustomTriangle<ConcreteTriangleType, BaseClass>:: get_opposing_object(Vertex* vrt) const { for(int i = 0; i < 3; ++i){ if(vrt == m_vertices[i]){ return make_pair(EDGE, (i + 1) % 3); } } UG_THROW("The given vertex is not contained in the given face."); }
LagrangeP1<ReferenceTetrahedron>::shape_type LagrangeP1<ReferenceTetrahedron>:: shape(size_t i, const MathVector<dim>& x) const { switch(i) { case 0: return(1.0-x[0]-x[1]-x[2]); case 1: return(x[0]); case 2: return(x[1]); case 3: return(x[2]); default: UG_THROW("LagrangeP1: Invalid shape fct index: "<<i); } };
LagrangeP1<ReferenceQuadrilateral>::shape_type LagrangeP1<ReferenceQuadrilateral>:: shape(size_t i, const MathVector<dim>& x) const { switch(i) { case 0: return((1.0-x[0])*(1.0-x[1])); case 1: return(x[0]*(1.0-x[1])); case 2: return(x[0]*x[1]); case 3: return((1.0-x[0])*x[1]); default: UG_THROW("LagrangeP1: Invalid shape fct index: "<<i); } };
int UGIsBaseClass(lua_State *L) { const char* derivClass = lua_tostring(L, -1); const char* baseClass = lua_tostring(L, -2); if(!derivClass || !baseClass) UG_THROW("In UGIsBaseClass: invalid class names passed as arguments."); luaL_getmetatable(L, derivClass); if(!lua_isnil(L, -1)) { lua_pushstring(L, "class_name_node"); lua_rawget(L, -2); const ug::bridge::ClassNameNode* classNameNode = (const ug::bridge::ClassNameNode*) lua_touserdata(L, -1); lua_pop(L, 2); if(classNameNode) { if(!classNameNode->empty()) { if(ClassNameTreeContains(*classNameNode, baseClass)) { lua_pushboolean(L, true); return 1; } } lua_pushboolean(L, false); return 1; } else UG_THROW("In UGIsBaseClasse: Something wrong with ClassNameNode."); } else{ UG_THROW("In UGIsBaseClass: Cannot find metatable for: "<< derivClass); } return 0; }
UG_API inline typename TAAPosVRT::ValueType CalculateGridObjectCenter(const GridObject* o, TAAPosVRT& aaPosVRT) { switch(o->base_object_id()){ case VERTEX: return CalculateCenter(static_cast<const Vertex*>(o), aaPosVRT); case EDGE: return CalculateCenter(static_cast<const Edge*>(o), aaPosVRT); case FACE: return CalculateCenter(static_cast<const Face*>(o), aaPosVRT); case VOLUME: return CalculateCenter(static_cast<const Volume*>(o), aaPosVRT); default: UG_THROW("Unknown geometric-object type."); } }
void LagrangeP1<ReferenceHexahedron>:: grad(grad_type& value, size_t i, const MathVector<dim>& x) const { switch(i) { case 0: value[0] = -(1.0-x[1])*(1.0-x[2]); value[1] = -(1.0-x[0])*(1.0-x[2]); value[2] = -(1.0-x[0])*(1.0-x[1]); break; case 1: value[0] = (1.0-x[1])*(1.0-x[2]); value[1] = -(x[0])*(1.0-x[2]); value[2] = -(x[0])*(1.0-x[1]); break; case 2: value[0] = (x[1])*(1.0-x[2]); value[1] = (x[0])*(1.0-x[2]); value[2] = -x[0]*x[1]; break; case 3: value[0] = -(x[1])*(1.0-x[2]); value[1] = (1.0-x[0])*(1.0-x[2]); value[2] = -(1.0-x[0])*(x[1]); break; case 4: value[0] = -(1.0-x[1])*(x[2]); value[1] = -(1.0-x[0])*(x[2]); value[2] = (1.0-x[0])*(1.0-x[1]); break; case 5: value[0] = (1.0-x[1])*x[2]; value[1] = -(x[0])*x[2]; value[2] = (x[0])*(1.0-x[1]); break; case 6: value[0] = (x[1])*x[2]; value[1] = (x[0])*x[2]; value[2] = x[0]*x[1]; break; case 7: value[0] = -(x[1])*x[2]; value[1] = (1.0-x[0])*x[2]; value[2] = (1.0-x[0])*x[1]; break; default: UG_THROW("LagrangeP1: Invalid shape fct index: "<<i); } }