Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions SparseGrids/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ add_executable(Tasmanian_gridtest gridtest_main.cpp
gridtestUnitTests.cpp
gridtestTestInterfaceC.cpp)

add_executable(Tasmanian_benchmarksgrid Benchmarks/benchCommon.hpp
gridtestCLICommon.hpp
add_executable(Tasmanian_benchmarksgrid gridtestCLICommon.hpp
Benchmarks/benchCommon.hpp
Benchmarks/benchMakeGrid.hpp
Benchmarks/benchLoadNeeded.hpp
Benchmarks/benchDifferentiate.hpp
Expand Down
17 changes: 16 additions & 1 deletion SparseGrids/TasmanianSparseGrid.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1968,10 +1968,17 @@ class TasmanianSparseGrid{
};
}else{
size_t dims = (size_t) getNumDimensions();
#if __cplusplus > 201103L
return [dta=domain_transform_a, dims](std::vector<double> const &x)->bool{
for(size_t i=0; i<dims; i++) if (x[i] < dta[i]) return false;
return true;
};
#else
return [=](std::vector<double> const &x)->bool{
for(size_t i=0; i<dims; i++) if (x[i] < domain_transform_a[i]) return false;
return true;
};
#endif
}
}else{
if (domain_transform_a.empty()){
Expand All @@ -1988,11 +1995,19 @@ class TasmanianSparseGrid{
}
}else{
size_t dims = (size_t) getNumDimensions();
#if __cplusplus > 201103L
return [dta=domain_transform_a, dtb=domain_transform_b, dims](std::vector<double> const &x)->bool{
for(size_t i=0; i<dims; i++)
if (x[i] < dta[i] or x[i] > dtb[i]) return false;
return true;
};
#else
return [=](std::vector<double> const &x)->bool{
for(size_t i=0; i<dims; i++)
if ((x[i] < domain_transform_a[i]) || (x[i] > domain_transform_b[i])) return false;
if (x[i] < domain_transform_a[i] or x[i] > domain_transform_b[i]) return false;
return true;
};
#endif
}
}
}
Expand Down
12 changes: 11 additions & 1 deletion SparseGrids/tsgAcceleratedDataStructures.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -635,13 +635,23 @@ struct AccelerationContext{

//! \brief Sets algorithm affinity in the direction of sparse.
ChangeType favorSparse(bool favor){
AlgorithmPreference new_preference = [=]()->AlgorithmPreference{
#if __cplusplus > 201103L
AlgorithmPreference new_preference = [as=algorithm_select, favor]()->AlgorithmPreference{
if (favor){
return (as == algorithm_dense) ? algorithm_autoselect : algorithm_sparse;
}else{
return (as == algorithm_sparse) ? algorithm_autoselect : algorithm_dense;
}
}();
#else
AlgorithmPreference new_preference = [&]()->AlgorithmPreference{
if (favor){
return (algorithm_select == algorithm_dense) ? algorithm_autoselect : algorithm_sparse;
}else{
return (algorithm_select == algorithm_sparse) ? algorithm_autoselect : algorithm_dense;
}
}();
#endif
if (new_preference != algorithm_select){
algorithm_select = new_preference;
return change_sparse_dense;
Expand Down
Loading