====== XTable ====== **//Inherited from//** [[class::domain::nitem|NItem]], **//Inherited by//** NULL **//Friend class//** NULL **//Description//** XTable封装了具有物理场属性的二维数据场的数据及其方法,它的类型标识为"CTABLE"。该类是一种通用的由行和列组成的二维表格。 数据表中的数据被约定为浮点数类型且在内存中作为列式一维数组处理,初始大小为0行1列。 XTable的每列数据都是一个拥有物理属性的数据场,场属性由数组m_Fields定义。XTable提供了提前某列数据的方法。 XTable支持的数据场列举如下: | 枚举量 | 值 | 说明 | | Field_V | 0 | 无量纲场 | | Field_X | 1 | 坐标第一分量 | | Field_Y | 2 | 坐标第二分量 | | Field_Z | 3 | 坐标第三分量 | | Field_T | 4 | 时间 | | Field_DOF | 5 | 自由度 | | Field_TEMP | 6 | 温度 | | Field_PRS | 7 | 压力 | | Field_FREQ | 8 | 频率 | | Field_AMPL | 9 | 幅值 | | Field_PHASE | 10 | 相位 | | Field_REAL | 11 | 实部 | | Field_VIRTUAL | 12| 虚部 | | Field_F | 13 | 力 | | Field_RHO | 14 | 密度 | | Field_U | 15 | 位移 | | Field_R | 16 | 角位移 | | Field_ANG | 17 | 角度 | | Field_VEL| 18 | 速度 | | Field_RVEL | 19 | 角速度 | | Field_ACC | 20 | 加速度 | | Field_RACC | 21 | 角加速度 | **//Members//** * XArray [[xtable#m_fields|m_Fields]] * XDataField [[xtable#m_data|m_Data]] **//Public interface//** * [[xtable#xtable1|XTable]](ulong id) * [[xtable#~xtable|~XTable]]() * void [[xtable#clear|clear]]() * const XDataField & [[xtable#getdata|getData]]() const * void [[xtable#setdata|setData]](const XDataField & fd) * DomainType [[xtable#getdomaintype|getDomainType]]() * virtual void [[xtable#write|write]](XBinaryIO * io) * virtual ErrorCode [[xtable#read|read]](XBinaryIO * io) * void [[xtable#getxycurve|getXYCurve]](int xIndex,int yIndex, XDataXY * xyc) const * void [[xtable#setfields|setFields]](vector * fields) * void [[xtable#setfields|setFields]](const XArray * fields) * bool [[xtable#matchfields|matchFields]](vector * defs) const * TableFieldType [[xtable#getfield|getField]](int idx) const * int [[xtable#countfield|countField]]() const * bool [[xtable#extractdatapoints|extractDataPoints]](int dim, vector * dataPts) const ---- {{anchor:m_fields}} **XArray m_Fields** 以列定义的场类型数组 {{anchor:m_data}} **XDataField m_Data** 表数据 ---- {{anchor:xtable1}} **XTable(ulong id)** *function: 构造函数 *parameters: - [i]ulong id: 对象ID *return value: 无 {{anchor:~xtable}} **~XTable()** *function: 析构函数 *parameters: NULL *return value: 无 {{anchor:clear}} **void clear()** *function: 清空数据,重置表大小(0行1列) *parameters: NULL *return value: 无 {{anchor:getdata}} **const XDataField & getData() const** *function: 获取表数据 *parameters: NULL *return value: 表数据场对象引用 {{anchor:setdata}} **void setData(const XDataField & fd)** *function: 设置表数据 *parameters: - [i]const XDataField & fd: 表数据场对象引用 *return value: 无 {{anchor:write}} **virtual void write(XBinaryIO * io)** *function: 将对象数据写入到二进制文件中 *parameters: - [i]XBinaryIO * io: 二进制文件句柄 *return value: 无 {{anchor:read}} **virtual ErrorCode read(XBinaryIO * io)** *function: 从二进制文件中读取对象数据 *parameters: - [i]XBinaryIO * io: 二进制文件句柄 *return value: 如成功读取返回Error_None, 否则返回相应错误码 {{anchor:getxycurve}} **void getXYCurve(int xIndex,int yIndex, XDataXY * xyc) const** *function: 从表对象中抽取两列数据构成曲线数据对象 *parameters: - [i]int xIndex: 自变量列索引 - [i]int yIndex: 因变量列索引 - [i] XDataXY * xyc: 曲线数据对象 *return value: 无 {{anchor:setfields}} **void setFields(vector * fields)** *function: 按列设置数据场类型 *parameters: - [i]vector * fields: 数据场类型数组 *return value: 无 {{anchor:setfields}} **void setFields(const XArray * fields)** *function: 按列设置数据场类型 *parameters: - [i]const XArray * fields: 数据场类型数组 *return value: 无 {{anchor:matchfields}} **bool matchFields(vector * defs) const** *function: 检查表的各列属性是否与给定定义匹配 *parameters: - [i]vector * defs: 给定场定义 *return value: 表的各列属性与给定定义匹配返回true,否则返回false {{anchor:getfield}} **TableFieldType getField(int idx) const** *function: 按列获取表的场类型 *parameters: - [i]int idx: 列的序号 *return value: 指定列的场类型 {{anchor:countfield}} **int countField() const** *function: 获取表的列数 *parameters: NULL *return value: 表的列数 {{anchor:extractdatapoints}} **bool extractDataPoints(int dim, vector * dataPts) const** *function: 假定表为坐标场(前3列为坐标),从表中提取数据点 *parameters: - [i]int dim: 被提前的场个数(从第4列开始算) - [i] vector * dataPts: 数据点数组 *return value: 成功提前返回true,否则返回false