30 std::vector<unsigned>& sfc_idx,
31 unsigned const current_index)
33 std::stack<MeshLib::Element const*> elem_stack;
34 elem_stack.push(element);
35 while (!elem_stack.empty())
39 sfc_idx[elem->
getID()] = current_index;
41 for (std::size_t i = 0; i < n_neighbors; ++i)
44 if (neighbor !=
nullptr && sfc_idx[neighbor->
getID()] ==
45 std::numeric_limits<unsigned>::max())
47 elem_stack.push(neighbor);
55 INFO(
"Looking for unused nodes...");
69 INFO(
"Found {:d} potentially collapsible nodes.",
76 const std::vector<ElementErrorCode> codes(
78 std::array<std::string,
81 for (
auto& i : output_str)
90 INFO(
"Testing mesh element geometry:");
91 const auto nErrorCodes(
93 unsigned error_count[nErrorCodes];
94 std::fill_n(error_count, 4, 0);
96 const std::vector<MeshLib::Element*>& elements(mesh.
getElements());
97 std::vector<ElementErrorCode> error_code_vector;
98 error_code_vector.reserve(nElements);
100 for (std::size_t i = 0; i < nElements; ++i)
103 error_code_vector.push_back(e);
111 flags(
static_cast<std::bitset<static_cast<std::size_t>(
113 for (
unsigned j = 0; j < nErrorCodes; ++j)
115 error_count[j] += flags[j];
121 if (min_volume > std::numeric_limits<double>::epsilon())
123 for (std::size_t i = 0; i < nElements; ++i)
125 if (elements[i]->getContent() < min_volume)
133 const auto error_sum(
static_cast<unsigned>(
134 std::accumulate(error_count, error_count + nErrorCodes, 0.0)));
140 for (std::size_t i = 0; i < nErrorCodes; ++i)
144 INFO(
"{:d} elements found with {:s}.",
152 INFO(
"No errors found.");
154 return error_code_vector;
159 const std::vector<ElementErrorCode>& error_codes)
161 const auto nErrorFlags(
166 const std::size_t nElements(error_codes.size());
167 std::array<std::string,
171 for (std::size_t i = 0; i < nErrorFlags; ++i)
174 std::string elementIdStr;
176 for (std::size_t j = 0; j < nElements; ++j)
178 if (error_codes[j][flags[i]])
180 elementIdStr += (std::to_string(j) +
", ");
184 const std::string nErrorsStr = (count) ? std::to_string(count) :
"No";
185 output[i] = (nErrorsStr +
" elements found with " +
190 output[i] += (
"ElementIDs: " + elementIdStr +
"\n");
209 std::vector<MeshLib::Element*>
const& elements(
210 boundary_mesh->getElements());
212 std::vector<unsigned> sfc_idx(elements.size(),
213 std::numeric_limits<unsigned>::max());
214 unsigned current_surface_id(0);
215 auto it = sfc_idx.cbegin();
217 while (it != sfc_idx.cend())
219 std::size_t
const idx =
220 static_cast<std::size_t
>(std::distance(sfc_idx.cbegin(), it));
221 trackSurface(elements[idx], sfc_idx, current_surface_id++);
222 it = std::find(sfc_idx.cbegin(),
224 std::numeric_limits<unsigned>::max());
229 return (--current_surface_id);
ElementErrorFlag
Possible error flags for mesh elements.
void INFO(fmt::format_string< Args... > fmt, Args &&... args)
Collects error flags for mesh elements.
static std::string toString(const ElementErrorFlag e)
Returns a string output for a specific error flag.
virtual unsigned getNumberOfNeighbors() const =0
Get the number of neighbors for this element.
std::size_t getID() const
Returns the ID of the element.
virtual const Element * getNeighbor(unsigned i) const =0
Get the specified neighbor.
std::vector< Element * > const & getElements() const
Get the element-vector for the mesh.
unsigned getDimension() const
Returns the dimension of the mesh (determined by the maximum dimension over all elements).
std::size_t getNumberOfElements() const
Get the number of elements.
const std::vector< std::size_t > & getSearchedNodeIDs() const
return marked node IDs
std::size_t searchUnused()
Marks all unused nodes.
constexpr std::string_view getBulkIDString(MeshItemType mesh_item_type)