Skip to content

Commit

Permalink
more verbose updates
Browse files Browse the repository at this point in the history
  • Loading branch information
mtao committed Dec 11, 2024
1 parent e03ee31 commit 507c163
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 5 deletions.
1 change: 1 addition & 0 deletions applications/isotropic_remeshing/examples/raw/small.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"input": {
"path": "unit_test/meshes/small3d.msh",
"validate": true,
"name_spec":
"main"
},
Expand Down
1 change: 1 addition & 0 deletions applications/isotropic_remeshing/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ int main(int argc, char* argv[])
if(j.contains("intermediate_output_format")) {
options.intermediate_output_format = j["intermediate_output_format"];
}
assert(options.position_attribute.is_valid());
wmtk::components::isotropic_remeshing::isotropic_remeshing(options);

// input uv mesh
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ IsotropicRemeshing::~IsotropicRemeshing() = default;
IsotropicRemeshing::IsotropicRemeshing(const IsotropicRemeshingOptions& opts)
: m_options(opts)
{
if(!m_options.position_attribute.is_valid()) {
throw std::runtime_error("Isotropic remeshing run without a valid position attribute");
}
if (m_options.envelope_size.has_value()) {
for (const auto& h : all_envelope_positions()) {
auto envelope_invariant = std::make_shared<invariants::EnvelopeInvariant>(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "configure_split.hpp"
#include <spdlog/spdlog.h>
#include <wmtk/Mesh.hpp>
#include <wmtk/invariants/InvariantCollection.hpp>
#include <wmtk/invariants/MinEdgeLengthInvariant.hpp>
Expand Down Expand Up @@ -32,11 +33,13 @@ void configure_split(operations::EdgeSplit& es, Mesh& m, const IsotropicRemeshin
auto invars = split_invariants(m, options);
es.add_invariant(invars);
for (auto& p : options.all_positions()) {
spdlog::info("Writng split attribute new for {}", p.name());
es.set_new_attribute_strategy(p, operations::SplitBasicStrategy::None, operations::SplitRibBasicStrategy::Mean);
}
for (const auto& attr : options.pass_through_attributes) {
es.set_new_attribute_strategy(attr);
}
assert(es.attribute_new_all_configured());
}

} // namespace wmtk::components::isotropic_remeshing::internal
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ namespace wmtk::components::isotropic_remeshing {

void isotropic_remeshing(const IsotropicRemeshingOptions& options)
{
assert(options.position_attribute.is_valid());
IsotropicRemeshing app(options);
app.run();
}
Expand Down
2 changes: 1 addition & 1 deletion src/wmtk/operations/EdgeSplit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ bool EdgeSplit::attribute_new_all_configured() const
for (const auto& strat : m_new_attr_strategies) {
if (strat->invalid_state()) {
all_configured = false;
wmtk::logger().warn("Attribute new {} was not configured", strat->name());
wmtk::logger().warn("Split attribute new {} was not configured", strat->name());
}
}
return all_configured;
Expand Down
12 changes: 8 additions & 4 deletions src/wmtk/utils/verify_simplex_index_valences.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ bool verify_simplex_index_valences(const Mesh& m, const internal::IndexSimplexMa
constexpr static int meshD = get_primitive_type_id(mesh_pt);
constexpr static int D = get_primitive_type_id(pt);


std::vector<std::set<int64_t>> cofaces(mapper.simplices<D>().size());
for (size_t j = 0; j < mapper.simplices<meshD>().size(); ++j) {
for (const auto& face_index : mapper.faces<meshD, D>(j)) {
Expand All @@ -47,9 +48,10 @@ bool verify_simplex_index_valences(const Mesh& m, const internal::IndexSimplexMa
}

if (mesh_pt == pt + 1) {
for (const auto& cof : cofaces) {
for(size_t j = 0; j < cofaces.size(); ++j) {
const auto& cof = cofaces[j];
if (cof.size() > 2) {
wmtk::logger().warn("More than 2 cofaces for a boundary simplex");
wmtk::logger().warn(fmt::format("More than 2 {}-cofaces (facet indices={}) for a boundary {}-simplex [{}]", D, fmt::join(cof,","), meshD, fmt::join(mapper.simplices<D>()[j],",")));
return false;
}
}
Expand All @@ -63,14 +65,16 @@ bool verify_simplex_index_valences(const Mesh& m, const internal::IndexSimplexMa

std::array<int64_t, D + 1> i = indices<D>(m, mapper, s);
const auto& cof2 = cofaces[mapper.get_index<D>(i)];
wmtk::logger().debug("Looking at {}-simplex {} on a {}", D, fmt::join(i, ","), meshD);
wmtk::logger().debug("Looking at {}-simplex {} on a {}-mesh", D, fmt::join(i, ","), meshD);


if (cof.size() != cof2.size()) {
wmtk::logger().warn(
"Cofaces size mismatch on simplex {}, mesh got (len{}), indices got [{}] "
"Cofaces size mismatch on {}-simplex {}, {}-mesh got (len{}), indices got [{}] "
"(len{})",
D,
fmt::join(i, ","),
meshD,
cof.size(),
fmt::join(cof2, ","),
cof2.size());
Expand Down

0 comments on commit 507c163

Please sign in to comment.