File: cptindices.cc

package info (click to toggle)
simrisc 16.06.00-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,568 kB
  • sloc: cpp: 6,889; fortran: 669; makefile: 112; ansic: 112; sh: 107
file content (36 lines) | stat: -rw-r--r-- 1,244 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
//#define XERR
#include "loop.ih"

// with BreastDensities: compute the bi-rad category to use (a: 0 .. d: 3)
// with LC: a 0-initialized vector of d_nRounds elements

Uint16Vect Loop::cptIndices() const
{
    Uint16Vect ret;

    if (not Globals::isBreast())    // LC: a 0-initialized vector is used
        ret.resize(d_nRounds);

    else                        // for BC: compute the indices used to obtain
    {                           //         dose values
        double prob = Random::instance().uniform();

        for (double age: d_screening.ages())
        {
                    // d_groupVector initialized at the constructor to
                    // the LC s3 table or the Densities biRad vector.
            RowCol rowCol = ProbGroup::probIndexOf(*d_groupVector, age, prob);

                                                        // invalid age
            if (rowCol.first == static_cast<uint16_t>(string::npos))
                    throw Exception{} <<
                                "runtime-error: no age category for age " <<
                                age;

                    // store the birad/s3 column index to use for prob/age:
            ret.push_back(rowCol.second);
        }
    }

    return ret;
}