本文整理汇总了C++中KSpace::uLast方法的典型用法代码示例。如果您正苦于以下问题:C++ KSpace::uLast方法的具体用法?C++ KSpace::uLast怎么用?C++ KSpace::uLast使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KSpace
的用法示例。
在下文中一共展示了KSpace::uLast方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testCellularGridSpaceND
bool testCellularGridSpaceND()
{
typedef typename KSpace::Cell Cell;
typedef typename KSpace::SCell SCell;
typedef typename KSpace::Point Point;
typedef typename KSpace::DirIterator DirIterator;
typedef typename KSpace::Cells Cells;
typedef typename KSpace::SCells SCells;
unsigned int nbok = 0;
unsigned int nb = 0;
trace.beginBlock ( "Testing block KSpace instantiation and scan ..." );
KSpace K;
int xlow[ 4 ] = { -3, -2, -2, -1 };
int xhigh[ 4 ] = { 5, 3, 2, 3 };
Point low( xlow );
Point high( xhigh );
bool space_ok = K.init( low, high, true );
nbok += space_ok ? 1 : 0;
nb++;
trace.info() << "(" << nbok << "/" << nb << ") "
<< "K.init( low, high )" << std::endl;
trace.info() << "K.dim()=" << K.dimension << endl;
int spel[ 4 ] = { 1, 1, 1, 1 }; // pixel
Point kp( spel );
Cell center = K.uCell( kp );
Cell c1 = K.uCell( kp );
Cell clow = K.uCell( low, kp );
Cell chigh = K.uCell( high, kp );
trace.info() << c1 << clow << chigh
<< " topo(c1)=" << K.uTopology( c1 ) << " dirs=";
for ( DirIterator q = K.uDirs( clow ); q != 0; ++q )
trace.info() << " " << *q;
trace.info() << endl;
Cell f = K.uFirst( c1 );
Cell l = K.uLast( c1 );
trace.info() << "Loop in " << clow << chigh << endl;
c1 = f;
unsigned int nbelems = 0;
do {
++nbelems;
// trace.info() << c1;
} while ( K.uNext( c1, f, l ) );
trace.info() << " -> " << nbelems << " elements." << endl;
unsigned int exp_nbelems = 1;
for ( Dimension i = 0; i < K.dimension; ++i )
exp_nbelems *= K.size( i );
nbok += nbelems == exp_nbelems ? 1 : 0;
nb++;
trace.info() << "(" << nbok << "/" << nb << ") "
<< nbelems << " scanned elements == "
<< exp_nbelems << " space size."
<< std::endl;
trace.endBlock();
trace.beginBlock ( "Testing neighborhoods in KSpace..." );
Cells N = K.uNeighborhood( center );
nbok += N.size() == ( K.dimension*2 + 1 ) ? 1 : 0;
nb++;
trace.info() << "(" << nbok << "/" << nb << ") "
<< N.size() << "(neighborhood size) == "
<< ( K.dimension*2 + 1 ) << "(2*dim()+1)" << endl;
Cells Np = K.uProperNeighborhood( center );
nbok += Np.size() == ( K.dimension*2 ) ? 1 : 0;
nb++;
trace.info() << "(" << nbok << "/" << nb << ") "
<< Np.size() << "(proper neighborhood size) == "
<< ( K.dimension*2 ) << "(2*dim())" << endl;
trace.endBlock();
trace.beginBlock ( "Testing faces in KSpace..." );
Cells Nf = K.uFaces( center );
nbok += Nf.size() == ceil( std::pow( 3.0 ,(int) K.dimension ) - 1 ) ? 1 : 0;
nb++;
trace.info() << "(" << nbok << "/" << nb << ") "
<< Nf.size() << "(faces size) == "
<< floor( std::pow( 3.0, (int)K.dimension ) - 1 ) << "(3^dim()-1)" << endl;
trace.endBlock();
trace.beginBlock ( "Testing block Incidence in KSpace..." );
SCell sspel = K.sCell( kp, K.POS );
for ( DirIterator q1 = K.sDirs( sspel ); q1 != 0; ++q1 )
for ( DirIterator q2 = K.sDirs( sspel ); q2 != 0; ++q2 )
{
if ( *q1 != *q2 )
{
SCell s0 = K.sIncident( sspel, *q1, true );
SCell s1 = K.sIncident( sspel, *q2, true );
SCell l10 = K.sIncident( s0, *q2, true );
SCell l01 = K.sIncident( s1, *q1, true );
trace.info() << "D+_" << *q2 << "(D+_" << *q1 << "(V))=" << l10
<< " D+_" << *q1 << "(D+_" << *q2 << "(V))=" << l01
<< endl;
nbok += l10 == K.sOpp( l01 ) ? 1 : 0;
nb++;
}
}
trace.info() << "(" << nbok << "/" << nb << ") "
<< "anti-commutativity of incidence operators." << std::endl;
trace.endBlock();
//.........这里部分代码省略.........