From: David Wells Date: Tue, 4 May 2021 21:08:12 +0000 (-0400) Subject: 1 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9a400e6254e53ad6c0d3e9aa17d1a6fbf317ec44;p=dealii.git 1 --- diff --git a/source/base/data_out_base.cc b/source/base/data_out_base.cc index 860b01c470..9db07c9d20 100644 --- a/source/base/data_out_base.cc +++ b/source/base/data_out_base.cc @@ -1427,6 +1427,74 @@ namespace + // Separate these out to avoid an internal compiler error with intel 17 + namespace internal + { + template + std::array::vertices_per_cell> + order_cell( unsigned int /*start*/, + unsigned int /*d1*/, + unsigned int /*d2*/, + unsigned int /*d3*/) + { + Assert(false, ExcInternalError()); + return {}; + } + + template <> + std::array::vertices_per_cell> + order_cell<1>( + unsigned int start, + unsigned int d1, + unsigned int /*d2*/, + unsigned int /*d3*/) + + { + std::array::vertices_per_cell> nodes; + nodes[0] = start; + nodes[1] = start + d1; +return nodes; + } + + template <> + std::array::vertices_per_cell> + order_cell<2>( + unsigned int start, + unsigned int d1, + unsigned int d2, + unsigned int /*d3*/) + + { + std::array::vertices_per_cell> nodes; + nodes[0] = start; + nodes[1] = start + d1; + nodes[2] = start + d2; + nodes[3] = start + d2 + d1; +return nodes; + } + + template <> + std::array::vertices_per_cell> + order_cell<3>( unsigned int start, + unsigned int d1, + unsigned int d2, + unsigned int d3) + { + std::array::vertices_per_cell> nodes; + nodes[0] = start; + nodes[1] = start + d1; + nodes[2] = start + d2; + nodes[3] = start + d2 + d1; + nodes[4] = start + d3; + nodes[5] = start + d3 + d1; + nodes[6] = start + d3 + d2; + nodes[7] = start + d3 + d2 + d1; +return nodes; + } + } + + + template void DXStream::write_cell(unsigned int, @@ -1435,36 +1503,16 @@ namespace unsigned int d2, unsigned int d3) { - int nodes[1 << dim]; - nodes[GeometryInfo::dx_to_deal[0]] = start; - if (dim >= 1) - { - nodes[GeometryInfo::dx_to_deal[1]] = start + d1; - if (dim >= 2) - { - // Add shifted line in y direction - nodes[GeometryInfo::dx_to_deal[2]] = start + d2; - nodes[GeometryInfo::dx_to_deal[3]] = start + d2 + d1; - if (dim >= 3) - { - // Add shifted quad in z direction - nodes[GeometryInfo::dx_to_deal[4]] = start + d3; - nodes[GeometryInfo::dx_to_deal[5]] = start + d3 + d1; - nodes[GeometryInfo::dx_to_deal[6]] = start + d3 + d2; - nodes[GeometryInfo::dx_to_deal[7]] = start + d3 + d2 + d1; - } - } - } + auto nodes = internal::order_cell(start, d1, d2, d3); if (flags.int_binary) - stream.write(reinterpret_cast(nodes), - (1 << dim) * sizeof(*nodes)); + stream.write(reinterpret_cast(nodes.data()), + nodes.size() * sizeof(nodes[0])); else { - const unsigned int final = (1 << dim) - 1; - for (unsigned int i = 0; i < final; ++i) - stream << nodes[i] << '\t'; - stream << nodes[final] << '\n'; + for (unsigned int i = 0; i < nodes.size() - 1; ++i) + stream << nodes[GeometryInfo::dx_to_deal[i]] << '\t'; + stream << nodes.back() << '\n'; } } @@ -1613,32 +1661,12 @@ namespace unsigned int d2, unsigned int d3) { - int nodes[1 << dim]; - nodes[GeometryInfo::ucd_to_deal[0]] = start; - if (dim >= 1) - { - nodes[GeometryInfo::ucd_to_deal[1]] = start + d1; - if (dim >= 2) - { - // Add shifted line in y direction - nodes[GeometryInfo::ucd_to_deal[2]] = start + d2; - nodes[GeometryInfo::ucd_to_deal[3]] = start + d2 + d1; - if (dim >= 3) - { - // Add shifted quad in z direction - nodes[GeometryInfo::ucd_to_deal[4]] = start + d3; - nodes[GeometryInfo::ucd_to_deal[5]] = start + d3 + d1; - nodes[GeometryInfo::ucd_to_deal[6]] = start + d3 + d2; - nodes[GeometryInfo::ucd_to_deal[7]] = start + d3 + d2 + d1; - } - } - } + auto nodes = internal::order_cell(start, d1, d2, d3); // Write out all cells and remember that all indices must be shifted by one. stream << index + 1 << "\t0 " << ucd_cell_type[dim]; - const unsigned int final = (1 << dim); - for (unsigned int i = 0; i < final; ++i) - stream << '\t' << nodes[i] + 1; + for (unsigned int i = 0; i < nodes.size(); ++i) + stream << '\t' << nodes[GeometryInfo::ucd_to_deal[i]] + 1; stream << '\n'; }