Ngsolve as form compiler


I am only beginning to explore NGsolve, and wondering if NGSolve can be used in a similar capacity as Fenics/FormCompiler, to generate c++ code for element matrices and shape function evaluation for a given variational form?

Is there an alternative way to do this in Ngsolve?



we cannot give you a self-contained C++ function for the element matrices, you need the ngsolve fem library at runtime.

We do (optional) code generation for the integration point, but shape functions are in the runtime.

The element function your are looking for is in
ngsolve/symbolicintegrator.hpp at master · NGSolve/ngsolve · GitHub,
line 668:

NGS_DLL_HEADER virtual void 
CalcElementMatrix (const FiniteElement & fel,
	       const ElementTransformation & trafo, 
	       FlatMatrix<double> elmat,
	       LocalHeap & lh) const override;

It could be called from an extern fem code.