Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mat_data_struct f_matpar_H_metal(double H, const std::vector<mat_data_struct> &mat) {
- mat_data_struct matnow;
- int L = 0;
- int R = mat.size() - 1;
- int m;
- while (R - L > 1) {
- m = (R + L) / 2;
- if (H > mat[m].H) {
- L = m;
- }
- else if (H <= mat[m].H) {
- R = m;
- }
- }
- double x = (H - mat[L].H) / double(mat[R].H - mat[L].H);
- matnow.H = H;
- matnow.T = mat[L].T + x * (mat[R].T - mat[L].T);
- matnow.k = mat[L].k + x * (mat[R].k - mat[L].k);
- matnow.rho = mat[L].rho + x * (mat[R].rho - mat[L].rho);
- matnow.cp = mat[L].cp + x * (mat[R].cp - mat[L].cp);
- matnow.mu= mat[L].cp + x * (mat[R].cp - mat[L].cp);
- return matnow;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement