⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 globepar.cpp

📁 在任务级并行平台P2HP上开发的demo应用
💻 CPP
字号:
// GlobePar.cpp: implementation of the GlobePar class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "Perm.h"
#include "GlobePar.h"
#include "Simulation.h"
using namespace std;

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

GlobePar::GlobePar(int dim){
	dimensions = dim;
	forwards = dim*2;
}

GlobePar::~GlobePar(){

}
	
void GlobePar::updatePara(long double weight, int index){
	long double temp = weight + averageOfWei[index]*numberOfLen[index]++;
	averageOfWei[index] = temp / numberOfLen[index];
}

int GlobePar::getDimen() const{
	return dimensions;
}

int GlobePar::getDirec() const{
	return forwards;
}

bool GlobePar::initial(const std::vector<long double> &tempvector){
	int len = tempvector.size();
	averageOfWei = tempvector;
	for(int i=0; i<len; i++)
		numberOfLen.push_back(1);
	return true;
}
	
bool GlobePar::resetNumber(){
	for(int i=0; i<numberOfLen.size(); i++)
		numberOfLen[i] = 1;
	return true;
}
	
const int GlobePar::directions[6][3] = {{1,0,0},{-1,0,0},{0,1,0},{0,-1,0},{0,0,1},{0,0,-1}};

CString GlobePar::sequence = "NO SEQUENCE";

int GlobePar::length = -1;

int GlobePar::bestEnergy = -1;

int GlobePar::round = 1;

int GlobePar::c = 1 ;   
                              
int GlobePar::z0 = 1 ;  

int GlobePar::Exp = 18;

double GlobePar::c0 = 50000;

int GlobePar::step = 20000;



⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -