Пример #1
0
GET_JS_PARSE_BEGIN(Function_get, ChFunction*) 
GET_JS_PARSE_END

SET_JS_PARSE_BEGIN(Function_set, ChFunction*)
SET_JS_PARSE_END


////////////////////////////////////////////////////////////////////
//
// METHODS
//


DEF_JS_FUNCTION(jsGet_y, ChFunction*, 1)
  PARCHK(0, &chjs_double);
  chjs_from_double(cx, rval, this_data->Get_y(chjs_to_double(cx, argv+0)) );
DEF_JS_FUNEND

DEF_JS_FUNCTION(jsGet_y_dx, ChFunction*, 1)
  PARCHK(0, &chjs_double);
  chjs_from_double(cx, rval, this_data->Get_y_dx(chjs_to_double(cx, argv+0)) );
DEF_JS_FUNEND

DEF_JS_FUNCTION(jsGet_y_dxdx, ChFunction*, 1)
  PARCHK(0, &chjs_double);
  chjs_from_double(cx, rval, this_data->Get_y_dxdx(chjs_to_double(cx, argv+0)) );
DEF_JS_FUNEND

DEF_JS_FUNCTION(jsMax, ChFunction*, 3)
  PARCHK(0, &chjs_double);
  PARCHK(1, &chjs_double);
Пример #2
0
    {0}
};

GET_JS_PARSE_BEGIN(ChLocalOptimizer_get, ChOptimizerLocal*)
	GET_JS_PROP (0,  chjs_from_int(cx,vp,this_data->maxiters) )
	GET_JS_PROP (1,  chjs_from_int(cx,vp,this_data->maxevaluations) )
	GET_JS_PROP (2,  chjs_from_double(cx,vp,this_data->arg_tol) )
	GET_JS_PROP (3,  chjs_from_double(cx,vp,this_data->fun_tol) )
	GET_JS_PROP (4,  chjs_from_double(cx,vp,this_data->initial_step) )
	GET_JS_PROP (5,  chjs_from_double(cx,vp,this_data->grad_step) )
GET_JS_PARSE_END

SET_JS_PARSE_BEGIN(ChLocalOptimizer_set, ChOptimizerLocal*)
	SET_JS_PROP (0,	&chjs_int,	  this_data->maxiters =chjs_to_int(cx,vp)  )
	SET_JS_PROP (1,	&chjs_int,	  this_data->maxevaluations =chjs_to_int(cx,vp)  )
	SET_JS_PROP (2,	&chjs_double, this_data->arg_tol =chjs_to_double(cx,vp)  )
	SET_JS_PROP (3,	&chjs_double, this_data->fun_tol =chjs_to_double(cx,vp)  )
	SET_JS_PROP (4,	&chjs_double, this_data->initial_step = chjs_to_double(cx,vp)  )
	SET_JS_PROP (5,	&chjs_double, this_data->grad_step = chjs_to_double(cx,vp)  )
SET_JS_PARSE_END



////////////////////////////////////////////////////////////////////
//
// METHODS
//

DEF_JS_BUILDER (ChLocalOptimizer_construct, ChOptimizerLocal*)
  this_data = new ChOptimizerLocal;
DEF_JS_BUILDEND
Пример #3
0
    {"e0",          0,	JSPROP_ENUMERATE},
    {"e1",          1,	JSPROP_ENUMERATE},
    {"e2",          2,	JSPROP_ENUMERATE},
    {"e3",          3,	JSPROP_ENUMERATE},
    {0}
}; 

GET_JS_PARSE_BEGIN(Quaternion_get, Quaternion*)
	GET_JS_PROP (0,  chjs_from_double(cx,vp,this_data->e0) )
	GET_JS_PROP (1,  chjs_from_double(cx,vp,this_data->e1) )
	GET_JS_PROP (2,  chjs_from_double(cx,vp,this_data->e2) )
	GET_JS_PROP (3,  chjs_from_double(cx,vp,this_data->e3) )
GET_JS_PARSE_END

SET_JS_PARSE_BEGIN(Quaternion_set, Quaternion*)
	SET_JS_PROP (0,	&chjs_double, this_data->e0 = chjs_to_double(cx,vp) )
	SET_JS_PROP (1,	&chjs_double, this_data->e1 = chjs_to_double(cx,vp) )
	SET_JS_PROP (2,	&chjs_double, this_data->e2 = chjs_to_double(cx,vp) )
	SET_JS_PROP (3,	&chjs_double, this_data->e3 = chjs_to_double(cx,vp) )
SET_JS_PARSE_END



////////////////////////////////////////////////////////////////////
//
// METHODS
//

DEF_JS_BUILDER (Quaternion_construct, Quaternion*)
  if (argc==0)
	this_data = new Quaternion(QNULL);