本文整理汇总了C++中teuchos::RCP::MaxNumIndices方法的典型用法代码示例。如果您正苦于以下问题:C++ RCP::MaxNumIndices方法的具体用法?C++ RCP::MaxNumIndices怎么用?C++ RCP::MaxNumIndices使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类teuchos::RCP
的用法示例。
在下文中一共展示了RCP::MaxNumIndices方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
// quad tests
TEUCHOS_UNIT_TEST(tEpetraLinearObjFactory, buildTest_quad)
{
// build global (or serial communicator)
#ifdef HAVE_MPI
stk::ParallelMachine Comm = MPI_COMM_WORLD;
Teuchos::RCP<Epetra_Comm> eComm = Teuchos::rcp(new Epetra_MpiComm(MPI_COMM_WORLD));
#else
stk::ParallelMachine Comm = WHAT_TO_DO_COMM;
Teuchos::RCP<Epetra_Comm> eComm = Teuchos::rcp(new Epetra_SerialComm());
#endif
int numProcs = stk::parallel_machine_size(Comm);
int myRank = stk::parallel_machine_rank(Comm);
TEUCHOS_ASSERT(numProcs<=2);
// build a geometric pattern from a single basis
RCP<const panzer::FieldPattern> patternC1
= buildFieldPattern<Intrepid::Basis_HGRAD_QUAD_C1_FEM<double,FieldContainer> >();
RCP<panzer::ConnManager<int,int> > connManager = buildQuadMesh(Comm,2,2,1,1);
RCP<panzer::DOFManager<int,int> > dofManager = rcp(new panzer::DOFManager<int,int>());
dofManager->setConnManager(connManager,MPI_COMM_WORLD);
dofManager->addField("u",patternC1);
dofManager->buildGlobalUnknowns();
panzer::EpetraLinearObjFactory<panzer::Traits,int> laFactory(eComm.getConst(),dofManager);
Teuchos::RCP<Epetra_Map> map = laFactory.getMap();
Teuchos::RCP<Epetra_Map> gMap = laFactory.getGhostedMap();
Teuchos::RCP<Epetra_CrsGraph> graph = laFactory.getGraph();
Teuchos::RCP<Epetra_CrsGraph> gGraph = laFactory.getGhostedGraph();
std::vector<int> owned,ownedAndShared;
dofManager->getOwnedIndices(owned);
dofManager->getOwnedAndSharedIndices(ownedAndShared);
// test maps
{
TEST_EQUALITY(map->NumMyElements(),(int) owned.size());
TEST_EQUALITY(gMap->NumMyElements(),(int) ownedAndShared.size());
// test indices
for(std::size_t i=0;i<owned.size();i++) TEST_ASSERT(map->MyGID(owned[i]));
for(std::size_t i=0;i<ownedAndShared.size();i++) TEST_ASSERT(gMap->MyGID(ownedAndShared[i]));
}
// test ograph
{
TEST_ASSERT(gGraph->Filled());
TEST_EQUALITY(gGraph->NumMyRows(),(int) ownedAndShared.size());
TEST_EQUALITY(gGraph->MaxNumIndices(),numProcs==2 ? 6 : 9);
std::vector<int> indices(10);
int numIndices = 0;
// Take degree of freedom in middle of mesh: Then look at ghosted graph
int err = gGraph->ExtractGlobalRowCopy(5,10,numIndices,&indices[0]);
TEST_EQUALITY(err,0);
indices.resize(numIndices);
std::sort(indices.begin(),indices.end());
if(numProcs==1) {
TEST_EQUALITY(numIndices,9);
std::vector<int> compare(9);
compare[0] = 0; compare[1] = 1; compare[2] = 2;
compare[3] = 3; compare[4] = 4; compare[5] = 5;
compare[3] = 6; compare[4] = 7; compare[5] = 8;
TEST_EQUALITY(compare.size(),indices.size());
TEST_ASSERT(std::equal(compare.begin(),compare.end(),indices.begin()));
}
else if(numProcs==2 && myRank==0) {
TEST_EQUALITY(numIndices,6);
std::vector<int> compare(6);
compare[0] = 0; compare[1] = 1; compare[2] = 2;
compare[3] = 3; compare[4] = 5; compare[5] = 7;
TEST_EQUALITY(compare.size(),indices.size());
TEST_ASSERT(std::equal(compare.begin(),compare.end(),indices.begin()));
}
else if(numProcs==2 && myRank==1) {
TEST_EQUALITY(numIndices,6);
std::vector<int> compare(6);
compare[0] = 3; compare[1] = 4; compare[2] = 5;
compare[3] = 6; compare[4] = 7; compare[5] = 8;
TEST_EQUALITY(compare.size(),indices.size());
TEST_ASSERT(std::equal(compare.begin(),compare.end(),indices.begin()));
}
}
// test graph
{
TEST_ASSERT(graph->Filled());
//.........这里部分代码省略.........