📄 particle.cpp
字号:
#include "StdAfx.h"
#include ".\particle.h"
CParticle::CParticle(void)
{
Pos = 0;
Vel = 0;
PosBest = 0;
Dim = 0;
}
CParticle::CParticle( int iDim )
{
Dim = iDim;
Pos = new double[Dim];
Vel = new double[Dim];
PosBest = new double[Dim];
}
CParticle::~CParticle(void)
{
if(Dim)
{
delete []Pos;
delete []Vel;
delete PosBest;
}
}
void CParticle::SetDim( int Dimension )
{
if( Pos )
delete []Pos;
if( Vel )
delete []Vel;
if( PosBest )
delete []PosBest;
Dim = Dimension;
Pos = new double[Dimension];
Vel = new double[Dimension];
PosBest = new double[Dimension];
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -