Vector MyCoefficientFunction()

I am trying to make a vector version of MyCoefficientFunction.

I am refeering to mylittelengsolve.
I find

   // ********************* Necessary **********************************
    virtual double Evaluate(const BaseMappedIntegrationPoint& mip) const override
      // maybe do something with mip and trafo?
      auto pnt = mip.GetPoint();
      return pnt[0] * pnt[1];

    // ******************* Performance improvements **********************

in “myCoefficient.hpp”. This I suppose is a function, but how come it is written in .hcp file? Isn’t it a header file? How do I make it a vector function? I searched in the source files, but I could not find a similar file that I could refer to.

Hi Kengo,

here are some examples (unfortunately not on the tutorial level as MyLittleNGSolve):

The specialcf.normal(3) ends up as a cl_NormalVectorCF class:

The inverse of a matrix-valued CF leads to an InverseCoefficientFunction:

The CF can be tensor-valued (scalar, vector, matrix, or higher order tensor). This is specified by SetDimensions. The Evaluate function writes values linear into a vector (last index is inner dimension)

A difference is whether a CF is a node of the expression tree (like NormalVector), or if it depends on one or serveral input CFs (like InverseCF). Then automatic differentiation for the node shall also be provided.