Esempio n. 1
0
//散乱波の計算
void Solver::scatteredWave(complex<double> *p){
	double rad = wave_angle*M_PI/180;	//ラジアン変換
	double _cos = cos(rad), _sin = sin(rad);	//毎回計算すると時間かかりそうだから,代入しておく

	for(int i=mField->getNpml(); i<mField->getNpx(); i++){
		for(int j=mField->getNpml(); j<mField->getNpy(); j++){
			if( N_S(i,j) == 1.0 ) continue;		//屈折率が1なら散乱は起きない
			double ikx = k_s*(i*_cos + j*_sin);
			p[index(i,j, +1)] += ray_coef*(1/_pow(N_S(i,j), 2)-1)
				                    *(polar(1.0, ikx-w_s*(time+DT_S))+polar(1.0, ikx-w_s*(time-DT_S))-2.0*polar(1.0, ikx-w_s*time)); 
		}
	}
}
Esempio n. 2
0
//散乱体の描画
void Solver::draw_model(){
	double N = max(mField->getNx(),mField->getNy());
	double ws = 2.0*MAIN_WINDOW_X/WINDOW_W/N;
	double hs = 2.0*MAIN_WINDOW_H/WINDOW_H/N;
	for (int i = mField->getNpml(); i < mField->getNpx()-mField->getNpml(); i++){
		for (int j = mField->getNpml(); j < mField->getNpy()-mField->getNpml(); j++){
			int x = i-mField->getNpml();
			int y = j-mField->getNpml();
			//媒質境界
			const double n = N_S(i,j);	//ここで,屈折率を書き換えてはいけない

			if(n == 1.0) continue;	//屈折率が1ならとばす
			glColor4d(0.7/n, 0.7/n, 0.7/n, 0.1);
			glRectd(x*ws-1, y*hs-1, (x+1.0)*ws-1, (y+1.0)*hs-1);	
		}
	}
}
Esempio n. 3
0
/**左右の壁のNS吸収境界
** 適用配列
** 適用するx座標
** 右か左か
*/
void Solver::absorbing_nsRL(complex<double> *p, int X, enum DIRECT offset){
	double kx_s = 1/sqrt(sqrt(2.0)) * k_s;
	double ky_s = sqrt(1 - 1/sqrt(2.0) ) * k_s;
	double u1, u2;
	double w_b  = w_s*DT_S/2;
	double k_b  = k_s*H_S/2;
	double kx_b = kx_s*H_S/2;
	double ky_b = ky_s*H_S/2;

	for(int j=1; j<mField->getNy()-1; j++){
		u1 = tan(w_b/n_s[index(X,j)]) / tan(k_b);
		u2 = 2 * _pow(sin(w_b/N_S(X,j)), 2) / _pow(sin(ky_b),2) * (1 - tan(kx_b)/tan(k_b));

		if(j == 1 || j == mField->getNy()-2)		// 四隅の横は一次元吸収境界
			p[index(X,j, +1)] = p[index(X+offset,j, 0)] + (1- u1)/(1+u1)*(p[index(X,j, 0)] - p[index(X+offset,j, +1)]);

		else						//それ以外は二次元吸収境界
			p[index(X,j, +1)] = - p[index(X+offset,j, -1)] 
								- (1-u1)/(1+u1)*(p[index(X,j, -1)] + p[index(X+offset,j, +1)]) 
								+     2/(1+u1)*(p[index(X,j,  0)] + p[index(X+offset,j,  0)]) 
								+ u2*u2/(1+u1)/2*( Dy2(p, X,j, 0)   +  Dy2(p, X+offset,j, 0)	);
												        //  dy^2 φn     +   dy^2 φb
	}
}
Esempio n. 4
0
File: rc.c Progetto: galexcode/w3m
#if 1				/* ANSI-C ? */
#define N_STR(x)	#x
#define N_S(x)	(x), N_STR(x)
#else				/* for traditional cpp? */
static char n_s[][2] = {
    {'0', 0},
    {'1', 0},
    {'2', 0},
};
#define N_S(x) (x), n_s[(x)]
#endif


static struct sel_c defaulturls[] = {
    {N_S(DEFAULT_URL_EMPTY), N_("none")},
    {N_S(DEFAULT_URL_CURRENT), N_("current URL")},
    {N_S(DEFAULT_URL_LINK), N_("link URL")},
    {0, NULL, NULL}
};

static struct sel_c displayinsdel[] = {
    {N_S(DISPLAY_INS_DEL_SIMPLE), N_("simple")},
    {N_S(DISPLAY_INS_DEL_NORMAL), N_("use tag")},
    {N_S(DISPLAY_INS_DEL_FONTIFY), N_("fontify")},
    {0, NULL, NULL}
};

#ifdef USE_MOUSE
static struct sel_c wheelmode[] = {
    {TRUE, "1", N_("A:relative to screen height")},