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

📄 simulation.h

📁 在任务级并行平台P2HP上开发的demo应用
💻 H
字号:
// Simulation.h: interface for the Simulation class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_SIMULATION_H__F2F0933B_135D_4810_8018_54B501FFC001__INCLUDED_)
#define AFX_SIMULATION_H__F2F0933B_135D_4810_8018_54B501FFC001__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "GlobePar.h"
#include "ProteinSeq.h"
#include <SET>
#include <malloc.h>
#include <MATH.H>

/***used in the space***/
class Point{
public:
	Point(int tempx, int tempy, int tempz)
		:x(tempx),y(tempy),z(tempz){		
	};
	void set(int tempx,int tempy,int tempz){
		x=tempx; y=tempy; z=tempz;
	}
	int x,y,z;
};

/***recorde the quality****/
class Quality{
public:
	Quality(){
	};
	void resetQuality(){
		for(int i=0; i<6; i++){
			energy[i] = 0;
			quality[i] = 0;
		}
		totalQuality = 0;
		averageQuality = 0;
		k_free = 0;
	}
	int k_free;
	int energy[6];
	long double quality[6];
	long double totalQuality;
	long double averageQuality;
};

/*** this class used in the simulaiton***/
class Simulation  
{
public:
	Simulation(ProteinSeq &tempseq,
				GlobePar &temppara);
	virtual ~Simulation();
	void initialization();//construct a structure of the protein
	void run(); //return the time used for these steps
	long usedTime() const;
	std::vector<Point> bestResult;
	int bestRecoder;

	int tempTotalEnergy;
	std::vector<Point> tempResult;
	std::vector<long double> tempWeight;
	std::vector<int> tempEnergy;

private:
	inline char getSpaceNode(int x, int y, int z) const;
	inline void setSpaceNode(int x, int y, int z, const char node);
	void resetTemp();//reset the temp result
	void resetMatrix();//reset the Matrix to zero
	void computingQuality(Quality &tempQuality);
	int selectOneDirection(Quality &tempQuality);//select one direction by random choice
												//return is the index of Parameter.directions array
	void putFirstTwoPoint();//when restart simulation we must do this method
	void putOneNode(Quality &tempQuality, int selectedDire);

	//The run method need these method listed down
	void releaseOneNode();
	long double selectMultiDirection(Quality &tempQuality, std::vector<int> &direction, const int &number);
	int linage(int big, int little);
	void recursion();

	
	
private:
	ProteinSeq &sequence;
	GlobePar &parameter;
	bool initialized;
	//recorder  time used for computing
	long startTime;
	long endTime;
	//the space where we will put the ball in
	char *space;
	int spaceSize;
	//temporary variables used by simulation

	
};

#endif // !defined(AFX_SIMULATION_H__F2F0933B_135D_4810_8018_54B501FFC001__INCLUDED_)





















⌨️ 快捷键说明

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