小编KOF*_*KOF的帖子

C ++:如何从格式化的文本文件中读取大量数据到程序中?

我正在为特定的流体问题编写CFD解算器。到目前为止,每次运行模拟时都会生成网格,并且当更改几何形状和流体属性时,需要重新编译程序。

对于单元数较少的小型问题,它工作得很好。但是对于细胞数超过一百万的情况,需要非常频繁地更改流体性质,效率很低。

显然,我们需要将模拟设置数据存储在配置文件中,并将几何信息存储在格式化的网格文件中。

  1. Simulation.config文件
% Dimension: 2D or 3D
N_Dimension= 2
% Number of fluid phases
N_Phases=  1
% Fluid density (kg/m3)
Density_Phase1= 1000.0
Density_Phase2= 1.0
% Kinematic viscosity (m^2/s)
Viscosity_Phase1=  1e-6
Viscosity_Phase2=  1.48e-05
...
Run Code Online (Sandbox Code Playgroud)
  1. Geometry.mesh文件
% Dimension: 2D or 3D
N_Dimension= 2
% Points (index: x, y, z)
N_Points= 100
x0 y0
x1 y1
...
x99 y99
% Faces (Lines in 2D: P1->p2)
N_Faces= 55
0 2
3 4
...
% Cells (polygons in 2D: Cell-Type and Points clock-wise). …
Run Code Online (Sandbox Code Playgroud)

c++ parsing config mesh configuration-files

9
推荐指数
2
解决办法
398
查看次数

标签 统计

c++ ×1

config ×1

configuration-files ×1

mesh ×1

parsing ×1