Ejemplo n.º 1
0
void Method::count(Mesh* mesh, Node* node, double timeStep, int ax)
{
	//randomizeAxis();
	//printf("count node %d axis %d start\n",node->local_num, ax);
	int v_n = 5;//number of value components 		sizeof(node->values.name)/sizeof(double);
	Node* next = new Node(node); 	//we store new time step node in here
	double nextValues[5]={0.0}; 	//(!)4=v_n new time step values
	double a_r_coeff[2]={0.0}; 	//coeffs in xi-eta-teta coords (axis[])
	double coord_char[2]={0.0}; 	//coordinates of point in old time step, where characteristic falls
	Triangle* t = 0;		//thetr for interpolation
	//for (int v_c=0; v_c<v_n; v_c++) 	//for each value component
	//{
	calculateCoeff(a_r_coeff,node->axis); 	//transform coefficients into random axes basis

		for (int i_crd=0; i_crd<2; i_crd++) //finding where characteristic for ax-th axis falls
			coord_char[i_crd] = node->coords[i_crd] - 2.0*a_r_coeff[ax]*node->axis[2*ax+i_crd]*timeStep;
		//printf("COUNT:   ts %lf   c0 %lf   c1 %lf   ax %d %lf %lf\n",timeStep,a_r_coeff[0],a_r_coeff[1],ax,node->axis[2*ax],node->axis[2*ax+1]);
		//printf("COUNT:   ts %lf   nd: %lf %lf   cc: %lf %lf\n",timeStep,node->coords[0],node->coords[1],coord_char[0],coord_char[1]);
	//printf("count node %d axis %d tri to find at %lf %lf\n",node->local_num, ax,node->axis[2*ax],node->axis[2*ax+1]);
	//printf("axes randomized with %lf %lf %lf %lf\n",node->axis[0],node->axis[1],node->axis[2],node->axis[3]);
		t = mesh->findTriangle(coord_char,node);
	//printf("count node %d axis %d tri found\n",node->local_num, ax);
		if (!t) {printf("Fail! No thetr found for %lf %lf\n",coord_char[0],coord_char[1]); return;};
		if (order == 1)
		{
			nextValues[0] = interpolate_1_order(t, coord_char, 0, mesh); 
			nextValues[1] = interpolate_1_order(t, coord_char, 1, mesh); 
			nextValues[2] = interpolate_1_order(t, coord_char, 2, mesh);
		}
		else if (order == 2)
		{
			double res[3]={0.0};
//			nextValues[0] = 
			interpolate_2_order(t, coord_char, mesh, res, next); 
			nextValues[0] = res[0];
			nextValues[1] = res[1];
			nextValues[2] = res[2];
		}
		else if (order == 3)
			nextValues[0] = interpolate_3_order(t, coord_char, mesh); 
	//printf("count node %d axis %d interpolated u with %lf\n",node->local_num, ax,nextValues[0]);
	//printf("count node %d axis %d interpolated ux with %lf\n",node->local_num, ax,nextValues[1]);
	//printf("count node %d axis %d interpolated uy with %lf\n",node->local_num, ax,nextValues[2]);
	next->setValues(nextValues);	//copy new time step values into new time step node
	//memcpy(next->coords, node->coords, sizeof(double)*3); //new time step coords, no mesh movement while
	node->nextStep = next;		//add link from old node to the new one
	//printf("count node %d axis %d finished\n",node->local_num, ax);
}
void LowPassFilter::changeCutOffFreq(float newFreq) {
    cutOffFrequency = newFreq;
    calculateCoeff();
}
Ejemplo n.º 3
0
void SimpleEq::changeCutOffFreq(float newFreq){
    cutOffFrequency = newFreq;
    calculateCoeff();
}