本文整理汇总了C++中ArrayType::extent方法的典型用法代码示例。如果您正苦于以下问题:C++ ArrayType::extent方法的具体用法?C++ ArrayType::extent怎么用?C++ ArrayType::extent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ArrayType
的用法示例。
在下文中一共展示了ArrayType::extent方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateWavefunctionMultiVectorEpetraMap
Epetra_Map_Ptr CreateWavefunctionMultiVectorEpetraMap(typename Wavefunction<Rank>::Ptr psi, int opRank)
{
typedef blitz::Array<cplx, Rank> ArrayType;
//Create a comm object from wavefunction distribution. Only involves procs with
//data for current operation rank
typename DistributedModel<Rank>::Ptr distr = psi->GetRepresentation()->GetDistributedModel();
Epetra_Comm_Ptr comm = CreateDistributedModelEpetraComm<Rank>(distr, opRank);
//Local size of wavefunction (opRank)
ArrayType data = psi->GetData();
int localSize = data.extent(opRank);
//Get global start idx for opRank
int rankSizeGlobal = psi->GetRepresentation()->GetFullShape()(opRank);
int globalStartIdx = distr->GetLocalStartIndex(rankSizeGlobal, opRank);
//Create index map for local elements (local idx -> global idx)
int* myElems = new int[localSize];
//Setup local->global index map
for (int i=0; i<localSize; i++)
{
myElems[i] = i + globalStartIdx;
}
return Epetra_Map_Ptr( new Epetra_Map(-1, localSize, myElems, 0, *comm) );
}
示例2: begin
/*
* Maps the given wavefunction to one where the particles are exchanged
* psi(1,2) -> psi(2,1)
*/
Wavefunction<3>::Ptr GetWavefunctionParticleExchange(Wavefunction<3>::Ptr psi, list angularSymmetrizationPairs)
{
typedef Array<cplx, 3> ArrayType;
ArrayType data = psi->GetData();
int countr = data.extent(1);
typedef stl_input_iterator<tuple> Iterator;
Iterator begin(angularSymmetrizationPairs);
Iterator end;
Wavefunction<3>::Ptr exchgPsi = psi->Copy();
ArrayType exchgData = exchgPsi->GetData();
for (Iterator i=begin; i!=end; i++)
{
int a1 = extract<int>((*i)[0]);
int a2 = extract<int>((*i)[1]);
for (int r1=0; r1<countr; r1++)
{
for (int r2=0; r2<countr; r2++)
{
exchgData(a1, r1, r2) = data(a2, r2, r1);
}
}
}
return exchgPsi;
}