mirror of
https://github.com/CHN-beta/ufo.git
synced 2024-10-22 11:48:44 +08:00
add solver.cpp
This commit is contained in:
parent
9721976e4c
commit
4b2971d54d
@ -24,7 +24,7 @@ find_package(glad REQUIRED)
|
||||
find_package(Matplot++ REQUIRED)
|
||||
find_path(ZPP_BITS_INCLUDE_DIR zpp_bits.h REQUIRED)
|
||||
|
||||
add_executable(ufo src/fold.cpp src/unfold.cpp src/plot.cpp src/main.cpp)
|
||||
add_executable(ufo src/solver.cpp src/fold.cpp src/unfold.cpp src/plot.cpp src/main.cpp)
|
||||
target_include_directories(ufo PRIVATE ${PROJECT_SOURCE_DIR}/include ${ZPP_BITS_INCLUDE_DIR})
|
||||
target_link_libraries(ufo PRIVATE
|
||||
yaml-cpp Eigen3::Eigen fmt::fmt concurrencpp::concurrencpp HighFive_HighFive TBB::tbb Matplot++::matplot
|
||||
|
@ -62,18 +62,8 @@ namespace ufo
|
||||
virtual Solver& operator()() = 0;
|
||||
virtual ~Solver() = default;
|
||||
|
||||
inline static concurrencpp::generator<std::pair<Eigen::Vector<unsigned, 3>, unsigned>>
|
||||
triplet_sequence(Eigen::Vector<unsigned, 3> range)
|
||||
{
|
||||
for (unsigned x = 0; x < range[0]; x++)
|
||||
for (unsigned y = 0; y < range[1]; y++)
|
||||
for (unsigned z = 0; z < range[2]; z++)
|
||||
co_yield
|
||||
{
|
||||
Eigen::Vector<unsigned, 3>{{x}, {y}, {z}},
|
||||
x * range[1] * range[2] + y * range[2] + z
|
||||
};
|
||||
}
|
||||
static concurrencpp::generator<std::pair<Eigen::Vector<unsigned, 3>, unsigned>>
|
||||
triplet_sequence(Eigen::Vector<unsigned, 3> range);
|
||||
|
||||
template <ZppSerializable T> inline static void zpp_write(const T& object, std::string filename)
|
||||
{
|
||||
|
17
src/solver.cpp
Normal file
17
src/solver.cpp
Normal file
@ -0,0 +1,17 @@
|
||||
# include <ufo/solver.hpp>
|
||||
|
||||
namespace ufo
|
||||
{
|
||||
concurrencpp::generator<std::pair<Eigen::Vector<unsigned, 3>, unsigned>> Solver::triplet_sequence
|
||||
(Eigen::Vector<unsigned, 3> range)
|
||||
{
|
||||
for (unsigned x = 0; x < range[0]; x++)
|
||||
for (unsigned y = 0; y < range[1]; y++)
|
||||
for (unsigned z = 0; z < range[2]; z++)
|
||||
co_yield
|
||||
{
|
||||
Eigen::Vector<unsigned, 3>{{x}, {y}, {z}},
|
||||
x * range[1] * range[2] + y * range[2] + z
|
||||
};
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user