diff --git a/CMakeLists.txt b/CMakeLists.txt index 58e67e079a0d20bf4f9c1fea3283ddb319d7a488..1c98533de246bc302e60a49d6507fc527b9ed7dd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,7 +8,7 @@ project (graph_framework CXX) option (USE_PCH "Enable the use of precompiled headers" ON) option (SAVE_KERNEL_SOURCE "Writes the kernel source code to a file." OFF) option (USE_INPUT_CACHE "Cache the values kernel input values." OFF) -option (USE_CONSTANT_CACHE "Cache the value of constantants in kernel registers." OFF) +option (USE_CONSTANT_CACHE "Cache the value of constants in kernel registers." OFF) option (SHOW_USE_COUNT "Add a comment showing the use count in kernel sources." OFF) option (USE_INDEX_CACHE "Cache index values instead of computing them every time." OFF) option (USE_VERBOSE "Verbose jit option." OFF) @@ -175,7 +175,7 @@ function (register_project reg_name dir url default_tag sub_dir) WORKING_DIRECTORY ${${reg_name}_SOURCE_DIR} ) -# Add a taraget to pull the latest version before building. Note dependency is +# Add a target to pull the latest version before building. Note dependency is # registered in the sub project CMakeList.txt. Not sure how this should handle # multiple targets in a project yet. Name must match the subproject pull_ # dependency. diff --git a/graph_benchmark/xrays_bench.cpp b/graph_benchmark/xrays_bench.cpp index 28e2df999828fc7812a99b26e6484163d5abb50f..5fb411814e3821429c310061c24897529d630ac2 100644 --- a/graph_benchmark/xrays_bench.cpp +++ b/graph_benchmark/xrays_bench.cpp @@ -14,7 +14,7 @@ /// /// @tparam T Base type of the calculation. /// @tparam NUM_TIMES Total number of times steps. -/// @tparam SUB_STEPS Number of substeps. +/// @tparam SUB_STEPS Number of sub-steps. /// @tparam NUM_RAYS Number of rays. //------------------------------------------------------------------------------ template @@ -61,7 +61,7 @@ void bench_runner() { t->set(static_cast (0.0)); -// Inital conditions. +// Initial conditions. omega->set(static_cast (500.0)); x->set(static_cast (2.5)); y->set(static_cast (0.0)); diff --git a/graph_c_binding/graph_c_binding.cpp b/graph_c_binding/graph_c_binding.cpp index 77ee4ca50493078dd7078a2f7e5cfa7b0e9c4b72..54b4d13a12d52e5065d8ad2805976ec6739430f8 100644 --- a/graph_c_binding/graph_c_binding.cpp +++ b/graph_c_binding/graph_c_binding.cpp @@ -491,8 +491,8 @@ extern "C" { /// @brief Create add node. /// /// @param[in] c The graph C context. -/// @param[in] left The left opperand. -/// @param[in] right The right opperand. +/// @param[in] left The left operand. +/// @param[in] right The right operand. /// @returns left + right //------------------------------------------------------------------------------ graph_node graph_add(STRUCT_TAG graph_c_context *c, @@ -557,8 +557,8 @@ extern "C" { /// @brief Create Substract node. /// /// @param[in] c The graph C context. -/// @param[in] left The left opperand. -/// @param[in] right The right opperand. +/// @param[in] left The left operand. +/// @param[in] right The right operand. /// @returns left - right //------------------------------------------------------------------------------ graph_node graph_sub(STRUCT_TAG graph_c_context *c, @@ -623,8 +623,8 @@ extern "C" { /// @brief Create Multiply node. /// /// @param[in] c The graph C context. -/// @param[in] left The left opperand. -/// @param[in] right The right opperand. +/// @param[in] left The left operand. +/// @param[in] right The right operand. /// @returns left*right //------------------------------------------------------------------------------ graph_node graph_mul(STRUCT_TAG graph_c_context *c, @@ -689,8 +689,8 @@ extern "C" { /// @brief Create Divide node. /// /// @param[in] c The graph C context. -/// @param[in] left The left opperand. -/// @param[in] right The right opperand. +/// @param[in] left The left operand. +/// @param[in] right The right operand. /// @returns left/right //------------------------------------------------------------------------------ graph_node graph_div(STRUCT_TAG graph_c_context *c, @@ -758,7 +758,7 @@ extern "C" { /// @brief Create Sqrt node. /// /// @param[in] c The graph C context. -/// @param[in] arg The left opperand. +/// @param[in] arg The left operand. /// @returns sqrt(arg) //------------------------------------------------------------------------------ graph_node graph_sqrt(STRUCT_TAG graph_c_context *c, @@ -822,7 +822,7 @@ extern "C" { /// @brief Create exp node. /// /// @param[in] c The graph C context. -/// @param[in] arg The left opperand. +/// @param[in] arg The left operand. /// @returns exp(arg) //------------------------------------------------------------------------------ graph_node graph_exp(STRUCT_TAG graph_c_context *c, @@ -886,7 +886,7 @@ extern "C" { /// @brief Create log node. /// /// @param[in] c The graph C context. -/// @param[in] arg The left opperand. +/// @param[in] arg The left operand. /// @returns log(arg) //------------------------------------------------------------------------------ graph_node graph_log(STRUCT_TAG graph_c_context *c, @@ -950,8 +950,8 @@ extern "C" { /// @brief Create Pow node. /// /// @param[in] c The graph C context. -/// @param[in] left The left opperand. -/// @param[in] right The right opperand. +/// @param[in] left The left operand. +/// @param[in] right The right operand. /// @returns pow(left, right) //------------------------------------------------------------------------------ graph_node graph_pow(STRUCT_TAG graph_c_context *c, @@ -1016,7 +1016,7 @@ extern "C" { /// @brief Create imaginary error function node. /// /// @param[in] c The graph C context. -/// @param[in] arg The left opperand. +/// @param[in] arg The left operand. /// @returns erfi(arg) //------------------------------------------------------------------------------ graph_node graph_erfi(STRUCT_TAG graph_c_context *c, @@ -1062,7 +1062,7 @@ extern "C" { /// @brief Create sine node. /// /// @param[in] c The graph C context. -/// @param[in] arg The left opperand. +/// @param[in] arg The left operand. /// @returns sin(arg) //------------------------------------------------------------------------------ graph_node graph_sin(STRUCT_TAG graph_c_context *c, @@ -1126,7 +1126,7 @@ extern "C" { /// @brief Create cosine node. /// /// @param[in] c The graph C context. -/// @param[in] arg The left opperand. +/// @param[in] arg The left operand. /// @returns cos(arg) //------------------------------------------------------------------------------ graph_node graph_cos(STRUCT_TAG graph_c_context *c, @@ -1190,8 +1190,8 @@ extern "C" { /// @brief Create arctangent node. /// /// @param[in] c The graph C context. -/// @param[in] left The left opperand. -/// @param[in] right The right opperand. +/// @param[in] left The left operand. +/// @param[in] right The right operand. /// @returns atan(left, right) //------------------------------------------------------------------------------ graph_node graph_atan(STRUCT_TAG graph_c_context *c, @@ -2461,7 +2461,7 @@ extern "C" { /// @param[in] random_state Optional random state, can be NULL if not used. /// @param[in] name Name for the kernel. /// @param[in] size Number of elements to operate on. -/// @param[in] tol Tolarance to converge the function to. +/// @param[in] tol Tolerance to converge the function to. /// @param[in] max_iter Maximum number of iterations before giving up. //------------------------------------------------------------------------------ void graph_add_converge_item(STRUCT_TAG graph_c_context *c, diff --git a/graph_c_binding/graph_c_binding.h b/graph_c_binding/graph_c_binding.h index 3736ed61f6d49832b0b4067a2a4b4cb32a529e92..8de6ddefea7872ab03210660f82d33647f808b31 100644 --- a/graph_c_binding/graph_c_binding.h +++ b/graph_c_binding/graph_c_binding.h @@ -8,9 +8,10 @@ /// @tableofcontents /// /// @section graph_c_binding_into Introduction -/// This section assumes the reader is already familar with developing C codes. -/// The simplist method to link framework code into a C code is to create a C++ -/// function with @code extern "C" @endcode First create a header file +/// This section assumes the reader is already familiar with developing C +/// codes. The simplest method to link framework code into a C code is to +/// create a C++ function with @code extern "C" @endcode First create a header +/// file /// c_callable.h /// @code /// extern "C" { @@ -20,7 +21,7 @@ /// /// Next create a source file c_callable.c and add the /// framework. This example uses the equation of a line example from the -/// @ref tutorial_workflow "making workflows" turorial. +/// @ref tutorial_workflow "making workflows" tutorial. /// @code /// // Include the necessary framework headers. /// @@ -62,8 +63,8 @@ /// @section graph_c_binding_interface C Binding Interface /// An alternative is to use the @ref graph_c_binding.h "C Language interface". /// The C binding interface can be enabled as one of the cmake -/// @ref build_system_user_options "conifgure options". As an example, we will -/// convert the @ref tutorial_workflow "making workflows" turorial to use the +/// @ref build_system_user_options "configure options". As an example, we will +/// convert the @ref tutorial_workflow "making workflows" tutorial to use the /// C language bindings. /// @code /// #include @@ -171,7 +172,7 @@ extern "C" { /// /// @param[in] type Base type. /// @param[in] use_safe_math Control is safe math is used. -/// @returns A contructed C context. +/// @returns A constructed C context. //------------------------------------------------------------------------------ STRUCT_TAG graph_c_context *graph_construct_context(const enum graph_type type, const bool use_safe_math); @@ -252,8 +253,8 @@ extern "C" { /// @brief Create Addition node. /// /// @param[in] c The graph C context. -/// @param[in] left The left opperand. -/// @param[in] right The right opperand. +/// @param[in] left The left operand. +/// @param[in] right The right operand. /// @returns left + right //------------------------------------------------------------------------------ graph_node graph_add(STRUCT_TAG graph_c_context *c, @@ -261,11 +262,11 @@ extern "C" { graph_node right); //------------------------------------------------------------------------------ -/// @brief Create Substract node. +/// @brief Create Subtract node. /// /// @param[in] c The graph C context. -/// @param[in] left The left opperand. -/// @param[in] right The right opperand. +/// @param[in] left The left operand. +/// @param[in] right The right operand. /// @returns left - right //------------------------------------------------------------------------------ graph_node graph_sub(STRUCT_TAG graph_c_context *c, @@ -276,8 +277,8 @@ extern "C" { /// @brief Create Multiply node. /// /// @param[in] c The graph C context. -/// @param[in] left The left opperand. -/// @param[in] right The right opperand. +/// @param[in] left The left operand. +/// @param[in] right The right operand. /// @returns left*right //------------------------------------------------------------------------------ graph_node graph_mul(STRUCT_TAG graph_c_context *c, @@ -288,8 +289,8 @@ extern "C" { /// @brief Create Divide node. /// /// @param[in] c The graph C context. -/// @param[in] left The left opperand. -/// @param[in] right The right opperand. +/// @param[in] left The left operand. +/// @param[in] right The right operand. /// @returns left/right //------------------------------------------------------------------------------ graph_node graph_div(STRUCT_TAG graph_c_context *c, @@ -330,8 +331,8 @@ extern "C" { /// @brief Create Pow node. /// /// @param[in] c The graph C context. -/// @param[in] left The left opperand. -/// @param[in] right The right opperand. +/// @param[in] left The left operand. +/// @param[in] right The right operand. /// @returns pow(left, right) //------------------------------------------------------------------------------ graph_node graph_pow(STRUCT_TAG graph_c_context *c, @@ -372,8 +373,8 @@ extern "C" { /// @brief Create arctangent node. /// /// @param[in] c The graph C context. -/// @param[in] left The left opperand. -/// @param[in] right The right opperand. +/// @param[in] left The left operand. +/// @param[in] right The right operand. /// @returns atan(left, right) //------------------------------------------------------------------------------ graph_node graph_atan(STRUCT_TAG graph_c_context *c, @@ -384,7 +385,7 @@ extern "C" { /// @brief Construct a random state node. /// /// @param[in] c The graph C context. -/// @param[in] seed Intial random seed. +/// @param[in] seed Initial random seed. /// @returns A random state node. //------------------------------------------------------------------------------ graph_node graph_random_state(STRUCT_TAG graph_c_context *c, @@ -523,7 +524,7 @@ extern "C" { /// @param[in] random_state Optional random state, can be NULL if not used. /// @param[in] name Name for the kernel. /// @param[in] size Number of elements to operate on. -/// @param[in] tol Tolarance to converge the function to. +/// @param[in] tol Tolerance to converge the function to. /// @param[in] max_iter Maximum number of iterations before giving up. //------------------------------------------------------------------------------ void graph_add_converge_item(STRUCT_TAG graph_c_context *c, diff --git a/graph_docs/compiling.dox b/graph_docs/compiling.dox index 36d8d4efb50c6cdb4dffdd4111068ecc2b4b38b4..7a59da96472f6d1e5ebbd37feccb95d9414e4510 100644 --- a/graph_docs/compiling.dox +++ b/graph_docs/compiling.dox @@ -12,10 +12,10 @@ * The following section is for users of the framework. * * @subsection build_system_user_dependencies Dependencies - * The graph_framwork requires three external dependencies and one optional + * The graph_framework requires three external dependencies and one optional * dependency. LLVM is another dependency that is * used for generating CPU code. However this is automatically obtained via the - * build system. The graph_frame is written using the + * build system. The graph_framework is written using the * C++20 standard. The * C interface uses * C17 @@ -49,7 +49,7 @@ @endcode * There are two ways to run cmake. From the command line the build system can * generated by using the cmake command with options set using the - * the -D option. As an exampole. + * the -D option. As an example. * @code cmake -DOPTION_NAME=OPTION_VALUE ../ @endcode @@ -65,16 +65,16 @@ * -D option. * * @subsubsection build_system_user_options Build system Options - * Initially, there will be no options. Along the botton, there are several - * commands. Use the 'c' command to start the configuation process. Once - * configured several options will apear. During this process cmake is cloning - * the LLVM repository. So this step may take some time initally. Most of the - * are various options for configuing LLVM and can be ignored. The important + * Initially, there will be no options. Along the bottom, there are several + * commands. Use the 'c' command to start the configuration process. Once + * configured several options will appear. During this process cmake is cloning + * the LLVM repository. So this step may take some time initially. Most of the + * are various options for configuring LLVM and can be ignored. The important * options are listed below. * * * - *
Build options for users.
Option Discrption + *
Option Discretion *
CMAKE_BUILD_TYPE Switch between * * Release * * Debug @@ -92,7 +92,7 @@ * @note macOS users will need to change the default option for * CMAKE_CXX_COMPILER to clang++. This is due to the way the * build systems determines default include directories for system libraries. - * This can be accomplished using the advacned options accessed from the t + * This can be accomplished using the advanced options accessed from the t * command or setting this via the command line. * @code cmake -DCMAKE_CXX_COMPILER=clang++ ../ @@ -123,7 +123,7 @@ make -j10 @endcode * The -jnum_processes option determines number of parallel - * instances to run. The build products will be found in assocated directories + * instances to run. The build products will be found in associated directories * in the build directory. * * A list of individual components which can be built can be identified using @@ -145,7 +145,7 @@ * * @subsection build_system_macros Macro Definitions * The build system defines some macros for defining targets, configuring debug - * options, and configuing external dependences. + * options, and configuring external dependences. * * @subsubsection build_system_targets Tool targets * @@ -154,7 +154,7 @@ * Define a tool target.\n\n * Parameters\n * [in] target The name of the target.\n - * [in] lang File extention for the target (c, cpp, f90).\n\n + * [in] lang File extension for the target (c, cpp, f90).\n\n * Target assumes there is a source file defined as target.lang. For * instance a C++ source file named foo.cpp is configured as * @code @@ -167,12 +167,12 @@ * Define a test target.\n\n * Parameters\n * [in] target The name of the target.\n - * [in] lang File extention for the target (c, cpp, f90).\n\n - * The aguments are the same as add_tool_target. This also adds the + * [in] lang File extension for the target (c, cpp, f90).\n\n + * The arguments are the same as add_tool_target. This also adds the * target as a unit test. *
* - * @subsubsection build_system_sanitizer Sanatizer flags + * @subsubsection build_system_sanitizer Sanitizer flags * *
* register_sanitizer_option(name)\n\n @@ -198,7 +198,7 @@ * dir. This also adds a new build option for * BUILD_TAG_DIR. The URL must have the format of * @code - ${URL_PROTO}domain.com${URL_SEP}remining/url + ${URL_PROTO}domain.com${URL_SEP}remaining/url @endcode *
* @@ -209,13 +209,13 @@ * @subsubsection build_system_dev_options Build System Options * * - *
Build options for developers.
Option Discription + *
Option Description *
USE_PCH Use precompiled headers during computation. Most users should keep this on. *
SAVE_KERNEL_SOURCE Option to dump the generated compute kernel source code to disk. *
USE_INPUT_CACHE Option to cache registers for the kernel arguments. *
USE_CONSTANT_CACHE Option to use registers to cache constant values otherwise constants are inlined. *
SHOW_USE_COUNT Generates information on the number of times a register is used. - *
USE_INDEX_CACHE Option to use registers to cache array indicies. + *
USE_INDEX_CACHE Option to use registers to cache array indices. *
Sanitizer Flags *
SANITIZE_ADDRESS Use address sanitizer debugging option. *
SANITIZE_LEAK Use leak sanitizer debugging option. diff --git a/graph_docs/general.dox b/graph_docs/general.dox index 3e72d2120a11bcc1a13b2683129827e16bd44bbe..78dc5299bb58f1c913e6033e75940fbd814ec28c 100644 --- a/graph_docs/general.dox +++ b/graph_docs/general.dox @@ -7,10 +7,10 @@ * * @section general_concepts_definitions Definitions * - * + * *
Glossery of termsGlossary of terms
Concept Definition *
node A leaf or branch on the graph tree. - *
graph A data stucture connecting nodes. + *
graph A data structure connecting nodes. *
reduce A transformation of the graph to remove leaf_nodes. *
auto differentiationA transformation of the graph build derivatives. *
compiler A tool for translating from one language to another. @@ -32,16 +32,16 @@ * @section general_concepts_graph Graph * The graph_framework operates by building a tree structure of math operations. * For an example of building expression structures see the - * @ref tutorial_expression "basic expressions tutroial". In tree form it is + * @ref tutorial_expression "basic expressions tutorial". In tree form it is * easy to traverse nodes in the graph. Take the example of equation of a line. * @f{equation}{y=mx + b@f} - * This equation consists of five nodes. The ends of the tree are clasified + * This equation consists of five nodes. The ends of the tree are classified * as either variables @f$x@f$ or constants @f$m,b@f$. These nodes are connected * by nodes for multiply and addition operations. The output @f$y@f$ represents * the entire graph of operations. - * @image{} html line_graph.png "The graph stucture for y = mx + b." + * @image{} html line_graph.png "The graph structure for y = mx + b." * Evaluation of graphs start from the top most node in this case the @f$+@f$ - * operation. Evaluation of a node is not performed until all subnodes are + * operation. Evaluation of a node is not performed until all sub-nodes are * evaluated starting with the left operand. Evaluation starts by recursively * evaluating the left operands until the last node is reached @f$m@f$. * @image{} html line_graph_eval1.png "" @@ -56,7 +56,7 @@ * From the previous @ref general_concepts_graph "section", it was shown how * graphs can be evaluated. This same evaluation can be applied to build * graphs of a function derivative. For an example of taking derivatives see the - * @ref tutorial_derivatives "auto differentiation tutroial". Lets say that we + * @ref tutorial_derivatives "auto differentiation tutorial". Lets say that we * want to take the derivative of @f$\frac{\partial y}{\partial x}@f$. This is * achieved by evaluating the until bottom left most node is reached. Then a new * graph is build starting with @f$\frac{\partial m}{\partial x}=0@f$. Applying @@ -72,7 +72,7 @@ * @section general_concepts_reduction Reduction * The final expression for @f$\frac{\partial y}{\partial x}@f$ contains many * unnecessary nodes in the graph. Instead of building full graphs, we can - * simplify and eleminate nodes as we build them. For instance, when the + * simplify and eliminate nodes as we build them. For instance, when the * expression @f$0x@f$ this created can be immediately reduce it to a single * node. * @image{} html line_graph_reduce1.png "" @@ -85,12 +85,12 @@ * @section general_concepts_compile Compile * Once graph expressions are built, they can be compiled to a compute kernel. * For an example of compiling expression trees into kernels see the - * @ref tutorial_workflow "workflow tutroial". + * @ref tutorial_workflow "workflow tutorial". * Using the same recursive evaluation, we can visit each node of a graph and * and create a line of kernel source code. There are three important parts for * creating kernels, inputs, outputs, and maps. These three concepts define * buffers on the compute device and how they are changed. Compute kernels can - * be genereted from multiple outputs and maps. + * be generated from multiple outputs and maps. * * @subsection general_concepts_compile_inputs Inputs * Inputs are the variable nodes that define the graph inputs. In the line @@ -102,13 +102,13 @@ * @subsection general_concepts_compile_outputs Outputs * Outputs are the ends of the nodes. These are the values we want to compute. * Any node of a graph can be a potential output. For each output a device - * buffer is generated to store the results of the evalutaion. For nodes that + * buffer is generated to store the results of the evaluation. For nodes that * are not used as outputs, no buffers need to be created since those results * are never stored. * * @subsection general_concepts_compile_maps Maps * Maps enable the results of an output node to be stored in an input node. This - * is use for a wide varity of steps. For instance take a gradient decent step. + * is used for a wide varity of cases. For instance take a gradient decent step. * @f{equation}{y = y + \frac{\partial f}{\partial x}@f} * In this case the output of the expression * @f$y + \frac{\partial f}{\partial x}@f$ @@ -117,13 +117,13 @@ *
* @section general_concepts_workflow Workflows * Sequences of kernels are evaluated in workflow. A workflow is defined from - * workitems which wrap a kernel call. + * work items which wrap a kernel call. * *
* @section general_concepts_safe_math Safe Math * There are some conditions where mathematically, a graph should evaluate to a - * normal number. However, when evaluted suing floating point precison, can lead - * to Inf or NaN. An example of this the + * normal number. However, when evaluated suing floating point precision, can + * lead to Inf or NaN. An example of this the * @f$\exp\left(x\right)@f$ function. For large argument values, * @f$\exp\left(x\right)@f$ overflows the maximum floating point precision and * returns Inf. @f$\frac{1}{\exp\left(x\right)}@f$ should evaluate diff --git a/graph_docs/main.dox b/graph_docs/main.dox index 2e311c18695d915e4942406b3058cd78ab4b50ed..0490d41fd9f6fe8861d177e253ffeabaf1e39755 100644 --- a/graph_docs/main.dox +++ b/graph_docs/main.dox @@ -5,8 +5,8 @@ * The graph_framework * is a domain specific compiler for translating physics equations to optimized * code that runs on GPUs and CPUs. The domain specific aspect limits this to - * classes of problems where the same physics is applied to an ensemble. Eamples - * include RF Ray tracing, particle pushing, and field line following. + * classes of problems where the same physics is applied to an ensemble. + * Examples include RF Ray tracing, particle pushing, and field line following. * * @subsection purpose Purpose * The purpose of this framework is to enable domain scientists to write code @@ -23,10 +23,10 @@ * @subsection rf_ray_tracing RF Ray tracing * This section covers user guides to run the RF Ray tracing code. To run this * code, a user selects an equilibrium, a wave distribution function, a solver - * method, intial ray conditions, and a power obsorption model. To run an + * method, initial ray conditions, and a power absorption model. To run an * example follow the instructions for the @ref xrays_commandline_example. * - * * @ref equilibrum_models + * * @ref equilibrium_models * * @ref dispersion_function * * @ref solvers * * @ref absorption_model @@ -49,7 +49,7 @@ * * @subsection framework_developer_tools Developer guide for RF Ray Tracing * * @ref code_structure_xrays "Code Structure" - * * @ref equilibrum_devel + * * @ref equilibrium_devel * * @ref dispersion_function_devel * * @ref solvers_devel * * @ref absorption_model_devel diff --git a/graph_docs/tutorial.dox b/graph_docs/tutorial.dox index f3a48d68490e8cad01b284c2500eacee787f58de..a59329ff38301e991deb015f43927bc020b27052 100644 --- a/graph_docs/tutorial.dox +++ b/graph_docs/tutorial.dox @@ -20,7 +20,7 @@ int main(int argc, const char * argv[]) { (void)argc; (void)argv; -// Insert code here. No code should be commited to this file beyond this +// Insert code here. No code should be committed to this file beyond this // template. END_GPU @@ -57,7 +57,7 @@ int main(int argc, const char * argv[]) { * The graph_framework is built around applying the same equations to a large * ensemble. Ensembles are defined from variables. All variables need to have * same dimensionality. To create a variable we use one of the variable factory - * methods. For now we will build it without initalizing it. + * methods. For now we will build it without initializing it. * @code template void run_tutorial() { @@ -98,7 +98,7 @@ void run_tutorial() { } @endcode * An explicit @ref graph::constant_node is created for m while an - * impicit constant was defined for b. Note in the implicit case, the + * implicit constant was defined for b. Note in the implicit case, the * actual node for b is not created until we use it in an expression. * *
@@ -185,7 +185,7 @@ void run_tutorial() { @endcode * This creates a workflow for device 0. * - * To create a kernal, we add a @ref workflow::work_item using the + * To create a kernel, we add a @ref workflow::work_item using the * @ref workflow::manager::add_item method. * @code workflow::manager work(0); @@ -255,7 +255,7 @@ work.print(2, {x, y, dydx}); 0 0.6 0.4 @endcode * showing that the device dose not have the updated values. To set values from - * the host. You need to explicity copy from a host buffer to a device buffer + * the host. You need to explicitly copy from a host buffer to a device buffer * using the @ref workflow::manager::copy_to_device method. * @code work.copy_to_device(x, std::array ({1.0, 2.0, 3.0}).data()); @@ -294,7 +294,7 @@ for (size_t i = 0; i < 10; i++) { work.print(1, {x}); } @endcode - * Running this code shows the value of x continously updating. + * Running this code shows the value of x continuously updating. * @code 1.4 1.16 @@ -347,7 +347,7 @@ void run_tutorial() { max = std::max(max, r*r); } std::cout << max << std::endl; - } while (max > 1.0E-10); + } while (max > 1.0E-14); work.print(0, {x}); work.print(1, {x}); work.print(2, {x}); @@ -368,9 +368,9 @@ void run_tutorial() { -2.6006 @endcode * - * However there are some things that are not optimial here. We are performing - * a reduction on the host side and transfering the entire array to the host. To - * improve this we can use a converge item instead. + * However there are some things that are not optimal here. We are performing + * a reduction on the host side and transferring the entire array to the host. + * To improve this we can use a converge item instead. * @code // Create a workflow manager. workflow::manager work(0); diff --git a/graph_driver/xrays.cpp b/graph_driver/xrays.cpp index 347d67e66413f7111f31f3eabc13bcc9ca68ec85..3b5808c8cd37830398c7ef4cf07150e715d1cb6d 100644 --- a/graph_driver/xrays.cpp +++ b/graph_driver/xrays.cpp @@ -42,7 +42,7 @@ std::normal_distribution> set_distribution(const std::complex } //------------------------------------------------------------------------------ -/// @brief Initalize value. +/// @brief Initialize value. /// /// @tparam T Base type of the calculation. /// @tparam SAFE_MATH Use @ref general_concepts_safe_math operations. @@ -149,7 +149,7 @@ void set_xy_variables(const commandline::parser &cl, /// @param[in] y Initial position in y direction. /// @param[in] z Initial position in z direction. /// @param[in] t Initial position in t direction. -/// @param[in] dt Inital dt. +/// @param[in] dt Initial dt. /// @param[in] eq Equilibrium object. /// @param[in] num_steps Equilibrium object. /// @param[in] sub_steps Equilibrium object. @@ -218,7 +218,7 @@ void run_solver(const commandline::parser &cl, std::cout << std::endl; solve.print_dzdt(); std::cout << std::endl; - solve.print_residule(); + solve.print_residual(); std::cout << std::endl; solve.print_x_next(); std::cout << std::endl; @@ -260,7 +260,7 @@ void run_solver(const commandline::parser &cl, } //------------------------------------------------------------------------------ -/// @brief Run Disperison +/// @brief Run Dispersion /// /// @tparam DISPERSION_FUNCTION The dispersion method. /// @@ -273,7 +273,7 @@ void run_solver(const commandline::parser &cl, /// @param[in] y Initial position in y direction. /// @param[in] z Initial position in z direction. /// @param[in] t Initial position in t direction. -/// @param[in] dt Inital dt. +/// @param[in] dt Initial dt. /// @param[in] eq Equilibrium object. /// @param[in] num_steps Equilibrium object. /// @param[in] sub_steps Equilibrium object. @@ -364,7 +364,7 @@ void run_dispersion(const commandline::parser &cl, } //------------------------------------------------------------------------------ -/// @brief Make an equilibrum. +/// @brief Make an equilibrium. /// /// @tparam T Base type of the calculation. /// @tparam SAFE_MATH Use @ref general_concepts_safe_math operations. @@ -406,7 +406,7 @@ std::mt19937_64 make_engine(const commandline::parser &cl, /// /// @param[in] cl Parsed commandline. /// @param[in] num_times Total number of time steps. -/// @param[in] sub_steps Number of substeps to push the rays. +/// @param[in] sub_steps Number of sub-steps to push the rays. /// @param[in] num_rays Number of rays to trace. //------------------------------------------------------------------------------ template @@ -444,7 +444,7 @@ void trace_ray(const commandline::parser &cl, t->set(static_cast (0.0)); -// Inital conditions. +// Initial conditions. set_variable(cl, omega, "w", engine, local_num_rays); set_variable(cl, kx, "kx", engine, local_num_rays); set_variable(cl, ky, "ky", engine, local_num_rays); @@ -531,7 +531,7 @@ void trace_ray(const commandline::parser &cl, //------------------------------------------------------------------------------ /// @brief Run absorption model. /// -/// @tparam ABSORPTION_MODEL Absoption model to use. +/// @tparam ABSORPTION_MODEL Absorption model to use. /// /// @param[in] cl Parsed commandline. /// @param[in] kamp Wave number amplitude. @@ -592,7 +592,7 @@ void run_absorption(const commandline::parser &cl, /// /// @param[in] cl Parsed commandline. /// @param[in] num_times Total number of time steps. -/// @param[in] sub_steps Number of substeps to push the rays. +/// @param[in] sub_steps Number of sub-steps to push the rays. /// @param[in] num_rays Number of rays to trace. //------------------------------------------------------------------------------ template @@ -667,7 +667,7 @@ void calculate_power(const commandline::parser &cl, /// /// @param[in] cl Parsed commandline. /// @param[in] num_times Total number of time steps. -/// @param[in] sub_steps Number of substeps to push the rays. +/// @param[in] sub_steps Number of sub-steps to push the rays. /// @param[in] num_rays Number of rays to trace. //------------------------------------------------------------------------------ template @@ -806,7 +806,7 @@ void bin_power(const commandline::parser &cl, /// /// @section xrays_commandline_args Command Options /// -///
Command Values Discription +///
Command Values Description ///
General Options ///
@code --help @endcode Display help text ///
@code --verbose @endcode Show verbose output about kernel information. @@ -815,7 +815,7 @@ void bin_power(const commandline::parser &cl, ///
@code --seed @endcode Use a fixed random seed. ///
Control Options ///
@code --num_times @endcode Positive Integer Total number of time steps to run. -///
@code --sub_steps @endcode Positive Integer Number of steps to run between outputs. +///
@code --sub_steps @endcode Positive Integer Number of steps to run between outputs. ///
@code --num_rays @endcode Positive Integer Total number rays to run. ///
@code --endtime @endcode Positive Number Total time to trace the ray to. ///
Ray Initialization Options @@ -857,21 +857,21 @@ void bin_power(const commandline::parser &cl, /// * normal Distribution function for ray z position. ///
@code --init_z_mean @endcode Positive Number Mean value for the ray z position distribution function. ///
@code --init_z_sigma @endcode Positive Number Standard deviation of for the ray z position distribution function. -///
@code --use_cyl_xy @endcode Use cylindical coordinates for x and y. +///
@code --use_cyl_xy @endcode Use cylindrical coordinates for x and y. ///
Ray Tracing Physics Options ///
@code --equilibrium @endcode -/// * @ref equilibrum_efit "efit" -/// * @ref equilibrum_vmec "vmec" Equilibrium to use. -///
@code --equilibrium_file @endcode Path to @ref equilibrum_models "equilibrium file" Equilibrium file path. +/// * @ref equilibrium_efit "efit" +/// * @ref equilibrium_vmec "vmec" Equilibrium to use. +///
@code --equilibrium_file @endcode Path to @ref equilibrium_models "equilibrium file" Equilibrium file path. ///
@code --dispersion @endcode /// * @ref dispersion_function_simple "simple" /// * @ref dispersion_function_bohm_gross "bohm_gross" /// * @ref dispersion_function_o_wave "ordinary_wave" /// * @ref dispersion_function_x_wave "extra_ordinary_wave" -/// * @ref dispersion_function_cold_plasma "code_plasma" Wave disperion function to trace rays from. +/// * @ref dispersion_function_cold_plasma "code_plasma" Wave dispersion function to trace rays from. ///
@code --absorption_model @endcode /// * @ref absorption_model_root "root_find" -/// * @ref absorption_model_root "weak_damping" Power absoption model to use. +/// * @ref absorption_model_root "weak_damping" Power absorption model to use. ///
@code --solver @endcode /// * @ref solvers_split_simplextic "split_simplextic" /// * @ref solvers_rk2 "rk2" @@ -907,14 +907,14 @@ void bin_power(const commandline::parser &cl, ///
@f$t @f$ 2.0 @f$2.0c @f$ @f$s @f$ ///
/// -/// @subsection xrays_commandline_example_dist Ray intialization. +/// @subsection xrays_commandline_example_dist Ray initialization. /// @code /// --init_x_mean=2.5 --init_y_dist=normal --init_y_mean=0.0 --init_y_sigma=0.05 --init_z_dist=normal --init_z_mean=0.0 --init_z_sigma=0.05 --use_cyl_xy /// @endcode -/// Inital values for the position for @f$y @f$ and @f$z @f$ will be sampled -/// from a normal distribution fuction. Both values have a mean of zero and as -/// standard devation of 0.05. @f$x @f$ is initalized with a uniform value of -/// 2.5. We also set the command to use cylindical coordinates. So +/// Initial values for the position for @f$y @f$ and @f$z @f$ will be sampled +/// from a normal distribution function. Both values have a mean of zero and as +/// standard deviation of 0.05. @f$x @f$ is initialized with a uniform value of +/// 2.5. We also set the command to use cylindrical coordinates. So /// @f$xyz\rightarrow r\phi z @f$. /// /// @code @@ -926,8 +926,8 @@ void bin_power(const commandline::parser &cl, /// @code /// --init_kx --init_kx_mean=-700.0 --init_ky_dist=normal --init_ky_mean=-100.0 --init_ky_sigma=10.0 --init_kz_dist=normal --init_kz_mean=0.0 --init_kz_sigma=10.0 /// @endcode -/// Inital values for @f$k_{y}@f$ and @f$k_{z}@f$ will be sampled from a normal -/// distribution fuction. Both of them have a standard deviation of 10. +/// Initial values for @f$k_{y}@f$ and @f$k_{z}@f$ will be sampled from a normal +/// distribution function. Both of them have a standard deviation of 10. /// @f$k_{y}@f$ has a mean of -100 and @f$k_{z}@f$ has zero mean. /// @f$k_{x}@f$ uses the default uniform value of -700.0. However, it is /// configured to solve for @f$k_{x}@f$ which satisfies the dispersion function @@ -937,8 +937,8 @@ void bin_power(const commandline::parser &cl, /// @code /// --equilibrium=efit --equilibrium_file=../graph_tests/efit.nc /// @endcode -/// We are using a @ref equilibrum_efit "EFIT" equilibirum with values -/// initalized from ../graph_tests/efit.nc. +/// We are using a @ref equilibrium_efit "EFIT" equilibrium with values +/// initialized from ../graph_tests/efit.nc. /// /// @code /// --absorption_model=weak_damping --dispersion=ordinary_wave --solver=rk4 @@ -967,7 +967,7 @@ commandline::parser parse_commandline(int argc, const char * argv[]) { "rk4", "adaptive_rk4" }); - cl.add_option("dispersion", true, "Wave disperion function to trace rays from.", { + cl.add_option("dispersion", true, "Wave dispersion function to trace rays from.", { "simple", "bohm_gross", "ordinary_wave", @@ -978,7 +978,7 @@ commandline::parser parse_commandline(int argc, const char * argv[]) { "efit", "vmec" }); - cl.add_option("equilibrium_file", true, "File to read the equilibrum from."); + cl.add_option("equilibrium_file", true, "File to read the equilibrium from."); cl.add_option("init_w_dist", true, "Distribution function for wave frequency.", { "uniform", "normal" @@ -999,7 +999,7 @@ commandline::parser parse_commandline(int argc, const char * argv[]) { cl.add_option("init_ky", false, "Solve for initial wave number in the y direction position."); cl.add_option("init_ky_mean", true, "Mean value for the wave number in they direction distribution function."); cl.add_option("init_ky_sigma", true, "Standard deviation of for the wave number in the y direction distribution function."); - cl.add_option("init_kz_dist", true, "Inital kz distribution.", { + cl.add_option("init_kz_dist", true, "Initial kz distribution.", { "uniform", "normal" }); @@ -1024,8 +1024,8 @@ commandline::parser parse_commandline(int argc, const char * argv[]) { }); cl.add_option("init_z_mean", true, "Mean value for the ray z position distribution function."); cl.add_option("init_z_sigma", true, "Standard deviation of for the ray z position distribution function."); - cl.add_option("use_cyl_xy", false, "Use cylindical coordinates for x and y."); - cl.add_option("absorption_model", true, "Power absoption model to use.", { + cl.add_option("use_cyl_xy", false, "Use cylindrical coordinates for x and y."); + cl.add_option("absorption_model", true, "Power absorption model to use.", { "root_find", "weak_damping" }); @@ -1054,20 +1054,20 @@ commandline::parser parse_commandline(int argc, const char * argv[]) { /// /// ///
Result file quantities
Dimensions -///
Name Discription +///
Name Description ///
time Size of time dimension. ///
num_rays Local number of rays for the device. -///
ray_dim Size of the dimension for quanties. (1 Real, 2 Complex) +///
ray_dim Size of the dimension for quantities. (1 Real, 2 Complex) ///
ray_dim_cplx Size of the dimension for complex quantities (Real, Imagine). -///
2D Qantities -///
Name Dimensions Discription +///
2D Quantities +///
Name Dimensions Description ///
d_power (time,num_rays,ray_dim) Change in power. ///
kamp (time,num_rays,ray_dim_cplx)@f$\sqrt{\vec{k}\cdot\vec{k}}@f$ ///
kx (time,num_rays,ray_dim) Wave number in @f$\hat{x}@f$ direction. ///
ky (time,num_rays,ray_dim) Wave number in @f$\hat{y}@f$ direction. ///
kz (time,num_rays,ray_dim) Wave number in @f$\hat{z}@f$ direction. ///
power (time,num_rays,ray_dim) Wave power. -///
residule(time,num_rays,ray_dim) Dispersion function residule. +///
residual(time,num_rays,ray_dim) Dispersion function residual. ///
time (time,num_rays,ray_dim) Time ///
w (time,num_rays,ray_dim) Wave frequency. ///
x (time,num_rays,ray_dim) Position in @f$\hat{x}@f$ direction. diff --git a/graph_fortran_binding/graph_fortran_binding.f90 b/graph_fortran_binding/graph_fortran_binding.f90 index 183b4e11b0202010f4f17aab4f2eb2385dc00296..c34de7cee3bf2bb8ec64b1f048b44f28d5683e10 100644 --- a/graph_fortran_binding/graph_fortran_binding.f90 +++ b/graph_fortran_binding/graph_fortran_binding.f90 @@ -1,15 +1,15 @@ !------------------------------------------------------------------------------- !> @file graph_fortran_binding.f90 -!> @brief Implimentation of the Fortran binding library. +!> @brief Implementation of the Fortran binding library. !------------------------------------------------------------------------------- !> @page graph_fortran_binding Embedding in Fortran code !> @brief Documentation for linking into a Fortran code base. !> @tableofcontents !> !> @section graph_fortran_binding_into Introduction -!> This section assumes the reader is already familar with developing Fortran -!> codes. The simplist method is to create a C callable function like the -!> @ref graph_c_binding_into "C binding exmaple". Then create a Fortran +!> This section assumes the reader is already familiar with developing Fortran +!> codes. The simplest method is to create a C callable function like the +!> @ref graph_c_binding_into "C binding example". Then create a Fortran !> interface for it. !> @code !> INTERFACE @@ -29,8 +29,8 @@ !> An alternative is to use the !> @ref graph_fortran "Fortran Language interface". The Fortran binding !> interface can be enabled as one of the cmake -!> @ref build_system_user_options "conifgure options". As an example, we will -!> convert the @ref tutorial_workflow "making workflows" turorial to use the +!> @ref build_system_user_options "configure options". As an example, we will +!> convert the @ref tutorial_workflow "making workflows" tutorial to use the !> Fortran language bindings. !> @code !> SUBROUTINE fortran_binding @@ -374,8 +374,8 @@ !> @brief Create Addition node. !> !> @param[in] c The graph C context. -!> @param[in] left The left opperand. -!> @param[in] right The right opperand. +!> @param[in] left The left operand. +!> @param[in] right The right operand. !> @returns left + right !------------------------------------------------------------------------------- TYPE(C_PTR) FUNCTION graph_add(c, left, right) & @@ -388,11 +388,11 @@ END FUNCTION !------------------------------------------------------------------------------- -!> @brief Create Substract node. +!> @brief Create Subtract node. !> !> @param[in] c The graph C context. -!> @param[in] left The left opperand. -!> @param[in] right The right opperand. +!> @param[in] left The left operand. +!> @param[in] right The right operand. !> @returns left - right !------------------------------------------------------------------------------- TYPE(C_PTR) FUNCTION graph_sub(c, left, right) & @@ -408,8 +408,8 @@ !> @brief Create Multiply node. !> !> @param[in] c The graph C context. -!> @param[in] left The left opperand. -!> @param[in] right The right opperand. +!> @param[in] left The left operand. +!> @param[in] right The right operand. !> @returns left*right !------------------------------------------------------------------------------- TYPE(C_PTR) FUNCTION graph_mul(c, left, right) & @@ -425,8 +425,8 @@ !> @brief Create Divide node. !> !> @param[in] c The graph C context. -!> @param[in] left The left opperand. -!> @param[in] right The right opperand. +!> @param[in] left The left operand. +!> @param[in] right The right operand. !> @returns left/right !------------------------------------------------------------------------------- TYPE(C_PTR) FUNCTION graph_div(c, left, right) & @@ -487,8 +487,8 @@ !> @brief Create pow node. !> !> @param[in] c The graph C context. -!> @param[in] left The left opperand. -!> @param[in] right The right opperand. +!> @param[in] left The left operand. +!> @param[in] right The right operand. !> @returns pow(left, right) !------------------------------------------------------------------------------- TYPE(C_PTR) FUNCTION graph_pow(c, left, right) & @@ -549,8 +549,8 @@ !> @brief Create atan node. !> !> @param[in] c The graph C context. -!> @param[in] left The left opperand. -!> @param[in] right The right opperand. +!> @param[in] left The left operand. +!> @param[in] right The right operand. !> @returns pow(left, right) !------------------------------------------------------------------------------- TYPE(C_PTR) FUNCTION graph_atan(c, left, right) & @@ -566,7 +566,7 @@ !> @brief Construct a random state node. !> !> @param[in] c The graph C context. -!> @param[in] seed Intial random seed. +!> @param[in] seed Initial random seed. !> @returns A random state node. !------------------------------------------------------------------------------- TYPE(C_PTR) FUNCTION graph_random_state(c, seed) & @@ -596,7 +596,7 @@ !> @brief Create 1D piecewise node with complex double buffer. !> !> @param[in] c The graph C context. -!> @param[in] arg The left opperand. +!> @param[in] arg The left operand. !> @param[in] scale Scale factor argument. !> @param[in] offset Offset factor argument. !> @param[in] source Source buffer to fill elements. @@ -761,7 +761,7 @@ !> @param[in] random_state Optional random state, can be NULL if not used. !> @param[in] name Name for the kernel. !> @param[in] num_particles Number of elements to operate on. -!> @param[in] tol Tolarance to converge the function to. +!> @param[in] tol Tolerance to converge the function to. !> @param[in] max_iter Maximum number of iterations before giving up. !------------------------------------------------------------------------------- SUBROUTINE graph_add_converge_item(c, inputs, num_inputs, & @@ -931,7 +931,7 @@ !------------------------------------------------------------------------------- !> @brief Construct a @ref graph_context object with float type. !> -!> Allocate memory for the @ref graph_context and initalize the c context with +!> Allocate memory for the @ref graph_context and initialize the c context with !> a double type. !> !> @param[in] use_safe_math Optional use safe math. @@ -957,7 +957,7 @@ !------------------------------------------------------------------------------- !> @brief Construct a @ref graph_context object with double type. !> -!> Allocate memory for the @ref graph_context and initalize the c context with +!> Allocate memory for the @ref graph_context and initialize the c context with !> a double type. !> !> @param[in] use_safe_math Use safe math. @@ -983,7 +983,7 @@ !------------------------------------------------------------------------------- !> @brief Construct a @ref graph_context object with complex float type. !> -!> Allocate memory for the @ref graph_context and initalize the c context with +!> Allocate memory for the @ref graph_context and initialize the c context with !> a complex float type. !> !> @param[in] use_safe_math Use safe math. @@ -1009,7 +1009,7 @@ !------------------------------------------------------------------------------- !> @brief Construct a @ref graph_context object with complex double type. !> -!> Allocate memory for the @ref graph_context and initalize the c context with +!> Allocate memory for the @ref graph_context and initialize the c context with !> a complex double type. !> !> @param[in] use_safe_math Use safe math. @@ -1038,7 +1038,7 @@ !------------------------------------------------------------------------------- !> @brief Deconstruct a @ref graph_context object. !> -!> Deallocate memory and unitialize a @ref graph_context object. +!> Deallocate memory and initialize a @ref graph_context object. !> !> @param[in,out] this A @ref graph_context instance. !------------------------------------------------------------------------------- @@ -1534,7 +1534,7 @@ !> @brief Get random size. !> !> @param[in,out] this @ref graph_context instance. -!> @param[in] seed Intial random seed. +!> @param[in] seed Initial random seed. !> @returns The random size. !------------------------------------------------------------------------------- FUNCTION graph_context_random_state(this, seed) @@ -1988,7 +1988,7 @@ !> @param[in] random_state Optional random state, can be NULL if not used. !> @param[in] name Name for the kernel. !> @param[in] num_particles Number of elements to operate on. -!> @param[in] tol Maximum tolarance to converge to. +!> @param[in] tol Maximum tolerance to converge to. !> @param[in] max_iter Maximum number of iterations for convergence. !------------------------------------------------------------------------------- SUBROUTINE graph_context_add_converge_item(this, inputs, outputs, & diff --git a/graph_framework/absorption.hpp b/graph_framework/absorption.hpp index d0c01d7af24310564bbd17d19fab6371296fbc66..9002afae9331803ae3a583919afac3d943d850c8 100644 --- a/graph_framework/absorption.hpp +++ b/graph_framework/absorption.hpp @@ -2,11 +2,11 @@ /// @file absorption.hpp /// @brief Base class for an absorption model. /// -/// Defines functions for computing power absorbtion. +/// Defines functions for computing power absorption. //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ -/// @page absorption_model Absoption Models -/// @brief A discription of the models for power absorption. +/// @page absorption_model Absorption Models +/// @brief A description of the models for power absorption. /// @tableofcontents /// /// @section absorption_model_intro Introduction @@ -17,7 +17,7 @@ /// component is. /// ///
-/// @subsection absorption_model_hot Hot Plasma Disperison Function +/// @subsection absorption_model_hot Hot Plasma Dispersion Function /// To do this we now assume a hot plasma dispersion function. /// @f{equation}{D\left(\vec{x},\vec{k},\omega\right)=i\sigma\Gamma_{0}+\Gamma_{1}+\vec{n}_{\perp}\cdot\vec{n}_{\perp}\frac{P\omega}{\omega_{ce}}\left(1+\zeta Z\left(\zeta\right)\right)\left(\Gamma_{2} + \Gamma_{5}F\right)\equiv 0 @f} /// Where @@ -44,8 +44,8 @@ ///
/// @section absorption_model_root Root Find /// One way to solve for the imaginary component is to locate the root of the -/// hot plasma dispersion function using the cold plasma solution as an intial -/// quess. We start by redefining @f$\vec{k}=k_{amp}\hat{k}@f$ now we can solve +/// hot plasma dispersion function using the cold plasma solution as an initial +/// guess. We start by redefining @f$\vec{k}=k_{amp}\hat{k}@f$ now we can solve /// for the complex value of @f$k_{amp}@f$ using a /// @ref solver::newton "Newton method". /// @@ -103,7 +103,7 @@ namespace absorption { // Base class //****************************************************************************** //------------------------------------------------------------------------------ -/// @brief Base class for absoption models. +/// @brief Base class for absorption models. /// /// @tparam T Base type of the calculation. /// @tparam SAFE_MATH Use @ref general_concepts_safe_math operations. @@ -117,7 +117,7 @@ namespace absorption { static constexpr bool safe_math = SAFE_MATH; //------------------------------------------------------------------------------ -/// @brief Compile the workitems. +/// @brief Compile the work items. //------------------------------------------------------------------------------ virtual void compile()=0; @@ -165,8 +165,8 @@ namespace absorption { /// t variable. graph::shared_leaf t; -/// Residule. - graph::shared_leaf residule; +/// Residual. + graph::shared_leaf residual; /// Workflow manager. workflow::manager work; @@ -185,15 +185,15 @@ namespace absorption { //------------------------------------------------------------------------------ /// @brief Constructor for root finding. /// -/// @param[in] kamp Inital kamp. -/// @param[in] w Inital w. -/// @param[in] kx Inital kx. -/// @param[in] ky Inital ky. -/// @param[in] kz Inital kz. -/// @param[in] x Inital x. -/// @param[in] y Inital y. -/// @param[in] z Inital z. -/// @param[in] t Inital t. +/// @param[in] kamp Initial kamp. +/// @param[in] w Initial w. +/// @param[in] kx Initial kx. +/// @param[in] ky Initial ky. +/// @param[in] kz Initial kz. +/// @param[in] x Initial x. +/// @param[in] y Initial y. +/// @param[in] z Initial z. +/// @param[in] t Initial t. /// @param[in] eq The plasma equilibrium. /// @param[in] filename Result filename, empty names will be blank. /// @param[in] index Concurrent index. @@ -278,7 +278,7 @@ namespace absorption { } //------------------------------------------------------------------------------ -/// @brief Compile the workitems. +/// @brief Compile the work items. //------------------------------------------------------------------------------ void compile() { work.compile(); @@ -372,15 +372,15 @@ namespace absorption { //------------------------------------------------------------------------------ /// @brief Constructor for weak damping. /// -/// @param[in] kamp Inital kamp. -/// @param[in] w Inital w. -/// @param[in] kx Inital kx. -/// @param[in] ky Inital ky. -/// @param[in] kz Inital kz. -/// @param[in] x Inital x. -/// @param[in] y Inital y. -/// @param[in] z Inital z. -/// @param[in] t Inital t. +/// @param[in] kamp Initial kamp. +/// @param[in] w Initial w. +/// @param[in] kx Initial kx. +/// @param[in] ky Initial ky. +/// @param[in] kz Initial kz. +/// @param[in] x Initial x. +/// @param[in] y Initial y. +/// @param[in] z Initial z. +/// @param[in] t Initial t. /// @param[in] eq The plasma equilibrium. /// @param[in] filename Result filename, empty names will be blank. /// @param[in] index Concurrent index. @@ -445,7 +445,7 @@ namespace absorption { } //------------------------------------------------------------------------------ -/// @brief Compile the workitems. +/// @brief Compile the work items. //------------------------------------------------------------------------------ void compile() { work.compile(); diff --git a/graph_framework/arithmetic.hpp b/graph_framework/arithmetic.hpp index 7d0d6d34f91c6f4af80983f31aadc97546a1d24d..6d23e3a6befc7698ef4526e16faefd233ffc9fd2 100644 --- a/graph_framework/arithmetic.hpp +++ b/graph_framework/arithmetic.hpp @@ -12,18 +12,18 @@ namespace graph { //------------------------------------------------------------------------------ -/// @brief Check if nodes are constant combineable. +/// @brief Check if nodes are constant combinable. /// /// @tparam T Base type of the nodes. /// @tparam SAFE_MATH Use @ref general_concepts_safe_math operations. /// -/// @param[in] a Opperand A -/// @param[in] b Opperand B +/// @param[in] a Operand A +/// @param[in] b Operand B /// @returns True if a and b are combinable. //------------------------------------------------------------------------------ template - bool is_constant_combineable(shared_leaf a, - shared_leaf b) { + bool is_constant_combinable(shared_leaf a, + shared_leaf b) { if (a->is_constant() && b->is_constant()) { auto a1 = piecewise_1D_cast(a); auto a2 = piecewise_2D_cast(a); @@ -45,9 +45,9 @@ namespace graph { /// @tparam T Base type of the nodes. /// @tparam SAFE_MATH Use @ref general_concepts_safe_math operations. /// -/// @param[in] a Opperand A -/// @param[in] b Opperand B -/// @returns True if a is promoteable over b. +/// @param[in] a Operand A +/// @param[in] b Operand B +/// @returns True if a is promotable over b. //------------------------------------------------------------------------------ template bool is_constant_promotable(shared_leaf a, @@ -67,13 +67,13 @@ namespace graph { /// @tparam T Base type of the nodes. /// @tparam SAFE_MATH Use @ref general_concepts_safe_math operations. /// -/// @param[in] a Opperand A -/// @param[in] b Opperand B +/// @param[in] a Operand A +/// @param[in] b Operand B /// @returns True if a and b are combinable. //------------------------------------------------------------------------------ template - bool is_variable_combineable(shared_leaf a, - shared_leaf b) { + bool is_variable_combinable(shared_leaf a, + shared_leaf b) { return a->is_power_base_match(b); } @@ -83,8 +83,8 @@ namespace graph { /// @tparam T Base type of the nodes. /// @tparam SAFE_MATH Use @ref general_concepts_safe_math operations. /// -/// @param[in] a Opperand A -/// @param[in] b Opperand B +/// @param[in] a Operand A +/// @param[in] b Operand B /// @returns True if a and b are combinable. //------------------------------------------------------------------------------ template @@ -103,8 +103,8 @@ namespace graph { /// @tparam T Base type of the nodes. /// @tparam SAFE_MATH Use @ref general_concepts_safe_math operations. /// -/// @param[in] a Opperand A -/// @param[in] b Opperand B +/// @param[in] a Operand A +/// @param[in] b Operand B /// @returns True if a and b are combinable. //------------------------------------------------------------------------------ template @@ -246,12 +246,12 @@ namespace graph { pl2->get_right(), pl2->get_y_scale(), pl2->get_y_offset()); } -// Idenity reductions. +// Identity reductions. if (this->left->is_match(this->right)) { return 2.0*this->left; } -// Common factor reduction. If the left and right are both muliply nodes check +// Common factor reduction. If the left and right are both multiply nodes check // for a common factor. So you can change a*b + a*c -> a*(b + c). auto lm = multiply_cast(this->left); auto rm = multiply_cast(this->right); @@ -341,8 +341,8 @@ namespace graph { // common term. // c1*a/b + c2*a/d -> (c1/b + c2/d)*a if (ldlm.get() && rdlm.get()) { - if (is_constant_combineable(ldlm->get_left(), - rdlm->get_left()) && + if (is_constant_combinable(ldlm->get_left(), + rdlm->get_left()) && !ldlm->get_right()->is_match(rdlm->get_right())) { return (ldlm->get_right()/ld->get_right() + rdlm->get_left()/ldlm->get_left() * @@ -637,7 +637,7 @@ namespace graph { } //------------------------------------------------------------------------------ -/// @brief Querey if the nodes match. +/// @brief Query if the nodes match. /// /// @param[in] x Other graph to check if it is a match. /// @returns True if the nodes are a match. @@ -825,7 +825,7 @@ namespace graph { /// @tparam SAFE_MATH Use @ref general_concepts_safe_math operations. /// /// @param[in] x Leaf node to attempt cast. -/// @returns An attemped dynamic case. +/// @returns An attempted dynamic cast. //------------------------------------------------------------------------------ template shared_add add_cast(shared_leaf x) { @@ -861,7 +861,7 @@ namespace graph { public: //------------------------------------------------------------------------------ -/// @brief Consruct a subtraction node. +/// @brief Construct a subtraction node. /// /// @param[in] l Left branch. /// @param[in] r Right branch. @@ -890,7 +890,7 @@ namespace graph { /// @returns A reduced subtraction node. //------------------------------------------------------------------------------ virtual shared_leaf reduce() { -// Idenity reductions. +// Identity reductions. auto l = constant_cast(this->left); if (this->left->is_match(this->right)) { if (l.get() && l->is(0)) { @@ -973,13 +973,13 @@ namespace graph { // c1 - (c2 + a) -> c3 + a auto la = add_cast(this->left); if (la.get()) { - if (is_constant_combineable(la->get_left(), this->right)) { + if (is_constant_combinable(la->get_left(), this->right)) { return (la->get_left() - this->right) + la->get_right(); } } auto ra = add_cast(this->right); if (ra.get()) { - if (is_constant_combineable(this->left, ra->get_left())) { + if (is_constant_combinable(this->left, ra->get_left())) { return (this->left - ra->get_left()) + ra->get_right(); } } @@ -988,10 +988,10 @@ namespace graph { // (a - c3) - c2 -> a + c3 auto ls = subtract_cast(this->left); if (ls.get()) { - if (is_constant_combineable(ls->get_left(), this->right)) { + if (is_constant_combinable(ls->get_left(), this->right)) { return (ls->get_left() - this->right) - ls->get_right(); - } else if (is_constant_combineable(ls->get_right(), - this->right)) { + } else if (is_constant_combinable(ls->get_right(), + this->right)) { return -(ls->get_right() + this->right) - ls->get_left(); } } @@ -999,14 +999,14 @@ namespace graph { // c1 - (a - c2) -> c3 - a auto rs = subtract_cast(this->right); if (rs.get()) { - if (is_constant_combineable(this->left, rs->get_left())) { + if (is_constant_combinable(this->left, rs->get_left())) { return (this->left - rs->get_left()) - rs->get_right(); - } else if (is_constant_combineable(this->left, rs->get_right())) { + } else if (is_constant_combinable(this->left, rs->get_right())) { return (this->left + rs->get_right()) - rs->get_left(); } } -// Common factor reduction. If the left and right are both muliply nodes check +// Common factor reduction. If the left and right are both multiply nodes check // for a common factor. So you can change a*b - a*c -> a*(b - c). auto lm = multiply_cast(this->left); auto rm = multiply_cast(this->right); @@ -1015,10 +1015,10 @@ namespace graph { if (lm.get()) { auto lmra = add_cast(lm->get_right()); if (lmra.get()) { - if (is_constant_combineable(lm->get_left(), - lmra->get_left()) && - is_constant_combineable(lm->get_left(), - this->right)) { + if (is_constant_combinable(lm->get_left(), + lmra->get_left()) && + is_constant_combinable(lm->get_left(), + this->right)) { return fma(lm->get_left(), lmra->get_right(), lm->get_left()*lmra->get_left() - this->right); @@ -1027,10 +1027,10 @@ namespace graph { // c1*(c2 - a) - c3 -> c4 - c1*a auto lmrs = subtract_cast(lm->get_right()); if (lmrs.get()) { - if (is_constant_combineable(lm->get_left(), - lmrs->get_left()) && - is_constant_combineable(lm->get_left(), - this->right)) { + if (is_constant_combinable(lm->get_left(), + lmrs->get_left()) && + is_constant_combinable(lm->get_left(), + this->right)) { return lm->get_left()*lmrs->get_left() - this->right - lm->get_left()*lmrs->get_right(); } @@ -1255,8 +1255,8 @@ namespace graph { // common term. // c1*a/b - c2*a/d -> (c1/b - c2/d)*a if (ldlm.get() && rdlm.get()) { - if (is_constant_combineable(ldlm->get_left(), - rdlm->get_left()) && + if (is_constant_combinable(ldlm->get_left(), + rdlm->get_left()) && !ldlm->get_right()->is_match(rdlm->get_right())) { return (ldlm->get_right()/ld->get_right() - rdlm->get_left()/ldlm->get_left() * @@ -1467,7 +1467,7 @@ namespace graph { } //------------------------------------------------------------------------------ -/// @brief Querey if the nodes match. +/// @brief Query if the nodes match. /// /// @param[in] x Other graph to check if it is a match. /// @returns True if the nodes are a match. @@ -1668,7 +1668,7 @@ namespace graph { /// @tparam SAFE_MATH Use @ref general_concepts_safe_math operations. /// /// @param[in] x Leaf node to attempt cast. -/// @returns An attemped dynamic case. +/// @returns An attempted dynamic cast. //------------------------------------------------------------------------------ template shared_subtract subtract_cast(shared_leaf x) { @@ -1679,7 +1679,7 @@ namespace graph { // Multiply node. //****************************************************************************** //------------------------------------------------------------------------------ -/// @brief A multiplcation node. +/// @brief A multiplication node. /// /// @tparam T Base type of the calculation. /// @tparam SAFE_MATH Use @ref general_concepts_safe_math operations. @@ -1688,7 +1688,7 @@ namespace graph { class multiply_node final : public branch_node { private: //------------------------------------------------------------------------------ -/// @brief Try to reduce paterns of constant times nested fma nodes. +/// @brief Try to reduce patterns of constant times nested fma nodes. /// /// c1*fma(...,x,c2) -> fma(...,x,c3) /// @@ -1699,8 +1699,8 @@ namespace graph { reduce_nested_fma_times_constant(shared_leaf trial) { auto temp = fma_cast(trial); if (temp.get()) { - if (is_constant_combineable(this->left, temp->get_left()) && - is_constant_combineable(this->left, temp->get_right())) { + if (is_constant_combinable(this->left, temp->get_left()) && + is_constant_combinable(this->left, temp->get_right())) { return fma(this->left*temp->get_left(), temp->get_middle(), this->left*temp->get_right()); @@ -1731,14 +1731,14 @@ namespace graph { auto temp = fma_cast(trial); if (temp.get()) { if (add->get_right()->is_match(temp->get_middle()) && - is_constant_combineable(add->get_left(), temp->get_right())) { + is_constant_combinable(add->get_left(), temp->get_right())) { auto temp2 = expand_nested_fma_times_add2(temp->get_left(), temp, add); if (temp2.get()) { return fma(temp2, add->get_right(), temp->get_right()*add->get_left()); - } else if (is_constant_combineable(add->get_left(), temp->get_left())) { + } else if (is_constant_combinable(add->get_left(), temp->get_left())) { return fma(fma(temp->get_left(), add->get_right(), add->get_left()*temp->get_left() + temp->get_right()), @@ -1769,8 +1769,8 @@ namespace graph { assert(temp2.get() && "Assumed a fma node."); if (temp.get()) { if (add->get_right()->is_match(temp->get_middle()) && - is_constant_combineable(add->get_left(), temp->get_left()) && - is_constant_combineable(add->get_left(), temp->get_right())) { + is_constant_combinable(add->get_left(), temp->get_left()) && + is_constant_combinable(add->get_left(), temp->get_right())) { return fma(fma(temp->get_left(), add->get_right(), @@ -1808,7 +1808,7 @@ namespace graph { public: //------------------------------------------------------------------------------ -/// @brief Consruct a multiplcation node. +/// @brief Construct a multiplication node. /// /// @param[in] l Left branch. /// @param[in] r Right branch. @@ -1818,7 +1818,7 @@ namespace graph { branch_node (l, r, multiply_node::to_string(l.get(), r.get())) {} //------------------------------------------------------------------------------ -/// @brief Evaluate the results of multiplcation. +/// @brief Evaluate the results of multiplication. /// /// result = l*r /// @@ -1828,13 +1828,13 @@ namespace graph { backend::buffer l_result = this->left->evaluate(); // If the left are right are same don't evaluate the right. -// NOTE: Do not use is_match here. Remove once power is implimented. +// NOTE: Do not use is_match here. Remove once power is implemented. if (this->left.get() == this->right.get()) { return l_result*l_result; } -// If all the elements on the left are zero, return the leftside without -// revaluating the rightside. Stop this loop early once the first non zero +// If all the elements on the left are zero, return the left side without +// reevaluating the right side. Stop this loop early once the first non zero // element is encountered. if (l_result.is_zero()) { return l_result; @@ -1845,9 +1845,9 @@ namespace graph { } //------------------------------------------------------------------------------ -/// @brief Reduce an multiplcation node. +/// @brief Reduce an multiplication node. /// -/// @returns A reduced multiplcation node. +/// @returns A reduced multiplication node. //------------------------------------------------------------------------------ virtual shared_leaf reduce() { auto l = constant_cast(this->left); @@ -1961,9 +1961,9 @@ namespace graph { // (a^c*b)*a^d -> a^(c+d)*b // (b*a^c)*a^d -> a^(c+d)*b - if (is_variable_combineable(this->right, lm->get_left())) { + if (is_variable_combinable(this->right, lm->get_left())) { return (this->right*lm->get_left())*lm->get_right(); - } else if (is_variable_combineable(this->right, lm->get_right())) { + } else if (is_variable_combinable(this->right, lm->get_right())) { return (this->right*lm->get_right())*lm->get_left(); } @@ -1979,8 +1979,8 @@ namespace graph { if (lmrp.get()) { auto lmrplm = multiply_cast(lmrp->get_left()); if (lmrplm.get() && - is_variable_combineable(lmrplm->get_right(), - this->right)) { + is_variable_combinable(lmrplm->get_right(), + this->right)) { return (lm->get_left()*pow(lmrplm->get_left(), lmrp->get_right()))*pow(this->right->get_power_base(), lmrp->get_right() + @@ -1993,8 +1993,8 @@ namespace graph { if (rm.get()) { // Assume constants are on the left. // c1*(c2*v) -> c3*v - if (is_constant_combineable(this->left, - rm->get_left())) { + if (is_constant_combinable(this->left, + rm->get_left())) { auto temp = this->left*rm->get_left(); if (temp->is_normal()) { return temp*rm->get_right(); @@ -2003,9 +2003,9 @@ namespace graph { // a*(a*b) -> a^2*b // a*(b*a) -> a^2*b - if (is_variable_combineable(this->left, rm->get_left())) { + if (is_variable_combinable(this->left, rm->get_left())) { return (this->left*rm->get_left())*rm->get_right(); - } else if (is_variable_combineable(this->left, rm->get_right())) { + } else if (is_variable_combinable(this->left, rm->get_right())) { return (this->left*rm->get_right())*rm->get_left(); } @@ -2052,26 +2052,26 @@ namespace graph { // Factor out common constants c*b*c*d -> c*c*b*d. c*c will get reduced to c on // the second pass. if (lm.get() && rm.get()) { - if (is_constant_combineable(lm->get_left(), - rm->get_left())) { + if (is_constant_combinable(lm->get_left(), + rm->get_left())) { auto temp = lm->get_left()*rm->get_left(); if (temp->is_normal()) { return temp*(lm->get_right()*rm->get_right()); } - } else if (is_constant_combineable(lm->get_left(), - rm->get_right())) { + } else if (is_constant_combinable(lm->get_left(), + rm->get_right())) { auto temp = lm->get_left()*rm->get_right(); if (temp->is_normal()) { return temp*(lm->get_right()*rm->get_left()); } - } else if (is_constant_combineable(lm->get_right(), - rm->get_left())) { + } else if (is_constant_combinable(lm->get_right(), + rm->get_left())) { auto temp = lm->get_right()*rm->get_left(); if (temp->is_normal()) { return temp*(lm->get_left()*rm->get_right()); } - } else if (is_constant_combineable(lm->get_right(), - rm->get_right())) { + } else if (is_constant_combinable(lm->get_right(), + rm->get_right())) { auto temp = lm->get_right()*rm->get_right(); if (temp->is_normal()) { return temp*(lm->get_left()*rm->get_left()); @@ -2122,7 +2122,7 @@ namespace graph { } // Power reductions. - if (is_variable_combineable(this->left, this->right)) { + if (is_variable_combinable(this->left, this->right)) { return pow(this->left->get_power_base(), this->left->get_power_exponent() + this->right->get_power_exponent()); @@ -2192,15 +2192,15 @@ namespace graph { auto lplm = multiply_cast(lp->get_left()); auto rplm = multiply_cast(rp->get_left()); if (lplm.get()) { - if (is_variable_combineable(lplm->get_right(), - this->right)) { + if (is_variable_combinable(lplm->get_right(), + this->right)) { return pow(lplm->get_left()->get_power_base(), this->left->get_power_exponent())* pow(this->right->get_power_base(), this->left->get_power_exponent() + this->right->get_power_exponent()); - } else if (is_variable_combineable(lplm->get_left(), - this->right)) { + } else if (is_variable_combinable(lplm->get_left(), + this->right)) { return pow(lplm->get_right()->get_power_base(), this->left->get_power_exponent())* pow(this->right->get_power_base(), @@ -2210,15 +2210,15 @@ namespace graph { } if (rplm.get()) { - if (is_variable_combineable(rplm->get_right(), - this->left)) { + if (is_variable_combinable(rplm->get_right(), + this->left)) { return pow(rplm->get_left()->get_power_base(), this->right->get_power_exponent())* pow(this->left->get_power_base(), this->left->get_power_exponent() + this->right->get_power_exponent()); - } else if (is_variable_combineable(rplm->get_left(), - this->left)) { + } else if (is_variable_combinable(rplm->get_left(), + this->left)) { return pow(rplm->get_right()->get_power_base(), this->right->get_power_exponent())* pow(this->left->get_power_base(), @@ -2231,15 +2231,15 @@ namespace graph { auto lpd = divide_cast(this->left->get_power_base()); if (lpd.get()) { // (a/b)^c*b^d -> a^c*b^(c-d) - if (is_variable_combineable(lpd->get_right(), - this->right)) { + if (is_variable_combinable(lpd->get_right(), + this->right)) { return pow(lpd->get_left(), this->left->get_power_exponent()) * pow(this->right->get_power_base(), this->right->get_power_exponent() - this->left->get_power_exponent()*lpd->get_right()->get_power_exponent()); } // (b/a)^c*b^d -> b^(c+d)/a^c - if (is_variable_combineable(lpd->get_left(), this->right)) { + if (is_variable_combinable(lpd->get_left(), this->right)) { return pow(this->right->get_power_base(), this->right->get_power_exponent() + this->left->get_power_exponent()*lpd->get_left()->get_power_exponent()) / @@ -2249,16 +2249,16 @@ namespace graph { auto rpd = divide_cast(this->right->get_power_base()); if (rpd.get()) { // b^d*(a/b)^c -> a^c*b^(c-d) - if (is_variable_combineable(rpd->get_right(), - this->left)) { + if (is_variable_combinable(rpd->get_right(), + this->left)) { return pow(rpd->get_left(), this->right->get_power_exponent()) * pow(this->left->get_power_base(), this->left->get_power_exponent() - this->right->get_power_exponent()*rpd->get_right()->get_power_exponent()); } // b^d*(b/a)^c -> b^(c+d)/a^c - if (is_variable_combineable(rpd->get_left(), - this->left)) { + if (is_variable_combinable(rpd->get_left(), + this->left)) { return pow(this->right->get_power_base(), this->right->get_power_exponent() + this->right->get_power_exponent()*rpd->get_left()->get_power_exponent()) / @@ -2532,7 +2532,7 @@ namespace graph { } //------------------------------------------------------------------------------ -/// @brief Querey if the nodes match. +/// @brief Query if the nodes match. /// /// @param[in] x Other graph to check if it is a match. /// @returns True if the nodes are a match. @@ -2717,7 +2717,7 @@ namespace graph { /// @tparam SAFE_MATH Use @ref general_concepts_safe_math operations. /// /// @param[in] x Leaf node to attempt cast. -/// @returns An attemped dynamic case. +/// @returns An attempted dynamic cast. //------------------------------------------------------------------------------ template shared_multiply multiply_cast(shared_leaf x) { @@ -2771,8 +2771,8 @@ namespace graph { virtual backend::buffer evaluate() { backend::buffer l_result = this->left->evaluate(); -// If all the elements on the left are zero, return the leftside without -// revaluating the rightside. Stop this loop early once the first non zero +// If all the elements on the left are zero, return the left side without +// reevaluating the right side. Stop this loop early once the first non zero // element is encountered. if (l_result.is_zero()) { return l_result; @@ -2930,16 +2930,16 @@ namespace graph { auto rm = multiply_cast(this->right); if (lm.get() && rm.get()) { - if (is_variable_combineable(lm->get_left(), - rm->get_left()) || - is_variable_combineable(lm->get_right(), - rm->get_right())) { + if (is_variable_combinable(lm->get_left(), + rm->get_left()) || + is_variable_combinable(lm->get_right(), + rm->get_right())) { return (lm->get_left()/rm->get_left()) * (lm->get_right()/rm->get_right()); - } else if (is_variable_combineable(lm->get_left(), - rm->get_right()) || - is_variable_combineable(lm->get_right(), - rm->get_left())) { + } else if (is_variable_combinable(lm->get_left(), + rm->get_right()) || + is_variable_combinable(lm->get_right(), + rm->get_left())) { return (lm->get_left()/rm->get_right()) * (lm->get_right()/rm->get_left()); } @@ -3055,11 +3055,11 @@ namespace graph { // (v1^a*v2)/v1^b -> v2*(v1^a/v1^b) // (v2*v1^a)/v1^b -> v2*(v1^a/v1^b) - if (is_variable_combineable(lm->get_left(), - this->right)) { + if (is_variable_combinable(lm->get_left(), + this->right)) { return lm->get_right()*(lm->get_left()/this->right); - } else if (is_variable_combineable(lm->get_right(), - this->right)) { + } else if (is_variable_combinable(lm->get_right(), + this->right)) { return lm->get_left()*(lm->get_right()/this->right); } } @@ -3076,8 +3076,8 @@ namespace graph { } // Power reductions. - if (is_variable_combineable(this->left, - this->right)) { + if (is_variable_combinable(this->left, + this->right)) { return pow(this->left->get_power_base(), this->left->get_power_exponent() - this->right->get_power_exponent()); @@ -3168,22 +3168,22 @@ namespace graph { auto lmrm = multiply_cast(lm->get_right()); auto lmlm = multiply_cast(lm->get_left()); if (lmrm.get()) { - if (is_variable_combineable(lmrm->get_right(), - this->right)) { + if (is_variable_combinable(lmrm->get_right(), + this->right)) { return lm->get_left()*lmrm->get_left() * (lmrm->get_right()/this->right); - } else if (is_variable_combineable(lmrm->get_left(), - this->right)) { + } else if (is_variable_combinable(lmrm->get_left(), + this->right)) { return lm->get_left()*lmrm->get_right() * (lmrm->get_left()/this->right); } } else if (lmlm.get()) { - if (is_variable_combineable(lmlm->get_right(), - this->right)) { + if (is_variable_combinable(lmlm->get_right(), + this->right)) { return lm->get_right()*lmlm->get_left() * (lmlm->get_right()/this->right); - } else if (is_variable_combineable(lmlm->get_left(), - this->right)) { + } else if (is_variable_combinable(lmlm->get_left(), + this->right)) { return lm->get_right()*lmlm->get_right() * (lmlm->get_left()/this->right); } @@ -3516,7 +3516,7 @@ namespace graph { } //------------------------------------------------------------------------------ -/// @brief Querey if the nodes match. +/// @brief Query if the nodes match. /// /// @param[in] x Other graph to check if it is a match. /// @returns True if the nodes are a match. @@ -3682,7 +3682,7 @@ namespace graph { /// @tparam SAFE_MATH Use @ref general_concepts_safe_math operations. /// /// @param[in] x Leaf node to attempt cast. -/// @returns An attemped dynamic case. +/// @returns An attempted dynamic cast. //------------------------------------------------------------------------------ template shared_divide divide_cast(shared_leaf x) { @@ -3715,9 +3715,9 @@ namespace graph { reduce_nested_fma(shared_subtract sub) { auto temp = fma_cast(this->left); if (temp.get()) { - if (is_constant_combineable(sub->get_right(), temp->get_left()) && - is_constant_combineable(sub->get_right(), temp->get_right()) && - is_constant_combineable(this->right, temp->get_right()) && + if (is_constant_combinable(sub->get_right(), temp->get_left()) && + is_constant_combinable(sub->get_right(), temp->get_right()) && + is_constant_combinable(this->right, temp->get_right()) && temp->get_middle()->is_match(sub->get_left())) { return fma(fma(temp->get_left(), sub->get_left(), @@ -3726,7 +3726,7 @@ namespace graph { this->right - temp->get_right()*sub->get_right()); } else { if (temp->get_middle()->is_match(sub->get_left()) && - is_constant_combineable(sub->get_right(), this->right)) { + is_constant_combinable(sub->get_right(), this->right)) { auto temp2 = temp->reduce_nested_fma(sub); if (temp2.get()) { return fma(temp2, @@ -3781,8 +3781,8 @@ namespace graph { backend::buffer l_result = this->left->evaluate(); backend::buffer r_result = this->right->evaluate(); -// If all the elements on the left are zero, return the leftside without -// revaluating the rightside. +// If all the elements on the left are zero, return the left side without +// reevaluating the right side. if (l_result.is_zero()) { return r_result; } @@ -3822,8 +3822,8 @@ namespace graph { // Check if the left and middle are combinable. This will be constant merged in // multiply reduction. - if (is_constant_combineable(this->left, this->middle) || - is_variable_combineable(this->left, this->middle)) { + if (is_constant_combinable(this->left, this->middle) || + is_variable_combinable(this->left, this->middle)) { return (this->left*this->middle) + this->right; } @@ -3844,8 +3844,8 @@ namespace graph { // fma(c1,c2 + a,c3) -> fma(c4,a,c5) auto ma = add_cast(this->middle); if (ma.get()) { - if (is_constant_combineable(this->left, ma->get_left()) && - is_constant_combineable(this->left, this->right)) { + if (is_constant_combinable(this->left, ma->get_left()) && + is_constant_combinable(this->left, this->right)) { return fma(this->left, ma->get_right(), fma(this->left, ma->get_left(), this->right)); @@ -3856,12 +3856,12 @@ namespace graph { // fma(c1,a - c2,c3) -> fma(c1,a,c3 - c1*c2) auto ms = subtract_cast(this->middle); if (ms.get()) { - if (is_constant_combineable(this->left, ms->get_left()) && - is_constant_combineable(this->left, this->right)) { + if (is_constant_combinable(this->left, ms->get_left()) && + is_constant_combinable(this->left, this->right)) { return fma(-this->left, ms->get_right(), this->left*ms->get_left() + this->right); - } else if (is_constant_combineable(this->left, ms->get_right()) && - is_constant_combineable(this->left, this->right)) { + } else if (is_constant_combinable(this->left, ms->get_right()) && + is_constant_combinable(this->left, this->right)) { return fma(this->left, ms->get_left(), this->right - this->left*ms->get_right()); } @@ -3888,7 +3888,7 @@ namespace graph { return this->middle*(this->left + rm->get_left()); } -// Chnage case of +// Change case of // fma(a,b,-c1*b) -> a*b - c1*b auto rmlc = constant_cast(rm->get_left()); if (rmlc.get() && rmlc->evaluate().is_negative()) { @@ -3901,8 +3901,8 @@ namespace graph { // fma(a,c1,c2*b) -> c1*fma(c3,b,a) // fma(c1,a,b*c2) -> c1*fma(c3,b,a) // fma(a,c1,b*c2) -> c1*fma(c3,b,a) - if (is_constant_combineable(this->left, - rm->get_left()) && + if (is_constant_combinable(this->left, + rm->get_left()) && !this->left->has_constant_zero()) { auto temp = rm->get_left()/this->left; if (temp->is_normal()) { @@ -3911,8 +3911,8 @@ namespace graph { this->middle); } } - if (is_constant_combineable(this->middle, - rm->get_left()) && + if (is_constant_combinable(this->middle, + rm->get_left()) && !this->middle->has_constant_zero()) { auto temp = rm->get_left()/this->middle; if (temp->is_normal()) { @@ -3921,8 +3921,8 @@ namespace graph { this->left); } } - if (is_constant_combineable(this->left, - rm->get_right()) && + if (is_constant_combinable(this->left, + rm->get_right()) && !this->left->has_constant_zero()) { auto temp = rm->get_right()/this->left; if (temp->is_normal()) { @@ -3931,8 +3931,8 @@ namespace graph { this->middle); } } - if (is_constant_combineable(this->middle, - rm->get_right()) && + if (is_constant_combinable(this->middle, + rm->get_right()) && !this->middle->has_constant_zero()) { auto temp = rm->get_right()/this->middle; if (temp->is_normal()) { @@ -3982,8 +3982,8 @@ namespace graph { // fma(c1*a,b,d*c2*d) -> c1*(a*b + c2/c1*d) // fma(a*c1,b,d*c2*d) -> c1*(a*b + c2/c1*d) if (lm.get() && rm.get()) { - if (is_constant_combineable(rm->get_left(), - lm->get_left()) && + if (is_constant_combinable(rm->get_left(), + lm->get_left()) && !lm->get_left()->has_constant_zero()) { auto temp = rm->get_left()/lm->get_left(); if (temp->is_normal()){ @@ -3992,8 +3992,8 @@ namespace graph { temp*rm->get_right()); } } - if (is_constant_combineable(rm->get_left(), - lm->get_right()) && + if (is_constant_combinable(rm->get_left(), + lm->get_right()) && !lm->get_right()->has_constant_zero()) { auto temp = rm->get_left()/lm->get_right(); if (temp->is_normal()){ @@ -4002,8 +4002,8 @@ namespace graph { temp*rm->get_right()); } } - if (is_constant_combineable(rm->get_right(), - lm->get_left()) && + if (is_constant_combinable(rm->get_right(), + lm->get_left()) && !lm->get_left()->has_constant_zero()) { auto temp = rm->get_right()/lm->get_left(); if (temp->is_normal()) { @@ -4012,8 +4012,8 @@ namespace graph { temp*rm->get_left()); } } - if (is_constant_combineable(rm->get_right(), - lm->get_right()) && + if (is_constant_combinable(rm->get_right(), + lm->get_right()) && !lm->get_right()->has_constant_zero()) { auto temp = rm->get_right()/lm->get_right(); if (temp->is_normal()) { @@ -4037,8 +4037,8 @@ namespace graph { // fma(c1,c2*a,b) -> fma(c3,a,b) // fma(c1,a*c2,b) -> fma(c3,a,b) // fma(a,c1*b,c) -> fma(c1,a*b,c) - if (is_constant_combineable(this->left, - mm->get_left())) { + if (is_constant_combinable(this->left, + mm->get_left())) { auto temp = this->left*mm->get_left(); if (temp->is_normal()) { return fma(temp, @@ -4046,8 +4046,8 @@ namespace graph { this->right); } } - if (is_constant_combineable(this->left, - mm->get_right())) { + if (is_constant_combinable(this->left, + mm->get_right())) { auto temp = this->left*mm->get_right(); if (temp->is_normal()) { return fma(temp, @@ -4080,8 +4080,8 @@ namespace graph { // fma(a,c1,c2/b) -> c1*(a + c3/b) auto rd = divide_cast(this->right); if (rd.get()) { - if (is_constant_combineable(this->left, - rd->get_left()) && + if (is_constant_combinable(this->left, + rd->get_left()) && !this->left->has_constant_zero()) { auto temp = rd->get_left()/this->left; if (temp->is_normal()) { @@ -4089,8 +4089,8 @@ namespace graph { temp/rd->get_right()); } } - if (is_constant_combineable(this->middle, - rd->get_left()) && + if (is_constant_combinable(this->middle, + rd->get_left()) && !this->middle->has_constant_zero()) { auto temp = rd->get_left()/this->middle; if (temp->is_normal()) { @@ -4451,7 +4451,7 @@ namespace graph { } } - if (is_variable_combineable(this->middle, rfma->get_middle())) { + if (is_variable_combinable(this->middle, rfma->get_middle())) { if (is_greater_exponent(this->middle, rfma->get_middle())) { // fma(a,x^b,fma(c,x^d,e)) -> fma(x^d,fma(x^(d-b),a,c),e) if b > d return fma(rfma->get_middle(), @@ -4467,7 +4467,7 @@ namespace graph { this->left), rfma->get_right()); } - } else if (is_variable_combineable(this->left, rfma->get_middle())) { + } else if (is_variable_combinable(this->left, rfma->get_middle())) { if (is_greater_exponent(this->left, rfma->get_middle())) { // fma(x^b,a,fma(c,x^d,e)) -> fma(x^d,fma(x^(d-b),a,c),e) if b > d return fma(rfma->get_middle(), @@ -4483,7 +4483,7 @@ namespace graph { this->middle), rfma->get_right()); } - } else if (is_variable_combineable(this->middle, rfma->get_left())) { + } else if (is_variable_combinable(this->middle, rfma->get_left())) { if (is_greater_exponent(this->middle, rfma->get_left())) { // fma(a,x^b,fma(x^d,c,e)) -> fma(x^d,fma(x^(d-b),a,c),e) if b > d return fma(rfma->get_left(), @@ -4499,7 +4499,7 @@ namespace graph { this->left), rfma->get_right()); } - } else if (is_variable_combineable(this->left, rfma->get_left())) { + } else if (is_variable_combinable(this->left, rfma->get_left())) { if (is_greater_exponent(this->left, rfma->get_left())) { // fma(x^b,a,fma(x^d,c,e)) -> fma(x^d,fma(x^(d-b),a,c),e) if b > d return fma(rfma->get_left(), @@ -4595,9 +4595,9 @@ namespace graph { } // fma(2,a^2,a) -> a*fma(2,a,1) -// Note this case is handled eailer. fma(2,a,a^2) -> a*fma(2,1,a) - if (is_variable_combineable(this->middle, - this->right)) { +// Note this case is handled earlier. fma(2,a,a^2) -> a*fma(2,1,a) + if (is_variable_combinable(this->middle, + this->right)) { auto temp = this->right/this->middle; auto temp_exponent = constant_cast(temp->get_power_exponent()); if (temp_exponent.get() && temp_exponent->evaluate().is_negative()) { @@ -4621,15 +4621,15 @@ namespace graph { if (rm.get() && mp.get()) { auto mplm = multiply_cast(mp->get_left()); if (mplm.get()) { - if (is_variable_combineable(mplm->get_left(), - rm->get_left())) { + if (is_variable_combinable(mplm->get_left(), + rm->get_left())) { auto temp = pow(mplm->get_left(), mp->get_right()); return temp*fma(this->left, this->middle/temp, this->right/temp); - } else if (is_variable_combineable(mplm->get_right(), - rm->get_left())) { + } else if (is_variable_combinable(mplm->get_right(), + rm->get_left())) { auto temp = pow(mplm->get_right(), mp->get_right()); return temp*fma(this->left, @@ -4642,8 +4642,8 @@ namespace graph { if (rfma.get() && mp.get()) { auto mplm = multiply_cast(mp->get_left()); if (mplm.get()) { - if (is_variable_combineable(mplm->get_left(), - rfma->get_left())) { + if (is_variable_combinable(mplm->get_left(), + rfma->get_left())) { auto temp = pow(mplm->get_left(), mp->get_right()); return fma(temp, @@ -4651,8 +4651,8 @@ namespace graph { this->middle/temp, rfma->get_middle()), rfma->get_right()); - } else if (is_variable_combineable(mplm->get_right(), - rfma->get_left())) { + } else if (is_variable_combinable(mplm->get_right(), + rfma->get_left())) { auto temp = pow(mplm->get_right(), mp->get_right()); return fma(temp, @@ -4665,8 +4665,8 @@ namespace graph { // fma(2,(a*b)^2,fma(3,a^2*b,c)) -> a^2*fma(2,b^2,fma(3,b,c)) auto rfmamm = multiply_cast(rfma->get_middle()); if (rfmamm.get()) { - if (is_variable_combineable(mplm->get_left(), - rfmamm->get_left())) { + if (is_variable_combinable(mplm->get_left(), + rfmamm->get_left())) { auto temp = pow(mplm->get_left(), mp->get_right()); return temp*fma(this->left, @@ -5100,7 +5100,7 @@ namespace graph { } //------------------------------------------------------------------------------ -/// @brief Querey if the nodes match. +/// @brief Query if the nodes match. /// /// @param[in] x Other graph to check if it is a match. /// @returns True if the nodes are a match. @@ -5364,7 +5364,7 @@ namespace graph { /// @tparam SAFE_MATH Use @ref general_concepts_safe_math operations. /// /// @param[in] x Leaf node to attempt cast. -/// @returns An attemped dynamic case. +/// @returns An attempted dynamic cast. //------------------------------------------------------------------------------ template shared_fma fma_cast(shared_leaf x) { diff --git a/graph_framework/backend.hpp b/graph_framework/backend.hpp index c95b65db030ff5675b096f35ad2ab2cf8b4de517..7ceb09a4cbb4bb2720e245d8d1d95b585804726f 100644 --- a/graph_framework/backend.hpp +++ b/graph_framework/backend.hpp @@ -1,6 +1,6 @@ //------------------------------------------------------------------------------ /// @file backend.hpp -/// @brief Class signature to impliment compute backends. +/// @brief Class signature to implement compute backends. /// /// Defined the function interfaces to access compute resources. //------------------------------------------------------------------------------ @@ -50,7 +50,7 @@ namespace backend { /// @brief Construct a buffer backend with a size. /// /// @param[in] s Size of he data buffer. -/// @param[in] d Scalar data to initalize. +/// @param[in] d Scalar data to initialize. //------------------------------------------------------------------------------ buffer(const size_t s, const T d) : memory(s, d) {} @@ -305,10 +305,10 @@ namespace backend { assert(size()%x.size() == 0 && "Vector operand size is not a multiple of matrix operand size"); - const size_t num_colmns = size()/x.size(); + const size_t num_columns = size()/x.size(); const size_t num_rows = x.size(); for (size_t i = 0; i < num_rows; i++) { - for (size_t j = 0; j < num_colmns; j++) { + for (size_t j = 0; j < num_columns; j++) { memory[i*num_rows + j] += x[i]; } } @@ -317,11 +317,11 @@ namespace backend { "Vector operand size is not a multiple of matrix operand size"); std::vector m(x.size()); - const size_t num_colmns = x.size()/size(); + const size_t num_columns = x.size()/size(); const size_t num_rows = size(); for (size_t i = 0; i < num_rows; i++) { - for (size_t j = 0; j < num_colmns; j++) { - m[i*num_colmns + j] = memory[i] + x[i*num_colmns + j]; + for (size_t j = 0; j < num_columns; j++) { + m[i*num_columns + j] = memory[i] + x[i*num_columns + j]; } } memory = m; @@ -341,11 +341,11 @@ namespace backend { assert(size()%x.size() == 0 && "Vector operand size is not a multiple of matrix operand size"); - const size_t num_colmns = size()/x.size(); + const size_t num_columns = size()/x.size(); const size_t num_rows = x.size(); for (size_t i = 0; i < num_rows; i++) { - for (size_t j = 0; j < num_colmns; j++) { - memory[i*num_colmns + j] += x[j]; + for (size_t j = 0; j < num_columns; j++) { + memory[i*num_columns + j] += x[j]; } } } else { @@ -353,11 +353,11 @@ namespace backend { "Vector operand size is not a multiple of matrix operand size"); std::vector m(x.size()); - const size_t num_colmns = x.size()/size(); + const size_t num_columns = x.size()/size(); const size_t num_rows = size(); for (size_t i = 0; i < num_rows; i++) { - for (size_t j = 0; j < num_colmns; j++) { - m[i*num_colmns + j] = memory[j] + x[i*num_colmns + j]; + for (size_t j = 0; j < num_columns; j++) { + m[i*num_columns + j] = memory[j] + x[i*num_columns + j]; } } memory = m; @@ -367,7 +367,7 @@ namespace backend { //------------------------------------------------------------------------------ /// @brief Subtract row operation. /// -/// Sunbtracts m_ij - v_i or v_i - m_ij. This will resize the buffer if it +/// Subtracts m_ij - v_i or v_i - m_ij. This will resize the buffer if it /// needs to be. /// /// @param[in] x The right operand. @@ -377,11 +377,11 @@ namespace backend { assert(size()%x.size() == 0 && "Vector operand size is not a multiple of matrix operand size"); - const size_t num_colmns = size()/x.size(); + const size_t num_columns = size()/x.size(); const size_t num_rows = x.size(); for (size_t i = 0; i < num_rows; i++) { - for (size_t j = 0; j < num_colmns; j++) { - memory[i*num_colmns + j] -= x[i]; + for (size_t j = 0; j < num_columns; j++) { + memory[i*num_columns + j] -= x[i]; } } } else { @@ -389,11 +389,11 @@ namespace backend { "Vector operand size is not a multiple of matrix operand size"); std::vector m(x.size()); - const size_t num_colmns = x.size()/size(); + const size_t num_columns = x.size()/size(); const size_t num_rows = size(); - for (size_t i = 0; i < num_colmns; i++) { + for (size_t i = 0; i < num_columns; i++) { for (size_t j = 0; j < num_rows; j++) { - m[i*num_colmns + j] = memory[i] - x[i*num_colmns + j]; + m[i*num_columns + j] = memory[i] - x[i*num_columns + j]; } } memory = m; @@ -403,7 +403,7 @@ namespace backend { //------------------------------------------------------------------------------ /// @brief Subtract col operation. /// -/// Sunbtracts m_ij - v_j or v_j - m_ij. This will resize the buffer if it +/// Subtracts m_ij - v_j or v_j - m_ij. This will resize the buffer if it /// needs to be. /// /// @param[in] x The other operand. @@ -413,11 +413,11 @@ namespace backend { assert(size()%x.size() == 0 && "Vector operand size is not a multiple of matrix operand size"); - const size_t num_colmns = size()/x.size(); + const size_t num_columns = size()/x.size(); const size_t num_rows = x.size(); for (size_t i = 0; i < num_rows; i++) { - for (size_t j = 0; j < num_colmns; j++) { - memory[i*num_colmns + j] -= x[j]; + for (size_t j = 0; j < num_columns; j++) { + memory[i*num_columns + j] -= x[j]; } } } else { @@ -425,11 +425,11 @@ namespace backend { "Vector operand size is not a multiple of matrix operand size"); std::vector m(x.size()); - const size_t num_colmns = x.size()/size(); + const size_t num_columns = x.size()/size(); const size_t num_rows = size(); for (size_t i = 0; i < num_rows; i++) { - for (size_t j = 0; j < num_colmns; j++) { - m[i*num_colmns + j] = memory[j] - x[i*num_colmns + j]; + for (size_t j = 0; j < num_columns; j++) { + m[i*num_columns + j] = memory[j] - x[i*num_columns + j]; } } memory = m; @@ -449,11 +449,11 @@ namespace backend { assert(size()%x.size() == 0 && "Vector operand size is not a multiple of matrix operand size"); - const size_t num_colmns = size()/x.size(); + const size_t num_columns = size()/x.size(); const size_t num_rows = x.size(); for (size_t i = 0; i < num_rows; i++) { - for (size_t j = 0; j < num_colmns; j++) { - memory[i*num_colmns + j] *= x[i]; + for (size_t j = 0; j < num_columns; j++) { + memory[i*num_columns + j] *= x[i]; } } } else { @@ -461,11 +461,11 @@ namespace backend { "Vector operand size is not a multiple of matrix operand size"); std::vector m(x.size()); - const size_t num_colmns = x.size()/size(); + const size_t num_columns = x.size()/size(); const size_t num_rows = size(); for (size_t i = 0; i < num_rows; i++) { - for (size_t j = 0; j < num_colmns; j++) { - m[i*num_colmns + j] = memory[i]*x[i*num_colmns + j]; + for (size_t j = 0; j < num_columns; j++) { + m[i*num_columns + j] = memory[i]*x[i*num_columns + j]; } } memory = m; @@ -485,11 +485,11 @@ namespace backend { assert(size()%x.size() == 0 && "Vector operand size is not a multiple of matrix operand size"); - const size_t num_colmns = size()/x.size(); + const size_t num_columns = size()/x.size(); const size_t num_rows = x.size(); for (size_t i = 0; i < num_rows; i++) { - for (size_t j = 0; j < num_colmns; j++) { - memory[i*num_colmns + j] *= x[j]; + for (size_t j = 0; j < num_columns; j++) { + memory[i*num_columns + j] *= x[j]; } } } else { @@ -497,11 +497,11 @@ namespace backend { "Vector operand size is not a multiple of matrix operand size"); std::vector m(x.size()); - const size_t num_colmns = x.size()/size(); + const size_t num_columns = x.size()/size(); const size_t num_rows = size(); for (size_t i = 0; i < num_rows; i++) { - for (size_t j = 0; j < num_colmns; j++) { - m[i*num_colmns + j] = memory[j]*x[i*num_colmns + j]; + for (size_t j = 0; j < num_columns; j++) { + m[i*num_columns + j] = memory[j]*x[i*num_columns + j]; } } memory = m; @@ -521,11 +521,11 @@ namespace backend { assert(size()%x.size() == 0 && "Vector operand size is not a multiple of matrix operand size"); - const size_t num_colmns = size()/x.size(); + const size_t num_columns = size()/x.size(); const size_t num_rows = x.size(); for (size_t i = 0; i < num_rows; i++) { - for (size_t j = 0; j < num_colmns; j++) { - memory[i*num_colmns + j] /= x[i]; + for (size_t j = 0; j < num_columns; j++) { + memory[i*num_columns + j] /= x[i]; } } } else { @@ -533,11 +533,11 @@ namespace backend { "Vector operand size is not a multiple of matrix operand size"); std::vector m(x.size()); - const size_t num_colmns = x.size()/size(); + const size_t num_columns = x.size()/size(); const size_t num_rows = size(); for (size_t i = 0; i < num_rows; i++) { - for (size_t j = 0; j < num_colmns; j++) { - m[i*num_colmns + j] = memory[i]/x[i*num_colmns + j]; + for (size_t j = 0; j < num_columns; j++) { + m[i*num_columns + j] = memory[i]/x[i*num_columns + j]; } } memory = m; @@ -557,11 +557,11 @@ namespace backend { assert(size()%x.size() == 0 && "Vector operand size is not a multiple of matrix operand size"); - const size_t num_colmns = size()/x.size(); + const size_t num_columns = size()/x.size(); const size_t num_rows = x.size(); for (size_t i = 0; i < num_rows; i++) { - for (size_t j = 0; j < num_colmns; j++) { - memory[i*num_colmns + j] /= x[j]; + for (size_t j = 0; j < num_columns; j++) { + memory[i*num_columns + j] /= x[j]; } } } else { @@ -569,11 +569,11 @@ namespace backend { "Vector operand size is not a multiple of matrix operand size"); std::vector m(x.size()); - const size_t num_colmns = x.size()/size(); + const size_t num_columns = x.size()/size(); const size_t num_rows = size(); for (size_t i = 0; i < num_rows; i++) { - for (size_t j = 0; j < num_colmns; j++) { - m[i*num_colmns + j] = memory[j]/x[i*num_colmns + j]; + for (size_t j = 0; j < num_columns; j++) { + m[i*num_columns + j] = memory[j]/x[i*num_columns + j]; } } memory = m; @@ -593,14 +593,14 @@ namespace backend { assert(size()%x.size() == 0 && "Vector operand size is not a multiple of matrix operand size"); - const size_t num_colmns = size()/x.size(); + const size_t num_columns = size()/x.size(); const size_t num_rows = x.size(); for (size_t i = 0; i < num_rows; i++) { - for (size_t j = 0; j < num_colmns; j++) { + for (size_t j = 0; j < num_columns; j++) { if constexpr (jit::complex_scalar) { - memory[i*num_colmns + j] = std::atan(x[i]/memory[i*num_colmns + j]); + memory[i*num_columns + j] = std::atan(x[i]/memory[i*num_columns + j]); } else { - memory[i*num_colmns + j] = std::atan2(x[i], memory[i*num_colmns + j]); + memory[i*num_columns + j] = std::atan2(x[i], memory[i*num_columns + j]); } } } @@ -609,14 +609,14 @@ namespace backend { "Vector operand size is not a multiple of matrix operand size"); std::vector m(x.size()); - const size_t num_colmns = x.size()/size(); + const size_t num_columns = x.size()/size(); const size_t num_rows = size(); for (size_t i = 0; i < num_rows; i++) { - for (size_t j = 0; j < num_colmns; j++) { + for (size_t j = 0; j < num_columns; j++) { if constexpr (jit::complex_scalar) { - m[i*num_colmns + j] = std::atan(x[i*num_colmns + j]/memory[i]); + m[i*num_columns + j] = std::atan(x[i*num_columns + j]/memory[i]); } else { - m[i*num_colmns + j] = std::atan2(x[i*num_colmns + j], memory[i]); + m[i*num_columns + j] = std::atan2(x[i*num_columns + j], memory[i]); } } } @@ -637,14 +637,14 @@ namespace backend { assert(size()%x.size() == 0 && "Vector operand size is not a multiple of matrix operand size"); - const size_t num_colmns = size()/x.size(); + const size_t num_columns = size()/x.size(); const size_t num_rows = x.size(); - for (size_t i = 0; i < num_colmns; i++) { + for (size_t i = 0; i < num_columns; i++) { for (size_t j = 0; j < num_rows; j++) { if constexpr (jit::complex_scalar) { - memory[i*num_colmns + j] = std::atan(x[j]/memory[i*num_colmns + j]); + memory[i*num_columns + j] = std::atan(x[j]/memory[i*num_columns + j]); } else { - memory[i*num_colmns + j] = std::atan2(x[j], memory[i*num_colmns + j]); + memory[i*num_columns + j] = std::atan2(x[j], memory[i*num_columns + j]); } } } @@ -653,14 +653,14 @@ namespace backend { "Vector operand size is not a multiple of matrix operand size"); std::vector m(x.size()); - const size_t num_colmns = x.size()/size(); + const size_t num_columns = x.size()/size(); const size_t num_rows = size(); for (size_t i = 0; i < num_rows; i++) { - for (size_t j = 0; j < num_colmns; j++) { + for (size_t j = 0; j < num_columns; j++) { if constexpr (jit::complex_scalar) { - m[i*num_colmns + j] = std::atan(x[i*num_colmns + j]/memory[j]); + m[i*num_columns + j] = std::atan(x[i*num_columns + j]/memory[j]); } else { - m[i*num_colmns + j] = std::atan2(x[i*num_colmns + j], memory[j]); + m[i*num_columns + j] = std::atan2(x[i*num_columns + j], memory[j]); } } } @@ -681,11 +681,11 @@ namespace backend { assert(size()%x.size() == 0 && "Vector operand size is not a multiple of matrix operand size"); - const size_t num_colmns = size()/x.size(); + const size_t num_columns = size()/x.size(); const size_t num_rows = x.size(); for (size_t i = 0; i < num_rows; i++) { - for (size_t j = 0; j < num_colmns; j++) { - memory[i*num_colmns + j] = std::pow(memory[i*num_colmns + j], x[i]); + for (size_t j = 0; j < num_columns; j++) { + memory[i*num_columns + j] = std::pow(memory[i*num_columns + j], x[i]); } } } else { @@ -693,11 +693,11 @@ namespace backend { "Vector operand size is not a multiple of matrix operand size"); std::vector m(x.size()); - const size_t num_colmns = x.size()/size(); + const size_t num_columns = x.size()/size(); const size_t num_rows = size(); - for (size_t i = 0; i < num_colmns; i++) { + for (size_t i = 0; i < num_columns; i++) { for (size_t j = 0; j < num_rows; j++) { - m[i*num_colmns + j] = std::pow(memory[i], x[i*num_colmns + j]); + m[i*num_columns + j] = std::pow(memory[i], x[i*num_columns + j]); } } memory = m; @@ -717,11 +717,11 @@ namespace backend { assert(size()%x.size() == 0 && "Vector operand size is not a multiple of matrix operand size"); - const size_t num_colmns = size()/x.size(); + const size_t num_columns = size()/x.size(); const size_t num_rows = x.size(); for (size_t i = 0; i < num_rows; i++) { - for (size_t j = 0; j < num_colmns; j++) { - memory[i*num_colmns + j] = std::pow(memory[i*num_colmns + j], x[j]); + for (size_t j = 0; j < num_columns; j++) { + memory[i*num_columns + j] = std::pow(memory[i*num_columns + j], x[j]); } } } else { @@ -729,11 +729,11 @@ namespace backend { "Vector operand size is not a multiple of matrix operand size"); std::vector m(x.size()); - const size_t num_colmns = x.size()/size(); + const size_t num_columns = x.size()/size(); const size_t num_rows = size(); for (size_t i = 0; i < num_rows; i++) { - for (size_t j = 0; j < num_colmns; j++) { - m[i*num_colmns + j] = std::pow(memory[j], x[i*num_colmns + j]); + for (size_t j = 0; j < num_columns; j++) { + m[i*num_columns + j] = std::pow(memory[j], x[i*num_columns + j]); } } memory = m; @@ -771,7 +771,7 @@ namespace backend { } assert(a.size() == b.size() && - "Left and right sizes are incompatable."); + "Left and right sizes are incompatible."); for (size_t i = 0, ie = a.size(); i < ie; i++) { a[i] += b.at(i); } @@ -829,7 +829,7 @@ namespace backend { } assert(a.size() == b.size() && - "Left and right sizes are incompatable."); + "Left and right sizes are incompatible."); for (size_t i = 0, ie = a.size(); i < ie; i++) { a[i] -= b.at(i); } @@ -863,7 +863,7 @@ namespace backend { } assert(a.size() == b.size() && - "Left and right sizes are incompatable."); + "Left and right sizes are incompatible."); for (size_t i = 0, ie = a.size(); i < ie; i++) { a[i] *= b.at(i); } @@ -897,7 +897,7 @@ namespace backend { } assert(a.size() == b.size() && - "Left and right sizes are incompatable."); + "Left and right sizes are incompatible."); for (size_t i = 0, ie = a.size(); i < ie; i++) { a[i] /= b.at(i); } @@ -1001,7 +1001,7 @@ namespace backend { assert(a.size() == b.size() && b.size() == c.size() && a.size() == c.size() && - "Left, middle and right sizes are incompatable."); + "Left, middle and right sizes are incompatible."); for (size_t i = 0, ie = a.size(); i < ie; i++) { if constexpr (use_fma) { a[i] = std::fma(a.at(i), b.at(i), c.at(i)); @@ -1078,7 +1078,7 @@ namespace backend { } assert(base.size() == exponent.size() && - "Left and right sizes are incompatable."); + "Left and right sizes are incompatible."); for (size_t i = 0, ie = base.size(); i < ie; i++) { base[i] = std::pow(base.at(i), exponent.at(i)); } @@ -1120,7 +1120,7 @@ namespace backend { } assert(x.size() == y.size() && - "Left and right sizes are incompatable."); + "Left and right sizes are incompatible."); for (size_t i = 0, ie = x.size(); i < ie; i++) { if constexpr (jit::complex_scalar) { x[i] = std::atan(y[i]/x[i]); diff --git a/graph_framework/commandline_parser.hpp b/graph_framework/commandline_parser.hpp index 2a9f17cdde0bace27bf5304cfbf1b2d715d9fb95..1bda4c3dbebf6811e389801a2ce954d50e3bddb4 100644 --- a/graph_framework/commandline_parser.hpp +++ b/graph_framework/commandline_parser.hpp @@ -13,7 +13,7 @@ /// Name space for the command line parsing. namespace commandline { -/// Lock to syncronize netcdf accross threads. +/// Lock to synchronize netcdf across threads. static std::mutex sync; //------------------------------------------------------------------------------ diff --git a/graph_framework/cpu_context.hpp b/graph_framework/cpu_context.hpp index f9750ec2d72ec13abb50c47781a9d3e655265191..f7d677555bc6c4efc79aab6fcafcb1058a92d74c 100644 --- a/graph_framework/cpu_context.hpp +++ b/graph_framework/cpu_context.hpp @@ -14,7 +14,8 @@ #include #include -// Clang headers will define IBAction and IBOutlet these so undefine them here. +// Clang headers will define IBAction and IBOutlet these so undefined them +// here. #undef IBAction #undef IBOutlet #include "llvm/Support/VirtualFileSystem.h" @@ -53,7 +54,7 @@ namespace gpu { /// /// The exec functions need the arguments split into individual calls. So this /// splits the strings that come from cmake into a char \* vector. Note the -/// first token will be duplacted in the first two elements. +/// first token will be duplicated in the first two elements. /// /// @param[in] string Input string. /// @returns The string split into an array of arguments. @@ -106,7 +107,7 @@ namespace gpu { } //------------------------------------------------------------------------------ -/// @brief Device discription. +/// @brief Device description. //------------------------------------------------------------------------------ static std::string device_type() { return "CPU"; diff --git a/graph_framework/cuda_context.hpp b/graph_framework/cuda_context.hpp index e2f31ac54adc52da0d25b9f64cfacb1cc5d2425c..ee02e0bfc43248ed9b006f268699e6d980d90a43 100644 --- a/graph_framework/cuda_context.hpp +++ b/graph_framework/cuda_context.hpp @@ -53,14 +53,14 @@ namespace gpu { } //------------------------------------------------------------------------------ -/// @brief Initalize cuda. +/// @brief Initialize cuda. //------------------------------------------------------------------------------ static CUresult cuda_init() { const CUresult result = cuInit(0); check_error(result, "cuInit"); return result; } -/// Initalize Cuda. +/// Initialize Cuda. static const CUresult result = cuda_init(); //------------------------------------------------------------------------------ @@ -125,7 +125,7 @@ namespace gpu { } //------------------------------------------------------------------------------ -/// @brief Device discription. +/// @brief Device description. //------------------------------------------------------------------------------ static std::string device_type() { return "Cuda GPU"; diff --git a/graph_framework/dispersion.hpp b/graph_framework/dispersion.hpp index 0727f38eee9421102a37a637d49b12538734aa63..dc47b2d2af9928dba8fb54bc3a302c9865ce06c3 100644 --- a/graph_framework/dispersion.hpp +++ b/graph_framework/dispersion.hpp @@ -21,7 +21,7 @@ ///
@f$c @f$ @f$\frac{m}{s}@f$Speed of light. ///
@f$m_{e}@f$ @f$kg @f$ Electron mass ///
@f$t_{e}@f$ @f$K @f$ Electron temperature -///
@f$n_{e}@f$ @f$m^{-3}@f$ Electron Denisty +///
@f$n_{e}@f$ @f$m^{-3}@f$ Electron Density ///
@f$q @f$ @f$C @f$ Fundamental Charge ///
@f$\vec{B}@f$ @f$T @f$ Magnetic field ///
@f$\epsilon_{0}@f$@f$\frac{F}{m}@f$Vacuum permittivity @@ -36,15 +36,15 @@ ///
/// /// @section dispersion_function_normal Normalization -/// The dispersion functions use normalized quantities for frequncy @f$\omega @f$ and +/// The dispersion functions use normalized quantities for frequency @f$\omega @f$ and /// time @f$t @f$. These are scaled to the speed of light @f$c @f$. /// -/// +/// ///
Disperion function units and normalizationsDispersion function units and normalizations
Symbol Real Unit Modified Modified UnitDescription ///
@f$\omega @f$ @f$s^{-1}@f$ @f$\omega'=\frac{\omega}{c}@f$ @f$m^{-1}@f$ Wave frequency ///
@f$\vec{k}@f$ @f$m^{-1}@f$ @f$\vec{k}@f$ @f$m^{-1}@f$ Wave number ///
@f$t @f$ @f$s @f$ @f$t'=tc @f$ @f$m @f$ Time -///
@f$\vec{x}@f$ @f$m @f$ @f$\vec{x}@f$ @f$m @f$ Postion +///
@f$\vec{x}@f$ @f$m @f$ @f$\vec{x}@f$ @f$m @f$ Position ///
@f$v_{p}=\frac{\omega}{k}@f$ @f$\frac{m}{s}@f$@f$v'_{p}=\frac{\omega'}{k}@f$ @f$1 @f$ Phase velocity ///
@f$v_{g}=\frac{\partial\omega}{\partial k}@f$@f$\frac{m}{s}@f$@f$v'_{g}=\frac{\partial\omega'}{\partial k}@f$@f$1 @f$ Group velocity ///
@@ -60,13 +60,13 @@ /// The following dispersion functions are available in xrays. /// /// @subsection dispersion_function_simple Simple -/// This disperison function represents a wave in a vacuum. +/// This dispersion function represents a wave in a vacuum. /// @f{equation}{D\left(\vec{x},\vec{k},\omega\right)=\frac{\vec{k}\cdot\vec{k}}{\omega^{2}}-1\equiv 0 @f} /// It has no resonances or cutoffs. /// ///
/// @subsection dispersion_function_bohm_gross Bohm Gross -/// This dispersion function now accounts for how occilations in the plasma +/// This dispersion function now accounts for how occupations in the plasma /// propagate. /// @f{equation}{D\left(\vec{x},\vec{k},\omega\right)=\omega_{pe}+\frac{3}{2}\vec{k}\cdot\vec{k}v^{2}_{th}-\omega^{2}\equiv 0 @f} /// It has no resonances. Waves cannot propagate below @f$\omega_{pe}@f$ and @f$v_{g}@f$ can never exceed @f$v_{th}@f$. @@ -74,7 +74,7 @@ /// ///
/// @subsection dispersion_function_o_wave Ordinary Wave -/// This disperison function represents a wave with a +/// This dispersion function represents a wave with a /// @f$\vec{E}_{1}||\vec{B}_{0}@f$. That means the electric field occilates /// parallel to the magnetic field. /// @f{equation}{D\left(\vec{x},\vec{k},\omega\right)=1-\frac{\omega^{2}_{pe}}{\omega^{2}}-\vec{n}_{\perp}\cdot\vec{n}_{\perp}\equiv 0 @f} @@ -83,32 +83,33 @@ /// ///
/// @subsection dispersion_function_x_wave Extra Ordinary Wave -/// This disperison function represents a wave with a +/// This dispersion function represents a wave with a /// @f$\vec{E}_{1}\perp\vec{B}_{0}@f$. That means the electric field occilates /// perpendicular to the magnetic field. /// @f{equation}{D\left(\vec{x},\vec{k},\omega\right)=1-\frac{\omega_{pe}^2}{\omega^{2}}\frac{\omega^{2}-\omega_{pe}^2}{\omega^{2}-\omega_{h}^2}-\vec{n}_{\perp}\cdot\vec{n}_{\perp}\equiv 0 @f} /// This mode has -/// This wave has two branches. One branch is cannot not progagate below the -/// @f$\omega_{r}@f$ cutoff. The other branch cannot not progagate below the -/// @f$\omega_{l}@f$ cutoff. As the wave approches the upper hybrid fequency, -/// wave propagation stops as the wave number approces +/// This wave has two branches. One branch is cannot not propagate below the +/// @f$\omega_{r}@f$ cutoff. The other branch cannot not propagate below the +/// @f$\omega_{l}@f$ cutoff. As the wave approaches the upper hybrid frequency, +/// wave propagation stops as the wave number approaches /// @f$\left|\vec{k}\right|\rightarrow\infty @f$. /// @image{} html X-Mode.png "" /// ///
/// @subsection dispersion_function_cold_plasma Cold Plasma -/// This disperison function represents a wave in a cold plasma medium. +/// This dispersion function represents a wave in a cold plasma medium. /// @f{equation}{D\left(\vec{x},\vec{k},\omega\right)=det\left(\vec{\epsilon}+\vec{n}\vec{n}-\vec{n}\cdot\vec{n}\vec{I}\right)\equiv 0 @f} -/// The quantity @f$\vec{\epsilon}@f$ is the diaelectric tensor. Using Onsager +/// The quantity @f$\vec{\epsilon}@f$ is the dielectric tensor. Using Onsager /// symmetries, this tensor is defined as /// @f{equation}{\vec{\epsilon}=\left(\begin{array}{ccc}\epsilon_{11}&\epsilon_{12}&0\\-\epsilon_{12}&\epsilon_{11}&0\\0&0&\epsilon_{33}\end{array}\right)@f} /// where /// @f{equation}{\epsilon_{11}=1-\sum_{s}\frac{\frac{\omega^{2}_{p}}{\omega^{2}}}{1-\frac{\Omega^{2}_{c}}{\omega^{2}}}@f} /// @f{equation}{\epsilon_{12}=-i\sum_{s}\frac{\frac{\Omega_{c}}{\omega}\frac{\omega^{2}_{p}}{\omega^{2}}}{1-\frac{\Omega^{2}_{c}}{\omega^{2}}}@f} /// @f{equation}{\epsilon_{33}=1-\sum_{s}\frac{\omega^{2}_{p}}{\omega^{2}}@f} -/// Note here we are including the plasma frequency for ions aswell. This +/// Note here we are including the plasma frequency for ions as well. This /// dispersion function is effectively a super position of the O-Mode and -/// X-Mode dispersion functions and as such has the same cutoffs and resonaces. +/// X-Mode dispersion functions and as such has the same cutoffs and +/// resonances. /// @image{} html ColdPlasma.png "" /// ///
@@ -116,8 +117,8 @@ /// This section is intended for code developers and outlines how to create new /// dispersion functions. New dispersion functions can be created from a /// subclass of @ref dispersion::dispersion_function or any other existing -/// dispersion_function class and overloading class methods. For convinence the -/// @ref dispersion::physics class contains several defined physical constants. +/// dispersion_function class and overloading class methods. For convenience +/// the @ref dispersion::physics class contains several defined physical constants. /// @code /// template /// class new_dispersion final : public dispersion_function { @@ -125,7 +126,7 @@ /// }; /// @endcode /// When a new dispersion function is subclassed from -/// @ref dispersion::dispersion_function an implimentation must be provided for +/// @ref dispersion::dispersion_function an implementation must be provided for /// the pure virtual method @ref dispersion::dispersion_function::D. /// @code /// template @@ -238,30 +239,30 @@ namespace dispersion { // Common physics expressions. //****************************************************************************** //------------------------------------------------------------------------------ -/// @brief Build plasma fequency expression. +/// @brief Build plasma frequency expression. /// /// @tparam T Base type of the calculation. /// @tparam SAFE_MATH Use @ref general_concepts_safe_math operations. /// -/// @param[in] n Density. -/// @param[in] q Species charge. -/// @param[in] m Species mass. -/// @param[in] c Speed of light -/// @param[in] epsion0 Vacuum permitixity. +/// @param[in] n Density. +/// @param[in] q Species charge. +/// @param[in] m Species mass. +/// @param[in] c Speed of light +/// @param[in] epsilon0 Vacuum permittivity. /// @returns The plasma frequency. //------------------------------------------------------------------------------ template static constexpr graph::shared_leaf - build_plasma_fequency(graph::shared_leaf n, - const T q, - const T m, - const T c, - const T epsion0) { - return n*q*q/(epsion0*m*c*c); + build_plasma_frequency(graph::shared_leaf n, + const T q, + const T m, + const T c, + const T epsilon0) { + return n*q*q/(epsilon0*m*c*c); } //------------------------------------------------------------------------------ -/// @brief Build cyclotron fequency expression. +/// @brief Build cyclotron frequency expression. /// /// @tparam T Base type of the calculation. /// @tparam SAFE_MATH Use @ref general_concepts_safe_math operations. @@ -274,10 +275,10 @@ namespace dispersion { //------------------------------------------------------------------------------ template static constexpr graph::shared_leaf - build_cyclotron_fequency(const T q, - graph::shared_leaf b, - const T m, - const T c) { + build_cyclotron_frequency(const T q, + graph::shared_leaf b, + const T m, + const T c) { return q*b/(m*c); } @@ -340,7 +341,7 @@ namespace dispersion { /// /// dx/dt = -1.0E3*(x - Exp(-t)) - Exp(-t) (1) /// -/// We need to figure out a disperison function D(w,k,x) such that +/// We need to figure out a dispersion function D(w,k,x) such that /// /// dx/dt = -(dD/dk)/(dD/dw) = -1.0E3*(x - Exp(-t)) - Exp(-t). (2) /// @@ -430,8 +431,8 @@ namespace dispersion { class physics : public dispersion_function { protected: // Define some common constants. -/// Vacuum permitivity. - const T epsion0 = 8.8541878138E-12; +/// Vacuum permittivity. + const T epsilon0 = 8.8541878138E-12; /// Vacuum permeability const T mu0 = M_PI*4.0E-7; /// Fundamental charge. @@ -439,7 +440,7 @@ namespace dispersion { /// Electron mass. const T me = 9.1093837015E-31; /// Speed of light. - const T c = static_cast (1.0)/std::sqrt(epsion0*mu0); + const T c = static_cast (1.0)/std::sqrt(epsilon0*mu0); }; //------------------------------------------------------------------------------ @@ -481,10 +482,10 @@ namespace dispersion { // Equilibrium quantities. auto ne = eq->get_electron_density(x, y, z); - auto wpe2 = build_plasma_fequency(ne, physics::q, - physics::me, - physics::c, - physics::epsion0); + auto wpe2 = build_plasma_frequency(ne, physics::q, + physics::me, + physics::c, + physics::epsilon0); auto te = eq->get_electron_temperature(x, y, z); // 2*1.602176634E-19 to convert eV to J. @@ -551,11 +552,11 @@ namespace dispersion { // Equilibrium quantities. auto ne = eq->get_electron_density(x, y, z); - auto wpe2 = build_plasma_fequency(ne, - physics::q, - physics::me, - physics::c, - physics::epsion0); + auto wpe2 = build_plasma_frequency(ne, + physics::q, + physics::me, + physics::c, + physics::epsilon0); // Wave numbers should be parallel to B if there is a magnetic field. Otherwise // B should be zero. @@ -636,16 +637,16 @@ namespace dispersion { }; //------------------------------------------------------------------------------ -/// @brief Guassian Well dispersion function. +/// @brief Gaussian Well dispersion function. /// /// @tparam T Base type of the calculation. /// @tparam SAFE_MATH Use @ref general_concepts_safe_math operations. //------------------------------------------------------------------------------ template - class guassian_well final : public dispersion_function { + class gaussian_well final : public dispersion_function { public: //------------------------------------------------------------------------------ -/// @brief Disperison relation with a non uniform well. +/// @brief Dispersion relation with a non uniform well. /// /// D = npar^2 + nperp^2 - (1 - 0.5*Exp(-x^2/0.1) /// @@ -687,7 +688,7 @@ namespace dispersion { class ion_cyclotron final : public physics { public: //------------------------------------------------------------------------------ -/// @brief Disperison relation for the O mode. +/// @brief Dispersion relation for the O mode. /// /// D = ⍵ce^2 + k^2*vs^2 - ⍵^2 (1) /// @@ -727,10 +728,10 @@ namespace dispersion { physics::c); auto b_vec = eq->get_magnetic_field(x, y, z); - auto wce = build_cyclotron_fequency(-physics::q, - b_vec->length(), - physics::me, - physics::c); + auto wce = build_cyclotron_frequency(-physics::q, + b_vec->length(), + physics::me, + physics::c); // Wave numbers. auto k = kx*eq->get_esup1(x, y, z) @@ -756,7 +757,7 @@ namespace dispersion { class ordinary_wave final : public physics { public: //------------------------------------------------------------------------------ -/// @brief Disperison relation for the O mode. +/// @brief Dispersion relation for the O mode. /// /// D = 1 - ⍵pe^2/⍵^2 - c^2/⍵^2*(kx^2 + ky^2 + kz^2) (1) /// @@ -784,11 +785,11 @@ namespace dispersion { equilibrium::shared &eq) { // Equilibrium quantities. auto ne = eq->get_electron_density(x, y, z); - auto wpe2 = build_plasma_fequency(ne, - physics::q, - physics::me, - physics::c, - physics::epsion0); + auto wpe2 = build_plasma_frequency(ne, + physics::q, + physics::me, + physics::c, + physics::epsilon0); // Wave numbers. auto n = (kx*eq->get_esup1(x, y, z) + @@ -815,7 +816,7 @@ namespace dispersion { class extra_ordinary_wave final : public physics { public: //------------------------------------------------------------------------------ -/// @brief Disperison relation for the X-Mode. +/// @brief Dispersion relation for the X-Mode. /// /// D = 1 - ⍵pe^2/⍵^2(⍵^2 - ⍵pe^2)/(⍵^2 - ⍵h^2) /// - c^2/⍵^2*(kx^2 + ky^2 + kz^2) (1) @@ -848,18 +849,18 @@ namespace dispersion { equilibrium::shared &eq) { // Equilibrium quantities. auto ne = eq->get_electron_density(x, y, z); - auto wpe2 = build_plasma_fequency(ne, - physics::q, - physics::me, - physics::c, - physics::epsion0); + auto wpe2 = build_plasma_frequency(ne, + physics::q, + physics::me, + physics::c, + physics::epsilon0); auto b_vec = eq->get_magnetic_field(x, y, z); auto b_len = b_vec->length(); - auto wec = build_cyclotron_fequency(-physics::q, - b_len, - physics::me, - physics::c); + auto wec = build_cyclotron_frequency(-physics::q, + b_len, + physics::me, + physics::c); // Wave numbers. auto n = (kx*eq->get_esup1(x, y, z) + @@ -878,7 +879,7 @@ namespace dispersion { }; //------------------------------------------------------------------------------ -/// @brief Cold Plasma Disperison function. +/// @brief Cold Plasma Dispersion function. /// /// @tparam T Base type of the calculation. /// @tparam SAFE_MATH Use @ref general_concepts_safe_math operations. @@ -887,7 +888,7 @@ namespace dispersion { class cold_plasma : public physics { public: //------------------------------------------------------------------------------ -/// @brief Cold Plasma Disperison function. +/// @brief Cold Plasma Dispersion function. /// /// D = Det[ϵ + nn - n^2I] (1) /// @@ -936,17 +937,17 @@ namespace dispersion { // Dielectric terms. // Frequencies auto ne = eq->get_electron_density(x, y, z); - auto wpe2 = build_plasma_fequency(ne, - physics::q, - physics::me, - physics::c, - physics::epsion0); + auto wpe2 = build_plasma_frequency(ne, + physics::q, + physics::me, + physics::c, + physics::epsilon0); auto b_vec = eq->get_magnetic_field(x, y, z); auto b_len = b_vec->length(); - auto ec = build_cyclotron_fequency(-physics::q, - b_len, - physics::me, - physics::c); + auto ec = build_cyclotron_frequency(-physics::q, + b_len, + physics::me, + physics::c); auto w2 = w*w; auto denome = 1.0 - ec*ec/w2; @@ -960,11 +961,11 @@ namespace dispersion { * physics::q; auto ni = eq->get_ion_density(i, x, y, z); - auto wpi2 = build_plasma_fequency(ni, charge, mi, - physics::c, - physics::epsion0); - auto ic = build_cyclotron_fequency(charge, b_len, mi, - physics::c); + auto wpi2 = build_plasma_frequency(ni, charge, mi, + physics::c, + physics::epsilon0); + auto ic = build_cyclotron_frequency(charge, b_len, mi, + physics::c); auto denomi = 1.0 - ic*ic/w2; e11 = e11 - (wpi2/w2)/denomi; @@ -998,7 +999,7 @@ namespace dispersion { }; //------------------------------------------------------------------------------ -/// @brief Cold Plasma expansion disperison function. +/// @brief Cold Plasma expansion dispersion function. /// /// @tparam T Base type of the calculation. /// @tparam SAFE_MATH Use @ref general_concepts_safe_math operations. @@ -1007,7 +1008,7 @@ namespace dispersion { class cold_plasma_expansion : public physics { public: //------------------------------------------------------------------------------ -/// @brief Cold Plasma expansion Disperison function. +/// @brief Cold Plasma expansion Dispersion function. /// /// Dc = -P/2(1 + Ωe/⍵)Γ0 + (1 - Ωe^2/⍵^2)Γ1 (1) /// @@ -1052,16 +1053,16 @@ namespace dispersion { / physics::c; // Setup characteristic frequencies. - auto ec = build_cyclotron_fequency(physics::q, - b_len, + auto ec = build_cyclotron_frequency(physics::q, + b_len, + physics::me, + physics::c); + auto wpe2 = build_plasma_frequency(ne, physics::q, physics::me, - physics::c); - auto wpe2 = build_plasma_fequency(ne, physics::q, - physics::me, - physics::c, - physics::epsion0); + physics::c, + physics::epsilon0); -// Disperison quantities. +// Dispersion quantities. auto P = wpe2/(w*w); auto q = P/(2.0*(1.0 + ec/w)); @@ -1089,7 +1090,7 @@ namespace dispersion { }; //------------------------------------------------------------------------------ -/// @brief Hot Plasma Disperison function. +/// @brief Hot Plasma Dispersion function. //------------------------------------------------------------------------------ template class hot_plasma final : public physics { @@ -1099,7 +1100,7 @@ namespace dispersion { public: //------------------------------------------------------------------------------ -/// @brief Hot Plasma Disperison function. +/// @brief Hot Plasma Dispersion function. /// /// D = iσΓ0 + Γ1 + n⟂^2P⍵/Ωe(1 + ζZ(ζ))(Γ2 + Γ5F) (1) /// @@ -1156,16 +1157,16 @@ namespace dispersion { / physics::c; // Setup characteristic frequencies. - auto ec = build_cyclotron_fequency(physics::q, - b_len, + auto ec = build_cyclotron_frequency(physics::q, + b_len, + physics::me, + physics::c); + auto wpe2 = build_plasma_frequency(ne, physics::q, physics::me, - physics::c); - auto wpe2 = build_plasma_fequency(ne, physics::q, - physics::me, - physics::c, - physics::epsion0); + physics::c, + physics::epsilon0); -// Disperison quantities. +// Dispersion quantities. auto P = wpe2/(w*w); auto q = P/(2.0*(1.0 + ec/w)); @@ -1200,7 +1201,7 @@ namespace dispersion { }; //------------------------------------------------------------------------------ -/// @brief Hot Plasma Expansion Disperison function. +/// @brief Hot Plasma Expansion Dispersion function. /// /// @tparam T Base type of the calculation. /// @tparam Z Z function class. @@ -1268,15 +1269,15 @@ namespace dispersion { physics::me); // Setup characteristic frequencies. - auto ec = build_cyclotron_fequency(physics::q, b_len, + auto ec = build_cyclotron_frequency(physics::q, b_len, + physics::me, + physics::c); + auto wpe2 = build_plasma_frequency(ne, physics::q, physics::me, - physics::c); - auto wpe2 = build_plasma_fequency(ne, physics::q, - physics::me, - physics::c, - physics::epsion0); + physics::c, + physics::epsilon0); -// Disperison quantities. +// Dispersion quantities. auto P = wpe2/(w*w); auto q = P/(2.0*(1.0 + ec/w)); @@ -1326,7 +1327,7 @@ namespace dispersion { template class dispersion_interface { protected: -/// Disperison function. +/// Dispersion function. graph::shared_leaf D; @@ -1421,11 +1422,11 @@ namespace dispersion { /// @param[in,out] x The unknown to solver for. /// @param[in] inputs Inputs for jit compile. /// @param[in] index Concurrent index. -/// @param[in] tolarance Tolarance to solve the dispersion function -/// to. +/// @param[in] tolerance Tolerance to solve the dispersion function +/// to. /// @param[in] max_iterations Maximum number of iterations before giving -/// up. -/// @returns The residule graph. +/// up. +/// @returns The residual graph. //------------------------------------------------------------------------------ graph::shared_leaf @@ -1434,7 +1435,7 @@ namespace dispersion { graph::input_nodes inputs, const size_t index=0, - const typename DISPERSION_FUNCTION::base tolarance = 1.0E-30, + const typename DISPERSION_FUNCTION::base tolerance = 1.0E-30, const size_t max_iterations = 1000) { auto x_var = graph::variable_cast(x); @@ -1444,7 +1445,7 @@ namespace dispersion { solver::newton(work, {x}, inputs, this->D, graph::shared_random_state (), - tolarance, max_iterations); + tolerance, max_iterations); work.compile(); work.run(); @@ -1455,18 +1456,18 @@ namespace dispersion { } //------------------------------------------------------------------------------ -/// @brief Get the disperison residule. +/// @brief Get the dispersion residual. /// /// @return D*D //------------------------------------------------------------------------------ graph::shared_leaf - get_residule() { + get_residual() { return this->D*this->D; } //------------------------------------------------------------------------------ -/// @brief Get the disperison function. +/// @brief Get the dispersion function. /// /// @return D(x,y,z,kx,ky,kz,w) //------------------------------------------------------------------------------ diff --git a/graph_framework/equilibrium.hpp b/graph_framework/equilibrium.hpp index 4433fa07f6f4a7733c09ce944674e0c7540f240e..a35625a6219dc863dd3ecd7eeff5b13101f9b609 100644 --- a/graph_framework/equilibrium.hpp +++ b/graph_framework/equilibrium.hpp @@ -1,52 +1,52 @@ //------------------------------------------------------------------------------ /// @file equilibrium.hpp -/// @brief Class signature to impliment plasma equilibrium. +/// @brief Class signature to implement plasma equilibrium. /// /// Defined the interfaces to access plasma equilibrium. //------------------------------------------------------------------------------ -/// @page equilibrum_models Equilibrium Models +/// @page equilibrium_models Equilibrium Models /// @brief Documentation for formatting equilibrium files. /// @tableofcontents /// -/// @section equilibrum_models_intro Introduction +/// @section equilibrium_models_intro Introduction /// This page documents the types and formatting of the equilibrium models. /// xrays currently supports two equilibrium models. -/// * EFIT Are 2D axisymetric equilibria relevant to tokamak devices. +/// * EFIT Are 2D axisymmetric equilibria relevant to tokamak devices. /// * VMEC Are 3D nested flux surface equilibria relevant for stellarator devices. /// /// This documentation assumes the user has some familiarity with EFIT or VMEC -/// and focuses instead how quanties from these are formatted. +/// and focuses instead how quantities from these are formatted. /// -/// @section equilibrum_splines Spline Formatting +/// @section equilibrium_splines Spline Formatting /// The equilibrium models used in this section make use of Cubic and Bicubic /// splines. /// ///
-/// @subsection equilibrum_splines_1D Cubic Splines -/// Cubic splines are 1D interpolation functions consisting of 4 coeffient +/// @subsection equilibrium_splines_1D Cubic Splines +/// Cubic splines are 1D interpolation functions consisting of 4 coefficient /// arrays. They take the form of /// @f{equation}{y\left(x\right)=C_{0} + C_{1}x + C_{2}x^2 + C_{3}x^2@f} /// where @f$x@f$ is a normalized radial index. Cubic splines coefficients can /// be calculated using /// Linear Solvers /// However, to avoid needing account for index offsets, index offsets are pre -/// computed into the spline coefficents. +/// computed into the spline coefficients. /// @f{equation}{C'^{i}_{0}=C^{i}_{0} - C^{i}_{1}i + C^{i}_{2}i^2 - C^{i}_{3}i^3@f} /// @f{equation}{C'^{i}_{1}=C^{i}_{1} -2C^{i}_{2}i + 3C^{i}_{3}i^2@f} /// @f{equation}{C'^{i}_{2}=C^{i}_{2} - 3C^{i}_{3}i@f} /// @f{equation}{C'^{i}_{3}=C^{i}_{3}@f} -/// Where @f$i@f$ is the index of the coeffient array. This allows to normalize -/// the spline argument @f$x@f$ so that it can both index the array and -/// evaluate the spline. +/// Where @f$i@f$ is the index of the coefficient array. This allows to +/// normalize the spline argument @f$x@f$ so that it can both index the array +/// and evaluate the spline. /// @f{equation}{x = \frac{x_{real} - x_{min}}{dx}@f} /// Rounding down the value of @f$x@f$ gives the correct coefficient index. /// ///
-/// @subsection equilibrum_splines_2D Bicubic Splines -/// Bicubic Splines are computed in a simular way instead they consist of a -/// total of 16 coeffients. These represent 4 spline functions in one -/// dimension which interpolate 4 coeffient values for the other dimension. -/// Like the 1D splines, 2D spline coeffients are normalized so the spline +/// @subsection equilibrium_splines_2D Bicubic Splines +/// Bicubic Splines are computed in a similar way instead they consist of a +/// total of 16 coefficients. These represent 4 spline functions in one +/// dimension which interpolate 4 coefficient values for the other dimension. +/// Like the 1D splines, 2D spline coefficients are normalized so the spline /// arguments can be used as normalized indices. /// @f{equation}{C'^{ij}_{00}=C^{ij}_{00}-C^{ij}_{01}j+C^{ij}_{02}j^{2}-C^{ij}_{03}j^{3}-C^{ij}_{10}i+C^{ij}_{11}ij-C^{ij}_{12}ij^{2}+C^{ij}_{13}ij^{3}+C^{ij}_{20}i^{2}-C^{ij}_{21}i^{2}j+C^{ij}_{22}i^{2}j^{2}-C^{ij}_{23}i^{2}j^{3}-C^{ij}_{30}i^{3}+C^{ij}_{31}i^{3}j-C^{ij}_{32}i^{3}j^{2}+C^{ij}_{33}i^{3}j^{3}j@f} /// @f{equation}{C'^{ij}_{01}=C^{ij}_{01}-2C^{ij}_{02}j+3C^{ij}_{03}j^{2}-C^{ij}_{11}i+2C^{ij}_{12}ij-3C^{ij}_{13}ij^{2}+C^{ij}_{21}i^{2}-2C^{ij}_{22}i^{2}j+3C^{ij}_{23}i^{2}j^{2}-C^{ij}_{31}i^{3}+2C^{ij}_{32}i^{3}j-3C^{ij}_{33}i^{3}j^{2}@f} @@ -71,95 +71,95 @@ /// @f{equation}{y = \frac{y_{real} - y_{min}}{dy}@f} /// ///
-/// @section equilibrum_efit EFIT +/// @section equilibrium_efit EFIT /// @image{} html Efit.png "Cross section of poloidal flux surfaces." -/// EFIT is an equilibium that comes from a solution of the +/// EFIT is an equilibrium that comes from a solution of the /// Grad–Shafranov equation. /// The solution gives us a map of the poloidal flux @f$\psi@f$ on 2D grid and -/// a 1D flux function @f$f_{pol}@f$. 1D profiles of electrion density +/// a 1D flux function @f$f_{pol}@f$. 1D profiles of electron density /// @f$n_{e}\left(\psi\right)@f$, electron temperature /// @f$t_{e}\left(\psi\right)@f$, and pressure @f$p\left(\psi\right)@f$ are /// mapped as functions of the normalized flux. /// -/// @subsection equilibrum_efit_format EFIT file format +/// @subsection equilibrium_efit_format EFIT file format /// Quantities are loaded into the ray tracer via a netcdf file. EFIT NetCDF -/// files must contain the following quantities. Spline quanities have a common -/// format of name_ci or name_cij. +/// files must contain the following quantities. Spline quantities have a +/// common format of name_ci or name_cij. /// -/// +/// ///
Efit netcdf file quantitiesEfit netcdf file quantities
Dimensions ///
Name Discription ///
numr Size of radial grid. ///
numz Size of vertical grid. ///
numpsi Size of arrays for @f$\psi@f$ mapped quantities. -///
Scalar Qantities +///
Scalar Quantities ///
dpsi Step size of the @f$\psi@f$ grid. ///
dr Step size of the radial grid. -///
dz Step size of the vertial grid. +///
dz Step size of the vertical grid. ///
ne_scale Scale of the @f$n_{e}@f$ profile. ///
pres_scale Scale of the pressure profile. ///
psibry Value of @f$\psi@f$ at the boundary. ///
psimin Minimum @f$\psi@f$ value. ///
rmin Minimum radial value. ///
te_scale Scale of the electron temperature profile. -///
zmin Minimum vertial value. -///
1D Qantities -///
NameSize Discription -///
fpol_ci numpsi Flux function profile coefficents -///
ne_ci numpsi @f$n_{e}@f$ profile coefficents. -///
pressure_ci numpsi Pressure profile coefficents. -///
te_ci numpsi @f$t_{e}@f$ profile coefficents. -///
2D Qantities -///
NameSize Discription -///
psi_cij (numr,numz)@f$\psi\left(r,z\right)@f$ coefficents. +///
zmin Minimum vertical value. +///
1D Quantities +///
NameSize Description +///
fpol_ci numpsi Flux function profile coefficients +///
ne_ci numpsi @f$n_{e}@f$ profile coefficients. +///
pressure_ci numpsi Pressure profile coefficients. +///
te_ci numpsi @f$t_{e}@f$ profile coefficients. +///
2D Quantities +///
NameSize Description +///
psi_cij (numr,numz)@f$\psi\left(r,z\right)@f$ coefficients. ///
/// ///
-/// @section equilibrum_vmec VMEC +/// @section equilibrium_vmec VMEC /// @image{} html vmec.png "Cross section of 3D flux surfaces." -/// VMEC is an equilibium that comes from +/// VMEC is an equilibrium that comes from /// minimizing mhd energy. -/// The solution gives us set of Fourier coefficents on a discrete radial grid. -/// 1D profiles of electrion density +/// The solution gives us set of Fourier coefficients on a discrete radial +/// grid. 1D profiles of electron density /// @f$n_{e}\left(\psi\right)@f$, electron temperature /// @f$t_{e}\left(\psi\right)@f$, and pressure @f$p\left(\psi\right)@f$ are /// mapped as functions of the normalized flux. /// -/// @subsection equilibrum_vmec_format VMEC file format +/// @subsection equilibrium_vmec_format VMEC file format /// Quantities are loaded into the ray tracer via a netcdf file. VMEC NetCDF -/// files must contain the following quantities. Spline quanities have a common -/// format of name_ci. All radial quantities are splined accross -/// the magnetic axis to the opposite end. That is quantities extend from -/// @f$-s\rightarrow s @f$. Splines of fourier coeffients are one dimensional -/// splines stored in a 2D array. Radial quantities are stored as a full or -/// half grid value. +/// files must contain the following quantities. Spline quantities have a +/// common format of name_ci. All radial quantities are splined +/// accross the magnetic axis to the opposite end. That is quantities extend +/// from @f$-s\rightarrow s @f$. Splines of fourier coeffients are one +/// dimensional splines stored in a 2D array. Radial quantities are stored as a +/// full or half grid value. /// -/// +/// ///
VMEC netcdf file quantitiesVMEC netcdf file quantities
Dimensions -///
Name Discription +///
Name Description ///
numsf Size of full radial grid. ///
numsh Size of half radial grid. ///
nummn Number of Fourier modes. -///
Scalar Qantities +///
Scalar Quantities ///
dphi Step size of toroidal flux. ///
ds Step size of normalized toroidal flux. ///
signj Sign of the Jacobian. ///
sminf Minimum @f$s @f$ on the full grid. ///
sminh Minimum @f$s @f$ on the half grid. -///
1D Qantities -///
Name Size Discription +///
1D Quantities +///
Name Size Description ///
chi_ci numsf Poloidal flux profile. ///
xm nummn Poloidal modes. ///
xn nummn Toroidal modes. -///
2D Qantities -///
Name Size Discription -///
lmns_ci (numsh,nummn)@f$\lambda @f$ fourier coefficents. -///
rmnc_ci (numsf,nummn)@f$r @f$ fourier coefficents. -///
zmns_ci (numsf,nummn)@f$z @f$ fourier coefficents. +///
2D Quantities +///
Name Size Description +///
lmns_ci (numsh,nummn)@f$\lambda @f$ fourier coefficients. +///
rmnc_ci (numsf,nummn)@f$r @f$ fourier coefficients. +///
zmns_ci (numsf,nummn)@f$z @f$ fourier coefficients. ///
/// ///
-/// @section equilibrum_devel Developing new equilibrium models +/// @section equilibrium_devel Developing new equilibrium models /// This section is intended for code developers and outlines how to create new /// equilibrium models. All equilibrium model use the same /// @ref equilibrium::generic interface. New equilibrium models can be created @@ -173,7 +173,7 @@ /// @endcode /// /// When a new equilibrium is -/// subclassed from @ref equilibrium::generic implimentations must be provided +/// subclassed from @ref equilibrium::generic implementations must be provided /// for the following pure virtual methods. /// * @ref equilibrium::generic::get_characteristic_field /// * @ref equilibrium::generic::get_electron_density @@ -190,10 +190,10 @@ /// arguments provide expressions for the input position of the ray. The /// methods return are expressions for the quantity at hand. /// -/// @subsection equilibrum_devel_coordinate Noncartesian Coordinates +/// @subsection equilibrium_devel_coordinate Non-cartesian Coordinates /// While these methods take an @f$x,y,z @f$ as the argument names, there is /// no reason these need to be assumed to be cartesian coordinates. For -/// instance the @ref equilibrum_vmec treats @f$x,y,z\rightarrow s,u,v @f$ as +/// instance the @ref equilibrium_vmec treats @f$x,y,z\rightarrow s,u,v @f$ as /// flux coordinates. In flux coordinate the coordinate system is no longer /// normalized nor orthogonal. So that other parts of the code can treat /// @f$\vec{k}@f$ correctly there are methods to return the covariant basis @@ -222,7 +222,7 @@ /// Name space for equilibrium models. namespace equilibrium { -/// Lock to syncronize netcdf accross threads. +/// Lock to synchronize netcdf across threads. static std::mutex sync; //****************************************************************************** @@ -244,7 +244,7 @@ namespace equilibrium { public: //------------------------------------------------------------------------------ -/// @brief Construct a generic equilibrum. +/// @brief Construct a generic equilibrium. /// /// @param[in] masses Vector of ion masses. /// @param[in] charges Vector of ion charges. @@ -373,7 +373,7 @@ namespace equilibrium { //------------------------------------------------------------------------------ /// @brief Get the contravariant basis vector in the x1 direction. /// -/// @param[in] x1 X1 posiiton. +/// @param[in] x1 X1 position. /// @param[in] x2 X2 position. /// @param[in] x3 X3 position. /// @returns The contravaraiant basis vector in x1. @@ -390,7 +390,7 @@ namespace equilibrium { //------------------------------------------------------------------------------ /// @brief Get the contravariant basis vector in the x2 direction. /// -/// @param[in] x1 X1 posiiton. +/// @param[in] x1 X1 position. /// @param[in] x2 X2 position. /// @param[in] x3 X3 position. /// @returns The contravaraiant basis vector in x2. @@ -407,7 +407,7 @@ namespace equilibrium { //------------------------------------------------------------------------------ /// @brief Get the contravariant basis vector in the x3 direction. /// -/// @param[in] x1 X1 posiiton. +/// @param[in] x1 X1 position. /// @param[in] x2 X2 position. /// @param[in] x3 X3 position. /// @returns The contravaraiant basis vector in x3. @@ -424,7 +424,7 @@ namespace equilibrium { //------------------------------------------------------------------------------ /// @brief Get the x position. /// -/// @param[in] x1 X1 posiiton. +/// @param[in] x1 X1 position. /// @param[in] x2 X2 position. /// @param[in] x3 X3 position. /// @returns The x position. @@ -439,7 +439,7 @@ namespace equilibrium { //------------------------------------------------------------------------------ /// @brief Get the y position. /// -/// @param[in] x1 X1 posiiton. +/// @param[in] x1 X1 position. /// @param[in] x2 X2 position. /// @param[in] x3 X3 position. /// @returns The y position. @@ -454,7 +454,7 @@ namespace equilibrium { //------------------------------------------------------------------------------ /// @brief Get the z position. /// -/// @param[in] x1 X1 posiiton. +/// @param[in] x1 X1 position. /// @param[in] x2 X2 position. /// @param[in] x3 X3 position. /// @returns The z position. @@ -613,7 +613,7 @@ namespace equilibrium { class slab : public generic { public: //------------------------------------------------------------------------------ -/// @brief Construct a guassian density with uniform magnetic field. +/// @brief Construct a gaussian density with uniform magnetic field. //------------------------------------------------------------------------------ slab() : generic ({3.34449469E-27}, {1}) {} @@ -737,7 +737,7 @@ namespace equilibrium { class slab_density : public generic { public: //------------------------------------------------------------------------------ -/// @brief Construct a guassian density with uniform magnetic field. +/// @brief Construct a gaussian density with uniform magnetic field. //------------------------------------------------------------------------------ slab_density() : generic ({3.34449469E-27}, {1}) {} @@ -866,7 +866,7 @@ namespace equilibrium { class slab_field : public generic { public: //------------------------------------------------------------------------------ -/// @brief Construct a guassian density with uniform magnetic field. +/// @brief Construct a gaussian density with uniform magnetic field. //------------------------------------------------------------------------------ slab_field() : generic ({3.34449469E-27}, {1}) {} @@ -981,21 +981,21 @@ namespace equilibrium { return std::make_shared> (); } //****************************************************************************** -// Guassian density with a uniform magnetic field. +// Gaussian density with a uniform magnetic field. //****************************************************************************** //------------------------------------------------------------------------------ -/// @brief Guassian density with uniform magnetic field equilibrium. +/// @brief Gaussian density with uniform magnetic field equilibrium. /// /// @tparam T Base type of the calculation. /// @tparam SAFE_MATH Use @ref general_concepts_safe_math operations. //------------------------------------------------------------------------------ template - class guassian_density : public generic { + class gaussian_density : public generic { public: //------------------------------------------------------------------------------ -/// @brief Construct a guassian density with uniform magnetic field. +/// @brief Construct a gaussian density with uniform magnetic field. //------------------------------------------------------------------------------ - guassian_density() : + gaussian_density() : generic ({3.34449469E-27}, {1}) {} //------------------------------------------------------------------------------ @@ -1095,16 +1095,16 @@ namespace equilibrium { }; //------------------------------------------------------------------------------ -/// @brief Convenience function to build a guassian density equilibrium. +/// @brief Convenience function to build a gaussian density equilibrium. /// /// @tparam T Base type of the calculation. /// @tparam SAFE_MATH Use @ref general_concepts_safe_math operations. /// -/// @returns A constructed guassian density equilibrium. +/// @returns A constructed gaussian density equilibrium. //------------------------------------------------------------------------------ template - shared make_guassian_density() { - return std::make_shared> (); + shared make_gaussian_density() { + return std::make_shared> (); } //------------------------------------------------------------------------------ @@ -1113,7 +1113,7 @@ namespace equilibrium { /// @tparam T Base type of the calculation. /// @tparam SAFE_MATH Use @ref general_concepts_safe_math operations. /// -/// @param[in] c Array of spline coeffiecents. +/// @param[in] c Array of spline coefficients. /// @param[in] x Spline argument. /// @param[in] scale Scale factor for argument. /// @param[in] offset Offset value for argument. @@ -1395,12 +1395,12 @@ namespace equilibrium { /// @param[in] te_c1 Te c1 spline coefficient. /// @param[in] te_c2 Te c2 spline coefficient. /// @param[in] te_c3 Te c3 spline coefficient. -/// @param[in] te_scale Temperatire scale. +/// @param[in] te_scale Temperature scale. /// @param[in] ne_c0 Ne c0 spline coefficient. /// @param[in] ne_c1 Ne c1 spline coefficient. /// @param[in] ne_c2 Ne c2 spline coefficient. /// @param[in] ne_c3 Ne c3 spline coefficient. -/// @param[in] ne_scale Denisty scale. +/// @param[in] ne_scale Density scale. /// @param[in] pres_c0 Pressure c0 spline coefficient. /// @param[in] pres_c1 Pressure c1 spline coefficient. /// @param[in] pres_c2 Pressure c2 spline coefficient. @@ -1953,7 +1953,7 @@ namespace equilibrium { //------------------------------------------------------------------------------ /// @brief Get the covariant basis vectors in the s direction. /// -/// @param[in] r Radial posirtion. +/// @param[in] r Radial position. /// @param[in] z Vertical position. /// @returns The covariant basis vectors. //------------------------------------------------------------------------------ @@ -1976,7 +1976,7 @@ namespace equilibrium { //------------------------------------------------------------------------------ /// @brief Get the covariant basis vectors in the u direction. /// -/// @param[in] r Radial posirtion. +/// @param[in] r Radial position. /// @param[in] z Vertical position. /// @returns The covariant basis vectors. //------------------------------------------------------------------------------ @@ -1999,7 +1999,7 @@ namespace equilibrium { //------------------------------------------------------------------------------ /// @brief Get the covariant basis vectors in the u direction. /// -/// @param[in] r Radial posirtion. +/// @param[in] r Radial position. /// @param[in] z Vertical position. /// @returns The covariant basis vectors. //------------------------------------------------------------------------------ @@ -2146,7 +2146,7 @@ namespace equilibrium { //------------------------------------------------------------------------------ /// @brief Get the profile function. /// -/// @param[in] s S posiiton. +/// @param[in] s S position. /// @returns The profile function. //------------------------------------------------------------------------------ graph::shared_leaf @@ -2161,7 +2161,7 @@ namespace equilibrium { /// @param[in] sminh Minimum s on the half grid. /// @param[in] sminf Minimum s on the full grid. /// @param[in] ds Change in s grid. -/// @param[in] dphi Change in torodial flux. +/// @param[in] dphi Change in toroidal flux. /// @param[in] signj Sign of the jacobian. /// @param[in] chi_c0 Poloidal flux c0. /// @param[in] chi_c1 Poloidal flux c1. @@ -2221,7 +2221,7 @@ namespace equilibrium { //------------------------------------------------------------------------------ /// @brief Get the contravariant basis vector in the S direction. /// -/// @param[in] s S posiiton. +/// @param[in] s S position. /// @param[in] u U position. /// @param[in] v V position. /// @returns The contravaraiant basis vector in s. @@ -2237,7 +2237,7 @@ namespace equilibrium { //------------------------------------------------------------------------------ /// @brief Get the contravariant basis vector in the U direction. /// -/// @param[in] s S posiiton. +/// @param[in] s S position. /// @param[in] u U position. /// @param[in] v V position. /// @returns The contravaraiant basis vector in u. @@ -2253,7 +2253,7 @@ namespace equilibrium { //------------------------------------------------------------------------------ /// @brief Get the contravariant basis vector in the V direction. /// -/// @param[in] s S posiiton. +/// @param[in] s S position. /// @param[in] u U position. /// @param[in] v V position. /// @returns The contravaraiant basis vector in v. @@ -2269,7 +2269,7 @@ namespace equilibrium { //------------------------------------------------------------------------------ /// @brief Get the electron density. /// -/// @param[in] s S posiiton. +/// @param[in] s S position. /// @param[in] u U position. /// @param[in] v V position. /// @returns The electron density expression. @@ -2286,7 +2286,7 @@ namespace equilibrium { /// @brief Get the ion density. /// /// @param[in] index The species index. -/// @param[in] s S posiiton. +/// @param[in] s S position. /// @param[in] u U position. /// @param[in] v V position. /// @returns The ion density expression. @@ -2302,7 +2302,7 @@ namespace equilibrium { //------------------------------------------------------------------------------ /// @brief Get the electron temperature. /// -/// @param[in] s S posiiton. +/// @param[in] s S position. /// @param[in] u U position. /// @param[in] v V position. /// @returns The electron temperature expression. @@ -2319,7 +2319,7 @@ namespace equilibrium { /// @brief Get the ion temperature. /// /// @param[in] index The species index. -/// @param[in] s S posiiton. +/// @param[in] s S position. /// @param[in] u U position. /// @param[in] v V position. /// @returns The ion temperature expression. @@ -2335,7 +2335,7 @@ namespace equilibrium { //------------------------------------------------------------------------------ /// @brief Get the magnetic field. /// -/// @param[in] s S posiiton. +/// @param[in] s S position. /// @param[in] u U position. /// @param[in] v V position. /// @returns Magnetic field expression. @@ -2368,7 +2368,7 @@ namespace equilibrium { //------------------------------------------------------------------------------ /// @brief Get the x position. /// -/// @param[in] s S posiiton. +/// @param[in] s S position. /// @param[in] u U position. /// @param[in] v V position. /// @returns The x position. @@ -2384,7 +2384,7 @@ namespace equilibrium { //------------------------------------------------------------------------------ /// @brief Get the y position. /// -/// @param[in] s S posiiton. +/// @param[in] s S position. /// @param[in] u U position. /// @param[in] v V position. /// @returns The y position. @@ -2400,7 +2400,7 @@ namespace equilibrium { //------------------------------------------------------------------------------ /// @brief Get the z position. /// -/// @param[in] s S posiiton. +/// @param[in] s S position. /// @param[in] u U position. /// @param[in] v V position. /// @returns The z position. diff --git a/graph_framework/math.hpp b/graph_framework/math.hpp index 9ef8dc1e622e309edf73e3af419083027ecb5029..4ce01ba7149d2feb1375f9f621e83bac9380efea 100644 --- a/graph_framework/math.hpp +++ b/graph_framework/math.hpp @@ -88,7 +88,7 @@ namespace graph { ap2->get_right(), ap2->get_y_scale(), ap2->get_y_offset()); } -// Handle casses like sqrt(c*x) where c is constant or cases like +// Handle cases like sqrt(c*x) where c is constant or cases like // sqrt((x^a)*y). auto am = multiply_cast(this->arg); if (am.get()) { @@ -177,7 +177,7 @@ namespace graph { } //------------------------------------------------------------------------------ -/// @brief Querey if the nodes match. +/// @brief Query if the nodes match. /// /// @param[in] x Other graph to check if it is a match. /// @returns True if the nodes are a match. @@ -267,7 +267,7 @@ namespace graph { }; //------------------------------------------------------------------------------ -/// @brief Define sqrt convience function. +/// @brief Define sqrt convenience function. /// /// @tparam T Base type of the calculation. /// @tparam SAFE_MATH Use @ref general_concepts_safe_math operations. @@ -307,7 +307,7 @@ namespace graph { /// @tparam SAFE_MATH Use @ref general_concepts_safe_math operations. /// /// @param[in] x Leaf node to attempt cast. -/// @returns An attemped dynamic case. +/// @returns An attempted dynamic case. //------------------------------------------------------------------------------ template shared_sqrt sqrt_cast(shared_leaf x) { @@ -469,7 +469,7 @@ namespace graph { } //------------------------------------------------------------------------------ -/// @brief Querey if the nodes match. +/// @brief Query if the nodes match. /// /// @param[in] x Other graph to check if it is a match. /// @returns True if the nodes are a match. @@ -532,7 +532,7 @@ namespace graph { }; //------------------------------------------------------------------------------ -/// @brief Define exp convience function. +/// @brief Define exp convenience function. /// /// @tparam T Base type of the calculation. /// @tparam SAFE_MATH Use @ref general_concepts_safe_math operations. @@ -572,7 +572,7 @@ namespace graph { /// @tparam SAFE_MATH Use @ref general_concepts_safe_math operations. /// /// @param[in] x Leaf node to attempt cast. -/// @returns An attemped dynamic case. +/// @returns An attempted dynamic case. //------------------------------------------------------------------------------ template shared_exp exp_cast(shared_leaf x) { @@ -712,7 +712,7 @@ namespace graph { } //------------------------------------------------------------------------------ -/// @brief Querey if the nodes match. +/// @brief Query if the nodes match. /// /// @param[in] x Other graph to check if it is a match. /// @returns True if the nodes are a match. @@ -775,7 +775,7 @@ namespace graph { }; //------------------------------------------------------------------------------ -/// @brief Define log convience function. +/// @brief Define log convenience function. /// /// @tparam T Base type of the calculation. /// @tparam SAFE_MATH Use @ref general_concepts_safe_math operations. @@ -814,7 +814,7 @@ namespace graph { /// @tparam SAFE_MATH Use @ref general_concepts_safe_math operations. /// /// @param[in] x Leaf node to attempt cast. -/// @returns An attemped dynamic case. +/// @returns An attempted dynamic case. //------------------------------------------------------------------------------ template shared_log log_cast(shared_leaf x) { @@ -1104,8 +1104,8 @@ namespace graph { } } - if (is_variable_combineable(ld->get_left(), - ld->get_right())) { + if (is_variable_combinable(ld->get_left(), + ld->get_right())) { return pow(ld->get_left()->get_power_base(), this->right*(ld->get_left()->get_power_exponent() - ld->get_right()->get_power_exponent())); @@ -1114,22 +1114,22 @@ namespace graph { if (ldrm.get()) { auto ldrmlm = multiply_cast(ldrm->get_left()); if (ldrmlm.get()) { - if (is_variable_combineable(ldrm->get_right(), - ldrmlm->get_right()->get_power_base())) { + if (is_variable_combinable(ldrm->get_right(), + ldrmlm->get_right()->get_power_base())) { return pow(ld->get_left()/ldrmlm->get_left(), this->right) / pow(ldrm->get_right()*ldrmlm->get_right(), this->right); - } else if (is_variable_combineable(ldrm->get_right(), - ldrmlm->get_left()->get_power_base())) { + } else if (is_variable_combinable(ldrm->get_right(), + ldrmlm->get_left()->get_power_base())) { return pow(ld->get_left()/ldrmlm->get_right(), this->right) / pow(ldrm->get_right()*ldrmlm->get_left(), this->right); - } else if (is_variable_combineable(ldrmlm->get_left(), - ldrmlm->get_right()->get_power_base()) || - is_variable_combineable(ldrmlm->get_right(), - ldrmlm->get_left()->get_power_base())) { + } else if (is_variable_combinable(ldrmlm->get_left(), + ldrmlm->get_right()->get_power_base()) || + is_variable_combinable(ldrmlm->get_right(), + ldrmlm->get_left()->get_power_base())) { return pow(ld->get_left()/ldrm->get_right(), this->right) / pow(ldrmlm->get_left()*ldrmlm->get_right(), @@ -1225,7 +1225,7 @@ namespace graph { } //------------------------------------------------------------------------------ -/// @brief Querey if the nodes match. +/// @brief Query if the nodes match. /// /// @param[in] x Other graph to check if it is a match. /// @returns True if the nodes are a match. @@ -1410,7 +1410,7 @@ namespace graph { /// @brief Cast to a power node. /// /// @param[in] x Leaf node to attempt cast. -/// @returns An attemped dynamic case. +/// @returns An attempted dynamic cast. //------------------------------------------------------------------------------ template shared_pow pow_cast(shared_leaf x) { @@ -1545,7 +1545,7 @@ namespace graph { } //------------------------------------------------------------------------------ -/// @brief Querey if the nodes match. +/// @brief Query if the nodes match. /// /// @param[in] x Other graph to check if it is a match. /// @returns True if the nodes are a match. @@ -1608,7 +1608,7 @@ namespace graph { }; //------------------------------------------------------------------------------ -/// @brief Define erfi convience function. +/// @brief Define erfi convenience function. /// /// @tparam T Base type of the calculation. /// @tparam SAFE_MATH Use @ref general_concepts_safe_math operations. @@ -1648,7 +1648,7 @@ namespace graph { /// @tparam SAFE_MATH Use @ref general_concepts_safe_math operations. /// /// @param[in] x Leaf node to attempt cast. -/// @returns An attemped dynamic case. +/// @returns An attempted dynamic cast. //------------------------------------------------------------------------------ template shared_erfi erfi_cast(shared_leaf x) { diff --git a/graph_framework/metal_context.hpp b/graph_framework/metal_context.hpp index c5c980d6c3d33244f273d5bddee62af9f77fe025..ae78312c2c90c7571289a4ee16f58a01f1a96491 100644 --- a/graph_framework/metal_context.hpp +++ b/graph_framework/metal_context.hpp @@ -36,7 +36,7 @@ namespace gpu { id command_buffer; /// Metal library. id library; -/// Buffer mutability discriptor. +/// Buffer mutability descriptor. std::map> bufferMutability; public: @@ -56,7 +56,7 @@ namespace gpu { } //------------------------------------------------------------------------------ -/// @brief Device discription. +/// @brief Device description. //------------------------------------------------------------------------------ static std::string device_type() { return "Metal GPU"; @@ -172,15 +172,15 @@ namespace gpu { id encoder = [command_buffer blitCommandEncoder]; for (auto &[data, size] : tex1d_list) { if (!texture_arguments.contains(data)) { - MTLTextureDescriptor *discriptor = [MTLTextureDescriptor new]; - discriptor.textureType = MTLTextureType1D; - discriptor.pixelFormat = MTLPixelFormatR32Float; - discriptor.width = size; - discriptor.storageMode = MTLStorageModeManaged; - discriptor.cpuCacheMode = MTLCPUCacheModeWriteCombined; - discriptor.hazardTrackingMode = MTLHazardTrackingModeUntracked; - discriptor.usage = MTLTextureUsageShaderRead; - texture_arguments[data] = [device newTextureWithDescriptor:discriptor]; + MTLTextureDescriptor *descriptor = [MTLTextureDescriptor new]; + descriptor.textureType = MTLTextureType1D; + descriptor.pixelFormat = MTLPixelFormatR32Float; + descriptor.width = size; + descriptor.storageMode = MTLStorageModeManaged; + descriptor.cpuCacheMode = MTLCPUCacheModeWriteCombined; + descriptor.hazardTrackingMode = MTLHazardTrackingModeUntracked; + descriptor.usage = MTLTextureUsageShaderRead; + texture_arguments[data] = [device newTextureWithDescriptor:descriptor]; [texture_arguments[data] replaceRegion:MTLRegionMake1D(0, size) mipmapLevel:0 withBytes:reinterpret_cast (data) @@ -192,16 +192,16 @@ namespace gpu { } for (auto &[data, size] : tex2d_list) { if (!texture_arguments.contains(data)) { - MTLTextureDescriptor *discriptor = [MTLTextureDescriptor new]; - discriptor.textureType = MTLTextureType2D; - discriptor.pixelFormat = MTLPixelFormatR32Float; - discriptor.width = size[1]; - discriptor.height = size[0]; - discriptor.storageMode = MTLStorageModeManaged; - discriptor.cpuCacheMode = MTLCPUCacheModeWriteCombined; - discriptor.hazardTrackingMode = MTLHazardTrackingModeUntracked; - discriptor.usage = MTLTextureUsageShaderRead; - texture_arguments[data] = [device newTextureWithDescriptor:discriptor]; + MTLTextureDescriptor *descriptor = [MTLTextureDescriptor new]; + descriptor.textureType = MTLTextureType2D; + descriptor.pixelFormat = MTLPixelFormatR32Float; + descriptor.width = size[1]; + descriptor.height = size[0]; + descriptor.storageMode = MTLStorageModeManaged; + descriptor.cpuCacheMode = MTLCPUCacheModeWriteCombined; + descriptor.hazardTrackingMode = MTLHazardTrackingModeUntracked; + descriptor.usage = MTLTextureUsageShaderRead; + texture_arguments[data] = [device newTextureWithDescriptor:descriptor]; [texture_arguments[data] replaceRegion:MTLRegionMake2D(0, 0, size[1], size[0]) mipmapLevel:0 withBytes:reinterpret_cast (data) diff --git a/graph_framework/newton.hpp b/graph_framework/newton.hpp index 9f1cbb4bca9d81133eb91592d701ed77ddcc718a..62d53081979bfb08649373b79ab538e104e3468f 100644 --- a/graph_framework/newton.hpp +++ b/graph_framework/newton.hpp @@ -12,7 +12,7 @@ namespace solver { //------------------------------------------------------------------------------ -/// @brief Determine the value of vars to minimze the loss function. +/// @brief Determine the value of vars to minimize the loss function. /// /// This uses newtons methods to solver for D(x) = 0. /// @@ -24,7 +24,7 @@ namespace solver { /// @param[in] inputs Inputs for jit compile. /// @param[in] func Function to find the root of. /// @param[in] state Random state node. -/// @param[in] tolarance Tolarance to solve the dispersion function +/// @param[in] tolerance Tolerance to solve the dispersion function /// to. /// @param[in] max_iterations Maximum number of iterations before giving /// up. @@ -36,7 +36,7 @@ namespace solver { graph::input_nodes inputs, graph::shared_leaf func, graph::shared_random_state state, - const T tolarance = 1.0E-30, + const T tolerance = 1.0E-30, const size_t max_iterations = 1000, const T step = 1.0) { graph::map_nodes setters; @@ -47,7 +47,7 @@ namespace solver { work.add_converge_item(inputs, {func*func}, setters, state, "loss_kernel", inputs.back()->size(), - tolarance, max_iterations); + tolerance, max_iterations); } } #endif /* newton_h */ diff --git a/graph_framework/node.hpp b/graph_framework/node.hpp index 698a5515a090a7b935c6692d332bed590f088aa2..ae729bd9da0539cfe26987604ee94f391043e5a9 100644 --- a/graph_framework/node.hpp +++ b/graph_framework/node.hpp @@ -14,14 +14,14 @@ /// nodes. For instance, the @ref graph::tan nodes are built from /// @f$\frac{\sin\left(x\right)}{\cos\left(x\right)}@f$. However, some problems /// will call for adding new operations. This page provides a basic example of -/// how to impliment a new operator @f$foo\left(x\right)@f$ in the +/// how to implement a new operator @f$foo\left(x\right)@f$ in the /// graph_framework. /// ///
/// @section new_operations_tutorial_node_subclass Node Subclasses /// All graph nodes are subclasses of @ref graph::leaf_node or subclasses of /// other nodes. In the case of our @f$foo\left(x\right)@f$ example we can -/// sublass the @ref graph::straight_node since these assume single arguments. +/// subclass the @ref graph::straight_node since these assume single arguments. /// If there are two or three operands you can subclass /// * @ref graph::branch_node /// * @ref graph::triple_node @@ -31,7 +31,7 @@ /// /// In this case, the @ref graph::straight_node (Along with /// @ref graph::branch_node, @ref graph::triple_node) have no reduction -/// assumputions. For this case since our operation @f$foo\left(x\right)@f$ +/// assumptions. For this case since our operation @f$foo\left(x\right)@f$ /// takes one argument, we will subclass the @ref graph::straight_node. /// /// The basics of subclassing a node, start with a subclass and a constructor. @@ -50,11 +50,11 @@ /// straight_node(x, foo_node::to_string(x.get())) {} /// }; /// @endcode -/// The static to_string method provices an idenifier that can be used -/// to generate a hash for the node. This hash will be used later in a factory -/// function to exsure nodes only exist once. +/// The static to_string method provides an identifier that can be +/// used to generate a hash for the node. This hash will be used later in a +/// factory function to ensure nodes only exist once. /// -/// A factory function constructs a node then immedately reduces it. The +/// A factory function constructs a node then immediately reduces it. The /// reduced node is then checked if it already exists in the /// @ref graph::leaf_node::caches_t::nodes. If the node is a new node, we add /// it to the cache and return it. Otherwise we discard the node and return the @@ -78,7 +78,7 @@ /// @endcode /// /// To aid in introspection we also need a function to cast a generic -/// @ref graph::shared_leaf back to the specific node type. For convience, we +/// @ref graph::shared_leaf back to the specific node type. For convenience, we /// also define a type alias for shared type. /// @code /// template @@ -96,16 +96,16 @@ /// be provided. /// ///
-/// @subsection new_operations_tutorial_evalute Evaluate +/// @subsection new_operations_tutorial_evaluate Evaluate /// To start, lets provide a way to -/// @ref graph::leaf_node::evaluate "evalute the node". The first step to +/// @ref graph::leaf_node::evaluate "evaluate the node". The first step to /// evaluate a node is to evaluate the nodes argument. /// @code /// virtual shared_leaf evaluate() { /// backend::buffer result = this->arg->evaluate(); /// } /// @endcode -/// @ref backend::buffer are quick ways we can evalute the node on the host +/// @ref backend::buffer are quick ways we can evaluate the node on the host /// before needing to generate device kernels and is used by the /// @ref graph::leaf_node::reduce method to precompute constant values. We can /// extend the @ref backend::buffer class with a new method to evaluate foo or @@ -120,7 +120,7 @@ /// ///
/// @subsection new_operations_tutorial_is_match Is Match -/// This methiod checks if the node matches another node. The first thing to +/// This method checks if the node matches another node. The first thing to /// check is if the pointers match. Then we can check if the structure of the /// graphs match. This is important for the factory function. When checking for /// cached nodes, two graphs can be identical but have different pointer @@ -156,7 +156,7 @@ /// } /// @endcode /// In this example we first check if the argument can be cast to a constant. -/// If it was castable, we evalute this node and create a new constant to +/// If it was cast-able, we evaluate this node and create a new constant to /// return in its place. Otherwise we return the current node unchanged. /// @note Other reductions are possible but not shown here. /// @@ -180,7 +180,7 @@ /// } /// @endcode /// Here we made use of the @ref graph::leaf_node::df_cache to avoid needing -/// to rebuild expressions everytime the same derivative is taken. +/// to rebuild expressions every time the same derivative is taken. /// ///
/// @subsection new_operations_tutorial_compile_preamble Compile preamble @@ -253,7 +253,7 @@ /// } /// @endcode /// Kernels are created by assuming infinite registers. In this case, a -/// register is a temporary variable. To provide a unquie name, the node +/// register is a temporary variable. To provide a unique name, the node /// pointer value is converted into a string. Since we only want to evaluate /// this once, we check if the register has already been created. /// @@ -304,9 +304,9 @@ /// ///
/// @subsection new_operations_tutorial_remove_pseudo Remove Pseudo -/// Return the node with pseduo variables removed. +/// Return the node with pseudo variables removed. /// @ref graph::pseudo_variable_node are used to end derivatives construction -/// by treating a sub graph as a pseduo variable. Before graphs can be +/// by treating a sub graph as a pseudo variable. Before graphs can be /// evaluated, these @ref graph::pseudo_variable_node need to be removed. /// @code /// virtual shared_leaf remove_pseudo() { @@ -462,7 +462,7 @@ namespace graph { const jit::register_usage &usage) = 0; //------------------------------------------------------------------------------ -/// @brief Querey if the nodes match. +/// @brief Query if the nodes match. /// /// @param[in] x Other graph to check if it is a match. /// @returns True if the nodes are a match. @@ -554,9 +554,9 @@ namespace graph { } //------------------------------------------------------------------------------ -/// @brief Test if all the subnodes terminate in variables. +/// @brief Test if all the sub-nodes terminate in variables. /// -/// @returns True if all the subnodes terminate in variables. +/// @returns True if all the sub-nodes terminate in variables. //------------------------------------------------------------------------------ virtual bool is_all_variables() const = 0; @@ -647,7 +647,8 @@ namespace graph { << std::endl; } -// Create one struct that holds both caches: for constructed nodes and for the backend buffers +// Create one struct that holds both caches: for constructed nodes and for the +// backend buffers //------------------------------------------------------------------------------ /// @brief Data structure to contain the two caches. /// @@ -727,7 +728,7 @@ namespace graph { //------------------------------------------------------------------------------ /// @brief Convert node pointer to a string. /// -/// @param[in] d Scalar data to initalize. +/// @param[in] d Scalar data to initialize. /// @return A string rep of the node. //------------------------------------------------------------------------------ static std::string to_string(const T d) { @@ -822,7 +823,7 @@ namespace graph { } //------------------------------------------------------------------------------ -/// @brief Querey if the nodes match. +/// @brief Query if the nodes match. /// /// @param[in] x Other graph to check if it is a match. /// @returns True if the nodes are a match. @@ -973,7 +974,7 @@ namespace graph { /// @tparam T Base type of the calculation. /// @tparam SAFE_MATH Use @ref general_concepts_safe_math operations. /// -/// @param[in] d Scalar data to initalize. +/// @param[in] d Scalar data to initialize. /// @returns A reduced constant node. //------------------------------------------------------------------------------ template @@ -1021,7 +1022,7 @@ namespace graph { return constant (static_cast (-1.0)); } -/// Convinece type for imaginary constant. +/// Convenience type for imaginary constant. template constexpr T i = T(0.0, 1.0); @@ -1036,7 +1037,7 @@ namespace graph { /// @tparam SAFE_MATH Use @ref general_concepts_safe_math operations. /// /// @param[in] x Leaf node to attempt cast. -/// @returns An attemped dynamic case. +/// @returns An attempted dynamic case. //------------------------------------------------------------------------------ template shared_constant constant_cast(shared_leaf x) { @@ -1424,7 +1425,7 @@ namespace graph { /// @brief Construct a variable node from a scalar. /// /// @param[in] s Size of he data buffer. -/// @param[in] d Scalar data to initalize. +/// @param[in] d Scalar data to initialize. /// @param[in] symbol Symbol of the variable used in equations. //------------------------------------------------------------------------------ variable_node(const size_t s, const T d, @@ -1683,7 +1684,7 @@ namespace graph { /// @tparam SAFE_MATH Use @ref general_concepts_safe_math operations. /// /// @param[in] s Size of he data buffer. -/// @param[in] d Scalar data to initalize. +/// @param[in] d Scalar data to initialize. /// @param[in] symbol Symbol of the variable used in equations. //------------------------------------------------------------------------------ template @@ -1728,7 +1729,7 @@ namespace graph { /// Convenience type alias for a vector of inputs. template using input_nodes = std::vector>; -/// Convenience type alias for maping end codes back to inputs. +/// Convenience type alias for mapping end codes back to inputs. template using map_nodes = std::vector, shared_variable>>; @@ -1740,7 +1741,7 @@ namespace graph { /// @tparam SAFE_MATH Use @ref general_concepts_safe_math operations. /// /// @param[in] x Leaf node to attempt cast. -/// @returns An attemped dynamic case. +/// @returns An attempted dynamic case. //------------------------------------------------------------------------------ template shared_variable variable_cast(shared_leaf x) { @@ -1890,7 +1891,7 @@ namespace graph { }; //------------------------------------------------------------------------------ -/// @brief Define pseudo variable convience function. +/// @brief Define pseudo variable convenience function. /// /// @tparam T Base type of the calculation. /// @tparam SAFE_MATH Use @ref general_concepts_safe_math operations. @@ -1914,7 +1915,7 @@ namespace graph { /// @tparam SAFE_MATH Use @ref general_concepts_safe_math operations. /// /// @param[in] x Leaf node to attempt cast. -/// @returns An attemped dynamic case. +/// @returns An attempted dynamic case. //------------------------------------------------------------------------------ template shared_pseudo_variable pseudo_variable_cast(shared_leaf &x) { diff --git a/graph_framework/output.hpp b/graph_framework/output.hpp index 4b7184fbda58c5645115ebad25e7f8c580ea18c8..02b2f758d109900ad56c5ad524da75c8d6f10442 100644 --- a/graph_framework/output.hpp +++ b/graph_framework/output.hpp @@ -1,6 +1,6 @@ //------------------------------------------------------------------------------ /// @file output.hpp -/// @brief Impliments output files in a netcdf format. +/// @brief Implements output files in a netcdf format. //------------------------------------------------------------------------------ #ifndef output_h @@ -14,7 +14,7 @@ /// Name space for output files. namespace output { -/// Lock to syncronize netcdf accross threads. +/// Lock to synchronize netcdf across threads. static std::mutex sync; //------------------------------------------------------------------------------ diff --git a/graph_framework/piecewise.hpp b/graph_framework/piecewise.hpp index 811c4e26b383cdf9e8d923967afa11ec079d9bd3..7b1b9f9870625158cf54939269e56d2fe232dcc4 100644 --- a/graph_framework/piecewise.hpp +++ b/graph_framework/piecewise.hpp @@ -17,7 +17,7 @@ namespace graph { /// @tparam T Base type of the calculation. /// /// @param[in,out] stream String buffer stream. -/// @param[in] register_name Reister for the argument. +/// @param[in] register_name Register for the argument. /// @param[in] length Dimension length of argument. /// @param[in] scale Argument scale factor. /// @param[in] offset Argument offset factor. @@ -57,23 +57,23 @@ void compile_index(std::ostringstream &stream, //------------------------------------------------------------------------------ /// @brief Class representing a 1D piecewise constant. /// -/// This class is used to impliment the coefficent terms of cubic spline +/// This class is used to implement the coefficient terms of cubic spline /// interpolation. An function is interpolated using /// /// y(x) = a_i + b_i*x +c_i*x^2 + d_i*x^3 (1) /// -/// The coeffients are defined as +/// The coefficients are defined as /// /// a_i = y_i (2) /// b_i = D_i (3) /// c_i = 3*(y_i+1 - y_i) - 2*D_i - D_i+1 (4) /// d_i = 2*(y_i - y_i+1) + D_i + D_i+1 (5) /// -/// The agument x is assumed to be the normalized argument +/// The argument x is assumed to be the normalized argument /// /// x_norm = (x - xmin)/dx - i (6) /// -/// To avoid tracking the index i which normaizes x to a zero to one interval +/// To avoid tracking the index i which normalizes x to a zero to one interval /// the coefficients should be normalized to /// /// a'_i = a_i - b_i*i + c_i*i^2 - d_i*i^3 (7) @@ -155,7 +155,7 @@ void compile_index(std::ostringstream &stream, //------------------------------------------------------------------------------ /// @brief Construct 1D a piecewise constant node. /// -/// @param[in] d Data to initalize the piecewise constant. +/// @param[in] d Data to initialize the piecewise constant. /// @param[in] x Argument. /// @param[in] scale Scale factor for the argument. /// @param[in] offset Offset factor for the argument. @@ -172,7 +172,7 @@ void compile_index(std::ostringstream &stream, /// @brief Evaluate the results of the piecewise constant. /// /// Evaluate functions are only used by the minimization. So this node does not -/// evaluate the argument. Instead this only returs the data as if it were a +/// evaluate the argument. Instead this only returns the data as if it were a /// constant. /// /// @returns The evaluated value of the node. @@ -401,9 +401,9 @@ void compile_index(std::ostringstream &stream, } //------------------------------------------------------------------------------ -/// @brief Querey if the nodes match. +/// @brief Query if the nodes match. /// -/// The argument of this node can be defered so we need to check if the +/// The argument of this node can be deferred so we need to check if the /// arguments are null. /// /// @param[in] x Other graph to check if it is a match. @@ -548,12 +548,12 @@ void compile_index(std::ostringstream &stream, }; //------------------------------------------------------------------------------ -/// @brief Define piecewise_1D convience function. +/// @brief Define piecewise_1D convenience function. /// /// @tparam T Base type of the calculation. /// @tparam SAFE_MATH Use @ref general_concepts_safe_math operations. /// -/// @param[in] d Data to initalize the piecewise constant. +/// @param[in] d Data to initialize the piecewise constant. /// @param[in] x Argument. /// @param[in] scale Argument scale factor. /// @param[in] offset Argument offset factor. @@ -595,7 +595,7 @@ void compile_index(std::ostringstream &stream, /// @tparam SAFE_MATH Use @ref general_concepts_safe_math operations. /// /// @param[in] x Leaf node to attempt cast. -/// @returns An attemped dynamic case. +/// @returns An attempted dynamic cast. //------------------------------------------------------------------------------ template shared_piecewise_1D piecewise_1D_cast(shared_leaf x) { @@ -608,17 +608,17 @@ void compile_index(std::ostringstream &stream, //------------------------------------------------------------------------------ /// @brief Class representing a 2D piecewise constant. /// -/// This class is used to impliment the coefficent terms of bicubic spline +/// This class is used to implement the coefficient terms of bicubic spline /// interpolation. An function is interpolated using /// /// z(x,y) = Σ_i,3Σ_j,3 c_ij*x^i*y^j (1) /// -/// The aguments x and y are assumed to be the normalized arguments +/// The arguments x and y are assumed to be the normalized arguments /// /// x_norm = (x - xmin)/dx - i (2) /// y_norm = (y - ymin)/dy - j (3) /// -/// To avoid tracking the indices i and j which normaizes x and y to a zero to +/// To avoid tracking the indices i and j which normalizes x and y to a zero to /// one interval the coefficients should be normalized to /// /// c00'_ij = Σ_k,3Σ_l,3 (-i)^k*(-j)^l*ckl_ij (4) @@ -722,10 +722,10 @@ void compile_index(std::ostringstream &stream, //------------------------------------------------------------------------------ /// @brief Construct 2D a piecewise constant node. /// -/// @param[in] d Data to initalize the piecewise constant. +/// @param[in] d Data to initialize the piecewise constant. /// @param[in] n Number of columns. /// @param[in] x X Argument. -/// @param[in] x_scale Scale factor for the xargument. +/// @param[in] x_scale Scale factor for the argument. /// @param[in] x_offset Offset factor for the x argument. /// @param[in] y Y Argument. /// @param[in] y_scale Scale factor for the y argument. @@ -806,7 +806,7 @@ void compile_index(std::ostringstream &stream, /// @brief Evaluate the results of the piecewise constant. /// /// Evaluate functions are only used by the minimization. So this node does not -/// evaluate the argument. Instead this only returs the data as if it were a +/// evaluate the argument. Instead this only returns the data as if it were a /// constant. /// /// @returns The evaluated value of the node. @@ -1102,7 +1102,7 @@ void compile_index(std::ostringstream &stream, } //------------------------------------------------------------------------------ -/// @brief Querey if the nodes match. +/// @brief Query if the nodes match. /// /// Assumes both arguments are either set or not set. /// @@ -1262,12 +1262,12 @@ void compile_index(std::ostringstream &stream, }; //------------------------------------------------------------------------------ -/// @brief Define piecewise_2D convience function. +/// @brief Define piecewise_2D convenience function. /// /// @tparam T Base type of the calculation. /// @tparam SAFE_MATH Use @ref general_concepts_safe_math operations. /// -/// @param[in] d Data to initalize the piecewise constant. +/// @param[in] d Data to initialize the piecewise constant. /// @param[in] n Number of columns. /// @param[in] x X argument. /// @param[in] x_scale Scale for x argument. @@ -1317,7 +1317,7 @@ void compile_index(std::ostringstream &stream, /// @tparam SAFE_MATH Use @ref general_concepts_safe_math operations. /// /// @param[in] x Leaf node to attempt cast. -/// @returns An attemped dynamic case. +/// @returns An attempted dynamic cast. //------------------------------------------------------------------------------ template shared_piecewise_2D piecewise_2D_cast(shared_leaf x) { diff --git a/graph_framework/random.hpp b/graph_framework/random.hpp index ace6faa485f8eb67d509dbd1c0482d6ac6235418..14f5330cb60e3c05c27ef04298bb2d74429bf1a5 100644 --- a/graph_framework/random.hpp +++ b/graph_framework/random.hpp @@ -32,7 +32,7 @@ namespace graph { /// State index. uint16_t index; #ifdef USE_CUDA -/// Pading to aline the size of the struct for Cuda backends. +/// Padding to aline the size of the struct for Cuda backends. uint16_t padding[3]; #endif }; @@ -41,13 +41,13 @@ namespace graph { /// @brief Construct a constant node from a vector. /// /// @param[in] size Number of random states. -/// @param[in] seed Inital random seed. +/// @param[in] seed Initial random seed. //------------------------------------------------------------------------------ random_state_node(const size_t size, const uint32_t seed=0) : leaf_node (random_state_node::to_string(), 1, false) { for (uint32_t i = 0; i < size; i++) { - states.push_back(initalize_state(seed + i)); + states.push_back(initialize_state(seed + i)); } } @@ -160,9 +160,9 @@ namespace graph { } //------------------------------------------------------------------------------ -/// @brief Test if all the subnodes terminate in variables. +/// @brief Test if all the sub-nodes terminate in variables. /// -/// @returns True if all the subnodes terminate in variables. +/// @returns True if all the sub-nodes terminate in variables. //------------------------------------------------------------------------------ virtual bool is_all_variables() const { return false; @@ -218,12 +218,12 @@ namespace graph { } //------------------------------------------------------------------------------ -/// @brief Initalize the random states. +/// @brief Initialize the random states. /// -/// @param[in] seed Inital random seed. +/// @param[in] seed Initial random seed. /// @returns A seeded state. //------------------------------------------------------------------------------ - mt_state initalize_state(const uint32_t seed) { + mt_state initialize_state(const uint32_t seed) { mt_state state; state.array[0] = seed; for (uint16_t i = 1, ie = state.array.size(); i < ie; i++) { @@ -236,13 +236,13 @@ namespace graph { }; //------------------------------------------------------------------------------ -/// @brief Define random_state convience function. +/// @brief Define random_state convenience function. /// /// @tparam T Base type of the calculation. /// @tparam SAFE_MATH Use @ref general_concepts_safe_math operations. /// /// @param[in] size Number of random states. -/// @param[in] seed Inital random seed. +/// @param[in] seed Initial random seed. /// @returns A reduced random_state node. //------------------------------------------------------------------------------ template @@ -278,7 +278,7 @@ namespace graph { /// @tparam SAFE_MATH Use @ref general_concepts_safe_math operations. /// /// @param[in] x Leaf node to attempt cast. -/// @returns An attemped dynamic case. +/// @returns An attempted dynamic cast. //------------------------------------------------------------------------------ template shared_random_state random_state_cast(shared_leaf x) { @@ -433,12 +433,12 @@ namespace graph { } //------------------------------------------------------------------------------ -/// @brief Querey if the nodes match. +/// @brief Query if the nodes match. /// /// Arithmetic and math operations on random number umber distributions have /// the effect of changing the distribution. For instance rand1 + rand2 will /// to a pyramid shaped distribution function. Assume random numbers never -/// match as a consequnce. +/// match as a consequence. /// /// @param[in] x Other graph to check if it is a match. /// @returns True if the nodes are a match. @@ -477,9 +477,9 @@ namespace graph { } //------------------------------------------------------------------------------ -/// @brief Test if all the subnodes terminate in variables. +/// @brief Test if all the sub-nodes terminate in variables. /// -/// @returns True if all the subnodes terminate in variables. +/// @returns True if all the sub-nodes terminate in variables. //------------------------------------------------------------------------------ virtual bool is_all_variables() const { return false; @@ -496,7 +496,7 @@ namespace graph { }; //------------------------------------------------------------------------------ -/// @brief Define random convience function. +/// @brief Define random convenience function. /// /// @tparam T Base type of the calculation. /// @tparam SAFE_MATH Use @ref general_concepts_safe_math operations. @@ -536,7 +536,7 @@ namespace graph { /// @tparam SAFE_MATH Use @ref general_concepts_safe_math operations. /// /// @param[in] x Leaf node to attempt cast. -/// @returns An attemped dynamic case. +/// @returns An attempted dynamic cast. //------------------------------------------------------------------------------ template shared_random random_cast(shared_leaf x) { diff --git a/graph_framework/register.hpp b/graph_framework/register.hpp index 8daaa20d4503712ed2470b689ba7cc75e2ea2ef0..d7dcdc4430dc133f7e834bdf675bc1bdcf6dd1d9 100644 --- a/graph_framework/register.hpp +++ b/graph_framework/register.hpp @@ -1,6 +1,6 @@ //------------------------------------------------------------------------------ /// @file register.hpp -/// @brief Utilities for writting jit source code. +/// @brief Utilities for writing jit source code. //------------------------------------------------------------------------------ #ifndef register_h @@ -200,7 +200,8 @@ namespace jit { //------------------------------------------------------------------------------ /// @brief Convert a value to a string while avoiding locale. /// -/// The standard streams use localizarion that interfers with multiple threads. +/// The standard streams use localization that interferes with multiple +/// threads. /// /// @tparam T Base type of the calculation. /// @@ -264,7 +265,7 @@ namespace jit { typedef std::map> texture2d_list; //------------------------------------------------------------------------------ -/// @brief Define a custom comparitor class. +/// @brief Define a custom comparator class. /// /// @tparam T Base type of the calculation. //------------------------------------------------------------------------------ diff --git a/graph_framework/solver.hpp b/graph_framework/solver.hpp index 122d853eb035240f872738116c955c9726bab8ed..244fabdd4d45a93b7ee2275838cd23a8914fd501 100644 --- a/graph_framework/solver.hpp +++ b/graph_framework/solver.hpp @@ -6,7 +6,7 @@ //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ /// @page solvers Solvers -/// @brief A discription of the integation methods for solving the ray equations. +/// @brief A description of the integration methods for solving the ray equations. /// @tableofcontents /// /// @section solvers_intro Introduction @@ -37,23 +37,23 @@ /// ///
/// @subsection solvers_rk2 2nd Order Runge Kutta -/// This solver integates coupled differential equations using the Runge Kutta +/// This solver integrates coupled differential equations using the Runge Kutta /// to second order. -/// It starts by computing a substep for @f$\vec{x}@f$ and @f$\vec{k}@f$. +/// It starts by computing a sub-step for @f$\vec{x}@f$ and @f$\vec{k}@f$. /// @f{equation}{\vec{x}_{1}=dt\frac{\partial\vec{x}}{\partial t}\left(\vec{x},\vec{k},\omega\right)@f} /// @f{equation}{\vec{k}_{1}=dt\frac{\partial\vec{k}}{\partial t}\left(\vec{x},\vec{k},\omega\right)@f} -/// That substep is used to compute a second substep. +/// That sub-step is used to compute a second sub-step. /// @f{equation}{\vec{x}_{2}=dt\frac{\partial\vec{x}}{\partial t}\left(\vec{x} + \vec{x}_{1},\vec{k} + \vec{k}_{1},\omega\right)@f} /// @f{equation}{\vec{k}_{2}=dt\frac{\partial\vec{k}}{\partial t}\left(\vec{x} + \vec{x}_{1},\vec{k} + \vec{k}_{1},\omega\right)@f} -/// These substeps are combined into a single step update. +/// These sub-steps are combined into a single step update. /// @f{equation}{\vec{x}_{next}=\vec{x}+\frac{\vec{x}_{1}+\vec{x}_{2}}{2}@f} /// @f{equation}{\vec{k}_{next}=\vec{k}+\frac{\vec{k}_{1}+\vec{k}_{2}}{2}@f} /// ///
/// @subsection solvers_rk4 4th Order Runge Kutta -/// This solver integates coupled differential equations using the Runge Kutta -/// to fouth order. Like the second order Runge Kutta, this solver computes 4 -/// substeps. +/// This solver integrates coupled differential equations using the Runge Kutta +/// to fourth order. Like the second order Runge Kutta, this solver computes 4 +/// sub-steps. /// @f{equation}{\vec{x}_{1}=dt\frac{\partial\vec{x}}{\partial t}\left(\vec{x},\vec{k},\omega\right)@f} /// @f{equation}{\vec{k}_{1}=dt\frac{\partial\vec{k}}{\partial t}\left(\vec{x},\vec{k},\omega\right)@f} /// @f{equation}{\vec{x}_{2}=dt\frac{\partial\vec{x}}{\partial t}\left(\vec{x} + \frac{\vec{x}_{1}}{2},\vec{k} + \frac{\vec{k}_{1}}{2},\omega\right)@f} @@ -62,7 +62,7 @@ /// @f{equation}{\vec{k}_{3}=dt\frac{\partial\vec{k}}{\partial t}\left(\vec{x} + \frac{\vec{x}_{2}}{2},\vec{k} + \frac{\vec{k}_{2}}{2},\omega\right)@f} /// @f{equation}{\vec{x}_{4}=dt\frac{\partial\vec{x}}{\partial t}\left(\vec{x} + \vec{x}_{3},\vec{k} + \vec{k}_{3},\omega\right)@f} /// @f{equation}{\vec{k}_{4}=dt\frac{\partial\vec{k}}{\partial t}\left(\vec{x} + \vec{x}_{3},\vec{k} + \vec{k}_{3},\omega\right)@f} -/// These substeps are combined into a single step update. +/// These sub-steps are combined into a single step update. /// @f{equation}{\vec{x}_{next}=\vec{x}+\frac{\vec{x}_{1}+2\left(\vec{x}_{2}+\vec{x}_{3}\right)+\vec{x}_{4}}{6}@f} /// @f{equation}{\vec{k}_{next}=\vec{k}+\frac{\vec{k}_{1}+2\left(\vec{k}_{2}+\vec{x}_{3}\right)+\vec{x}_{4}}{6}@f} /// @@ -83,7 +83,7 @@ /// @ref solver::solver_interface or any other existing solver class and /// overloading class methods. /// @code -/// tempate +/// template /// class new_solver : public solver_interface { /// ... /// } @@ -172,9 +172,9 @@ namespace solver { graph::shared_leaf t_next; -/// Residule. +/// Residual. graph::shared_leaf residule; + DISPERSION_FUNCTION::safe_math> residual; /// Workflow manager. workflow::manager init(graph::shared_leaf x, - const typename DISPERSION_FUNCTION::base tolarance = 1.0E-30, + const typename DISPERSION_FUNCTION::base tolerance = 1.0E-30, const size_t max_iterations = 1000) final { graph::input_nodes inputs { @@ -267,16 +267,16 @@ namespace solver { graph::variable_cast(this->kz) }; - residule = this->D.solve(x, inputs, index, - tolarance, max_iterations); + residual = this->D.solve(x, inputs, index, + tolerance, max_iterations); - return residule; + return residual; } //------------------------------------------------------------------------------ -/// @brief Method to initalize the rays. +/// @brief Method to initialize the rays. /// -/// @returns The residule graph. +/// @returns The residual graph. //------------------------------------------------------------------------------ virtual graph::shared_leaf init() final { @@ -292,9 +292,9 @@ namespace solver { graph::variable_cast(this->kz) }; - residule = this->D.get_residule(); + residual = this->D.get_residual(); - return residule; + return residual; } //------------------------------------------------------------------------------ @@ -315,7 +315,7 @@ namespace solver { graph::output_nodes outputs = { - this->residule + this->residual }; graph::map_nodest, work.get_context()); - dataset.create_variable(file, "residule", residule, work.get_context()); + dataset.create_variable(file, "residual", residual, work.get_context()); dataset.create_variable(file, "w", this->w, work.get_context()); dataset.create_variable(file, "x", this->x, work.get_context()); dataset.create_variable(file, "y", this->y, work.get_context()); @@ -349,7 +349,7 @@ namespace solver { } //------------------------------------------------------------------------------ -/// @brief Syncronize results from host to gpu. +/// @brief Synchronize results from host to gpu. //------------------------------------------------------------------------------ void sync_device() { work.copy_to_device(this->t, graph::variable_cast(this->t)->data()); @@ -363,7 +363,7 @@ namespace solver { } //------------------------------------------------------------------------------ -/// @brief Syncronize results from gpu to host. +/// @brief Synchronize results from gpu to host. //------------------------------------------------------------------------------ void sync_host() { work.copy_to_host(this->t, graph::variable_cast(this->t)->data()); @@ -384,13 +384,13 @@ namespace solver { } //------------------------------------------------------------------------------ -/// @brief Check the residule. +/// @brief Check the residual. /// -/// @param[in] index Ray index to check residule for. -/// @returns The value of the residule at the index. +/// @param[in] index Ray index to check residual for. +/// @returns The value of the residual at the index. //------------------------------------------------------------------------------ - typename DISPERSION_FUNCTION::base check_residule(const size_t index) { - return work.check_value(index, this->residule); + typename DISPERSION_FUNCTION::base check_residual(const size_t index) { + return work.check_value(index, this->residual); } //------------------------------------------------------------------------------ @@ -401,7 +401,7 @@ namespace solver { void print(const size_t index) { work.print(index, { this->t, - this->residule, + this->residual, this->w, this->x, this->y, @@ -473,10 +473,10 @@ namespace solver { } //------------------------------------------------------------------------------ -/// @brief Print out the latex expression for the residule. +/// @brief Print out the latex expression for the residual. //------------------------------------------------------------------------------ - void print_residule() { - residule->to_latex(); + void print_residual() { + residual->to_latex(); std::cout << std::endl; } @@ -592,15 +592,15 @@ namespace solver { //------------------------------------------------------------------------------ /// @brief Construct a new second order runge kutta solver. /// -/// @param[in] w Inital omega. -/// @param[in] kx Inital kx. -/// @param[in] ky Inital ky. -/// @param[in] kz Inital kz. -/// @param[in] x Inital x. -/// @param[in] y Inital y. -/// @param[in] z Inital z. -/// @param[in] t Inital t. -/// @param[in] dt Inital dt. +/// @param[in] w Initial omega. +/// @param[in] kx Initial kx. +/// @param[in] ky Initial ky. +/// @param[in] kz Initial kz. +/// @param[in] x Initial x. +/// @param[in] y Initial y. +/// @param[in] z Initial z. +/// @param[in] t Initial t. +/// @param[in] dt Initial dt. /// @param[in] eq Equilibrium object. /// @param[in] filename Result filename, empty names will be blank. /// @param[in] num_rays Number of rays to write. @@ -760,15 +760,15 @@ namespace solver { //------------------------------------------------------------------------------ /// @brief Construct a new second order runge kutta solver. /// -/// @param[in] w Inital omega. -/// @param[in] kx Inital kx. -/// @param[in] ky Inital ky. -/// @param[in] kz Inital kz. -/// @param[in] x Inital x. -/// @param[in] y Inital y. -/// @param[in] z Inital z. -/// @param[in] t Inital t. -/// @param[in] dt Inital dt. +/// @param[in] w Initial omega. +/// @param[in] kx Initial kx. +/// @param[in] ky Initial ky. +/// @param[in] kz Initial kz. +/// @param[in] x Initial x. +/// @param[in] y Initial y. +/// @param[in] z Initial z. +/// @param[in] t Initial t. +/// @param[in] dt Initial dt. /// @param[in] eq Equilibrium object. /// @param[in] filename Result filename, empty names will be blank. /// @param[in] num_rays Number of rays to write. @@ -871,7 +871,7 @@ namespace solver { }; //****************************************************************************** -// Adaptive timestep Fourth Order Runge Kutta. +// Adaptive time step Fourth Order Runge Kutta. //****************************************************************************** //------------------------------------------------------------------------------ /// @brief Adaptive Fourth Order Runge Kutta class. @@ -881,7 +881,7 @@ namespace solver { template class adaptive_rk4 : public rk4 { protected: -/// Dispersion residule. +/// Dispersion residual. dispersion::dispersion_interface D; /// Time step variable. graph::shared_leaf outputs = { - this->residule + this->residual }; graph::map_nodes (w, kx, ky, kz, x, y, z, t, eq, filename, num_rays, index) { -// Test if the function is separatable. +// Test if the function is separable. auto zero = graph::zero (); assert(zero->is_match(this->D.get_dkxdt()->df(kx)) && diff --git a/graph_framework/special_functions.hpp b/graph_framework/special_functions.hpp index c7aa430986d1158ced457c4c7177cc0d28f10155..e2da06989d3e0a60565ea5561080c568efcc4127 100644 --- a/graph_framework/special_functions.hpp +++ b/graph_framework/special_functions.hpp @@ -1,6 +1,6 @@ //------------------------------------------------------------------------------ /// @file special_functions.hpp -/// @brief Implimentations for special functions. +/// @brief Implementations for special functions. /// /// Special functions are adapted from http://ab-initio.mit.edu/Faddeeva //------------------------------------------------------------------------------ @@ -529,7 +529,7 @@ namespace special { } //------------------------------------------------------------------------------ -/// @brief Compute specal case of w(z) = exp(z^2)\*erfz(z). +/// @brief Compute special case of w(z) = exp(z^2)\*erfz(z). /// /// Specialized for imaginary arguments. /// diff --git a/graph_framework/timing.hpp b/graph_framework/timing.hpp index a8c4d1eeb91f1f06695a47f6e3dd046368d335b4..6439c097a98d9b7941d33f1bd3c62d2086eb6135 100644 --- a/graph_framework/timing.hpp +++ b/graph_framework/timing.hpp @@ -17,7 +17,7 @@ namespace timing { //------------------------------------------------------------------------------ class measure_diagnostic { private: -/// Discription of what is being timed. +/// Description of what is being timed. const std::string label; /// Starting time of the measure. const std::chrono::high_resolution_clock::time_point start; @@ -28,7 +28,7 @@ namespace timing { //------------------------------------------------------------------------------ /// @brief Construct a time diagnostic object. /// -/// @param[in] message Discription of what is being timed. +/// @param[in] message Description of what is being timed. //------------------------------------------------------------------------------ measure_diagnostic(const std::string message = "") : label(message), start(std::chrono::high_resolution_clock::now()) {} @@ -66,22 +66,22 @@ namespace timing { //------------------------------------------------------------------------------ class measure_diagnostic_threaded { private: -/// Discription of what is being timed. +/// Description of what is being timed. const std::string label; /// Starting time of the measure. std::map start; /// Starting end of the measure. std::map end; -/// Lock to syncronize accross theads for the start time. +/// Lock to synchronize across threads for the start time. std::mutex sync_start; -/// Lock to syncronize accross theads for the end time. +/// Lock to synchronize across threads for the end time. std::mutex sync_end; public: //------------------------------------------------------------------------------ /// @brief Construct a time diagnostic object. /// -/// @param[in] message Discription of what is being timed. +/// @param[in] message Description of what is being timed. //------------------------------------------------------------------------------ measure_diagnostic_threaded(const std::string message = "") : label(message) {} diff --git a/graph_framework/trigonometry.hpp b/graph_framework/trigonometry.hpp index 3cb335cddfd73e4c009e62b49d53297b4247a165..176a42d65ae979b6de709442bd2ecbba1ffd3c30 100644 --- a/graph_framework/trigonometry.hpp +++ b/graph_framework/trigonometry.hpp @@ -154,7 +154,7 @@ namespace graph { } //------------------------------------------------------------------------------ -/// @brief Querey if the nodes match. +/// @brief Query if the nodes match. /// /// @param[in] x Other graph to check if it is a match. /// @returns True if the nodes are a match. @@ -217,7 +217,7 @@ namespace graph { }; //------------------------------------------------------------------------------ -/// @brief Define sine convience function. +/// @brief Define sine convenience function. /// /// @tparam T Base type of the calculation. /// @tparam SAFE_MATH Use @ref general_concepts_safe_math operations. @@ -256,7 +256,7 @@ namespace graph { /// @tparam SAFE_MATH Use @ref general_concepts_safe_math operations. /// /// @param[in] x Leaf node to attempt cast. -/// @returns An attemped dynamic case. +/// @returns An attempted dynamic cast. //------------------------------------------------------------------------------ template shared_sine sin_cast(shared_leaf x) { @@ -406,7 +406,7 @@ namespace graph { } //------------------------------------------------------------------------------ -/// @brief Querey if the nodes match. +/// @brief Query if the nodes match. /// /// @param[in] x Other graph to check if it is a match. /// @returns True if the nodes are a match. @@ -469,7 +469,7 @@ namespace graph { }; //------------------------------------------------------------------------------ -/// @brief Define cosine convience function. +/// @brief Define cosine convenience function. /// /// @tparam T Base type of the calculation. /// @tparam SAFE_MATH Use @ref general_concepts_safe_math operations. @@ -508,7 +508,7 @@ namespace graph { /// @tparam SAFE_MATH Use @ref general_concepts_safe_math operations. /// /// @param[in] x Leaf node to attempt cast. -/// @returns An attemped dynamic case. +/// @returns An attempted dynamic cast. //------------------------------------------------------------------------------ template shared_cosine cos_cast(shared_leaf x) { @@ -519,7 +519,7 @@ namespace graph { // Tangent node. //****************************************************************************** //------------------------------------------------------------------------------ -/// @brief Define tangent convience function. +/// @brief Define tangent convenience function. /// /// tan(x) = sin(x)/cos(x) /// @@ -721,7 +721,7 @@ namespace graph { } //------------------------------------------------------------------------------ -/// @brief Querey if the nodes match. +/// @brief Query if the nodes match. /// /// @param[in] x Other graph to check if it is a match. /// @returns True if the nodes are a match. @@ -862,7 +862,7 @@ namespace graph { /// @tparam SAFE_MATH Use @ref general_concepts_safe_math operations. /// /// @param[in] x Leaf node to attempt cast. -/// @returns An attemped dynamic case. +/// @returns An attempted dynamic cast. //------------------------------------------------------------------------------ template shared_atan atan_cast(shared_leaf x) { diff --git a/graph_framework/workflow.hpp b/graph_framework/workflow.hpp index 8412559e35398d72619d08053a6ec652c7f98c10..421442b79c8e1ef6f3ae47532ce4d65a40f13102 100644 --- a/graph_framework/workflow.hpp +++ b/graph_framework/workflow.hpp @@ -13,7 +13,7 @@ /// Name space for workflows. namespace workflow { //------------------------------------------------------------------------------ -/// @brief Class representing a workitem. +/// @brief Class representing a work item. /// /// @tparam T Base type of the calculation. /// @tparam SAFE_MATH Use @ref general_concepts_safe_math operations. @@ -42,8 +42,8 @@ namespace workflow { /// @param[in] out Output nodes. /// @param[in] maps Setter maps. /// @param[in] state Random state node. -/// @param[in] name Name of the workitem. -/// @param[in] size Size of the workitem. +/// @param[in] name Name of the work item. +/// @param[in] size Size of the work item. /// @param[in,out] context Jit context. //------------------------------------------------------------------------------ work_item(graph::input_nodes in, @@ -68,7 +68,7 @@ namespace workflow { } //------------------------------------------------------------------------------ -/// @brief Run the workitem. +/// @brief Run the work item. //------------------------------------------------------------------------------ virtual void run() { kernel(); @@ -76,7 +76,7 @@ namespace workflow { }; //------------------------------------------------------------------------------ -/// @brief Class representing a convergence workitem. +/// @brief Class representing a convergence work item. /// /// @tparam T Base type of the calculation. /// @tparam SAFE_MATH Use @ref general_concepts_safe_math operations. @@ -86,8 +86,8 @@ namespace workflow { private: /// Kernel function. std::function max_kernel; -/// Convergence tolarance. - const T tolarance; +/// Convergence tolerance. + const T tolerance; /// Total number of iterations. const size_t max_iterations; @@ -99,10 +99,10 @@ namespace workflow { /// @param[in] outputs Output nodes. /// @param[in] maps Setter maps. /// @param[in] state Random state node. -/// @param[in] name Name of the workitem. -/// @param[in] size Size of the workitem. +/// @param[in] name Name of the work item. +/// @param[in] size Size of the work item. /// @param[in,out] context Jit context. -/// @param[in] tol Tolarance to solve the dispersion function to. +/// @param[in] tol Tolerance to solve the dispersion function to. /// @param[in] max_iter Maximum number of iterations before giving up. //------------------------------------------------------------------------------ converge_item(graph::input_nodes inputs, @@ -114,7 +114,7 @@ namespace workflow { const T tol=1.0E-30, const size_t max_iter=1000) : work_item (inputs, outputs, maps, state, name, size, context), - tolarance(tol), max_iterations(max_iter) { + tolerance(tol), max_iterations(max_iter) { context.add_max_reduction(size); } @@ -134,28 +134,28 @@ namespace workflow { //------------------------------------------------------------------------------ virtual void run() { size_t iterations = 0; - T max_residule = max_kernel(); + T max_residual = max_kernel(); T last_max = std::numeric_limits::max(); T off_last_max = std::numeric_limits::max(); - while (std::abs(max_residule) > std::abs(tolarance) && - std::abs(last_max - max_residule) > std::abs(tolarance) && - std::abs(off_last_max - max_residule) > std::abs(tolarance) && + while (std::abs(max_residual) > std::abs(tolerance) && + std::abs(last_max - max_residual) > std::abs(tolerance) && + std::abs(off_last_max - max_residual) > std::abs(tolerance) && iterations++ < max_iterations) { - last_max = max_residule; + last_max = max_residual; if (!(iterations%2)) { - off_last_max = max_residule; + off_last_max = max_residual; } - max_residule = max_kernel(); + max_residual = max_kernel(); } -// In release mode asserts are diaables so write error to standard err. Need to +// In release mode asserts are disables so write error to standard err. Need to // flip the comparison operator because we want to assert to trip if false. assert(iterations < max_iterations && "Workitem failed to converge."); if (iterations > max_iterations) { std::cerr << "Workitem failed to converge with in given iterations." << std::endl; - std::cerr << "Minimum residule reached: " << max_residule + std::cerr << "Minimum residual reached: " << max_residual << std::endl; } } @@ -172,7 +172,7 @@ namespace workflow { private: /// JIT context. jit::context context; -/// List of prework items. +/// List of pre work items. std::vector>> preitems; /// List of work items. std::vector>> items; @@ -194,8 +194,8 @@ namespace workflow { /// @param[in] out Output nodes. /// @param[in] maps Setter maps. /// @param[in] state Random state node. -/// @param[in] name Name of the workitem. -/// @param[in] size Size of the workitem. +/// @param[in] name Name of the work item. +/// @param[in] size Size of the work item. //------------------------------------------------------------------------------ void add_preitem(graph::input_nodes in, graph::output_nodes out, @@ -215,8 +215,8 @@ namespace workflow { /// @param[in] out Output nodes. /// @param[in] maps Setter maps. /// @param[in] state Random state node. -/// @param[in] name Name of the workitem. -/// @param[in] size Size of the workitem. +/// @param[in] name Name of the work item. +/// @param[in] size Size of the work item. //------------------------------------------------------------------------------ void add_item(graph::input_nodes in, graph::output_nodes out, @@ -236,9 +236,9 @@ namespace workflow { /// @param[in] out Output nodes. /// @param[in] maps Setter maps. /// @param[in] state Random state node. -/// @param[in] name Name of the workitem. -/// @param[in] size Size of the workitem. -/// @param[in] tol Tolarance to converge the function to. +/// @param[in] name Name of the work item. +/// @param[in] size Size of the work item. +/// @param[in] tol Tolerance to converge the function to. /// @param[in] max_iter Maximum number of iterations before giving up. //------------------------------------------------------------------------------ void add_converge_item(graph::input_nodes in, @@ -271,7 +271,7 @@ namespace workflow { } //------------------------------------------------------------------------------ -/// @brief Run prework items. +/// @brief Run pre work items. //------------------------------------------------------------------------------ void pre_run() { for (auto &item : preitems) { diff --git a/graph_korc/xkorc.cpp b/graph_korc/xkorc.cpp index c3f83c5c477ffaabdd53c8057a7b9137d45fe0d2..d1b7cf1141c19ac88dac5e3603a7133691887d9e 100644 --- a/graph_korc/xkorc.cpp +++ b/graph_korc/xkorc.cpp @@ -82,7 +82,7 @@ void run_korc() { {u_init->get_y(), graph::variable_cast(uy)}, {u_init->get_z(), graph::variable_cast(uz)}, {gamma_init, graph::variable_cast(gamma)} - }, graph::shared_random_state (), "initalize_gamma", local_num_particles); + }, graph::shared_random_state (), "initialize_gamma", local_num_particles); auto u_prime = u_vec - dt*u_vec->cross(b_vec)/(2.0*gamma); diff --git a/graph_playground/xplayground.cpp b/graph_playground/xplayground.cpp index 37264c25b44cd00eb8bc83200b5d4358985afa0d..7781207aa1fcb8fbf389204244066db6351407a4 100644 --- a/graph_playground/xplayground.cpp +++ b/graph_playground/xplayground.cpp @@ -15,7 +15,7 @@ int main(int argc, const char * argv[]) { (void)argc; (void)argv; -// Insert code here. No code should be commited to this file beyond this +// Insert code here. No code should be committed to this file beyond this // template. END_GPU diff --git a/graph_tests/arithmetic_test.cpp b/graph_tests/arithmetic_test.cpp index 422ea51837c1cbcb12c0e34082dafb12048617fe..400df9dba5b57e2465609acb633b44fc11a2e677 100644 --- a/graph_tests/arithmetic_test.cpp +++ b/graph_tests/arithmetic_test.cpp @@ -38,22 +38,22 @@ template void test_add() { auto zero = graph::zero (); auto one_plus_zero = one + zero; assert(one_plus_zero.get() == one.get() && - "Expected to retrive the left side."); + "Expected to retrieve the left side."); assert(one_plus_zero->evaluate()[0] == static_cast (1.0) && "Expected the evaluation of one."); auto zero_plus_one = zero + one; assert(zero_plus_one.get() == one.get() && - "Expected to retrive the right side."); + "Expected to retrieve the right side."); -// Test variable quanities. +// Test variable quantities. // Any zero nodes should reduce to the other operand. auto variable = graph::variable (1, ""); auto var_plus_zero = variable + zero; assert(var_plus_zero.get() == variable.get() && - "Expected to retrive the left side."); + "Expected to retrieve the left side."); auto zero_plus_var = zero + variable; assert(zero_plus_var.get() == variable.get() && - "Expected to retrive the right side."); + "Expected to retrieve the right side."); // Variable plus a variable should return an add node. auto var_plus_var = variable + variable; @@ -187,7 +187,7 @@ template void test_add() { // c1*a + c2*b -> c1*(a + c3*b) auto constant_factor = three*variable + (one + one)*var_b; assert(graph::multiply_cast(constant_factor).get() && - "Expected multilpy node."); + "Expected multiply node."); // Test is_match auto match1 = graph::one () + variable; @@ -233,28 +233,28 @@ template void test_add() { "Expected add_node in the third slot."); // (a/(b*c) + d/(e*c)) -> (a/b + d/e)/c - auto muliply_divide_factor = var_a/(var_b*var_c) + var_d/(var_e*var_c); - auto muliply_divide_factor_cast = divide_cast(muliply_divide_factor); - assert(muliply_divide_factor_cast.get() && "Expected divide node."); - assert(muliply_divide_factor_cast->get_right()->is_match(var_c) && + auto multiply_divide_factor = var_a/(var_b*var_c) + var_d/(var_e*var_c); + auto multiply_divide_factor_cast = divide_cast(multiply_divide_factor); + assert(multiply_divide_factor_cast.get() && "Expected divide node."); + assert(multiply_divide_factor_cast->get_right()->is_match(var_c) && "Expected var_c to be factored out."); // (a/(b*c) + d/(c*e)) -> (a/b + d/e)/c - auto muliply_divide_factor2 = var_a/(var_b*var_c) + var_d/(var_c*var_e); - auto muliply_divide_factor_cast2 = divide_cast(muliply_divide_factor2); - assert(muliply_divide_factor_cast2.get() && "Expected divide node."); - assert(muliply_divide_factor_cast2->get_right()->is_match(var_c) && + auto multiply_divide_factor2 = var_a/(var_b*var_c) + var_d/(var_c*var_e); + auto multiply_divide_factor_cast2 = divide_cast(multiply_divide_factor2); + assert(multiply_divide_factor_cast2.get() && "Expected divide node."); + assert(multiply_divide_factor_cast2->get_right()->is_match(var_c) && "Expected var_c to be factored out."); // (a/(c*b) + d/(e*c)) -> (a/b + d/e)/c - auto muliply_divide_factor3 = var_a/(var_c*var_b) + var_d/(var_e*var_c); - auto muliply_divide_factor_cast3 = divide_cast(muliply_divide_factor3); - assert(muliply_divide_factor_cast3.get() && "Expected divide node."); - assert(muliply_divide_factor_cast3->get_right()->is_match(var_c) && + auto multiply_divide_factor3 = var_a/(var_c*var_b) + var_d/(var_e*var_c); + auto multiply_divide_factor_cast3 = divide_cast(multiply_divide_factor3); + assert(multiply_divide_factor_cast3.get() && "Expected divide node."); + assert(multiply_divide_factor_cast3->get_right()->is_match(var_c) && "Expected var_c to be factored out."); // (a/(c*b) + d/(c*e)) -> (a/b + d/e)/c - auto muliply_divide_factor4 = var_a/(var_c*var_b) + var_d/(var_c*var_e); - auto muliply_divide_factor_cast4 = divide_cast(muliply_divide_factor4); - assert(muliply_divide_factor_cast4.get() && "Expected divide node."); - assert(muliply_divide_factor_cast4->get_right()->is_match(var_c) && + auto multiply_divide_factor4 = var_a/(var_c*var_b) + var_d/(var_c*var_e); + auto multiply_divide_factor_cast4 = divide_cast(multiply_divide_factor4); + assert(multiply_divide_factor_cast4.get() && "Expected divide node."); + assert(multiply_divide_factor_cast4->get_right()->is_match(var_c) && "Expected var_c to be factored out."); // Test node properties. @@ -475,7 +475,7 @@ template void test_subtract() { // A right side zero node should reduce to left side. auto one_minus_zero = one - zero; assert(one_minus_zero.get() == one.get() && - "Expected to retrive the left side."); + "Expected to retrieve the left side."); assert(one_minus_zero->evaluate()[0] == static_cast (1.0) && "Expected a value of 1."); @@ -487,12 +487,12 @@ template void test_subtract() { assert(zero_minus_one->evaluate()[0] == static_cast (-1.0) && "Expected a value of -1."); -// Test variable quanities. +// Test variable quantities. // Any right side zero nodes should reduce to the other operand. auto variable = graph::variable (1, ""); auto var_minus_zero = variable - zero; assert(var_minus_zero.get() == variable.get() && - "Expected to retrive the left side."); + "Expected to retrieve the left side."); // Any right side zero should reduce to a the a multiply node. auto zero_minus_var = zero - variable; @@ -613,7 +613,7 @@ template void test_subtract() { // c1*a - c2*b -> c1*(a - c3*b) auto common_factor = 3.0*var_a - 2.0*var_b; assert(graph::multiply_cast(common_factor).get() && - "Expected multilpy node."); + "Expected multiply node."); // (c1 - c2*v) - c3*v -> c1 - c4*v (1 - 3v) - 2v = 1 - 5*v auto chained_subtract = (1.0 - 3.0*var_a) - 2.0*var_a; @@ -788,28 +788,28 @@ template void test_subtract() { "Expected a multiply node."); // (a/(b*c) - d/(e*c)) -> (a/b + d/e)/c - auto muliply_divide_factor = var_a/(var_b*var_c) - var_d/(var_e*var_c); - auto muliply_divide_factor_cast = divide_cast(muliply_divide_factor); - assert(muliply_divide_factor_cast.get() && "Expected divide node."); - assert(muliply_divide_factor_cast->get_right()->is_match(var_c) && + auto multiply_divide_factor = var_a/(var_b*var_c) - var_d/(var_e*var_c); + auto multiply_divide_factor_cast = divide_cast(multiply_divide_factor); + assert(multiply_divide_factor_cast.get() && "Expected divide node."); + assert(multiply_divide_factor_cast->get_right()->is_match(var_c) && "Expected var_c to be factored out."); // (a/(b*c) - d/(c*e)) -> (a/b - d/e)/c - auto muliply_divide_factor2 = var_a/(var_b*var_c) - var_d/(var_c*var_e); - auto muliply_divide_factor_cast2 = divide_cast(muliply_divide_factor2); - assert(muliply_divide_factor_cast2.get() && "Expected divide node."); - assert(muliply_divide_factor_cast2->get_right()->is_match(var_c) && + auto multiply_divide_factor2 = var_a/(var_b*var_c) - var_d/(var_c*var_e); + auto multiply_divide_factor_cast2 = divide_cast(multiply_divide_factor2); + assert(multiply_divide_factor_cast2.get() && "Expected divide node."); + assert(multiply_divide_factor_cast2->get_right()->is_match(var_c) && "Expected var_c to be factored out."); // (a/(c*b) - d/(e*c)) -> (a/b - d/e)/c - auto muliply_divide_factor3 = var_a/(var_c*var_b) - var_d/(var_e*var_c); - auto muliply_divide_factor_cast3 = divide_cast(muliply_divide_factor3); - assert(muliply_divide_factor_cast3.get() && "Expected divide node."); - assert(muliply_divide_factor_cast3->get_right()->is_match(var_c) && + auto multiply_divide_factor3 = var_a/(var_c*var_b) - var_d/(var_e*var_c); + auto multiply_divide_factor_cast3 = divide_cast(multiply_divide_factor3); + assert(multiply_divide_factor_cast3.get() && "Expected divide node."); + assert(multiply_divide_factor_cast3->get_right()->is_match(var_c) && "Expected var_c to be factored out."); // (a/(c*b) - d/(c*e)) -> (a/b - d/e)/c - auto muliply_divide_factor4 = var_a/(var_c*var_b) - var_d/(var_c*var_e); - auto muliply_divide_factor_cast4 = divide_cast(muliply_divide_factor4); - assert(muliply_divide_factor_cast4.get() && "Expected divide node."); - assert(muliply_divide_factor_cast4->get_right()->is_match(var_c) && + auto multiply_divide_factor4 = var_a/(var_c*var_b) - var_d/(var_c*var_e); + auto multiply_divide_factor_cast4 = divide_cast(multiply_divide_factor4); + assert(multiply_divide_factor_cast4.get() && "Expected divide node."); + assert(multiply_divide_factor_cast4->get_right()->is_match(var_c) && "Expected var_c to be factored out."); // Test common denominators. @@ -1016,24 +1016,24 @@ template void test_multiply() { assert(three_times_two_result.at(0) == two_times_three_result.at(0) && "Expected 3*2 == 2*3."); -// Test variable quanities. +// Test variable quantities. // Any zero should reduce back to zero. auto variable = graph::variable (1, ""); assert((variable*zero).get() == zero.get() && - "Expected to retrive the right side."); + "Expected to retrieve the right side."); assert((zero*variable).get() == zero.get() && - "Expected to retrive the left side."); + "Expected to retrieve the left side."); // Any one should reduce to the opposite side. assert((variable*one).get() == variable.get() && - "Expected to retrive the left side."); + "Expected to retrieve the left side."); assert((one*variable).get() == variable.get() && - "Expected to retrive the right side."); + "Expected to retrieve the right side."); assert((variable*zero)->evaluate()[0] == static_cast (0.0) && "Expected value of zero."); assert((variable*zero)->evaluate()[0] == static_cast (0.0) && "Expected value of zero."); -// Varibale times a non 0 or 1 constant should reduce to a multiply node. +// Variable times a non 0 or 1 constant should reduce to a multiply node. auto two_times_var = 2.0*variable; assert(graph::multiply_cast(two_times_var).get() && "Expected multiply node."); @@ -1106,9 +1106,9 @@ template void test_multiply() { auto x3_cast = graph::multiply_cast(x3); assert(x3_cast.get() && "Expected a multiply node."); assert(graph::constant_cast(x3_cast->get_left()).get() && - "Expected a constant coefficent."); + "Expected a constant coefficient."); assert(graph::multiply_cast(x3_cast->get_right()).get() && - "Expected a multipy node."); + "Expected a multiply node."); // Test reduction of common constants x*c1*c2*y = c3*x*y. auto x4 = graph::variable (1, "")*2.0; @@ -1117,9 +1117,9 @@ template void test_multiply() { auto x6_cast = graph::multiply_cast(x6); assert(x6_cast.get() && "Expected a multiply node."); assert(graph::constant_cast(x6_cast->get_left()).get() && - "Expected a constant coefficent."); + "Expected a constant coefficient."); assert(graph::multiply_cast(x6_cast->get_right()).get() && - "Expected multipy node."); + "Expected multiply node."); // Test reduction of common constants c1*x*y*c2 = c3*x*y. auto x7 = 2.0*graph::variable (1, ""); @@ -1128,9 +1128,9 @@ template void test_multiply() { auto x9_cast = graph::multiply_cast(x9); assert(x9_cast.get() && "Expected a multiply node."); assert(graph::constant_cast(x9_cast->get_left()).get() && - "Expected a constant coefficent."); + "Expected a constant coefficient."); assert(graph::multiply_cast(x9_cast->get_right()).get() && - "Expected multipy node."); + "Expected multiply node."); // Test reduction of common constants x*c1*y*c2 = c3*x*y. auto x10 = graph::variable (1, "")*2.0; @@ -1139,9 +1139,9 @@ template void test_multiply() { auto x12_cast = graph::multiply_cast(x12); assert(x12_cast.get() && "Expected a multiply node."); assert(graph::constant_cast(x12_cast->get_left()).get() && - "Expected a constant coefficent."); + "Expected a constant coefficient."); assert(graph::multiply_cast(x12_cast->get_right()).get() && - "Expected a multipy node."); + "Expected a multiply node."); // Test gathering of terms. auto v1 = graph::variable (1, "v1"); @@ -1334,7 +1334,7 @@ template void test_multiply() { auto pow_mul_cast = graph::pow_cast(pow_mul); assert(pow_mul_cast.get() && "Expected power node."); assert(add_cast(pow_mul_cast->get_right()) && - "Expected add node in expoent."); + "Expected add node in exponent."); // (c*v)*v -> c*v^2 auto test_var_move = [](graph::shared_leaf x) { @@ -1895,7 +1895,7 @@ template void test_multiply() { auto var_d = (3.0 + graph::variable (1, "")); auto gather_power2 = (var_a*graph::pow(var_b, var_c))*graph::pow(var_d, var_c); auto gather_power2_cast = graph::multiply_cast(gather_power2); - assert(gather_power2_cast.get() && "Expected a mutliply node."); + assert(gather_power2_cast.get() && "Expected a multiply node."); assert(gather_power2_cast->get_left()->is_match(var_a) && "Expected a."); assert(gather_power2_cast->get_right()->is_match(graph::pow(var_b*var_d, @@ -1904,7 +1904,7 @@ template void test_multiply() { // (a^c*b)*d^c -> b*(a*d)^c auto gather_power3 = (graph::pow(var_a, var_c)*var_b)*graph::pow(var_d, var_c); auto gather_power3_cast = graph::multiply_cast(gather_power3); - assert(gather_power3_cast.get() && "Expected a mutliply node."); + assert(gather_power3_cast.get() && "Expected a multiply node."); assert(gather_power3_cast->get_left()->is_match(var_b) && "Expected b."); assert(gather_power3_cast->get_right()->is_match(graph::pow(var_a*var_d, @@ -1913,7 +1913,7 @@ template void test_multiply() { // a^c*(b*d^c) -> b*(a*d)^c auto gather_power4 = graph::pow(var_a, var_c)*(var_b*graph::pow(var_d, var_c)); auto gather_power4_cast = graph::multiply_cast(gather_power4); - assert(gather_power4_cast.get() && "Expected a mutliply node."); + assert(gather_power4_cast.get() && "Expected a multiply node."); assert(gather_power4_cast->get_left()->is_match(var_b) && "Expected b."); assert(gather_power4_cast->get_right()->is_match(graph::pow(var_a*var_d, @@ -1922,7 +1922,7 @@ template void test_multiply() { // a^c*(b^c*d) -> d*(a*b)^c auto gather_power5 = graph::pow(var_a, var_c)*(graph::pow(var_b, var_c)*var_d); auto gather_power5_cast = graph::multiply_cast(gather_power5); - assert(gather_power5_cast.get() && "Expected a mutliply node."); + assert(gather_power5_cast.get() && "Expected a multiply node."); assert(gather_power5_cast->get_left()->is_match(var_d) && "Expected d."); assert(gather_power5_cast->get_right()->is_match(graph::pow(var_a*var_b, @@ -1958,7 +1958,7 @@ template void test_multiply() { 12.2), v1, 12.0)) && - "Exptected (((0.2*x + 3.1)*x + 12.2)*x + 12"); + "Expected (((0.2*x + 3.1)*x + 12.2)*x + 12"); // c1*fma(fma(fma(c2,x,c3),x,c4),x,c5) -> fma(fma(fma(c6,x,c7),x,c8),x,c9) auto consume = 10.0*(graph::fma(graph::fma(graph::fma(0.2,v1,2.3),v1,3.0),v1,0.1)); @@ -2057,8 +2057,8 @@ template void test_divide() { auto var_divided_var = variable/variable; auto var_divided_var_cast = graph::constant_cast(var_divided_var); - assert(var_divided_var_cast.get() && "Expeced constant node."); - assert(var_divided_var_cast->is(1) && "Expeced one."); + assert(var_divided_var_cast.get() && "Expected constant node."); + assert(var_divided_var_cast->is(1) && "Expected one."); auto variable_b = graph::variable (1, 4, ""); auto var_divided_varb = variable/variable_b; @@ -2084,7 +2084,7 @@ template void test_divide() { auto varvec_divided_two = varvec/2.0; assert(graph::multiply_cast(varvec_divided_two).get() && - "Expect a mutliply node."); + "Expect a multiply node."); const backend::buffer varvec_divided_two_result = varvec_divided_two->evaluate(); assert(varvec_divided_two_result.size() == 2 && "Size mismatch in result."); assert(varvec_divided_two_result.at(0) == static_cast (1.0) && @@ -3177,13 +3177,13 @@ template void test_fma() { // fma(a,b,fma(a,b,2)) -> 2*fma(a,b,1) auto chained_fma = fma(var_a, var_b, fma(var_a, var_b, two)); auto chained_fma_cast = multiply_cast(chained_fma); - assert(chained_fma_cast.get() && "Expected muliply node."); + assert(chained_fma_cast.get() && "Expected multiply node."); assert(constant_cast(chained_fma_cast->get_left()) && "Expected constant node."); // fma(a,b,fma(b,a,c)) -> 2*fma(a,b,1) auto chained_fma2 = fma(var_a, var_b, fma(var_b, var_a, two)); auto chained_fma_cast2 = multiply_cast(chained_fma2); - assert(chained_fma_cast2.get() && "Expected muliply node."); + assert(chained_fma_cast2.get() && "Expected multiply node."); assert(constant_cast(chained_fma_cast2->get_left()) && "Expected constant node."); @@ -3214,19 +3214,19 @@ template void test_fma() { // fma(a,b/c,b/d) -> b*(a/c + 1/d) auto divide_factor = graph::fma(var_a, var_b/var_c, var_b/var_d); assert(graph::multiply_cast(divide_factor).get() && - "Expetced a multiply node."); + "Expected a multiply node."); // fma(a,c/b,d/b) -> (a*c + d)/b auto divide_factor2 = graph::fma(var_a, var_c/var_b, var_d/var_b); assert(graph::divide_cast(divide_factor2).get() && - "Expetced a divide node."); + "Expected a divide node."); // fma(b/c,a,b/d) -> b*(a/c + 1/d) auto divide_factor3 = graph::fma(var_b/var_c, var_a, var_b/var_d); assert(graph::multiply_cast(divide_factor3).get() && - "Expetced a multiply node."); + "Expected a multiply node."); // fma(c/b,a,d/b) -> (a*c + d)/b auto divide_factor4 = graph::fma(var_c/var_b, var_a, var_d/var_b); assert(graph::divide_cast(divide_factor4).get() && - "Expetced a divide node."); + "Expected a divide node."); // Test node properties. assert(one_two_three->is_constant() && "Expected a constant."); @@ -3633,69 +3633,69 @@ template void test_fma() { "Expected a power node."); // fma(2,(ab)^2,a^2b) -> a^2*b*fma(2, b, 1) - auto commom_power = graph::fma(2.0, graph::pow(var_a*var_b, 2.0), graph::pow(var_a, 2.0)*var_b); - auto commom_power_cast = graph::multiply_cast(commom_power); - assert(commom_power_cast.get() && "Expected a multiply node."); - assert(commom_power_cast->get_right()->is_match(var_b) && - "Expeced b"); - assert(commom_power_cast->get_left()->is_match(graph::pow(var_a, 2.0) * + auto common_power = graph::fma(2.0, graph::pow(var_a*var_b, 2.0), graph::pow(var_a, 2.0)*var_b); + auto common_power_cast = graph::multiply_cast(common_power); + assert(common_power_cast.get() && "Expected a multiply node."); + assert(common_power_cast->get_right()->is_match(var_b) && + "Expected b"); + assert(common_power_cast->get_left()->is_match(graph::pow(var_a, 2.0) * graph::fma(2.0, var_b, 1.0)) && - "Expeced a^2*fma(2, b, 1)"); + "Expected a^2*fma(2, b, 1)"); // fma(2,(ba)^2,a^2b) -> a^2*b*fma(2, b, 1) - auto commom_power2 = graph::fma(2.0, graph::pow(var_b*var_a, 2.0), graph::pow(var_a, 2.0)*var_b); - auto commom_power2_cast = graph::multiply_cast(commom_power2); - assert(commom_power2_cast.get() && "Expected a multiply node."); - assert(commom_power2_cast->get_right()->is_match(var_b) && - "Expced b"); - assert(commom_power2_cast->get_left()->is_match(graph::pow(var_a, 2.0) * + auto common_power2 = graph::fma(2.0, graph::pow(var_b*var_a, 2.0), graph::pow(var_a, 2.0)*var_b); + auto common_power2_cast = graph::multiply_cast(common_power2); + assert(common_power2_cast.get() && "Expected a multiply node."); + assert(common_power2_cast->get_right()->is_match(var_b) && + "Expected b"); + assert(common_power2_cast->get_left()->is_match(graph::pow(var_a, 2.0) * graph::fma(2.0, var_b, 1.0)) && - "Expced a^2*fma(2, b, 1)"); + "Expected a^2*fma(2, b, 1)"); // fma(2,(a*b)^2,fma(a^2,b,c)) -> fma(a^2*b,fma(2,b,1),c) - auto commom_power3 = graph::fma(2.0, + auto common_power3 = graph::fma(2.0, graph::pow(var_a*var_b, 2.0), graph::fma(graph::pow(var_a, 2.0), var_b, var_c)); - auto commom_power3_cast = graph::fma_cast(commom_power3); - assert(commom_power3_cast.get() && "Expected a fma node."); - assert(commom_power3_cast->get_left()->is_match(graph::pow(var_a, 2.0)) && + auto common_power3_cast = graph::fma_cast(common_power3); + assert(common_power3_cast.get() && "Expected a fma node."); + assert(common_power3_cast->get_left()->is_match(graph::pow(var_a, 2.0)) && "Expected a^2"); - assert(commom_power3_cast->get_middle()->is_match(var_b*graph::fma(2.0, + assert(common_power3_cast->get_middle()->is_match(var_b*graph::fma(2.0, var_b, 1.0)) && "Expected b*fma(2,b,1)"); - assert(commom_power3_cast->get_right()->is_match(var_c) && "Expected c"); + assert(common_power3_cast->get_right()->is_match(var_c) && "Expected c"); // fma(2,(a*b)^2,fma(a^2,b,c)) -> fma(a^2*b,fma(2,b,1),c) - auto commom_power4 = graph::fma(2.0, + auto common_power4 = graph::fma(2.0, graph::pow(var_b*var_a, 2.0), graph::fma(graph::pow(var_a, 2.0), var_b, var_c)); - auto commom_power4_cast = graph::fma_cast(commom_power4); - assert(commom_power4_cast.get() && "Expected a fma node."); - assert(commom_power4_cast->get_left()->is_match(graph::pow(var_a, 2.0)) && + auto common_power4_cast = graph::fma_cast(common_power4); + assert(common_power4_cast.get() && "Expected a fma node."); + assert(common_power4_cast->get_left()->is_match(graph::pow(var_a, 2.0)) && "Expected a^2"); - assert(commom_power4_cast->get_middle()->is_match(var_b*graph::fma(2.0, + assert(common_power4_cast->get_middle()->is_match(var_b*graph::fma(2.0, var_b, 1.0)) && "Expected b*fma(2,b,1)"); - assert(commom_power4_cast->get_right()->is_match(var_c) && "Expected c"); + assert(common_power4_cast->get_right()->is_match(var_c) && "Expected c"); // fma(2,a^2,a) -> a*fma(2,a,1) auto common_power5 = graph::fma(2.0,var_a*var_a,var_a); - auto commom_power5_cast = graph::multiply_cast(common_power5); - assert(commom_power5_cast.get() && "Expected a multiply node."); - assert(commom_power5_cast->get_left()->is_match(graph::fma(2.0,var_a,1.0)) && + auto common_power5_cast = graph::multiply_cast(common_power5); + assert(common_power5_cast.get() && "Expected a multiply node."); + assert(common_power5_cast->get_left()->is_match(graph::fma(2.0,var_a,1.0)) && "Expected fma(2,a,1)."); - assert(commom_power5_cast->get_right()->is_match(var_a) && + assert(common_power5_cast->get_right()->is_match(var_a) && "Expected a."); // fma(2,a,a^2) -> a*(2 + a) auto common_power6 = graph::fma(2.0,var_a,var_a*var_a); - auto commom_power6_cast = graph::multiply_cast(common_power6); - assert(commom_power6_cast.get() && "Expected a multiply node."); - assert(commom_power6_cast->get_left()->is_match(2.0 + var_a) && + auto common_power6_cast = graph::multiply_cast(common_power6); + assert(common_power6_cast.get() && "Expected a multiply node."); + assert(common_power6_cast->get_left()->is_match(2.0 + var_a) && "Expected (2 + a)."); - assert(commom_power6_cast->get_right()->is_match(var_a) && + assert(common_power6_cast->get_right()->is_match(var_a) && "Expected a."); // fma(2,(a*b)^2,fma(3,a^2*b,c)) -> fma(a^2*b,fma(2,b,3),c) diff --git a/graph_tests/c_binding_test.c b/graph_tests/c_binding_test.c index 9af357f6189c7856ca5227d6d427572ccd5fc41f..7d9da5b2e40614109188a7d9a01d5b1f96d35003 100644 --- a/graph_tests/c_binding_test.c +++ b/graph_tests/c_binding_test.c @@ -38,34 +38,34 @@ void run_tests(const enum graph_type type, graph_node px = graph_pseudo_variable(c_context, x); assert(graph_remove_pseudo(c_context, px) == x && - "Expected to recieve x."); + "Expected to receive x."); graph_node one = graph_constant(c_context, 1.0); graph_node zero = graph_constant(c_context, 0.0); assert(graph_sub(c_context, one, one) == zero && - "Expected to recieve zero."); + "Expected to receive zero."); assert(graph_div(c_context, one, one) == one && - "Expected to recieve one."); + "Expected to receive one."); assert(graph_sqrt(c_context, one) == one && - "Expected to recieve one."); + "Expected to receive one."); assert(graph_exp(c_context, zero) == one && - "Expected to recieve one."); + "Expected to receive one."); assert(graph_log(c_context, one) == zero && - "Expected to recieve zero."); + "Expected to receive zero."); assert(graph_pow(c_context, one, one) == one && - "Expected to recieve one."); + "Expected to receive one."); if (type == COMPLEX_FLOAT || type == COMPLEX_DOUBLE) { assert(graph_erfi(c_context, zero) == zero && - "Expected to recieve zero."); + "Expected to receive zero."); } assert(graph_sin(c_context, zero) == zero && - "Expected to recieve zero."); + "Expected to receive zero."); assert(graph_cos(c_context, zero) == one && - "Expected to recieve one."); + "Expected to receive one."); assert(graph_atan(c_context, one, zero) == zero && - "Expected to recieve zero."); + "Expected to receive zero."); graph_node dydx = graph_df(c_context, y, x); graph_node dydm = graph_df(c_context, y, m); diff --git a/graph_tests/dispersion_test.cpp b/graph_tests/dispersion_test.cpp index eb8dde600196e96048d00ec411766d65ea3818ba..1c1fcd0be1ea33cf399f720c40c401c14731ddc4 100644 --- a/graph_tests/dispersion_test.cpp +++ b/graph_tests/dispersion_test.cpp @@ -17,13 +17,13 @@ /// /// @tparam DISPERSION Class of dispersion function to use. /// -/// @param[in] tolarance Tolarance to solver the dispersion function to. +/// @param[in] tolerance Tolerance to solver the dispersion function to. /// @param[in] omega Ray frequency. -/// @param[in] k_guess Inital guess for the wave number. +/// @param[in] k_guess Initial guess for the wave number. /// @param[in,out] eq The equilibrium. //------------------------------------------------------------------------------ template -void test_solve(const typename DISPERSION::base tolarance, +void test_solve(const typename DISPERSION::base tolerance, const typename DISPERSION::base omega, const typename DISPERSION::base k_guess, equilibrium::shared &eq) { @@ -49,18 +49,18 @@ void test_solve(const typename DISPERSION::base tolarance, graph::variable_cast(kz), graph::variable_cast(t), }); - D.solve(kx, inputs, 0, tolarance); + D.solve(kx, inputs, 0, tolerance); kx->set(static_cast (0.2)); - D.solve(ky, inputs, 0, tolarance); + D.solve(ky, inputs, 0, tolerance); ky->set(static_cast (0.25)); kz->set(k_guess); - D.solve(kz, inputs, 0, tolarance); + D.solve(kz, inputs, 0, tolerance); kz->set(static_cast (0.15)); kx->set(k_guess); - D.solve(w, inputs, 0, tolarance); + D.solve(w, inputs, 0, tolerance); } //------------------------------------------------------------------------------ @@ -68,17 +68,17 @@ void test_solve(const typename DISPERSION::base tolarance, /// /// @tparam T Base type of the calculation. /// -/// @param[in] tolarance Tolarance to solver the dispersion function to. +/// @param[in] tolerance Tolerance to solver the dispersion function to. //------------------------------------------------------------------------------ template -void run_tests(const T tolarance) { - auto eq_den = equilibrium::make_guassian_density (); +void run_tests(const T tolerance) { + auto eq_den = equilibrium::make_gaussian_density (); auto eq_no = equilibrium::make_no_magnetic_field (); - test_solve> (tolarance, 0.5, 1.0, eq_den); - test_solve> (tolarance, 1.0, 600.0, eq_no); - test_solve> (tolarance, 0.5, 1.0, eq_den); - test_solve> (tolarance, 900.0, 1000.0, eq_den); + test_solve> (tolerance, 0.5, 1.0, eq_den); + test_solve> (tolerance, 1.0, 600.0, eq_no); + test_solve> (tolerance, 0.5, 1.0, eq_den); + test_solve> (tolerance, 900.0, 1000.0, eq_den); } //------------------------------------------------------------------------------ diff --git a/graph_tests/efit_test.cpp b/graph_tests/efit_test.cpp index 17fe05cf2b9cfff1732389852ada0e85a58cf194..30085c8c9ca97e872605cf2db662730fc0421159 100644 --- a/graph_tests/efit_test.cpp +++ b/graph_tests/efit_test.cpp @@ -18,7 +18,7 @@ //------------------------------------------------------------------------------ /// @brief Class interface for gold data. /// -/// @tparam T Base type of teh calculation. +/// @tparam T Base type of the calculation. //------------------------------------------------------------------------------ template class gold_data { @@ -99,28 +99,28 @@ public: /// /// @param[in] test Test value. /// @param[in] expected Expected result. -/// @param[in] tolarance Error tolarance. +/// @param[in] tolerance Error tolerance. /// @param[in] name Name of the test. //------------------------------------------------------------------------------ template -void check_error(const T test, const T expected, const T tolarance, +void check_error(const T test, const T expected, const T tolerance, const char *name) { const T diff = test - expected; const T error = diff/(diff == 0 ? 1.0 : expected); - assert(error*error <= tolarance && name); + assert(error*error <= tolerance && name); } //------------------------------------------------------------------------------ /// @brief Check error. /// /// @param[in] test Test value. -/// @param[in] tolarance Error tolarance. +/// @param[in] tolerance Error tolerance. /// @param[in] name Name of the test. //------------------------------------------------------------------------------ template -void check_error(const T test, const T tolarance, +void check_error(const T test, const T tolerance, const char *name) { - assert(test*test <= tolarance && name); + assert(test*test <= tolerance && name); } //------------------------------------------------------------------------------ diff --git a/graph_tests/erfi_test.cpp b/graph_tests/erfi_test.cpp index 4cc5f9e0e3910fff3a5174b9d4c060f3dc18dbd2..82f8a19b304f52f490e8d817b8d97554ecdd1f86 100644 --- a/graph_tests/erfi_test.cpp +++ b/graph_tests/erfi_test.cpp @@ -21,9 +21,9 @@ /// /// @tparam T Base type of the calculation. /// -/// @param[in] tolarance Test tolarance. +/// @param[in] tolerance Test tolerance. //------------------------------------------------------------------------------ -template void test_erfi(const T tolarance) { +template void test_erfi(const T tolerance) { int ncid; nc_open(ERFI_FILE, NC_NOWRITE, &ncid); @@ -65,18 +65,18 @@ template void test_erfi(const T tolarance) { assert(std::real(gold) == std::real(test) && "Real parts don't match."); if (std::imag(test) != std::imag(gold)) { - assert(std::abs(static_cast (1) - std::imag(test)/std::imag(gold)) <= tolarance && + assert(std::abs(static_cast (1) - std::imag(test)/std::imag(gold)) <= tolerance && "Imaginary parts don't match."); } } else if (std::isinf(std::imag(gold))) { assert(std::imag(gold) == std::imag(test) && "Imaginary parts don't match."); if (std::real(test) != std::real(gold)) { - assert(std::abs(static_cast (1) - std::real(test)/std::real(gold)) <= tolarance && + assert(std::abs(static_cast (1) - std::real(test)/std::real(gold)) <= tolerance && "Real parts don't match."); } } else if (!std::isinf(std::real(test)) && !std::isinf(std::imag(test))) { - assert(std::abs(static_cast (1) - test/gold) <= tolarance && + assert(std::abs(static_cast (1) - test/gold) <= tolerance && "Results don't match."); } } diff --git a/graph_tests/jit_test.cpp b/graph_tests/jit_test.cpp index 5d878225af3ffc59bb750b6d505e3948a0508d93..c1111bb7adab9cbbfadcb31b59ed6f91215d0322 100644 --- a/graph_tests/jit_test.cpp +++ b/graph_tests/jit_test.cpp @@ -13,24 +13,24 @@ #include "../graph_framework/dispersion.hpp" //------------------------------------------------------------------------------ -/// @brief Assert when difference is greater than the tolarance. +/// @brief Assert when difference is greater than the tolerance. /// /// Specialize to check for complex numbers since complex has not <= operator. /// /// @tparam T Base type of the calculation. /// /// @param[in] test Test value. -/// @param[in] tolarance Test tolarance. +/// @param[in] tolerance Test tolerance. //------------------------------------------------------------------------------ template -void check(const T test, const T tolarance) { +void check(const T test, const T tolerance) { if constexpr (jit::complex_scalar) { - assert(std::real(test) <= std::real(tolarance) && + assert(std::real(test) <= std::real(tolerance) && "Real GPU and CPU values differ."); - assert(std::imag(test) <= std::imag(tolarance) && + assert(std::imag(test) <= std::imag(tolerance) && "Imaginary GPU and CPU values differ."); } else { - assert(test <= tolarance && "GPU and CPU values differ."); + assert(test <= tolerance && "GPU and CPU values differ."); } } @@ -43,14 +43,14 @@ void check(const T test, const T tolarance) { /// @param[in] outputs Kernel output nodes. /// @param[in] setters Kernel set nodes. /// @param[in] expected Expected result. -/// @param[in] tolarance Check tolarances. +/// @param[in] tolerance Check tolerances. //------------------------------------------------------------------------------ template void compile(graph::input_nodes inputs, graph::output_nodes outputs, graph::map_nodes setters, const T expected, - const T tolarance) { + const T tolerance) { jit::context source(0); source.add_kernel("test_kernel", inputs, outputs, setters, graph::shared_random_state (), @@ -66,7 +66,7 @@ void compile(graph::input_nodes inputs, source.copy_to_host(outputs.back(), &result); const T diff = std::abs(result - expected); - check(diff, tolarance); + check(diff, tolerance); } //------------------------------------------------------------------------------ @@ -330,11 +330,11 @@ template void run_math_tests() { /// @tparam DISPERSION_FUNCTION Class of dispersion function to use. /// /// @param[in,out] eq Equilibrium for the dispersion function. -/// @param[in] tolarance The test tolarance for check results to. +/// @param[in] tolerance The test tolerance for check results to. //------------------------------------------------------------------------------ template void run_dispersion_test(equilibrium::shared &eq, - const typename DISPERSION_FUNCTION::base tolarance) { + const typename DISPERSION_FUNCTION::base tolerance) { auto w = graph::variable (1, "w"); auto x = graph::variable (1, "x"); @@ -355,7 +355,7 @@ void run_dispersion_test(equilibrium::shared t->set(static_cast (1.0)); dispersion::dispersion_interface D(w, kx, ky, kz, x, y, z, t, eq); - auto residule = D.get_d(); + auto residual = D.get_d(); compile ({graph::variable_cast(w), graph::variable_cast(x), @@ -365,9 +365,9 @@ void run_dispersion_test(equilibrium::shared graph::variable_cast(ky), graph::variable_cast(kz), graph::variable_cast(t)}, - {residule}, {}, - residule->evaluate().at(0), - tolarance); + {residual}, {}, + residual->evaluate().at(0), + tolerance); } //------------------------------------------------------------------------------ diff --git a/graph_tests/math_test.cpp b/graph_tests/math_test.cpp index 670423d00ce71579baff044071031bfbdf7f3be0..ac612c18e4d595e9a70e4d2f2f65bca07a22213e 100644 --- a/graph_tests/math_test.cpp +++ b/graph_tests/math_test.cpp @@ -58,7 +58,7 @@ void test_sqrt() { auto x_cast = graph::multiply_cast(x); assert(x_cast.get() && "Expected a multiply node."); assert(graph::constant_cast(x_cast->get_left()).get() && - "Expected a constant coefficent."); + "Expected a constant coefficient."); assert(graph::sqrt_cast(x_cast->get_right()).get() && "Expected sqrt node."); @@ -87,7 +87,7 @@ void test_sqrt() { auto cxby_sqrt_cast = graph::multiply_cast(cxby_sqrt); assert(cxby_sqrt_cast.get() && "Expected a multiply node."); assert(graph::constant_cast(cxby_sqrt_cast->get_left()).get() && - "Expected a constant coefficent."); + "Expected a constant coefficient."); assert(graph::sqrt_cast(cxby_sqrt_cast->get_right()).get() && "Expected sqrt node."); @@ -97,7 +97,7 @@ void test_sqrt() { auto sqpow_cast = graph::pow_cast(sqpow); assert(sqpow_cast.get() && "Expected pow node."); auto exp_cast = graph::multiply_cast(sqpow_cast->get_right()); - assert(exp_cast.get() && "Expected a mutliply node."); + assert(exp_cast.get() && "Expected a multiply node."); auto constant_cast = graph::constant_cast(exp_cast->get_left()); assert(constant_cast.get() && "Expected constant node on the left."); assert(constant_cast->is(0.5) && "Expected a value of 0.5"); @@ -185,7 +185,7 @@ void test_pow() { auto powsq_cast = graph::pow_cast(powsq); assert(powsq_cast.get() && "Expected pow node."); auto exp_cast = graph::multiply_cast(powsq_cast->get_right()); - assert(exp_cast.get() && "Expected a mutliply node."); + assert(exp_cast.get() && "Expected a multiply node."); auto constant_cast = graph::constant_cast(exp_cast->get_left()); assert(constant_cast.get() && "Expected constant node on the left."); assert(constant_cast->is(0.5) && "Expected a value of 0.5"); @@ -252,7 +252,7 @@ void test_pow() { // sqrt(a)^a -> a^(b/c) -> a^(c2*b) auto pow_sqrt = graph::pow_cast(graph::pow(graph::sqrt(ten), ten)); assert(graph::multiply_cast(pow_sqrt->get_right()).get() && - "Expected mutliply node."); + "Expected multiply node."); // Test derivatives. auto x2 = graph::pow(ten, 2.0); @@ -352,7 +352,7 @@ void test_pow() { auto pow_combine_cast = graph::divide_cast(pow_combine); assert(pow_combine_cast.get() && "Expected a divide node."); assert(pow_combine_cast->get_right()->is_match(graph::pow(var_d, 2.0)) && - "Expected d^2 in deniminator."); + "Expected d^2 in denominator."); assert(pow_combine_cast->get_left()->is_match(graph::pow(var_a, 2.0*(var_b - 0.5)) * var_c*var_c) && diff --git a/graph_tests/node_test.cpp b/graph_tests/node_test.cpp index 0a11aa9b0e48242cfdf56af5b524d5db8fda934c..b6fefcd484513ae53ad01a09e0714ae83ed39a16 100644 --- a/graph_tests/node_test.cpp +++ b/graph_tests/node_test.cpp @@ -27,32 +27,32 @@ void test_constant() { assert(zero_cast.get() && "Expected a constant type."); assert(graph::variable_cast(zero).get() == nullptr && "Expected a constant type."); - assert(zero_cast->is(0) && "Constant value expeced zero."); - assert(!zero_cast->is(1) && "Constant value not expeced one."); + assert(zero_cast->is(0) && "Constant value expected zero."); + assert(!zero_cast->is(1) && "Constant value not expected one."); const backend::buffer zero_result = zero->evaluate(); assert(zero_result.size() == 1 && "Expected single value."); assert(zero_result.at(0) == static_cast (0.0) && - "Constant value evalute expeced zero."); + "Constant value evaluate expected zero."); auto dzero = zero->df(zero); auto dzero_cast = graph::constant_cast(dzero); assert(dzero_cast.get() && "Expected a constant type for derivative."); - assert(dzero_cast->is(1.0) && "Constant value expeced one."); + assert(dzero_cast->is(1.0) && "Constant value expected one."); zero->set(static_cast (1.0)); - assert(zero_cast->is(0.0) && "Constant value expeced zero."); + assert(zero_cast->is(0.0) && "Constant value expected zero."); auto one = graph::one (); auto one_cast = graph::constant_cast(one); assert(one_cast.get() && "Expected a constant type."); - assert(one_cast->is(1.0) && "Constant value expeced zero."); + assert(one_cast->is(1.0) && "Constant value expected zero."); const backend::buffer one_result = one->evaluate(); assert(one_result.size() == 1 && "Expected single value."); assert(one_result.at(0) == static_cast (1.0) && - "Constant value evalute expeced one."); + "Constant value evaluate expected one."); auto done = one->df(zero); auto done_cast = graph::constant_cast(done); assert(done_cast.get() && "Expected a constant type for derivative."); - assert(done_cast->is(0) && "Constant value expeced zero."); + assert(done_cast->is(0) && "Constant value expected zero."); // Test is_match auto c1 = graph::constant(static_cast (5.0)); @@ -81,18 +81,18 @@ void test_variable() { const backend::buffer zero_result = zero->evaluate(); assert(zero_result.size() == 1 && "Expected single value."); assert(zero_result.at(0) == static_cast (0.0) && - "Variable value evalute expeced zero."); + "Variable value evaluate expected zero."); zero->set(static_cast (1.0)); const backend::buffer zero_result2 = zero->evaluate(); assert(zero_result2.size() == 1 && "Expected single value."); assert(zero_result2.at(0) == static_cast (1.0) && - "Variable value evalute expeced zero."); + "Variable value evaluate expected zero."); auto dzero = zero->df(zero); assert(graph::constant_cast(dzero).get() && "Expected a constant type."); const backend::buffer dzero_result = dzero->evaluate(); assert(dzero_result.size() == 1 && "Expected single value."); assert(dzero_result.at(0) == static_cast (1.0) && - "Constant value evalute expeced one."); + "Constant value evaluate expected one."); auto ones = graph::variable (2, 1, ""); auto dzerodone = zero->df(ones); @@ -101,22 +101,22 @@ void test_variable() { const backend::buffer dzerodone_result = dzerodone->evaluate(); assert(dzerodone_result.size() == 1 && "Expected single value."); assert(dzerodone_result.at(0) == static_cast (0.0) && - "Constant value evalute expeced zero."); + "Constant value evaluate expected zero."); auto one_two = graph::variable (std::vector ({1.0, 2.0}), ""); const backend::buffer one_two_result = one_two->evaluate(); assert(one_two_result.size() == 2 && "Expected two elements in constant"); assert(one_two_result.at(0) == static_cast (1.0) && - "Expected one for first elememt"); + "Expected one for first element"); assert(one_two_result.at(1) == static_cast (2.0) && - "Expected two for second elememt"); + "Expected two for second element"); one_two->set(std::vector ({3.0, 4.0})); const backend::buffer one_two_result2 = one_two->evaluate(); assert(one_two_result2.size() == 2 && "Expected two elements in constant"); assert(one_two_result2.at(0) == static_cast (3.0) && - "Expected three for first elememt"); + "Expected three for first element"); assert(one_two_result2.at(1) == static_cast (4.0) && - "Expected four for second elememt"); + "Expected four for second element"); // Test is_match auto v1 = graph::variable (1, ""); diff --git a/graph_tests/physics_test.cpp b/graph_tests/physics_test.cpp index 3c6fe14c666fa1ba61ebd8ff7ede54c5b4abccce..02af06061bd97de2397e8993b2eb88a433050a8f 100644 --- a/graph_tests/physics_test.cpp +++ b/graph_tests/physics_test.cpp @@ -48,7 +48,7 @@ void test_constant() { z->set(static_cast (real_dist(engine))); t->set(static_cast (0.0)); -// The equilibrum isn't used; +// The equilibrium isn't used; auto eq = equilibrium::make_slab (); auto dt_const = graph::constant(static_cast (1.0)); solver::rk2> @@ -106,10 +106,10 @@ void test_constant() { /// /// @tparam SOLVER Class of solver to use. /// -/// @param[in] tolarance Tolarance to solver the dispersion function to. +/// @param[in] tolerance Tolerance to solver the dispersion function to. //------------------------------------------------------------------------------ template -void test_bohm_gross(const typename SOLVER::base tolarance) { +void test_bohm_gross(const typename SOLVER::base tolerance) { auto omega = graph::variable (1, "\\omega"); auto kx = graph::variable (1, "k_{x}"); auto ky = graph::variable (1, "k_{y}"); @@ -149,7 +149,7 @@ void test_bohm_gross(const typename SOLVER::base tolarance) { auto dt_const = graph::constant(static_cast (0.1)); SOLVER solve(omega, kx, ky, kz, x, y, z, t, dt_const, eq); if constexpr (jit::use_cuda()) { - solve.init(kx, tolarance); + solve.init(kx, tolerance); } else { solve.init(kx); } @@ -164,7 +164,7 @@ void test_bohm_gross(const typename SOLVER::base tolarance) { + 3.0/2.0*vth2/omega0*k0*time - 1.0; const auto diff_x = x->evaluate().at(0) - expected_x; - assert(std::abs(diff_x*diff_x) < std::abs(tolarance) && + assert(std::abs(diff_x*diff_x) < std::abs(tolerance) && "Failed to reach expected x."); } @@ -203,10 +203,10 @@ void test_bohm_gross(const typename SOLVER::base tolarance) { /// /// @tparam SOLVER Class of solver to use. /// -/// @param[in] tolarance Tolarance to solver the dispersion function to. +/// @param[in] tolerance Tolerance to solver the dispersion function to. //------------------------------------------------------------------------------ template -void test_light_wave(const typename SOLVER::base tolarance) { +void test_light_wave(const typename SOLVER::base tolerance) { auto omega = graph::variable (1, "\\omega"); auto kx = graph::variable (1, "k_{x}"); auto ky = graph::variable (1, "k_{y}"); @@ -243,7 +243,7 @@ void test_light_wave(const typename SOLVER::base tolarance) { auto eq = equilibrium::make_no_magnetic_field (); auto dt_const = graph::constant(static_cast (0.1)); SOLVER solve(omega, kx, ky, kz, x, y, z, t, dt_const, eq); - solve.init(kx, tolarance); + solve.init(kx, tolerance); solve.compile(); for (size_t i = 0; i < 20; i++) { @@ -255,7 +255,7 @@ void test_light_wave(const typename SOLVER::base tolarance) { + k0/omega0*time - 1.0; const auto diff_x = x->evaluate().at(0) - expected_x; - assert(std::abs(diff_x*diff_x) < std::abs(tolarance) && + assert(std::abs(diff_x*diff_x) < std::abs(tolerance) && "Failed to reach expected x."); } @@ -280,10 +280,10 @@ void test_light_wave(const typename SOLVER::base tolarance) { /// /// @tparam T Base type of the calculation. /// -/// @param[in] tolarance Tolarance to solver the dispersion function to. +/// @param[in] tolerance Tolerance to solver the dispersion function to. //------------------------------------------------------------------------------ template -void test_acoustic_wave(const T tolarance) { +void test_acoustic_wave(const T tolerance) { auto omega = graph::variable (1, "\\omega"); auto kx = graph::variable (1, "k_{x}"); auto ky = graph::variable (1, "k_{y}"); @@ -320,7 +320,7 @@ void test_acoustic_wave(const T tolarance) { auto dt_const = graph::constant(static_cast (0.0001)); solver::rk4> solve(omega, kx, ky, kz, x, y, z, t, dt_const, eq); - solve.init(kx, tolarance); + solve.init(kx, tolerance); solve.compile(); for (size_t i = 0; i < 20; i++) { @@ -329,7 +329,7 @@ void test_acoustic_wave(const T tolarance) { } const auto diff_x = x->evaluate().at(0)/t->evaluate().at(0) - vs; - assert(std::abs(diff_x*diff_x) < std::abs(tolarance) && + assert(std::abs(diff_x*diff_x) < std::abs(tolerance) && "Ray progated at different speed."); } @@ -397,7 +397,7 @@ void test_o_mode_wave() { const auto diff = x->evaluate().at(0) - x_cut; assert(std::abs(diff*diff) < 8.0E-10 && - "Failed to reach expected tolarance."); + "Failed to reach expected tolerance."); } //------------------------------------------------------------------------------ @@ -512,13 +512,13 @@ void test_cold_plasma_cutoffs() { /// /// @tparam T Base type of the calculation. /// -/// @param[in] tolarance Tolarance to solver the dispersion function to. +/// @param[in] tolerance Tolerance to solver the dispersion function to. /// @param[in] n0 Starting nz value. /// @param[in] x0 Starting x guess. /// @param[in] kx0 Starting kx guess. //------------------------------------------------------------------------------ template -void test_reflection(const T tolarance, +void test_reflection(const T tolerance, const T n0, const T x0, const T kx0) { @@ -544,7 +544,7 @@ void test_reflection(const T tolarance, solve(w, kx, ky, kz, x, y, z, t, dt_const, eq); // Solve for a location where the wave is cut off. - solve.init(x, tolarance); + solve.init(x, tolerance); const T cuttoff_location = x->evaluate().at(0); // Set the ray starting point close to the cut off to reduce the number of @@ -554,7 +554,7 @@ void test_reflection(const T tolarance, // Set an inital guess for kx and solve for the wave number at the new // location. kx->set(kx0); - solve.init(kx, tolarance); + solve.init(kx, tolerance); solve.compile(); solve.sync_host(); @@ -622,17 +622,17 @@ template void test_efit() { /// /// @tparam T Base type of the calculation. /// -/// @param[in] tolarance Tolarance to solver the dispersion function to. +/// @param[in] tolerance Tolerance to solver the dispersion function to. //------------------------------------------------------------------------------ -template void run_tests(const T tolarance) { +template void run_tests(const T tolerance) { test_constant (); - test_bohm_gross>> (tolarance); - test_bohm_gross>> (tolarance); - test_light_wave>> (tolarance); - test_light_wave>> (tolarance); - test_acoustic_wave (tolarance); + test_bohm_gross>> (tolerance); + test_bohm_gross>> (tolerance); + test_light_wave>> (tolerance); + test_light_wave>> (tolerance); + test_acoustic_wave (tolerance); test_o_mode_wave (); - test_reflection (tolarance, 0.7, 0.1, 22.0); + test_reflection (tolerance, 0.7, 0.1, 22.0); test_cold_plasma_cutoffs (); test_efit (); } diff --git a/graph_tests/piecewise_test.cpp b/graph_tests/piecewise_test.cpp index a07e7aee548d81c0a7f87952a1bcf4ec4021ca26..904187381099071a5093e76294bbd53b1a574430 100644 --- a/graph_tests/piecewise_test.cpp +++ b/graph_tests/piecewise_test.cpp @@ -18,29 +18,29 @@ #include "../graph_framework/jit.hpp" //------------------------------------------------------------------------------ -/// @brief Assert when difference is greater than the tolarance. +/// @brief Assert when difference is greater than the tolerance. /// /// Specialize to check for complex numbers since complex has not <= operator. /// /// @tparam T Base type of the calculation. /// /// @param[in] test Test value. -/// @param[in] tolarance Test tolarance. +/// @param[in] tolerance Test tolerance. //------------------------------------------------------------------------------ template void check(const T test, - const T tolarance) { + const T tolerance) { if constexpr (jit::complex_scalar) { - assert(std::real(test) <= std::real(tolarance) && + assert(std::real(test) <= std::real(tolerance) && "Real GPU and CPU values differ."); - assert(std::imag(test) <= std::imag(tolarance) && + assert(std::imag(test) <= std::imag(tolerance) && "Imaginary GPU and CPU values differ."); } else { - assert(test <= tolarance && "GPU and CPU values differ."); + assert(test <= tolerance && "GPU and CPU values differ."); } } //------------------------------------------------------------------------------ -/// @brief Compile kernal and check the result of the output. +/// @brief Compile kernel and check the result of the output. /// /// @tparam T Base type of the calculation. /// @@ -48,13 +48,13 @@ template void check(const T test, /// @param[in] outputs Kernel output nodes. /// @param[in] setters Kernel set nodes. /// @param[in] expected Expected result. -/// @param[in] tolarance Check tolarances. +/// @param[in] tolerance Check tolerances. //------------------------------------------------------------------------------ template void compile(graph::input_nodes inputs, graph::output_nodes outputs, graph::map_nodes setters, const T expected, - const T tolarance) { + const T tolerance) { jit::context source(0); source.add_kernel("test_kernel", inputs, outputs, setters, graph::shared_random_state (), inputs.back()->size()); @@ -69,7 +69,7 @@ template void compile(graph::input_nodes inputs, source.copy_to_host(outputs.back(), &result); const T diff = std::abs(result - expected); - check(diff, tolarance); + check(diff, tolerance); } //------------------------------------------------------------------------------ diff --git a/graph_tests/solver_test.cpp b/graph_tests/solver_test.cpp index 34528a5d47bc0d64157cebf61057db1564c6865f..427d0f572c58608683fc9bfdb8c823cc844fd0d1 100644 --- a/graph_tests/solver_test.cpp +++ b/graph_tests/solver_test.cpp @@ -19,13 +19,13 @@ /// /// @tparam SOLVER Class of solver to use. /// -/// @param[in] tolarance Tolarance to solver the dispersion function to. +/// @param[in] tolerance Tolerance to solver the dispersion function to. /// @param[in] omega0 Ray frequency. /// @param[in] kx0 Wave number guess. -/// @param[in] dt Timestep for the solver. +/// @param[in] dt Time step for the solver. //------------------------------------------------------------------------------ template -void test_solver(const typename SOLVER::base tolarance, +void test_solver(const typename SOLVER::base tolerance, const typename SOLVER::base omega0, const typename SOLVER::base kx0, const typename SOLVER::base dt) { @@ -38,12 +38,12 @@ void test_solver(const typename SOLVER::base tolarance, auto z = graph::variable (1, 0.0, "z"); auto t = graph::variable (1, 0.0, "t"); - auto eq = equilibrium::make_guassian_density (); + auto eq = equilibrium::make_gaussian_density (); auto dt_const = graph::constant(static_cast (dt)); SOLVER solve(w, kx, ky, kz, x, y, z, t, dt_const, eq); const timing::measure_diagnostic solver("init"); - auto residule = solve.init(kx, tolarance); + auto residual = solve.init(kx, tolerance); solver.print(); const timing::measure_diagnostic compile("compile"); @@ -53,31 +53,31 @@ void test_solver(const typename SOLVER::base tolarance, const timing::measure_diagnostic step("step"); for (size_t i = 0; i < 5; i++) { solve.step(); - assert(std::abs(solve.check_residule(0)) < std::abs(tolarance) && - "Solver failed to retain initial acuracy"); + assert(std::abs(solve.check_residual(0)) < std::abs(tolerance) && + "Solver failed to retain initial accuracy"); } step.print(); } //------------------------------------------------------------------------------ -/// @brief Run tests with a specified disperions Relation. +/// @brief Run tests with a specified dispersions Relation. /// /// @tparam DISPERSION Class of dispersion function to use. /// -/// @param[in] tolarance Tolarance to solver the dispersion function to. +/// @param[in] tolerance Tolerance to solver the dispersion function to. /// @param[in] omega0 Ray frequency. /// @param[in] kx0 Wave number guess. /// @param[in] dt Timestep for the solver. //------------------------------------------------------------------------------ template -void run_disperions_tests(const typename DISPERSION::base tolarance, - const typename DISPERSION::base omega0, - const typename DISPERSION::base kx0, - const typename DISPERSION::base dt) { - test_solver> (tolarance, omega0, kx0, dt); +void run_dispersions_tests(const typename DISPERSION::base tolerance, + const typename DISPERSION::base omega0, + const typename DISPERSION::base kx0, + const typename DISPERSION::base dt) { + test_solver> (tolerance, omega0, kx0, dt); std::cout << "Test completed for rk2 solver." << std::endl; - test_solver> (tolarance, omega0, kx0, dt); + test_solver> (tolerance, omega0, kx0, dt); std::cout << "Test completed for rk4 solver." << std::endl; } @@ -86,13 +86,13 @@ void run_disperions_tests(const typename DISPERSION::base tolarance, /// /// @tparam T Base type of the calculation. /// -/// @param[in] tolarance Tolarance to solver the dispersion function to. +/// @param[in] tolerance Tolerance to solver the dispersion function to. //------------------------------------------------------------------------------ template -void run_tests(const T tolarance) { - run_disperions_tests> (tolarance, 0.5, 0.25, 1.0); - run_disperions_tests> (tolarance, 0.5, 0.25, 0.00001); - run_disperions_tests> (tolarance, 900.0, 1000.0, 0.5/10000.0); +void run_tests(const T tolerance) { + run_dispersions_tests> (tolerance, 0.5, 0.25, 1.0); + run_dispersions_tests> (tolerance, 0.5, 0.25, 0.00001); + run_dispersions_tests> (tolerance, 900.0, 1000.0, 0.5/10000.0); std::cout << "Tests completed for "; jit::add_type (std::cout); std::cout << std::endl; diff --git a/utilities/bin.py b/utilities/bin.py index e339560bdb3f93bbc39dccf01407a73d11e9a0c7..a5183c9f844cb13db0a14c559ed5fcea271d73dc 100644 --- a/utilities/bin.py +++ b/utilities/bin.py @@ -114,13 +114,13 @@ def main(**args): ## * --directory Directory to search for the result files. ## * --num_files Number of result files to read. ## * --num_x Number of bin points in x. -## * --min_x Miniumum x bin. +## * --min_x Minimum x bin. ## * --max_x Maximum x bin. ## * --num_y Number of bin points in y. -## * --min_y Miniumum y bin. +## * --min_y Minimum y bin. ## * --max_y Maximum y bin. ## * --num_z Number of bin points in z. -## * --min_z Miniumum z bin. +## * --min_z Minimum z bin. ## * --max_z Maximum z bin. #------------------------------------------------------------------------------- if __name__ == '__main__': @@ -154,7 +154,7 @@ if __name__ == '__main__': action='store', required=True, dest='min_x', - help='Miniumum x bin.', + help='Minimum x bin.', type=float, metavar='MIN_X') command_line_parser.add_argument('-mx', @@ -178,7 +178,7 @@ if __name__ == '__main__': action='store', required=True, dest='min_y', - help='Miniumum y bin.', + help='Minimum y bin.', type=float, metavar='MIN_Y') command_line_parser.add_argument('-my', @@ -202,7 +202,7 @@ if __name__ == '__main__': action='store', required=True, dest='min_z', - help='Miniumum z bin.', + help='Minimum z bin.', type=float, metavar='MIN_Z') command_line_parser.add_argument('-mz', diff --git a/utilities/fix_NaN.py b/utilities/fix_NaN.py index 8206d8624c7ec899c15959bc4adf8b0ee8344c05..e339f516bf5a1ec97b90ab7f0b80798697442cd0 100644 --- a/utilities/fix_NaN.py +++ b/utilities/fix_NaN.py @@ -61,10 +61,10 @@ def main(**args): ## * --directory Directory to search for the result files. ## * --num_files Number of result files to read. ## * --num_r Number of radial bin points. -## * --min_r Miniumum radial bin. +## * --min_r Minimum radial bin. ## * --max_r Maximum radial bin. ## * --num_z Number of vertical bin points. -## * --min_z Miniumum vertical bin. +## * --min_z Minimum vertical bin. ## * --max_z Maximum vertical bin. #------------------------------------------------------------------------------- if __name__ == '__main__': @@ -99,7 +99,7 @@ if __name__ == '__main__': action='store', required=True, dest='min_r', - help='Miniumum radial bin.', + help='Minimum radial bin.', type=float, metavar='MIN_R') command_line_parser.add_argument('-mr', @@ -123,7 +123,7 @@ if __name__ == '__main__': action='store', required=True, dest='min_z', - help='Miniumum vertical bin.', + help='Minimum vertical bin.', type=float, metavar='MIN_Z') command_line_parser.add_argument('-mz', diff --git a/utilities/get_includes.py b/utilities/get_includes.py index 993183d4e7675ffd1d15cb5a2742210205e9acf8..3d8a6fc5b16b002d4851fa5c4025b4a00c22cbf0 100644 --- a/utilities/get_includes.py +++ b/utilities/get_includes.py @@ -35,7 +35,7 @@ def main(**args): ## ## cc -Wp,-v -x c++ /dev/null -fsyntax-only ## -## to retrive the include paths for the compiler used. +## to retrieve the include paths for the compiler used. ## ## Defines command line arguments for. ## * --compiler Compiler command.