16 initialize( label, size1, size1, NULL );
23 initialize( label, length, length, boundaries );
30 int size1 = (int) boundaries.size( );
32 initialize( label, size1, size1, &(boundaries[0]) );
39 initialize( group.mLabel, group.
size( ), group.
size( ), &(group.mBoundaries[0]) );
44void GIDI_settings_group::initialize( std::string
const &label,
int size1,
int length,
double const *boundaries ) {
49 if( size1 < length ) size1 = length;
50 if( size1 < 0 ) size1 = 0;
51 mBoundaries.resize( size1, 0 );
52 for( i1 = 0; i1 < length; ++i1 ) mBoundaries[i1] = boundaries[i1];
58 if (
this != &group ) {
59 initialize( group.mLabel, group.
size(), group.
size(), &(group.mBoundaries[0]) );
74 int iMin = 0, iMid, iMax = (int) mBoundaries.size( ), iMaxM1 = iMax - 1;
76 if( iMax == 0 )
return( -3 );
77 if( energy < mBoundaries[0] ) {
78 if( encloseOutOfRange )
return( 0 );
81 if( energy > mBoundaries[iMaxM1] ) {
82 if( encloseOutOfRange )
return( iMax - 2 );
86 iMid = ( iMin + iMax ) >> 1;
87 if( iMid == iMin )
break;
88 if( energy < mBoundaries[iMid] ) {
94 if( iMin == iMaxM1 ) iMin--;
105 std::cout <<
"GROUP: label = '" << mLabel <<
"': length = " << nbs << std::endl;
106 if( outline )
return;
107 for(
int ib = 0; ib < nbs; ib++ ) {
108 snprintf( buffer,
sizeof buffer,
"%16.8e", mBoundaries[ib] );
110 if( ( ( ib + 1 ) % valuesPerLine ) == 0 ) std::cout << std::endl;
112 if( nbs % valuesPerLine ) std::cout << std::endl;
120GIDI_settings_groups_from_bdfls::GIDI_settings_groups_from_bdfls( std::string
const &fileName ) {
122 initialize( fileName.c_str( ) );
127GIDI_settings_groups_from_bdfls::GIDI_settings_groups_from_bdfls(
char const *fileName ) {
134GIDI_settings_groups_from_bdfls::GIDI_settings_groups_from_bdfls( cbdfls_file
const *bdfls ) {
136 initialize2( bdfls );
141void GIDI_settings_groups_from_bdfls::initialize(
char const *fileName ) {
146 if( ( bdfls = cbdflsOpen( fileName, &Error ) ) == NULL )
throw Error;
147 initialize2( bdfls );
148 cbdflsRelease( bdfls );
153void GIDI_settings_groups_from_bdfls::initialize2( cbdfls_file
const *bdfls ) {
157 std::string label(
"" );
160 ng = cbdflsGIDs( (cbdfls_file *) bdfls, &gids );
161 for(
int ig = 0; ig < ng; ++ig ) {
162 ngbs = cbdflsGetGroup( (cbdfls_file *) bdfls, gids[ig], &boundaries );
163 snprintf( cLabel,
sizeof xLabel,
"LLNL_gid_%.3d", gids[ig] );
171GIDI_settings_groups_from_bdfls::~GIDI_settings_groups_from_bdfls( ) {
179 std::string label(
"" );
182 snprintf( cLabel,
sizeof cLabel,
"LLNL_gid_%.3d", gid );
184 for(
int ig = 0; ig < (int) mGroups.size( ); ++ig ) {
185 if( mGroups[ig].isLabel( label ) )
return( mGroups[ig] );
192std::vector<std::string> GIDI_settings_groups_from_bdfls::getLabels(
void )
const {
194 int size = (int) mGroups.size( );
195 std::vector<std::string> labels( size );
197 for(
int if1 = 0; if1 < size; ++if1 ) labels[if1] = mGroups[if1].getLabel( );
203std::vector<int> GIDI_settings_groups_from_bdfls::getGIDs(
void )
const {
205 int size = (int) mGroups.size( );
206 std::vector<int> fids( size );
209 for(
int if1 = 0; if1 < size; ++if1 ) {
210 fids[if1] = (int) strtol( &(mGroups[if1].getLabel( ).c_str( )[9]), &e, 10 );
217void GIDI_settings_groups_from_bdfls::print(
bool outline,
int valuesPerLine )
const {
219 int ngs = (int) mGroups.size( );
221 std::cout <<
"BDFLS GROUPs: number of groups = " << ngs << std::endl;
222 for(
int if1 = 0; if1 < ngs ; ++if1 ) mGroups[if1].
print( outline, valuesPerLine );
void print(G4double elem)
GIDI_settings_group & operator=(const GIDI_settings_group &group)
void print(bool outline=false, int valuesPerLine=10) const
GIDI_settings_group(std::string const &label="empty", int size=0)
int getGroupIndexFromEnergy(double energy, bool encloseOutOfRange) const
void initialize(Config const *const theConfig)
Initialize the clustering model based on the Config object.