Skip to content
Snippets Groups Projects
Commit be19e760 authored by Stéphane Del Pino's avatar Stéphane Del Pino
Browse files

Specialize call for the case of a single function and a single zone

Call was ambiguous without it:
 interpolate: mesh*(zone...)*Vh_type*(function...) -> Vh
 interpolate: mesh*(zone...)*Vh_type*function -> Vh
parent a054ba88
No related branches found
No related tags found
1 merge request!138Fix a g++-9 warning
...@@ -243,6 +243,40 @@ SchemeModule::SchemeModule() ...@@ -243,6 +243,40 @@ SchemeModule::SchemeModule()
)); ));
this
->_addBuiltinFunction("interpolate",
std::make_shared<BuiltinFunctionEmbedder<
std::shared_ptr<const IDiscreteFunction>(std::shared_ptr<const IMesh>,
std::shared_ptr<const IZoneDescriptor>,
std::shared_ptr<const IDiscreteFunctionDescriptor>,
const FunctionSymbolId&)>>(
[](std::shared_ptr<const IMesh> mesh,
std::shared_ptr<const IZoneDescriptor> interpolation_zone,
std::shared_ptr<const IDiscreteFunctionDescriptor> discrete_function_descriptor,
const FunctionSymbolId& function_id) -> std::shared_ptr<const IDiscreteFunction> {
switch (discrete_function_descriptor->type()) {
case DiscreteFunctionType::P0: {
return DiscreteFunctionInterpoler{mesh,
{interpolation_zone},
discrete_function_descriptor,
function_id}
.interpolate();
}
case DiscreteFunctionType::P0Vector: {
return DiscreteFunctionVectorInterpoler{mesh,
{interpolation_zone},
discrete_function_descriptor,
{function_id}}
.interpolate();
}
default: {
throw NormalError("invalid function descriptor type");
}
}
}
));
this->_addBuiltinFunction("randomizeMesh", this->_addBuiltinFunction("randomizeMesh",
std::make_shared<BuiltinFunctionEmbedder<std::shared_ptr< std::make_shared<BuiltinFunctionEmbedder<std::shared_ptr<
const IMesh>(std::shared_ptr<const IMesh>, const IMesh>(std::shared_ptr<const IMesh>,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment