// ------------------------------------------------------------------------ FlipChecker::FlipChecker() { // load the file QString flipFileName = "/home/om0000/Projects/PhDProjectNew/src/ValveTracking/ToFlip.json"; QFile file(flipFileName); file.open(QIODevice::ReadOnly | QIODevice::Text); QJson::Parser parser; QVariantMap data = parser.parse(&file).toMap(); BuildMap(data["coords"].toMap(), m_FlipMap); BuildMap(data["points"].toMap(), m_PointFlipMap); file.close(); }
void FileSystemMap::CreateMap(string const& MountPoint) { fs::path full_path(fs::initial_path<fs::path>()); full_path = fs::system_complete(fs::path(MountPoint)); if (!fs::exists(full_path)) { BOOST_THROW_EXCEPTION( invalid_argument(string(MountPoint).append(" Not found"))); } if (fs::is_directory(full_path)) { BuildMap(full_path); } else { BOOST_THROW_EXCEPTION( invalid_argument( string("Expecting directory, found :").append( full_path.c_str()))); } #ifdef __DEBUG__FSM std::cout << "\n" << FileCount << " files\n" << DirCount << " directories\n" << OtherCount << " others\n" << ErrCount << " errors\n"; #endif return; }
void NaturalNestedDissection ( Int nx, Int ny, Int nz, const DistGraph& graph, DistMap& map, DistSeparator& sep, DistNodeInfo& node, Int cutoff, bool storeFactRecvInds ) { EL_DEBUG_CSE // NOTE: There is a potential memory leak here if sep or info is reused DistMap perm( graph.NumSources(), graph.Comm() ); const Int firstLocalSource = perm.FirstLocalSource(); const Int numLocalSources = perm.NumLocalSources(); for( Int s=0; s<numLocalSources; ++s ) perm.SetLocal( s, s+firstLocalSource ); NaturalNestedDissectionRecursion ( nx, ny, nz, graph, perm, sep, node, 0, cutoff ); // Construct the distributed reordering BuildMap( sep, map ); EL_DEBUG_ONLY(EnsurePermutation(map)) // Run the symbolic analysis Analysis( node, storeFactRecvInds ); }
void NaturalNestedDissection ( Int nx, Int ny, Int nz, const Graph& graph, vector<Int>& map, Separator& sep, NodeInfo& node, Int cutoff ) { EL_DEBUG_CSE // NOTE: There is a potential memory leak here if sep or info is reused const Int numSources = graph.NumSources(); vector<Int> perm( numSources ); for( Int s=0; s<numSources; ++s ) perm[s] = s; NaturalNestedDissectionRecursion ( nx, ny, nz, graph, perm, sep, node, 0, cutoff ); // Construct the distributed reordering BuildMap( sep, map ); EL_DEBUG_ONLY(EnsurePermutation( map )) // Run the symbolic analysis Analysis( node ); }
void HaplotypeKey::Initialize(char ** haplotypes, int start, int stop) { from = to = start; int max = 1; // The first few markers are guaranteed to keep us under the complexity // limit Clear(); while (max < maxUnique && to != stop) { ExtendCodes(haplotypes); max *= 2; } // After enough markers have been added, we must monitor further extensions HashCodes(); while (hash.count <= maxUnique && from - to < 31 && to != stop) { ExtendCodes(haplotypes); HashCodes(); } if (hash.count > maxUnique) { TrimCodes(); HashCodes(); } BuildMap(); }
void Setup() { Universe::SetMapLeftX(20); Universe::SetMapTopY(50); PLAYER_VECTOR::iterator theIterator; for( theIterator = Universe::GetPlayers().begin(); theIterator != Universe::GetPlayers().end(); theIterator++ ) { Player * next = *theIterator; next->SetInitialValuesForNewRound(); } Universe::ClearAndDeleteAll(); BuildMap(); }
/* sets the output format supported by the audio renderer */ void CPCMRemap::SetOutputFormat(unsigned int channels, enum PCMChannels *channelMap, bool ignoreLayout/* = false */) { m_outChannels = channels; m_outSet = channelMap != NULL; m_ignoreLayout = ignoreLayout; if (channelMap) memcpy(m_outMap, channelMap, sizeof(enum PCMChannels) * channels); DumpMap("O", channels, channelMap); BuildMap(); }
/* sets the input format, and returns the requested channel layout */ enum PCMChannels *CPCMRemap::SetInputFormat(unsigned int channels, enum PCMChannels *channelMap, unsigned int sampleSize, unsigned int sampleRate) { m_inChannels = channels; m_inSampleSize = sampleSize; m_sampleRate = (float)sampleRate; m_inSet = channelMap != NULL; if (channelMap) memcpy(m_inMap, channelMap, sizeof(enum PCMChannels) * channels); /* fix me later */ assert(sampleSize == 2); /* get the audio layout, and count the channels in it */ if (!m_bAudio2) m_channelLayout = (enum PCMLayout)g_guiSettings.GetInt("audiooutput.channellayout"); else m_channelLayout = (enum PCMLayout)g_guiSettings.GetInt("audiooutput2.channellayout"); if (m_channelLayout >= PCM_MAX_LAYOUT) m_channelLayout = PCM_LAYOUT_2_0; //spdif only has 2 pcm channels, so don't try to use more if (g_guiSettings.GetInt("audiooutput.mode") == AUDIO_IEC958) { CLog::Log(LOGINFO, "CPCMRemap: Configured speaker layout: %s (iec958)\n", PCMLayoutStr(m_channelLayout).c_str()); m_channelLayout = PCM_LAYOUT_2_0; } else CLog::Log(LOGINFO, "CPCMRemap: Configured speaker layout: %s\n", PCMLayoutStr(m_channelLayout).c_str()); DumpMap("I", channels, channelMap); BuildMap(); /* now remove the empty channels from PCMLayoutMap; * we don't perform upmixing so we want the minimum amount of those */ if (channelMap) { if (!m_outSet) ResolveChannels(); /* Do basic channel resolving to find out the empty channels; * If m_outSet == true, this was done already by BuildMap() above */ int i = 0; for (enum PCMChannels *chan = PCMLayoutMap[m_channelLayout]; *chan != PCM_INVALID; ++chan) if (m_lookupMap[*chan][0].channel != PCM_INVALID) { /* something is mapped here, so add the channel */ m_layoutMap[i++] = *chan; } m_layoutMap[i] = PCM_INVALID; } else memcpy(m_layoutMap, PCMLayoutMap[m_channelLayout], sizeof(PCMLayoutMap[m_channelLayout])); m_attenuation = 1.0; m_attenuationInc = 1.0; m_holdCounter = 0; return m_layoutMap; }
void SwapOperation(INT32T count){ INT32T newEnergy, oldEnergy; InitMap(); BuildMap(); InitLabel(); newEnergy = ComputeEnergy(); oldEnergy = newEnergy + 1; while ((oldEnergy != newEnergy) && (count-- > 0)){ oldEnergy = newEnergy; AlphaBetaSwap(); newEnergy = ComputeEnergy(); } }
/* declares a 2D char array 'map' to hold the level. Calls functions to let the user build a map and write it to a file. */ void Create(void) { char map[22][80]; initscr(); noecho(); Pop(map); Draw(map); BuildMap(map); endwin(); WriteToFile(map); }
void FileSystemMap::BuildMap( fs::path const& FullPathName) { fs::directory_iterator end_iter; for (fs::directory_iterator dir_itr(FullPathName); dir_itr != end_iter; ++dir_itr) { try { if (fs::is_directory(dir_itr->status())) { ++DirCount; #ifdef __DEBUG__FSM std::cout << "entering directory: " << dir_itr->path().filename() << endl; #endif BuildMap(dir_itr->path()); } else if (fs::is_regular_file(dir_itr->status())) { ++FileCount; string s(dir_itr->path().c_str()); #ifdef __DEBUG__FSM std::cout << "\tchunking file #" << FileCount << " " << s << endl; #endif //FileDescType fd(s); auto ap = FileMap.insert(make_pair(s, FileDescType(s))); if (ap.second) //new item was inserted { auto vd = mCntGraph.AddVertex(&ap.first->second); //add the new file to the boost graph as a vertex ap.first->second.VertexDesc((void*)vd); //add shortcut pointer to the vertex descriptor to Fileobj } ChunkFile((*ap.first).second); } else { ++OtherCount; #ifdef __DEBUG__FSM std::cout << "Other found :" << dir_itr->path().filename() << endl; #endif } } catch (const std::exception & ex) { ++ErrCount; std::cout << ex.what() << std::endl; } } return; }
/* sets the input format, and returns the requested channel layout */ enum PCMChannels *CPCMRemap::SetInputFormat(unsigned int channels, enum PCMChannels *channelMap, unsigned int sampleSize, unsigned int sampleRate, PCMLayout layout) { m_inChannels = channels; m_inSampleSize = sampleSize; m_sampleRate = sampleRate; m_inSet = channelMap != NULL; if (channelMap) memcpy(m_inMap, channelMap, sizeof(enum PCMChannels) * channels); /* get the audio layout, and count the channels in it */ m_channelLayout = layout; if (m_channelLayout >= PCM_MAX_LAYOUT) m_channelLayout = PCM_LAYOUT_2_0; DumpMap("I", channels, channelMap); BuildMap(); /* now remove the empty channels from PCMLayoutMap; * we don't perform upmixing so we want the minimum amount of those */ if (channelMap) { if (!m_outSet) ResolveChannels(); /* Do basic channel resolving to find out the empty channels; * If m_outSet == true, this was done already by BuildMap() above */ int i = 0; for (enum PCMChannels *chan = PCMLayoutMap[m_channelLayout]; *chan != PCM_INVALID; ++chan) if (m_lookupMap[*chan][0].channel != PCM_INVALID) { /* something is mapped here, so add the channel */ m_layoutMap[i++] = *chan; } m_layoutMap[i] = PCM_INVALID; } else memcpy(m_layoutMap, PCMLayoutMap[m_channelLayout], sizeof(PCMLayoutMap[m_channelLayout])); m_attenuation = 1.0; m_attenuationInc = 1.0; m_holdCounter = 0; return m_layoutMap; }
void CASW_Map_Builder::Update( float flEngineTime ) { if ( m_bRunningProcess ) { ProcessExecution(); } else if ( m_iBuildStage == STAGE_MAP_BUILD_SCHEDULED ) { if ( m_flStartProcessingTime < flEngineTime ) { BuildMap(); } } else if ( m_iBuildStage == STAGE_VBSP2 ) { UpdateVBSP2Progress(); } else if ( m_iBuildStage == STAGE_GENERATE ) { if ( m_flStartProcessingTime < flEngineTime ) { if ( !m_bStartedGeneration ) { delete m_pGeneratedMapLayout; delete m_pLayoutSystem; m_pLayoutSystem = new CLayoutSystem(); AddListeners( m_pLayoutSystem ); m_pGeneratedMapLayout = new CMapLayout( m_pMissionSettings->MakeCopy() ); if ( !m_pLayoutSystem->LoadFromKeyValues( m_pMissionDefinition ) ) { Log_Warning( LOG_TilegenLayoutSystem, "Failed to load mission from key values definition.\n" ); m_iBuildStage = STAGE_NONE; return; } m_pLayoutSystem->BeginGeneration( m_pGeneratedMapLayout ); m_bStartedGeneration = true; } else { if ( m_pLayoutSystem->IsGenerating() ) { m_pLayoutSystem->ExecuteIteration(); // If an error occurred and this map is randomly generated, try again and hope we get a successful layout this time. if ( m_pLayoutSystem->GenerationErrorOccurred() ) { if ( m_nLevelGenerationRetryCount < tilegen_retry_count.GetInt() && m_pLayoutSystem->IsRandomlyGenerated() ) { // Error generating layout Log_Msg( LOG_TilegenGeneral, "Retrying layout generation...\n" ); m_pGeneratedMapLayout->Clear(); m_pLayoutSystem->BeginGeneration( m_pGeneratedMapLayout ); ++ m_nLevelGenerationRetryCount; } else { Log_Warning( LOG_TilegenGeneral, "Failed to generate valid map layout after %d tries...\n", tilegen_retry_count.GetInt() ); m_iBuildStage = STAGE_NONE; } } } else { Log_Msg( LOG_TilegenGeneral, "Map layout generated\n" ); m_iBuildStage = STAGE_NONE; char layoutFilename[MAX_PATH]; Q_snprintf( layoutFilename, MAX_PATH, "maps\\%s", m_szLayoutName ); m_pGeneratedMapLayout->SaveMapLayout( layoutFilename ); delete m_pGeneratedMapLayout; m_pGeneratedMapLayout = NULL; BuildMap(); } } } } }
CSimpleDlgCtrlResizer::CSimpleDlgCtrlResizer(CWnd& dialog, CPoint center) { BuildMap(&dialog, center); }