コード例 #1
0
ファイル: lininteg.cpp プロジェクト: lyq105/mfem
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);
    }
}
コード例 #2
0
ファイル: lininteg.cpp プロジェクト: lyq105/mfem
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);
    }
}
コード例 #3
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);
    }
}
コード例 #4
0
ファイル: lininteg.cpp プロジェクト: lyq105/mfem
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);
    }
}
コード例 #5
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);
    }
}
コード例 #6
0
ファイル: lininteg.cpp プロジェクト: lyq105/mfem
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);
    }
}
コード例 #7
0
ファイル: lininteg.cpp プロジェクト: lyq105/mfem
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);
    }
}