Skip to content

Commit

Permalink
fix warnings and errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Ahdhn committed Dec 13, 2024
1 parent 44cec69 commit 434f010
Show file tree
Hide file tree
Showing 10 changed files with 84 additions and 64 deletions.
36 changes: 21 additions & 15 deletions apps/Delaunay/delaunay_rxmesh.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -88,18 +88,22 @@ __global__ static void __launch_bounds__(blockThreads)

// first check if the edge formed by v0-v1 is a delaunay edge
// where v2 and v3 are the opposite vertices to the edge
// 0
// / | \
// 3 | 2
// \ | /
// 1
/*
0
/ | \
3 | 2
\ | /
1
*/
// if not delaunay, then we check if flipping it won't create a
// foldover The case below would create a fold over
// 0
// / | \
// / 1 \
// / / \ \
// 2 3
/*
0
/ | \
/ 1 \
/ / \ \
2 3
*/


T lambda = angle_between_three_vertices(V0, V2, V1);
Expand Down Expand Up @@ -203,11 +207,13 @@ inline uint32_t count_non_delaunay_edges(TriMesh& mesh)
for (TriMesh::VertexIter v0_it = mesh.vertices_begin();
v0_it != mesh.vertices_end();
++v0_it) {
// 0
// / | \
// 3 | 2
// \ | /
// 1
/*
0
/ | \
3 | 2
\ | /
1
*/
TriMesh::VertexHandle v0 = *v0_it;

if (mesh.is_boundary(v0)) {
Expand Down
15 changes: 8 additions & 7 deletions apps/Remesh/collapse.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,13 @@ __global__ static void __launch_bounds__(blockThreads)

// iter[0] and iter[2] are the edge two vertices
// iter[1] and iter[3] are the two opposite vertices
// 0
// / | \
// 3 | 1
// \ | /
// 2

/*
0
/ | \
3 | 1
\ | /
2
*/

if (edge_status(eh) == UNSEEN /*&& edge_link(eh) == 2*/) {
const VertexIterator iter =
Expand Down Expand Up @@ -507,7 +508,7 @@ inline void collapse_short_edges(rxmesh::RXMeshDynamic& rx,
{
using namespace rxmesh;

constexpr uint32_t blockThreads = 512;
constexpr uint32_t blockThreads = 256;

edge_status->reset(UNSEEN, DEVICE);

Expand Down
2 changes: 1 addition & 1 deletion apps/Remesh/flip.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ inline void equalize_valences(rxmesh::RXMeshDynamic& rx,

using namespace rxmesh;

constexpr uint32_t blockThreads = 512;
constexpr uint32_t blockThreads = 256;

edge_status->reset(UNSEEN, DEVICE);

Expand Down
14 changes: 8 additions & 6 deletions apps/Remesh/split.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,13 @@ __global__ static void edge_split(rxmesh::Context context,
auto should_split = [&](const EdgeHandle& eh, const VertexIterator& iter) {
// iter[0] and iter[2] are the edge two vertices
// iter[1] and iter[3] are the two opposite vertices
// 0
// / | \
// 3 | 1
// \ | /
// 2
/*
0
/ | \
3 | 1
\ | /
2
*/
assert(iter.size() == 4);

if (edge_status(eh) == UNSEEN) {
Expand Down Expand Up @@ -195,7 +197,7 @@ inline void split_long_edges(rxmesh::RXMeshDynamic& rx,
{
using namespace rxmesh;

constexpr uint32_t blockThreads = 512;
constexpr uint32_t blockThreads = 256;


edge_status->reset(UNSEEN, DEVICE);
Expand Down
13 changes: 7 additions & 6 deletions apps/SurfaceTracking/collapser.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,13 @@ edge_collapse(rxmesh::Context context,
const VertexIterator& iter) {
// iter[0] and iter[2] are the edge two vertices
// iter[1] and iter[3] are the two opposite vertices
// 0a
// / | \
// c3 | 1d
// \ | /
// 2b

/*
0a
/ | \
c3 | 1d
\ | /
2b
*/
const VertexHandle ah = iter[0];
const VertexHandle bh = iter[2];
const VertexHandle ch = iter[1];
Expand Down
12 changes: 7 additions & 5 deletions apps/SurfaceTracking/flipper.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,13 @@ edge_flip(rxmesh::Context context,
auto should_flip = [&](const EdgeHandle& eh, const VertexIterator& iter) {
// iter[0] and iter[2] are the edge two vertices
// iter[1] and iter[3] are the two opposite vertices
// 0
// / | \
// 3 | 1
// \ | /
// 2
/*
0
/ | \
3 | 1
\ | /
2
*/

if (edge_status(eh) == UNSEEN) {
// make sure it is not boundary edge
Expand Down
25 changes: 14 additions & 11 deletions apps/SurfaceTracking/splitter.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,13 @@ split_edges(rxmesh::Context context,
auto should_split = [&](const EdgeHandle& eh, const VertexIterator& iter) {
// iter[0] and iter[2] are the edge two vertices
// iter[1] and iter[3] are the two opposite vertices
// 0
// / | \
// 3 | 1
// \ | /
// 2
/*
0
/ | \
3 | 1
\ | /
2
*/

if (edge_status(eh) == UNSEEN) {
// make sure it is not boundary edge
Expand All @@ -58,12 +60,13 @@ split_edges(rxmesh::Context context,
is_edge_bd(eh) == 0) {

assert(iter.size() == 4);

// a
// / | \
// c | d
// \ | /
// b
/*
a
/ | \
c | d
\ | /
b
*/

const VertexHandle ah = iter[0];
const VertexHandle bh = iter[2];
Expand Down
9 changes: 6 additions & 3 deletions include/rxmesh/algo/tutte_embedding.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,11 @@ inline void map_vertices_to_circle(RXMeshStatic& rx,

constexpr uint32_t blockThreads = 256;

VertexHandle* d_next_v = nullptr;
VertexHandle* d_next_v = nullptr;
const VertexHandle h_next_v = VertexHandle();
CUDA_ERROR(cudaMalloc((void**)&d_next_v, sizeof(VertexHandle)));
CUDA_ERROR(cudaMemset(d_next_v, INVALID64, sizeof(VertexHandle)));
CUDA_ERROR(cudaMemcpy(
d_next_v, &h_next_v, sizeof(VertexHandle), cudaMemcpyHostToDevice));


LaunchBox<blockThreads> lb;
Expand All @@ -171,7 +173,8 @@ inline void map_vertices_to_circle(RXMeshStatic& rx,
d_next_v,
sizeof(VertexHandle),
cudaMemcpyDeviceToHost));
CUDA_ERROR(cudaMemset(d_next_v, INVALID64, sizeof(VertexHandle)));
CUDA_ERROR(cudaMemcpy(
d_next_v, &h_next_v, sizeof(VertexHandle), cudaMemcpyHostToDevice));
if (current_v.is_valid()) {
last_v = current_v;
}
Expand Down
10 changes: 5 additions & 5 deletions include/rxmesh/diff/hessian_sparse_matrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ struct HessianSparseMatrix : public SparseMatrix<T>

using ScalarT = Scalar<T, K, true>;

using IndexT = SparseMatrix<T>::IndexT;
using IndexT = typename SparseMatrix<T>::IndexT;


HessianSparseMatrix(const RXMeshStatic& rx) : SparseMatrix<T>(rx, K)
Expand All @@ -37,8 +37,8 @@ struct HessianSparseMatrix : public SparseMatrix<T>
const IndexT local_i,
const IndexT local_j) const
{
const IndexT r_id = this->get_row_id(row_v) * m_replicate + local_i;
const IndexT c_id = this->get_row_id(col_v) * m_replicate + local_j;
const IndexT r_id = this->get_row_id(row_v) * this->m_replicate + local_i;
const IndexT c_id = this->get_row_id(col_v) * this->m_replicate + local_j;

return SparseMatrix<T>::operator()(r_id, c_id);
}
Expand All @@ -52,8 +52,8 @@ struct HessianSparseMatrix : public SparseMatrix<T>
const IndexT local_i,
const IndexT local_j)
{
const IndexT r_id = this->get_row_id(row_v) * m_replicate + local_i;
const IndexT c_id = this->get_row_id(col_v) * m_replicate + local_j;
const IndexT r_id = this->get_row_id(row_v) * this->m_replicate + local_i;
const IndexT c_id = this->get_row_id(col_v) * this->m_replicate + local_j;

return SparseMatrix<T>::operator()(r_id, c_id);
}
Expand Down
12 changes: 7 additions & 5 deletions include/rxmesh/rxmesh_static.h
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,7 @@ class RXMeshStatic : public RXMesh
false,
false,
false,
[](uint32_t v, uint32_t e, uint32_t f) { return 0; },
[](uint32_t v, uint32_t e, uint32_t f) -> size_t { return 0; },
NULL,
args...);
}
Expand All @@ -718,7 +718,7 @@ class RXMeshStatic : public RXMesh
*/
template <uint32_t blockThreads, typename KernelT, typename... ArgsT>
void run_kernel(
const KernelT kernel,
KernelT kernel,
const std::vector<Op> op,
const bool oriented,
const bool with_vertex_valence,
Expand All @@ -731,7 +731,7 @@ class RXMeshStatic : public RXMesh

prepare_launch_box(op,
lb,
kernel,
(void*)kernel,
oriented,
with_vertex_valence,
is_concurrent,
Expand Down Expand Up @@ -1766,7 +1766,8 @@ class RXMeshStatic : public RXMesh
for_each_face(
HOST,
[&](const FaceHandle& fh) {
for (uint32_t i = 0; i < attribute.get_num_attributes(); ++i) {
for (uint32_t i = 0; i < attribute.get_num_attributes();
++i) {
file << attribute(fh, i) << " ";
}
file << "\n";
Expand Down Expand Up @@ -1800,7 +1801,8 @@ class RXMeshStatic : public RXMesh
for_each_vertex(
HOST,
[&](const VertexHandle& vh) {
for (uint32_t i = 0; i < attribute.get_num_attributes(); ++i) {
for (uint32_t i = 0; i < attribute.get_num_attributes();
++i) {
file << attribute(vh, i) << " ";
}
file << "\n";
Expand Down

0 comments on commit 434f010

Please sign in to comment.