MCPcopy Create free account
hub / github.com/Cantera/cantera / setAuxiliary

Method setAuxiliary

src/base/SolutionArray.cpp:880–922  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

878}
879
880void SolutionArray::setAuxiliary(int loc, const AnyMap& data)
881{
882 setLoc(loc, false);
883 for (const auto& [name, value] : data) {
884 if (!m_extra->count(name)) {
885 throw CanteraError("SolutionArray::setAuxiliary",
886 "Unknown auxiliary component '{}'.", name);
887 }
888 auto& extra = m_extra->at(name);
889 if (extra.is<void>()) {
890 if (m_dataSize > 1) {
891 throw CanteraError("SolutionArray::setAuxiliary",
892 "Unable to set location for type '{}': "
893 "component is not initialized.", name);
894 }
895 _initExtra(name, value);
896 _resizeExtra(name);
897 }
898 try {
899 if (extra.isVector<long int>()) {
900 setAuxiliarySingle<long int>(m_loc, extra, value);
901 } else if (extra.isVector<double>()) {
902 setAuxiliarySingle<double>(m_loc, extra, value);
903 } else if (extra.isVector<string>()) {
904 setAuxiliarySingle<string>(m_loc, extra, value);
905 } else if (extra.isVector<vector<long int>>()) {
906 setAuxiliaryMulti<long int>(m_loc, extra, value);
907 } else if (extra.isVector<vector<double>>()) {
908 setAuxiliaryMulti<double>(m_loc, extra, value);
909 } else if (extra.isVector<vector<string>>()) {
910 setAuxiliaryMulti<string>(m_loc, extra, value);
911 } else {
912 throw CanteraError("SolutionArray::setAuxiliary",
913 "Unable to set entry for type '{}'.", extra.type_str());
914 }
915 } catch (CanteraError& err) {
916 // make failed type conversions traceable
917 throw CanteraError("SolutionArray::setAuxiliary",
918 "Encountered incompatible value for component '{}':\n{}",
919 name, err.getMessage());
920 }
921 }
922}
923
924AnyMap preamble(const string& desc)
925{

Callers 3

TESTFunction · 0.80
testSingleColFunction · 0.80
testMultiColFunction · 0.80

Calls 3

CanteraErrorClass · 0.85
type_strMethod · 0.80
getMessageMethod · 0.45

Tested by 3

TESTFunction · 0.64
testSingleColFunction · 0.64
testMultiColFunction · 0.64