コード例 #1
0
const std::pair<std::string,std::string> ribi::trim::TriangleMeshBuilder::CreateCells() const noexcept
{
  PROFILE_FUNC();

  std::stringstream out_owner;
  out_owner
    << static_cast<int>(m_faces.size())
    << "\n(\n";

  std::stringstream out_neighbour;
  out_neighbour
    << m_faces.size()
    << "\n(\n";

  for (auto face: m_faces)
  {
    assert(face);
    assert(face->GetOwner());
    out_owner << face->GetOwner()->GetIndex() << "\n";
    if(!face->GetNeighbour())
    {
      out_neighbour << "-1\n";
    }
    else
    {
      out_neighbour << face->GetNeighbour()->GetIndex() << "\n";
    }
  }

  out_owner << ")";
  out_neighbour << ")";
  return std::make_pair(out_owner.str(),out_neighbour.str());
}
コード例 #2
0
const std::string ribi::trim::TriangleMeshBuilder::CreateNodes() const noexcept
{
  PROFILE_FUNC();

  std::string text;
  for (const auto point: m_points)
  {
    std::stringstream s;
    int cnt = 0;
    for (const double p:
      {
        point->GetCoordinat()->GetX(),
        point->GetCoordinat()->GetY(),
        point->GetZ().value()
      }
    )
    {
      s << std::setprecision(cnt != 2 ? 17 : 3);
      s << p << " ";
      ++cnt;
    }
    std::string t = s.str();
    assert(t[t.size() - 1] == ' '); //Replace last space
    t[t.size() - 1] = '\n';
    text += t;

  }
  return text;
}
コード例 #3
0
        void oni_adapter_plugin::init_openni()
        {
            PROFILE_FUNC();
            openni::Version version = openni::OpenNI::getVersion();

            LOG_INFO("orbbec.ni.oni_adapter_plugin", "Initializing OpenNI v%d.%d.%d.%d",
                  version.major,
                  version.minor,
                  version.maintenance,
                  version.build);

            openni::Status rc = openni::STATUS_OK;

            openni::OpenNI::addDeviceConnectedListener(this);
            openni::OpenNI::addDeviceDisconnectedListener(this);

            rc = openni::OpenNI::initialize();

            bool successful = rc == openni::STATUS_OK;

            if (!successful)
            {
                LOG_WARN("orbbec.ni.oni_adapter_plugin", "Failed to initialize OpenNI: %s", openni::OpenNI::getExtendedError());
            }
            else
            {
                LOG_INFO("orbbec.ni.oni_adapter_plugin", "Initialized OpenNI v%d.%d.%d.%d",
                      version.major,
                      version.minor,
                      version.maintenance,
                      version.build);
            }
        }
コード例 #4
0
// Returns attack odds out of 100 (the higher, the better...)
int CvSelectionGroupAI::AI_attackOdds(const CvPlot* pPlot, bool bPotentialEnemy) const
{
	PROFILE_FUNC();

	CvUnit* pAttacker;

	FAssert(getOwnerINLINE() != NO_PLAYER);

/************************************************************************************************/
/* BETTER_BTS_AI_MOD                      02/21/10                                jdog5000      */
/*                                                                                              */
/* Efficiency, Lead From Behind                                                                 */
/************************************************************************************************/
	// From Lead From Behind by UncutDragon
	// original
	//if (pPlot->getBestDefender(NO_PLAYER, getOwnerINLINE(), NULL, !bPotentialEnemy, bPotentialEnemy) == NULL)
	// modified
	if (!pPlot->hasDefender(false, NO_PLAYER, getOwnerINLINE(), NULL, !bPotentialEnemy, bPotentialEnemy))
/************************************************************************************************/
/* BETTER_BTS_AI_MOD                       END                                                  */
/************************************************************************************************/
	{
		return 100;
	}

	int iOdds = 0;
	pAttacker = AI_getBestGroupAttacker(pPlot, bPotentialEnemy, iOdds);

	if (pAttacker == NULL)
	{
		return 0;
	}

	return iOdds;
}
コード例 #5
0
//------------------------------------------------------------------------------------------------------
//
//  FUNCTION:   void Init2DIntList(int*** pppiList, int iSizeX, int iSizeY)
//
//  PURPOSE :   allocate and initialize a 2d array of int data
//
//------------------------------------------------------------------------------------------------------
void CvXMLLoadUtility::Init2DIntList(int*** pppiList, int iSizeX, int iSizeY)
{
	// SPEEDUP
	PROFILE_FUNC();
	int i,j;	// loop counters
	int** ppiList;

	FAssertMsg(*pppiList == NULL,"memory leak?");
	FAssertMsg(((0 < iSizeX) && (0 < iSizeY)), "list size to allocate is less than 1");
	// allocate the memory for the array of pointers to arrays of ints
	*pppiList = new int *[iSizeX];
	// set the local pointer to the newly allocated memory
	ppiList = *pppiList;

	// loop through each of the pointers
	for (i=0;i<iSizeX;i++)
	{
		// allocate a list of ints for the current pointer
		ppiList[i] = new int[iSizeY];
		// loop through all of the current pointer's ints
		for (j=0;j<iSizeY;j++)
		{
			// set the current int to zero
			ppiList[i][j] = 0;
		}
	}
}
コード例 #6
0
ファイル: lua_util.cpp プロジェクト: miho/ugcore
bool ParseAndExecuteBuffer(const char* buffer, const char *bufferName)
{
	PROFILE_FUNC();
	lua_State* L = GetDefaultLuaState();

	lua_pushcfunction(L, luaCallStackError);

	PROFILE_BEGIN(luaL_loadbuffer);
	int error = luaL_loadbuffer(L, buffer, strlen(buffer), bufferName);
	PROFILE_END_(luaL_loadbuffer);

	if(error == 0)
	{
		PROFILE_BEGIN(lua_pcall);
		error = lua_pcall(L, 0, 0, -2);
	}

	if(error)
	{
		string msg = lua_tostring(L, -1);
		lua_pop(L, 1);
		if(msg.find("__UG__LUA__EMPTY__MSG__") == string::npos)
			throw(LuaError(msg.c_str()));
		else
			throw(LuaError());
	}

	return true;

}
コード例 #7
0
ファイル: dcsmq.cpp プロジェクト: jj4jj/adjust_reporter
int     dcsmq_poll(dcsmq_t*  smq, int max_time_us){	
	PROFILE_FUNC();
	int64_t past_us = 0, start_us, now_us;
	start_us = dcsutil::time_unixtime_us();
	int nproc = 0, ntotal_proc = 0;
    dcsmq_msg_t dcmsg;
    uint64_t recvmsgid;
	while (past_us < max_time_us){
        dcmsg.buffer = (char*)smq->recvbuff;
        dcmsg.sz = smq->conf.msg_buffsz;
        recvmsgid = _dcsmq_recv_msg(smq, smq->recver, smq->session, dcmsg);
        if (recvmsgid == (uint64_t)-1){
            break;
        }
        smq->msg_cb(smq, recvmsgid, dcmsg, smq->msg_cb_ud);
        ++nproc;
		++ntotal_proc;
		if (nproc >= 16){
			now_us = dcsutil::time_unixtime_us();
			past_us +=  (now_us - start_us);
			start_us = now_us;
			nproc = 0;
		}
	}
	return ntotal_proc;
}
コード例 #8
0
//------------------------------------------------------------------------------------------------------
//
//  FUNCTION:   void Init2DDirectionTypesList(DirectionTypes*** pppiList, int iSizeX, int iSizeY)
//
//  PURPOSE :   allocate and initialize a 2d array of DirectionTypes data
//
//------------------------------------------------------------------------------------------------------
void CvXMLLoadUtility::Init2DDirectionTypesList(DirectionTypes*** pppiList, int iSizeX, int iSizeY)
{
	// SPEEDUP
	PROFILE_FUNC();
	int i,j;	// loop counters
	DirectionTypes** ppiList;

	FAssertMsg(*pppiList == NULL,"memory leak?");
	FAssertMsg(((0 < iSizeX) && (0 < iSizeY)), "list size to allocate is less than 1");
	// allocate the memory for the array of pointers to arrays of DirectionTypes
	*pppiList = new DirectionTypes *[iSizeX];
	// set the local pointer to the newly allocated memory
	ppiList = *pppiList;

	// loop through each of the pointers
	for (i=0;i<iSizeX;i++)
	{
		// allocate a list of DirectionTypes for the current pointer
		ppiList[i] = new DirectionTypes[iSizeY];
		// loop through all of the current pointer's DirectionTypes
		for (j=0;j<iSizeY;j++)
		{
			// set the current DirectionTypes to NO_DIRECTION
			ppiList[i][j] = NO_DIRECTION;
		}
	}
}
コード例 #9
0
SequenceOverlapPairVector OverlapExtractorWithCorrection::getExactOverlaps(const std::string& query)
{
    PROFILE_FUNC("OverlapExtractorWithCorrection::queryOverlaps")

    SequenceOverlapPairVector raw_overlaps;

    // 
    // Get inexact overlaps between the query and uncorrected reads by direct FM-index lookups
    //
    getRawOverlapsDirect(query, &raw_overlaps);

    /*
    //
    // Get inexact overlaps between the query and uncorrected reads using the k-mer cache
    //
    // Extract new reads from the FM-index and update the cache
    extractAndUpdate(query);
    extractAndUpdate(reverseComplement(query));

    // Compute overlaps between the query sequence and the raw extracted reads
    getRawOverlapsCached(query, false, &raw_overlaps);
    getRawOverlapsCached(query, true, &raw_overlaps);
    */
    // Convert raw overlaps to corrected, exact overlaps
    SequenceOverlapPairVector out_overlaps;
    getCorrectedExactOverlaps(query, &raw_overlaps, &out_overlaps);
    return out_overlaps;
}
コード例 #10
0
ファイル: treasure_pool.cpp プロジェクト: bluekirby0/darkstar
void CTreasurePool::DelMember(CCharEntity* PChar)
{
	PROFILE_FUNC();
	DSP_DEBUG_BREAK_IF(PChar == NULL);
	DSP_DEBUG_BREAK_IF(PChar->PTreasurePool != this);

	if(m_TreasurePoolType != TREASUREPOOL_ZONE){
		//Zone drops e.g. Dynamis DO NOT remove previous lot info. Everything else does.
		for( int i=0; i<10; i++){
			if(m_PoolItems[i].Lotters.size()>0){
				for(int j=0; j<m_PoolItems[i].Lotters.size(); j++){
					//remove their lot info
					if(PChar->id == m_PoolItems[i].Lotters[j].member->id){
						m_PoolItems[i].Lotters.erase(m_PoolItems[i].Lotters.begin()+j);
					}
				}
			}
		}
	}

	for (uint32 i = 0; i < members.size(); ++i) 
	{
		if (PChar == members.at(i))
		{
			PChar->PTreasurePool = NULL;
			members.erase(members.begin()+i);
			break;
		}
	}
	if (m_TreasurePoolType != TREASUREPOOL_ZONE && members.empty())
	{
		delete this;
		return;
	}
}
コード例 #11
0
void CMobSkillState::Clear()
{
	PROFILE_FUNC();
  CState::Clear();

  m_PMobSkill = NULL;
}
コード例 #12
0
const std::string ribi::trim::TriangleMeshBuilder::CreateOpenFoamFaces() const noexcept
{
  PROFILE_FUNC();

  std::stringstream s;
  s
    << std::setprecision(17)
    << m_faces.size()
    << "\n(\n";

  //Build a list of nodes
  for (auto face: m_faces)
  {
    assert(face);
    std::vector<int> points_indices;
    for (auto point: face->GetPoints())
    {
      points_indices.push_back(point->GetIndex());
    }

    s
      << points_indices.size()
      << "("
      << Implode(std::string(" "),points_indices)
      << ")\n";
  }
  s << ")";

  return s.str();
}
コード例 #13
0
ファイル: HapgenUtil.cpp プロジェクト: nathanhaigh/sga
// Align the haplotype to the reference genome represented by the BWT/SSA pair
void HapgenUtil::alignHaplotypeToReferenceBWASW(const std::string& haplotype,
        const BWTIndexSet& referenceIndex,
        HapgenAlignmentVector& outAlignments)
{
    PROFILE_FUNC("HapgenUtil::alignHaplotypesToReferenceBWASW")
    LRAlignment::LRParams params;

    params.zBest = 20;

    for(size_t i = 0; i <= 1; ++i)
    {
        LRAlignment::LRHitVector hits;
        std::string query = (i == 0) ? haplotype : reverseComplement(haplotype);
        LRAlignment::bwaswAlignment(query, referenceIndex.pBWT, referenceIndex.pSSA, params, hits);

        // Convert the hits into alignments
        for(size_t j = 0; j < hits.size(); ++j)
        {
            int q_alignment_length = hits[j].q_end - hits[j].q_start;

            // Skip non-complete alignments
            if((int)haplotype.length() == q_alignment_length)
            {
                HapgenAlignment aln(hits[j].targetID, hits[j].t_start, hits[j].length, hits[j].G, i == 1);
                outAlignments.push_back(aln);
            }
        }
    }
}
コード例 #14
0
//------------------------------------------------------------------------------------------------------
//
//  FUNCTION:   InitImprovementBonusList(CvImprovementBonusInfo** ppImprovementBonus, int iListLen)
//
//  PURPOSE :   allocate a improvement bonus struct list of iListLen size and initialize it's members
//
//------------------------------------------------------------------------------------------------------
void CvXMLLoadUtility::InitImprovementBonusList(CvImprovementBonusInfo** ppImprovementBonus, int iListLen)
{
	// SPEEDUP
	PROFILE_FUNC();
	int i;	// loop counter
	CvImprovementBonusInfo* paImprovementBonus;

	FAssertMsg(*ppImprovementBonus == NULL,"memory leak?");
	FAssertMsg((0 < iListLen),"list size to allocate is less than 1");
	// allocate memory for the bonus type pointer based on the list length parameter
	*ppImprovementBonus = new CvImprovementBonusInfo[iListLen];
	// set the local pointer to the memory we just allocated
	paImprovementBonus = *ppImprovementBonus;

	// loop through all the bonus structs
	for (i=0;i<iListLen;i++)
	{
		paImprovementBonus[i].m_bBonusMakesValid = false;

		FAssertMsg(paImprovementBonus[i].m_aiYieldChange==NULL, "mem leak");
		paImprovementBonus[i].m_aiYieldChange = new int[NUM_YIELD_TYPES];
		for (int j = 0; j < NUM_YIELD_TYPES; j++)
		{
			paImprovementBonus[i].m_aiYieldChange[j] = 0;
		}

		paImprovementBonus[i].m_iDiscoverRand = 0;
	}
}
コード例 #15
0
ファイル: linkshell.cpp プロジェクト: bluekirby0/darkstar
void CLinkshell::AddMember(CCharEntity* PChar, int8 type)
{
	PROFILE_FUNC();
    members.push_back(PChar);
	Sql_Query(SqlHandle,"UPDATE accounts_sessions SET linkshellid = %u , linkshellrank = %u WHERE charid = %u", this->getID(),type, PChar->id);
    PChar->PLinkshell = this;
}
コード例 #16
0
void CvMapGenerator::addLakes()
{
	PROFILE_FUNC();

	if (gDLL->getPythonIFace()->pythonAddLakes() && !gDLL->getPythonIFace()->pythonUsingDefaultImpl())
	{
		return; // Python override
	}

	gDLL->NiTextOut("Adding Lakes...");
	CvPlot* pLoopPlot;
	int iI;

	for (iI = 0; iI < GC.getMapINLINE().numPlotsINLINE(); iI++)
	{
		gDLL->callUpdater();
		pLoopPlot = GC.getMapINLINE().plotByIndexINLINE(iI);
		FAssertMsg(pLoopPlot != NULL, "LoopPlot is not assigned a valid value");

		if (!(pLoopPlot->isWater()))
		{
			if (!(pLoopPlot->isCoastalLand()))
			{
				if (!(pLoopPlot->isRiver()))
				{
					if (GC.getGameINLINE().getMapRandNum(GC.getXMLval(XML_LAKE_PLOT_RAND), "addLakes") == 0)
					{
						pLoopPlot->setPlotType(PLOT_OCEAN);
					}
				}
			}
		}
	}
}
コード例 #17
0
void CvMapGenerator::addFeatures()
{
	PROFILE_FUNC();

	CvPlot* pPlot;
	int iI, iJ;

	if (gDLL->getPythonIFace()->pythonAddFeatures() && !gDLL->getPythonIFace()->pythonUsingDefaultImpl())
	{
		return; // Python override
	}

	for (iI = 0; iI < GC.getMapINLINE().numPlotsINLINE(); iI++)
	{
		pPlot = GC.getMapINLINE().plotByIndexINLINE(iI);
		FAssert(pPlot != NULL);

		for (iJ = 0; iJ < GC.getNumFeatureInfos(); iJ++)
		{
			if (pPlot->canHaveFeature((FeatureTypes)iJ))
			{
				if (GC.getGameINLINE().getMapRandNum(10000, "addFeaturesAtPlot") < GC.getFeatureInfo((FeatureTypes)iJ).getAppearanceProbability())
				{
					pPlot->setFeatureType((FeatureTypes)iJ);
				}
			}
		}
	}
}
コード例 #18
0
ファイル: CvMap.cpp プロジェクト: Nightinggale/Medieval_Tech
void CvMap::calculateAreas()
{
	PROFILE_FUNC();
	CvPlot* pLoopPlot;
	CvArea* pArea;
	int iArea;
	int iI;

	for (iI = 0; iI < numPlotsINLINE(); iI++)
	{
		pLoopPlot = plotByIndexINLINE(iI);
		gDLL->callUpdater();
		FAssertMsg(pLoopPlot != NULL, "LoopPlot is not assigned a valid value");

		if (pLoopPlot->getArea() == FFreeList::INVALID_INDEX)
		{
			pArea = addArea();
			pArea->init(pArea->getID(), pLoopPlot->isWater());

			iArea = pArea->getID();

			pLoopPlot->setArea(iArea);

			gDLL->getFAStarIFace()->GeneratePath(&GC.getAreaFinder(), pLoopPlot->getX_INLINE(), pLoopPlot->getY_INLINE(), -1, -1, pLoopPlot->isWater(), iArea);
		}
	}
}
コード例 #19
0
ファイル: CvMap.cpp プロジェクト: Nightinggale/Medieval_Tech
//"Check plots for wetlands or seaWater.  Returns true if found"
bool CvMap::findWater(CvPlot* pPlot, int iRange, bool bFreshWater)
{
	PROFILE_FUNC();

	for (int iDX = -(iRange); iDX <= iRange; iDX++)
	{
		for (int iDY = -(iRange); iDY <= iRange; iDY++)
		{
			CvPlot* pLoopPlot	= plotXY(pPlot->getX_INLINE(), pPlot->getY_INLINE(), iDX, iDY);

			if (pLoopPlot != NULL)
			{
				if (bFreshWater)
				{
					if (pLoopPlot->isRiver())
					{
						return true;
					}
				}
				else
				{
					if (pLoopPlot->isWater())
					{
						return true;
					}
				}
			}
		}
	}

	return false;
}
コード例 #20
0
ファイル: ClipperUtils.cpp プロジェクト: jiripech/Slic3r
void PolyTreeToExPolygons(ClipperLib::PolyTree& polytree, Slic3r::ExPolygons* expolygons)
{
    PROFILE_FUNC();
    expolygons->clear();
    for (int i = 0; i < polytree.ChildCount(); ++i)
        AddOuterPolyNodeToExPolygons(*polytree.Childs[i], expolygons);
}
コード例 #21
0
ファイル: synth_message.cpp プロジェクト: bluekirby0/darkstar
CSynthMessagePacket::CSynthMessagePacket(CCharEntity * PChar, SYNTH_MESSAGE messageID, uint16 itemID, uint8 quantity)
{
	PROFILE_FUNC();
	this->type = 0x6F;
	this->size = 0x12;

	WBUFB(data,(0x04)-4) = messageID;

	if (itemID != 0)
	{
		WBUFB(data,(0x06)-4) = quantity;
		WBUFW(data,(0x08)-4) = itemID;
	} 
		
	if( messageID == SYNTH_FAIL) 
	{
		uint8 count = 0;
		for(uint8 slotID = 1; slotID <= 8; ++slotID) 
		{
			uint32 quantity = PChar->CraftContainer->getQuantity(slotID);
			if (quantity == 0) 
			{
                uint16 itemID = PChar->CraftContainer->getItemID(slotID);
				WBUFW(data,(0x0A+(count*2))-4) = itemID;
				count++;
			}
		}
	}
}
コード例 #22
0
ファイル: ClipperUtils.cpp プロジェクト: jiripech/Slic3r
void simplify_polygons(const Slic3r::Polygons &subject, Slic3r::ExPolygons* retval, bool preserve_collinear)
{
    PROFILE_FUNC();

    if (!preserve_collinear) {
        Polygons polygons;
        simplify_polygons(subject, &polygons, preserve_collinear);
        union_(polygons, retval);
        return;
    }
    
    // convert into Clipper polygons
    ClipperLib::Paths input_subject;
    Slic3rMultiPoints_to_ClipperPaths(subject, &input_subject);
    
    ClipperLib::PolyTree polytree;
    
    ClipperLib::Clipper c;
    c.PreserveCollinear(true);
    c.StrictlySimple(true);
    c.AddPaths(input_subject, ClipperLib::ptSubject, true);
    c.Execute(ClipperLib::ctUnion, polytree, ClipperLib::pftNonZero, ClipperLib::pftNonZero);
    
    // convert into ExPolygons
    PolyTreeToExPolygons(polytree, retval);
}
コード例 #23
0
ファイル: ClipperUtils.cpp プロジェクト: jiripech/Slic3r
void
offset(const Slic3r::Polygons &polygons, ClipperLib::Paths* retval, const float delta,
    ClipperLib::JoinType joinType, double miterLimit)
{
    PROFILE_FUNC();
    // read input
    ClipperLib::Paths input;
    Slic3rMultiPoints_to_ClipperPaths(polygons, &input);
    
    // scale input
    scaleClipperPolygons(input);
    
    // perform offset
    ClipperLib::ClipperOffset co;
    if (joinType == jtRound) {
        co.ArcTolerance = miterLimit * double(CLIPPER_OFFSET_SCALE);
    } else {
        co.MiterLimit = miterLimit;
    }
    {
        PROFILE_BLOCK(offset_AddPaths);
        co.AddPaths(input, joinType, ClipperLib::etClosedPolygon);
    }
    {
        PROFILE_BLOCK(offset_Execute);
        co.Execute(*retval, delta * float(CLIPPER_OFFSET_SCALE));
    }
    
    // unscale output
    unscaleClipperPolygons(*retval);
}
コード例 #24
0
ファイル: itemutils.cpp プロジェクト: bluekirby0/darkstar
    void LoadDropList()
	{
		PROFILE_FUNC();
        int32 ret = Sql_Query(SqlHandle, "SELECT dropId, itemId, type, rate FROM mob_droplist WHERE dropid < %u;", MAX_DROPID);

	    if( ret != SQL_ERROR && Sql_NumRows(SqlHandle) != 0)
	    {
		    while(Sql_NextRow(SqlHandle) == SQL_SUCCESS) 
		    {
			    uint16 DropID  = (uint16)Sql_GetUIntData(SqlHandle,0);

                if (g_pDropList[DropID] == 0)
                {
                    g_pDropList[DropID] = new DropList_t;
                }

                DropItem_t DropItem;

                DropItem.ItemID  = (uint16)Sql_GetIntData(SqlHandle,1);
                DropItem.DropType = (uint8)Sql_GetIntData(SqlHandle,2);
                DropItem.DropRate = (uint8)Sql_GetIntData(SqlHandle,3);
				
                g_pDropList[DropID]->push_back(DropItem);
		    }
	    }
    }
コード例 #25
0
ファイル: itemutils.cpp プロジェクト: bluekirby0/darkstar
    void LoadLootList()
	{
		PROFILE_FUNC();
		int32 ret = Sql_Query(SqlHandle, "SELECT LootDropId, itemId, rolls, lootGroupId FROM bcnm_loot WHERE LootDropId < %u;", MAX_LOOTID);

	    if( ret != SQL_ERROR && Sql_NumRows(SqlHandle) != 0)
	    {
		    while(Sql_NextRow(SqlHandle) == SQL_SUCCESS) 
		    {
			    uint16 LootID  = (uint16)Sql_GetUIntData(SqlHandle,0);

                if (g_pLootList[LootID] == 0)
                {
                    g_pLootList[LootID] = new LootList_t;
                }

                LootItem_t LootItem;

                LootItem.ItemID  = (uint16)Sql_GetIntData(SqlHandle,1);
                LootItem.Rolls = (uint16)Sql_GetIntData(SqlHandle,2);
				LootItem.LootGroupId = (uint8)Sql_GetIntData(SqlHandle,3);
				
                g_pLootList[LootID]->push_back(LootItem);
		    }
		}
    }
コード例 #26
0
// Run the mutation algorithm to generate an improved consensus sequence
std::string run_mutation(const std::string& base, const std::vector<HMMInputData>& input)
{
    PROFILE_FUNC("run_mutation")
    std::string result = base;

    // assume models for all the reads have the same k
    assert(!input.empty());
    const uint32_t k = input[0].read->pore_model[input[0].strand].k;

    int iteration = 0;
    while(iteration++ < 10) {

        // Generate possible sequences
        PathConsVector paths = generate_mutations(result, k);

        // score them in the HMM
        score_paths(paths, input);

        // check if no improvement was made
        if(paths[0].path == result)
            break;
        result = paths[0].path;
    }

    return result;
}
コード例 #27
0
    astra_status_t device_streamset::close_sensor_streams()
    {
        PROFILE_FUNC();
        streams_.clear();

        return ASTRA_STATUS_SUCCESS;
    }
コード例 #28
0
  bool scratchpad_wrapper::push_block_scratchpad_data(const block& b)
  {
    PROFILE_FUNC("scratchpad_wrapper::push_block_scratchpad_data(b)");
    bool res = false;
    {
      PROFILE_FUNC_SECOND("scratchpad_wrapper::push_block_scratchpad_data-cache");
      res = currency::push_block_scratchpad_data(b, m_scratchpad_cache);
    }
    {
      PROFILE_FUNC_SECOND("scratchpad_wrapper::push_block_scratchpad_data-db");
      res &= currency::push_block_scratchpad_data(b, m_rdb_scratchpad);
    }
    
#ifdef SELF_VALIDATE_SCRATCHPAD
    std::vector<crypto::hash> scratchpad_cache;
    load_scratchpad_from_db(m_rdb_scratchpad, scratchpad_cache);
    if (scratchpad_cache != m_scratchpad_cache)
    {
      LOG_PRINT_L0("scratchpads mismatch, memory version: "
        << ENDL << dump_scratchpad(m_scratchpad_cache)
        << ENDL << "db version:" << ENDL << dump_scratchpad(scratchpad_cache)
        );
    }
#endif
    return res;
  }
コード例 #29
0
void CvPropertySolver::doTurn()
{
	MEMORY_TRACE_FUNCTION();
	PROFILE_FUNC();

	gatherActiveManipulators();
	resetPropertyChanges();

	// Propagators first
	predictPropagators();
	m_mapProperties.computePredictValues();
	correctPropagators();
	m_mapProperties.applyChanges();
	m_aPropagatorContexts.clear();

	// Interactions next
	predictInteractions();
	m_mapProperties.computePredictValues();
	correctInteractions();
	m_mapProperties.applyChanges();
	m_aInteractionContexts.clear();

	// Sources last
	predictSources();
	m_mapProperties.computePredictValues();
	correctSources();
	m_mapProperties.applyChanges();
	m_aSourceContexts.clear();
	m_apGlobalManipulators.clear();
}
コード例 #30
0
ファイル: ug.cpp プロジェクト: miho/ugcore
/**
 *  init app, script and data paths
 */
bool InitPaths(const char* argv0)
{
	PROFILE_FUNC();
	//The method currently only works if the path is explicitly specified
	//during startup or if UG4_ROOT is defined.

	//	extract the application path.
	char* ug4Root = getenv("UG4_ROOT");
	const char* pathSep = GetPathSeparator();

	std::string strRoot = "";

	if(ug4Root){
		strRoot = ug4Root;
	}
	else{
		std::string tPath = argv0;
		size_t pos = tPath.find_last_of(pathSep);
		
		if (pos != std::string::npos)
			tPath = tPath.substr(0, pos);
		else
			tPath = ".";

		strRoot = tPath + pathSep + "..";
	}

	if(!PathProvider::has_path(ROOT_PATH))
		PathProvider::set_path(ROOT_PATH, strRoot);
	if(!PathProvider::has_path(BIN_PATH))
		PathProvider::set_path(BIN_PATH, strRoot + pathSep + "bin");
	if(!PathProvider::has_path(SCRIPT_PATH))
		PathProvider::set_path(SCRIPT_PATH, strRoot + pathSep + "ugcore/scripts");
	if(!PathProvider::has_path(DATA_PATH))
		PathProvider::set_path(DATA_PATH, strRoot + pathSep + "data");
	if(!PathProvider::has_path(GRID_PATH))
		PathProvider::set_path(GRID_PATH, strRoot + pathSep + "data" + pathSep + "grids");
	if(!PathProvider::has_path(PLUGIN_PATH))
		PathProvider::set_path(PLUGIN_PATH, strRoot + pathSep
										+ "bin" + pathSep + "plugins");
	if(!PathProvider::has_path(APPS_PATH))
		PathProvider::set_path(APPS_PATH, strRoot + pathSep + "apps");

//	log the paths
	UG_DLOG(MAIN, 1, "app path set to: " << PathProvider::get_path(BIN_PATH) <<
			std::endl << "script path set to: " << PathProvider::get_path(SCRIPT_PATH) <<
			std::endl << "data path set to: " << PathProvider::get_path(DATA_PATH) <<
			std::endl);
/*
	if(!script::FileExists(PathProvider::get_path(BIN_PATH).c_str()) ||
	   !script::FileExists(PathProvider::get_path(SCRIPT_PATH).c_str()) ||
	   !script::FileExists(PathProvider::get_path(DATA_PATH).c_str()))
	{
		UG_LOG("WARNING: paths were not initialized correctly.\n");
		return false;
	}
*/
	return true;
}