//! Initializes new core base. CoreBase::CoreBase( VaultCore* owner, QObject* parent ) : QObject( 0 ), m_vault( owner ), m_rest( 0 ), m_state( Initializing ) { Q_CHECK_PTR( m_vault ); // Transfer to correct thread. if( parent != 0 && owner->thread() != parent->thread() ) qCritical( "Owner and parent must live in the same thread." ); this->moveToThread( owner->thread() ); if( parent != 0 ) this->setParent( parent ); // Initialize the core. initializeBase( parent ); }
bool ossimTilingPoly::initialize(const ossimMapProjection& proj, const ossimIrect& boundingRect) { bool result = false; if(traceDebug()) { ossimNotify(ossimNotifyLevel_DEBUG) << "ossimTilingPoly::initialize DEBUG: Entered..." << "\nBounding rect === " << boundingRect << std::endl; } ossimDpt convertedTilingDistance = theTilingDistance; result = initializeBase(proj, boundingRect, convertedTilingDistance); if (result) { return parseShpFile(); } return result; }
SceneEditor::SceneEditor( Model& scene ) : BaseSceneEditor( scene ) , m_scene( scene ) { initializeBase( m_scene.getRoot(), &m_scene ); }
BOOLEAN randomSchreier( PermGroup *const G, RandomSchreierOptions rOptions) { Unsigned noOfOriginalGens, successCount, level, finalLevel, nonInvolRejectCount, levelLowestOrder; unsigned long curOrder, lowestOrder; Permutation **originalGen; FactoredInt trueGroupOrder, factoredOrbLen; Permutation *gen; Permutation *randGen = newIdentityPerm( G->degree), *h = newUndefinedPerm( G->degree), *lowestOrderH = newUndefinedPerm( G->degree), *tempPerm; /* Set defaults for options. */ if ( rOptions.initialSeed == 0 ) rOptions.initialSeed = 47; if ( rOptions.minWordLengthIncrement == UNKNOWN ) rOptions.minWordLengthIncrement = 7; if ( rOptions.maxWordLengthIncrement == UNKNOWN ) rOptions.maxWordLengthIncrement = 23; if ( rOptions.stopAfter == UNKNOWN ) if ( G->order ) rOptions.stopAfter = 10000; else rOptions.stopAfter = 40; if ( rOptions.reduceGenOrder == UNKNOWN ) rOptions.reduceGenOrder = TRUE; if ( rOptions.rejectNonInvols == UNKNOWN ) rOptions.rejectNonInvols = 0; if ( rOptions.rejectHighOrder == UNKNOWN ) rOptions.rejectHighOrder = 0; if ( rOptions.onlyEssentialInitGens == UNKNOWN ) rOptions.onlyEssentialInitGens = FALSE; if ( rOptions.onlyEssentialAddedGens == UNKNOWN ) rOptions.onlyEssentialAddedGens = TRUE; /* Initialize seed. */ initializeSeed( rOptions.initialSeed); /* Check that fields of G that must be null initially actually are. Then allocate these fields. */ if ( G->base || G->basicOrbLen || G->basicOrbit || G->schreierVec ) ERROR( "randschr", "A group field that must be null initially was " "nonnull.") G->base = allocIntArrayBaseSize(); G->basicOrbLen = allocIntArrayBaseSize(); G->basicOrbit = (UnsignedS **) allocPtrArrayBaseSize(); G->schreierVec = (Permutation ***) allocPtrArrayBaseSize(); /* If the true group order is known, set trueGroupOrder to it. Otherwise allocate G->order and mark trueGroupOrder as undefined (i.e., noOfFactors == UNKNOWN). Then set G->order to 1. */ if ( G->order ) trueGroupOrder = *G->order; else { G->order = allocFactoredInt(); trueGroupOrder.noOfFactors = UNKNOWN; } G->order->noOfFactors = 0; /* Delete identity generators from G if present. Return immediately if G is the identity group. */ removeIdentityGens( G); if ( !G->generator) { /* Should we allocate G->base, etc??? */ G->baseSize = 0; return TRUE; } /* Adjoin an inverse image array to each permutation if absent. */ adjoinGenInverses( G); /* Choose an initial segment of the base so that each generator moves some base point. */ initializeBase( G); /* Here we allocate and construct an array of pointers to the original generators. */ noOfOriginalGens = 0; originalGen = allocPtrArrayDegree(); for ( gen = G->generator ; gen ; gen = gen->next ) originalGen[++noOfOriginalGens] = gen; /* Fill in the level of each generator, and make each generator essential at its level and above. (????) */ for ( gen = G->generator ; gen ; gen = gen->next ) { gen->level = levelIn( G, gen); MAKE_NOT_ESSENTIAL_ALL( gen); for ( level = 1 ; level <= gen->level ; ++level ) MAKE_ESSENTIAL_AT_LEVEL( gen, level); } /* Construct the orbit length, basic orbit, and Schreier vector arrays. Set G->order (previously allocated) to the product of the basic orbit lengths. */ G->order->noOfFactors = 0; for ( level = 1 ; level <= G->baseSize ; ++level ) { G->basicOrbLen[level] = 1; G->basicOrbit[level] = allocIntArrayDegree(); G->schreierVec[level] = allocPtrArrayDegree(); if ( rOptions.onlyEssentialInitGens ) constructBasicOrbit( G, level, "FindEssential"); else constructBasicOrbit( G, level, "AllGensAtLevel" ); } /* The variable successCount will count the number of consecutive times the quasi-random group element can be factored successfully. */ successCount = 0; nonInvolRejectCount = 0; while ( successCount < rOptions.stopAfter && (trueGroupOrder.noOfFactors == UNKNOWN || !factEqual( G->order, &trueGroupOrder)) ) { randomizeGen( noOfOriginalGens, originalGen, rOptions.minWordLengthIncrement, rOptions.maxWordLengthIncrement, randGen); if ( factorGroupElt( G, randGen, h, &finalLevel) ) ++successCount; else { successCount = 0; if ( rOptions.reduceGenOrder ) replaceByPower( G, finalLevel, h); if ( nonInvolRejectCount >= rOptions.rejectNonInvols || isInvolution( h) ) { if ( nonInvolRejectCount > 0 && (lowestOrder < (curOrder = permOrder(h)) || lowestOrder == curOrder && levelLowestOrder > finalLevel) ) { tempPerm = h; h = lowestOrderH; lowestOrderH = tempPerm; finalLevel = levelLowestOrder; } if ( finalLevel == G->baseSize+1 ) { if ( G->baseSize >= options.maxBaseSize ) ERROR1i( "initializeBase", "Base size exceeded maximum of ", options.maxBaseSize, ". Rerun with -mb option.") G->base[++G->baseSize] = pointMovedBy( h); G->basicOrbLen[G->baseSize] = 1; G->basicOrbit[G->baseSize] = allocIntArrayDegree(); G->schreierVec[G->baseSize] = allocPtrArrayDegree(); } assignGenName( G, h); addStrongGenerator( G, h, FALSE); h = newUndefinedPerm( G->degree); nonInvolRejectCount = 0; } else { curOrder = permOrder( h); if ( curOrder == 0 ) curOrder = ULONG_MAX; if ( nonInvolRejectCount == 0 || curOrder < lowestOrder || (curOrder == lowestOrder && finalLevel > levelLowestOrder) ) { copyPermutation( h, lowestOrderH); lowestOrder = curOrder; levelLowestOrder = finalLevel; } ++nonInvolRejectCount; } } } freePtrArrayDegree( originalGen); deletePermutation( randGen); deletePermutation( h); deletePermutation( lowestOrderH); return trueGroupOrder.noOfFactors != UNKNOWN && factEqual( G->order, &trueGroupOrder); }