本文整理汇总了C++中CkVec::free方法的典型用法代码示例。如果您正苦于以下问题:C++ CkVec::free方法的具体用法?C++ CkVec::free怎么用?C++ CkVec::free使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CkVec
的用法示例。
在下文中一共展示了CkVec::free方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: edge_bisect_help
//.........这里部分代码省略.........
n5chunk = -1;
e4chunk = e2chunk;
e3chunk = e1chunk;
}
// add n1, n5, n3
elemConn[e1_n1] = n1; elemConn[e1_n2] = n5; elemConn[e1_n3] = n3;
lockelems[0] = FEM_add_element(theMesh, elemConn, 3, 0, e1chunk);
theMod->fmUtil->copyElemData(0,e1,lockelems[0]);
// add n2, n5, n3
elemConn[e1_n1] = n5; elemConn[e1_n2] = n2; elemConn[e1_n3] = n3;
lockelems[1] = FEM_add_element(theMesh, elemConn, 3, 0, e3chunk);
theMod->fmUtil->copyElemData(0,e1,lockelems[1]);
if (e2 != -1) { // e2 exists
// add n1, n5, n4
elemConn[e2_n1] = n1; elemConn[e2_n2] = n5; elemConn[e2_n3] = n4;
lockelems[2] = FEM_add_element(theMesh, elemConn, 3, 0, e2chunk);
theMod->fmUtil->copyElemData(0,e2,lockelems[2]);
// add n2, n5, n4
elemConn[e2_n1] = n5; elemConn[e2_n2] = n2; elemConn[e2_n3] = n4;
lockelems[3] = FEM_add_element(theMesh, elemConn, 3, 0, e4chunk);
theMod->fmUtil->copyElemData(0,e2,lockelems[3]);
}
FEM_purge_element(theMesh,e1,0);
FEM_purge_element(theMesh,e2,0);
//get rid of some unnecessary ghost node sends
for(int i=0; i<4;i++) {
int nodeToUpdate = -1;
if(i==0) nodeToUpdate = n1;
else if(i==1) nodeToUpdate = n2;
else if(i==2) nodeToUpdate = n3;
else if(i==3) nodeToUpdate = n4;
//if any of the chunks sharing this node sends this as a ghost, then all of them have to
//so find out the set of chunks I need to send this as a ghost to
//collect info from each of the shared chunks, do a union of all these chunks
//send this updated list to everyone.
//if anyone needs to add or delete some ghosts, they will
int *chkl, numchkl=0;
CkVec<int> finalchkl;
theMod->fmUtil->findGhostSend(nodeToUpdate, chkl, numchkl);
for(int j=0; j<numchkl; j++) {
finalchkl.push_back(chkl[j]);
}
if(numchkl>0) delete[] chkl;
const IDXL_Rec *irec=theMesh->node.shared.getRec(nodeToUpdate);
int numchunks=0;
int *chunks1, *inds1;
if(irec) {
numchunks = irec->getShared();
chunks1 = new int[numchunks];
inds1 = new int[numchunks];
for(int j=0; j<numchunks; j++) {
chunks1[j] = irec->getChk(j);
inds1[j] = irec->getIdx(j);
}
}
for(int j=0; j<numchunks; j++) {
findgsMsg *fmsg = meshMod[chunks1[j]].findghostsend(index,inds1[j]);
if(fmsg->numchks>0) {
for(int k=0; k<fmsg->numchks; k++) {
bool shouldbeadded = true;
for(int l=0; l<finalchkl.size(); l++) {
if(fmsg->chunks[k]==finalchkl[l]) {
shouldbeadded = false;
break;
}
}
if(shouldbeadded) finalchkl.push_back(fmsg->chunks[k]);
}
}
delete fmsg;
}
int *finall, numfinall=finalchkl.size();
if(numfinall>0) finall = new int[numfinall];
for(int j=0; j<numfinall; j++) finall[j] = finalchkl[j];
finalchkl.free();
theMod->fmUtil->UpdateGhostSend(nodeToUpdate, finall, numfinall);
for(int j=0; j<numchunks; j++) {
verifyghostsendMsg *vmsg = new(numfinall)verifyghostsendMsg();
vmsg->fromChk = index;
vmsg->sharedIdx = inds1[j];
vmsg->numchks = numfinall;
for(int k=0; k<numfinall; k++) vmsg->chunks[k] = finall[k];
meshMod[chunks1[j]].updateghostsend(vmsg);
}
if(numfinall>0) delete[] finall;
if(numchunks>0) {
delete[] chunks1;
delete[] inds1;
}
}
FEM_Modify_UnlockN(theMesh, n5, 0);
return n5;
}
示例2: edge_flip_help
//.........这里部分代码省略.........
}
if(n4 < 0) {
e2Topurge = theMod->fmUtil->eatIntoElement(e2);
theMesh->e2n_getAll(e2Topurge,elemConn);
for(int i=0; i<3; i++) {
if(elemConn[i]!=n1 && elemConn[i]!=n2) {
n4 = elemConn[i];
}
}
locknodes[3] = n4;
}
FEM_remove_element(theMesh,e1Topurge,0,0);
FEM_remove_element(theMesh,e2Topurge,0,0);
// add n1, n3, n4
elemConn[e1_n1] = n1; elemConn[e1_n2] = n4; elemConn[e1_n3] = n3;
lockelems[0] = FEM_add_element(theMesh, elemConn, 3, 0, index);
//the attributes should really be interpolated, i.e. on both new elems,
//the values should be an average of the previous two elements
theMod->fmUtil->copyElemData(0,e1Topurge,lockelems[0]);
// add n2, n3, n4
elemConn[e1_n1] = n4; elemConn[e1_n2] = n2; elemConn[e1_n3] = n3;
lockelems[1] = FEM_add_element(theMesh, elemConn, 3, 0, index);
theMod->fmUtil->copyElemData(0,e1Topurge,lockelems[1]); //both of the new elements copy from one element
//purge the two elements
FEM_purge_element(theMesh,e1Topurge,0);
FEM_purge_element(theMesh,e2Topurge,0);
//get rid of some unnecessary ghost node sends
for(int i=0; i<4;i++) {
int nodeToUpdate = -1;
if(i==0) nodeToUpdate = n1;
else if(i==1) nodeToUpdate = n2;
else if(i==2) nodeToUpdate = n3;
else if(i==3) nodeToUpdate = n4;
//if any of the chunks sharing this node sends this as a ghost, then all of them have to
//so find out the set of chunks I need to send this as a ghost to
//collect info from each of the shared chunks, do a union of all these chunks
//send this updated list to everyone.
//if anyone needs to add or delete some ghosts, they will
int *chkl, numchkl=0;
CkVec<int> finalchkl;
theMod->fmUtil->findGhostSend(nodeToUpdate, chkl, numchkl);
for(int j=0; j<numchkl; j++) {
finalchkl.push_back(chkl[j]);
}
if(numchkl>0) delete[] chkl;
const IDXL_Rec *irec=theMesh->node.shared.getRec(nodeToUpdate);
int numchunks=0;
int *chunks1, *inds1;
if(irec) {
numchunks = irec->getShared();
chunks1 = new int[numchunks];
inds1 = new int[numchunks];
for(int j=0; j<numchunks; j++) {
chunks1[j] = irec->getChk(j);
inds1[j] = irec->getIdx(j);
}
}
for(int j=0; j<numchunks; j++) {
findgsMsg *fmsg = meshMod[chunks1[j]].findghostsend(index,inds1[j]);
if(fmsg->numchks>0) {
for(int k=0; k<fmsg->numchks; k++) {
bool shouldbeadded = true;
for(int l=0; l<finalchkl.size(); l++) {
if(fmsg->chunks[k]==finalchkl[l]) {
shouldbeadded = false;
break;
}
}
if(shouldbeadded) finalchkl.push_back(fmsg->chunks[k]);
}
}
delete fmsg;
}
int *finall, numfinall=finalchkl.size();
if(numfinall>0) finall = new int[numfinall];
for(int j=0; j<numfinall; j++) finall[j] = finalchkl[j];
finalchkl.free();
theMod->fmUtil->UpdateGhostSend(nodeToUpdate, finall, numfinall);
for(int j=0; j<numchunks; j++) {
verifyghostsendMsg *vmsg = new(numfinall)verifyghostsendMsg();
vmsg->fromChk = index;
vmsg->sharedIdx = inds1[j];
vmsg->numchks = numfinall;
for(int k=0; k<numfinall; k++) vmsg->chunks[k] = finall[k];
meshMod[chunks1[j]].updateghostsend(vmsg);
}
if(numfinall>0) delete[] finall;
if(numchunks>0) {
delete[] chunks1;
delete[] inds1;
}
}
//make sure that it always comes here, don't return with unlocking
return 1; //return newNode;
}