Ejemplo n.º 1
0
std::vector<T> as_vector(pt::ptree const& pt, pt::ptree::key_type const& key)
{
    std::vector<T> r;
    for (auto& item : pt.get_child(key))
        r.push_back(item.second.template get_value<T>());
    return r;
}
Ejemplo n.º 2
0
void Detector::addSpatialEntityTypeToPropertyTree(SpatialEntityPseudo3D &spatialEntity,
                                                  pt::ptree &propertyTree) {
    pt::ptree attributeTree;

    attributeTree.put<std::string>(LABEL_SPATIAL_ENTITY_SPATIAL_TYPE, spatialEntity.typeAsString());

    propertyTree.add_child(LABEL_ATTRIBUTE, attributeTree);
}
Ejemplo n.º 3
0
void Detector::addNumericStateVariableToPropertyTree(pt::ptree &propertyTree,
                                                     const std::string &name, double value) {
    pt::ptree numericStateVariablePropertyTree;

    numericStateVariablePropertyTree.put<std::string>(LABEL_EXPERIMENT_TIMEPOINT_NUMERIC_STATE_VARIABLE_NAME, name);
    numericStateVariablePropertyTree.put<double>(LABEL_EXPERIMENT_TIMEPOINT_NUMERIC_STATE_VARIABLE_VALUE, value);

    propertyTree.add_child(LABEL_EXPERIMENT_TIMEPOINT_NUMERIC_STATE_VARIABLE, numericStateVariablePropertyTree);
}
Ejemplo n.º 4
0
void Detector::addSpatialEntitiesToPropertyTree(pt::ptree &propertyTree) {
    std::vector<std::shared_ptr<SpatialEntityPseudo3D>> spatialEntities = getCollectionOfSpatialEntityPseudo3D();

    for (std::shared_ptr<SpatialEntityPseudo3D> &spatialEntityPointer : spatialEntities) {
        pt::ptree spatialEntityPropertyTree = constructSpatialEntityPropertyTree(*spatialEntityPointer);

        propertyTree.add_child(LABEL_EXPERIMENT_TIMEPOINT_SPATIAL_ENTITY, spatialEntityPropertyTree);
    }
}
	std::string MakeResultJSON(const std::string& answer,
		const std::string& file_id,
		const std::string& error_code,
		const std::string& seq,
		const PT::ptree& data)
	{
		PT::ptree root;
		root.put(JSON_TAG_ANS, answer);
		root.put(JSON_TAG_FILEID, file_id);
		root.put_child(JSON_TAG_DATA, data);
		root.put(JSON_TAG_ERROR_CODE, error_code);
		root.put(JSON_TAG_SEQ, seq);
		std::stringstream ss;
		PT::write_json(ss, root, false);
		return ss.str();
	}
void init_shifted_softmax(const pt::ptree& ptree) {
    double shift = ptree.get("global.softmax_shift", 10.0f);
    ShiftedSoftMax* ssm = (ShiftedSoftMax*) get_link_function("shifted_softmax");
    ssm->shift = shift;
    LOG(debug) << "softmax shift=" << shift;
}
void saveTurbulenceParameters(const IOdictionary& RASProperties,
                              pt::ptree& settings)
{
    std::string dictName = "kOmegaSSTCoeffs";
    dictionary kOmegaSSTCoeffsDict
            (RASProperties.subOrEmptyDict(dictName));

    scalar alphaK1 = kOmegaSSTCoeffsDict.lookupOrDefault<scalar>("alphaK1", 0.85034);
    settings.put(dictName + "." + speeditcl::io::TURBULENCE_KOMEGASST_ALPHA_K1, alphaK1);

    scalar alphaK2 = kOmegaSSTCoeffsDict.lookupOrDefault<scalar>("alphaK2", 1.0);
    settings.put(dictName + "." + speeditcl::io::TURBULENCE_KOMEGASST_ALPHA_K2, alphaK2);

    scalar alphaOmega1 = kOmegaSSTCoeffsDict.lookupOrDefault<scalar>("alphaOmega1", 0.5);
    settings.put(dictName + "." + speeditcl::io::TURBULENCE_KOMEGASST_ALPHA_OMEGA1, alphaOmega1);

    scalar alphaOmega2 = kOmegaSSTCoeffsDict.lookupOrDefault<scalar>("alphaOmega2", 0.85616);
    settings.put(dictName + "." + speeditcl::io::TURBULENCE_KOMEGASST_ALPHA_OMEGA2, alphaOmega2);

    scalar gamma1 = kOmegaSSTCoeffsDict.lookupOrDefault<scalar>("gamma1", 0.5532);
    settings.put(dictName + "." + speeditcl::io::TURBULENCE_KOMEGASST_GAMMA1, gamma1);

    scalar gamma2 = kOmegaSSTCoeffsDict.lookupOrDefault<scalar>("gamma2", 0.4403);
    settings.put(dictName + "." + speeditcl::io::TURBULENCE_KOMEGASST_GAMMA2, gamma2);

    scalar beta1 = kOmegaSSTCoeffsDict.lookupOrDefault<scalar>("beta1", 0.0750);
    settings.put(dictName + "." + speeditcl::io::TURBULENCE_KOMEGASST_BETA1, beta1);

    scalar beta2 = kOmegaSSTCoeffsDict.lookupOrDefault<scalar>("beta2", 0.0828);
    settings.put(dictName + "." + speeditcl::io::TURBULENCE_KOMEGASST_BETA2, beta2);

    scalar betaStar = kOmegaSSTCoeffsDict.lookupOrDefault<scalar>("betaStar", 0.09);
    settings.put(dictName + "." + speeditcl::io::TURBULENCE_KOMEGASST_BETASTAR, betaStar);

    scalar a1 = kOmegaSSTCoeffsDict.lookupOrDefault<scalar>("a1", 0.31);
    settings.put(dictName + "." + speeditcl::io::TURBULENCE_KOMEGASST_A1, a1);

    scalar c1 = kOmegaSSTCoeffsDict.lookupOrDefault<scalar>("c1", 10);
    settings.put(dictName + "." + speeditcl::io::TURBULENCE_KOMEGASST_C1, c1);

    scalar Cmu = kOmegaSSTCoeffsDict.lookupOrDefault<scalar>("Cmu", 0.09);
    settings.put(dictName + "." + speeditcl::io::TURBULENCE_KOMEGASST_CMU, Cmu);

    scalar kappa = 0.41;
    settings.put(dictName + "." + speeditcl::io::TURBULENCE_KOMEGASST_KAPPA, kappa);

    scalar E = 9.8;
    settings.put(dictName + "." + speeditcl::io::TURBULENCE_KOMEGASST_E, E);

    scalar ypl = 11.0;
    for (int i = 0; i < 10; i++)
    {
        ypl = ::log(E*ypl)/kappa;
    }
    scalar yPlusLam = ypl;
    settings.put(dictName + "." + speeditcl::io::TURBULENCE_KOMEGASST_YPLUS_LAM, yPlusLam);

}