Source/Initialization/PlasmaInjector.cpp
// Depending on injection type at runtime, initialize inj_rho
// so that inj_rho->getDensity calls
// InjectorPosition[Constant or Custom or etc.].getDensity.
Depending on injection type at runtime, initialize inj_rho
so that inj_rho->getDensity calls
InjectorPosition[Constant or Custom or etc.].getDensity.
Depending on injection type at runtime initialize inj_rho so that inj_rho - > getDensity calls InjectorPosition [ Constant or Custom or etc . ] . getDensity .
void PlasmaInjector::parseDensity (ParmParse& pp)
{
    std::string rho_prof_s;
    pp.get("profile", rho_prof_s);
    std::transform(rho_prof_s.begin(), rho_prof_s.end(),
                   rho_prof_s.begin(), ::tolower);
    if (rho_prof_s == "constant") {
        getWithParser(pp, "density", density);
        h_inj_rho.reset(new InjectorDensity((InjectorDensityConstant*)nullptr, density));
    } else if (rho_prof_s == "custom") {
        h_inj_rho.reset(new InjectorDensity((InjectorDensityCustom*)nullptr, species_name));
    } else if (rho_prof_s == "predefined") {
        h_inj_rho.reset(new InjectorDensity((InjectorDensityPredefined*)nullptr,species_name));
    } else if (rho_prof_s == "parse_density_function") {
        Store_parserString(pp, "density_function(x,y,z)", str_density_function);
        h_inj_rho.reset(new InjectorDensity((InjectorDensityParser*)nullptr,
                                            makeParser(str_density_function,{"x","y","z"})));
    } else {
        std::string s_inj_style;
        pp.query("injection_style", s_inj_style);
        if (s_inj_style != "external_file") {
            StringParseAbortMessage("Density profile type", rho_prof_s);
        }
    }
}
void PlasmaInjector :: parseDensity ( ParmParse & pp ) { std :: string rho_prof_s ; pp . get ( " " , rho_prof_s ) ; std :: transform ( rho_prof_s . begin ( ) , rho_prof_s . end ( ) , rho_prof_s . begin ( ) , :: tolower ) ; if ( rho_prof_s == " " ) { getWithParser ( pp , " " , density ) ; h_inj_rho . reset ( new InjectorDensity ( ( InjectorDensityConstant * ) nullptr , density ) ) ; } else if ( rho_prof_s == " " ) { h_inj_rho . reset ( new InjectorDensity ( ( InjectorDensityCustom * ) nullptr , species_name ) ) ; } else if ( rho_prof_s == " " ) { h_inj_rho . reset ( new InjectorDensity ( ( InjectorDensityPredefined * ) nullptr , species_name ) ) ; } else if ( rho_prof_s == " " ) { Store_parserString ( pp , " " , str_density_function ) ; h_inj_rho . reset ( new InjectorDensity ( ( InjectorDensityParser * ) nullptr , makeParser ( str_density_function , { " " , " " , " " } ) ) ) ; } else { std :: string s_inj_style ; pp . query ( " " , s_inj_style ) ; if ( s_inj_style != " " ) { StringParseAbortMessage ( " " , rho_prof_s ) ; } } }
Depending on injection type at runtime, initialize inj_rho
so that inj_rho->getDensity calls
InjectorPosition[Constant or Custom or etc.
Depending on injection type at runtime initialize inj_rho so that inj_rho - > getDensity calls InjectorPosition [ Constant or Custom or etc .
// parse density information // Construct InjectorDensity with InjectorDensityConstant. // Construct InjectorDensity with InjectorDensityCustom. // Construct InjectorDensity with InjectorDensityPredefined. // Construct InjectorDensity with InjectorDensityParser. //No need for profile definition if external file is used