plate.h
来自「finite element mesh 参数化有限元网格划分」· C头文件 代码 · 共 64 行
H
64 行
// plate.h
#ifndef PLATE_H
#define PLATE_H
#include "coord.h"
/** Defines a plate. The plate is defined by a list of coordinates on a plane and the width of the plate. */
class Plate {
private:
Coord *coords;
int numCoords;
double width;
public:
/** Default constructor. Creates an empty plate. */
Plate():coords(NULL),numCoords(0),width(DEFAULT_PLATE_WIDTH) {}
/** Constructor
\param coords An array of the plates' coordinates
\param numCoords Number of coordinates of the plate
\param width The width of the plate
*/
Plate(Coord *coords, int numCoords, double width = DEFAULT_PLATE_WIDTH) {
this->coords = new Coord[numCoords];
for (int i=0; i<numCoords; i++)
this->coords[i]=coords[i];
this->numCoords = numCoords;
this->width = width;
}
/** Set parameters
\param coords An array of the plates' coordinates
\param numCoords Number of coordinates of the plate
\param width The width of the plate
*/
void setParams(Coord *coords, int numCoords, double width = DEFAULT_PLATE_WIDTH) {
if (this->coords) delete[] this->coords;
this->coords = new Coord[numCoords];
for (int i=0; i<numCoords; i++)
this->coords[i]=coords[i];
this->numCoords = numCoords;
this->width = width;
}
/** Get parameters
\param coords \out An address of an array of the plates' coordinates (the array will be allocated by the function)
\param numCoords Number of coordinates of the plate
\param width \out The width of the plate
*/
void getParams(Coord **coords, int &numCoords, double &width) const {
if (!coords) return;
numCoords = this->numCoords;
*coords = new Coord[this->numCoords];
for (int i=0; i<this->numCoords; i++)
(*coords)[i]=this->coords[i];
width = this->width;
}
};
#endif
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?