int dynwave_execute(double tStep) // // Input: links = array of topo sorted links indexes // tStep = time step (sec) // Output: returns number of iterations used // Purpose: routes flows through drainage network over current time step. // { int converged; // --- initialize if ( ErrorCode ) return 0; Steps = 0; converged = FALSE; Omega = OMEGA; initRoutingStep(); // --- keep iterating until convergence while ( Steps < MaxTrials ) { // --- execute a routing step & check for nodal convergence initNodeStates(); findLinkFlows(tStep); converged = findNodeDepths(tStep); Steps++; if ( Steps > 1 ) { if ( converged ) break; // --- check if link calculations can be skipped in next step findBypassedLinks(); } } if ( !converged ) NonConvergeCount++; // --- identify any capacity-limited conduits findLimitedLinks(); return Steps; }
MPHFAlgorithm<span,Abundance_t,NodeState_t>::MPHFAlgorithm ( Group& group, const std::string& name, Iterable<Count>* solidCounts, Iterable<Type>* solidKmers, unsigned int nbCores, bool buildOrLoad, IProperties* options ) : Algorithm("mphf", nbCores, options), _group(group), _name(name), _buildOrLoad(buildOrLoad), _dataSize(0), _nb_abundances_above_precision(0), _solidCounts(0), _solidKmers(0), _abundanceMap(0), _nodeStateMap(0), _adjacencyMap(0), _progress(0) { /** We keep a reference on the solid kmers. */ setSolidCounts (solidCounts); /** We keep a reference on the solid kmers. */ setSolidKmers (solidKmers); /** We build the hash object. */ setAbundanceMap (new AbundanceMap()); setNodeStateMap (new NodeStateMap()); setAdjacencyMap (new AdjacencyMap()); /** In case of load, we load the mphf and populate right now. */ if (buildOrLoad == false) { /** We load the hash object from the dedicated storage group. */ { TIME_INFO (getTimeInfo(), "load"); _abundanceMap->load (_group, _name); } /** We populate the abundance hash table. */ populate (); /** init a clean node state map */ initNodeStates (); } }
void MPHFAlgorithm<span,Abundance_t,NodeState_t>::execute () { /** We check whether we can use such a type. */ if (_buildOrLoad == true) { /** We need a progress object. */ tools::dp::IteratorListener* delegate = createIteratorListener(0,""); LOCAL (delegate); setProgress (new ProgressCustom(delegate)); //if MPHF_BOOPHF and verbose 0, give a null progress to the builder, make it understand the internal progress bar of boophf needs to be removed if((typeid(*delegate) == typeid(tools::dp::IteratorListener))) setProgress (0); // get number of threads from dispatcher unsigned int nbThreads = this->getDispatcher()->getExecutionUnitsNumber(); /** We build the hash. */ { TIME_INFO (getTimeInfo(), "build"); _abundanceMap->build (*_solidKmers, nbThreads, _progress); } /** We save the hash object in the dedicated storage group. */ { TIME_INFO (getTimeInfo(), "save"); _dataSize = _abundanceMap->save (_group, _name); } /** We populate the hash table. */ populate (); /** init a clean node state map */ initNodeStates (); } }