예제 #1
0
파일: lininteg.cpp 프로젝트: lyq105/mfem
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);
    }
}
예제 #2
0
파일: lininteg.cpp 프로젝트: lyq105/mfem
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);
    }
}