|
15 | 15 | #include "4C_global_legacy_module.hpp" |
16 | 16 | #include "4C_io_input_file.hpp" |
17 | 17 | #include "4C_linalg_utils_densematrix_multiply.hpp" |
| 18 | +#include "4C_utils_enum.hpp" |
18 | 19 |
|
19 | 20 | FOUR_C_NAMESPACE_OPEN |
20 | 21 |
|
@@ -81,14 +82,15 @@ void EXODUS::validate_mesh_element_jacobians(Core::IO::Exodus::Mesh& mymesh) |
81 | 82 |
|
82 | 83 | for (const auto& [eb_id, eb] : mymesh.get_element_blocks()) |
83 | 84 | { |
84 | | - const Core::FE::CellType distype = shape_to_cell_type(eb.get_shape()); |
| 85 | + const Core::FE::CellType distype = eb.get_shape(); |
85 | 86 | // check and rewind if necessary |
86 | 87 | validate_element_jacobian(mymesh, distype, eb); |
87 | 88 | // full check at all gausspoints |
88 | 89 | int invalid_dets = validate_element_jacobian_fullgp(mymesh, distype, eb); |
| 90 | + using EnumTools::operator<<; |
89 | 91 | if (invalid_dets > 0) |
90 | 92 | std::cout << invalid_dets << " negative Jacobian determinants in EB of shape " |
91 | | - << shape_to_string(eb.get_shape()) << std::endl; |
| 93 | + << eb.get_shape() << std::endl; |
92 | 94 | } |
93 | 95 | return; |
94 | 96 | } |
@@ -144,29 +146,17 @@ void EXODUS::validate_element_jacobian(Core::IO::Exodus::Mesh& mymesh, |
144 | 146 | Core::LinAlg::SerialDenseMatrix deriv(NSD, iel); |
145 | 147 |
|
146 | 148 | // go through all elements |
147 | | - std::shared_ptr<std::map<int, std::vector<int>>> eleconn = eb.get_ele_conn(); |
148 | | - std::map<int, std::vector<int>>::iterator i_ele; |
| 149 | + const std::map<int, std::vector<int>>& eleconn = eb.get_ele_conn(); |
149 | 150 | int numrewindedeles = 0; |
150 | | - for (i_ele = eleconn->begin(); i_ele != eleconn->end(); ++i_ele) |
| 151 | + for (auto i_ele = eleconn.begin(); i_ele != eleconn.end(); ++i_ele) |
151 | 152 | { |
152 | | - int rewcount = 0; |
153 | 153 | for (int igp = 0; igp < intpoints.nquad; ++igp) |
154 | 154 | { |
155 | 155 | Core::FE::shape_function_3d_deriv1( |
156 | 156 | deriv, intpoints.qxg[igp][0], intpoints.qxg[igp][1], intpoints.qxg[igp][2], distype); |
157 | 157 | if (!positive_ele(i_ele->first, i_ele->second, mymesh, deriv)) |
158 | 158 | { |
159 | | - // rewind the element nodes |
160 | | - if (rewcount == 0) |
161 | | - { |
162 | | - i_ele->second = rewind_ele(i_ele->second, distype); |
163 | | - numrewindedeles++; |
164 | | - } |
165 | | - // double check |
166 | | - if (!positive_ele(i_ele->first, i_ele->second, mymesh, deriv)) |
167 | | - FOUR_C_THROW( |
168 | | - "No proper rewinding for element id {} at gauss point {}", i_ele->first, igp); |
169 | | - rewcount++; |
| 159 | + FOUR_C_THROW("Negative Jacobian for element id {} at gauss point {}", i_ele->first, igp); |
170 | 160 | } |
171 | 161 | } |
172 | 162 | } |
@@ -231,9 +221,9 @@ int EXODUS::validate_element_jacobian_fullgp(Core::IO::Exodus::Mesh& mymesh, |
231 | 221 |
|
232 | 222 | // go through all elements |
233 | 223 | int invalids = 0; |
234 | | - std::shared_ptr<std::map<int, std::vector<int>>> eleconn = eb.get_ele_conn(); |
| 224 | + const std::map<int, std::vector<int>>& eleconn = eb.get_ele_conn(); |
235 | 225 | std::map<int, std::vector<int>>::iterator i_ele; |
236 | | - for (i_ele = eleconn->begin(); i_ele != eleconn->end(); ++i_ele) |
| 226 | + for (auto i_ele = eleconn.begin(); i_ele != eleconn.end(); ++i_ele) |
237 | 227 | { |
238 | 228 | for (int igp = 0; igp < intpoints.nquad; ++igp) |
239 | 229 | { |
|
0 commit comments