xref: /libCEED/examples/rust/ex1-volume/src/opt.rs (revision 3d8e882215d238700cdceb37404f76ca7fa24eaa)
1*3d8e8822SJeremy L Thompson // Copyright (c) 2017-2022, Lawrence Livermore National Security, LLC and other CEED contributors.
2*3d8e8822SJeremy L Thompson // All Rights Reserved. See the top-level LICENSE and NOTICE files for details.
3ded9b81dSJeremy L Thompson //
4*3d8e8822SJeremy L Thompson // SPDX-License-Identifier: BSD-2-Clause
5ded9b81dSJeremy L Thompson //
6*3d8e8822SJeremy L Thompson // This file is part of CEED:  http://github.com/ceed
7ded9b81dSJeremy L Thompson 
8ded9b81dSJeremy L Thompson use structopt::StructOpt;
9ded9b81dSJeremy L Thompson 
10ded9b81dSJeremy L Thompson // ----------------------------------------------------------------------------
11ded9b81dSJeremy L Thompson // Command line arguments
12ded9b81dSJeremy L Thompson // ----------------------------------------------------------------------------
13ded9b81dSJeremy L Thompson #[derive(Debug, StructOpt)]
14ded9b81dSJeremy L Thompson #[structopt(
15ded9b81dSJeremy L Thompson     name = "libCEED Rust Example 1 - Volume",
16ded9b81dSJeremy L Thompson     about = "This example uses the mass matrix to compute the length, area, or volume of a region, depending upon runtime parameters."
17ded9b81dSJeremy L Thompson )]
18954a6033SJeremy L Thompson #[cfg(not(tarpaulin_include))]
19ded9b81dSJeremy L Thompson pub(crate) struct Opt {
20ded9b81dSJeremy L Thompson     /// libCEED backend resource to use
21ded9b81dSJeremy L Thompson     #[structopt(name = "ceed", short = "c", long = "ceed", default_value = "/cpu/self")]
22ded9b81dSJeremy L Thompson     pub(crate) ceed_spec: String,
23ded9b81dSJeremy L Thompson     /// Mesh dimension
24ded9b81dSJeremy L Thompson     #[structopt(
25ded9b81dSJeremy L Thompson         name = "dimension",
26ded9b81dSJeremy L Thompson         short = "d",
27ded9b81dSJeremy L Thompson         long = "dimension",
28ded9b81dSJeremy L Thompson         default_value = "3"
29ded9b81dSJeremy L Thompson     )]
30ded9b81dSJeremy L Thompson     pub(crate) dim: usize,
31ded9b81dSJeremy L Thompson     /// Polynomial degree for the mesh
32ded9b81dSJeremy L Thompson     #[structopt(
33ded9b81dSJeremy L Thompson         name = "mesh degree",
34ded9b81dSJeremy L Thompson         short = "m",
35ded9b81dSJeremy L Thompson         long = "mesh_degree",
36ded9b81dSJeremy L Thompson         default_value = "4"
37ded9b81dSJeremy L Thompson     )]
38ded9b81dSJeremy L Thompson     pub(crate) mesh_degree: usize,
39ded9b81dSJeremy L Thompson     /// Polynomial degree for the solution
40ded9b81dSJeremy L Thompson     #[structopt(
41ded9b81dSJeremy L Thompson         name = "solution degree",
42ded9b81dSJeremy L Thompson         short = "p",
43ded9b81dSJeremy L Thompson         long = "solution_degree",
44ded9b81dSJeremy L Thompson         default_value = "4"
45ded9b81dSJeremy L Thompson     )]
46ded9b81dSJeremy L Thompson     pub(crate) solution_degree: usize,
47ded9b81dSJeremy L Thompson     /// Number of quadrature points in 1D
48ded9b81dSJeremy L Thompson     #[structopt(
49ded9b81dSJeremy L Thompson         name = "number of quadrature points",
50ded9b81dSJeremy L Thompson         short = "q",
51ded9b81dSJeremy L Thompson         long = "num_qpts",
52ded9b81dSJeremy L Thompson         default_value = "6"
53ded9b81dSJeremy L Thompson     )]
54ded9b81dSJeremy L Thompson     pub(crate) num_qpts: usize,
55ded9b81dSJeremy L Thompson     /// Approximate problem size
56ded9b81dSJeremy L Thompson     #[structopt(
57ded9b81dSJeremy L Thompson         name = "problem size",
58ded9b81dSJeremy L Thompson         short = "s",
59ded9b81dSJeremy L Thompson         long = "problem_size",
60ded9b81dSJeremy L Thompson         default_value = "-1"
61ded9b81dSJeremy L Thompson     )]
62ded9b81dSJeremy L Thompson     pub(crate) problem_size_requested: i64,
63ded9b81dSJeremy L Thompson     /// Test mode
64ded9b81dSJeremy L Thompson     #[structopt(name = "test mode", short = "t", long = "test")]
65ded9b81dSJeremy L Thompson     pub(crate) test: bool,
66ded9b81dSJeremy L Thompson     /// Quiet mode
67eab5b1a2SJeremy L Thompson     #[structopt(name = "quiet mode", short = "x", long = "quiet")]
68ded9b81dSJeremy L Thompson     pub(crate) quiet: bool,
69ded9b81dSJeremy L Thompson     /// Gallery QFunctions
70ded9b81dSJeremy L Thompson     #[structopt(name = "gallery QFunctions", short = "g", long = "gallery")]
71ded9b81dSJeremy L Thompson     pub(crate) gallery: bool,
72ded9b81dSJeremy L Thompson }
73ded9b81dSJeremy L Thompson 
74ded9b81dSJeremy L Thompson // ----------------------------------------------------------------------------
75