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

📄 masterpart.cpp

📁 光滑质点无网格法SPH并行计算程序
💻 CPP
字号:
//      ___                       ___           ___           ___       ___     //     /\__\          ___        /\__\         /\  \         /\__\     /\  \.   //    /::|  |        /\  \      /::|  |       /::\  \       /:/  /    /::\  \.  //   /:|:|  |        \:\  \    /:|:|  |      /:/\:\  \     /:/  /    /:/\:\  \. //  /:/|:|__|__      /::\__\  /:/|:|  |__   /:/  \:\  \   /:/  /    /::\~\:\  \.// /:/ |::::\__\  __/:/\/__/ /:/ |:| /\__\ /:/__/_\:\__\ /:/__/    /:/\:\ \:\__\.// \/__/~~/:/  / /\/:/  /    \/__|:|/:/  / \:\  /\ \/__/ \:\  \    \:\~\:\ \/__///       /:/  /  \::/__/         |:/:/  /   \:\ \:\__\    \:\  \    \:\ \:\__\. //      /:/  /    \:\__\         |::/  /     \:\/:/  /     \:\  \    \:\ \/__/  //     /:/  /      \/__/         /:/  /       \::/  /       \:\__\    \:\__\.   //     \/__/                     \/__/         \/__/         \/__/     \/__/    // // =============================================================================//                       Minimalist OpenGL Environment//                       Parallel Rendering Extension// =============================================================================//// Copyright 2007 Balazs Domonkos// // This program is free software; you can redistribute it and/or// modify it under the terms of the GNU General Public License// as published by the Free Software Foundation; either version 2// of the License, or (at your option) any later version.// // This program is distributed in the hope that it will be useful,// but WITHOUT ANY WARRANTY; without even the implied warranty of// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the// GNU General Public License for more details.// // You should have received a copy of the GNU General Public License// along with this program; if not, write to the Free Software// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA./// @file MasterPart.cpp/// ParaComp master part window proxy#include <paracomp/include/MasterPart.h>#include <paracomp/include/Support.h>#if MINGLE_PARACOMP_SUPPORT == 1namespace MinGLE {#define PCCHECKERROR(method, err) 	if(err!=PC_NO_ERROR) Except(method, pcGetErrorString(err))ParaCompMasterPart::ParaCompMasterPart(Window *window, std::vector<std::string> hostlist, ParaCompSupport *support,	ParallelRenderingSupport::CompositingOperator compositingOperator) :	ParaCompPart(window, support, compositingOperator), mHostList(hostlist){	// Turn on displaying output by default explicitly	mDisplayOutput = true;		// Create event collector	mEventCollector =  new EventCollector(hostlist);	mEventQueueWindowProxy = new EventQueueWindowProxy(this);	insertWindowProxy(mEventQueueWindowProxy);	// Create context	createContext();		// Refresh context info	_refreshContextInfo();		// Create proper frame processor	_createFrameProcessor();		// Wait for event injectors to connect	mEventCollector->waitForInjectors();}ParaCompMasterPart::~ParaCompMasterPart() {	//removeWindowProxy();	delete mEventQueueWindowProxy;	delete mEventCollector;}void ParaCompMasterPart::createContext() {	PCint compositingOperator = (mCompositingOperator == ParallelRenderingSupport::ALPHA_BLEND_OPERATOR ? PC_COMP_ALPHA_SORT : PC_COMP_DEPTH);	PCint pixelFormat = (mCompositingOperator == ParallelRenderingSupport::ALPHA_BLEND_OPERATOR ? PC_PF_BGRA8 : PC_PF_BGR8|PC_PF_Z32I);	// Create a list of properties for the context that we are going to create.	// Properties are specified as (name, value) terminated by	// PC_PROPERTY_END 	PCint properties[] = {		PC_COMPOSITE_TYPE, compositingOperator,		PC_PIXEL_FORMAT, pixelFormat,		PC_NETWORK_ID, mSupport->getNetId(),		PC_OUTPUT_DEPTH, 0,		PC_PROPERTY_END	};	// Now create a master context.	// This is the only difference between a master & the slaves : the	// slaves cannot create a context without the help of the master.	// After context creation, there is no difference (capability wise)	// between master and slaves.	{ 		char **hostList = _getHostListC();		//printf("master %s creating context\n", hostList[0]);		PCerr err = pcContextCreateMaster(properties, hostList, hostList[0], &mContext);		PCCHECKERROR("ParaCompMasterPart::createContext", err); 		//printf("master %s ok\n", hostList[0]);		delete []hostList;	}}char **ParaCompMasterPart::_getHostListC() {	size_t hostCount = mHostList.size();	char **hostList = new char*[hostCount+1];	for(size_t i=0;i<hostCount; i++) {		hostList[i] = (char *) mHostList[i].c_str();		//printf("%d %s\n", i, hostList[i]);	}	hostList[hostCount] = 0;		return hostList;}#undef PCCHECKERROR} // namespace MinGLE#endif // MINGLE_PARACOMP_SUPPORT == 1

⌨️ 快捷键说明

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