mack::options::selection_option::selection_option( std::string const& short_flag, std::string const& long_flag, std::string const& brief_description, std::string const& detailed_description, std::vector<std::string> const& selection_values, std::string const& default_value, std::string const& start_value) : mack::options::option( short_flag, long_flag, brief_description, detailed_description, default_value, start_value), _selection_values(selection_values) { if (_selection_values.empty()) { BOOST_THROW_EXCEPTION(no_selection_error() << errinfo_option_flag(long_flag)); } if (!is_valid_value(default_value)) { BOOST_THROW_EXCEPTION(invalid_value_error() << errinfo_option_flag(get_long_flag()) << errinfo_option_value(default_value)); } else if (!is_valid_value(start_value)) { BOOST_THROW_EXCEPTION(invalid_value_error() << errinfo_option_flag(get_long_flag()) << errinfo_option_value(start_value)); } }
// This way of handling positivity violations is // not continuous in time. One would have to // transition gradually from one level to another. // stringencyLevel should be changed to double // (integer values could serve as points where // complete transition is made). // void PositivityState::increaseStringency() { if(stringencyLevel==AVERAGE) { dprintf("increasing stringency level to POSITIVITY_POINTS"); stringencyLevel = POSITIVITY_POINTS; repeatStageFlag = true; } //else if(stringencyLevel==POSITIVITY_POINTS) //{ // dprintf("increasing stringency level to IMPLICIT_SOURCE"); // stringencyLevel = IMPLICIT_SOURCE; // repeatStepFlag = true; //} //else if(stringencyLevel==IMPLICIT_SOURCE) else if(stringencyLevel==POSITIVITY_POINTS) { // make this number configurable? // could rescale based on comparison // of minval with minval computed with // larger time step. // // want to modify dt by a factor that will // cause minval to be zero. // // time step must be repeated if step length is changed. repeatStepFlag = true; #if 0 if(suggested_dt_changeFactor < .8) dt_changeFactor = .8; else if(suggested_dt_changeFactor > .95) dt_changeFactor = .95; else dt_changeFactor = suggested_dt_changeFactor; #endif //double dt_changeFactor = .95; //cflFactor *= dt_changeFactor; cflFactor -= .0625; //dt *= dt_changeFactor; //dprint(dt); dprintf1("decreased cflFactor to %f",cflFactor); // if cflFactor gets too small something must have gone wrong. // There should exist a positivity-guaranteeing CFL number // that is independent of the solution (assuming that there // is a positivity-guaranteeing CFL number that is independent // of the solution for the HLLE method, which maybe isn't quite // true because we don't have a perfect way to obtain an upper // bound on physical wave speeds for the Riemann problem between // two cell states (Einfeldt's prescription is a not a guarantee // for all strictly hyperbolic systems). //assert_gt(cflFactor, .08); assert_gt(cflFactor, 0.); } else { invalid_value_error(stringencyLevel); } }
void mack::options::option::set_default_value( std::string const& default_value) { if (!is_valid_value(default_value)) { BOOST_THROW_EXCEPTION(invalid_value_error() << errinfo_option_value(default_value) << errinfo_option_flag(get_long_flag())); } else { _default_value = default_value; } }
// ndims: number of dimensions that have mbc layers of boundary cells dTensorBC1::dTensorBC1(int S1i, int mbcin, int ndimsin) : S1(S1i), mbc(mbcin), ndims(ndimsin) { size=S1i; b1=1; assert_ge(mbc,0); switch(ndims) { default: invalid_value_error(ndims); case 1: b1=1-mbc; size=S1+2*mbc; case 0: ; } init(); }
// ndims: number of dimensions that have mbc layers of boundary cells dTensorBC2::dTensorBC2(int S1i, int S2i, int mbcin, int ndimsin) : S1(S1i), S2(S2i), mbc(mbcin), ndims(ndimsin) { s1=S1i; s2=S2i; b1=1; b2=1; assert_ge(mbc,0); switch(ndims) { default: invalid_value_error(ndims); case 2: b2=1-mbc; s2=S2+2*mbc; case 1: b1=1-mbc; s1=S1+2*mbc; case 0: ; } init(); }
// ndims: number of dimensions that have mbc layers of boundary cells dTensorBC4::dTensorBC4(int S1i, int S2i, int S3i, int S4i, int mbcin, int ndimsin) : S1(S1i), S2(S2i), S3(S3i), S4(S4i), mbc(mbcin), ndims(ndimsin) { s1=S1i; s2=S2i; s3=S3i; s4=S4i; b1=1; b2=1; b3=1; b4=1; assert_ge(mbc,0); switch(ndims) { default: invalid_value_error(ndims); case 4: b4=1-mbc; s4=S4+2*mbc; case 3: b3=1-mbc; s3=S3+2*mbc; case 2: b2=1-mbc; s2=S2+2*mbc; case 1: b1=1-mbc; s1=S1+2*mbc; case 0: ; } init(); }