tecplot云图——数据文本格式2
程序员文章站
2022-05-29 14:45:32
...
文本格式
按照文本格式顺序,第一行是标头,第二行是变量,第三行n是数据点个数,e是面元的个数,f代表点和面元,et代表的是面元类型,quadrilateral是四边形。点输出结束后,然后排列每个面元四个点在总点数的位置。
C++代码
ofstream out4("tecplot1.dat");
int n_point = x_dengfen * z_dengfen, e_number = (x_dengfen - 1)* (z_dengfen - 1);
out4 << " Title=“sample finite-element”" << endl;
out4 << " Variables=“x”,“y”,“z”,“b”" << endl;
out4 << "Zone n=" << n_point << ",e=" << e_number << ",f=fepoint,et=quadrilateral" << endl;
for (int j = 0; j < x_dengfen; j++)
{
for (int i = 0; i < z_dengfen; i++)
{
out4 << fixed << setw(w_char) << setprecision(n_deci) <<underwater_totallhull[j].x_i[i] << fixed << setw(w_char) << setprecision(n_deci) << underwater_totallhull[j].y_i[i] << fixed << setw(w_char) << setprecision(n_deci) << underwater_totallhull[j].z_i[i] << fixed << setw(w_char) << setprecision(n_deci) <<0.2<< endl;
}
}
for (int i = 1, j = 1; i <= (x_dengfen - 1)* (z_dengfen - 1); j++, i++)
{
if (j % (z_dengfen) == 0) j = j + 1;
out4 << fixed << setw(w_char) << setprecision(n_deci) << j ;
out4 << fixed << setw(w_char) << setprecision(n_deci) << j + 1 ;
out4 << fixed << setw(w_char) << setprecision(n_deci) << j + 1 + z_dengfen ;
out4 << fixed << setw(w_char) << setprecision(n_deci) << j + z_dengfen << endl;
}
out4.close();