Skip to content

Commit d81f349

Browse files
authored
Merge pull request #853 from wildmeshing/dzint/public_id
Make ids public.
2 parents 958ba69 + 9d9d843 commit d81f349

File tree

96 files changed

+436
-788
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+436
-788
lines changed

.github/workflows/coverage.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,15 +67,15 @@ jobs:
6767
cd build
6868
ctest --verbose --output-on-failure
6969
lcov --directory . --capture --output-file coverage.info
70-
lcov --remove coverage.info '/usr/*' "${HOME}"'/.cache/*' '*tests/*.cpp' '*tests/*.hpp' --output-file coverage.info
70+
lcov --remove coverage.info '/usr/*' '*tests/*.cpp' '*tests/*.hpp' --output-file coverage.info
7171
7272
- name: Upload Coverage
7373
uses: codecov/codecov-action@v4
7474
env:
7575
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
7676
with:
77-
flags: wildmeshing # optional
78-
files: coverage.info
79-
name: wildmeshing # optional
80-
fail_ci_if_error: false # optional (default = false)
81-
verbose: true # optional (default = false)
77+
flags: wildmeshing # optional
78+
files: coverage.info
79+
name: wildmeshing # optional
80+
fail_ci_if_error: false # optional (default = false)
81+
verbose: true # optional (default = false)

applications/procedural/main.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
#include <wmtk/utils/Logger.hpp>
1111

1212
#include <wmtk/components/input/input.hpp>
13-
#include <wmtk/components/output/output.hpp>
1413
#include <wmtk/components/output/OutputOptions.hpp>
14+
#include <wmtk/components/output/output.hpp>
1515
#include <wmtk/components/utils/resolve_path.hpp>
1616

1717
#include <wmtk/TriMesh.hpp>
@@ -74,9 +74,6 @@ int main(int argc, char* argv[])
7474
},
7575
options.settings);
7676

77-
78-
using namespace internal;
79-
8077
if (!bool(mesh)) {
8178
throw std::runtime_error("Did not obtain a mesh when generating a procedural one");
8279
}

components/isotropic_remeshing/wmtk/components/isotropic_remeshing/isotropic_remeshing.cpp

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
#include <wmtk/Scheduler.hpp>
55
#include <wmtk/TriMesh.hpp>
66
#include <wmtk/invariants/FusionEdgeInvariant.hpp>
7+
#include <wmtk/invariants/InteriorSimplexInvariant.hpp>
78
#include <wmtk/invariants/InvariantCollection.hpp>
8-
#include <wmtk/invariants/MultiMeshMapValidInvariant.hpp>
9-
#include <wmtk/invariants/MultiMeshLinkConditionInvariant.hpp>
10-
#include <wmtk/invariants/MinEdgeLengthInvariant.hpp>
119
#include <wmtk/invariants/MaxEdgeLengthInvariant.hpp>
12-
#include <wmtk/invariants/ValenceImprovementInvariant.hpp>
13-
#include <wmtk/invariants/InteriorSimplexInvariant.hpp>
10+
#include <wmtk/invariants/MinEdgeLengthInvariant.hpp>
11+
#include <wmtk/invariants/MultiMeshLinkConditionInvariant.hpp>
12+
#include <wmtk/invariants/MultiMeshMapValidInvariant.hpp>
1413
#include <wmtk/invariants/SimplexInversionInvariant.hpp>
14+
#include <wmtk/invariants/ValenceImprovementInvariant.hpp>
1515
#include <wmtk/invariants/uvEdgeInvariant.hpp>
1616
#include <wmtk/io/ParaviewWriter.hpp>
1717
#include <wmtk/multimesh/MultiMeshVisitor.hpp>
@@ -55,9 +55,6 @@ double relative_to_absolute_length(
5555

5656
void isotropic_remeshing(const IsotropicRemeshingOptions& options)
5757
{
58-
using namespace internal;
59-
60-
6158
auto position = options.position_attribute;
6259

6360
if (position.mesh().top_simplex_type() != PrimitiveType::Triangle) {
@@ -175,7 +172,6 @@ void isotropic_remeshing(const IsotropicRemeshingOptions& options)
175172
ops.push_back(op_split);
176173

177174

178-
179175
//////////////////////////////////////////
180176
// collapse
181177
wmtk::logger().debug("Configure isotropic remeshing collapse");

components/tests/test_component_isotropic_remeshing.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
#include <nlohmann/json.hpp>
33
#include <tools/DEBUG_EdgeMesh.hpp>
44
#include <tools/DEBUG_TriMesh.hpp>
5-
#include <tools/DEBUG_Tuple.hpp>
65
#include <tools/EdgeMesh_examples.hpp>
76
#include <tools/TriMesh_examples.hpp>
87
#include <wmtk/Scheduler.hpp>

components/tetwild_simplification/wmtk/components/tetwild_simplification/tetwild_simplification.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -916,8 +916,6 @@ std::tuple<std::shared_ptr<TriMesh>, nlohmann::json> tetwild_simplification(
916916
double duplicate_tol,
917917
bool use_sampling)
918918
{
919-
using namespace internal;
920-
921919
wmtk::utils::EigenMatrixWriter writer;
922920
mesh.serialize(writer);
923921

src/wmtk/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ set(SRC_FILES
2828
Primitive.cpp
2929
Tuple.hxx
3030
Tuple.hpp
31+
Tuple.cpp
3132
Types.hpp
3233
Scheduler.hpp
3334
Scheduler.cpp

src/wmtk/EdgeMesh.cpp

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ bool EdgeMesh::is_boundary_vertex(const Tuple& tuple) const
3232
{
3333
assert(is_valid(tuple));
3434
const attribute::Accessor<int64_t> ee_accessor = create_const_accessor<int64_t>(m_ee_handle);
35-
return ee_accessor.const_vector_attribute<2>(tuple)(tuple.m_local_vid) < 0;
35+
return ee_accessor.const_vector_attribute<2>(tuple)(tuple.local_vid()) < 0;
3636
}
3737

3838
Tuple EdgeMesh::switch_tuple(const Tuple& tuple, PrimitiveType type) const
@@ -43,22 +43,22 @@ Tuple EdgeMesh::switch_tuple(const Tuple& tuple, PrimitiveType type) const
4343
switch (type) {
4444
case PrimitiveType::Vertex:
4545
return Tuple(
46-
1 - tuple.m_local_vid,
47-
tuple.m_local_eid,
48-
tuple.m_local_fid,
49-
tuple.m_global_cid);
46+
1 - tuple.local_vid(),
47+
tuple.local_eid(),
48+
tuple.local_fid(),
49+
tuple.global_cid());
5050
case PrimitiveType::Edge: {
5151
const int64_t gvid = id(tuple, PrimitiveType::Vertex);
5252

5353
const attribute::Accessor<int64_t> ee_accessor =
5454
create_const_accessor<int64_t>(m_ee_handle);
5555
auto ee = ee_accessor.const_vector_attribute<2>(tuple);
5656

57-
int64_t gcid_new = ee(tuple.m_local_vid);
57+
int64_t gcid_new = ee(tuple.local_vid());
5858

5959
// This is for special case self-loop, just to make sure the local vid of the returned
6060
// tuple is the same as the input. (When doing double-switch this is needed)
61-
if (gcid_new == tuple.m_global_cid) {
61+
if (gcid_new == tuple.global_cid()) {
6262
return tuple;
6363
}
6464

@@ -77,7 +77,7 @@ Tuple EdgeMesh::switch_tuple(const Tuple& tuple, PrimitiveType type) const
7777
assert(lvid_new != -1);
7878

7979

80-
const Tuple res(lvid_new, tuple.m_local_eid, tuple.m_local_fid, gcid_new);
80+
const Tuple res(lvid_new, tuple.local_eid(), tuple.local_fid(), gcid_new);
8181
assert(is_valid(res));
8282
return res;
8383
}
@@ -92,7 +92,7 @@ Tuple EdgeMesh::switch_tuple(const Tuple& tuple, PrimitiveType type) const
9292
bool EdgeMesh::is_ccw(const Tuple& tuple) const
9393
{
9494
assert(is_valid(tuple));
95-
return tuple.m_local_vid == 0;
95+
return tuple.local_vid() == 0;
9696
}
9797

9898
void EdgeMesh::initialize(
@@ -217,16 +217,16 @@ bool EdgeMesh::is_valid(const Tuple& tuple) const
217217
return false;
218218
}
219219

220-
const bool is_connectivity_valid = tuple.m_local_vid >= 0 && tuple.m_global_cid >= 0;
220+
const bool is_connectivity_valid = tuple.local_vid() >= 0 && tuple.global_cid() >= 0;
221221
if (!is_connectivity_valid) {
222222
#if !defined(NDEBUG)
223223
logger().debug(
224-
"tuple.m_local_vid={} >= 0"
225-
" tuple.m_global_cid={} >= 0",
226-
tuple.m_local_vid,
227-
tuple.m_global_cid);
228-
assert(tuple.m_local_vid >= 0);
229-
assert(tuple.m_global_cid >= 0);
224+
"tuple.local_vid()={} >= 0"
225+
" tuple.global_cid()={} >= 0",
226+
tuple.local_vid(),
227+
tuple.global_cid());
228+
assert(tuple.local_vid() >= 0);
229+
assert(tuple.global_cid() >= 0);
230230
#endif
231231
return false;
232232
}
@@ -292,7 +292,7 @@ std::vector<std::vector<TypedAttributeHandle<int64_t>>> EdgeMesh::connectivity_a
292292

293293
std::vector<Tuple> EdgeMesh::orient_vertices(const Tuple& tuple) const
294294
{
295-
int64_t cid = tuple.m_global_cid;
295+
int64_t cid = tuple.global_cid();
296296
return {Tuple(0, -1, -1, cid), Tuple(1, -1, -1, cid)};
297297
}
298298

src/wmtk/EdgeMesh.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,18 +51,18 @@ class EdgeMesh : public MeshCRTP<EdgeMesh>
5151
std::vector<std::vector<TypedAttributeHandle<int64_t>>> connectivity_attributes()
5252
const override;
5353

54+
5455
Tuple switch_vertex(const Tuple& tuple) const;
5556
Tuple switch_edge(const Tuple& tuple) const;
5657

5758
std::vector<Tuple> orient_vertices(const Tuple& tuple) const override;
58-
59-
protected:
6059
int64_t id(const Tuple& tuple, PrimitiveType type) const;
6160
using MeshCRTP<EdgeMesh>::id; // getting the (simplex) prototype
6261

6362
int64_t id_vertex(const Tuple& tuple) const { return id(tuple, PrimitiveType::Vertex); }
6463
int64_t id_edge(const Tuple& tuple) const { return id(tuple, PrimitiveType::Edge); }
6564

65+
protected:
6666
/**
6767
* @brief internal function that returns the tuple of requested type, and has the global index
6868
* cid
@@ -102,10 +102,10 @@ inline int64_t EdgeMesh::id(const Tuple& tuple, PrimitiveType type) const
102102
const attribute::Accessor<int64_t, EdgeMesh> ev_accessor =
103103
create_const_accessor<int64_t>(m_ev_handle);
104104
auto ev = ev_accessor.const_vector_attribute<2>(tuple);
105-
return ev(tuple.m_local_vid);
105+
return ev(tuple.local_vid());
106106
}
107107
case PrimitiveType::Edge: {
108-
return tuple.m_global_cid;
108+
return tuple.global_cid();
109109
}
110110
case PrimitiveType::Triangle:
111111
case PrimitiveType::Tetrahedron:

src/wmtk/Mesh.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ bool Mesh::is_valid(const Tuple& tuple) const
117117

118118
bool Mesh::is_removed(const Tuple& tuple) const
119119
{
120-
return is_removed(tuple.m_global_cid);
120+
return is_removed(tuple.global_cid());
121121
}
122122
bool Mesh::is_removed(const Tuple& t, PrimitiveType pt) const
123123
{

src/wmtk/Mesh.hpp

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@
2222
#include "Types.hpp"
2323
#include "attribute/AttributeManager.hpp"
2424
#include "attribute/AttributeScopeHandle.hpp"
25+
#include "attribute/FlagAccessor.hpp"
2526
#include "attribute/MeshAttributeHandle.hpp"
2627
#include "attribute/MeshAttributes.hpp"
27-
#include "attribute/FlagAccessor.hpp"
2828
#include "multimesh/attribute/AttributeScopeHandle.hpp"
2929

3030
#include "multimesh/attribute/UseParentScopeRAII.hpp"
@@ -43,11 +43,6 @@
4343
namespace wmtk {
4444
namespace tests {
4545
class DEBUG_Mesh;
46-
namespace tools {
47-
48-
class TestTools;
49-
50-
}
5146
} // namespace tests
5247
// thread management tool that we will PImpl
5348
namespace attribute {
@@ -69,13 +64,6 @@ class UpdateEdgeOperationMultiMeshMapFunctor;
6964
}
7065
} // namespace operations
7166

72-
namespace simplex {
73-
class RawSimplex;
74-
namespace utils {
75-
class SimplexComparisons;
76-
}
77-
} // namespace simplex
78-
7967
namespace io {
8068
class ParaviewWriter;
8169
}
@@ -90,7 +78,7 @@ template <typename Visitor>
9078
class MultiMeshVisitorExecutor;
9179

9280
namespace utils {
93-
class MapValidator;
81+
class MapValidator;
9482
namespace internal {
9583
class TupleTag;
9684
}
@@ -106,7 +94,6 @@ class TupleTag;
10694
class Mesh : public std::enable_shared_from_this<Mesh>, public wmtk::utils::MerkleTreeInteriorNode
10795
{
10896
public:
109-
friend class tests::tools::TestTools;
11097
friend class tests::DEBUG_Mesh;
11198
template <typename T, int Dim>
11299
friend class attribute::AccessorBase;
@@ -129,11 +116,6 @@ class Mesh : public std::enable_shared_from_this<Mesh>, public wmtk::utils::Merk
129116
friend class multimesh::attribute::AttributeScopeHandle;
130117
friend class multimesh::utils::internal::TupleTag;
131118
friend class operations::utils::UpdateEdgeOperationMultiMeshMapFunctor;
132-
friend class simplex::RawSimplex;
133-
friend class simplex::Simplex;
134-
friend class simplex::IdSimplex;
135-
friend class simplex::SimplexCollection;
136-
friend class simplex::utils::SimplexComparisons;
137119
friend class operations::Operation;
138120
friend class operations::EdgeCollapse;
139121
friend class operations::EdgeSplit;
@@ -795,7 +777,7 @@ class Mesh : public std::enable_shared_from_this<Mesh>, public wmtk::utils::Merk
795777
// creates a scope as int64_t as the AttributeScopeHandle exists
796778
[[nodiscard]] attribute::AttributeScopeHandle create_single_mesh_scope();
797779

798-
protected:
780+
public:
799781
/**
800782
* @brief return the global id of the Tuple of the given dimension
801783
*
@@ -812,8 +794,11 @@ class Mesh : public std::enable_shared_from_this<Mesh>, public wmtk::utils::Merk
812794

813795
int64_t id(const simplex::NavigatableSimplex& s) const { return s.index(); }
814796
int64_t id(const simplex::IdSimplex& s) const { return s.index(); }
797+
815798
/// Forwarding version of id on simplices that does id caching
816799
virtual int64_t id(const simplex::Simplex& s) const = 0;
800+
801+
protected:
817802
/// Internal utility to allow id to be virtual with a non-virtual overload in derived -Mesh classes.
818803
/// Mesh::id invokes Mesh::id_virtual which is final overriden by MeshCRTP<TriMesh>::id_virtual, which in turn invokes MeshCRTP<TriMesh>::id, and then TriMesh::id.
819804
/// This circuitous mechanism makes MeshCRTP<TriMesh>::id and TriMesh::id fully inlineable, so code that wants to take in any derived class can get optimized results with MeshCRTP, or for cases where classes want to utilize just TriMesh they can get inline/accelerated usage as well.

0 commit comments

Comments
 (0)