示例#1
0
bool ObjectStatistics::compute() {

   //std::cerr << "ObjectStatistics: compute: execcount=" << m_executionCount << std::endl;

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

   if (obj->getTimestep()+1 > m_timesteps)
      m_timesteps = obj->getTimestep()+1;

   stats s;
   if (auto i = Indexed::as(obj)) {
      s.elements = i->getNumElements();
      s.vertices = i->getNumCorners();
   } else if (auto t = Triangles::as(obj)) {
      s.elements = t->getNumElements();
      s.vertices = t->getNumCorners();
   }
   if (auto c = Coords::as(obj)) {
      s.coords = c->getNumCoords();
      if (c->normals())
         ++s.normals;
   } else if (auto d = DataBase::as(obj)) {
      if (d->grid())
         ++s.grids;
      if(auto v = Vec<Scalar, 3>::as(obj)) {
         s.data[3] = v->getSize();
      } else if(auto v = Vec<Scalar, 1>::as(obj)) {
         s.data[1] = v->getSize();
      }
   }
   s.blocks = 1;
   m_cur += s;

   return true;
}
示例#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;
}