当前位置: 首页>>代码示例>>C++>>正文


C++ RegionList类代码示例

本文整理汇总了C++中RegionList的典型用法代码示例。如果您正苦于以下问题:C++ RegionList类的具体用法?C++ RegionList怎么用?C++ RegionList使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了RegionList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: iter

double EffectTruncSilence::CalcPreviewInputLength(double /* previewLength */)
{
   double inputLength = mT1 - mT0;
   double minInputLength = inputLength;

   // Master list of silent regions
   RegionList silences;

   // Start with the whole selection silent
   silences.push_back(Region(mT0, mT1));

   SelectedTrackListOfKindIterator iter(Track::Wave, mTracks);
   int whichTrack = 0;

   for (Track *t = iter.First(); t; t = iter.Next()) {
      WaveTrack *const wt = static_cast<WaveTrack *>(t);

      RegionList trackSilences;

      sampleCount index = wt->TimeToLongSamples(mT0);
      sampleCount silentFrame = 0; // length of the current silence

      Analyze(silences, trackSilences, wt, &silentFrame, &index, whichTrack, &inputLength, &minInputLength);

      whichTrack++;
   }
   return inputLength;
}
开发者ID:jengelh,项目名称:audacity,代码行数:28,代码来源:TruncSilence.cpp

示例2: getRegions

	RegionList ParallelSelector::getRegions(const core::NodePtr& node) const {

		RegionList res;
		auto parallel = node->getNodeManager().getLangBasic().getParallel();
		core::visitDepthFirst(core::NodeAddress(node), [&](const core::CallExprAddress& cur)->bool {
			if (*cur.getAddressedNode()->getFunctionExpr() != *parallel) {
				return false;
			}

			core::JobExprAddress job = cur->getArgument(0).as<core::JobExprAddress>();
			core::ExpressionAddress addr = job->getBody();

			if(addr->getNodeType() == core::NT_BindExpr) {
				addr = addr.as<core::BindExprAddress>()->getCall()->getFunctionExpr();
			}

			if (addr->getNodeType() == core::NT_LambdaExpr) {
				res.push_back(addr.as<core::LambdaExprAddress>()->getBody());
			}

			return true;

		}, false);

		return res;
	}
开发者ID:8l,项目名称:insieme,代码行数:26,代码来源:parallel_selector.cpp

示例3: invalidateRegionsImpl

ProgramStateRef 
ProgramState::invalidateRegions(RegionList Regions,
                                const Expr *E, unsigned Count,
                                const LocationContext *LCtx,
                                bool CausedByPointerEscape,
                                InvalidatedSymbols *IS,
                                const CallEvent *Call,
                                RegionList ConstRegions) const {
  SmallVector<SVal, 8> Values;
  for (RegionList::const_iterator I = Regions.begin(),
                                  End = Regions.end(); I != End; ++I)
    Values.push_back(loc::MemRegionVal(*I));

  SmallVector<SVal, 8> ConstValues;
  for (RegionList::const_iterator I = ConstRegions.begin(),
                                  End = ConstRegions.end(); I != End; ++I)
    ConstValues.push_back(loc::MemRegionVal(*I));

  if (!IS) {
    InvalidatedSymbols invalidated;
    return invalidateRegionsImpl(Values, E, Count, LCtx,
                                 CausedByPointerEscape,
                                 invalidated, Call, ConstValues);
  }
  return invalidateRegionsImpl(Values, E, Count, LCtx, CausedByPointerEscape,
                               *IS, Call, ConstValues);
}
开发者ID:agheorghiu,项目名称:root,代码行数:27,代码来源:ProgramState.cpp

示例4: boundaries

void boundaries()
{
	//define the boundaries
	RegionList *regionList        = GetBoundaries();
	cl_int        *regionIndeces     = regionList->GetRegionIndeces(0);
	cl_int        numRegions         = regionList->GetNumRegions();

	numBoundaries_ = 0;


	for(cl_int i = 0; i < numRegions; i++) {
		numBoundaries_ += regionList->GetRegionCount(i);
	}

	boundaries_ = new cl_int [numBoundaries_];
	for(cl_int i = 0; i < numBoundaries_; i++) {
		boundaries_[i] = regionIndeces[i];
	}

	memset(h_bndy, 255, height * width * sizeof(cl_uchar));


	for(cl_int i = 0; i < numBoundaries_; i++) {
		h_bndy[boundaries_[i]] = 0;
	}
}
开发者ID:zvonkok,项目名称:masterthesis,代码行数:26,代码来源:edison.cpp

示例5: iter

bool EffectTruncSilence::FindSilences
   (RegionList &silences, Track *firstTrack, Track *lastTrack)
{
   // Start with the whole selection silent
   Region *sel = new Region;
   sel->start = mT0;
   sel->end = mT1;
   silences.push_back(sel);

   // Remove non-silent regions in each track
   SelectedTrackListOfKindIterator iter(Track::Wave, mTracks);
   int whichTrack = 0;
   bool lastSeen = false;
   for (Track *t = iter.StartWith(firstTrack); !lastSeen && t; t = iter.Next())
   {
      lastSeen = (t == lastTrack);
      WaveTrack *const wt = static_cast<WaveTrack *>(t);

      // Smallest silent region to detect in frames
      sampleCount minSilenceFrames =
         sampleCount(std::max(mInitialAllowedSilence, DEF_MinTruncMs) * wt->GetRate());

      //
      // Scan the track for silences
      //
      RegionList trackSilences;
      trackSilences.DeleteContents(true);

      sampleCount index = wt->TimeToLongSamples(mT0);
      sampleCount silentFrame = 0;

      // Detect silences
      bool cancelled = !(Analyze(silences, trackSilences, wt, &silentFrame, &index, whichTrack));

      // Buffer has been freed, so we're OK to return if cancelled
      if (cancelled)
      {
         ReplaceProcessedTracks(false);
         return false;
      }

      if (silentFrame >= minSilenceFrames)
      {
         // Track ended in silence -- record region
         Region *r = new Region;
         r->start = wt->LongSamplesToTime(index - silentFrame);
         r->end = wt->LongSamplesToTime(index);
         trackSilences.push_back(r);
      }

      // Intersect with the overall silent region list
      Intersect(silences, trackSilences);
      whichTrack++;
   }

   return true;
}
开发者ID:ShockingIce,项目名称:audacity,代码行数:57,代码来源:TruncSilence.cpp

示例6: getRegions

	RegionList PForSelector::getRegions(const core::NodePtr& node) const {
		RegionList res;
		auto pfor = node->getNodeManager().getLangExtension<lang::ParallelExtension>().getPFor();
		core::visitDepthFirstPrunable(core::NodeAddress(node), [&](const core::CallExprAddress& cur) -> bool {
			if(*cur.getAddressedNode()->getFunctionExpr() != *pfor) { return false; }
			res.push_back(cur);
			return true;
		}, false);

		return res;
	}
开发者ID:zmanchun,项目名称:insieme,代码行数:11,代码来源:pfor_selector.cpp

示例7: addSubregion

void SubRegionList::addSubregion(SubRegion& toAdd)
{
  _subregions.push_back(&toAdd);
  //WARNING can i pass in region intersections as ouput? or perhaps i need to copy
  if (_subregions.size() == 1)
    _region_intersections = _subregions.front()->_regions;
  else
  {
    RegionList tmp = _region_intersections;
    tmp.intersectRegions(toAdd._regions, _region_intersections);
  }
}
开发者ID:personalrobotics,项目名称:hyperedge_cutting,代码行数:12,代码来源:MetricUtils.cpp

示例8: getRegions

	RegionList SizeBasedRegionSelector::getRegions(const core::NodePtr& node) const {
		RegionList regions;

		SizeCalculator calculator;
		visitDepthFirstPrunable(core::NodeAddress(node), [&](const core::CompoundStmtAddress &comp) {
			unsigned size = calculator.estimateSize(comp.getAddressedNode());
			if(minSize < size && size < maxSize) {
				regions.push_back(comp);
				return true;
			}
			return false;
		});
		return regions;
	}
开发者ID:8l,项目名称:insieme,代码行数:14,代码来源:size_based_selector.cpp

示例9:

int	CRegionManager::getRegionList(int cx,int cy,RegionList& list)
{
	list.clear();
	for ( size_t i = 0;i<m_Regions.size();++i )
	{
		CRegion* pRegion = m_Regions[i];
		if ( pRegion && pRegion->containsCell(cx,cy ) )
		{
			list.push_back(pRegion);
		}
	}

	return list.size();
}
开发者ID:SmallRaindrop,项目名称:LocatorApp,代码行数:14,代码来源:RegionManager.cpp

示例10: CopyInputTracks

bool EffectTruncSilence::ProcessAll()
{
   // Copy tracks
   CopyInputTracks(Track::All);

   // Master list of silent regions; it is responsible for deleting them.
   // This list should always be kept in order.
   RegionList silences;
   silences.DeleteContents(true);

   SelectedTrackListOfKindIterator iter(Track::Wave, mTracks);
   if (FindSilences(silences, iter.First(), iter.Last())) {
      TrackListIterator iterOut(mOutputTracks);
      double totalCutLen = 0.0;
      Track *const first = iterOut.First();
      if (DoRemoval(silences, 0, 1, first, iterOut.Last(), totalCutLen)) {
         mT1 -= totalCutLen;
         return true;
      }
   }

   return false;
}
开发者ID:ShockingIce,项目名称:audacity,代码行数:23,代码来源:TruncSilence.cpp

示例11: makeWithStore

ProgramStateRef 
ProgramState::invalidateRegionsImpl(RegionList Regions,
                                    const Expr *E, unsigned Count,
                                    const LocationContext *LCtx,
                                    bool CausedByPointerEscape,
                                    InvalidatedSymbols &IS,
                                    const CallEvent *Call,
                                    RegionList ConstRegions) const {
  ProgramStateManager &Mgr = getStateManager();
  SubEngine* Eng = Mgr.getOwningEngine();
  InvalidatedSymbols ConstIS;

  if (Eng) {
    StoreManager::InvalidatedRegions Invalidated;
    const StoreRef &newStore
      = Mgr.StoreMgr->invalidateRegions(getStore(), Regions, E, Count, LCtx, IS,
                                        Call, ConstRegions, ConstIS,
                                        &Invalidated);

    ProgramStateRef newState = makeWithStore(newStore);

    if (CausedByPointerEscape) {
      newState = Eng->notifyCheckersOfPointerEscape(newState,
                                               &IS, Regions, Invalidated, Call);
      if (!ConstRegions.empty()) {
        StoreManager::InvalidatedRegions Empty;
        newState = Eng->notifyCheckersOfPointerEscape(newState, &ConstIS,
                                                      ConstRegions, Empty, Call,
                                                      true);
      }
    }

    return Eng->processRegionChanges(newState, &IS, Regions, Invalidated, Call);
  }

  const StoreRef &newStore =
    Mgr.StoreMgr->invalidateRegions(getStore(), Regions, E, Count, LCtx, IS,
                                    Call, ConstRegions, ConstIS, NULL);
  return makeWithStore(newStore);
}
开发者ID:mrkj,项目名称:clang,代码行数:40,代码来源:ProgramState.cpp

示例12: getExtraInvalidatedRegions

void BlockCall::getExtraInvalidatedRegions(RegionList &Regions) const {
  // FIXME: This also needs to invalidate captured globals.
  if (const MemRegion *R = getBlockRegion())
    Regions.push_back(R);
}
开发者ID:CTSRD-TESLA,项目名称:clang,代码行数:5,代码来源:Calls.cpp

示例13: main

int main(int   argc,
	 char* argv[])
{
    int        ret = 0;
    RegionList regions;

    if (argc < 3) {
	std::cout << "Usage: " << argv[0] << " <RAW file> <BRL-CAD file>" << std::endl;
	ret = 1;
    }
    else {
	std::ifstream is(argv[1]);

	if (!is.is_open()) {
	    std::cout << "Error reading RAW file" << std::endl;
	    ret = 1;
	}
	else {
	    struct rt_wdb* wdbp = wdb_fopen(argv[2]);
	    std::string title = "Converted from ";
	    title += argv[1];

	    mk_id(wdbp, title.c_str());

	    std::vector<std::string> nameLine = readLine(is);

	    while (is && !is.eof()) {
		if (nameLine.size() == 0) {
		    nameLine = readLine(is);
		    continue;
		}

		std::cout << "Read: " << nameLine[0].c_str() << '\n';
		assert(nameLine[0].size() > 0);

		Bot& bot = regions.addRegion(nameLine[0]);

		if (nameLine.size() > 1) {
		    size_t thicknessIndex = nameLine[1].find("thickf=");

		    if (thicknessIndex != std::string::npos) {
			std::string thickf = nameLine[1].substr(thicknessIndex + 7);

			if (thickf.size() > 0) {
			    fastf_t val = toValue(thickf.c_str());
			    bot.setThickness(val);
			} else {
			    std::cout << "Missing thickness in " << nameLine[0].c_str() << '\n';
			}
		    }
		}

		std::vector<std::string> triangleLine = readLine(is);

		while (is && (triangleLine.size() == 9)) {
		    point_t p;

		    getPoint(triangleLine[0], triangleLine[1], triangleLine[2], p);
		    size_t a = bot.addPoint(p);

		    getPoint(triangleLine[3], triangleLine[4], triangleLine[5], p);
		    size_t b = bot.addPoint(p);

		    getPoint(triangleLine[6], triangleLine[7], triangleLine[8], p);
		    size_t c = bot.addPoint(p);

		    bot.addTriangle(a, b, c);

		    triangleLine = readLine(is);
		}

		nameLine = triangleLine;
	    }

	    regions.create(wdbp);
	    wdb_close(wdbp);
	}
    }

    regions.printStat();

    return ret;
}
开发者ID:behollis,项目名称:brlcad-svn-rev65072-gsoc2015,代码行数:83,代码来源:raw-g.cpp

示例14: sampleCount

bool EffectTruncSilence::Analyze(RegionList& silenceList,
                                 RegionList& trackSilences,
                                 WaveTrack* wt,
                                 sampleCount* silentFrame,
                                 sampleCount* index,
                                 int whichTrack,
                                 double* inputLength /*= NULL*/,
                                 double* minInputLength /*= NULL*/)
{
   // Smallest silent region to detect in frames
   sampleCount minSilenceFrames = sampleCount(std::max( mInitialAllowedSilence, DEF_MinTruncMs) * wt->GetRate());

   double truncDbSilenceThreshold = Enums::Db2Signal[mTruncDbChoiceIndex];
   sampleCount blockLen = wt->GetMaxBlockSize();
   sampleCount start = wt->TimeToLongSamples(mT0);
   sampleCount end = wt->TimeToLongSamples(mT1);
   sampleCount outLength = 0;

   double previewLength;
   gPrefs->Read(wxT("/AudioIO/EffectsPreviewLen"), &previewLength, 6.0);
   // Minimum required length in samples.
   const sampleCount previewLen = previewLength * wt->GetRate();

   // Keep position in overall silences list for optimization
   RegionList::iterator rit(silenceList.begin());

   // Allocate buffer
   float *buffer = new float[blockLen];

   // Loop through current track
   while (*index < end) {
      if (inputLength && ((outLength >= previewLen) || (*index - start > wt->TimeToLongSamples(*minInputLength)))) {
         *inputLength = std::min<double>(*inputLength, *minInputLength);
         if (outLength >= previewLen) {
            *minInputLength = *inputLength;
         }
         return true;
      }

      if (!inputLength) {
         // Show progress dialog, test for cancellation
         bool cancelled = TotalProgress(
               detectFrac * (whichTrack + (*index - start) / (double)(end - start)) /
               (double)GetNumWaveTracks());
         if (cancelled) {
            delete [] buffer;
            return false;
         }
      }

      // Optimization: if not in a silent region skip ahead to the next one

      double curTime = wt->LongSamplesToTime(*index);
      for ( ; rit != silenceList.end(); ++rit) {
         // Find the first silent region ending after current time
         if (rit->end >= curTime) {
            break;
         }
      }

      if (rit == silenceList.end()) {
         // No more regions -- no need to process the rest of the track
         if (inputLength) {
            // Add available samples up to previewLength.
            sampleCount remainingTrackSamples = wt->TimeToLongSamples(wt->GetEndTime()) - *index;
            sampleCount requiredTrackSamples = previewLen - outLength;
            outLength += (remainingTrackSamples > requiredTrackSamples)? requiredTrackSamples : remainingTrackSamples;
         }

         break;
      }
      else if (rit->start > curTime) {
         // End current silent region, skip ahead
         if (*silentFrame >= minSilenceFrames)  {
            trackSilences.push_back(Region(
               wt->LongSamplesToTime(*index - *silentFrame),
               wt->LongSamplesToTime(*index)
            ));
         }
         *silentFrame = 0;
         sampleCount newIndex = wt->TimeToLongSamples(rit->start);
         if (inputLength) {
            sampleCount requiredTrackSamples = previewLen - outLength;
            // Add non-silent sample to outLength
            outLength += ((newIndex - *index) > requiredTrackSamples)? requiredTrackSamples : newIndex - *index;
         }

         *index = newIndex;
      }
      // End of optimization

      // Limit size of current block if we've reached the end
      sampleCount count = blockLen;
      if ((*index + count) > end) {
         count = end - *index;
      }

      // Fill buffer
      wt->Get((samplePtr)(buffer), floatSample, *index, count);

//.........这里部分代码省略.........
开发者ID:jengelh,项目名称:audacity,代码行数:101,代码来源:TruncSilence.cpp

示例15: comment

void petabricks::CodeGenerator::mkCreateGpuSpatialMethodCallTask(
    const std::string& transname,
    const std::string& taskname, 
    const std::string& objname, 
    const std::string& methodname, 
    const SimpleRegion& region, 
    std::vector<RegionNodeGroup>& regionNodesGroups, 
    int nodeID, 
    int gpuCopyOut, 
    RegionList to, 
    bool divisible) {
  std::string taskclass
;
  int dim_int = region.totalDimensions();
  std::string lastdim = jalib::XToString(dim_int - 1);
  std::string max = region.maxCoord()[dim_int - 1]->toString();
  std::string min = region.minCoord()[dim_int - 1]->toString();

  if(!divisible) {
    taskclass = "petabricks::CreateGpuSpatialMethodCallTask<"+objname
      + ", " + jalib::XToString(region.totalDimensions())
      + ", &" + objname + "::" + methodname + TX_OPENCL_POSTFIX + "_createtasks"
      + ">";
    //beginIf(min+"<"+max);
    comment("MARKER 6");
    write("IndexT _tmp_begin[] = {" + region.getIterationLowerBounds() + "};");
    write("IndexT _tmp_end[] = {"   + region.getIterationUpperBounds() + "};");
    write("RegionNodeGroupMapPtr groups = new RegionNodeGroupMap();");
    for(std::vector<RegionNodeGroup>::iterator group = regionNodesGroups.begin(); group != regionNodesGroups.end(); ++group){
      write("{");
      incIndent();
      write("std::set<int> ids;");
      for(std::vector<int>::iterator id = group->nodeIDs().begin(); id != group->nodeIDs().end(); ++id){
	write("ids.insert("+jalib::XToString(*id)+");");
      }
      write("groups->insert(RegionNodeGroup(\""+group->matrixName()+"\",ids));");
      decIndent();
      write("}");
    }
    write(taskname+" = new "+taskclass+"(this,_tmp_begin, _tmp_end, "+jalib::XToString(nodeID)+", groups, "+jalib::XToString(gpuCopyOut)+");");
    //endIf();

    return;
  }

  std::string n_div = "cont_" + jalib::XToString(_contCounter++);
  write(taskname + " = new petabricks::MethodCallTask<"+_curClass+", &"+_curClass+"::"+n_div+">( this );");

  // Add divider function
  CodeGenerator helper = forkhelper();
  helper.beginFunc("DynamicTaskPtr", n_div);
  helper.write("DynamicTaskPtr _fini = new NullDynamicTask();");

  // Assign the gpu-cpu division point.
  helper.write("ElementT gpu_ratio = "+transname+"_gpuratio/8.0;");

  std::string div = "div";
  RegionPtr proxy = to.front();
  helper.write("IndexT totalRow = "+proxy->matrix()->name()+".size("+jalib::XToString(dim_int - 1)+");");
  helper.write("IndexT div = ceil(gpu_ratio * totalRow);");
  helper.beginIf("div > " + max);
  helper.write("div = "+max+";");
  helper.endIf();

  // GPU

  taskclass = "petabricks::CreateGpuSpatialMethodCallTask<"+objname
              + ", " + jalib::XToString(dim_int)
              + ", &" + objname + "::" + methodname + TX_OPENCL_POSTFIX + "_createtasks"
              + ">";
  helper.comment("MARKER 6");
  
  //helper.beginIf(min+" < div");
  helper.write("IndexT _gpu_begin[] = {" + region.getIterationLowerBounds() + "};");
  helper.write("IndexT _gpu_end[] = {" + region.getIterationMiddleEnd(div) + "};");
  helper.write("RegionNodeGroupMapPtr groups = new RegionNodeGroupMap();");

  for(std::vector<RegionNodeGroup>::iterator group = regionNodesGroups.begin(); group != regionNodesGroups.end(); ++group){
    helper.write("{");
    helper.incIndent();
    helper.write("std::set<int> ids;");
    for(std::vector<int>::iterator id = group->nodeIDs().begin(); id != group->nodeIDs().end(); ++id){
      helper.write("ids.insert("+jalib::XToString(*id)+");");
    }
    helper.write("groups->insert(RegionNodeGroup(\""+group->matrixName()+"\",ids));");
    helper.decIndent();
    helper.write("}");
  }

  helper.write("DynamicTaskPtr gpu_task = new "+taskclass+"(this,_gpu_begin, _gpu_end, "+jalib::XToString(nodeID)+", groups, "+jalib::XToString(gpuCopyOut)+");");
  helper.write("gpu_task->enqueue();");
  helper.write("_fini->dependsOn(gpu_task);");
  //helper.endIf();

  // CPU
  taskclass = "petabricks::SpatialMethodCallTask<CLASS"
              ", " + jalib::XToString(dim_int)
              + ", &CLASS::" + methodname + "_workstealing_wrap"
    //+ ", &CLASS::" + methodname + "_workstealing"
              + ">";
//.........这里部分代码省略.........
开发者ID:AikidoGuy,项目名称:petabricks,代码行数:101,代码来源:codegenerator.cpp


注:本文中的RegionList类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。