31 using namespace Utilities;
45 if (
string ==
"continuous monotone spline")
51 "You provided an interpolation type which is not supported: " <<
string 52 <<
"This may be due to all options besides continuous monotone spline have been " 53 <<
"removed since version 0.5. It is best to remove the interpolation variable " 54 <<
"from you input file as it may be removed in future versions.");
60 Interface::Interface()
63 Interface::~Interface ()
67 Interface::declare_entries(
Parameters &prm,
const std::string &parent_name,
const std::vector<std::string> &required_entries)
78 for (
auto &it : get_snippet_map())
80 std::string item = path +
"/"+std::to_string(idx);
82 Pointer((item).c_str()).Set(declarations,
"object");
83 Pointer((item+
"/label").c_str()).Set(declarations,(
"add a '" + it.first +
"'").c_str());
94 unsigned int counter = 0;
95 for (
auto &it : get_declare_map())
107 "The model name of the feature determining its type.");
109 "The name which the user has given to the feature. " 110 "This is mostly used for documentation purposes, and should in most cases be unique, " 111 "although this is not enforced.");
113 "A tag which can be given to a feature. This is meant to categorize different features. " 114 "If the tag is not provided or empty, it is set to the model name.");
116 "An array of 2d Points representing an array of coordinates where the feature is located.");
119 "What type of interpolation should be used to enforce the minimum points per " 120 "distance parameter. Options are 'global' and " 121 "'continuous monotone spline' interpolation. If this " 122 "value is set to global, the global value for interpolation is used. " 123 "This option is deprecated and will be removed in a future release.");
124 WBAssert(it.second != NULL,
"No declare entries given.");
125 it.second(prm, parent_name, {});
140 Interface::get_coordinates(
const std::string & ,
146 std::transform(coordinates.begin(),coordinates.end(), coordinates.begin(),
151 const std::string interpolation_type_string = prm.
get<std::string>(
"interpolation") ==
"global" ? this->world->interpolation : prm.
get<std::string>(
"interpolation");
152 interpolation_type = WorldBuilder::Features::Internal::string_to_interpolation_type(interpolation_type_string);
154 original_number_of_coordinates = coordinates.size();
159 "For interpolation, linear and monotone spline are the only allowed values. " 160 <<
"You provided " << interpolation_type_string <<
'.');
168 Interface::registerType(
const std::string &name,
169 void ( *declare_entries)(
Parameters &,
const std::string &,
const std::vector<std::string> &),
173 get_factory_map()[name] = factory;
174 get_declare_map()[name] = declare_entries;
175 get_snippet_map()[name] = make_snippet;
178 std::unique_ptr<Interface>
181 std::string lower_case_name;
182 std::transform(name.begin(),
184 std::back_inserter(lower_case_name),
189 WBAssertThrow(get_factory_map().find(lower_case_name) != get_factory_map().end(),
190 "Internal error: Plugin with name '" << lower_case_name <<
"' is not found. " 191 "The size of factories is " << get_factory_map().size() <<
'.');
196 return get_factory_map().at(lower_case_name)->create(world);
200 Interface::distance_to_feature_plane(
const Point<3> & ,
204 WBAssertThrow(
false,
"The distance_to_feature_plane is not yet implemented for the desinated object");
Class for circle line/spline, including interpolation on it.
void enter_subsection(const std::string &name)
#define WBAssert(condition, message)
std::string get_full_json_path(size_t max_size=std::numeric_limits< size_t >::max()) const
#define WBAssertThrow(condition, message)
void declare_entry(const std::string &name, const Types::Interface &type, const std::string &documentation)
std::vector< T > get_vector(const std::string &name)
T get(const std::string &name)
rapidjson::Document declarations