本文整理汇总了C++中CStopWatch::Stop方法的典型用法代码示例。如果您正苦于以下问题:C++ CStopWatch::Stop方法的具体用法?C++ CStopWatch::Stop怎么用?C++ CStopWatch::Stop使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CStopWatch
的用法示例。
在下文中一共展示了CStopWatch::Stop方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RasterizeImage
void CBathymetryRasterizer::RasterizeImage()
{
CStopWatch sw;
sw.Start();
int LowPixel = 255;
int HighPixel = 0;
byte * ImageData = new byte[ImageSize * ImageSize * 3];
for (int i = 0; i < ImageSize; ++ i)
{
for (int j = 0; j < ImageSize; ++ j)
{
int const Index = ImageSize * i + j;
if (Buckets[Index].Count > 0)
{
double const Value = Buckets[Index].Sum / Buckets[Index].Count;
double const Intensity = 2.5f;
double const Bottom = 0;
int const Pixel = 255 - Clamp<int>((int) (Value * Intensity - Bottom), 0, 255);
LowPixel = Min(LowPixel, Pixel);
HighPixel = Max(HighPixel, Pixel);
ImageData[Index * 3 + 0] = Pixel;
ImageData[Index * 3 + 1] = 0;
ImageData[Index * 3 + 2] = 0;
}
else
{
ImageData[Index * 3 + 0] = 0;
ImageData[Index * 3 + 1] = 0;
ImageData[Index * 3 + 2] = 255;
}
if (Buckets[Index].Tag == -1)
{
ImageData[Index * 3 + 1] = 255;
}
//else if (Buckets[Index].Tag > 0)
//{
// if (TagGroups[Buckets[Index].Tag].IsBridge)
// {
// ImageData[Index * 3 + 1] = ImageData[Index * 3 + 0];
// ImageData[Index * 3 + 0] = 0;
// ImageData[Index * 3 + 2] = 128;
// }
//}
}
}
Log::Info("Low value: %d High Value: %d", LowPixel, HighPixel);
CImage * Image = new CImage(ImageData, vec2u(ImageSize), 3);
Image->FlipY();
Image->Write(OutputName);
Log::Info("Rasterize to image took %.3f", sw.Stop());
}
示例2: GetArgs
void
CSeqDBPerfApp::x_InitApplicationData()
{
CStopWatch sw;
sw.Start();
const CArgs& args = GetArgs();
const CSeqDB::ESeqType kSeqType = ParseMoleculeTypeString(args["dbtype"].AsString());
const string& kDbName(args["db"].AsString());
m_BlastDb.Reset(new CSeqDBExpert(kDbName, kSeqType));
m_DbIsProtein = static_cast<bool>(m_BlastDb->GetSequenceType() == CSeqDB::eProtein);
int kNumThreads = 1;
#if (defined(_OPENMP) && defined(NCBI_THREADS))
kNumThreads = args["num_threads"].AsInteger();
#endif
m_DbHandles.reserve(kNumThreads);
m_DbHandles.push_back(m_BlastDb);
if (kNumThreads > 1) {
for (int i = 1; i < kNumThreads; i++) {
m_BlastDb.Reset(new CSeqDBExpert(kDbName, kSeqType));
m_DbHandles.push_back(m_BlastDb);
}
}
m_MemoryUsage.assign(kNumThreads, SMemUsage());
sw.Stop();
cout << "Initialization time: " << sw.AsSmartString() << endl;
}
示例3: FillInteriorPoints
void CTopographyRasterizer::FillInteriorPoints()
{
CStopWatch sw;
sw.Start();
Buckets = new SPixelBucket[ImageSize * ImageSize];
vector<STriangle2D<double>> Triangles;
AddAtEnd(Triangles, TriangulateEarClipping(CatalinaOutline));
double ActualMax = 0;
for (int i = 0; i < ImageSize; ++ i)
{
for (int j = 0; j < ImageSize; ++ j)
{
bool InsideTriangle = false;
vec2d const Point = vec2d(
RegionXCorner + ((double) i / (double) (ImageSize - 1)) * RegionXSize,
RegionYCorner + ((double) j / (double) (ImageSize - 1)) * RegionYSize
);
for (auto const & Triangle : Triangles)
{
if (ion::IsPointInOrOnTriangle(Triangle.A, Triangle.C, Triangle.B, Point))
{
InsideTriangle = true;
break;
}
}
if (InsideTriangle)
{
auto Bucket = Helper_GetBucket(i, j);
Bucket->Interior = true;
Bucket->Value = Helper_ClosestEdgeDistance(Point);
ActualMax = Max(ActualMax, Bucket->Value);
}
}
}
double const ApexPoint = 0.06;
double const ScaleUp = 255.0 / 0.05;
for (int i = 0; i < ImageSize; ++ i)
{
for (int j = 0; j < ImageSize; ++ j)
{
auto Bucket = Helper_GetBucket(i, j);
Bucket->Value /= ApexPoint;
Bucket->Value = pow(Bucket->Value, 0.65f);
Bucket->Value *= ApexPoint * ScaleUp;
}
}
Log::Info("Max: %f Scaled Max: %f", ActualMax, ActualMax * ScaleUp);
Log::Info("Topography fill interior took %.3f", sw.Stop());
}
示例4: FillBridgeGroups
void CBathymetryRasterizer::FillBridgeGroups()
{
CStopWatch sw;
sw.Start();
static vector<vec2i> const Neighbors =
{
vec2i(-1, 0),
vec2i(1, 0),
vec2i(0, -1),
vec2i(0, 1),
};
int Tag = 1;
while (TagGroups[Tag].count)
{
if (TagGroups[Tag].IsBridge)
{
vector<vec2i> Queue = Helper_GetAllMatchingGroup(Tag);
int KernelSize = 4;
int MinSamples = 2;
while (Queue.size() && KernelSize <= 512)
{
for (auto const & Spot : Queue)
{
Helper_EstimatePixelValueBridge(Spot, KernelSize, MinSamples);
}
for (auto it = Queue.begin(); it != Queue.end(); )
{
if (Helper_GetBucket(*it)->Count > 0)
{
it = Queue.erase(it);
}
else
{
it ++;
}
}
KernelSize += 2;
MinSamples = 4;
}
}
Tag ++;
}
Log::Info("Fill bridge groups took %.3f", sw.Stop());
}
示例5: FillGroups
void CBathymetryRasterizer::FillGroups()
{
CStopWatch sw;
sw.Start();
int tag = 1;
while (TagGroups[tag].count)
{
if (TagGroups[tag].count < 96 && ! TagGroups[tag].IsBridge)
{
Helper_ReconstructTagGroup(TagGroups[tag], tag);
}
tag ++;
}
Log::Info("Fill groups took %.3f", sw.Stop());
}
示例6: CopySourcePointsToBuckets
void CBathymetryRasterizer::CopySourcePointsToBuckets()
{
CStopWatch sw;
sw.Start();
for (auto const & Point : SourceElevationPostings)
{
int const IndexX = (int) (((Point.X - RegionXCorner) / RegionXSize) * ImageSize);
int const IndexY = (int) (((Point.Y - RegionYCorner) / RegionYSize) * ImageSize);
if (IndexX >= 0 && IndexX < ImageSize &&
IndexY >= 0 && IndexY < ImageSize)
{
Buckets[ImageSize * IndexX + IndexY].Sum += Point.Z;
Buckets[ImageSize * IndexX + IndexY].Count ++;
}
}
Log::Info("Copy to buckets took %.3f", sw.Stop());
}
示例7: Start
TEST(TestStopWatch, Stop)
{
CStopWatch a;
CTestStopWatchThread thread;
EXPECT_FALSE(a.IsRunning());
EXPECT_EQ(0.0f, a.GetElapsedSeconds());
EXPECT_EQ(0.0f, a.GetElapsedMilliseconds());
std::cout << "Calling Start()" << std::endl;
a.Start();
thread.Sleep(1000);
EXPECT_TRUE(a.IsRunning());
std::cout << "Elapsed Seconds: " << a.GetElapsedSeconds() << std::endl;
std::cout << "Elapsed Milliseconds: " << a.GetElapsedMilliseconds() << std::endl;
a.Stop();
EXPECT_FALSE(a.IsRunning());
EXPECT_EQ(0.0f, a.GetElapsedSeconds());
EXPECT_EQ(0.0f, a.GetElapsedMilliseconds());
}
示例8: _tmain
//.........这里部分代码省略.........
if(iMinMergeLength < 0 || iMinMergeLength > cMaxLengthRange)
{
printf("Error: Minimum output merged element length '-m%d' is not in range 0..%d",iMinMergeLength,cMaxLengthRange);
exit(1);
}
iMaxMergeLength = MaxMergeLength->count ? MaxMergeLength->ival[0] : cDfltMaxLength;
if(iMaxMergeLength < iMinMergeLength || iMaxMergeLength > cMaxLengthRange)
{
printf("Error: Maximum element length '-M%d' is not in range %d..%d",iMaxMergeLength,iMinMergeLength,cMaxLengthRange);
exit(1);
}
iJoinDistance = JoinDistance->count ? JoinDistance->ival[0] : cDfltJoinOverlap;
if(iJoinDistance < 0 || iJoinDistance > cMaxJoinOverlap)
{
printf("Error: Join separation length '-j%d' is not in range %d..%d",iJoinDistance,0,cMaxJoinOverlap);
exit(1);
}
iRefExtend = RefExtend->count ? RefExtend->ival[0] : 0;
if(iRefExtend < (-1 * cMaxExtendLength) || iRefExtend > cMaxExtendLength)
{
printf("Error: Ref Extension length '-e%d' is not in range %d..%d",iRefExtend,(-1 * cMaxExtendLength),cMaxExtendLength);
exit(1);
}
iRelExtend = RelExtend->count ? RelExtend->ival[0] : 0;
if(iRelExtend < (-1 * cMaxExtendLength) || iRelExtend > cMaxExtendLength)
{
printf("Error: Rel Extension length '-E%d' is not in range %d..%d",iRelExtend,(-1 * cMaxExtendLength),cMaxExtendLength);
exit(1);
}
strncpy(szRefFile,RefFile->filename[0],_MAX_PATH);
szRefFile[_MAX_PATH-1] = '\0';
if(RelFile->count)
{
strncpy(szRelFile,RelFile->filename[0],_MAX_PATH);
szRelFile[_MAX_PATH-1] = '\0';
}
else
{
if(iProcMode == ePMElRefExclusive || iProcMode == ePMElRefRelUnion)
szRelFile[0] = '\0';
else
{
printf("Error: Rel loci file must be specified in processing mode '-p%d' (%s)",iProcMode,ProcMode2Txt((etProcMode)iProcMode));
exit(1);
}
}
// now that command parameters have been parsed then initialise diagnostics log system
if(!gDiagnostics.Open(szLogFile,(etDiagLevel)iScreenLogLevel,(etDiagLevel)iFileLogLevel,true))
{
printf("\nError: Unable to start diagnostics subsystem.");
if(szLogFile[0] != '\0')
printf(" Most likely cause is that logfile '%s' can't be opened/created",szLogFile);
exit(1);
}
gDiagnostics.DiagOut(eDLInfo,gszProcName,"Version: %s Processing parameters:",cpszProgVer);
gDiagnostics.DiagOutMsgOnly(eDLInfo,"Processing Mode: %d (%s)",iProcMode,ProcMode2Txt((etProcMode)iProcMode));
gDiagnostics.DiagOutMsgOnly(eDLInfo,"Reference CSV file: '%s'",szRefFile);
if(szRelFile[0] != '\0')
gDiagnostics.DiagOutMsgOnly(eDLInfo,"Relative CSV file: '%s'",szRelFile);
gDiagnostics.DiagOutMsgOnly(eDLInfo,"Output processed loci into CSV file: '%s'",szOutLociFile);
gDiagnostics.DiagOutMsgOnly(eDLInfo,"Output loci file ref species: '%s'",szRefSpecies);
gDiagnostics.DiagOutMsgOnly(eDLInfo,"Output loci file rel species: '%s'",szRelSpecies);
gDiagnostics.DiagOutMsgOnly(eDLInfo,"Output loci file element type: '%s'",szElType);
gDiagnostics.DiagOutMsgOnly(eDLInfo,"Minimum input element length: %d",iMinLength);
gDiagnostics.DiagOutMsgOnly(eDLInfo,"Maximum input element length: %d",iMaxLength);
gDiagnostics.DiagOutMsgOnly(eDLInfo,"Ref element flank extension length: %d",iRefExtend);
gDiagnostics.DiagOutMsgOnly(eDLInfo,"Rel element flank extension length: %d",iRelExtend);
gDiagnostics.DiagOutMsgOnly(eDLInfo,"Merge output elements separated by at most this many bases: %d",iJoinDistance);
gDiagnostics.DiagOutMsgOnly(eDLInfo,"Minimum output merged element length: %d",iMinMergeLength);
gDiagnostics.DiagOutMsgOnly(eDLInfo,"Maximum output merged element length: %d",iMaxMergeLength);
// processing here...
gStopWatch.Start();
#ifdef _WIN32
SetPriorityClass(GetCurrentProcess(), BELOW_NORMAL_PRIORITY_CLASS);
#endif
Rslt = Process((etProcMode)iProcMode,iMinLength,iMaxLength,iRefExtend,iRelExtend,iJoinDistance,iMinMergeLength,iMaxMergeLength,szRefFile,szRelFile,szOutLociFile,
szRefSpecies,szRelSpecies,szElType);
gStopWatch.Stop();
Rslt = Rslt >=0 ? 0 : 1;
gDiagnostics.DiagOut(eDLInfo,gszProcName,"Exit code: %d Total processing time: %s",Rslt,gStopWatch.Read());
exit(Rslt);
}
else
{
printf("\n%s CSV Merge Elements, Version %s\n",gszProcName,cpszProgVer);
arg_print_errors(stdout,end,gszProcName);
arg_print_syntax(stdout,argtable,"\nUse '-h' to view option and parameter usage\n");
exit(1);
}
}
示例9: _tmain
//.........这里部分代码省略.........
exit(1);
}
strncpy(szRsltsFile,rsltsfile->filename[0],_MAX_PATH);
szRsltsFile[_MAX_PATH-1] = '\0';
CUtility::TrimQuotedWhitespcExtd(szRsltsFile);
if(szRsltsFile[0] == '\0')
{
printf("\nError: No results file ('-o<file> option') specified after removal of leading/trailing quotes and whitespace");
exit(1);
}
NumIncludeChroms = IncludeChroms->count;
for(Idx=0;Idx < IncludeChroms->count; Idx++)
{
LenChromList = (int)strlen(IncludeChroms->sval[Idx]);
pszIncludeChroms[Idx] = new char [LenChromList+1];
strcpy(pszIncludeChroms[Idx],IncludeChroms->sval[Idx]);
CUtility::TrimQuotes(pszIncludeChroms[Idx]);
}
NumExcludeChroms = ExcludeChroms->count;
for(Idx=0;Idx < ExcludeChroms->count; Idx++)
{
LenChromList = (int)strlen(ExcludeChroms->sval[Idx]);
pszExcludeChroms[Idx] = new char [LenChromList+1];
strcpy(pszExcludeChroms[Idx],ExcludeChroms->sval[Idx]);
CUtility::TrimQuotes(pszExcludeChroms[Idx]);
}
// now that command parameters have been parsed then initialise diagnostics log system
if(!gDiagnostics.Open(szLogFile,(etDiagLevel)iScreenLogLevel,(etDiagLevel)iFileLogLevel,true))
{
printf("\nError: Unable to start diagnostics subsystem.");
if(szLogFile[0] != '\0')
printf(" Most likely cause is that logfile '%s' can't be opened/created",szLogFile);
exit(1);
}
gDiagnostics.DiagOut(eDLInfo,gszProcName,"Version: %d.%2.2d Processing parameters:",cProgVer/100,cProgVer%100);
const char *pszProcMode;
switch(PMode) {
case ePMNDyadRegionDist:
pszProcMode = "background dyad regional distribution";
break;
case ePMNDyadOverlap:
pszProcMode = "sample dyads overlap onto background dyads";
break;
};
gDiagnostics.DiagOutMsgOnly(eDLInfo,"Processing mode: '%s'",pszProcMode);
gDiagnostics.DiagOutMsgOnly(eDLInfo,"offset background loci by: %d",BkgDyadOfs);
if(PMode == ePMNDyadOverlap)
{
gDiagnostics.DiagOutMsgOnly(eDLInfo,"offset sample loci by: %d",SmplDyadOfs);
gDiagnostics.DiagOutMsgOnly(eDLInfo,"window flanking: %d",WindDyad);
}
gDiagnostics.DiagOutMsgOnly(eDLInfo,"input background loci file: '%s'",szDyadFile);
if(PMode == ePMNDyadOverlap)
gDiagnostics.DiagOutMsgOnly(eDLInfo,"input sample loci file: '%s'",szSampleFile);
gDiagnostics.DiagOutMsgOnly(eDLInfo,"results file: '%s'",szRsltsFile);
for(Idx = 0; Idx < NumIncludeChroms; Idx++)
gDiagnostics.DiagOutMsgOnly(eDLInfo,"reg expressions defining chroms to include: '%s'",pszIncludeChroms[Idx]);
for(Idx = 0; Idx < NumExcludeChroms; Idx++)
gDiagnostics.DiagOutMsgOnly(eDLInfo,"reg expressions defining chroms to exclude: '%s'",pszExcludeChroms[Idx]);
#ifdef _WIN32
SetPriorityClass(GetCurrentProcess(), BELOW_NORMAL_PRIORITY_CLASS);
#endif
gStopWatch.Start();
Rslt = Process(PMode, // processing mode
BkgDyadOfs, // offset background loci by this many bases to derive dyad loci
SmplDyadOfs, // offset sample loci by this many bases to derive dyad loci
WindDyad, // accept sample dyad as matching background loci if within +/- this many bases
NumIncludeChroms,
pszIncludeChroms,
NumExcludeChroms,
pszExcludeChroms,
szDyadFile, // CSV file containing background dyad loci
szSampleFile, // CSV file containing sample dyad loci
szRsltsFile); // output results to this file
gStopWatch.Stop();
Rslt = Rslt >=0 ? 0 : 1;
gDiagnostics.DiagOut(eDLInfo,gszProcName,"Exit code: %d Total processing time: %s",Rslt,gStopWatch.Read());
exit(Rslt);
}
else
{
arg_print_errors(stdout,end,gszProcName);
arg_print_syntax(stdout,argtable,"\nend of help\n");
exit(1);
}
return 0;
}
示例10: _tmain
//.........这里部分代码省略.........
{
gDiagnostics.DiagOut(eDLFatal,gszProcName,"Error: No input alignment file(s) specified with with '-I<filespec>' option)");
exit(1);
}
for(NumAlignFiles=Idx=0;NumAlignFiles < cRRMaxInFileSpecs && Idx < alignfiles->count; Idx++)
{
pszAlignFiles[Idx] = NULL;
if(pszAlignFiles[NumAlignFiles] == NULL)
pszAlignFiles[NumAlignFiles] = new char [_MAX_PATH];
strncpy(pszAlignFiles[NumAlignFiles],alignfiles->filename[Idx],_MAX_PATH);
pszAlignFiles[NumAlignFiles][_MAX_PATH-1] = '\0';
CUtility::TrimQuotedWhitespcExtd(pszAlignFiles[NumAlignFiles]);
if(pszAlignFiles[NumAlignFiles][0] != '\0')
NumAlignFiles++;
}
if(!NumAlignFiles)
{
gDiagnostics.DiagOut(eDLFatal,gszProcName,"Error: After removal of whitespace, no input alignment file(s) specified with '-I<filespec>' option");
exit(1);
}
// number of alignment files must be same as the number of SNP files and genome names!
if(NumAlignFiles != NumSNPFiles && NumAlignFiles != NumRelGenomes)
{
gDiagnostics.DiagOut(eDLFatal,gszProcName,"Error: Expected same number of genome names, alignment files and SNP files, %d genome names, %d alignment files, %d SNP files",NumRelGenomes,NumAlignFiles,NumSNPFiles);
exit(1);
}
MinSpeciesTotCntThres = mincovspecies->count ? mincovspecies->ival[0] : 1;
if(MinSpeciesTotCntThres < 1 || MinSpeciesTotCntThres > 10000)
{
gDiagnostics.DiagOut(eDLFatal,gszProcName,"Error: Minimum species total bases '-z%d' must be in range 1..10000",MinSpeciesTotCntThres);
exit(1);
}
MinSpeciesWithCnts = mincovspecies->count ? mincovspecies->ival[0] : 1;
if(MinSpeciesWithCnts < 1 || MinSpeciesWithCnts > NumAlignFiles)
{
gDiagnostics.DiagOut(eDLFatal,gszProcName,"Error: Minimum species to call marker '-Z%d' must be in range 1..%d",NumAlignFiles);
exit(1);
}
// show user current resource limits
#ifndef _WIN32
gDiagnostics.DiagOut(eDLInfo, gszProcName, "Resources: %s",CUtility::ReportResourceLimits());
#endif
gDiagnostics.DiagOut(eDLInfo,gszProcName,"Processing parameters:");
const char *pszDescr;
switch(PMode) {
case ePMdefault:
pszDescr = "Default marker processing";
break;
}
gDiagnostics.DiagOutMsgOnly(eDLInfo,"Processing mode is : '%s'",pszDescr);
gDiagnostics.DiagOutMsgOnly(eDLInfo,"Minimum coverage : %d",MinCovBases);
gDiagnostics.DiagOutMsgOnly(eDLInfo,"Maximum P-Value : %1.4f'",MaxPValue);
gDiagnostics.DiagOutMsgOnly(eDLInfo,"Reference genome assembly name : '%s'",szRefGenome);
gDiagnostics.DiagOutMsgOnly(eDLInfo,"Minimum total bases for species at SNP call loci : %d",MinSpeciesTotCntThres);
gDiagnostics.DiagOutMsgOnly(eDLInfo,"Maximum alternative species coverage at SNP call loci : %d",AltSpeciesMaxCnt);
gDiagnostics.DiagOutMsgOnly(eDLInfo,"Minimum number of species with SNP call at same loci : %d",MinSpeciesWithCnts);
for(Idx=0; Idx < NumRelGenomes; Idx++)
gDiagnostics.DiagOutMsgOnly(eDLInfo,"Alignments and SNPs from this genome (%d) : '%s'",Idx+1,pszRelGenomes[Idx]);
for(Idx=0; Idx < NumSNPFiles; Idx++)
gDiagnostics.DiagOutMsgOnly(eDLInfo,"Input SNP file (%d) : '%s'",Idx+1,pszSNPFiles[Idx]);
for(Idx=0; Idx < NumAlignFiles; Idx++)
gDiagnostics.DiagOutMsgOnly(eDLInfo,"Input alignment file (%d) : '%s'",Idx+1,pszAlignFiles[Idx]);
gDiagnostics.DiagOutMsgOnly(eDLInfo,"Output markers to file : '%s'",szMarkerFile);
gDiagnostics.DiagOutMsgOnly(eDLInfo,"number of threads : %d",NumThreads);
#ifdef _WIN32
SetPriorityClass(GetCurrentProcess(), BELOW_NORMAL_PRIORITY_CLASS);
#endif
gStopWatch.Start();
Rslt = Process(PMode,MinCovBases,MaxPValue,MinSpeciesTotCntThres,MinSpeciesWithCnts,AltSpeciesMaxCnt,szRefGenome,NumRelGenomes,pszRelGenomes,NumThreads,NumSNPFiles,pszSNPFiles,NumAlignFiles,pszAlignFiles,szMarkerFile);
gStopWatch.Stop();
Rslt = Rslt >=0 ? 0 : 1;
gDiagnostics.DiagOut(eDLInfo,gszProcName,"Exit code: %d Total processing time: %s",Rslt,gStopWatch.Read());
exit(Rslt);
}
else
{
printf("\n%s Generate Markers, Version %s\n",gszProcName,cpszProgVer);
arg_print_errors(stdout,end,gszProcName);
arg_print_syntax(stdout,argtable,"\nUse '-h' to view option and parameter usage\n");
exit(1);
}
return 0;
}
示例11: _tmain
//.........这里部分代码省略.........
iMode = Mode->count ? Mode->ival[0] : eProcModeStandard;
if(iMode < eProcModeStandard || iMode > eProcModeStandard)
{
printf("\nError: Requested processing mode '-x%d' not supported",iMode);
exit(1);
}
if(RegionsIn->count)
{
strcpy(szRegionsIn,RegionsIn->sval[0]);
TrimQuotes(szRegionsIn);
if((iRegionsIn = ParseRegions(szRegionsIn)) < 0)
{
printf("Error: unable to parse '-r%s' into regions to retain",szRegionsIn);
exit(1);
}
}
else
{
szRegionsIn[0] = '\0';
iRegionsIn = (cFeatBitIG | cFeatBitUpstream | cFeatBit5UTR | cFeatBitCDS | cFeatBitIntrons | cFeatBit3UTR | cFeatBitDnstream);
}
if(RegionsOut->count)
{
strcpy(szRegionsOut,RegionsOut->sval[0]);
TrimQuotes(szRegionsOut);
if((iRegionsOut = ParseRegions(szRegionsOut)) < 0)
{
printf("Error: unable to parse '-R%s' into regions to remove",szRegionsOut);
exit(1);
}
}
else
{
szRegionsOut[0] = '\0';
iRegionsOut = 0;
}
iRegionsIn &= ~iRegionsOut;
if(!iRegionsIn)
{
printf("Error: no regions to retain");
exit(1);
}
iRegLen = RegLen->count ? RegLen->ival[0] : cDfltRegLen;
if(iRegLen < cMinRegLen)
{
printf("\nRegulatory region length '-L%d' less than minimum %d, assuming you meant to use '-L%d'",iRegLen,cMinRegLen,cMinRegLen);
iRegLen = cMinRegLen;
}
else
{
if(iRegLen > cMaxRegLen)
{
printf("\nRegulatory region length '-L%d' more than maximum %d, assuming you meant to use '-L%d'",iRegLen,cMaxRegLen,cMaxRegLen);
iRegLen = cMaxRegLen;
}
}
strcpy(szInputFile,InFile->filename[0]);
strcpy(szOutputFile,OutFile->filename[0]);
strcpy(szInputBiobedFile,InBedFile->filename[0]);
strcpy(szInSeqFile,InSeqFile->filename[0]);
// now that command parameters have been parsed then initialise diagnostics log system
if(!gDiagnostics.Open(szLogFile,(etDiagLevel)iScreenLogLevel,(etDiagLevel)iFileLogLevel,true))
{
printf("\nError: Unable to start diagnostics subsystem.");
if(szLogFile[0] != '\0')
printf(" Most likely cause is that logfile '%s' can't be opened/created",szLogFile);
exit(1);
}
gDiagnostics.DiagOut(eDLInfo,gszProcName,"Version: %d.%2.2d Processing parameters:",cProgVer/100,cProgVer%100);
gDiagnostics.DiagOutMsgOnly(eDLInfo,"Loci file (.csv) file to process: '%s'",szInputFile);
gDiagnostics.DiagOutMsgOnly(eDLInfo,"bio assembly (.seq) file to process: '%s'",szInSeqFile);
gDiagnostics.DiagOutMsgOnly(eDLInfo,"where to write out fasta with random sequences: '%s'",szOutputFile);
gDiagnostics.DiagOutMsgOnly(eDLInfo,"biobed file containing regional features: '%s'",szInputBiobedFile);
gDiagnostics.DiagOutMsgOnly(eDLInfo,"Processing mode: %s",iMode == eProcModeStandard ? "standard" : iMode == eProcModeStandard ? "extended" : "summary");
gDiagnostics.DiagOutMsgOnly(eDLInfo,"Accept random samples in any of these regions: '%s'",Regions2Txt(iRegionsIn));
#ifdef _WIN32
SetPriorityClass(GetCurrentProcess(), BELOW_NORMAL_PRIORITY_CLASS);
#endif
Rslt = Process(iMode,iRegionsIn,iRegLen,szInputFile,szInputBiobedFile,szInSeqFile,szOutputFile);
gStopWatch.Stop();
Rslt = Rslt < 0 ? 1 : 0;
gDiagnostics.DiagOut(eDLInfo,gszProcName,"Exit Code: %d Total processing time: %s",Rslt,gStopWatch.Read());
exit(Rslt);
}
else
{
arg_print_errors(stdout,end,gszProcName);
arg_print_syntax(stdout,argtable,"\nend of help\n");
exit(1);
}
}
示例12: DetectBridgeGroups
void CBathymetryRasterizer::DetectBridgeGroups()
{
CStopWatch sw;
sw.Start();
static vector<vec2i> const Neighbors =
{
vec2i(-1, 0),
vec2i(1, 0),
vec2i(0, -1),
vec2i(0, 1),
};
int Tag = 1;
while (TagGroups[Tag].count)
{
vector<vec2i> const Group = Helper_GetAllMatchingGroup(Tag);
bool NextToData = false;
bool NextToLand = false;
vec2i LandPt, DataPt;
for (auto Tile : Group)
{
for (auto Neighbor : Neighbors)
{
auto Bucket = Helper_GetBucket(Tile + Neighbor);
if (Bucket)
{
if (Bucket->Count > 0)
{
NextToData = true;
DataPt = Tile;
if (NextToLand)
{
break;
}
}
if (Bucket->Tag == -1)
{
NextToLand = true;
LandPt = Tile;
if (NextToData)
{
break;
}
}
}
}
if (NextToData && NextToLand)
{
break;
}
}
if (NextToData && NextToLand)
{
TagGroups[Tag].IsBridge = true;
Log::Info(" Tag group %d is bridge because {%d, %d} next to Data and {%d, %d} next to Land", Tag, DataPt.X, DataPt.Y, LandPt.X, LandPt.Y);
}
Tag ++;
}
Log::Info("Detect bridge groups took %.3f", sw.Stop());
}
示例13: _tmain
//.........这里部分代码省略.........
{
gDiagnostics.DiagOut(eDLFatal,gszProcName,"Error: After removal of whitespace, no SQLite experiment name specified with '-w<str>' option");
return(1);
}
if(experimentdescr->count)
{
strncpy(szExperimentDescr,experimentdescr->sval[0],sizeof(szExperimentDescr)-1);
szExperimentDescr[sizeof(szExperimentDescr)-1] = '\0';
CUtility::TrimQuotedWhitespcExtd(szExperimentDescr);
}
if(strlen(szExperimentDescr) < 1)
{
gDiagnostics.DiagOut(eDLFatal,gszProcName,"Error: After removal of whitespace, no SQLite experiment description specified with '-W<str>' option");
return(1);
}
gExperimentID = gSQLiteSummaries.StartExperiment(szSQLiteDatabase,false,true,szExperimentName,szExperimentName,szExperimentDescr);
if(gExperimentID < 1)
return(1);
gProcessID = gSQLiteSummaries.AddProcess((char *)gszProcName,(char *)gszProcName,(char *)szExperimentDescr);
if(gProcessID < 1)
return(1);
gProcessingID = gSQLiteSummaries.StartProcessing(gExperimentID,gProcessID,(char *)cpszProgVer);
if(gProcessingID < 1)
return(1);
gDiagnostics.DiagOut(eDLInfo,gszProcName,"Initialised SQLite database '%s' for results summary collection",szSQLiteDatabase);
gDiagnostics.DiagOut(eDLInfo,gszProcName,"SQLite database experiment identifier for '%s' is %d",szExperimentName,gExperimentID);
gDiagnostics.DiagOut(eDLInfo,gszProcName,"SQLite database process identifier for '%s' is %d",(char *)gszProcName,gProcessID);
gDiagnostics.DiagOut(eDLInfo,gszProcName,"SQLite database processing instance identifier is %d",gProcessingID);
}
else
{
szSQLiteDatabase[0] = '\0';
szExperimentDescr[0] = '\0';
}
PMode = mode->count ? mode->ival[0] : 0;
if(PMode < 0 || PMode > 1)
{
gDiagnostics.DiagOut(eDLFatal,gszProcName,"Error: Processing mode '-m%d' must be in range 0..0",PMode);
return(1);
}
strcpy(szInPE1File,inpe1file->filename[0]);
CUtility::TrimQuotedWhitespcExtd(szInPE1File);
strcpy(szInPE2File,inpe2file->filename[0]);
CUtility::TrimQuotedWhitespcExtd(szInPE2File);
strcpy(szOutFile,outfile->filename[0]);
CUtility::TrimQuotedWhitespcExtd(szOutFile);
// show user current resource limits
#ifndef _WIN32
gDiagnostics.DiagOut(eDLInfo, gszProcName, "Resources: %s",CUtility::ReportResourceLimits());
#endif
gDiagnostics.DiagOut(eDLInfo,gszProcName,"Processing parameters:");
const char *pszDescr;
switch(PMode) {
case 0:
pszDescr = "Corelate PE1 and PE2 alignments";
break;
}
gDiagnostics.DiagOutMsgOnly(eDLInfo,"Processing mode is : '%s'",pszDescr);
gDiagnostics.DiagOutMsgOnly(eDLInfo,"Experiment name : '%s'",szExperimentName);
gDiagnostics.DiagOutMsgOnly(eDLInfo,"Experiment description : '%s'",szExperimentDescr);
gDiagnostics.DiagOutMsgOnly(eDLInfo,"SQLite database file: '%s'",szOutFile);
gDiagnostics.DiagOutMsgOnly(eDLInfo,"PE1 SAM file: '%s'",szInPE1File);
gDiagnostics.DiagOutMsgOnly(eDLInfo,"PE2 SAM file: '%s'",szInPE2File);
gDiagnostics.DiagOutMsgOnly(eDLInfo,"Corelations to file: '%s'",szOutFile);
#ifdef _WIN32
SetPriorityClass(GetCurrentProcess(), BELOW_NORMAL_PRIORITY_CLASS);
#endif
gStopWatch.Start();
Rslt = Process(PMode,szInPE1File,szInPE2File,szOutFile);
Rslt = Rslt >=0 ? 0 : 1;
if(gExperimentID > 0)
{
if(gProcessingID)
gSQLiteSummaries.EndProcessing(gProcessingID,Rslt);
gSQLiteSummaries.EndExperiment(gExperimentID);
}
gStopWatch.Stop();
gDiagnostics.DiagOut(eDLInfo,gszProcName,"Exit code: %d Total processing time: %s",Rslt,gStopWatch.Read());
exit(Rslt);
}
else
{
printf("\n%s, Version %s\n", gszProcName,cpszProgVer);
arg_print_errors(stdout,end,gszProcName);
arg_print_syntax(stdout,argtable,"\nUse '-h' to view option and parameter usage\n");
exit(1);
}
return 0;
}
示例14: ClassifyGroups
void CBathymetryRasterizer::ClassifyGroups()
{
CStopWatch sw;
sw.Start();
vector<STriangle2D<double>> Triangles;
AddAtEnd(Triangles, TriangulateEarClipping(CatalinaOutline));
AddAtEnd(Triangles, TriangulateEarClipping(BirdRock));
for (int i = 0; i < ImageSize; ++ i)
{
for (int j = 0; j < ImageSize; ++ j)
{
bool InsideTriangle = false;
vec2d const Point = vec2d(
RegionXCorner + ((double) i / (double) (ImageSize - 1)) * RegionXSize,
RegionYCorner + ((double) j / (double) (ImageSize - 1)) * RegionYSize
);
for (auto const & Triangle : Triangles)
{
if (ion::IsPointInOrOnTriangle(Triangle.A, Triangle.C, Triangle.B, Point))
{
InsideTriangle = true;
break;
}
}
if (InsideTriangle)
{
auto Bucket = Helper_GetBucket(i, j);
Bucket->Tag = -1;
Bucket->Count = 1;
Bucket->Sum = 0;
}
}
}
int tag = 1;
TagGroups = new STagInfo[ImageSize * ImageSize]();
for (int i = 0; i < ImageSize; ++ i)
{
for (int j = 0; j < ImageSize; ++ j)
{
TagGroups[tag].count = Helper_FillBucketTags(i, j, tag);
if (TagGroups[tag].count)
{
TagGroups[tag].start_x = i;
TagGroups[tag].start_y = j;
tag ++;
}
}
}
tag = 1;
while (TagGroups[tag].count)
{
Log::Info(" Group %d has %d members", tag, TagGroups[tag].count);
tag ++;
}
Log::Info("Classify groups took %.3f", sw.Stop());
}
示例15: SimulateInOut
//.........这里部分代码省略.........
});
loader.OnParsed([](const InfoTextLoader::LinedataType& data)
{
cout << "[" << std::setfill('0') << std::setw(3) << 0 << "]Data : (" << data.data.size() << ") " << data.line << endl;
});
instreamCText >> loader;
cout << "Version of CText data stream was: " << loader.Version() << " " << endl;
cout << endl;
//gui::components::CPoint p1(0, 0);
CRectangle r1(10, 20, 33, 55);
cout << "Simulate running" << endl;
cout << r1 << endl;
std::ostringstream outstring;
outstring << r1;
std::string outFromr1 = outstring.str();
std::istringstream instream;
instream.str(outFromr1);
CRectangle r2;
//std::cin >> r2;
instream >> r2;
cout << r2 << endl;
{
std::istringstream instream2;
instream2.str("\"Older Depp, Du.\"");
std::locale x(std::locale::classic(), new my_ctypeComma);
instream2.imbue(x);
std::string tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
instream2 >> tmp1;
instream2 >> tmp2;
instream2 >> tmp3;
instream2 >> tmp4;
instream2 >> tmp5;
}
//std::string newstr = "CText Arial, \"Use the up and down arrow or[w] and[s] to move the menu
// cursor up and down.\", DarkRed;";
std::string newstr = "CText Arial, 34, \"Use the up and down arrow, or[w] and[s] to move the menu cursor up and down.\", DarkRed;";
{
std::string delimiters("\",;");
std::vector<std::string> parts;
split(parts, newstr, boost::is_any_of(delimiters));
}
{
std::istringstream instream4;
instream4.str(newstr);
std::string sin((std::istreambuf_iterator<char>(instream4)),
std::istreambuf_iterator<char>());
//std::regex
// word_regex(",(?!(?<=(?:^|,)\s*\"(?:[^\"]|\"\"|\\\")*,)(?:[^\"]|\"\"|\\\")*\"\s*(?:,|$))");
std::regex word_regex(",(?=([^\"]*\"[^\"]*\")*[^\"]*$)");
auto what =
std::sregex_iterator(sin.begin(), sin.end(), word_regex);
auto wend = std::sregex_iterator();
std::vector<std::string> v;
for(; what != wend; ++what) {
std::smatch match = *what;
v.push_back(match.str());
}
}
cout << endl;
cout << endl;
const int iMax = 1000;
const char* versionString = "Version 1.2.3.4";
stdcOut(iMax << " * Version parse of '" << versionString << "'.");
CStopWatch sw;
sw.Start();
//std::time()
VersionToken vtok1;
for(int i = 0; i < iMax; ++i)
{
std::istringstream instream3;
instream3.str(versionString);
instream3 >> vtok1;
/*std::istringstream instreamCText2;
instreamCText2.str(str);
//instreamCText2.seekg(std::ios_base::beg);
InfoTextLoader loader2;
instreamCText2 >> loader2;*/
}
sw.Stop();
cout << "Time: " << sw.GetDuration() << endl;
cout << "VersionToken: " << vtok1 << endl;
cout << endl;
cout << endl;
// Todo: create a version class derived from a token class in the serializer lib
// that reads in versioned stuff from iostream.
} // SimulateInOut