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


C++ Medium::RescaleEnergy_Time方法代码示例

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


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

示例1: main

int main() {

    clock_t start, end;

	Introduction();
	int Time_Selection = ChooseSteadyOrTime();          // 1 for steady state, 2 for time resolved
	numPhotons = HowManyPhotons();

    start = clock();
    Medium * m = new Medium;
    Heat * h = new Heat;

    //  inserting brain layers
    m->CreateCube(0, 0, 0, 10, 10, 10, 0.07, 37.4, 0.977, 1.37);		// adipose tissue @ 700 nm
    //m->CreateBall(1,1,1,1,0.02,9.0,0.89,1.37);
  
    m->CreateCube(1, 1, 0, 8, 8, 8, 0.15, 1.67, 0.7, 1.37);		// AuNR in intralipid
	m->CreateCube(2, 2, 2, 6, 6, 6, 0.045, 29.5, 0.96, 1.37);	// breast carcinoma @ 700nm
    //m->CreateCube(6, 6, 6, 2, 2, 2, 0.08, 40.9, 0.84, 1.37);		// white-matter

    h->AddThermalCoef(m, 2, 3.800, 0.001000, 0.000500, 0);                     // spinus
    h->AddThermalCoef(m, 1, 1.590, 0.001520, 0.000650, 0);                       // bone
    h->AddThermalCoef(m, 3, 3.680, 0.001030, 0.000565, 0);                     // grey-matter 
//	h->AddThermalCoef(m, 4, 3.600, 0.001030, 0.000505);                     // white-matter
    //m->PrintMediumProperties();

    Source * s1 = new Source;
    
    //     for(long i = 0; i < numPhotons; i++)
      //       RunPhotonNew(m, s);

	if (Time_Selection == 2)
	{
		for (long i = 0; i < numThreads; i++)
		{
			myThreads[i] = thread(CreateNewThread_time, m, s1, (long)floor(numPhotons / numThreads));
		}

		for (long i = 0; i < numThreads; i++)
		{
			myThreads[i].join();
		}
		m->RescaleEnergy_Time(numPhotons, time_step);
		WriteAbsorbedEnergyToFile_Time(m);
	}
	else
	{
		for (long i = 0; i < numThreads; i++)
		{
			myThreads[i] = thread(CreateNewThread_steady, m, s1, (long)floor(numPhotons / numThreads));
		}

		for (long i = 0; i < numThreads; i++)
		{
			myThreads[i].join();
		}
		m->RescaleEnergy(numPhotons);
		WriteAbsorbedEnergyToFile(m);

		h->PennesEquation(m,35);
		WriteTemperature(m, h);
	}
	//	Run second pulse
	Source * s2 = new Source;
	/*Prepare_SecondPulse(m, s2, 0.1);
	for (long i = 0; i < numThreads; i++)
	{
		myThreads[i] = thread(CreateNewThread_secondPulse, m, s2, (long)floor(numPhotons / numThreads));
	}

	for (long i = 0; i < numThreads; i++)
	{
		myThreads[i].join();
	}*/

	
	//m->RecordFluence();

	
	// WritePhotonFluenceToFile(m);

	/*m->RescaleEnergy_Time_secondPulse(numPhotons, time_step);
	WriteAbsorbedEnergyToFile_Time_secondPulse(m);*/

    delete m;
	delete s1; delete s2;
    delete h;

    end = clock();

    cout << "Simulation duration was " << (float)(end - start) / CLOCKS_PER_SEC << " seconds." << endl;
    system("pause");
    exit(0);
}
开发者ID:mesicjak,项目名称:PPTT,代码行数:94,代码来源:PPTT_main.cpp


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