[fem] implements a more generic ConstantFunction