155 lines
4.1 KiB
C++
155 lines
4.1 KiB
C++
#pragma once
|
|
|
|
#include<vtkActor.h>
|
|
#include<vtkUnstructuredGrid.h>
|
|
|
|
#include <iostream>
|
|
#include "structFromJson.h"
|
|
#include <set>
|
|
#include <QMap>
|
|
#include <QSet>
|
|
#include <QVector>
|
|
|
|
using namespace std;
|
|
|
|
class gen2DGrid
|
|
{
|
|
public:
|
|
gen2DGrid();
|
|
~gen2DGrid();
|
|
vtkSmartPointer<vtkUnstructuredGrid> m_grid_surface;
|
|
|
|
private:
|
|
vtkSmartPointer<vtkActor> m_vtk_actor;
|
|
vtkSmartPointer<vtkUnstructuredGrid> m_grid;
|
|
|
|
|
|
float m_color_x;
|
|
float m_color_y;
|
|
float m_color_z;
|
|
float m_opacity;
|
|
float m_line_width;
|
|
|
|
//1 vtu 0 vtk
|
|
int m_write_xml_type;
|
|
//1 binary 0 ascii
|
|
int m_write_data_type;
|
|
|
|
//1 center 0 leftBottom
|
|
int m_offset_type;
|
|
|
|
float m_length;
|
|
float m_width;
|
|
float m_height;
|
|
float m_offset_x;
|
|
float m_offset_y;
|
|
float m_offset_z;
|
|
|
|
float m_max_interval_x;
|
|
float m_max_interval_y;
|
|
float m_max_interval_z;
|
|
float m_max_interval;
|
|
|
|
vector<float> vec_points;
|
|
vector<float> vec_elements;
|
|
|
|
vector<set<int>> vec_set_point;
|
|
vector<set<int>> vec_set_cell;
|
|
|
|
QVector<QVector<int>> m_faceToCell;
|
|
QMap<int,int>m_cellIdToGridCellId;
|
|
QVector<QSet<int>> m_faceToPoint;
|
|
|
|
void genSurfaceGrid();
|
|
public:
|
|
vector<set<int>>& getPointSetWithSurface();
|
|
vector<set<int>>& getCellSetWithSurface();
|
|
|
|
vtkSmartPointer<vtkActor> getActor();
|
|
void setColor(float color_x, float color_y, float color_z);
|
|
void setOpacity(float opacity);
|
|
void setLineWidth(float line_width);
|
|
float getOpacity()const{return m_opacity;}
|
|
float getLineWidth()const{return m_line_width;}
|
|
|
|
float getOffsetType()const{return m_offset_type;}
|
|
float getOffsetX()const{return m_offset_x;}
|
|
float getOffsetY()const{return m_offset_y;}
|
|
float getOffsetZ()const{return 0;}
|
|
float getLength()const{return m_length;}
|
|
float getWidth()const{return m_width;}
|
|
float getHeight()const{return 0;}
|
|
float getMaxInteralX()const{return m_max_interval_x;}
|
|
float getMaxInteralY()const{return m_max_interval_y;}
|
|
float getMaxInteralZ()const{return -1;}
|
|
|
|
void setOffsetType(int offset_type);
|
|
void setOffsetTypeToCenter();
|
|
void setOffsetTypeToLeftBottom();
|
|
void setOffsetX(float offset_x);
|
|
void setOffsetY(float offset_y);
|
|
void setOffsetZ(float offset_z);
|
|
void setLength(float length);
|
|
void setWidth(float width);
|
|
void setHeight(float height);
|
|
void setMaxIntervalX(float max_interval_x);
|
|
void setMaxIntervalY(float max_interval_y);
|
|
void setMaxIntervalZ(float max_interval_z);
|
|
void setMaxInterval(float max_interval);
|
|
|
|
void readModelJsonFile(string json_name);
|
|
void readGridJsonFile(string json_name);
|
|
void writeGridJsonFile(string json_name);
|
|
|
|
void genProcess();
|
|
|
|
void getGridParams(CasRockGrid *struct_grid);
|
|
void setGridParams(CasRockGrid *struct_grid);
|
|
void setModelParams(CasRockModel* struct_model);
|
|
|
|
void update();
|
|
void updateColor(float color_x, float color_y, float color_z);
|
|
void updateOpacity(float opacity);
|
|
void updateLineWidth(float line_width);
|
|
|
|
int getWriteDataMode()const{return m_write_data_type;}
|
|
int getWriteXmlMode()const{return m_write_xml_type;}
|
|
|
|
void setWriteXmlMode(int write_xml_type);
|
|
void setWriteDataMode(int write_data_type);
|
|
void setWriteDataModeToAscii();
|
|
void setWriteDataModeToBinary();
|
|
void setWriteXmlModeToVtu();
|
|
void setWriteXmlModeToVtk();
|
|
|
|
void writeFile(string file_name);
|
|
void writeVtuFile(string vtu_file_name);
|
|
void writeVtkFile(string vtk_file_name);
|
|
|
|
void writeGridFile(string nodes_file_name,string elements_file_name);
|
|
void writeNodesFile(string nodes_file_name);
|
|
void writeElementsFile(string elements_file_name);
|
|
|
|
QVector<QSet<int> > getFaceToPoint();
|
|
QVector<QVector<int> > getFaceToCell();
|
|
QMap<int, int> getCellIdToGridIdMap();
|
|
vtkSmartPointer<vtkUnstructuredGrid> getStructure();
|
|
vtkSmartPointer<vtkUnstructuredGrid> getStructureOrigin();
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|