标题:请问:这代码为啥出现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: 12Rank: 12Rank: 12
来 自:CC
等 级:贵宾
威 望:49
帖 子:1636
专家分:3940
注 册: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



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-476665-1-1.html




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

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