@@ -3990,6 +3990,17 @@ objectintegralelementref *integral_getelementref(vm *v) {
39903990 return NULL ;
39913991}
39923992
3993+ /* ---------
3994+ * Elementid
3995+ * --------- */
3996+
3997+ static value integral_elementid (vm * v , int nargs , value * args ) {
3998+ objectintegralelementref * elref = integral_getelementref (v );
3999+ if (!elref ) { morpho_runtimeerror (v , INTEGRAL_SPCLFN , ELEMENTID_FUNCTION ); return MORPHO_NIL ; }
4000+
4001+ return MORPHO_INTEGER (elref -> id );
4002+ }
4003+
39934004/* --------
39944005 * Tangent
39954006 * -------- */
@@ -4036,6 +4047,7 @@ int normlhandle; // TL storage handle for normal vectors
40364047/** Evaluates the normal vector */
40374048void integral_evaluatenormal (vm * v , value * out ) {
40384049 objectintegralelementref * elref = integral_getelementref (v );
4050+
40394051 if (!elref ) { morpho_runtimeerror (v , INTEGRAL_SPCLFN , NORMAL_FUNCTION ); return ; }
40404052
40414053 int dim = elref -> mesh -> dim ;
@@ -5040,6 +5052,7 @@ void functional_initialize(void) {
50405052 builtin_addclass (NEMATIC_CLASSNAME , MORPHO_GETCLASSDEFINITION (Nematic ), objclass );
50415053 builtin_addclass (NEMATICELECTRIC_CLASSNAME , MORPHO_GETCLASSDEFINITION (NematicElectric ), objclass );
50425054
5055+ builtin_addfunction (ELEMENTID_FUNCTION , integral_elementid , BUILTIN_FLAGSEMPTY );
50435056 builtin_addfunction (TANGENT_FUNCTION , integral_tangent , BUILTIN_FLAGSEMPTY );
50445057 builtin_addfunction (NORMAL_FUNCTION , integral_normal , BUILTIN_FLAGSEMPTY );
50455058 builtin_addfunction (GRAD_FUNCTION , integral_gradfn , BUILTIN_FLAGSEMPTY );
0 commit comments