fix some code

This commit is contained in:
陈浩南 2023-09-26 13:43:11 +08:00
parent 29a378acbc
commit 312dbd0529
5 changed files with 19 additions and 16 deletions

View File

@ -7,6 +7,12 @@ set_property(GLOBAL PROPERTY CXX_STANDARD 23)
set_property(GLOBAL PROPERTY CXX_STANDARD_REQUIRED ON)
set_property(GLOBAL PROPERTY CXX_EXTENSIONS OFF)
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message("Setting build type to 'RelWithDebInfo' as none was specified.")
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
endif()
find_package(yaml-cpp REQUIRED)
find_package(Eigen3 REQUIRED)
find_package(fmt REQUIRED)

View File

@ -5,6 +5,11 @@
outputs = inputs:
let
pkgs = inputs.nixpkgs.legacyPackages.x86_64-linux;
# pkgs = import inputs.nixpkgs
# {
# localSystem = { system = "x86_64-linux"; gcc = { arch = "alderlake"; tune = "alderlake"; }; };
# config.allowUnfree = true;
# };
localPackages = import "${inputs.nixos}/local/pkgs" { inherit pkgs; inherit (inputs.nixpkgs) lib; };
in
{
@ -17,7 +22,7 @@
localPackages.zpp-bits
];
hardeningDisable = [ "all" ];
NIX_DEBUG = "1";
# NIX_DEBUG = "1";
};
};
}

View File

@ -13,7 +13,7 @@
# include <vector>
# include <span>
# include <yaml-cpp/yaml.h>
# include <eigen3/Eigen/Dense>
# include <Eigen/Dense>
# include <concurrencpp/concurrencpp.h>
# include <fmt/format.h>
# include <fmt/std.h>
@ -136,6 +136,8 @@ struct Output
std::vector<QPointDataType_> QPointData;
void write(std::string filename, std::string format, unsigned percision = 10);
Output() = default;
Output(std::string filename);
};
concurrencpp::generator<std::pair<Eigen::Vector<unsigned, 3>, unsigned>>

View File

@ -3,7 +3,6 @@
inline HighFive::CompoundType create_compound_complex()
{ return {{"r", HighFive::AtomicType<double>{}}, {"i", HighFive::AtomicType<double>{}}}; }
inline Input::Input(std::string filename)
{
// read main input file
@ -21,7 +20,7 @@ inline Input::Input(std::string filename)
SuperCellDeformation.emplace();
for (unsigned i = 0; i < 3; i++)
for (unsigned j = 0; j < 3; j++)
(*SuperCellDeformation)(i, j) = node["SuperCellDeformation"][i][j].as<double>();
(*SuperCellDeformation)(i, j) = value[i][j].as<double>();
}
for (unsigned i = 0; i < 3; i++)
@ -45,9 +44,9 @@ inline Input::Input(std::string filename)
auto& _ = QPointDataOutputFile.emplace_back();
_.FileName = value[i]["FileName"].as<std::string>();
_.Format = value[i]["Format"].as<std::string>();
if (!std::set<std::string>{"yaml", "hdf5"}.contains(_.Format))
if (!std::set<std::string>{"yaml", "yaml-human-readable", "zpp"}.contains(_.Format))
throw std::runtime_error(fmt::format
("Unknown format: {}, should be \"yaml\" or \"hdf5\".", _.Format));
("Unknown format: {}, should be \"yaml\", \"yaml-human-readable\" or \"zpp\".", _.Format));
}
}

View File

@ -1,13 +1,4 @@
# include <iostream>
# include <array>
# include <numbers>
# include <numeric>
# include <fstream>
# include <eigen3/Eigen/Dense>
# include <yaml-cpp/yaml.h>
# include <matplot/matplot.h>
using namespace std::literals;
# include <ufo/ufo.impl.hpp>
// 一个临时的程序, 用于将数据导出画图