diff --git a/src/scheme/DiscreteFunctionVectorInterpoler.cpp b/src/scheme/DiscreteFunctionVectorInterpoler.cpp index b416400c65a719614be50a53f167a44d859c9497..57724b7722df4a8410993afee713c35f8d1c73e1 100644 --- a/src/scheme/DiscreteFunctionVectorInterpoler.cpp +++ b/src/scheme/DiscreteFunctionVectorInterpoler.cpp @@ -96,11 +96,7 @@ template <size_t Dimension> DiscreteFunctionVariant DiscreteFunctionVectorInterpoler::_interpolate() const { - for (const auto& function_id : m_function_id_list) { - const auto& function_descriptor = function_id.descriptor(); - Assert(function_descriptor.domainMappingNode().children[1]->m_data_type == ASTNodeDataType::typename_t); - const ASTNodeDataType& data_type = function_descriptor.domainMappingNode().children[1]->m_data_type.contentType(); - + auto check_data_type = [](const ASTNodeDataType& data_type) { switch (data_type) { case ASTNodeDataType::bool_t: case ASTNodeDataType::unsigned_int_t: @@ -115,7 +111,32 @@ DiscreteFunctionVectorInterpoler::_interpolate() const throw NormalError(os.str()); } } + }; + + if (m_function_id_list.size() == 1) { + const auto& function_descriptor = m_function_id_list[0].descriptor(); + if ((function_descriptor.domainMappingNode().children[1]->m_data_type == ASTNodeDataType::typename_t) or + (function_descriptor.domainMappingNode().children[1]->m_data_type == ASTNodeDataType::tuple_t)) { + const ASTNodeDataType& data_type = function_descriptor.domainMappingNode().children[1]->m_data_type.contentType(); + + check_data_type(data_type); + } else { + throw UnexpectedError("incorrect function"); + } + } else { + for (const auto& function_id : m_function_id_list) { + const auto& function_descriptor = function_id.descriptor(); + if (function_descriptor.domainMappingNode().children[1]->m_data_type == ASTNodeDataType::typename_t) { + const ASTNodeDataType& data_type = + function_descriptor.domainMappingNode().children[1]->m_data_type.contentType(); + + check_data_type(data_type); + } else { + throw UnexpectedError("incorrect function"); + } + } } + return this->_interpolate<Dimension, double>(); }