Skip to content

Commit

Permalink
Address comments from PR #1058.
Browse files Browse the repository at this point in the history
  • Loading branch information
gunney1 committed Jun 6, 2023
1 parent 63c17c6 commit 2584783
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 28 deletions.
2 changes: 1 addition & 1 deletion scripts/uberenv
5 changes: 1 addition & 4 deletions src/axom/quest/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ set( quest_headers
detail/inout/InOutOctreeStats.hpp
detail/inout/InOutOctreeValidator.hpp

## Marching cubes
detail/MarchingCubesImpl.hpp

# Mesh tester
MeshTester.hpp
detail/MeshTester_detail.hpp
Expand Down Expand Up @@ -110,7 +107,7 @@ endif()

blt_list_append(
TO quest_headers
ELEMENTS MarchingCubes.hpp
ELEMENTS MarchingCubes.hpp detail/MarchingCubesImpl.hpp
IF CONDUIT_FOUND
)

Expand Down
2 changes: 1 addition & 1 deletion src/axom/quest/MarchingCubes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ void MarchingCubesSingleDomain::computeIsocontour(double contourVal)
m_impl->setContourValue(contourVal);
m_impl->markCrossings();
m_impl->scanCrossings();
m_impl->computeContpur();
m_impl->computeContour();
}

void MarchingCubesSingleDomain::allocateImpl()
Expand Down
5 changes: 4 additions & 1 deletion src/axom/quest/MarchingCubes.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ class MarchingCubesSingleDomain;
* \@brief Class implementing marching cubes to compute a contour
* mesh from a scalar function on an input mesh.
*
* This implementation is for the original algorithm of Lorensen and
* Cline, 1987.
*
* Implementation is for 2D (marching squares) and 3D (marching
* cubes).
*
Expand Down Expand Up @@ -335,7 +338,7 @@ class MarchingCubesSingleDomain
//!@brief Precompute some metadata for contour mesh.
virtual void scanCrossings() = 0;
//!@brief Generate the contour mesh in internal data format.
virtual void computeContpur() = 0;
virtual void computeContour() = 0;
//!@brief Get the number of contour mesh cells generated.
//@}
virtual axom::IndexType getContourCellCount() const = 0;
Expand Down
15 changes: 4 additions & 11 deletions src/axom/quest/detail/MarchingCubesImpl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,11 @@
#include "axom/quest/MarchingCubes.hpp"
#include "axom/quest/detail/marching_cubes_lookup.hpp"
#include "axom/primal/geometry/Point.hpp"
#include "axom/primal/constants.hpp"
#include "axom/mint/execution/internal/structured_exec.hpp"
#include "conduit_blueprint.hpp"
#include "axom/fmt.hpp"

#ifndef __WHERE
#define __STRINGIZE(x) __STRINGIZE2(x)
#define __STRINGIZE2(x) #x
//!@brief String literal for code location
#define __WHERE \
__FILE__ ":" __STRINGIZE(__LINE__) "(" + std::string(__func__) + ") "
#endif

namespace axom
{
namespace quest
Expand Down Expand Up @@ -328,7 +321,7 @@ class MarchingCubesImpl : public MarchingCubesSingleDomain::ImplBase
num_contour_cells(m_crossings.back().caseNum);
}

void computeContpur() override
void computeContour() override
{
auto crossingsView = m_crossings.view();

Expand Down Expand Up @@ -596,7 +589,7 @@ class MarchingCubesImpl : public MarchingCubesSingleDomain::ImplBase
}

// STEP 3: point is in between the edge points, interpolate its position
constexpr double ptiny = 1.0e-80;
constexpr double ptiny = axom::primal::PRIMAL_TINY;
const double df = f2 - f1 + ptiny; //add ptiny to avoid division by zero
const double w = (m_contourVal - f1) / df;
for(int d = 0; d < DIM; ++d)
Expand Down Expand Up @@ -648,7 +641,7 @@ class MarchingCubesImpl : public MarchingCubesSingleDomain::ImplBase
}

// STEP 3: point is not at corner; interpolate its position
constexpr double ptiny = 1.0e-80;
constexpr double ptiny = axom::primal::PRIMAL_TINY;
const double df = f2 - f1 + ptiny; //add ptiny to avoid division by zero
const double w = (m_contourVal - f1) / df;
for(int d = 0; d < DIM; ++d)
Expand Down
10 changes: 1 addition & 9 deletions src/axom/quest/examples/quest_marching_cubes_example.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,6 @@
#include <vector>
#include <cmath>

#ifndef __WHERE
#define __STRINGIZE(x) __STRINGIZE2(x)
#define __STRINGIZE2(x) #x
//!@brief String literal for code location
#define __WHERE \
__FILE__ ":" __STRINGIZE(__LINE__) "(" + std::string(__func__) + ") "
#endif

namespace quest = axom::quest;
namespace slic = axom::slic;
namespace mint = axom::mint;
Expand Down Expand Up @@ -86,7 +78,7 @@ struct Input
std::vector<double> inPlane;
std::vector<double> perpDir;

size_t ndim {0};
std::size_t ndim {0};

// TODO: Ensure that fcnCenter, inPlane and perpDir sizes match dimensionality.

Expand Down
2 changes: 1 addition & 1 deletion src/cmake/blt

0 comments on commit 2584783

Please sign in to comment.