예제 #1
0
void ElementIntegral
::createOneFormTransformationMatrix(const CellJacobianBatch& JTrans,
                                    const CellJacobianBatch& JVol) const
{
    TimeMonitor timer(transCreationTimer());
    Tabs tab;
    SUNDANCE_MSG2(transformVerb(),
                  tab << "ElementIntegral creating linear form trans matrices");

    int maxDim = JTrans.cellDim();

    if (transformationMatrixIsValid(alpha())) return;
    transformationMatrixIsValid(alpha()) = true;

    int flops = JTrans.numCells() * maxDim + JTrans.numCells();

    G(alpha()).resize(JTrans.numCells() * JTrans.cellDim());

    int k = 0;
    double* GPtr = &(G(alpha())[0]);

    for (int c=0; c<JTrans.numCells(); c++)
    {
        Array<double> invJ;
        JTrans.getInvJ(c, invJ);
        double detJ = fabs(JVol.detJ()[c]);
        for (int gamma=0; gamma<maxDim; gamma++, k++)
        {
            GPtr[k] = detJ*invJ[alpha() + maxDim * gamma];
        }
    }

    addFlops(flops);
}
예제 #2
0
void ElementIntegral
::createTwoFormTransformationMatrix(const CellJacobianBatch& JTrans,
                                    const CellJacobianBatch& JVol) const
{
    TimeMonitor timer(transCreationTimer());
    Tabs tab;

    int flops = 0;

    int maxDim = JTrans.cellDim();
    int cellDim = JVol.cellDim();

    if (testDerivOrder() == 1 && unkDerivOrder() == 1)
    {
        Tabs tab2;
        if (transformationMatrixIsValid(alpha(), beta())) return;
        transformationMatrixIsValid(alpha(), beta()) = true;

        G(alpha(), beta()).resize(JTrans.numCells() * JTrans.cellDim() * JTrans.cellDim());

        double* GPtr = &(G(alpha(),beta())[0]);
        int k = 0;

        for (int c=0; c<JTrans.numCells(); c++)
        {
            static Array<double> invJ;
            JTrans.getInvJ(c, invJ);
            double detJ = fabs(JVol.detJ()[c]);
            for (int gamma=0; gamma<maxDim; gamma++)
            {
                for (int delta=0; delta<maxDim; delta++, k++)
                {
                    GPtr[k] =  detJ*invJ[alpha() + gamma*maxDim]
                               * invJ[beta() + maxDim*delta];
                }
            }
        }
        flops = 2 * JTrans.numCells() * maxDim * maxDim + JTrans.numCells();
    }

    else if (testDerivOrder() == 1 && unkDerivOrder() == 0)
    {
        if (transformationMatrixIsValid(alpha())) return;
        transformationMatrixIsValid(alpha()) = true;

        G(alpha()).resize(JTrans.numCells() * JTrans.cellDim());

        int k = 0;
        double* GPtr = &(G(alpha())[0]);

        for (int c=0; c<JTrans.numCells(); c++)
        {
            static Array<double> invJ;
            JTrans.getInvJ(c, invJ);
            double detJ = fabs(JVol.detJ()[c]);
            for (int gamma=0; gamma<maxDim; gamma++,k++)
            {
                GPtr[k] = detJ*invJ[alpha() + maxDim * gamma];
            }
        }
        flops = JTrans.numCells() * maxDim + JTrans.numCells();
    }

    else
    {
        if (transformationMatrixIsValid(beta())) return;
        transformationMatrixIsValid(beta()) = true;

        G(beta()).resize(JTrans.numCells() * JTrans.cellDim());

        int k = 0;
        double* GPtr = &(G(beta())[0]);

        for (int c=0; c<JTrans.numCells(); c++)
        {
            static Array<double> invJ;
            JTrans.getInvJ(c, invJ);
            double detJ = fabs(JVol.detJ()[c]);
            for (int gamma=0; gamma<maxDim; gamma++,k++)
            {
                GPtr[k] = detJ*invJ[beta() + maxDim * gamma];
            }
        }
        flops = JTrans.numCells() * maxDim + JTrans.numCells();
    }

    addFlops(flops);
}