本文整理汇总了C++中ASSERTP函数的典型用法代码示例。如果您正苦于以下问题:C++ ASSERTP函数的具体用法?C++ ASSERTP怎么用?C++ ASSERTP使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ASSERTP函数的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: CheckBnd2
/*************************************************************************
* This function checks whether or not the boundary information is correct
**************************************************************************/
idxtype CheckBnd2(GraphType *graph)
{
idxtype i, j, nvtxs, nbnd, id, ed;
idxtype *xadj, *adjncy, *where, *bndptr, *bndind;
nvtxs = graph->nvtxs;
xadj = graph->xadj;
adjncy = graph->adjncy;
where = graph->where;
bndptr = graph->bndptr;
bndind = graph->bndind;
for (nbnd=0, i=0; i<nvtxs; i++) {
id = ed = 0;
for (j=xadj[i]; j<xadj[i+1]; j++) {
if (where[i] != where[adjncy[j]])
ed += graph->adjwgt[j];
else
id += graph->adjwgt[j];
}
if (ed - id >= 0 && xadj[i] < xadj[i+1]) {
nbnd++;
ASSERTP(bndptr[i] != -1, ("%d %d %d\n", i, id, ed));
ASSERT(bndind[bndptr[i]] == i);
}
}
ASSERTP(nbnd == graph->nbnd, ("%d %d\n", nbnd, graph->nbnd));
return 1;
}
开发者ID:educharlie,项目名称:HNA-Algorithm,代码行数:34,代码来源:debug.c
示例2: CheckNodeBnd
/*************************************************************************
* This function checks whether or not the boundary information is correct
**************************************************************************/
idxtype CheckNodeBnd(GraphType *graph, idxtype onbnd)
{
idxtype i, j, nvtxs, nbnd;
idxtype *xadj, *adjncy, *where, *bndptr, *bndind;
nvtxs = graph->nvtxs;
xadj = graph->xadj;
adjncy = graph->adjncy;
where = graph->where;
bndptr = graph->bndptr;
bndind = graph->bndind;
for (nbnd=0, i=0; i<nvtxs; i++) {
if (where[i] == 2)
nbnd++;
}
ASSERTP(nbnd == onbnd, ("%d %d\n", nbnd, onbnd));
for (i=0; i<nvtxs; i++) {
if (where[i] != 2) {
ASSERTP(bndptr[i] == -1, ("%d %d\n", i, bndptr[i]));
}
else {
ASSERTP(bndptr[i] != -1, ("%d %d\n", i, bndptr[i]));
}
}
return 1;
}
开发者ID:educharlie,项目名称:HNA-Algorithm,代码行数:33,代码来源:debug.c
示例3: throw
/**
* Begin an object. Only allowed at the beginning of the output,
* after adding an object or inside an array.
*/
void Saver::beginObject(void) throw(io::IOException) {
ASSERTP(state != END, "json: ended output!");
ASSERTP(!isObject(state), "json: object creation only allowed in a field or an array");
doIndent();
_out << "{";
if(isArray(state))
stack.push(state);
state = OBJECT;
}
开发者ID:dllinxi,项目名称:WCET,代码行数:13,代码来源:json.cpp
示例4: ASSERTP
/**
* Adds an attribute to this element, replacing any existing attribute with the
* same local name and namespace URI.
* @param attribute the attribute to add
* @throw MultipleParentException if the attribute is already attached to an
* element
* @throw NamespaceConflictException - if the attribute's prefix is mapped to a
* different namespace URI than the same prefix is mapped to by this element,
* another attribute of this element, or an additional namespace declaration of
* this element.
*/
void Element::addAttribute(Attribute *attribute) {
ASSERTP(attribute, "null attribute");
ASSERTP(!attribute->getNode(), "already added attribute");
xmlAttrPtr attr;
// !!TODO!! add support for namespace
attr = xmlSetProp(NODE(node), attribute->getLocalName(), attribute->getValue());
ASSERT(attr);
attribute->setNode(attr);
}
开发者ID:alexjordan,项目名称:otawa,代码行数:20,代码来源:xom_Element.cpp
示例5: ASSERTP
/**
* Add the given node to the tree.
* @param node Node to add.
*/
void SortedBinTree::insert(Node *node) {
ASSERTP(node, "null node");
if(isEmpty())
setRoot(node);
else
insert(root(), node);
}
开发者ID:alexjordan,项目名称:otawa,代码行数:11,代码来源:inhstruct_SortedBinTree.cpp
示例6: Project2WayNodePartition
void Project2WayNodePartition(ctrl_t *ctrl, graph_t *graph)
{
idx_t i, j, nvtxs;
idx_t *cmap, *where, *cwhere;
graph_t *cgraph;
cgraph = graph->coarser;
cwhere = cgraph->where;
nvtxs = graph->nvtxs;
cmap = graph->cmap;
Allocate2WayNodePartitionMemory(ctrl, graph);
where = graph->where;
/* Project the partition */
for (i=0; i<nvtxs; i++) {
where[i] = cwhere[cmap[i]];
ASSERTP(where[i] >= 0 && where[i] <= 2, ("%"PRIDX" %"PRIDX" %"PRIDX" %"PRIDX"\n",
i, cmap[i], where[i], cwhere[cmap[i]]));
}
FreeGraph(&graph->coarser);
graph->coarser = NULL;
Compute2WayNodePartitionParams(ctrl, graph);
}
开发者ID:certik,项目名称:libmesh,代码行数:27,代码来源:srefine.c
示例7: CheckBnd
/*************************************************************************
* This function checks whether or not the boundary information is correct
**************************************************************************/
idxtype CheckBnd(GraphType *graph)
{
idxtype i, j, nvtxs, nbnd;
idxtype *xadj, *adjncy, *where, *bndptr, *bndind;
nvtxs = graph->nvtxs;
xadj = graph->xadj;
adjncy = graph->adjncy;
where = graph->where;
bndptr = graph->bndptr;
bndind = graph->bndind;
for (nbnd=0, i=0; i<nvtxs; i++) {
if (xadj[i+1]-xadj[i] == 0)
nbnd++; /* Islands are considered to be boundary vertices */
for (j=xadj[i]; j<xadj[i+1]; j++) {
if (where[i] != where[adjncy[j]]) {
nbnd++;
ASSERT(bndptr[i] != -1);
ASSERT(bndind[bndptr[i]] == i);
break;
}
}
}
ASSERTP(nbnd == graph->nbnd, ("%d %d\n", nbnd, graph->nbnd));
return 1;
}
开发者ID:educharlie,项目名称:HNA-Algorithm,代码行数:33,代码来源:debug.c
示例8: CheckRInfo
/*************************************************************************
* This function checks whether or not the rinfo of a vertex is consistent
**************************************************************************/
idxtype CheckRInfo(RInfoType *rinfo)
{
idxtype i, j;
for (i=0; i<rinfo->ndegrees; i++) {
for (j=i+1; j<rinfo->ndegrees; j++)
ASSERTP(rinfo->edegrees[i].pid != rinfo->edegrees[j].pid, ("%d %d %d %d\n", i, j, rinfo->edegrees[i].pid, rinfo->edegrees[j].pid));
}
return 1;
}
开发者ID:educharlie,项目名称:HNA-Algorithm,代码行数:14,代码来源:debug.c
示例9: if
/**
* Returns the indexth namespace prefix declared on this element. Namespaces
* inherited from ancestors are not included. The index is purely for
* convenience, and has no meaning in itself. This includes the namespaces of
* the element name and of all attributes' names (except for those with the
* prefix xml such as xml:space) as well as additional declarations made for
* attribute values and element content. However, prefixes used multiple times
* (e.g. on several attribute values) are only reported once. The default
* namespace is reported with an empty string prefix if present. Like most lists
* in Java, the first prefix is at index 0.
* @par
* If the namespaces on the element change for any reason (adding or removing an
* attribute in a namespace, adding or removing a namespace declaration,
* changing the prefix of an element, etc.) then then this method may skip or
* repeat prefixes. Don't change the prefixes of an element while iterating
* across them.
* @param index The prefix to return.
* @return The prefix.
**/
String Element::getNamespacePrefix(int index) {
for(xmlNs *ns = NODE(node)->nsDef; ns; ns = ns->next) {
if(index)
index--;
else if(ns->prefix)
return ns->prefix;
else
return "";
}
ASSERTP(false, "namespace index out of bounds");
return "";
}
开发者ID:alexjordan,项目名称:otawa,代码行数:31,代码来源:xom_Element.cpp
示例10: throw
/**
* Create a random access stream from a file, removing it if it already exists.
* @param path Path of the file to open.
* @param access Type of access (one of READ, WRITE, READ_WRITE).
* @return Opened file.
* @throws IOException Thrown if there is an error.
*/
io::RandomAccessStream *System::createRandomFile(
const sys::Path& path,
access_t access)
throw(SystemException)
{
ASSERTP(access != READ, "file creation requires at least a write mode");
int fd = ::open(&path.toString(), makeFlags(access) | O_CREAT | O_TRUNC, 0666);
if(fd < 0)
throw SystemException(errno, _ << "cannot create \"" << path << "\"");
else
# if defined(__unix) || defined(__APPLE__)
return new UnixRandomAccessStream(fd);
# elif defined(__WIN32) || defined(__WIN64)
return new WinRandomAccessStream(fd);
# else
# error "Unsupported on this OS !"
# endif
}
开发者ID:alexjordan,项目名称:otawa,代码行数:25,代码来源:system_System.cpp
示例11: IsSeparable
/*************************************************************************
* This function checks if the separator is indeed a separator
**************************************************************************/
idxtype IsSeparable(GraphType *graph)
{
idxtype i, j, nvtxs, other;
idxtype *xadj, *adjncy, *where;
nvtxs = graph->nvtxs;
xadj = graph->xadj;
adjncy = graph->adjncy;
where = graph->where;
for (i=0; i<nvtxs; i++) {
if (where[i] == 2)
continue;
other = (where[i]+1)%2;
for (j=xadj[i]; j<xadj[i+1]; j++) {
ASSERTP(where[adjncy[j]] != other, ("%d %d %d %d %d %d\n", i, where[i], adjncy[j], where[adjncy[j]], xadj[i+1]-xadj[i], xadj[adjncy[j]+1]-xadj[adjncy[j]]));
}
}
return 1;
}
开发者ID:educharlie,项目名称:HNA-Algorithm,代码行数:24,代码来源:debug.c
示例12: ASSERTP
/**
* Test if the first basic block postdominates the second one.
* @param bb1 Dominator BB.
* @param bb2 Dominated BB.
* @return True if bb1 postdominates bb2.
*/
bool PostDominance::postDominates(BasicBlock *bb1, BasicBlock *bb2) {
ASSERTP(bb1, "null BB 1");
ASSERTP(bb2, "null BB 2");
ASSERTP(bb1->cfg() == bb2->cfg(), "both BB are not owned by the same CFG");
int index = bb1->number();
ASSERTP(index >= 0, "no index for BB 1");
BitSet *set = REVERSE_POSTDOM(bb2);
ASSERTP(set, "no index for BB 2");
ASSERTP(bb1 == bb2
|| !REVERSE_POSTDOM(bb1)->contains(bb2->number())
|| !REVERSE_POSTDOM(bb2)->contains(bb1->number()),
"CFG with disconnected nodes");
return set->contains(index);
}
开发者ID:alexjordan,项目名称:otawa,代码行数:22,代码来源:util_PostDominance.cpp
示例13: CreateCoarseGraphNoMask
//.........这里部分代码省略.........
cnvwgt = cgraph->nvwgt;
cadjwgtsum = cgraph->adjwgtsum;
cadjncy = cgraph->adjncy;
cadjwgt = cgraph->adjwgt;
htable = idxset(cnvtxs, -1, idxwspacemalloc(ctrl, cnvtxs));
iend = xadj[nvtxs];
auxadj = ctrl->wspace.auxcore;
memcpy(auxadj, adjncy, iend*sizeof(idxtype));
for (i=0; i<iend; i++)
auxadj[i] = cmap[auxadj[i]];
cxadj[0] = cnvtxs = cnedges = 0;
for (i=0; i<nvtxs; i++) {
v = perm[i];
if (cmap[v] != cnvtxs)
continue;
u = match[v];
if (ncon == 1)
cvwgt[cnvtxs] = vwgt[v];
else
scopy(ncon, nvwgt+v*ncon, cnvwgt+cnvtxs*ncon);
if (dovsize)
cvsize[cnvtxs] = vsize[v];
cadjwgtsum[cnvtxs] = adjwgtsum[v];
nedges = 0;
istart = xadj[v];
iend = xadj[v+1];
for (j=istart; j<iend; j++) {
k = auxadj[j];
if ((m = htable[k]) == -1) {
cadjncy[nedges] = k;
cadjwgt[nedges] = adjwgt[j];
htable[k] = nedges++;
}
else {
cadjwgt[m] += adjwgt[j];
}
}
if (v != u) {
if (ncon == 1)
cvwgt[cnvtxs] += vwgt[u];
else
saxpy(ncon, 1.0, nvwgt+u*ncon, 1, cnvwgt+cnvtxs*ncon, 1);
if (dovsize)
cvsize[cnvtxs] += vsize[u];
cadjwgtsum[cnvtxs] += adjwgtsum[u];
istart = xadj[u];
iend = xadj[u+1];
for (j=istart; j<iend; j++) {
k = auxadj[j];
if ((m = htable[k]) == -1) {
cadjncy[nedges] = k;
cadjwgt[nedges] = adjwgt[j];
htable[k] = nedges++;
}
else {
cadjwgt[m] += adjwgt[j];
}
}
/* Remove the contracted adjacency weight */
if ((j = htable[cnvtxs]) != -1) {
ASSERT(cadjncy[j] == cnvtxs);
cadjwgtsum[cnvtxs] -= cadjwgt[j];
cadjncy[j] = cadjncy[--nedges];
cadjwgt[j] = cadjwgt[nedges];
htable[cnvtxs] = -1;
}
}
ASSERTP(cadjwgtsum[cnvtxs] == idxsum(nedges, cadjwgt), ("%d %d\n", cadjwgtsum[cnvtxs], idxsum(nedges, cadjwgt)));
for (j=0; j<nedges; j++)
htable[cadjncy[j]] = -1; /* Zero out the htable */
cnedges += nedges;
cxadj[++cnvtxs] = cnedges;
cadjncy += nedges;
cadjwgt += nedges;
}
cgraph->nedges = cnedges;
ReAdjustMemory(graph, cgraph, dovsize);
IFSET(ctrl->dbglvl, DBG_TIME, stoptimer(ctrl->ContractTmr));
idxwspacefree(ctrl, cnvtxs);
}
开发者ID:aceskpark,项目名称:osfeo,代码行数:101,代码来源:ccgraph.c
示例14: CreateCoarseGraph_NVW
//.........这里部分代码省略.........
u = match[v];
cvwgt[cnvtxs] = 1;
cadjwgtsum[cnvtxs] = adjwgtsum[v];
nedges = 0;
istart = xadj[v];
iend = xadj[v+1];
for (j=istart; j<iend; j++) {
k = auxadj[j];
kk = k&mask;
if ((m = htable[kk]) == -1) {
cadjncy[nedges] = k;
cadjwgt[nedges] = 1;
htable[kk] = nedges++;
}
else if (cadjncy[m] == k) {
cadjwgt[m]++;
}
else {
for (jj=0; jj<nedges; jj++) {
if (cadjncy[jj] == k) {
cadjwgt[jj]++;
break;
}
}
if (jj == nedges) {
cadjncy[nedges] = k;
cadjwgt[nedges++] = 1;
}
}
}
if (v != u) {
cvwgt[cnvtxs]++;
cadjwgtsum[cnvtxs] += adjwgtsum[u];
istart = xadj[u];
iend = xadj[u+1];
for (j=istart; j<iend; j++) {
k = auxadj[j];
kk = k&mask;
if ((m = htable[kk]) == -1) {
cadjncy[nedges] = k;
cadjwgt[nedges] = 1;
htable[kk] = nedges++;
}
else if (cadjncy[m] == k) {
cadjwgt[m]++;
}
else {
for (jj=0; jj<nedges; jj++) {
if (cadjncy[jj] == k) {
cadjwgt[jj]++;
break;
}
}
if (jj == nedges) {
cadjncy[nedges] = k;
cadjwgt[nedges++] = 1;
}
}
}
/* Remove the contracted adjacency weight */
jj = htable[cnvtxs&mask];
if (jj >= 0 && cadjncy[jj] != cnvtxs) {
for (jj=0; jj<nedges; jj++) {
if (cadjncy[jj] == cnvtxs)
break;
}
}
if (jj >= 0 && cadjncy[jj] == cnvtxs) { /* This 2nd check is needed for non-adjacent matchings */
cadjwgtsum[cnvtxs] -= cadjwgt[jj];
cadjncy[jj] = cadjncy[--nedges];
cadjwgt[jj] = cadjwgt[nedges];
}
}
ASSERTP(cadjwgtsum[cnvtxs] == idxsum(nedges, cadjwgt), ("%d %d %d %d %d\n", cnvtxs, cadjwgtsum[cnvtxs], idxsum(nedges, cadjwgt), adjwgtsum[u], adjwgtsum[v]));
for (j=0; j<nedges; j++)
htable[cadjncy[j]&mask] = -1; /* Zero out the htable */
htable[cnvtxs&mask] = -1;
cnedges += nedges;
cxadj[++cnvtxs] = cnedges;
cadjncy += nedges;
cadjwgt += nedges;
}
cgraph->nedges = cnedges;
ReAdjustMemory(graph, cgraph, 0);
IFSET(ctrl->dbglvl, DBG_TIME, stoptimer(ctrl->ContractTmr));
idxwspacefree(ctrl, mask+1);
}
开发者ID:aceskpark,项目名称:osfeo,代码行数:101,代码来源:ccgraph.c
示例15: ASSERTP
/**
* Set the write port size (at least 1).
* @param read_write_size Write port size.
*/
void Cache::setWritePortSize(int write_port_size) {
ASSERTP(write_port_size >= 0, "bad write port size");
_info.write_port_size = write_port_size;
}
开发者ID:alexjordan,项目名称:otawa,代码行数:8,代码来源:hardware_Cache.cpp
示例16: Moc_KWayFM
//.........这里部分代码省略.........
}
}
}
}
/******************************************/
/* Let processors know the subdomain wgts */
/* if all proposed moves commit. */
/******************************************/
MPI_Allreduce((void *)lnpwgts, (void *)pgnpwgts, nparts*ncon,
MPI_DOUBLE, MPI_SUM, ctrl->comm);
/**************************/
/* compute overfill array */
/**************************/
overweight = 0;
for (j=0; j<nparts; j++) {
for (h=0; h<ncon; h++) {
if (pgnpwgts[j*ncon+h] > ognpwgts[j*ncon+h]) {
overfill[j*ncon+h] =
(pgnpwgts[j*ncon+h]-badmaxpwgt[j*ncon+h]) /
(pgnpwgts[j*ncon+h]-ognpwgts[j*ncon+h]);
}
else {
overfill[j*ncon+h] = 0.0;
}
overfill[j*ncon+h] = amax(overfill[j*ncon+h], 0.0);
overfill[j*ncon+h] *= movewgts[j*ncon+h];
if (overfill[j*ncon+h] > 0.0)
overweight = 1;
ASSERTP(ctrl, ognpwgts[j*ncon+h] <= badmaxpwgt[j*ncon+h] ||
pgnpwgts[j*ncon+h] <= ognpwgts[j*ncon+h],
(ctrl, "%.4f %.4f %.4f\n", ognpwgts[j*ncon+h],
badmaxpwgt[j*ncon+h], pgnpwgts[j*ncon+h]));
}
}
/****************************************************/
/* select moves to undo according to overfill array */
/****************************************************/
if (overweight == 1) {
for (iii=0; iii<nmoved; iii++) {
i = moved[iii];
oldto = tmp_where[i];
nvwgt = graph->nvwgt+i*ncon;
my_edegrees = tmp_rinfo[i].degrees;
for (k=0; k<tmp_rinfo[i].ndegrees; k++)
if (my_edegrees[k].edge == where[i])
break;
for (h=0; h<ncon; h++)
if (nvwgt[h] > 0.0 && overfill[oldto*ncon+h] > nvwgt[h]/4.0)
break;
/**********************************/
/* nullify this move if necessary */
/**********************************/
if (k != tmp_rinfo[i].ndegrees && h != ncon) {
moved[iii] = -1;
from = oldto;
to = where[i];
开发者ID:davidheryanto,项目名称:sc14,代码行数:66,代码来源:kwayfm.c
注:本文中的ASSERTP函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论