2301_77060366 2024-01-08 15:45 采纳率: 0%
浏览 4

在下面这段代码中,为什么在VS平台上运行至//error处,会出现断点指令错误(debugbreak

在下面这段代码中,为什么在VS平台上运行至//error处,会出现断点指令错误(debugbreak)


int numElements = theDomain->getNumElements();

    for (int i = 1; i <= numElements; i++) {//本例中单元编号从1开始
        Element* element = theDomain->getElement(i);
        //Information* info = new Information();
        //element->getResponse(3, *info);
        //const Vector& stressVector = info->getData();


        // 获取当前单元的节点列表(向量)
        const ID& nodeTags = element->getExternalNodes();
        // 计算共享节点的平均应力
        Vector averageStress(3 * nodeTags.Size());
        for (int k = 0; k < nodeTags.Size(); k++) {
            double sumStress01 = 0.0;
            double sumStress02 = 0.0;
            double sumStress03 = 0.0;
            int count = 0;
            for (int l = 1; l <= numElements; l++) {
                Element* otherElement = theDomain->getElement(l);
                const ID& otherNodeTags = otherElement->getExternalNodes();
                for (int m = 0; m < otherNodeTags.Size(); m++) {
                    if (nodeTags(k) == otherNodeTags(m)) {
                        Information* otherInfo = new Information();
                        otherElement->getResponse(3, *otherInfo);
                        const Vector& otherStressVector = otherInfo->getData();

                        sumStress01 += otherStressVector(3 * m - 3);
                        sumStress02 += otherStressVector(3 * m - 2);
                        sumStress03 += otherStressVector(3 * m - 1);
                        count++;
                    }//error
                }
            }
            averageStress(3 * k - 3) = sumStress01 / count;
            averageStress(3 * k - 2) = sumStress02 / count;
            averageStress(3 * k - 1) = sumStress03 / count;
        }

    }
  • 写回答

1条回答 默认 最新

  • 赵4老师 2024-01-08 17:18
    关注

    崩溃的时候在弹出的对话框按相应按钮进入调试,按Alt+7键查看Call Stack即“调用堆栈”里面从上到下列出的对应从里层到外层的函数调用历史。双击某一行可将光标定位到此次调用的源代码或汇编指令处,看不懂时双击下一行,直到能看懂为止。

    评论

报告相同问题?

问题事件

  • 创建了问题 1月8日