void BoundaryLFIntegrator::AssembleRHSElementVect( const FiniteElement &el, ElementTransformation &Tr, Vector &elvect) { int dof = el.GetDof(); shape.SetSize(dof); // vector of size dof elvect.SetSize(dof); elvect = 0.0; const IntegrationRule *ir = IntRule; if (ir == NULL) { int intorder = oa * el.GetOrder() + ob; // <---------- ir = &IntRules.Get(el.GetGeomType(), intorder); } for (int i = 0; i < ir->GetNPoints(); i++) { const IntegrationPoint &ip = ir->IntPoint(i); Tr.SetIntPoint (&ip); double val = Tr.Weight() * Q.Eval(Tr, ip); el.CalcShape(ip, shape); add(elvect, ip.weight * val, shape, elvect); } }
void BoundaryNormalLFIntegrator::AssembleRHSElementVect( const FiniteElement &el, ElementTransformation &Tr, Vector &elvect) { int dim = el.GetDim()+1; int dof = el.GetDof(); Vector nor(dim), Qvec; shape.SetSize(dof); elvect.SetSize(dof); elvect = 0.0; const IntegrationRule *ir = IntRule; if (ir == NULL) { int intorder = oa * el.GetOrder() + ob; // <---------- ir = &IntRules.Get(el.GetGeomType(), intorder); } for (int i = 0; i < ir->GetNPoints(); i++) { const IntegrationPoint &ip = ir->IntPoint(i); Tr.SetIntPoint(&ip); CalcOrtho(Tr.Jacobian(), nor); Q.Eval(Qvec, Tr, ip); el.CalcShape(ip, shape); elvect.Add(ip.weight*(Qvec*nor), shape); } }
void VectorFEBoundaryTangentLFIntegrator::AssembleRHSElementVect( const FiniteElement &el, ElementTransformation &Tr, Vector &elvect) { int dof = el.GetDof(); DenseMatrix vshape(dof, 2); Vector f_loc(3); Vector f_hat(2); elvect.SetSize(dof); elvect = 0.0; const IntegrationRule *ir = IntRule; if (ir == NULL) { int intorder = 2*el.GetOrder(); // <---------- ir = &IntRules.Get(el.GetGeomType(), intorder); } for (int i = 0; i < ir->GetNPoints(); i++) { const IntegrationPoint &ip = ir->IntPoint(i); Tr.SetIntPoint(&ip); f.Eval(f_loc, Tr, ip); Tr.Jacobian().MultTranspose(f_loc, f_hat); el.CalcVShape(ip, vshape); Swap<double>(f_hat(0), f_hat(1)); f_hat(0) = -f_hat(0); f_hat *= ip.weight; vshape.AddMult(f_hat, elvect); } }
void VectorBoundaryFluxLFIntegrator::AssembleRHSElementVect( const FiniteElement &el, ElementTransformation &Tr, Vector &elvect) { int dim = el.GetDim()+1; int dof = el.GetDof(); shape.SetSize (dof); nor.SetSize (dim); elvect.SetSize (dim*dof); const IntegrationRule *ir = IntRule; if (ir == NULL) ir = &IntRules.Get(el.GetGeomType(), el.GetOrder() + 1); elvect = 0.0; for (int i = 0; i < ir->GetNPoints(); i++) { const IntegrationPoint &ip = ir->IntPoint(i); Tr.SetIntPoint (&ip); CalcOrtho(Tr.Jacobian(), nor); el.CalcShape (ip, shape); nor *= Sign * ip.weight * F -> Eval (Tr, ip); for (int j = 0; j < dof; j++) for (int k = 0; k < dim; k++) elvect(dof*k+j) += nor(k) * shape(j); } }
void VectorFEDomainLFIntegrator::AssembleRHSElementVect( const FiniteElement &el, ElementTransformation &Tr, Vector &elvect) { int dof = el.GetDof(); int dim = el.GetDim(); vshape.SetSize(dof,dim); vec.SetSize(dim); elvect.SetSize(dof); elvect = 0.0; const IntegrationRule *ir = IntRule; if (ir == NULL) { // int intorder = 2*el.GetOrder() - 1; // ok for O(h^{k+1}) conv. in L2 int intorder = 2*el.GetOrder(); ir = &IntRules.Get(el.GetGeomType(), intorder); } for (int i = 0; i < ir->GetNPoints(); i++) { const IntegrationPoint &ip = ir->IntPoint(i); Tr.SetIntPoint (&ip); el.CalcVShape(Tr, vshape); QF.Eval (vec, Tr, ip); vec *= ip.weight * Tr.Weight(); vshape.AddMult (vec, elvect); } }
void VectorBoundaryLFIntegrator::AssembleRHSElementVect( const FiniteElement &el, ElementTransformation &Tr, Vector &elvect) { int vdim = Q.GetVDim(); int dof = el.GetDof(); shape.SetSize(dof); vec.SetSize(vdim); elvect.SetSize(dof * vdim); elvect = 0.0; const IntegrationRule *ir = IntRule; if (ir == NULL) { int intorder = el.GetOrder() + 1; ir = &IntRules.Get(el.GetGeomType(), intorder); } for (int i = 0; i < ir->GetNPoints(); i++) { const IntegrationPoint &ip = ir->IntPoint(i); Q.Eval(vec, Tr, ip); Tr.SetIntPoint (&ip); vec *= Tr.Weight() * ip.weight; el.CalcShape(ip, shape); for (int k = 0; k < vdim; k++) for (int s = 0; s < dof; s++) elvect(dof*k+s) += vec(k) * shape(s); } }
void BoundaryFlowIntegrator::AssembleRHSElementVect( const FiniteElement &el, FaceElementTransformations &Tr, Vector &elvect) { int dim, ndof, order; double un, w, vu_data[3], nor_data[3]; dim = el.GetDim(); ndof = el.GetDof(); Vector vu(vu_data, dim), nor(nor_data, dim); const IntegrationRule *ir = IntRule; if (ir == NULL) { // Assuming order(u)==order(mesh) order = Tr.Elem1->OrderW() + 2*el.GetOrder(); if (el.Space() == FunctionSpace::Pk) order++; ir = &IntRules.Get(Tr.FaceGeom, order); } shape.SetSize(ndof); elvect.SetSize(ndof); elvect = 0.0; for (int p = 0; p < ir->GetNPoints(); p++) { const IntegrationPoint &ip = ir->IntPoint(p); IntegrationPoint eip; Tr.Loc1.Transform(ip, eip); el.CalcShape(eip, shape); Tr.Face->SetIntPoint(&ip); u->Eval(vu, *Tr.Elem1, eip); if (dim == 1) nor(0) = 2*eip.x - 1.0; else CalcOrtho(Tr.Face->Jacobian(), nor); un = vu * nor; w = 0.5*alpha*un - beta*fabs(un); w *= ip.weight*f->Eval(*Tr.Elem1, eip); elvect.Add(w, shape); } }
void BoundaryTangentialLFIntegrator::AssembleRHSElementVect( const FiniteElement &el, ElementTransformation &Tr, Vector &elvect) { int dim = el.GetDim()+1; int dof = el.GetDof(); Vector tangent(dim), Qvec; shape.SetSize(dof); elvect.SetSize(dof); elvect = 0.0; if (dim != 2) mfem_error("These methods make sense only in 2D problems."); const IntegrationRule *ir = IntRule; if (ir == NULL) { int intorder = oa * el.GetOrder() + ob; // <---------- ir = &IntRules.Get(el.GetGeomType(), intorder); } for (int i = 0; i < ir->GetNPoints(); i++) { const IntegrationPoint &ip = ir->IntPoint(i); Tr.SetIntPoint(&ip); const DenseMatrix &Jac = Tr.Jacobian(); tangent(0) = Jac(0,0); tangent(1) = Jac(1,0); Q.Eval(Qvec, Tr, ip); el.CalcShape(ip, shape); add(elvect, ip.weight*(Qvec*tangent), shape, elvect); } }
void DGDirichletLFIntegrator::AssembleRHSElementVect( const FiniteElement &el, FaceElementTransformations &Tr, Vector &elvect) { int dim, ndof; bool kappa_is_nonzero = (kappa != 0.); double w; dim = el.GetDim(); ndof = el.GetDof(); nor.SetSize(dim); nh.SetSize(dim); ni.SetSize(dim); adjJ.SetSize(dim); if (MQ) mq.SetSize(dim); shape.SetSize(ndof); dshape.SetSize(ndof, dim); dshape_dn.SetSize(ndof); elvect.SetSize(ndof); elvect = 0.0; const IntegrationRule *ir = IntRule; if (ir == NULL) { // a simple choice for the integration order; is this OK? int order = 2*el.GetOrder(); ir = &IntRules.Get(Tr.FaceGeom, order); } for (int p = 0; p < ir->GetNPoints(); p++) { const IntegrationPoint &ip = ir->IntPoint(p); IntegrationPoint eip; Tr.Loc1.Transform(ip, eip); Tr.Face->SetIntPoint(&ip); if (dim == 1) nor(0) = 2*eip.x - 1.0; else CalcOrtho(Tr.Face->Jacobian(), nor); el.CalcShape(eip, shape); el.CalcDShape(eip, dshape); Tr.Elem1->SetIntPoint(&eip); // compute uD through the face transformation w = ip.weight * uD->Eval(*Tr.Face, ip) / Tr.Elem1->Weight(); if (!MQ) { if (Q) w *= Q->Eval(*Tr.Elem1, eip); ni.Set(w, nor); } else { nh.Set(w, nor); MQ->Eval(mq, *Tr.Elem1, eip); mq.MultTranspose(nh, ni); } CalcAdjugate(Tr.Elem1->Jacobian(), adjJ); adjJ.Mult(ni, nh); dshape.Mult(nh, dshape_dn); elvect.Add(sigma, dshape_dn); if (kappa_is_nonzero) elvect.Add(kappa*(ni*nor), shape); } }