Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

593 tet swap operation #595

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ include(gmp)
include(mshio)
include(predicates)
include(jse)
include(polysolve)

# Core library
add_library(wildmeshing_toolkit)
Expand Down Expand Up @@ -117,7 +116,6 @@ target_link_libraries(wildmeshing_toolkit PUBLIC
mshio::mshio
predicates::predicates
nlohmann_json::nlohmann_json
polysolve::polysolve
)

add_subdirectory(components)
Expand Down
26 changes: 0 additions & 26 deletions cmake/recipes/polysolve.cmake

This file was deleted.

8 changes: 4 additions & 4 deletions components/wmtk_components/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ set(SRC_FILES
)
target_sources(wildmeshing_components PRIVATE ${SRC_FILES})

#TODOfix: restore components

add_subdirectory(adaptive_tessellation)
add_subdirectory(delaunay)
add_subdirectory(input)
# add_subdirectory(isotropic_remeshing)
add_subdirectory(isotropic_remeshing)
add_subdirectory(mesh_info)
add_subdirectory(output)
# add_subdirectory(regular_space)
# add_subdirectory(marching)
add_subdirectory(regular_space)
add_subdirectory(marching)
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@

m_mesh.serialize(writer1);

for (const auto v : child_meshes[0]->get_all(PrimitiveType::Vertex)) {
for (const auto& v : child_meshes[0]->get_all(PrimitiveType::Vertex)) {

Check warning on line 129 in components/wmtk_components/isotropic_remeshing/internal/IsotropicRemeshing.cpp

View check run for this annotation

Codecov / codecov/patch

components/wmtk_components/isotropic_remeshing/internal/IsotropicRemeshing.cpp#L129

Added line #L129 was not covered by tests
auto parent_v =
child_meshes[0]->map_to_root_tuple(Simplex(PrimitiveType::Vertex, v));
child_vertex_accessor.vector_attribute(v) =
Expand Down Expand Up @@ -167,7 +167,7 @@

m_mesh.serialize(writer2);

for (const auto v : child_meshes[0]->get_all(PrimitiveType::Vertex)) {
for (const auto& v : child_meshes[0]->get_all(PrimitiveType::Vertex)) {

Check warning on line 170 in components/wmtk_components/isotropic_remeshing/internal/IsotropicRemeshing.cpp

View check run for this annotation

Codecov / codecov/patch

components/wmtk_components/isotropic_remeshing/internal/IsotropicRemeshing.cpp#L170

Added line #L170 was not covered by tests
auto parent_v =
child_meshes[0]->map_to_root_tuple(Simplex(PrimitiveType::Vertex, v));
child_vertex_accessor.vector_attribute(v) =
Expand Down Expand Up @@ -213,7 +213,7 @@

m_mesh.serialize(writer3);

for (const auto v : child_meshes[0]->get_all(PrimitiveType::Vertex)) {
for (const auto& v : child_meshes[0]->get_all(PrimitiveType::Vertex)) {

Check warning on line 216 in components/wmtk_components/isotropic_remeshing/internal/IsotropicRemeshing.cpp

View check run for this annotation

Codecov / codecov/patch

components/wmtk_components/isotropic_remeshing/internal/IsotropicRemeshing.cpp#L216

Added line #L216 was not covered by tests
auto parent_v =
child_meshes[0]->map_to_root_tuple(Simplex(PrimitiveType::Vertex, v));
child_vertex_accessor.vector_attribute(v) =
Expand All @@ -233,12 +233,12 @@
}

if (m_do_smooth) {
//m_scheduler.run_operation_on_all(PrimitiveType::Vertex, "smooth");
//is_conn_valid = m_mesh.is_connectivity_valid();
//if (!is_conn_valid) throw std::runtime_error("invalid mesh connectivty");
// m_scheduler.run_operation_on_all(PrimitiveType::Vertex, "smooth");
// is_conn_valid = m_mesh.is_connectivity_valid();
// if (!is_conn_valid) throw std::runtime_error("invalid mesh connectivty");

//wmtk::logger().info("Is connectivity valid: {}", is_conn_valid);
//wmtk::logger().info("Done smooth {}\n", i);
// wmtk::logger().info("Is connectivity valid: {}", is_conn_valid);
// wmtk::logger().info("Done smooth {}\n", i);
}

// debug write
Expand All @@ -254,7 +254,7 @@

m_mesh.serialize(writer4);

for (const auto v : child_meshes[0]->get_all(PrimitiveType::Vertex)) {
for (const auto& v : child_meshes[0]->get_all(PrimitiveType::Vertex)) {

Check warning on line 257 in components/wmtk_components/isotropic_remeshing/internal/IsotropicRemeshing.cpp

View check run for this annotation

Codecov / codecov/patch

components/wmtk_components/isotropic_remeshing/internal/IsotropicRemeshing.cpp#L257

Added line #L257 was not covered by tests
auto parent_v =
child_meshes[0]->map_to_root_tuple(Simplex(PrimitiveType::Vertex, v));
child_vertex_accessor.vector_attribute(v) =
Expand Down
2 changes: 1 addition & 1 deletion src/wmtk/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ set(SRC_FILES
Cell.hpp
Mesh.cpp
Mesh.hpp
Mesh_hash.cpp
PointMesh.cpp
PointMesh.hpp
EdgeMesh.hpp
Expand Down Expand Up @@ -42,6 +41,7 @@ add_subdirectory(utils)
add_subdirectory(attribute)
add_subdirectory(simplex)
add_subdirectory(operations)
add_subdirectory(optimization)
add_subdirectory(autogen)

add_subdirectory(invariants)
Expand Down
4 changes: 2 additions & 2 deletions src/wmtk/EdgeMesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ EdgeMesh::EdgeMesh(EdgeMesh&& o) = default;
EdgeMesh& EdgeMesh::operator=(const EdgeMesh& o) = default;
EdgeMesh& EdgeMesh::operator=(EdgeMesh&& o) = default;

operations::data::EdgeMeshEdgeOperationData EdgeMesh::split_edge(
operations::edge_mesh::EdgeOperationData EdgeMesh::split_edge(
const Tuple& t,
Accessor<long>& hash_accessor)
{
Expand All @@ -26,7 +26,7 @@ operations::data::EdgeMeshEdgeOperationData EdgeMesh::split_edge(
return executor;
}

operations::data::EdgeMeshEdgeOperationData EdgeMesh::collapse_edge(
operations::edge_mesh::EdgeOperationData EdgeMesh::collapse_edge(
const Tuple& t,
Accessor<long>& hash_accessor)
{
Expand Down
9 changes: 4 additions & 5 deletions src/wmtk/EdgeMesh.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once

#include <Eigen/Core>
#include <wmtk/operations/data/EdgeMeshEdgeOperationData.hpp>
#include <wmtk/operations/edge_mesh/EdgeOperationData.hpp>
#include "Mesh.hpp"
#include "Tuple.hpp"

Expand All @@ -26,11 +26,11 @@ class EdgeMesh : public Mesh

long top_cell_dimension() const override { return 1; }

operations::data::EdgeMeshEdgeOperationData split_edge(
operations::edge_mesh::EdgeOperationData split_edge(
const Tuple& t,
Accessor<long>& hash_accessor);

operations::data::EdgeMeshEdgeOperationData collapse_edge(
operations::edge_mesh::EdgeOperationData collapse_edge(
const Tuple& t,
Accessor<long>& hash_accessor);

Expand All @@ -39,8 +39,7 @@ class EdgeMesh : public Mesh
bool is_ccw(const Tuple& tuple) const override;
using Mesh::is_boundary;
bool is_boundary(const Tuple& tuple, PrimitiveType) const override;
bool is_boundary_vertex(const Tuple& tuple) const override;

bool is_boundary_vertex(const Tuple& tuple) const;

void initialize(Eigen::Ref<const RowVectors2l> E);

Expand Down
4 changes: 2 additions & 2 deletions src/wmtk/EdgeMeshOperationExecutor.hpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#pragma once
#include <wmtk/operations/data/EdgeMeshEdgeOperationData.hpp>
#include <wmtk/operations/edge_mesh/EdgeOperationData.hpp>
#include <wmtk/utils/Logger.hpp>
#include "EdgeMesh.hpp"
#include "SimplicialComplex.hpp"
#include "Tuple.hpp"
namespace wmtk {
class EdgeMesh::EdgeMeshOperationExecutor : public operations::data::EdgeMeshEdgeOperationData
class EdgeMesh::EdgeMeshOperationExecutor : public operations::edge_mesh::EdgeOperationData
{
public:
EdgeMeshOperationExecutor(EdgeMesh& m, const Tuple& operating_tuple, Accessor<long>& hash_acc);
Expand Down
2 changes: 0 additions & 2 deletions src/wmtk/Mesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

#include <wmtk/SimplicialComplex.hpp>
#include <wmtk/utils/Logger.hpp>
#include <wmtk/utils/vector_hash.hpp>

#include "Primitive.hpp"

Expand Down Expand Up @@ -38,7 +37,6 @@ PrimitiveType Mesh::top_simplex_type() const
return static_cast<PrimitiveType>(dimension);
}


std::vector<Tuple> Mesh::get_all(PrimitiveType type) const
{
return get_all(type, false);
Expand Down
10 changes: 1 addition & 9 deletions src/wmtk/Mesh.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class TupleTag;

class SimplicialComplex;

class Mesh : public std::enable_shared_from_this<Mesh>, public wmtk::utils::MerkleTreeInteriorNode
class Mesh : public std::enable_shared_from_this<Mesh>
{
public:
template <typename T>
Expand Down Expand Up @@ -112,9 +112,6 @@ class Mesh : public std::enable_shared_from_this<Mesh>, public wmtk::utils::Merk
virtual long top_cell_dimension() const = 0;
PrimitiveType top_simplex_type() const;

// attribute directly hashes its "children" components so it overrides "child_hashes"
std::map<std::string, const wmtk::utils::Hashable*> child_hashables() const override;
std::map<std::string, std::size_t> child_hashes() const override;

// dimension is the dimension of the top level simplex in this mesh
// That is, a TriMesh is a 2, a TetMesh is a 3
Expand Down Expand Up @@ -382,11 +379,6 @@ class Mesh : public std::enable_shared_from_this<Mesh>, public wmtk::utils::Merk
* @return false otherwise
*/
virtual bool is_boundary(const Tuple& tuple, PrimitiveType pt) const = 0;
virtual bool is_boundary_vertex(const Tuple& tuple) const = 0;
virtual bool is_boundary_edge(const Tuple& tuple) const
{
throw std::runtime_error("is_boundary_edge dosent make sense for this mesh");
}


bool is_hash_valid(const Tuple& tuple, const ConstAccessor<long>& hash_accessor) const;
Expand Down
27 changes: 0 additions & 27 deletions src/wmtk/Mesh_hash.cpp

This file was deleted.

43 changes: 0 additions & 43 deletions src/wmtk/MultiMeshManager.cpp
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
#include "MultiMeshManager.hpp"
#include <fmt/format.h>
#include <wmtk/utils/vector_hash.hpp>
//#include <fmt/ranges.h>
#include <functional>
#include <wmtk/attribute/internal/hash.hpp>
#include <wmtk/simplex/top_dimension_cofaces.hpp>
#include <wmtk/simplex/utils/make_unique.hpp>
#include <wmtk/simplex/utils/tuple_vector_to_homogeneous_simplex_vector.hpp>
#include <wmtk/utils/TupleInspector.hpp>
#include <wmtk/utils/vector_hash.hpp>
#include "Mesh.hpp"
#include "SimplicialComplex.hpp"
#include "multimesh/utils/local_switch_tuple.hpp"
Expand Down Expand Up @@ -76,43 +70,6 @@ MultiMeshManager::MultiMeshManager(MultiMeshManager&& o) = default;
MultiMeshManager& MultiMeshManager::operator=(const MultiMeshManager& o) = default;
MultiMeshManager& MultiMeshManager::operator=(MultiMeshManager&& o) = default;

// attribute directly hashes its "children" components so it overrides "child_hashes"
std::map<std::string, const wmtk::utils::Hashable*> MultiMeshManager::child_hashables() const
{
std::map<std::string, const wmtk::utils::Hashable*> ret;
for (const auto& c : m_children) {
assert(bool(c.mesh));
auto id = c.mesh->absolute_multi_mesh_id();
std::string name = fmt::format("child_map_[{}]", fmt::join(id, ","));
ret[name] = c.mesh.get();
}
return ret;
}
std::map<std::string, std::size_t> MultiMeshManager::child_hashes() const
{
// default implementation pulls the child attributes (ie the attributes)
std::map<std::string, std::size_t> ret = wmtk::utils::MerkleTreeInteriorNode::child_hashes();
ret["child_id"] = m_child_id;

if (m_parent != nullptr) {
auto id = m_parent->absolute_multi_mesh_id();
ret["parent_map"] = wmtk::utils::vector_hash(id);
} else {
ret["parent_map"] = 0;
}


const std::hash<MeshAttributeHandle<long>> attr_hasher;
ret["parent_map_handle"] = attr_hasher(map_to_parent_handle);
for (const auto& c : m_children) {
assert(bool(c.mesh));
auto id = c.mesh->absolute_multi_mesh_id();
std::string name = fmt::format("child_map_[{}]", fmt::join(id, ","));
ret[name] = attr_hasher(c.map_handle);
}
return ret;
}

bool MultiMeshManager::is_root() const
{
return m_parent == nullptr;
Expand Down
7 changes: 1 addition & 6 deletions src/wmtk/MultiMeshManager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
// included to make a friend as this requires IDs
#include <wmtk/multimesh/same_simplex_dimension_surjection.hpp>
#include <wmtk/operations/utils/UpdateVertexMultiMeshMapHash.hpp>
#include <wmtk/utils/MerkleTreeInteriorNode.hpp>


namespace wmtk {
Expand All @@ -33,7 +32,7 @@ class SimplicialComplex;
/**
* @brief Implementation details for how the Mesh class implements multiple meshes
*/
class MultiMeshManager : public wmtk::utils::MerkleTreeInteriorNode
class MultiMeshManager
{
public:
// utility function for mapping the same set of simplices (or a subset of equivalent simplices)
Expand Down Expand Up @@ -65,10 +64,6 @@ class MultiMeshManager : public wmtk::utils::MerkleTreeInteriorNode
MultiMeshManager& operator=(const MultiMeshManager& o);
MultiMeshManager& operator=(MultiMeshManager&& o);

// attribute directly hashes its "children" components so it overrides "child_hashes"
std::map<std::string, const wmtk::utils::Hashable*> child_hashables() const override;
std::map<std::string, std::size_t> child_hashes() const override;

//=========================================================
// Storage of MultiMesh
//=========================================================
Expand Down
2 changes: 1 addition & 1 deletion src/wmtk/PointMesh.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class PointMesh : public Mesh
bool is_ccw(const Tuple& tuple) const override;
using Mesh::is_boundary;
bool is_boundary(const Tuple& tuple, PrimitiveType pt) const override;
bool is_boundary_vertex(const Tuple& tuple) const override;
bool is_boundary_vertex(const Tuple& tuple) const;

void initialize(long count);

Expand Down
Loading
Loading