Skip to content
Draft
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
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ __pycache__/
.Python
.venv/
env/
bin/
/bin/
build/
develop-eggs/
dist/
Expand Down
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ name = "cygv"
crate-type = ["lib", "cdylib"]

[dependencies]
clap = { version = "4.5.16", features = ["derive"] }
ctrlc = "3.4.4"
itertools = "0.13.0"
nalgebra = "0.33.0"
rug = "1.25.0"
yaml-rust2 = "0.8"

[dependencies.pyo3]
version = "0.22.2"
Expand Down
41 changes: 41 additions & 0 deletions src/bin/cygv/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
use clap::Parser;
use std::fs;
use std::io::{self, Read};
use yaml_rust2::YamlLoader;

/// Compute GV and GW invariants of CY manifold specified by the input file
#[derive(Parser, Debug)]
#[command(version, about, long_about = None)]
struct Args {
/// Input file
#[arg(short, long, default_value_t = String::from("stdin"))]
file: String,
/// Output file
#[arg(short, long, default_value_t = String::from("stdout"))]
output: String,
}

fn main() {
let args = Args::parse();

let input_str = if args.file == "stdin" {
let mut input = String::new();
io::stdin()
.read_to_string(&mut input)
.expect("Failed to read from stdin");
input
} else {
fs::read_to_string(&args.file)
.unwrap_or_else(|_| panic!("Failed to read from file {}", args.file))
};

let input_data = YamlLoader::load_from_str(&input_str).expect("Failed to parse YAML");

for cy in input_data {
println!("{:?}", cy);

// get cy data

// save or print out invariants
}
}
1 change: 1 addition & 0 deletions src/io.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
//! Input and output functions
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ pub mod factorial;
pub mod fundamental_period;
pub mod hkty;
pub mod instanton;
pub mod io;
pub mod misc;
pub mod polynomial;
pub mod pool;
Expand Down