Ejemplo n.º 1
0
bool IsoSurface::work(vistle::UnstructuredGrid::const_ptr gridS,
             vistle::Vec<vistle::Scalar>::const_ptr dataS,
             vistle::DataBase::const_ptr mapdata) {

   const int processorType = getIntParameter("processortype");
#ifdef CUTTINGSURFACE
   const Scalar isoValue = 0.0;
#else
   const Scalar isoValue = getFloatParameter("isovalue");
#endif

   Leveller l(isocontrol, gridS, isoValue, processorType);

#ifndef CUTTINGSURFACE
   l.setIsoData(dataS);
#endif
   if(mapdata){
      l.addMappedData(mapdata);
   };
   l.process();

#ifndef CUTTINGSURFACE
   auto minmax = dataS->getMinMax();
   if (minmax.first[0] < m_min)
      m_min = minmax.first[0];
   if (minmax.second[0] > m_max)
      m_max = minmax.second[0];
#endif

   Object::ptr result = l.result();
   DataBase::ptr mapresult = l.mapresult();
   if (result) {
#ifndef CUTTINGSURFACE
      result->copyAttributes(dataS);
#endif
      result->copyAttributes(gridS, false);
      if (mapdata && mapresult) {
         mapresult->copyAttributes(mapdata);
         mapresult->setGrid(result);
         addObject(m_dataOut, mapresult);
      }
#ifndef CUTTINGSURFACE
      else {
          addObject(m_dataOut, result);
      }
#endif
   }
   return true;
}
Ejemplo n.º 2
0
bool IsoSurface::compute() {

   const Scalar isoValue = getFloatParameter("isovalue");

   Object::const_ptr grid = expect<Object>("grid_in");
   Object::const_ptr data = expect<Object>("data_in");
   if (!grid || !data)
      return false;

   Object::ptr object = generateIsoSurface(grid, data, isoValue);

   if (object) {
      object->copyAttributes(data);
      object->copyAttributes(grid, false);
      addObject("grid_out", object);
   }

   return true;
}
Ejemplo n.º 3
0
bool CutGeometry::compute() {

   Object::const_ptr oin = expect<Object>("grid_in");
   if (!oin)
      return false;

   Object::ptr object = cutGeometry(oin);
   if (object) {
      object->copyAttributes(oin);
      addObject("grid_out", object);
   }

   return true;
}
Ejemplo n.º 4
0
bool CellToVert::compute() {

   coCellToVert algo;

   Object::const_ptr grid = expect<Object>("grid_in");
   Object::const_ptr data = expect<Object>("data_in");
   if (!grid || !data)
      return false;

   Object::ptr out = algo.interpolate(grid, data);
   if (out) {
      out->copyAttributes(data);
      addObject("data_out", out);
      passThroughObject("grid_out", grid);
   }

   return true;
}
Ejemplo n.º 5
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;
}
Ejemplo n.º 6
0
bool IsoSurface::work(vistle::Object::const_ptr grid,
             vistle::Vec<vistle::Scalar>::const_ptr dataS,
             vistle::DataBase::const_ptr mapdata) {

   const int processorType = getIntParameter("processortype");
#ifdef CUTTINGSURFACE
   const Scalar isoValue = 0.0;
#else
   const Scalar isoValue = getFloatParameter("isovalue");
#endif

   Leveller l(isocontrol, grid, isoValue, processorType);
   l.setComputeNormals(m_computeNormals->getValue());

#ifndef CUTTINGSURFACE
   l.setIsoData(dataS);
#endif
   if(mapdata){
      l.addMappedData(mapdata);
   };
   l.process();

#ifndef CUTTINGSURFACE
   auto minmax = dataS->getMinMax();
   if (minmax.first[0] < m_min)
      m_min = minmax.first[0];
   if (minmax.second[0] > m_max)
      m_max = minmax.second[0];
#endif

   Object::ptr result = l.result();
   DataBase::ptr mapresult = l.mapresult();
   if (result && !result->isEmpty()) {
#ifndef CUTTINGSURFACE
      result->copyAttributes(dataS);
#endif
      result->updateInternals();
      result->copyAttributes(grid, false);
      result->setTransform(grid->getTransform());
      if (result->getTimestep() < 0) {
          result->setTimestep(grid->getTimestep());
          result->setNumTimesteps(grid->getNumTimesteps());
      }
      if (result->getBlock() < 0) {
          result->setBlock(grid->getBlock());
          result->setNumBlocks(grid->getNumBlocks());
      }
      if (mapdata && mapresult) {
         mapresult->updateInternals();
         mapresult->copyAttributes(mapdata);
         mapresult->setGrid(result);
         addObject(m_dataOut, mapresult);
      }
#ifndef CUTTINGSURFACE
      else {
          addObject(m_dataOut, result);
      }
#endif
   }
   return true;
}