41 std::vector<unsigned>& sfc_idx,
42 unsigned const current_index)
44 std::stack<MeshLib::Element const*> elem_stack;
45 elem_stack.push(element);
46 while (!elem_stack.empty())
50 sfc_idx[elem->
getID()] = current_index;
52 for (std::size_t i = 0; i < n_neighbors; ++i)
55 if (neighbor !=
nullptr && sfc_idx[neighbor->
getID()] ==
56 std::numeric_limits<unsigned>::max())
58 elem_stack.push(neighbor);
66 INFO(
"Looking for unused nodes...");
80 INFO(
"Found {:d} potentially collapsible nodes.",
87 const std::vector<ElementErrorCode> codes(
89 std::array<std::string,
92 for (
auto& i : output_str)
101 INFO(
"Testing mesh element geometry:");
102 const auto nErrorCodes(
104 unsigned error_count[nErrorCodes];
105 std::fill_n(error_count, 4, 0);
107 const std::vector<MeshLib::Element*>& elements(mesh.
getElements());
108 std::vector<ElementErrorCode> error_code_vector;
109 error_code_vector.reserve(nElements);
111 for (std::size_t i = 0; i < nElements; ++i)
114 error_code_vector.push_back(e);
122 flags(
static_cast<std::bitset<static_cast<std::size_t>(
124 for (
unsigned j = 0; j < nErrorCodes; ++j)
126 error_count[j] += flags[j];
132 if (min_volume > std::numeric_limits<double>::epsilon())
134 for (std::size_t i = 0; i < nElements; ++i)
136 if (elements[i]->getContent() < min_volume)
144 const auto error_sum(
static_cast<unsigned>(
145 std::accumulate(error_count, error_count + nErrorCodes, 0.0)));
151 for (std::size_t i = 0; i < nErrorCodes; ++i)
155 INFO(
"{:d} elements found with {:s}.",
163 INFO(
"No errors found.");
165 return error_code_vector;
170 const std::vector<ElementErrorCode>& error_codes)
172 const auto nErrorFlags(
177 const std::size_t nElements(error_codes.size());
178 std::array<std::string,
182 for (std::size_t i = 0; i < nErrorFlags; ++i)
185 std::string elementIdStr;
187 for (std::size_t j = 0; j < nElements; ++j)
189 if (error_codes[j][flags[i]])
191 elementIdStr += (std::to_string(j) +
", ");
195 const std::string nErrorsStr = (count) ? std::to_string(count) :
"No";
196 output[i] = (nErrorsStr +
" elements found with " +
201 output[i] += (
"ElementIDs: " + elementIdStr +
"\n");
220 std::vector<MeshLib::Element*>
const& elements(
221 boundary_mesh->getElements());
223 std::vector<unsigned> sfc_idx(elements.size(),
224 std::numeric_limits<unsigned>::max());
225 unsigned current_surface_id(0);
226 auto it = sfc_idx.cbegin();
228 while (it != sfc_idx.cend())
230 std::size_t
const idx =
231 static_cast<std::size_t
>(std::distance(sfc_idx.cbegin(), it));
232 trackSurface(elements[idx], sfc_idx, current_surface_id++);
233 it = std::find(sfc_idx.cbegin(),
235 std::numeric_limits<unsigned>::max());
240 return (--current_surface_id);
ElementErrorFlag
Possible error flags for mesh elements.
Definition of the Element class.
void INFO(fmt::format_string< Args... > fmt, Args &&... args)
Definition of the MeshRevision class.
Definition of the MeshValidation class.
Definition of the Mesh class.
Definition of the Node class.
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)