예제 #1
0
파일: eltrans.cpp 프로젝트: LLNL/mfem
const DenseMatrix &ElementTransformation::EvalAdjugateJ()
{
   MFEM_ASSERT((EvalState & ADJUGATE_MASK) == 0, "");
   Jacobian();
   adjJ.SetSize(dFdx.Width(), dFdx.Height());
   if (dFdx.Width() > 0) { CalcAdjugate(dFdx, adjJ); }
   EvalState |= ADJUGATE_MASK;
   return adjJ;
}
예제 #2
0
파일: lininteg.cpp 프로젝트: lyq105/mfem
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);
    }
}