本文整理汇总了C++中DistributedTetrahedralMesh::GetNumHaloNodes方法的典型用法代码示例。如果您正苦于以下问题:C++ DistributedTetrahedralMesh::GetNumHaloNodes方法的具体用法?C++ DistributedTetrahedralMesh::GetNumHaloNodes怎么用?C++ DistributedTetrahedralMesh::GetNumHaloNodes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DistributedTetrahedralMesh
的用法示例。
在下文中一共展示了DistributedTetrahedralMesh::GetNumHaloNodes方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TestNodeExchange
void TestNodeExchange() throw(Exception)
{
HeartConfig::Instance()->Reset();
HeartConfig::Instance()->Reset();
DistributedTetrahedralMesh<1,1> mesh;
mesh.ConstructRegularSlabMesh(0.1, 1.0); // [0,1] with h=0.1, ie 11 node mesh
MyCardiacCellFactory cell_factory;
cell_factory.SetMesh(&mesh);
MonodomainTissue<1> monodomain_tissue( &cell_factory, true );
if ( PetscTools::GetNumProcs() == 1 )
{
TS_ASSERT_EQUALS( mesh.GetNumHaloNodes(), 0u );
}
else
{
if ( PetscTools::AmMaster() || PetscTools::AmTopMost() )
{
TS_ASSERT_EQUALS( mesh.GetNumHaloNodes(), 1u );
}
else
{
TS_ASSERT_EQUALS( mesh.GetNumHaloNodes(), 2u );
}
}
for (DistributedTetrahedralMesh<1,1>::HaloNodeIterator it=mesh.GetHaloNodeIteratorBegin();
it != mesh.GetHaloNodeIteratorEnd();
++it)
{
AbstractCardiacCellInterface* cell = monodomain_tissue.GetCardiacCellOrHaloCell( (*it)->GetIndex() );
TS_ASSERT_DELTA(cell->GetStimulus(0.001),0,1e-10);
}
if ( PetscTools::AmMaster() )
{
// Master owns node 0
AbstractCardiacCellInterface* cell = monodomain_tissue.GetCardiacCellOrHaloCell(0);
TS_ASSERT_DELTA(cell->GetStimulus(0.001), -80.0, 1e-10);
}
else
{
// Zero is not halo owned by any process (unless we have a lot of them).
TS_ASSERT_THROWS_CONTAINS(monodomain_tissue.GetCardiacCellOrHaloCell(0),
"Requested node/halo 0 does not belong to processor ");
}
}