From: Denis Davydov Date: Thu, 21 Jun 2018 04:57:56 +0000 (+0200) Subject: add shortcuts for elements of the tupls X-Git-Tag: v9.1.0-rc1~1008^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a6aa545f6d2bda64b3667505af59072a3ee6a63b;p=dealii.git add shortcuts for elements of the tupls --- diff --git a/source/base/data_out_base.cc b/source/base/data_out_base.cc index 29b12e2570..855da02507 100644 --- a/source/base/data_out_base.cc +++ b/source/base/data_out_base.cc @@ -5213,31 +5213,33 @@ namespace DataOutBase std::vector data_set_written(n_data_sets, false); for (auto range : vector_data_ranges) { - AssertThrow(std::get<1>(range) >= std::get<0>(range), - ExcLowerRange(std::get<1>(range), std::get<0>(range))); - AssertThrow(std::get<1>(range) < n_data_sets, - ExcIndexRange(std::get<1>(range), 0, n_data_sets)); - AssertThrow(std::get<1>(range) + 1 - std::get<0>(range) <= 3, + const auto first_component = std::get<0>(range); + const auto last_component = std::get<1>(range); + const auto name = std::get<2>(range); + AssertThrow(last_component >= first_component, + ExcLowerRange(last_component, first_component)); + AssertThrow(last_component < n_data_sets, + ExcIndexRange(last_component, 0, n_data_sets)); + AssertThrow(last_component + 1 - first_component <= 3, ExcMessage( "Can't declare a vector with more than 3 components " "in VTK")); // mark these components as already written: - for (unsigned int i = std::get<0>(range); i <= std::get<1>(range); ++i) + for (unsigned int i = first_component; i <= last_component; ++i) data_set_written[i] = true; // write the header. concatenate all the component names with double // underscores unless a vector name has been specified out << " (range) != "") - out << std::get<2>(range); + if (name != "") + out << name; else { - for (unsigned int i = std::get<0>(range); i < std::get<1>(range); - ++i) + for (unsigned int i = first_component; i < last_component; ++i) out << data_names[i] << "__"; - out << data_names[std::get<1>(range)]; + out << data_names[last_component]; } out << "\" NumberOfComponents=\"3\" format=\"" << ascii_or_binary @@ -5249,23 +5251,23 @@ namespace DataOutBase for (unsigned int n = 0; n < n_nodes; ++n) { - switch (std::get<1>(range) - std::get<0>(range)) + switch (last_component - first_component) { case 0: - data.push_back(data_vectors(std::get<0>(range), n)); + data.push_back(data_vectors(first_component, n)); data.push_back(0); data.push_back(0); break; case 1: - data.push_back(data_vectors(std::get<0>(range), n)); - data.push_back(data_vectors(std::get<0>(range) + 1, n)); + data.push_back(data_vectors(first_component, n)); + data.push_back(data_vectors(first_component + 1, n)); data.push_back(0); break; case 2: - data.push_back(data_vectors(std::get<0>(range), n)); - data.push_back(data_vectors(std::get<0>(range) + 1, n)); - data.push_back(data_vectors(std::get<0>(range) + 2, n)); + data.push_back(data_vectors(first_component, n)); + data.push_back(data_vectors(first_component + 1, n)); + data.push_back(data_vectors(first_component + 2, n)); break; default: