Skip to content

Commit 58f664d

Browse files
committed
Add some range based iterators and other comment changes
1 parent 9c1e763 commit 58f664d

3 files changed

Lines changed: 20 additions & 20 deletions

File tree

src/axom/primal/operators/winding_number.hpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -227,9 +227,9 @@ double winding_number(const Point<T, 2>& q,
227227
{
228228
bool dummy_isOnCurve = false;
229229
double ret_val = 0.0;
230-
for(int i = 0; i < carray.size(); i++)
230+
for(auto& curv : carray)
231231
{
232-
ret_val += detail::bezier_winding_number(q, carray[i], dummy_isOnCurve, edge_tol, EPS);
232+
ret_val += detail::bezier_winding_number(q, curv, dummy_isOnCurve, edge_tol, EPS);
233233
}
234234

235235
return ret_val;
@@ -321,7 +321,7 @@ double winding_number(const Point<T, 2>& q,
321321
* \brief Computes the GWN for a 2D point wrt an array of memoized data for 2D NURBS curves
322322
*
323323
* \param [in] query The query point to test
324-
* \param [in] nurbs_curve_arr The array of memoized curve objects
324+
* \param [in] nurbs_cache_arr The array of memoized curve objects
325325
* \param [out] isOnCurve Set to true is the query point is on the curve
326326
* \param [in] edge_tol The physical distance level at which objects are considered indistinguishable
327327
* \param [in] EPS Miscellaneous numerical tolerance level for nonphysical distances
@@ -330,17 +330,17 @@ double winding_number(const Point<T, 2>& q,
330330
*/
331331
template <typename T>
332332
double winding_number(const Point<T, 2>& query,
333-
const axom::Array<detail::NURBSCurveGWNCache<T>>& nurbs_curve_arr,
333+
const axom::Array<detail::NURBSCurveGWNCache<T>>& nurbs_cache_arr,
334334
bool& isOnCurve,
335335
double edge_tol = 1e-8,
336336
double EPS = 1e-8)
337337
{
338338
double gwn = 0;
339339
isOnCurve = false;
340-
for(int i = 0; i < nurbs_curve_arr.size(); ++i)
340+
for(auto& the_cache : nurbs_cache_arr)
341341
{
342342
bool isOnThisCurve = false;
343-
gwn += winding_number(query, nurbs_curve_arr[i], isOnThisCurve, edge_tol, EPS);
343+
gwn += winding_number(query, the_cache, isOnThisCurve, edge_tol, EPS);
344344
isOnCurve = isOnCurve || isOnThisCurve;
345345
}
346346

@@ -383,12 +383,12 @@ axom::Array<double> winding_number(const axom::Array<Point<T, 2>>& query_arr,
383383
{
384384
ret_val[n] = 0.0;
385385

386-
for(int i = 0; i < nurbs_cache_arr.size(); ++i)
386+
for(auto& the_cache : nurbs_cache_arr)
387387
{
388-
for(int k = 0; k < nurbs_cache_arr[i].getNumKnotSpans(); ++k)
388+
for(int k = 0; k < the_cache.getNumKnotSpans(); ++k)
389389
{
390390
ret_val[n] += detail::bezier_winding_number_memoized(query_arr[n],
391-
nurbs_cache_arr[i],
391+
the_cache,
392392
k,
393393
0,
394394
0,
@@ -424,9 +424,9 @@ axom::Array<double> winding_number(const axom::Array<Point<T, 2>>& query_arr,
424424
{
425425
axom::Array<detail::NURBSCurveGWNCache<T>> cache_arr(0, curve_arr.size());
426426

427-
for(int i = 0; i < curve_arr.size(); ++i)
427+
for(auto& curv : curve_arr)
428428
{
429-
cache_arr.emplace_back(detail::NURBSCurveGWNCache<T>(curve_arr[i], edge_tol));
429+
cache_arr.emplace_back(detail::NURBSCurveGWNCache<T>(curv, edge_tol));
430430
}
431431

432432
return winding_number(query_arr, cache_arr, edge_tol, EPS);
@@ -902,9 +902,9 @@ axom::Array<double> winding_number(const axom::Array<Point<T, 3>>& query_arr,
902902
{
903903
// Precompute the expansions and cast directions for each patch
904904
axom::Array<detail::NURBSPatchGWNCache<T>> nurbs_cache_arr(0, surf_arr.size());
905-
for(int i = 0; i < surf_arr.size(); ++i)
905+
for(autp& surf : surf_arr)
906906
{
907-
nurbs_cache_arr.emplace_back(detail::NURBSPatchGWNCache<T>(surf_arr[i]));
907+
nurbs_cache_arr.emplace_back(detail::NURBSPatchGWNCache<T>(surf));
908908
}
909909

910910
return winding_number(query_arr, nurbs_cache_arr, edge_tol, ls_tol, quad_tol, disk_size, EPS);

src/axom/quest/io/STEPReader.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ struct PatchData
6969
int patchIndex {-1};
7070
bool wasOriginallyPeriodic_u {false};
7171
bool wasOriginallyPeriodic_v {false};
72-
bool reversed_u {false};
72+
bool was_reversed_u {false};
7373
axom::primal::BoundingBox<double, 2> parametricBBox;
7474
axom::primal::BoundingBox<double, 3> physicalBBox;
7575
axom::Array<bool> trimmingCurves_originallyPeriodic;
@@ -701,13 +701,13 @@ class StepFileProcessor
701701
patchData.patchIndex = patchIndex;
702702
patchData.wasOriginallyPeriodic_u = patchProcessor.patchWasOriginallyPeriodic_u();
703703
patchData.wasOriginallyPeriodic_v = patchProcessor.patchWasOriginallyPeriodic_v();
704-
patchData.reversed_u = (face.Orientation() != TopAbs_FORWARD);
704+
patchData.was_reversed_u = (face.Orientation() != TopAbs_FORWARD);
705705
patchData.parametricBBox = faceBoundingBox(face);
706706
patchData.physicalBBox = patches[patchIndex].boundingBox();
707707

708708
// Apply the face orientation to the Axom patch so that normals are
709709
// consistent with the original B-Rep.
710-
if(patchData.reversed_u)
710+
if(patchData.was_reversed_u)
711711
{
712712
patches[patchIndex].reverseOrientation_u();
713713
}
@@ -921,7 +921,7 @@ class StepFileProcessor
921921
SLIC_ASSERT(curve.isValidNURBS());
922922
SLIC_ASSERT(curve.getDegree() == bsplineCurve->Degree());
923923

924-
if(patchData.reversed_u)
924+
if(patchData.was_reversed_u)
925925
{
926926
reflectCurve_u(curve, patch_umin, patch_umax);
927927
}

src/axom/quest/tests/quest_step_reader.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ std::string pjoin(const char* str, Args... args)
4545

4646
//------------------------------------------------------------------------------
4747
// Use a pared-down version of the TriangleGWN3D method to directly evaluate
48-
// the for a triangle mesh
48+
// the winding number for a triangle mesh
4949
struct MiniTriangleGWN3D
5050
{
5151
using Point3D = primal::Point<double, 3>;
@@ -76,7 +76,7 @@ struct MiniTriangleGWN3D
7676
&mesh,
7777
AXOM_LAMBDA(axom::IndexType cellIdx,
7878
const axom::numerics::Matrix<double>& coords,
79-
[[maybe_unused]] const axom::IndexType* nodeIds) {
79+
const axom::IndexType* /*nodeIds*/) {
8080
// clang-format off
8181
trisView[cellIdx] = Triangle3D {Point3D {(coords(0, 0) - ctr[0]) / scl, (coords(1, 0) - ctr[1]) / scl, (coords(2, 0) - ctr[2]) / scl},
8282
Point3D {(coords(0, 1) - ctr[0]) / scl, (coords(1, 1) - ctr[1]) / scl, (coords(2, 1) - ctr[2]) / scl},
@@ -170,7 +170,7 @@ void runStepFileTest(const std::string& stepFile, double deflection = 0.1)
170170
const auto shapeBbox = stepReader.getBRepBoundingBox().scale(1.1);
171171
auto bboxMin = shapeBbox.getMin();
172172
auto bboxMax = shapeBbox.getMax();
173-
const auto bboxDiag = bboxMax.array() - bboxMin.array();
173+
const auto bboxDiag = bboxMax.range();
174174

175175
axom::Array<primal::Point<double, 3>> query_arr;
176176
for(const double fx : {0.11, 0.251, 0.52, 0.731, 0.91})

0 commit comments

Comments
 (0)