本文整理汇总了C++中Lattice::dim方法的典型用法代码示例。如果您正苦于以下问题:C++ Lattice::dim方法的具体用法?C++ Lattice::dim怎么用?C++ Lattice::dim使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Lattice
的用法示例。
在下文中一共展示了Lattice::dim方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
LatticeLevelIterator::LatticeLevelIterator(const Lattice& l)
{
int max;
max=l.max_k() ? l.max_k() : 1;
L=&l;
iter=SimpleIndex(l.dim(),max);
overflow=false;
}
示例2: coordLocal
int Site::coordLocal(int direction)
{
if(direction==lattice_->dim()-1)
{
return index_/lattice_->jump(direction) - lattice_->halo();
}
else if(direction==0)
{
return index_%lattice_->jump(1) - lattice_->halo();
}
else
{
return (index_%lattice_->jump(direction+1)) / lattice_->jump(direction) - lattice_->halo();
}
}
示例3: haloNext
void Site::haloNext()
{
index_++;
//Can only leave boundary by reaching coord(0)=0, so otherwise done
if(coordLocal(0)==0)
{
bool is_in_halo = 0;
for(int i=1; i<lattice_->dim(); i++)
{
if( coordLocal(i)<0 || coordLocal(i)>=lattice_->sizeLocal(i) ) { is_in_halo = 1; break; }
}
if(!is_in_halo) index_ += lattice_->sizeLocal(0);
}
}
示例4: next
void Site::next()
{
index_++;
//If coordLocal(0) != sizeLocal(0) then next site reached
if( coordLocal(0) != lattice_->sizeLocal(0) ) { return; }
else
{
index_ -= lattice_->sizeLocal(0);
for(int i=1; i<lattice_->dim(); i++)
{
index_ += lattice_->jump(i);
//If coordLocal(i) !=sizeLocal(0) then next site reached
if( coordLocal(i) != lattice_->sizeLocal(i) ) { return; }
index_ -= lattice_->sizeLocal(i) * lattice_->jump(i);
}
index_ = lattice_->siteLast() + 1;
}
}
示例5: setCoord
bool Site::setCoord(int* r)
{
this->first();
//Check site is local
if(r[lattice_->dim()-1]<this->coord(lattice_->dim()-1) || r[lattice_->dim()-1]>=this->coord(lattice_->dim()-1)+lattice_->sizeLocal(lattice_->dim()-1)
|| r[lattice_->dim()-2]<this->coord(lattice_->dim()-2) || r[lattice_->dim()-2]>=this->coord(lattice_->dim()-2)+lattice_->sizeLocal(lattice_->dim()-2) )
{
return false;
//COUT<<"LATfield::Site::setCoord(int*) - Site desired non-local!"<<endl;
}
else
{
int jump=0;
for(int i=0; i<lattice_->dim(); i++)
{
jump+=(r[i]-coord(i))*lattice_->jump(i);
}
this->indexAdvance(jump);
return true;
}
}
示例6: coord
int Site::coord(int direction) ////////sensible a quelle dim est scatter (seul modif a faire ici)
{
if(direction<lattice_->dim()-2) { return coordLocal(direction); }
else if (direction==lattice_->dim()-2) {return coordLocal(direction)+lattice_->coordSkip()[1]; }
else {return coordLocal(direction)+lattice_->coordSkip()[0]; }
}