Пример #1
0
Crystal::Crystal(QObject *parent_) :
  Avogadro::QtGui::ExtensionPlugin(parent_),
  m_molecule(NULL),
  m_unitCellDialog(NULL),
  m_importCrystalClipboardAction(new QAction(this)),
  m_editUnitCellAction(new QAction(this)),
  m_buildSupercellAction(new QAction(this)),
  m_niggliReduceAction(new QAction(this)),
  m_scaleVolumeAction(new QAction(this)),
  m_standardOrientationAction(new QAction(this)),
  m_toggleUnitCellAction(new QAction(this)),
  m_wrapAtomsToCellAction(new QAction(this))
{
  m_importCrystalClipboardAction->setText(tr("Import Crystal from Clipboard"));
  connect(m_importCrystalClipboardAction, SIGNAL(triggered()),
          SLOT(importCrystalClipboard()));
  m_actions.push_back(m_importCrystalClipboardAction);
  m_importCrystalClipboardAction->setProperty("menu priority", 220);

  // this will be changed when the molecule is set:
  m_toggleUnitCellAction->setText(tr("Toggle Unit Cell"));
  connect(m_toggleUnitCellAction, SIGNAL(triggered()), SLOT(toggleUnitCell()));
  m_actions.push_back(m_toggleUnitCellAction);
  m_toggleUnitCellAction->setProperty("menu priority", 210);

  m_editUnitCellAction->setText(tr("Edit Unit Cell..."));
  connect(m_editUnitCellAction, SIGNAL(triggered()), SLOT(editUnitCell()));
  m_actions.push_back(m_editUnitCellAction);
  m_editUnitCellAction->setProperty("menu priority", 190);

  m_wrapAtomsToCellAction->setText(tr("&Wrap Atoms to Unit Cell"));
  connect(m_wrapAtomsToCellAction, SIGNAL(triggered()),
          SLOT(wrapAtomsToCell()));
  m_actions.push_back(m_wrapAtomsToCellAction);
  m_wrapAtomsToCellAction->setProperty("menu priority", 180);

  m_standardOrientationAction->setText(tr("Rotate to Standard &Orientation"));
  connect(m_standardOrientationAction, SIGNAL(triggered()),
          SLOT(standardOrientation()));
  m_actions.push_back(m_standardOrientationAction);
  m_standardOrientationAction->setProperty("menu priority", 170);

  m_scaleVolumeAction->setText(tr("Scale Cell &Volume"));
  connect(m_scaleVolumeAction, SIGNAL(triggered()), SLOT(scaleVolume()));
  m_actions.push_back(m_scaleVolumeAction);
  m_scaleVolumeAction->setProperty("menu priority", 160);

  m_buildSupercellAction->setText(tr("Build &Supercell"));
  connect(m_buildSupercellAction, SIGNAL(triggered()), SLOT(buildSupercell()));
  m_actions.push_back(m_buildSupercellAction);
  m_buildSupercellAction->setProperty("menu priority", 150);

  m_niggliReduceAction->setText(tr("Reduce Cell (&Niggli)"));
  connect(m_niggliReduceAction, SIGNAL(triggered()), SLOT(niggliReduce()));
  m_actions.push_back(m_niggliReduceAction);
  m_niggliReduceAction->setProperty("menu priority", 140);

  updateActions();
}
int main(int argc, char** argv)
{
	if(argc < 2) { printf("Needs 1 arguement... Try again."); return 0; }

	FILE *fin,*fout;
	clock_t start, end;
	char line[16], res[16];
	int linectr = 0, k, volchange[16], v = 0;
	
	factor = 1.0;
	
	fin 	= fopen(argv[1], "r");
	fout 	= fopen("outLookup", "w");
	
	// Will lower factor every 1/16th step
	for(k = 0; k < 16; volchange[k] = (NUM_ENTRIES/16) * k, k++);
	
	if(fin != NULL) {
		start = clock();
		
		//---------------------------------------------------------------------
		// PROCESSING
		while(fgets(line, 32, fin) != NULL) {
			if(linectr == volchange[v]) { // Reinitializes the array every 1/16th step
				if(linectr > 0) factor -= 0.0625;
				initializeLookup();
				v++;
			}
			
			int16_t scaledvolume = scaleVolume(atoi(line), factor);
			
			// Output to file
			//sprintf(res, "%.3f\t\t%d\n", factor, scaledvolume);
			//fputs(res, fout);
			
			linectr++;
			
			
		}
		//---------------------------------------------------------------------
		
		end = clock();
	
		printf("Program took %fms\n", (double)(end-start)/CLOCKS_PER_SEC);
		
		fclose(fout);
		fclose(fin);
	} else { printf("Check source file parameter. Try again."); }
	
	return 0;
}
Пример #3
0
void Ambient::playCurrentNode(uint32 volume, uint32 fadeOutDelay) {
	if (!fadeOutDelay) fadeOutDelay = 1;

	uint32 node = _vm->_state->getLocationNode();
	uint32 room = _vm->_state->getLocationRoom();
	uint32 age = _vm->_state->getLocationAge();

	// Load sound descriptors
	loadNode(node, room, age);

	// Adjust volume
	scaleVolume(volume);

	// Play sounds
	applySounds(fadeOutDelay);
}
Пример #4
0
Crystal::Crystal(QObject *parent_) :
  Avogadro::QtGui::ExtensionPlugin(parent_),
  m_molecule(NULL),
  m_unitCellDialog(NULL),
  m_editUnitCellAction(new QAction(this)),
  m_niggliReduceAction(new QAction(this)),
  m_scaleVolumeAction(new QAction(this)),
  m_standardOrientationAction(new QAction(this)),
  m_toggleUnitCellAction(new QAction(this)),
  m_wrapAtomsToCellAction(new QAction(this))
{
  // this will be changed when the molecule is set:
  m_toggleUnitCellAction->setText(tr("Toggle Unit Cell"));
  connect(m_toggleUnitCellAction, SIGNAL(triggered()), SLOT(toggleUnitCell()));
  m_actions.push_back(m_toggleUnitCellAction);
  m_toggleUnitCellAction->setProperty("menu priority", -1);

  m_editUnitCellAction->setText(tr("Edit Unit Cell..."));
  connect(m_editUnitCellAction, SIGNAL(triggered()), SLOT(editUnitCell()));
  m_actions.push_back(m_editUnitCellAction);
  m_editUnitCellAction->setProperty("menu priority", -50);

  m_wrapAtomsToCellAction->setText(tr("&Wrap Atoms to Unit Cell"));
  connect(m_wrapAtomsToCellAction, SIGNAL(triggered()),
          SLOT(wrapAtomsToCell()));
  m_actions.push_back(m_wrapAtomsToCellAction);
  m_wrapAtomsToCellAction->setProperty("menu priority", -200);

  m_standardOrientationAction->setText(tr("Rotate to Standard &Orientation"));
  connect(m_standardOrientationAction, SIGNAL(triggered()),
          SLOT(standardOrientation()));
  m_actions.push_back(m_standardOrientationAction);
  m_standardOrientationAction->setProperty("menu priority", -250);

  m_scaleVolumeAction->setText(tr("Scale Cell &Volume"));
  connect(m_scaleVolumeAction, SIGNAL(triggered()), SLOT(scaleVolume()));
  m_actions.push_back(m_scaleVolumeAction);
  m_scaleVolumeAction->setProperty("menu priority", -275);

  m_niggliReduceAction->setText(tr("Reduce Cell (&Niggli)"));
  connect(m_niggliReduceAction, SIGNAL(triggered()), SLOT(niggliReduce()));
  m_actions.push_back(m_niggliReduceAction);
  m_niggliReduceAction->setProperty("menu priority", -350);

  updateActions();
}