Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
1c05d1f
Added BezierCurve class to primal geom, changed CMake file
davidgunderman Jun 20, 2019
d6cd28d
Fixed bugs in definition of order, added test to primal_intro
davidgunderman Jun 20, 2019
4d0e182
moved bezier tests from /examples/primal_introduction_ex to /tests/pr…
davidgunderman Jun 24, 2019
62b9e54
Forgot to add some files
davidgunderman Jun 24, 2019
b8c8192
Added a de CastelJau Bezier splitting operator, which is not complete…
davidgunderman Jun 25, 2019
9da1d89
deleted bezier tests from /examples/primal_introduction.cpp
davidgunderman Jun 25, 2019
2926259
Converted more of the primal_bezier to gtest and slic_INFO formats
davidgunderman Jun 26, 2019
2dd5765
Added files from last commit:
davidgunderman Jun 27, 2019
c51b321
Added equality/inequality test for BezierCurve class, finished unit t…
davidgunderman Jun 28, 2019
331153e
Finished first draft bezier intersection hpp file, added test file fo…
davidgunderman Jul 1, 2019
89153ce
Uncrustified primal
Jul 9, 2019
4ccaf52
Some refactoring and tests for primal's BezierCurve class
kennyweiss Jul 9, 2019
2cb29bc
Added sectorArea() to BezierCurve, CurvedPolygon class with area func…
davidgunderman Jul 17, 2019
954fc0c
Added intersection of curved polygons, one test, and some helper func…
davidgunderman Jul 23, 2019
c39c2c2
Added more CurvedPolygon tests
davidgunderman Jul 23, 2019
fa87f12
Added sectorArea() to BezierCurve, CurvedPolygon class with area func…
davidgunderman Jul 17, 2019
157b4bb
Added intersection of curved polygons, one test, and some helper func…
davidgunderman Jul 23, 2019
22eb0fa
Added more CurvedPolygon tests
davidgunderman Jul 23, 2019
575be5a
Added intersection tests. TODO: precision of curvedpolygon intersecti…
davidgunderman Jul 24, 2019
840c572
Added tolerances to CurvedPolygon functions, unit tests for area and …
davidgunderman Jul 25, 2019
8081c8f
Improves documentation, error checking and testing of binomialCoeffic…
kennyweiss Jul 26, 2019
d73cd80
Makes Matrix's default constructor public
kennyweiss Jul 26, 2019
a978e13
Refactors and tests the BezierCurve sectorArea() weights calculation
kennyweiss Jul 26, 2019
4c10356
Merge branch 'feature/gunderman/bezier-polygon' of https://github.com…
davidgunderman Jul 26, 2019
11e9317
Merge branch 'feature/gunderman/bezier-polygon' of https://github.com…
davidgunderman Jul 26, 2019
751e7fd
Added sectorMoment() to BezierCurve, moment() to CurvedPolygon, tests…
davidgunderman Jul 26, 2019
553bd7f
Beginnings of a field transfer application for high-order meshes
kennyweiss Jul 29, 2019
4292e6e
Merge branch 'feature/weiss27/bezier-mesh-example' into feature/gunde…
davidgunderman Jul 30, 2019
c2fa969
Added doxygen comments for tangent intersections, overlapping curves,…
davidgunderman Jul 31, 2019
0a244c5
Changed recursion base case to improve robustness. Added intersect to…
davidgunderman Jul 31, 2019
79b42cc
Adds inclusion/separation test to intersect_polygon, reverts base cas…
davidgunderman Aug 14, 2019
eb7019f
Added reverseorientation functions to BezierCurve and CurvedPolygon c…
davidgunderman Aug 16, 2019
c443305
index on feature/gunderman/bezier-polygon: eb7019f Added reverseorien…
davidgunderman Aug 26, 2019
303d16b
WIP on feature/gunderman/bezier-polygon: eb7019f Added reverseorienta…
davidgunderman Aug 26, 2019
02fbd42
Debugged quest high order remap example
davidgunderman Aug 27, 2019
0d62e5b
Moved intersect curved poly into detail
davidgunderman Sep 17, 2019
b06a347
refactoring intersect_curved_polygon
davidgunderman Sep 18, 2019
0346c1e
Reformatted tests for CurvedPolygon
davidgunderman Sep 30, 2019
95d6f23
Separated curvedpolygon tests, added some tests to curved_polygon_test
davidgunderman Oct 1, 2019
199c2ad
Refactored CurvedPolygon tests, refactored CurvedPolygon
davidgunderman Oct 2, 2019
e2974e8
Bugfixes for curved polygon tests in MSVC
kennyweiss Oct 8, 2019
ffbc7f3
Bugfix for API change in primal::intersect
kennyweiss Oct 8, 2019
e516535
Rely on Axom data submodule for mesh files in quest high order remap …
kennyweiss Oct 8, 2019
7aac19d
primal's BezierCurve::dt should return a Vector rather than a Point
kennyweiss Oct 8, 2019
21b670b
Updates axom_data submodule
kennyweiss Oct 8, 2019
3c9d929
Minor updates to CurvedPolygon
kennyweiss Oct 8, 2019
c956060
Merge branch 'feature/kweiss/bezier-polygon' into feature/gunderman/b…
kennyweiss Oct 8, 2019
349753a
Attempting to fix macos error
davidgunderman Oct 22, 2019
509df60
Added conversion to positive basis, transform for high order mesh. Ch…
davidgunderman Oct 29, 2019
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
11 changes: 5 additions & 6 deletions src/axom/core/numerics/Matrix.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,11 @@ class Matrix
{
public:

/*!
* \brief Default constructor
*/
Matrix() : m_rows(0), m_cols(0), m_data(nullptr), m_usingExternal(false) {}

/*!
* \brief Constructor, creates a Matrix with the given rows and columns.
*
Expand Down Expand Up @@ -530,12 +535,6 @@ class Matrix

private:

/*!
* \brief Default constructor. Does nothing.
* \note Made private to prevent host-code from calling this.
*/
Matrix() : m_rows(0), m_cols(0), m_data(nullptr) { };

/// \name Private Helper Methods
/// @{

Expand Down
87 changes: 87 additions & 0 deletions src/axom/core/tests/utils_utilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,3 +116,90 @@ TEST(core_Utilities,minmax)
EXPECT_EQ(a, axom::utilities::max(a,b));
}
}

TEST(core_Utilities, binomial_coefficient)
{
std::cout<<"Testing binomial coefficient function."<< std::endl;

// test n less than zero
{
const int n = -1;
const int exp = 0;
for(int k=-1 ; k < 10 ; ++k)
{
auto binom_k_n = axom::utilities::binomialCoefficient(n,k);
EXPECT_EQ( exp, binom_k_n);
}
}

// test n := 0
{
const int n = 0;

EXPECT_EQ( 1, axom::utilities::binomialCoefficient(n,0));

EXPECT_EQ( 0, axom::utilities::binomialCoefficient(n,-1));
EXPECT_EQ( 0, axom::utilities::binomialCoefficient(n, 1));

}

// test n := 1
{
const int n = 1;

EXPECT_EQ( 0, axom::utilities::binomialCoefficient(n,-1));

EXPECT_EQ( 1, axom::utilities::binomialCoefficient(n, 0));
EXPECT_EQ( 1, axom::utilities::binomialCoefficient(n, 1));

EXPECT_EQ( 0, axom::utilities::binomialCoefficient(n, 2));

}

// test n := 2
{
const int n = 2;

EXPECT_EQ( 1, axom::utilities::binomialCoefficient(n,0));
EXPECT_EQ( 2, axom::utilities::binomialCoefficient(n,1));
EXPECT_EQ( 1, axom::utilities::binomialCoefficient(n,2));

}

// test n := 3
{
const int n = 3;

EXPECT_EQ( 1, axom::utilities::binomialCoefficient(n,0));
EXPECT_EQ( 3, axom::utilities::binomialCoefficient(n,1));
EXPECT_EQ( 3, axom::utilities::binomialCoefficient(n,2));
EXPECT_EQ( 1, axom::utilities::binomialCoefficient(n,3));
}

// test n := 4
{
const int n = 4;

EXPECT_EQ( 1, axom::utilities::binomialCoefficient(n,0));
EXPECT_EQ( 4, axom::utilities::binomialCoefficient(n,1));
EXPECT_EQ( 6, axom::utilities::binomialCoefficient(n,2));
EXPECT_EQ( 4, axom::utilities::binomialCoefficient(n,3));
EXPECT_EQ( 1, axom::utilities::binomialCoefficient(n,4));
}

// test recurrence relation nCk = (n-1)C(k-1) + (n-1)C(k)
{
for(int n = 1 ; n < 10 ; ++n)
{
for(int k=1 ; k <= n ; ++k)
{
auto binom_n_k = axom::utilities::binomialCoefficient(n,k);
auto binom_n1_k1 = axom::utilities::binomialCoefficient(n-1,k-1);
auto binom_n1_k = axom::utilities::binomialCoefficient(n-1,k);

EXPECT_EQ(binom_n_k, binom_n1_k1 + binom_n1_k );
}
}
}

}
24 changes: 24 additions & 0 deletions src/axom/core/utilities/Utilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,29 @@ void processAbort()
#endif
}

int binomialCoefficient(int n, int k)
{
if(k > n || k < 0) // check if out-of-bounds
{
return 0;
}
if(k == n || k == 0) // early return
{
return 1;
}
if (k > n-k) // exploit symmetry to reduce work
{
k= n-k;
}

int val = 1;
for (int i=1 ; i<=k ; ++i)
{
val*=(n-k+i);
val/=i;
}
return val;
}

} // end namespace utilities
} // end namespace axom
8 changes: 8 additions & 0 deletions src/axom/core/utilities/Utilities.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,14 @@ T clampLower(T val, T lower)
return val < lower ? lower : val;
}

/*!
* \brief Computes the binomial coefficient `n choose k`
*
* \return \f$ {n\choose k} = n! / (k! * (n-k)!)\f$
* when \f$ n \ge k \ge 0 \f$, 0 otherwise.
*/
int binomialCoefficient(int n, int k);

/*!
* \brief Returns a random real number within the specified interval
*
Expand Down
2 changes: 2 additions & 0 deletions src/axom/primal/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ set( primal_headers
## geometry
geometry/BezierCurve.hpp
geometry/BoundingBox.hpp
geometry/CurvedPolygon.hpp
geometry/OrientedBoundingBox.hpp
geometry/OrientationResult.hpp
geometry/NumericArray.hpp
Expand All @@ -44,6 +45,7 @@ set( primal_headers

operators/detail/clip_impl.hpp
operators/detail/intersect_bezier_impl.hpp
operators/detail/intersect_curved_poly_impl.hpp
operators/detail/intersect_impl.hpp
)

Expand Down
Loading