Skip to content

Beautiful access to element degrees of freedom

Christoph Lehmann requested to merge chleh/ogs:localdof into master
  1. Feature description was added to the changelog
  2. Tests covering your feature were added?
  3. Any new feature or behavior change was documented?

2 lines of code say more than a thousand words...

        auto const [x1, x2, x3] =
            NumLib::localDOF<N1, NumLib::Vectorial<N2, 2>, N3>(x);

Thank you, @endJunction, your ideas and work simplified and improved the implementation considerably.


  • seems not fully compatible with our current approach to staggered coupling

Future work

Similar things could be done for local matrix and vector initialization and block access therein.
    auto local_Jac = MathLib::createZeroedMatrix<
        typename ShapeMatricesTypeDisplacement::template MatrixType<
            temperature_size + displacement_size + pressure_size,
            temperature_size + displacement_size + pressure_size>>(
        local_Jac_data, displacement_size + pressure_size + temperature_size,
        displacement_size + pressure_size + temperature_size);

    auto local_rhs = MathLib::createZeroedVector<
        typename ShapeMatricesTypeDisplacement::template VectorType<
            displacement_size + pressure_size + temperature_size>>(
        local_rhs_data, displacement_size + pressure_size + temperature_size);

    typename ShapeMatricesTypePressure::NodalMatrixType MTT;
    MTT.setZero(temperature_size, temperature_size);


            .template block<displacement_size, displacement_size>(
                displacement_index, displacement_index)
            .noalias() += B.transpose() * C * B * w;

How about the following instead?

auto local_Jac = localMatrix(N_T, N_p, N_u);

auto MTT = localMatrix(N_T);

block(localJac, "u"_b, "u"_b).noalias() += B.transpose() * C * B * w;
Edited by Christoph Lehmann

Merge request reports