// Step 6 void YsShellExt_DuplicateUtil::AddVolume(YSSIZE_T n,const YsShellExt::VolumeHandle hdArray[]) { for(YSSIZE_T idx=0; idx<n; ++idx) { AddVolume(hdArray[idx],YSFALSE); } }
void IndexServer::_StartWatchingVolumes() { BVolume volume; while (fVolumeRoster.GetNextVolume(&volume) != B_BAD_VALUE) AddVolume(volume); fVolumeRoster.StartWatching(this); }
/* readonly attribute sbIDeviceContent content; */ NS_IMETHODIMP sbMockDevice::GetContent(sbIDeviceContent * *aContent) { nsresult rv; if (!mContent) { nsRefPtr<sbDeviceContent> deviceContent = sbDeviceContent::New(); NS_ENSURE_TRUE(deviceContent, NS_ERROR_OUT_OF_MEMORY); rv = deviceContent->Initialize(); NS_ENSURE_SUCCESS(rv, rv); mContent = deviceContent; // Create a device volume. nsRefPtr<sbBaseDeviceVolume> volume; rv = sbBaseDeviceVolume::New(getter_AddRefs(volume), this); NS_ENSURE_SUCCESS(rv, rv); // Set the volume GUID. char volumeGUID[NSID_LENGTH]; nsID* deviceID; rv = GetId(&deviceID); NS_ENSURE_SUCCESS(rv, rv); deviceID->ToProvidedString(volumeGUID); NS_Free(deviceID); rv = volume->SetGUID(NS_ConvertUTF8toUTF16(volumeGUID)); NS_ENSURE_SUCCESS(rv, rv); // Add the volume. rv = AddVolume(volume); NS_ENSURE_SUCCESS(rv, rv); // Set the primary and default volume. { nsAutoLock autoVolumeLock(mVolumeLock); mPrimaryVolume = volume; mDefaultVolume = volume; } // make a mock library too NS_NAMED_LITERAL_STRING(LIBID, "mock-library.mock-device"); nsCOMPtr<sbIDeviceLibrary> devLib; rv = CreateDeviceLibrary(LIBID, nsnull, getter_AddRefs(devLib)); NS_ENSURE_SUCCESS(rv, rv); // Set the volume device library. rv = volume->SetDeviceLibrary(devLib); NS_ENSURE_SUCCESS(rv, rv); rv = AddLibrary(devLib); NS_ENSURE_SUCCESS(rv, rv); } NS_ADDREF(*aContent = mContent); return NS_OK; }
void nglPathVolume::UpdateVolumes(std::list<nglPathVolume>& rVolumes) { OSErr result; uint volumeIndex = 1; /* Call FSGetVolumeInfo in loop to get all volumes starting with the first */ do { FSVolumeRefNum refnum = 0; result = FSGetVolumeInfo(kFSInvalidVolumeRefNum, volumeIndex, &refnum, kFSVolInfoNone, NULL, NULL, NULL); if ( noErr == result ) { // Found a new volume. AddVolume(rVolumes, refnum); ++volumeIndex; } } while ( noErr == result ); }
// MountRootVolume status_t VolumeManager::MountRootVolume(const char* device, const char* parameters, int32 len, Volume** volume) { // Store the uid/gid of the mounting user -- when running in userland // this is always the owner of the UserlandFS server, but we can't help // that. fMountUID = geteuid(); fMountGID = getegid(); // create the query manager fQueryManager = new(std::nothrow) QueryManager(this); if (!fQueryManager) return B_NO_MEMORY; status_t error = fQueryManager->Init(); if (error != B_OK) return error; // create volumes set fVolumes = new(std::nothrow) VolumeSet; if (!fVolumes) return B_NO_MEMORY; error = fVolumes->InitCheck(); if (error != B_OK) return error; // create node ID to volumes map fNodeIDs2Volumes = new(std::nothrow) NodeIDVolumeMap; if (!fNodeIDs2Volumes) return B_NO_MEMORY; error = fNodeIDs2Volumes->InitCheck(); if (error != B_OK) return error; // create the volume event queue fVolumeEvents = new VolumeEventQueue; if (!fVolumeEvents) return B_NO_MEMORY; error = fVolumeEvents->InitCheck(); if (error != B_OK) return error; // spawn the event deliverer #if USER fEventDeliverer = spawn_thread(&_EventDelivererEntry, "volume event deliverer", B_NORMAL_PRIORITY, this); #else fEventDeliverer = spawn_kernel_thread(&_EventDelivererEntry, "volume event deliverer", B_NORMAL_PRIORITY, this); #endif if (fEventDeliverer < 0) return fEventDeliverer; // create the root volume RootVolume* rootVolume = new(std::nothrow) RootVolume(this); if (!rootVolume) return B_NO_MEMORY; error = rootVolume->Init(); if (error != B_OK) { delete rootVolume; return error; } fRootID = rootVolume->GetRootID(); // add the root volume error = AddVolume(rootVolume); if (error != B_OK) { delete rootVolume; return error; } // mount the root volume error = rootVolume->Mount(device, fMountFlags, (const char*)parameters, len); if (error != B_OK) { rootVolume->SetUnmounting(true); PutVolume(rootVolume); return error; } rootVolume->AcquireReference(); *volume = rootVolume; // run the event deliverer resume_thread(fEventDeliverer); return B_OK; }
void FluidSystem::SPH_CreateExample ( int n, int nmax ) { Vector3DF pos; Vector3DF min, max; Reset ( nmax ); switch ( n ) { case 0: // Wave pool //-- TEST CASE: 2x2x2 grid, 32 particles. NOTE: Set PRADIUS to 0.0004 to reduce wall influence // grid 0: 3*3*2 = 18 particles // grid 1,2: 3*1*2 = 6 particles // grid 3: 1*1*2 = 2 particles // grid 4,5,6: 0 = 0 particles /*m_Vec [ SPH_VOLMIN ].Set ( -2.5, -2.5, 0 ); m_Vec [ SPH_VOLMAX ].Set ( 2.5, 2.5, 5.0 ); m_Vec [ SPH_INITMIN ].Set ( -2.5, -2.5, 0 ); m_Vec [ SPH_INITMAX ].Set ( 2.5, 2.5, 1.6 );*/ m_Vec [ SPH_VOLMIN ].Set ( -30, -30, 0 ); m_Vec [ SPH_VOLMAX ].Set ( 30, 30, 40 ); //m_Vec [ SPH_INITMIN ].Set ( -5, -5, 10 ); //m_Vec [ SPH_INITMAX ].Set ( 5, 5, 20 ); m_Vec [ SPH_INITMIN ].Set ( -20, -26, 10 ); m_Vec [ SPH_INITMAX ].Set ( 20, 26, 40 ); m_Param [ FORCE_XMIN_SIN ] = 12.0; m_Param [ BOUND_ZMIN_SLOPE ] = 0.05; break; case 1: // Dam break m_Vec [ SPH_VOLMIN ].Set ( -30, -14, 0 ); m_Vec [ SPH_VOLMAX ].Set ( 30, 14, 60 ); m_Vec [ SPH_INITMIN ].Set ( 0, -13, 0 ); m_Vec [ SPH_INITMAX ].Set ( 29, 13, 30 ); m_Vec [ PLANE_GRAV_DIR ].Set ( 0.0, 0, -9.8 ); break; case 2: // Dual-Wave pool m_Vec [ SPH_VOLMIN ].Set ( -60, -5, 0 ); m_Vec [ SPH_VOLMAX ].Set ( 60, 5, 50 ); m_Vec [ SPH_INITMIN ].Set ( -46, -5, 0 ); m_Vec [ SPH_INITMAX ].Set ( 46, 5, 15 ); m_Param [ FORCE_XMIN_SIN ] = 8.0; m_Param [ FORCE_XMAX_SIN ] = 8.0; m_Vec [ PLANE_GRAV_DIR ].Set ( 0.0, 0, -9.8 ); break; case 3: // Swirl Stream m_Vec [ SPH_VOLMIN ].Set ( -30, -30, 0 ); m_Vec [ SPH_VOLMAX ].Set ( 30, 30, 50 ); m_Vec [ SPH_INITMIN ].Set ( -30, -30, 0 ); m_Vec [ SPH_INITMAX ].Set ( 30, 30, 40 ); m_Vec [ EMIT_POS ].Set ( -20, -20, 22 ); m_Vec [ EMIT_RATE ].Set ( 1, 4, 0 ); m_Vec [ EMIT_ANG ].Set ( 0, 120, 1.5 ); m_Vec [ EMIT_DANG ].Set ( 0, 0, 0 ); m_Vec [ PLANE_GRAV_DIR ].Set ( 0.0, 0, -9.8 ); break; case 4: // Shockwave m_Vec [ SPH_VOLMIN ].Set ( -60, -15, 0 ); m_Vec [ SPH_VOLMAX ].Set ( 60, 15, 50 ); m_Vec [ SPH_INITMIN ].Set ( -59, -14, 0 ); m_Vec [ SPH_INITMAX ].Set ( 59, 14, 30 ); m_Vec [ PLANE_GRAV_DIR ].Set ( 0.0, 0, -9.8 ); m_Toggle [ WALL_BARRIER ] = true; m_Toggle [ WRAP_X ] = true; break; case 5: // Zero gravity m_Vec [ SPH_VOLMIN ].Set ( -40, -40, 0 ); m_Vec [ SPH_VOLMAX ].Set ( 40, 40, 50 ); m_Vec [ SPH_INITMIN ].Set ( -20, -20, 20 ); m_Vec [ SPH_INITMAX ].Set ( 20, 20, 40 ); m_Vec [ EMIT_POS ].Set ( -20, 0, 40 ); m_Vec [ EMIT_RATE ].Set ( 2, 1, 0 ); m_Vec [ EMIT_ANG ].Set ( 0, 120, 0.25 ); m_Vec [ PLANE_GRAV_DIR ].Set ( 0, 0, 0 ); m_Param [ SPH_INTSTIFF ] = 0.20; break; case 6: // Point gravity m_Vec [ SPH_VOLMIN ].Set ( -40, -40, 0 ); m_Vec [ SPH_VOLMAX ].Set ( 40, 40, 50 ); m_Vec [ SPH_INITMIN ].Set ( -20, -20, 20 ); m_Vec [ SPH_INITMAX ].Set ( 20, 20, 40 ); m_Param [ SPH_INTSTIFF ] = 0.50; m_Vec [ EMIT_POS ].Set ( -20, 20, 25 ); m_Vec [ EMIT_RATE ].Set ( 1, 4, 0 ); m_Vec [ EMIT_ANG ].Set ( -20, 100, 2.0 ); m_Vec [ POINT_GRAV_POS ].Set ( 0, 0, 25 ); m_Vec [ PLANE_GRAV_DIR ].Set ( 0, 0, 0 ); m_Param [ POINT_GRAV ] = 3.5; break; case 7: // Levy break m_Vec [ SPH_VOLMIN ].Set ( -40, -40, 0 ); m_Vec [ SPH_VOLMAX ].Set ( 40, 40, 50 ); m_Vec [ SPH_INITMIN ].Set ( 10, -40, 0 ); m_Vec [ SPH_INITMAX ].Set ( 40, 40, 50 ); m_Vec [ EMIT_POS ].Set ( 34, 27, 16.6 ); m_Vec [ EMIT_RATE ].Set ( 2, 9, 0 ); m_Vec [ EMIT_ANG ].Set ( 118, 200, 1.0 ); m_Toggle [ LEVY_BARRIER ] = true; m_Param [ BOUND_ZMIN_SLOPE ] = 0.1; m_Vec [ PLANE_GRAV_DIR ].Set ( 0.0, 0, -9.8 ); break; case 8: // Drain m_Vec [ SPH_VOLMIN ].Set ( -20, -20, 0 ); m_Vec [ SPH_VOLMAX ].Set ( 20, 20, 50 ); m_Vec [ SPH_INITMIN ].Set ( -15, -20, 20 ); m_Vec [ SPH_INITMAX ].Set ( 20, 20, 50 ); m_Vec [ EMIT_POS ].Set ( -16, -16, 30 ); m_Vec [ EMIT_RATE ].Set ( 1, 4, 0 ); m_Vec [ EMIT_ANG ].Set ( -20, 140, 1.8 ); m_Toggle [ DRAIN_BARRIER ] = true; m_Vec [ PLANE_GRAV_DIR ].Set ( 0.0, 0, -9.8 ); break; case 9: // Tumbler m_Vec [ SPH_VOLMIN ].Set ( -30, -30, 0 ); m_Vec [ SPH_VOLMAX ].Set ( 30, 30, 50 ); m_Vec [ SPH_INITMIN ].Set ( 24, -29, 20 ); m_Vec [ SPH_INITMAX ].Set ( 29, 29, 40 ); m_Param [ SPH_VISC ] = 0.1; m_Param [ SPH_INTSTIFF ] = 0.50; m_Param [ SPH_EXTSTIFF ] = 8000; //m_Param [ SPH_SMOOTHRADIUS ] = 0.01; m_Param [ BOUND_ZMIN_SLOPE ] = 0.4; m_Param [ FORCE_XMIN_SIN ] = 12.00; m_Vec [ PLANE_GRAV_DIR ].Set ( 0.0, 0, -9.8 ); break; case 10: // Large sim m_Vec [ SPH_VOLMIN ].Set ( -35, -35, 0 ); m_Vec [ SPH_VOLMAX ].Set ( 35, 35, 60 ); m_Vec [ SPH_INITMIN ].Set ( -5, -35, 0 ); m_Vec [ SPH_INITMAX ].Set ( 30, 0, 60 ); m_Vec [ PLANE_GRAV_DIR ].Set ( 0.0, 0, -9.8 ); break; } SPH_ComputeKernels (); m_Param [ SPH_SIMSIZE ] = m_Param [ SPH_SIMSCALE ] * (m_Vec[SPH_VOLMAX].z - m_Vec[SPH_VOLMIN].z); m_Param [ SPH_PDIST ] = pow ( m_Param[SPH_PMASS] / m_Param[SPH_RESTDENSITY], 1/3.0 ); float ss = m_Param [ SPH_PDIST ]*0.87 / m_Param[ SPH_SIMSCALE ]; printf ( "Spacing: %f\n", ss); AddVolume ( m_Vec[SPH_INITMIN], m_Vec[SPH_INITMAX], ss ); // Create the particles float cell_size = m_Param[SPH_SMOOTHRADIUS]*2.0; // Grid cell size (2r) Grid_Setup ( m_Vec[SPH_VOLMIN], m_Vec[SPH_VOLMAX], m_Param[SPH_SIMSCALE], cell_size, 1.0 ); // Setup grid Grid_InsertParticles (); // Insert particles Vector3DF vmin, vmax; vmin = m_Vec[SPH_VOLMIN]; vmin -= Vector3DF(2,2,2); vmax = m_Vec[SPH_VOLMAX]; vmax += Vector3DF(2,2,-2); #ifdef BUILD_CUDA FluidClearCUDA (); Sleep ( 500 ); FluidSetupCUDA ( NumPoints(), sizeof(Fluid), *(float3*)& m_GridMin, *(float3*)& m_GridMax, *(float3*)& m_GridRes, *(float3*)& m_GridSize, (int) m_Vec[EMIT_RATE].x ); Sleep ( 500 ); FluidParamCUDA ( m_Param[SPH_SIMSCALE], m_Param[SPH_SMOOTHRADIUS], m_Param[SPH_PMASS], m_Param[SPH_RESTDENSITY], m_Param[SPH_INTSTIFF], m_Param[SPH_VISC] ); #endif }
wxTreeItemId BFBackupTree::AddDestination (const wxString& strPath) { wxTreeItemId idLast, idCurr; wxString strCurr, strCurrFilled, strAdd; wxStringTokenizer tkz(strPath, wxFILE_SEP_PATH); idLast = GetRootItem(); while ( tkz.HasMoreTokens() ) { idCurr = idLast; strCurr = tkz.GetNextToken(); strCurrFilled = strCurr; if (bFillBlackfiskPlaceholders_) BFBackup::FillBlackfiskPlaceholders(strCurrFilled); idLast = FindItem(idCurr, strCurrFilled, false); // does the item exists if ( idLast.IsOk() ) { idCurr = idLast; continue; } // the current path, stored behind the adding item strAdd = strPath.Left(strPath.Find(strCurr) + strCurr.Len()); // ** it is a volume ** if (strCurrFilled.Len() > 1 && strCurrFilled[1] == _T(':')) { // append the volume item idLast = AddVolume(idCurr, strCurr, strAdd); continue; } // ** it is a directory ** idLast = AppendItem ( idCurr, strCurrFilled, -1, -1, new BFBackupTreeItemData ( BFInvalidOID, strAdd) ); if ( wxDir::Exists(strAdd) ) { SetItemImage(idLast, BFIconTable::folder, wxTreeItemIcon_Normal); SetItemImage(idLast, BFIconTable::folder_open, wxTreeItemIcon_Expanded); } else { SetItemImage(idLast, BFIconTable::folder_virtual, wxTreeItemIcon_Normal); SetItemImage(idLast, BFIconTable::folder_virtual_open, wxTreeItemIcon_Expanded); } } // while(token) return idLast; }