本文整理汇总了C++中CkVec::size方法的典型用法代码示例。如果您正苦于以下问题:C++ CkVec::size方法的具体用法?C++ CkVec::size怎么用?C++ CkVec::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CkVec
的用法示例。
在下文中一共展示了CkVec::size方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ReceiveVectorMigration
void HybridBaseLB::ReceiveVectorMigration(LBVectorMigrateMsg *msg)
{
#if CMK_LBDB_ON
FindNeighbors();
int atlevel = msg->level - 1;
DEBUGF(("[%d] ReceiveMigration\n", CkMyPe()));
LevelData *lData = levelData[atlevel];
LDStats *statsData = lData->statsData;
// pick objects for required load migration, first fit
lData->vector_expected = 0;
for (int i=0; i<msg->n_moves; i++) {
VectorMigrateInfo &move = msg->moves[i];
CkVec<LDObjData> objs;
CkVec<LDCommData> comms;
if (move.from_pe == CkMyPe()) {
int toPe = move.to_pe;
double load = move.load;
GetObjsToMigrate(toPe, load, statsData, atlevel, comms, objs);
int count = objs.size();
if (_lb_args.debug()>1)
CkPrintf("[%d] sending %d objects to %d at %f.\n", CkMyPe(), count, toPe, CkWallTimer());
if (objs.size() > 0)
thisProxy[toPe].ObjsMigrated(objs, objs.size(), comms.getVec(), comms.size(), atlevel);
thisProxy[toPe].TotalObjMigrated(count, atlevel);
}
else if (move.to_pe == CkMyPe()) {
// expecting objects
lData->vector_expected ++;
}
}
if (_lb_args.debug()>1)
CkPrintf("[%d] expecting %d vectors. \n", CkMyPe(), lData->vector_expected);
if (lData->vectorReceived()) {
VectorDone(atlevel);
if (lData->migrationDone())
StatsDone(atlevel);
}
delete msg;
#endif
}
示例2: isUserSymbol
int CtgGlobalList::isUserSymbol(const char *name) {
// return 1;
if((strncmp("_", name, 1) == 0) || (strncmp("Cpv_", name, 4) == 0)
|| (strncmp("Csv_", name, 4) == 0) || (strncmp("Ctv_", name, 4) == 0)
|| (strncmp("Bnv_", name, 4) == 0) || (strncmp("Bpv_", name, 4) == 0)
|| (strncmp("ckout", name, 5) == 0) || (strncmp("stdout", name, 6) == 0)
|| (strncmp("ckerr", name, 5) == 0)
|| (strncmp("environ", name, 7) == 0)
|| (strncmp("stderr", name, 6) == 0) || (strncmp("stdin", name, 5) == 0)) {
#ifdef CMK_GFORTRAN
if (match(name, "__.*_MOD_.*")) return 1;
#endif
return 0;
}
/**
if the name is on the blacklist, it is not a user symbol
*/
for(int i=0;i<_blacklist.size();i++){
if(strlen(name) == strlen(_blacklist[i]) && strncmp(name,_blacklist[i],strlen(name)) == 0){
return 0;
}
}
return 1;
}
示例3: get_elemsToLock
void BulkAdapt::get_elemsToLock(adaptAdj startElem, adaptAdj **elemsToLock, int edgeID, int *count)
{
CkVec<adaptAdj>* nbrElems;
// find the elements adjacent to startElem along the edge edgeID
//BULK_DEBUG(CkPrintf("[%d] BulkAdapt::get_elemsToLock: calling getEdgeAdaptAdj on elem %d\n",partitionID,startElem.localID));
nbrElems = getEdgeAdaptAdj(meshID, startElem.localID, startElem.elemType,
edgeID);
// extract adjacencies from CkVec into array needed by the locking code
(*count) = nbrElems->size();
(*elemsToLock) = (adaptAdj *)malloc((*count + 1) * sizeof(adaptAdj));
for (int i=0; i<*count; i++) {
(*elemsToLock)[i] = (*nbrElems)[i];
}
// add the start element
(*elemsToLock)[*count] = startElem;
(*count)++;
/*
printf("Elems to lock: ");
for (int i=0; i<*count; i++) {
printf("(%d, %d, %d) ", (*elemsToLock)[i].partID, (*elemsToLock)[i].localID,
(*elemsToLock)[i].elemType);
}
printf("\n");
*/
}
示例4: ImportFluidData_request
void System::ImportFluidData_request(const CkVec< pair<int,int> > &reqData, const int recvIndex)
{
assert(thisIndex != recvIndex);
const int nrecv = reqData.size();
assert(nrecv > 0);
MeshFluidGrad_msg *msg = new (nrecv, nrecv, nrecv, nrecv) MeshFluidGrad_msg;
msg->n = nrecv;
for (int i = 0; i < nrecv; i++)
{
const int local_id = reqData[i].first;
const int remote_id = reqData[i].second;
assert(local_id >= 0);
assert(local_id < local_n);
msg-> id_list[i] = remote_id;
msg->mesh_pnts[i] = mesh_pnts[local_id];
msg->Wrec_list[i] = Wrec_list[local_id];
#if 1
if (!ptcl_list[local_id].is_active())
{
Fluid Wi = Wrec_list[local_id].w;
const real dt = t_global - mesh_pnts[local_id].tbeg;
for (int k = 0; k < Fluid::NFLUID; k++)
Wi[k] += Wrec_list[local_id].t[k]*dt;
msg->Wrec_list[i].w = Wi;
}
#endif
msg->Wrec_minmax[i] = Wrec_minmax_list[local_id];
}
systemProxy[recvIndex].ImportFluidData_recv(msg);
}
示例5: ImportFluidPrimitives_request
void System::ImportFluidPrimitives_request(const CkVec< pair<int,int> > &reqData, const int recvIndex)
{
assert(thisIndex != recvIndex);
const int nrecv = reqData.size();
assert(nrecv > 0);
CkVec< pair<int, pair<Fluid, MeshPoint> > > data2send(nrecv);
for (int i = 0; i < nrecv; i++)
{
const int local_id = reqData[i].first;
const int remote_id = reqData[i].second;
assert(local_id >= 0);
assert(local_id < local_n);
data2send[i].first = remote_id;
Fluid Wi = Wrec_list[local_id].w;
#if 1
if (!ptcl_list[local_id].is_active())
{
Fluid Wi = Wrec_list[local_id].w;
const real dt = t_global - mesh_pnts[local_id].tbeg;
for (int k = 0; k < Fluid::NFLUID; k++)
Wi[k] += Wrec_list[local_id].t[k]*dt;
}
#endif
data2send[i].second = std::make_pair(Wi, mesh_pnts[local_id]);
}
systemProxy[recvIndex].ImportFluidPrimitives_recv(data2send);
}
示例6: fprintf
/**
Analyze the current set of global variables, determine
which are user globals and which are system globals,
and store the list of user globals.
*/
CtgGlobalList::CtgGlobalList() {
datalen=0;
nRec=0;
int count;
for (count = 0; count < _namelist.size(); count ++)
{
unsigned long addr;
int size;
if (0 > lookup_obj_sym(_namelist[count], &addr, &size)) {
fprintf(stderr, "%s: no such symbol\n", _namelist[count]);
continue;
}
void *ptr = (void *)addr;
int gSize = ALIGN8(size);
//#if DEBUG_GOT_MANAGER
printf(" -> %s is a user global, of size %d, at %p\n",
_namelist[count], size, ptr);
//#endif
rec.push_back(CtgRec(ptr,datalen,size));
datalen+=gSize;
}
nRec=rec.size();
#if DEBUG_GOT_MANAGER
printf("relt has %d entries, %d of which are user globals\n\n",
relt_size,nRec);
#endif
}
示例7: assignclause
void par_SolverState::assignclause(CkVec<par_Clause>& cls )
{
clauses.removeAll();
for(int i=0; i<cls.size(); i++)
{
clauses.push_back( cls[i]);
}
}
示例8: ReceiveMigrationDelta
// pick objects to migrate "t" amount of work
void HbmLB::ReceiveMigrationDelta(double t, int lblevel, int fromlevel)
{
#if CMK_LBDB_ON
int i;
int atlevel = fromlevel-1;
LevelData *lData = levelData[atlevel];
if (atlevel != 0) {
thisProxy.ReceiveMigrationDelta(t, lblevel, atlevel, lData->nChildren, lData->children);
return;
}
// I am leave, find objects to migrate
CkVec<int> migs;
CkVec<LDObjData> &objData = myStats.objData;
for (i=0; i<myStats.n_objs; i++) {
LDObjData &oData = objData[i];
if (oData.wallTime < t) {
migs.push_back(i);
t -= oData.wallTime;
if (t == 0.0) break;
}
}
int nmigs = migs.size();
// send a message to
int matchPE = CkMyPe() ^ (1<<(lblevel-1));
DEBUGF(("[%d] migrating %d objs to %d at lblevel %d! \n", CkMyPe(),nmigs,matchPE,lblevel));
thisProxy[matchPE].ReceiveMigrationCount(nmigs, lblevel);
// migrate objects
for (i=0; i<nmigs; i++) {
int idx = migs[i]-i;
LDObjData &oData = objData[idx];
CkVec<LDCommData> comms;
collectCommData(idx, comms);
thisProxy[matchPE].ObjMigrated(oData, comms.getVec(), comms.size());
theLbdb->Migrate(oData.handle, matchPE);
// TODO modify LDStats
DEBUGF(("myStats.removeObject: %d, %d, %d\n", migs[i], i, objData.size()));
myStats.removeObject(idx);
}
#endif
}
示例9: nextUnoccupied
//Find next un-occupied global number:
int nextUnoccupied(void) {
while (occupiedBefore<occupied.size()) {
if (occupied[occupiedBefore]==0)
return occupiedBefore;
else occupiedBefore++;
}
/* occupiedBefore==occupied.size(), so add to end of list */
occupied.push_back(1);
return occupiedBefore;
}
示例10: userBracketEvent
void TraceBluegene::userBracketEvent(const char* name, double bt, double et, void** parentLogPtr, CkVec<void*> bgLogList){
if (!genTimeLog) return;
BgTimeLog* newLog = new BgTimeLog(_threadEP,name,bt,et);
newLog->addBackwardDeps(bgLogList);
CmiAssert(bgLogList.size()>0);
newLog->objId = ((BgTimeLog*)bgLogList[0])->objId; // for sdag
*parentLogPtr = newLog;
tTIMELINEREC.logEntryInsert(newLog);
}
示例11: getRoccomPconn
/** Extract all FEM communication information into Roccom format. */
static CkVec<int> getRoccomPconn(int fem_mesh,int *ghost_len,const int *paneFmChunk)
{
CkVec<int> pconn;
// Shared nodes come first:
getRoccomPconn(IDXL_Get_send(FEM_Comm_shared(fem_mesh,FEM_NODE)),0,pconn,paneFmChunk);
int realLen=pconn.size();
// Sent ghost nodes:
getRoccomPconn(IDXL_Get_send(FEM_Comm_ghost(fem_mesh,FEM_NODE)),0,pconn,paneFmChunk);
// Received ghost nodes (use bias to switch to Roccom ghost node numbering)
getRoccomPconn(IDXL_Get_recv(FEM_Comm_ghost(fem_mesh,FEM_NODE)),
FEM_Mesh_get_length(fem_mesh,FEM_NODE),pconn,paneFmChunk);
// Handle elements (much tougher!)
// Find list of element types
int elems[1024];
int e, ne=FEM_Mesh_get_entities(fem_mesh,elems);
for (e=0;e<ne;e++)
if (elems[e]<FEM_ELEM || elems[e]>=FEM_SPARSE)
elems[e--]=elems[--ne]; // swap out bad entity with the end
// Make one output IDXL that combines all element types:
IDXL_t elghost=IDXL_Create();
int out_r=0, out_g=0; // output indices for real; ghost
for (e=0;e<ne;e++) {
IDXL_Combine(elghost,FEM_Comm_ghost(fem_mesh,elems[e]), out_r,out_g);
out_r+=FEM_Mesh_get_length(fem_mesh,elems[e]);
out_g+=FEM_Mesh_get_length(fem_mesh,elems[e]+FEM_GHOST);
}
// Sent ghost elements:
getRoccomPconn(IDXL_Get_send(elghost),0,pconn,paneFmChunk);
// Received ghost elements (shift all ghosts to start after real elements)
getRoccomPconn(IDXL_Get_recv(elghost),out_r,pconn,paneFmChunk);
IDXL_Destroy(elghost);
if (ghost_len) *ghost_len=pconn.size()-realLen;
return pconn;
}
示例12: mark
/// Mark this entity's global numbers as used:
void mark(FEM_Entity &src) {
int l,len=src.size();
for (l=0;l<len;l++) {
int g=src.getGlobalno(l);
if (g!=-1) {
while (occupied.size()<=g) { //Make room for this marker
occupied.push_back(0);
}
//FIXME: make sure element global numbers aren't repeated
// (tough because *node* global numbers may be repeated)
occupied[g]=1;
}
}
}
示例13: localCreateSection
void Patch::localCreateSection() {
#ifdef USE_SECTION_MULTICAST
CkVec<CkArrayIndex6D> elems;
for (int num=0; num<numNbrs; num++)
elems.push_back(CkArrayIndex6D(computesList[num][0], computesList[num][1], computesList[num][2], computesList[num][3], computesList[num][4], computesList[num][5]));
CkArrayID computeArrayID = computeArray.ckGetArrayID();
mCastSecProxy = CProxySection_Compute::ckNew(computeArrayID, elems.getVec(), elems.size());
CkMulticastMgr *mCastGrp = CProxy_CkMulticastMgr(mCastGrpID).ckLocalBranch();
mCastSecProxy.ckSectionDelegate(mCastGrp);
mCastGrp->setReductionClient(mCastSecProxy, new CkCallback(CkIndex_Patch::reduceForces(NULL), thisProxy(thisIndex.x, thisIndex.y, thisIndex.z)));
#endif
}
示例14: ImportNewDt_recv
void System::ImportNewDt_recv(const CkVec< pair<int, real> > &recvUpdates)
{
const int nrecv = recvUpdates.size();
for (int i = 0; i < nrecv; i++)
{
const int iId = recvUpdates[i].first;
assert(iId >= (int)(nactive_loc + nimport_loc));
assert(iId < (int) ptcl_act.size());
assert(ptcl_act[iId]->is_active());
mesh_act[iId]->dt_new = recvUpdates[i].second;
}
ImportNewDt_nRequested--;
assert(ImportNewDt_nRequested >= 0);
if (ImportNewDt_nRequested == 0)
ImportNewDtCb.send();
}
示例15: ImportNewDt_request
void System::ImportNewDt_request(const CkVec< pair<int,int> > &reqData, const int recvIndex)
{
assert(thisIndex != recvIndex);
const int nrecv = reqData.size();
assert(nrecv > 0);
CkVec< pair<int, real> > data2send;
data2send.reserve(nrecv);
for (int i = 0; i < nrecv; i++)
{
const int local_id = reqData[i].first;
const int remote_id = reqData[i].second;
assert(local_id >= 0);
assert(local_id < local_n);
assert(ptcl_list[local_id].is_active());
data2send.push_back(std::make_pair(remote_id, mesh_pnts[local_id].dt_new));
}
systemProxy[recvIndex].ImportNewDt_recv(data2send);
}