Esempio n. 1
0
void KstCSD::setVector(KstVectorPtr new_v) {
  KstVectorPtr v = _inputVectors[INVECTOR];
  if (v) {
    if (v == new_v) {
      return;
    }
    v->writeUnlock();
  }

  _inputVectors.erase(INVECTOR);
  new_v->writeLock();
  _inputVectors[INVECTOR] = new_v;
  setDirty();
}
Esempio n. 2
0
KstDataObjectPtr KstPlugin::makeDuplicate(KstDataObjectDataObjectMap& duplicatedMap) {
  KstPluginPtr plugin = new KstPlugin;

  // use same inputs
  for (KstVectorMap::ConstIterator iter = _inputVectors.begin(); iter != _inputVectors.end(); ++iter) {
    plugin->inputVectors().insert(iter.key(), iter.data());
  }
  for (KstScalarMap::ConstIterator iter = _inputScalars.begin(); iter != _inputScalars.end(); ++iter) {
    plugin->inputScalars().insert(iter.key(), iter.data());  
  }
  for (KstStringMap::ConstIterator iter = _inputStrings.begin(); iter != _inputStrings.end(); ++iter) {
    plugin->inputStrings().insert(iter.key(), iter.data());  
  }
  
  // create new outputs
  for (KstVectorMap::ConstIterator iter = outputVectors().begin(); iter != outputVectors().end(); ++iter) {
    KstVectorPtr v = new KstVector;
    v->writeLock();
    plugin->outputVectors().insert(iter.key(), v);
    v->setTagName(iter.data()->tagName() + "'");
    v->setProvider(plugin.data());
    KST::addVectorToList(v);
    v->writeUnlock();
  }
  for (KstScalarMap::ConstIterator iter = outputScalars().begin(); iter != outputScalars().end(); ++iter) {
    KstScalarPtr s = new KstScalar;
    s->writeLock();
    plugin->outputScalars().insert(iter.key(), s);
    s->setTagName(iter.data()->tagName() + "'");
    s->setProvider(plugin.data());
    s->writeUnlock();
  }
  for (KstStringMap::ConstIterator iter = outputStrings().begin(); iter != outputStrings().end(); ++iter) {
    KstStringPtr s = new KstString;
    s->writeLock();
    plugin->outputStrings().insert(iter.key(), s);
    s->setTagName(iter.data()->tagName() + "'");
    s->setProvider(plugin.data());
    s->writeUnlock();  
  }
  
  // set the same plugin
  plugin->setPlugin(_plugin);
  plugin->setTagName(tagName() + "'");
  duplicatedMap.insert(this, KstDataObjectPtr(plugin));  
  return KstDataObjectPtr(plugin);
}
Esempio n. 3
0
void KstEquation::setExistingXVector(KstVectorPtr in_xv, bool do_interp) {
  KstVectorPtr v = _inputVectors[XVECTOR];
  if (v) {
    if (v == in_xv) {
      return;
    }
    v->writeUnlock();
  }

  setDirty();

  _inputVectors.erase(XVECTOR);
  in_xv->writeLock();
  _xVector = _inputVectors.insert(XVECTOR, in_xv);

  _ns = 2; // reset the updating
  _doInterp = do_interp;
}