From: Daniel Arndt Date: Mon, 23 Apr 2018 14:06:17 +0000 (+0200) Subject: Restore formatting options in Abaqus_to_UCD X-Git-Tag: v9.0.0-rc1~114^2~4 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=014326c8b4146cfa0973f744c26a328db6ec038f;p=dealii.git Restore formatting options in Abaqus_to_UCD --- diff --git a/source/grid/grid_in.cc b/source/grid/grid_in.cc index e5b389b91e..d46cdc11b7 100644 --- a/source/grid/grid_in.cc +++ b/source/grid/grid_in.cc @@ -23,6 +23,8 @@ #include #include +#include + #include #include #include @@ -3533,6 +3535,9 @@ cont: AssertThrow (output, ExcIO()); + // save old formatting options + const boost::io::ios_base_all_saver formatting_saver(output); + // Write out title - Note: No other commented text can be inserted below the // title in a UCD file output << "# Abaqus to UCD mesh conversion" << std::endl; @@ -3561,54 +3566,47 @@ cont: // keyword used to represent them in the file. // Write out header - output - << node_list.size() << "\t" - << (cell_list.size() + face_list.size()) << "\t0\t0\t0" - << std::endl; + output << node_list.size() << "\t" + << (cell_list.size() + face_list.size()) << "\t0\t0\t0" + << std::endl; + + output.width (16); + output.precision (8); // Write out node numbers - for (unsigned int ii = 0; ii < node_list.size(); ++ii) // Loop over all nodes + // Loop over all nodes + for (unsigned int ii = 0; ii < node_list.size(); ++ii) { - for (unsigned int jj = 0; jj < dim + 1; ++jj) // Loop over entries to be outputted + // Node number + output << node_list[ii][0] << "\t"; + + // Node coordinates + output.setf (std::ios::scientific, std::ios::floatfield); + for (unsigned int jj = 1; jj < dim + 1; ++jj) { - if (jj == 0) // Node number - { - output.precision(); - output << node_list[ii][jj] << "\t"; - } - else // Node coordinates - { - output.width (16); - output.setf (std::ios::scientific, - std::ios::floatfield); - output.precision (8); - if (std::abs (node_list[ii][jj]) > tolerance) // invoke tolerance -> set points close to zero equal to zero - output << static_cast (node_list[ii][jj]) << "\t"; - else - output << 0.0 << "\t"; - } + // invoke tolerance -> set points close to zero equal to zero + if (std::abs (node_list[ii][jj]) > tolerance) + output << static_cast (node_list[ii][jj]) << "\t"; + else + output << 0.0 << "\t"; } if (dim == 2) output << 0.0 << "\t"; - output - << std::endl; + output << std::endl; output.unsetf (std::ios::floatfield); } // Write out cell node numbers for (unsigned int ii = 0; ii < cell_list.size(); ++ii) { - output - << ii + 1 << "\t" - << cell_list[ii][0] << "\t" - << (dim == 2 ? "quad" : "hex") << "\t"; + output << ii + 1 << "\t" + << cell_list[ii][0] << "\t" + << (dim == 2 ? "quad" : "hex") << "\t"; for (unsigned int jj = 1; jj < GeometryInfo::vertices_per_cell + 1; ++jj) - output - << cell_list[ii][jj] << "\t"; + output << cell_list[ii][jj] << "\t"; - output - << std::endl; + output << std::endl; } // Write out quad node numbers @@ -3619,11 +3617,9 @@ cont: << face_list[ii][0] << "\t" << (dim == 2 ? "line" : "quad") << "\t"; for (unsigned int jj = 1; jj < GeometryInfo::vertices_per_face + 1; ++jj) - output - << face_list[ii][jj] << "\t"; + output << face_list[ii][jj] << "\t"; - output - << std::endl; + output << std::endl; } } }