| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1165 人关注过本帖
标题:请问:这代码为啥出现problem recived signal SIGSEGV,Segmentation fault呢 ...
只看楼主 加入收藏
Studenter
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2017-4-19
结帖率:100%
收藏
 问题点数:0 回复次数:2 
请问:这代码为啥出现problem recived signal SIGSEGV,Segmentation fault呢
void Source_linear_Item_Calculation(double k_eff,double ****Cs,double ***q_sour,double ****source_linear,double ***cx,double ***cy)
{
    int g,g2,cell,reg,azimuth;
    double ****_fiss_Lsour=NULL,**** _Scatt_Lsour=NULL;
    double _XS_nf, _chi, _XS_s;
//    if ((q_scatter = (double *)calloc(NumGroups, sizeof(double))) == NULL || \
//        (q_fission = (double *)calloc(NumGroups, sizeof(double))) == NULL)
//        exit(120);

     for(cell=0;cell<NumCellsInCore;cell++){
        for(reg=0;reg<NumFSRsInCell[cell];reg++){
          for (azimuth = 0; azimuth < NumAzimuAng; azimuth++){
             for (g = 0; g < NumGroups; g++)
             {
                  _fiss_Lsour[g][cell][reg][azimuth]=0.0;                   这里出现problem recived signal SIGSEGV,Segmentation fault错误
                   _Scatt_Lsour[g][cell][reg][azimuth]=0.0;
             }
            }
        }
    }
    for(cell=0;cell<NumCellsInCore;cell++){
        for(reg=0;reg<NumFSRsInCell[cell];reg++){
          for (azimuth = 0; azimuth < NumAzimuAng; azimuth++){
             for (g = 0; g < NumGroups; g++)
             {

                 Cs[cell][reg][azimuth][g]=0.0;
          }
        }
     }
    }

      for(cell=0;cell<NumCellsInCore;cell++){
        for(reg=0;reg<NumFSRsInCell[cell];reg++){
          for (azimuth = 0; azimuth < NumAzimuAng; azimuth++){
             for (g = 0; g < NumGroups; g++)
             {

                 Cs[g][cell][reg][azimuth]=cx[cell][reg][g]*cos(EffAzimuAng[azimuth])+cy[cell][reg][g]*sin(EffAzimuAng[azimuth]);
             }
          }
        }
     }

    for(cell=0;cell<NumCellsInCore;cell++)
    {
        for(reg=0;reg<NumFSRsInCell[cell];reg++)
        {
            for(g=0;g<NumGroups;g++)
            {
                for (azimuth = 0; azimuth < NumAzimuAng; azimuth++)
                    {
                       for(g2=0;g2<NumGroups;g2++)
                          {
                             _XS_nf = GetXSs_tafnfchi_FSR(cell, reg, g2, MacroXS_nf, Inp_XSs_nf);
                             _chi = GetXSs_tafnfchi_FSR(cell, reg, g, Chi, Inp_Chi);
                             _XS_s = GetXSs_s_FSR(cell, reg, g2, g, MacroXS_s, Inp_XSs_p0);
                            _fiss_Lsour[g][cell][reg][azimuth] += (_chi /k_eff)*(_XS_nf*Cs[g2][cell][reg][azimuth])/(4.*3.14159265);
                            _Scatt_Lsour[g][cell][reg][azimuth] += (_XS_s*Cs[g2][cell][reg][azimuth])/(4.*3.14159265);
                           }
                          source_linear[g][cell][reg][azimuth]=_fiss_Lsour[g][cell][reg][azimuth]+_Scatt_Lsour[g][cell][reg][azimuth];
                          _fiss_Lsour[g][cell][reg][azimuth]=0.;
                          _Scatt_Lsour[g][cell][reg][azimuth]=0.;
                   }
            }
        }
    }
}
搜索更多相关主题的帖子: problem double 
2017-05-03 17:50
forever74
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
来 自:CC
等 级:版主
威 望:58
帖 子:1685
专家分:4252
注 册:2007-12-27
收藏
得分:0 
Segment fault一般因为下标越界或者指针乱飘。

对宇宙最严谨的描述应该就是宇宙其实是不严谨的
2017-05-03 18:03
Emotiona
Rank: 7Rank: 7Rank: 7
等 级:黑侠
帖 子:311
专家分:581
注 册:2017-3-7
收藏
得分:0 
学习了
2017-05-04 09:13
快速回复:请问:这代码为啥出现problem recived signal SIGSEGV,Segmentation f ...
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.017512 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved