Esempio n. 1
0
void Object::copyAttributes(Object::const_ptr src, bool replace) {

   if (replace) {
      auto &m = d()->meta;
      auto &sm = src->meta();
      m.setBlock(sm.block());
      m.setNumBlocks(sm.numBlocks());
      m.setTimeStep(sm.timeStep());
      m.setNumTimesteps(sm.numTimesteps());
      m.setRealTime(sm.realTime());
      m.setAnimationStep(sm.animationStep());
      m.setNumAnimationSteps(sm.numAnimationSteps());
      m.setIteration(sm.iteration());
   }

   d()->copyAttributes(src->d(), replace);
}
Esempio n. 2
0
bool FilterNode::compute() {

   Object::const_ptr data = expect<Object>("data_in");
   if (!data)
      return true;

   const bool invert = m_invertParam->getValue();
   const Integer select = m_nodeParam->getValue();

   bool pass = true;
   switch (m_criterionParam->getValue()) {
   case Rank:
       pass = select == rank();
       break;
   case BlockNumber:
       pass = select == data->getBlock();
       break;
   case Timestep:
       pass = select == data->getTimestep();
       break;
   }

   if (invert)
      pass = !pass;

   if (pass) {
      passThroughObject("data_out", data);
   } else {
      Object::ptr obj = data->cloneType();
      obj->setMeta(data->meta());
      obj->copyAttributes(data);
      addObject("data_out", obj);
   }

   return true;
}