代码拉取完成,页面将自动刷新
#include "Element_1D.h"
Point_1::Point_1()
{
coord = new double [1];
};
Point_1::Point_1(double _x)
{
coord = new double [1];
coord[0] = _x;
};
Point_1::Point_1(const Point_1& _p)
{
coord = new double [1];
coord[0] = _p.coord[0];
};
Point_1::Point_1(Point_1& p)
{
coord = new double [1];
coord[0] = p.coord[0];
};
Point_1::~Point_1()
{
if (coord != NULL)
delete [] coord;
};
std::ostream& operator<<(std::ostream& _os, const Point_1 &_p)
{
if (_p.coord != NULL)
_os << _p.coord[0];
return _os;
};
Point_1 operator+(const Point_1 &_p1, const Point_1 &_p2)
{
Point_1 re(_p1.coord[0] + _p2.coord[0]);
return re;
};
double Point_1::operator()() const
{
return coord[0];
};
void Point_1::operator()(double _x)
{
coord[0] = _x;
};
const Point_1& Point_1::operator=(const Point_1 &_p)
{
if (this != &_p)
coord[0] = _p.coord[0];
return *this;
};
MeshGrid::MeshGrid()
{
no_vertex = 2;
vertices = new Point_1[no_vertex];
global_idx = new int[no_vertex];
};
MeshGrid::~MeshGrid()
{
delete [] vertices;
delete [] global_idx;
};
void MeshGrid::set_global_idx(int _i, int _idx)
{
if (_i >= 0 && _i <= 1)
global_idx[_i] = _idx;
else
std::cerr << "In MeshGrid: out of idx range." << std::endl;
};
int MeshGrid::get_global_idx(int _i) const
{
if (_i >= 0 && _i <= 1)
return global_idx[_i];
else
std::cerr << "In MeshGrid: out of idx range." << std::endl;
};
void MeshGrid::set_vertices(const Point_1 *_pnt_list)
{
for (int i = 0; i < 2; i++)
vertices[i] = _pnt_list[i];
};
void MeshGrid::set_vertices(int _i, const Point_1 &_p)
{
vertices[_i] = _p;
};
const Point_1* MeshGrid::get_vertices() const
{
return vertices;
};
const Point_1& MeshGrid::get_vertices(int _i) const
{
return vertices[_i];
};
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。