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...");
70 INFO(
"Found {:d} potentially collapsible nodes.",
77 const std::vector<ElementErrorCode> codes(
79 std::array<std::string,
82 for (
auto& i : output_str)
91 INFO(
"Testing mesh element geometry:");
92 const auto nErrorCodes(
94 unsigned error_count[nErrorCodes];
95 std::fill_n(error_count, 4, 0);
97 const std::vector<MeshLib::Element*>& elements(mesh.
getElements());
98 std::vector<ElementErrorCode> error_code_vector;
99 error_code_vector.reserve(nElements);
101 for (std::size_t i = 0; i < nElements; ++i)
104 error_code_vector.push_back(e);
112 flags(
static_cast<std::bitset<static_cast<std::size_t>(
114 for (
unsigned j = 0; j < nErrorCodes; ++j)
116 error_count[j] += flags[j];
122 if (min_volume > std::numeric_limits<double>::epsilon())
124 for (std::size_t i = 0; i < nElements; ++i)
126 if (elements[i]->getContent() < min_volume)
134 const auto error_sum(
static_cast<unsigned>(
135 std::accumulate(error_count, error_count + nErrorCodes, 0.0)));
141 for (std::size_t i = 0; i < nErrorCodes; ++i)
145 INFO(
"{:d} elements found with {:s}.",
153 INFO(
"No errors found.");
155 return error_code_vector;
160 const std::vector<ElementErrorCode>& error_codes)
162 const auto nErrorFlags(
167 const std::size_t nElements(error_codes.size());
168 std::array<std::string,
172 for (std::size_t i = 0; i < nErrorFlags; ++i)
175 std::string elementIdStr;
177 for (std::size_t j = 0; j < nElements; ++j)
179 if (error_codes[j][flags[i]])
181 elementIdStr += (std::to_string(j) +
", ");
185 const std::string nErrorsStr = (count) ? std::to_string(count) :
"No";
186 output[i] = (nErrorsStr +
" elements found with " +
191 output[i] += (
"ElementIDs: " + elementIdStr +
"\n");
210 std::vector<MeshLib::Element*>
const& elements(
211 boundary_mesh->getElements());
213 std::vector<unsigned> sfc_idx(elements.size(),
214 std::numeric_limits<unsigned>::max());
215 unsigned current_surface_id(0);
216 auto it = sfc_idx.cbegin();
218 while (it != sfc_idx.cend())
220 std::size_t
const idx =
221 static_cast<std::size_t
>(std::distance(sfc_idx.cbegin(), it));
222 trackSurface(elements[idx], sfc_idx, current_surface_id++);
223 it = std::find(sfc_idx.cbegin(),
225 std::numeric_limits<unsigned>::max());
230 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
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)