本文整理汇总了C++中VectorSpace::comm方法的典型用法代码示例。如果您正苦于以下问题:C++ VectorSpace::comm方法的具体用法?C++ VectorSpace::comm怎么用?C++ VectorSpace::comm使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VectorSpace
的用法示例。
在下文中一共展示了VectorSpace::comm方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: vecMaker
Array<Vector<double> > vecMaker(int nVecs, int n,
int nProc, int rank, const VectorType<double>& vecType)
{
/* This VS will go out of scope when the function is exited, but
* its vectors will remember it */
VectorSpace<double> space
= vecType.createEvenlyPartitionedSpace(MPIComm::world(), n);
Rand::setLocalSeed(space.comm(), 314159);
Array<Vector<double> > rtn(nVecs);
for (int i=0; i<rtn.size(); i++)
{
rtn[i] = space.createMember();
rtn[i].randomize();
}
return rtn;
}
示例2: vecMaker
Array<Vector<double> > vecMaker(int nVecs,
int nProc, int rank, const VectorType<double>& vecType)
{
int n1 = 3;
int n2 = 4;
int n3 = 2;
int n4 = 5;
int n5 = 6;
int n6 = 4;
/* This VS will go out of scope when the function is exited, but
* its vectors will remember it */
VectorSpace<double> vs1
= vecType.createEvenlyPartitionedSpace(MPIComm::world(), n1);
VectorSpace<double> vs2
= vecType.createEvenlyPartitionedSpace(MPIComm::world(), n2);
VectorSpace<double> vs3
= vecType.createEvenlyPartitionedSpace(MPIComm::world(), n3);
VectorSpace<double> vs4
= vecType.createEvenlyPartitionedSpace(MPIComm::world(), n4);
VectorSpace<double> vs5
= vecType.createEvenlyPartitionedSpace(MPIComm::world(), n5);
VectorSpace<double> vs6
= vecType.createEvenlyPartitionedSpace(MPIComm::world(), n6);
VectorSpace<double> vs
= blockSpace(vs1, blockSpace(vs2, blockSpace(vs3, vs4)),
blockSpace(vs5, vs6));
Out::root() << "space = " << vs << endl;
Rand::setLocalSeed(vs.comm(), 314159);
Array<Vector<double> > rtn(nVecs);
for (int i=0; i<rtn.size(); i++)
{
rtn[i] = vs.createMember();
rtn[i].randomize();
}
return rtn;
}