static PyObject*
cshockCapturingCalculateNumericalDiffusionJaffre(PyObject* self,
						 PyObject* args)
{
  double shockCapturingFactor,beta;
  PyObject *elementDiameter,*strongResidual,*grad_u,*numDiff;
  if(!PyArg_ParseTuple(args,"ddOOOO",
                       &shockCapturingFactor,
		       &beta,
                       &elementDiameter,
                       &strongResidual,
                       &grad_u,
                       &numDiff))
    return NULL;
  calculateNumericalDiffusionJaffre(SHAPE(grad_u)[0],
				    SHAPE(grad_u)[1],
				    SHAPE(grad_u)[2],
				    shockCapturingFactor,
				    beta,
				    DDATA(elementDiameter),
				    DDATA(strongResidual),
				    DDATA(grad_u),
				    DDATA(numDiff));
  Py_INCREF(Py_None);
  return Py_None;
}
static PyObject*
cshockCapturingCalculateNumericalDiffusion_A_1(PyObject* self,
                                             PyObject* args)
{
  double shockCapturingFactor;
  PyObject *elementDiameter,*strongResidual,*mt,*df,*numDiff;
  if(!PyArg_ParseTuple(args,"dOOOOO",
                       &shockCapturingFactor,
                       &elementDiameter,
                       &strongResidual,
                       &mt,
                       &df,
                       &numDiff))
    return NULL;
  calculateNumericalDiffusion_A_1(SHAPE(df)[0],
                                  SHAPE(df)[1],
                                  SHAPE(df)[2],
                                  shockCapturingFactor,
                                  DDATA(elementDiameter),
                                  DDATA(strongResidual),
                                  DDATA(mt),
                                  DDATA(df),
                                  DDATA(numDiff));
  Py_INCREF(Py_None);
  return Py_None;
}
示例#3
0
static PyObject* ctracking_getOuterNormals_affineSimplex(PyObject* self,
							 PyObject* args)
{
  int nSpace;
  


  PyObject *boundaryNormals,
    *jacobianInverseArray,
    *unitNormalArray;

  if (!PyArg_ParseTuple(args,
			"OOO",
			&boundaryNormals,
			&jacobianInverseArray,
			&unitNormalArray))
    return NULL;
  nSpace = SHAPE(boundaryNormals)[0] -1;
  if (nSpace == 1)
    {
      getOuterNormals_affineSimplex_1d(SHAPE(jacobianInverseArray)[0],
				       SHAPE(unitNormalArray)[1],
				       SHAPE(jacobianInverseArray)[1],
				       DDATA(boundaryNormals),
				       DDATA(jacobianInverseArray),
				       DDATA(unitNormalArray));

    }
  else if (nSpace == 2)
    {
      getOuterNormals_affineSimplex_2d(SHAPE(jacobianInverseArray)[0],
				       SHAPE(unitNormalArray)[1],
				       SHAPE(jacobianInverseArray)[1],
				       DDATA(boundaryNormals),
				       DDATA(jacobianInverseArray),
				       DDATA(unitNormalArray));

    }
  else
    {
      assert(nSpace == 3);
      getOuterNormals_affineSimplex_3d(SHAPE(jacobianInverseArray)[0],
				       SHAPE(unitNormalArray)[1],
				       SHAPE(jacobianInverseArray)[1],
				       DDATA(boundaryNormals),
				       DDATA(jacobianInverseArray),
				       DDATA(unitNormalArray));

    }
  Py_INCREF(Py_None); 
  return Py_None;
}
示例#4
0
文件: rb_cpShape.c 项目: 0w/moai-dev
static VALUE
rb_cpShapeSetLayers(VALUE self, VALUE layers)
{
	SHAPE(self)->layers = NUM2UINT(layers);
	
	return layers;
}
示例#5
0
文件: rb_cpShape.c 项目: 0w/moai-dev
static VALUE
rb_cpShapeGetBB(VALUE self)
{
	cpBB *bb = malloc(sizeof(cpBB));
	*bb = SHAPE(self)->bb;
	return Data_Wrap_Struct(c_cpBB, NULL, free, bb);
}
示例#6
0
文件: rb_cpShape.c 项目: 0w/moai-dev
static VALUE
rb_cpShapeCacheBB(VALUE self)
{
	cpShape *shape = SHAPE(self);
	cpShapeCacheBB(shape);
	
	return rb_cpShapeGetBB(self);
}
示例#7
0
文件: rb_cpShape.c 项目: 0w/moai-dev
static VALUE
rb_cpShapeSetBody(VALUE self, VALUE body)
{
	SHAPE(self)->body = BODY(body);
	rb_ivar_set(self, id_body, body);
	
	return body;
}
示例#8
0
文件: rb_cpShape.c 项目: 0w/moai-dev
static VALUE
rb_cpShapeSetCollType(VALUE self, VALUE val)
{
	VALUE col_type = rb_obj_id(val);
	rb_iv_set(self, "collType", val);
	SHAPE(self)->collision_type = NUM2UINT(col_type);
	
	return val;
}
示例#9
0
文件: rb_cpShape.c 项目: 0w/moai-dev
static VALUE
rb_cpShapeSetGroup(VALUE self, VALUE val)
{
	VALUE col_type = rb_obj_id(val);
	rb_iv_set(self, "group", val);
	SHAPE(self)->group = NUM2UINT(col_type);
	
	return val;
}
Recursor::Recursor(Vector2 pos, int c) : oldPos(pos), GameObject(pos,SHAPE(baseShape)) {
	parent = NULL;
	if (c > 0) {
		child = new Recursor(pos + (Vector2(15,15) * (float)c * 1.7f), c - 1);
		child->parent = this;
		scale += (c*1.25f);
	} else {
		child = NULL;
	}
}
示例#11
0
文件: rb_cpShape.c 项目: 0w/moai-dev
static VALUE
rb_cpCircleInitialize(VALUE self, VALUE body, VALUE radius, VALUE offset)
{
	cpCircleShape *circle = (cpCircleShape *)SHAPE(self);
	
	cpCircleShapeInit(circle, BODY(body), NUM2DBL(radius), *VGET(offset));
	circle->shape.data = (void *)self;
	circle->shape.collision_type = Qnil;

	rb_ivar_set(self, id_body, body);
	
	return self;
}
示例#12
0
static PyObject* ctracking_setNodeOnBoundaryArray(PyObject* self,
						  PyObject* args)
{
  PyObject *exteriorElementBoundariesArray,
    *elementBoundaryNodesArray,
    *nodeOnBoundaryArray;
  if (!PyArg_ParseTuple(args,
			"OOO",
			&exteriorElementBoundariesArray,
			&elementBoundaryNodesArray,
			&nodeOnBoundaryArray))
    return NULL;

  setNodeOnBoundaryArray(SHAPE(exteriorElementBoundariesArray)[0],
			 SHAPE(elementBoundaryNodesArray)[1],
			 IDATA(exteriorElementBoundariesArray),
			 IDATA(elementBoundaryNodesArray),
			 IDATA(nodeOnBoundaryArray));

  Py_INCREF(Py_None); 
  return Py_None;
}
示例#13
0
文件: rb_cpShape.c 项目: 0w/moai-dev
static VALUE
rb_cpSegmentInitialize(VALUE self, VALUE body, VALUE a, VALUE b, VALUE r)
{
	cpSegmentShape *seg = (cpSegmentShape *)SHAPE(self);
	
	cpSegmentShapeInit(seg, BODY(body), *VGET(a), *VGET(b), NUM2DBL(r));
	seg->shape.data = (void *)self;
	seg->shape.collision_type = Qnil;

	rb_ivar_set(self, id_body, body);
	
	return self;
}
示例#14
0
文件: rb_cpShape.c 项目: 0w/moai-dev
static VALUE
rb_cpPolyInitialize(VALUE self, VALUE body, VALUE arr, VALUE offset)
{
	cpPolyShape *poly = (cpPolyShape *)SHAPE(self);
	
	Check_Type(arr, T_ARRAY);
	int numVerts = RARRAY_LEN(arr);
	VALUE *ary_ptr = RARRAY_PTR(arr);
	cpVect verts[numVerts];
	
	for(int i=0; i<numVerts; i++)
		verts[i] = *VGET(ary_ptr[i]);
	
	cpPolyShapeInit(poly, BODY(body), numVerts, verts, *VGET(offset));
	poly->shape.data = (void *)self;
	poly->shape.collision_type = Qnil;

	rb_ivar_set(self, id_body, body);
	
	return self;
}
示例#15
0
文件: rb_cpShape.c 项目: 0w/moai-dev
static VALUE
rb_cpShapeGetElasticity(VALUE self)
{
	return rb_float_new(SHAPE(self)->e);
}
示例#16
0
文件: rb_cpShape.c 项目: 0w/moai-dev
static VALUE
rb_cpShapeGetFriction(VALUE self)
{
	return rb_float_new(SHAPE(self)->u);
}
示例#17
0
文件: rb_cpShape.c 项目: 0w/moai-dev
static VALUE
rb_cpShapeSetElasticity(VALUE self, VALUE val)
{
	SHAPE(self)->e = NUM2DBL(val);
	return val;
}
示例#18
0
文件: rb_cpShape.c 项目: 0w/moai-dev
static VALUE
rb_cpShapeSetFriction(VALUE self, VALUE val)
{
	SHAPE(self)->u = NUM2DBL(val);
	return val;
}
示例#19
0
文件: rb_cpShape.c 项目: 0w/moai-dev
static VALUE
rb_cpShapeGetLayers(VALUE self)
{
	return UINT2NUM(SHAPE(self)->layers);
}
示例#20
0
文件: rb_cpShape.c 项目: 0w/moai-dev
static VALUE
rb_cpShapeGetSurfaceV(VALUE self)
{
	return VWRAP(self, &SHAPE(self)->surface_v);
}
示例#21
0
文件: rb_cpShape.c 项目: 0w/moai-dev
static VALUE
rb_cpShapeSetSurfaceV(VALUE self, VALUE val)
{
	SHAPE(self)->surface_v = *VGET(val);
	return val;
}