Skip to content

Commit

Permalink
minor
Browse files Browse the repository at this point in the history
  • Loading branch information
nmwsharp committed Jul 17, 2019
1 parent b1d2e9f commit 5143577
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
5 changes: 3 additions & 2 deletions include/polyscope/standardize_data_array.h
Original file line number Diff line number Diff line change
Expand Up @@ -802,8 +802,9 @@ std::vector<O> adaptorF_convertArrayOfVectorToStdVector(const T& inputData) {
// - any user defined function
// std::vector<std::vector<S>> adaptorF_custom_convertNestedArrayToStdVector(const YOUR_TYPE& inputData);
// - dense callable (parenthesis) access (like T(i,j)), on a type that supports .rows() and .cols()
// - double bracket access (like T[i][j]), where the outer and inner array types
// - iterable
// - recursive unpacking with bracket
// - recursive unpacking with parent
// - recursive unpacking with iterable


// Note: this dummy function is defined so the non-dependent name adaptorF_custom_convertArrayOfVectorToStdVector will
Expand Down
16 changes: 7 additions & 9 deletions test/src/array_adaptors_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
#include <string>
#include <vector>

#define POLYSCOPE_NO_STANDARDIZE_FALLTHROUGH

#include "polyscope/standardize_data_array.h"

using std::cout;
using std::endl;
Expand All @@ -35,7 +38,7 @@ struct UserArray {
UserArray userArray_sizeFunc{{0.1, 0.2, 0.3, 0.4, 0.5}};

// Size function for custom array
size_t adaptorF_size(const UserArray& c) { return c.bigness(); }
size_t adaptorF_custom_size(const UserArray& c) { return c.bigness(); }


// == A type that we access with callable (paren)
Expand All @@ -58,7 +61,6 @@ UserArrayCallableInt userArray_callableAccessInt{{0.1, 0.2, 0.3, 0.4, 0.5}};


// == A type that requires a custom access function
// (Eigen works this way, but don't want to depend on Eigen)
struct UserArrayFuncAccess {
std::vector<double> myData;
size_t size() const { return myData.size(); }
Expand Down Expand Up @@ -187,12 +189,6 @@ UserNestedListCustom userArray_nestedListCustom{{{1, 2, 3}, {4, 5, 6, 7}}};
} // namespace


#define POLYSCOPE_NO_STANDARDIZE_FALLTHROUGH

// This include is intentionally after the definitions above, so it can pick them up
#include "polyscope/standardize_data_array.h"


// Test that validateSize works when the type has a .size() member
TEST(ArrayAdaptorTests, validateSize_MemberMethod) {
polyscope::validateSize(arr_vecdouble, 5, "test");
Expand All @@ -205,7 +201,9 @@ TEST(ArrayAdaptorTests, validateSize_MemberMethod) {


// Test that validateSize works with a custom overload
TEST(ArrayAdaptorTests, validateSize_Custom) { polyscope::validateSize(userArray_sizeFunc, 5, "test"); }
TEST(ArrayAdaptorTests, validateSize_Custom) {
polyscope::validateSize(userArray_sizeFunc, 5, "test");
}


// Test that standardizeArray works with bracket access
Expand Down

0 comments on commit 5143577

Please sign in to comment.