本文整理汇总了C++中TetrahedralMesh::ConstructRectangularMesh方法的典型用法代码示例。如果您正苦于以下问题:C++ TetrahedralMesh::ConstructRectangularMesh方法的具体用法?C++ TetrahedralMesh::ConstructRectangularMesh怎么用?C++ TetrahedralMesh::ConstructRectangularMesh使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TetrahedralMesh
的用法示例。
在下文中一共展示了TetrahedralMesh::ConstructRectangularMesh方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: archive_dir_base
void Test2DSimulations() throw(Exception)
{
double conductivity_scale = 1;
double h = 0.01; // cm
double ode_time_step = 0.005; //ms
double pde_time_step = 0.01; //ms
unsigned num_stims = 1;
TetrahedralMesh<2,2> mesh;
unsigned num_elem_x = (unsigned)(0.5/h); // num elements to make 5mm
unsigned num_elem_y = (unsigned)(0.5/h); // num elements to make 5mm
//unsigned num_elem_z = (unsigned)(0.15/h);// Num elements to make 0.3cm
double pacing_cycle_length = 350;
double stim_mag = -500000;
double stim_dur = 3;
double area = 0.005;
mesh.ConstructRectangularMesh(num_elem_x, num_elem_y);
mesh.Scale(h,h); // Get mesh into units of cm.
std::string archive_dir_base("LongPostprocessing_archives/archive");
std::string archive_dir_current;
// Setup
HeartConfig::Instance()->SetSimulationDuration(pacing_cycle_length); //ms
HeartConfig::Instance()->SetOutputDirectory("LongPostprocessing");
HeartConfig::Instance()->SetOutputFilenamePrefix("results");
// These lines make postprocessing fast or slow.
HeartConfig::Instance()->SetOdePdeAndPrintingTimeSteps(ode_time_step, pde_time_step, 10); // Leads to 10MB VTK file
//HeartConfig::Instance()->SetOdePdeAndPrintingTimeSteps(ode_time_step, pde_time_step, 0.01); // Leads to 1GB VTK file
HeartConfig::Instance()->SetIntracellularConductivities(Create_c_vector(1.4*conductivity_scale*1.171, 1.4*conductivity_scale*1.171));
HeartConfig::Instance()->SetSurfaceAreaToVolumeRatio(1400.0); // 1/cm
HeartConfig::Instance()->SetCapacitance(1.0); // uF/cm^2
HeartConfig::Instance()->SetVisualizeWithMeshalyzer();
#ifdef CHASTE_VTK
HeartConfig::Instance()->SetVisualizeWithVtk();
#endif
std::vector<std::pair<double,double> > apds_requested;
apds_requested.push_back(std::pair<double, double>(90,-30)); //repolarisation percentage and threshold
HeartConfig::Instance()->SetApdMaps(apds_requested);
// std::vector<double> excitation_threshold;
// excitation_threshold.push_back(-30.0);
// HeartConfig::Instance()->SetUpstrokeTimeMaps(excitation_threshold);
// HeartConfig::Instance()->SetMaxUpstrokeVelocityMaps(excitation_threshold);
for (unsigned stim_counter=0; stim_counter < num_stims; stim_counter++ )
{
// Load problem
MonodomainProblem<2> *p_monodomain_problem;
if (stim_counter==0)
{
PointStimulusCellFactory<2> cell_factory(stim_mag, stim_dur, pacing_cycle_length, area);
p_monodomain_problem = new MonodomainProblem<2>( &cell_factory );
p_monodomain_problem->SetMesh(&mesh);
p_monodomain_problem->Initialise();
}
else
{
p_monodomain_problem = CardiacSimulationArchiver<MonodomainProblem<2> >::Load(archive_dir_current);
}
HeartConfig::Instance()->SetSimulationDuration((double) (stim_counter+1)*pacing_cycle_length); //ms
// set new directories to work from
std::stringstream stringoutput;
stringoutput << stim_counter;
std::string stim_counter_string = stringoutput.str();
archive_dir_current = archive_dir_base + "_" + stim_counter_string;
OutputFileHandler archive_directory(archive_dir_current, true); // Clean a folder for new results
HeartConfig::Instance()->SetOutputFilenamePrefix("results_" + stim_counter_string);
// Solve problem (this does the postprocessing too when HeartConfig options are set).
p_monodomain_problem->Solve();
HeartEventHandler::Headings();
HeartEventHandler::Report();
// Save problem to archive
CardiacSimulationArchiver<MonodomainProblem<2> >::Save(*p_monodomain_problem, archive_dir_current, false);
std::cout << "Archived to " << archive_dir_current << "\n" << std::flush;
// Copy the postprocessing results into the archive folders so they aren't wiped.
std::vector<std::string> files;
files.push_back("Apd_90_minus_30_Map");
// files.push_back("MaxUpstrokeVelocityMap_-30");
// files.push_back("UpstrokeTimeMap_-30");
for (unsigned i=0; i<files.size(); i++)
{
FileFinder file_to_copy(HeartConfig::Instance()->GetOutputDirectory() + "/output/" + files[i] + ".dat", RelativeTo::ChasteTestOutput);
TS_ASSERT(file_to_copy.IsFile());
archive_directory.CopyFileTo(file_to_copy);
}
}// close for loop
}//close void Test2dSimulations