You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
nmWTAI-Platform/ML/Training/Training/SceneIO.h

85 lines
2.2 KiB
C++

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#pragma once
#include <vector>
#include <string>
#include <fstream>
// 场景结构体
struct PebiScene {
int version;
// 网格几何
int D;
double GridControl;
std::vector<std::vector<double> > Boundary;
std::vector<std::vector<double> > VerticalWell;
std::vector<std::vector<double> > HorizontalWell;
std::vector<std::vector<double> > FractureVerticalWell;
std::vector<std::vector<std::vector<double> > > MultistageFracturedHorizontalWell;
std::vector<std::vector<double> > InclinedWell;
std::vector<std::vector<double> > Fault;
// 井顺序
std::vector<int> wellType;
std::vector<std::string> wellName;
// 求解器参数
int solverType;
// Rate 流量数据
struct {
std::vector<std::vector<double> > t;
std::vector<std::vector<double> > qo;
std::vector<std::vector<double> > qg;
std::vector<std::vector<double> > qw;
} Rate;
// CS 井筒参数
struct {
std::vector<double> C;
std::vector<double> S;
} CS;
// 每口井的流量段索引
std::vector<int> wellFlowSectionIndex;
// PVT 数据
struct {
std::vector<double> p;
double pb;
std::vector<double> Rso, Bo, Co, miuo, rouo;
std::vector<double> Rv, Bg, Cg, miug, roug, Z;
std::vector<double> Rsw, Bw, Cw, miuw, rouw;
std::vector<double> V, k_kinitial, Cf_Cfinitial;
std::vector<double> So, Kro, Sg, Krg, Sw, Krw;
} PVT;
// Base 储层参数
struct {
double Pi, Cti, Cf, Soi, Sgi, Swi;
double d, dt_Min, dt_Max;
double k_ref, phi_ref, h_ref;
} Base;
};
// scene.bin 读取器
class SceneIO {
public:
static bool loadScene(const std::string& filename, PebiScene& scene);
private:
static bool readInt(std::ifstream& fs, int& value);
static bool readDouble(std::ifstream& fs, double& value);
// 读取 UTF-16 字符串scene.bin 的格式)
static bool readString(std::ifstream& fs, std::string& value);
static bool readSafeSize(std::ifstream& fs, size_t& size);
static bool readVector1D(std::ifstream& fs, std::vector<double>& vec);
static bool readVector2D(std::ifstream& fs, std::vector<std::vector<double> >& vec);
static bool readVector3D(std::ifstream& fs, std::vector<std::vector<std::vector<double> > >& vec);
// 读取整数向量
static bool readStdVecI(std::ifstream& fs, std::vector<int>& vec);
};