当前位置: 首页>>代码示例>>C++>>正文


C++ ModelType::getMW方法代码示例

本文整理汇总了C++中ModelType::getMW方法的典型用法代码示例。如果您正苦于以下问题:C++ ModelType::getMW方法的具体用法?C++ ModelType::getMW怎么用?C++ ModelType::getMW使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ModelType的用法示例。


在下文中一共展示了ModelType::getMW方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: sample_theta_vectors_from_count_vectors

void sample_theta_vectors_from_count_vectors() {
	ModelType model;
	model.read(modelF);
	calcExpectedEffectiveLengths<ModelType>(model);


	int num_threads = min(nThreads, nCV);

	buffer = new Buffer(nMB, nSamples, cvlen, tmpF);

	paramsArray = new Params[num_threads];
	threads = new pthread_t[num_threads];

	char inpF[STRLEN];
	for (int i = 0; i < num_threads; i++) {
		paramsArray[i].no = i;
		sprintf(inpF, "%s%d", cvsF, i);
		paramsArray[i].fi = fopen(inpF, "r");
		paramsArray[i].engine = engineFactory::new_engine();
		paramsArray[i].mw = model.getMW();
	}

	/* set thread attribute to be joinable */
	pthread_attr_init(&attr);
	pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);

	for (int i = 0; i < num_threads; i++) {
		rc = pthread_create(&threads[i], &attr, &sample_theta_from_c, (void*)(&paramsArray[i]));
		pthread_assert(rc, "pthread_create", "Cannot create thread " + itos(i) + " (numbered from 0) in sample_theta_vectors_from_count_vectors!");
	}
	for (int i = 0; i < num_threads; i++) {
		rc = pthread_join(threads[i], &status);
		pthread_assert(rc, "pthread_join", "Cannot join thread " + itos(i) + " (numbered from 0) in sample_theta_vectors_from_count_vectors!");
	}

	/* destroy attribute */
	pthread_attr_destroy(&attr);
	delete[] threads;

	for (int i = 0; i < num_threads; i++) {
		fclose(paramsArray[i].fi);
		delete paramsArray[i].engine;
	}
	delete[] paramsArray;

	delete buffer; // Must delete here, force the content left in the buffer be written into the disk

	if (verbose) { printf("Sampling is finished!\n"); }
}
开发者ID:bryopsis,项目名称:trinity,代码行数:49,代码来源:calcCI.cpp


注:本文中的ModelType::getMW方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。