Ejemplo n.º 1
0
//-----------------------------------------------------------------------------
void StamFluidSolver::vel_step ( float * u, float * v, float * u0, float * v0, float visc, float dt )
{
    addSource ( u, u0, dt );
    addSource ( v, v0, dt );

#if (VORTICITY_CONFINEMENT == 1)
    if(mUseVorticityConfinement)
    {
        // add in vorticity confinement force
        vorticityConfinement(u0, v0);
        addSource ( u, u0, dt );
        addSource ( v, v0, dt );
    }
#endif

#if 0
    // add in temperature force
    if(mSimulateTemperature)
    {
        heatRise(v0);
        addSource ( v, v0, dt );
    }
#endif

    SWAP ( u0, u );
    diffuse ( 1, u, u0, visc, dt );
    SWAP ( v0, v );
    diffuse ( 2, v, v0, visc, dt );
    project ( u, v, u0, v0 );
    SWAP ( u0, u );
    SWAP ( v0, v );
    advect ( 1, u, u0, u0, v0, dt );
    advect ( 2, v, v0, u0, v0, dt );
    project ( u, v, u0, v0 );
}
Ejemplo n.º 2
0
bool AppsEngine::sourceRequestEvent(const QString &name)
{
    if (containerForSource(name)) {
        return true;
    }

    if (name.startsWith(QLatin1String("Apps"))) {
        AppSource *appSource = new AppSource(name, this);
        addSource(appSource);
        return true;
    } else if (name.startsWith(QLatin1String("Categories"))) {
        CategoriesSource *catSource = new CategoriesSource(name, this);
        addSource(catSource);
        return true;
    } else if (name.startsWith(QLatin1String("Groups"))) {
        GroupsSource *grpsSource = new GroupsSource(name, this);
        addSource(grpsSource);
        return true;
    } else if (name.startsWith(QLatin1String("Group"))) {
        GroupSource *grpSource = new GroupSource(name, this);
        addSource(grpSource);
        return true;
    }

    return false;
}
Ejemplo n.º 3
0
InstSelect::InstSelect(Cfg *Func, Variable *Dest, Operand *Condition,
                       Operand *SourceTrue, Operand *SourceFalse)
    : Inst(Func, Inst::Select, 3, Dest) {
  assert(Condition->getType() == IceType_i1);
  addSource(Condition);
  addSource(SourceTrue);
  addSource(SourceFalse);
}
Ejemplo n.º 4
0
void KimpanelEngine::init()
{
    m_panelAgent = new PanelAgent(this);
    KimpanelInputPanelContainer* inputpanelSource = new KimpanelInputPanelContainer(this, m_panelAgent);
    inputpanelSource->setObjectName(INPUTPANEL_SOURCE_NAME);
    KimpanelStatusBarContainer* statusbarSource = new KimpanelStatusBarContainer(this, m_panelAgent);
    statusbarSource->setObjectName(STATUSBAR_SOURCE_NAME);
    addSource(inputpanelSource);
    addSource(statusbarSource);
    this->m_panelAgent->created();
}
	void FluidSolver::update() {
		addSource(uv, uvOld);
		
		if( doVorticityConfinement )
		{
			vorticityConfinement(uvOld);
			addSource(uv, uvOld);
		}
		
		SWAP(uv, uvOld);
		
		diffuseUV( viscocity );
		
		project(uv, uvOld);
		
		SWAP(uv, uvOld);
		
		advect2d(uv, uvOld);
		
		project(uv, uvOld);
		
		if(doRGB)
		{
			addSource(color, colorOld);
			SWAP(color, colorOld);
			
			if( colorDiffusion!=0. && deltaT!=0. )
			{
				diffuseRGB(0, colorDiffusion );
				SWAP(color, colorOld);
			}
			
			advectRGB(0, uv);
			fadeRGB();
		} 
		else
		{
			addSource(density, densityOld);
			SWAP(density, densityOld);
			
			if( colorDiffusion!=0. && deltaT!=0. ) {
				diffuse(0, density, densityOld, colorDiffusion );
				SWAP(density, densityOld);
			}
			
			advect(0, density, densityOld, uv);	
			fadeDensity();
		}
	}
Ejemplo n.º 6
0
void MediaStreamDescriptor::addRemoteSource(MediaStreamSource* source)
{
    if (m_client)
        m_client->addRemoteSource(source);
    else
        addSource(source);
}
Ejemplo n.º 7
0
bool DataContainersEngine::sourceRequestEvent(const QString &source)
{
    // This engine will fetch webpages over http. First thing we do is check
    // the source to make sure it is indeed an http URL.
    KUrl url(source);
    kDebug() << "goin to fetch" << source << url << url.protocol();
    if (!url.protocol().startsWith("http", Qt::CaseInsensitive)) {
        return false;
    }

    // Create a HttpContainer, which is a subclass of Plasma::DataContainer
    HttpContainer *container = new HttpContainer(url, this);

    // Set the object name to be the same as the source name; DataEngine
    // relies on this to identify the container. This could also be done
    // in HttpContainer's constructor, but for the sake of this example
    // we're dong it here to show that it must be done *before* the
    // DataContainer subclass is passed to addSource
    container->setObjectName(source);

    // Now we tell Plasma::DataEngine about this new container
    addSource(container);

    // Since we successfully set up the source, return true
    return true;
}
Ejemplo n.º 8
0
 foreach (JobView *jobView, m_pendingJobs) {
     if (jobView->state() == JobView::Stopped) {
         delete jobView;
     } else {
         addSource(jobView);
     }
 }
Ejemplo n.º 9
0
InstAlloca::InstAlloca(Cfg *Func, Operand *ByteCount, uint32_t AlignInBytes,
                       Variable *Dest)
    : Inst(Func, Inst::Alloca, 1, Dest), AlignInBytes(AlignInBytes) {
  // Verify AlignInBytes is 0 or a power of 2.
  assert(AlignInBytes == 0 || llvm::isPowerOf2_32(AlignInBytes));
  addSource(ByteCount);
}
Ejemplo n.º 10
0
 void Reader::init(const int& position_in_file,const int& position_in_buffer)
 {
   alGenSources(1,&m_source) ;
   m_stream->init(m_source,position_in_file,position_in_buffer,m_is_event) ;
   addSource() ;
   m_is_initialised = true ;
 }
Ejemplo n.º 11
0
Shader& Shader::addFile(const std::string& filename) {
    CORRADE_ASSERT(Utility::Directory::fileExists(filename),
        "Shader file " << '\'' + filename + '\'' << " cannot be read.", *this);

    addSource(Utility::Directory::readString(filename));
    return *this;
}
Ejemplo n.º 12
0
bool UniPAX::PublicationXref::setAttribute(std::string& attribute, std::string& value, PersistenceManager& manager) {

	if (UniPAX::Xref::setAttribute(attribute, value, manager))
		return true;

	if (boost::iequals(attribute,"url"))
	{
		addUrl(value);
		return true;
	}
	if (boost::iequals(attribute,"title"))
	{
		setTitle(value);
		return true;
	}
	if (boost::iequals(attribute,"source"))
	{
		addSource(value);
		return true;
	}
	if (boost::iequals(attribute,"author"))
	{
		addAuthor(value);
		return true;
	}
	if (boost::iequals(attribute,"year"))
	{
		return (PersistenceManager::convertAttribute(value,year));
	}

	return false;

}
Ejemplo n.º 13
0
GenericGraphNode::GenericGraphNode(Widget *parent, Graph *parentGraph, const std::string &title) :
    GraphNode(parent, parentGraph, title)
{
    Source *source = new Source(this, mParentGraph, "Output");
    source->setId(fmt::format("{}GraphNodeSource", title));
    addSource(source);
}
Ejemplo n.º 14
0
void Style::setJSON(const std::string& json, const std::string&) {
    sources.clear();
    layers.clear();

    rapidjson::GenericDocument<rapidjson::UTF8<>, rapidjson::CrtAllocator> doc;
    doc.Parse<0>((const char *const)json.c_str());
    if (doc.HasParseError()) {
        Log::Error(Event::ParseStyle, "Error parsing style JSON at %i: %s", doc.GetErrorOffset(), rapidjson::GetParseError_En(doc.GetParseError()));
        return;
    }

    StyleParser parser;
    parser.parse(doc);

    for (auto& source : parser.sources) {
        addSource(std::move(source));
    }

    for (auto& layer : parser.layers) {
        addLayer(std::move(layer));
    }

    glyphStore->setURL(parser.glyphURL);
    spriteStore->setURL(parser.spriteURL);

    loaded = true;
}
Ejemplo n.º 15
0
void CompositeSource::addSourceWithChapter(
                            const std::shared_ptr<ISeekableSource> &src,
                            const std::wstring &title)
{
    addSource(src);
    ITagParser *parser = dynamic_cast<ITagParser*>(src.get());
    if (parser) {
        if (count() == 1)
            fetchAlbumTags(parser);
        const std::vector<chapters::entry_t> *chaps;
        if ((chaps = parser->getChapters())) {
            std::copy(chaps->begin(), chaps->end(),
                      std::back_inserter(m_chapters));
            return;
        }
        const std::map<uint32_t, std::wstring> &tags = parser->getTags();
        std::map<uint32_t, std::wstring>::const_iterator
            tag = tags.find(Tag::kTitle);
        if (tag != tags.end()) {
            addChapter(tag->second, src->length() / m_asbd.mSampleRate);
            return;
        }
    }
    addChapter(title, src->length() / m_asbd.mSampleRate);
}
Ejemplo n.º 16
0
void MediaStreamPrivate::addRemoteSource(MediaStreamSource* source)
{
    if (m_client)
        m_client->addRemoteSource(source);
    else
        addSource(source);
}
Ejemplo n.º 17
0
bool Device<MType>::initializeReporters(int machine_location,
                                        int device_location,
                                        ReportManagers* report_managers) {
  auto neuron_manager = report_managers->getNeuronManager();
  bool result = true;
  result &= neuron_manager->addDescription("neuron_voltage",
                                           DataDescription(DataSpace::Device,
                                                           DataType::Float));
  result &= neuron_manager->addSource("neuron_voltage",
                                      machine_location,
                                      device_location,
                                      -1,
                                      neuron_simulator_updater_);
  result &= neuron_manager->addDescription("input_current",
                                           DataDescription(DataSpace::Device,
                                                           DataType::Float));
  result &= neuron_manager->addSource("input_current",
                                      machine_location,
                                      device_location,
                                      -1,
                                      input_updater_);
  result &= neuron_manager->addDescription("clamp_voltage",
                                           DataDescription(DataSpace::Device,
                                                           DataType::Float));
  result &= neuron_manager->addSource("clamp_voltage",
                                      machine_location,
                                      device_location,
                                      -1,
                                      input_updater_);
  result &= neuron_manager->addDescription("clamp_voltage_bit",
                                           DataDescription(DataSpace::Device,
                                                           DataType::Bit));
  result &= neuron_manager->addSource("clamp_voltage_bit",
                                      machine_location,
                                      device_location,
                                      -1,
                                      input_updater_);
  result &= neuron_manager->addDescription("synaptic_current",
                                           DataDescription(DataSpace::Device,
                                                           DataType::Float));
  result &= neuron_manager->addSource("synaptic_current",
                                      machine_location,
                                      device_location,
                                      -1,
                                      synapse_simulator_updater_);
  return result;
}
Ejemplo n.º 18
0
bool TasksEngine::sourceRequestEvent(const QString &source)
{
    if (source == "virtualDesktops") {
        addSource(new VirtualDesktopsSource);
        return true;
    }
    return false;
}
Ejemplo n.º 19
0
//-----------------------------------------------------------------------------
void StamFluidSolver::dens_step ( float * x, float * x0, float * u, float * v, float diff, float dt )
{
    addSource ( x, x0, dt );
    SWAP ( x0, x );
    diffuse ( 0, x, x0, diff, dt );
    SWAP ( x0, x );
    advect ( 0, x, x0, u, v, dt );
}
Ejemplo n.º 20
0
	void VFS::addNewSource(const std::string& path) {
		VFSSource* source = createSource(path);
		if (source) {
			addSource(source);
		} else {
			FL_WARN(_log, LMsg("Failed to add new VFS source: ") << path);
		}
	}
void OGRGDALImportExtension::addWFSSource()
{
  WFSSourceAddDialog AddDlg(m_TempDir,this);

  if (AddDlg.exec() == QDialog::Accepted)
  {
    addSource(AddDlg.sourceInfos());
  }
}
Ejemplo n.º 22
0
UIDownloaderUserManual::UIDownloaderUserManual()
{
    /* Prepare instance: */
    if (!m_spInstance)
        m_spInstance = this;

    /* Compose User Manual filename: */
    QString strUserManualFullFileName = vboxGlobal().helpFile();
    QString strUserManualShortFileName = QFileInfo(strUserManualFullFileName).fileName();

    /* Add sources: */
    addSource(QString("http://download.virtualbox.org/virtualbox/%1/").arg(vboxGlobal().vboxVersionStringNormalized()) + strUserManualShortFileName);
    addSource(QString("http://download.virtualbox.org/virtualbox/") + strUserManualShortFileName);

    /* Set target: */
    QString strUserManualDestination = QDir(vboxGlobal().homeFolder()).absoluteFilePath(strUserManualShortFileName);
    setTarget(strUserManualDestination);
}
Ejemplo n.º 23
0
InstFakeKill::InstFakeKill(Cfg *Func, const VarList &KilledRegs,
                           const Inst *Linked)
    : Inst(Func, Inst::FakeKill, KilledRegs.size(), NULL), Linked(Linked) {
  for (VarList::const_iterator I = KilledRegs.begin(), E = KilledRegs.end();
       I != E; ++I) {
    Variable *Var = *I;
    addSource(Var);
  }
}
void OGRGDALImportExtension::addFileSource()
{
  FileSourceAddDialog AddDlg(m_InputDir,this);

  if (AddDlg.exec() == QDialog::Accepted)
  {
    addSource(AddDlg.sourceInfos());
  }
}
Ejemplo n.º 25
0
void Profire2626::Profire2626EAP::setupSources_mid()
{
    addSource("Mic/Line/In", 0, 8, eRS_InS1, 1);
    addSource("ADAT A/In", 0, 4, eRS_ADAT, 1);
    addSource("ADAT B/In", 4, 4, eRS_ADAT, 1);
    addSource("SPDIF/In", 14, 2, eRS_AES, 1);
    addSource("Mixer/Out", 0, 16, eRS_Mixer, 1);
    addSource("1394/In", 0, 16, eRS_ARX0, 1);
    addSource("1394/In", 0, 10, eRS_ARX1, 17);
    addSource("Mute", 0, 1, eRS_Muted);
}
Ejemplo n.º 26
0
void Smoke::densityStep()
{
	addSource( d, dOld );

    swap( dOld, d );
	diffuse( 0, d, dOld, diff );
    
	swap( dOld, d );
	advect( 0, d, dOld, u, v );
}
Ejemplo n.º 27
0
// If TargetTrue==TargetFalse, we turn it into an unconditional
// branch.  This ensures that, along with the 'switch' instruction
// semantics, there is at most one edge from one node to another.
InstBr::InstBr(Cfg *Func, Operand *Source, CfgNode *TargetTrue,
               CfgNode *TargetFalse)
    : Inst(Func, Inst::Br, 1, NULL), TargetFalse(TargetFalse),
      TargetTrue(TargetTrue) {
  if (TargetTrue == TargetFalse) {
    TargetTrue = NULL; // turn into unconditional version
  } else {
    addSource(Source);
  }
}
Ejemplo n.º 28
0
void AudioManager::dropEvent(QDropEvent *event)
{
    QList<QUrl> urls = event->mimeData()->urls();
    if(urls.isEmpty())
        return;

    foreach(QUrl ur, urls)
    {
        addSource(ur.toLocalFile());
    }
Ejemplo n.º 29
0
void EditSourcesDlg::onAddSourceButtonPressed()
{
    QString dir = QFileDialog::getExistingDirectory(this,
                                                    tr("Select a folder to add to the backup"),
                                                    QDir::homePath());
    if (!dir.isEmpty())
    {
        addSource(dir);
    }
}
void QgsVirtualLayerSourceSelect::onAddSource()
{
    QScopedPointer<QgsEmbeddedLayerSelectDialog> dlg( new QgsEmbeddedLayerSelectDialog( this, sMainApp ) );
    int r = dlg->exec();
    if ( r == QDialog::Rejected ) {
        return;
    }

    addSource( dlg->getLocalName(), dlg->getSource(), dlg->getProvider(), dlg->getEncoding() );
}