diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..20d40b6 --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. \ No newline at end of file diff --git a/assets/const/const.dat b/assets/const/const.dat deleted file mode 100644 index 5d165ce..0000000 --- a/assets/const/const.dat +++ /dev/null @@ -1,469 +0,0 @@ -CODATA 2022 + astrophysical constants -Most quantities have been converted to CGS -Generated on Feb 10, 2025 -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -Reference: - -Mohr, P. , Tiesinga, E. , Newell, D. and Taylor, B. (2024), Codata Internationally Recommended 2022 Values of the Fundamental Physical Constants, -Codata Internationally Recommended 2022 Values of the Fundamental Physical Constants, -[online], https://tsapps.nist.gov/publication/get_pdf.cfm?pub_id=958002, https://physics.nist.gov/constants (Accessed February 10, 2025) -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -Symbol Name Value Unit Uncertainty Source -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -weinK Wien displacement law constant 2.89776850e-01 K cm 5.10000000e-07 CODATA2022 -au1Hyper atomic unit of 1st hyperpolarizablity 3.20636151e-53 C^3 m^3 J^-2 2.80000000e-60 CODATA2022 -au2Hyper atomic unit of 2nd hyperpolarizablity 6.23538080e-65 C^4 m^4 J^-3 1.10000000e-71 CODATA2022 -auEDip atomic unit of electric dipole moment 8.47835309e-30 C m 7.30000000e-37 CODATA2022 -auEPol atomic unit of electric polarizablity 1.64877727e-41 C^2 m^2 J^-1 1.60000000e-49 CODATA2022 -auEQuad atomic unit of electric quadrupole moment 4.48655124e-40 C m^2 3.90000000e-47 CODATA2022 -auMDip atomic unit of magn. dipole moment 1.85480190e-23 J T^-1 1.60000000e-30 CODATA2022 -auMFlux atomic unit of magn. flux density 2.35051757e+09 G 7.10000000e-01 CODATA2022 -muD deuteron magn. moment 4.33073482e-27 J T^-1 3.80000000e-34 CODATA2022 -muD_Bhor deuteron magn. moment to Bohr magneton ratio 4.66975457e-04 5.00000000e-12 CODATA2022 -muD_Nuc deuteron magn. moment to nuclear magneton ratio 8.57438233e-01 9.20000000e-09 CODATA2022 -muD_e deuteron-electron magn. moment ratio -4.66434555e-04 5.00000000e-12 CODATA2022 -muD_p deuteron-proton magn. moment ratio 3.07012208e-01 4.50000000e-09 CODATA2022 -muD_n deuteron-neutron magn. moment ratio -4.48206520e-01 1.10000000e-07 CODATA2022 -rgE electron gyromagn. ratio 1.76085963e+11 s^-1 T^-1 5.30000000e+01 CODATA2022 -rgE_2pi electron gyromagn. ratio over 2 pi 2.80249532e+04 MHz T^-1 2.40000000e-03 CODATA2022 -muE electron magn. moment -9.28476412e-24 J T^-1 8.00000000e-31 CODATA2022 -muE_Bhor electron magn. moment to Bohr magneton ratio -1.00115965e+00 3.80000000e-12 CODATA2022 -muE_Nuc electron magn. moment to nuclear magneton ratio -1.83828197e+03 8.50000000e-07 CODATA2022 -muE_anom electron magn. moment anomaly 1.15965219e-03 3.80000000e-12 CODATA2022 -muE_muP_shield electron to shielded proton magn. moment ratio -6.58227596e+02 7.10000000e-06 CODATA2022 -muE_muH_shield electron to shielded helion magn. moment ratio 8.64058255e+02 1.00000000e-05 CODATA2022 -muE_D electron-deuteron magn. moment ratio -2.14392349e+03 2.30000000e-05 CODATA2022 -muE_mu electron-muon magn. moment ratio 2.06766989e+02 5.40000000e-06 CODATA2022 -muE_n electron-neutron magn. moment ratio 9.60920500e+02 2.30000000e-04 CODATA2022 -muE_p electron-proton magn. moment ratio -6.58210686e+02 6.60000000e-06 CODATA2022 -mu0 magn. constant 1.25663706e-06 N A^-2 0.00000000e+00 CODATA2022 -phi0 magn. flux quantum 2.06783385e-15 Wb 0.00000000e+00 CODATA2022 -muMu muon magn. moment -4.49044799e-26 J T^-1 4.00000000e-33 CODATA2022 -muMu_Bhor muon magn. moment to Bohr magneton ratio -4.84197045e-03 1.30000000e-10 CODATA2022 -muMu_Nuc muon magn. moment to nuclear magneton ratio -8.89059698e+00 2.30000000e-07 CODATA2022 -muMu_p muon-proton magn. moment ratio -3.18334512e+00 8.90000000e-08 CODATA2022 -rgN neutron gyromagn. ratio 1.83247171e+08 s^-1 T^-1 4.30000000e+01 CODATA2022 -rgN_2pi neutron gyromagn. ratio over 2 pi 2.91646950e+01 MHz T^-1 7.30000000e-06 CODATA2022 -muN neutron magn. moment -9.66236450e-27 J T^-1 2.40000000e-33 CODATA2022 -muN_Bhor neutron magn. moment to Bohr magneton ratio -1.04187563e-03 2.50000000e-10 CODATA2022 -muN_Nuc neutron magn. moment to nuclear magneton ratio -1.91304273e+00 4.50000000e-07 CODATA2022 -muN_p_shield neutron to shielded proton magn. moment ratio -6.84996940e-01 1.60000000e-07 CODATA2022 -muN_e neutron-electron magn. moment ratio 1.04066882e-03 2.50000000e-10 CODATA2022 -muN_p neutron-proton magn. moment ratio -6.84979340e-01 1.60000000e-07 CODATA2022 -rgP proton gyromagn. ratio 2.67522187e+08 s^-1 T^-1 1.10000000e-01 CODATA2022 -rgP_2pi proton gyromagn. ratio over 2 pi 4.25774813e+01 MHz T^-1 3.70000000e-06 CODATA2022 -muP proton magn. moment 1.41060671e-26 J T^-1 1.20000000e-33 CODATA2022 -muP_Bhor proton magn. moment to Bohr magneton ratio 1.52103221e-03 1.50000000e-11 CODATA2022 -muP_Nuc proton magn. moment to nuclear magneton ratio 2.79284735e+00 2.80000000e-08 CODATA2022 -muP_shield proton magn. shielding correction 2.56890000e-05 1.10000000e-08 CODATA2022 -muP_n proton-neutron magn. moment ratio -1.45989805e+00 3.40000000e-07 CODATA2022 -rgH shielded helion gyromagn. ratio 2.03789457e+08 s^-1 T^-1 2.40000000e+00 CODATA2022 -rgH_2pi shielded helion gyromagn. ratio over 2 pi 3.24341015e+01 MHz T^-1 2.80000000e-06 CODATA2022 -muH_shield shielded helion magn. moment -1.07455302e-26 J T^-1 9.30000000e-34 CODATA2022 -muH_shield_Bhor shielded helion magn. moment to Bohr magneton rati -1.15867147e-03 1.40000000e-11 CODATA2022 -muH_shield_Nuc shielded helion magn. moment to nuclear magneton r -2.12749772e+00 2.50000000e-08 CODATA2022 -muH_shield_p shielded helion to proton magn. moment ratio -7.61766562e-01 1.20000000e-08 CODATA2022 -muH_shield_p_shield shielded helion to shielded proton magn. moment ra -7.61786131e-01 3.30000000e-09 CODATA2022 -muP_shield shielded proton magn. moment 1.41057047e-26 J T^-1 1.20000000e-33 CODATA2022 -muP_shield_Bhor shielded proton magn. moment to Bohr magneton rati 1.52099313e-03 1.60000000e-11 CODATA2022 -muP_shield_Nuc shielded proton magn. moment to nuclear magneton r 2.79277560e+00 3.00000000e-08 CODATA2022 -aSi_220 {220} lattice spacing of silicon 1.92015571e-08 cm 3.20000000e-16 CODATA2022 -aSi lattice spacing of silicon 1.92015576e-08 cm 5.00000000e-16 CODATA2022 -mAlpha_e alpha particle-electron mass ratio 7.29429954e+03 2.40000000e-07 CODATA2022 -mAlpha alpha particle mass 6.64465734e-24 g 2.00000000e-33 CODATA2022 -EAlpha alpha particle mass energy equivalent 5.97192019e-03 erg 1.80000000e-12 CODATA2022 -EAlpha_MeV alpha particle mass energy equivalent in MeV 5.97192019e-03 erg 1.76239430e-12 CODATA2022 -mAlpha_u alpha particle mass in u 6.64465734e-24 g 1.04613961e-34 CODATA2022 -MAlpha alpha particle molar mass 4.00150618e+00 g / mol 1.20000000e-09 CODATA2022 -mAlpha_p alpha particle-proton mass ratio 3.97259969e+00 2.20000000e-10 CODATA2022 -angstromStar Angstrom star 1.00001495e-08 cm 9.00000000e-15 CODATA2022 -mU atomic mass constant 1.66053907e-24 g 5.00000000e-34 CODATA2022 -mU_E atomic mass constant energy equivalent 1.49241809e-03 erg 4.50000000e-13 CODATA2022 -mU_E_MeV atomic mass constant energy equivalent in MeV 1.49241809e-03 erg 4.48609458e-13 CODATA2022 -mU_eV atomic mass unit-electron volt relationship 1.49241809e-03 erg 4.48609458e-13 CODATA2022 -mU_hartree atomic mass unit-hartree relationship 3.42317769e+07 E_h 1.00000000e-02 CODATA2022 -mU_Hz atomic mass unit-hertz relationship 2.25234272e+23 1 / s 6.80000000e+13 CODATA2022 -mU_invm atomic mass unit-inverse meter relationship 7.51300661e+12 1 / cm 2.30000000e+03 CODATA2022 -mU_J atomic mass unit-joule relationship 1.49241809e-03 erg 4.50000000e-13 CODATA2022 -mU_K atomic mass unit-kelvin relationship 1.08095402e+13 K 3.30000000e+03 CODATA2022 -mU_kg atomic mass unit-kilogram relationship 1.66053907e-24 g 5.00000000e-34 CODATA2022 -au1Hyper atomic unit of 1st hyperpolarizability 3.20636131e-53 C^3 m^3 J^-2 1.50000000e-62 CODATA2022 -au2Hyper atomic unit of 2nd hyperpolarizability 6.23537999e-65 C^4 m^4 J^-3 3.80000000e-74 CODATA2022 -auAct atomic unit of action 1.05457182e-27 erg s 0.00000000e+00 CODATA2022 -auC atomic unit of charge 1.60217663e-19 C 0.00000000e+00 CODATA2022 -auCrho atomic unit of charge density 1.08120238e+12 C m^-3 4.90000000e+02 CODATA2022 -auI atomic unit of current 6.62361824e-03 A 1.30000000e-14 CODATA2022 -auMu atomic unit of electric dipole mom. 8.47835363e-30 C m 1.30000000e-39 CODATA2022 -auE atomic unit of electric field 5.14220675e+11 V m^-1 7.80000000e+01 CODATA2022 -auEFG atomic unit of electric field gradient 9.71736243e+21 V m^-2 2.90000000e+12 CODATA2022 -auPol atomic unit of electric polarizability 1.64877727e-41 C^2 m^2 J^-1 5.00000000e-51 CODATA2022 -auV atomic unit of electric potential 2.72113862e+01 V 5.30000000e-11 CODATA2022 -auQuad atomic unit of electric quadrupole mom. 4.48655152e-40 C m^2 1.40000000e-49 CODATA2022 -Eh atomic unit of energy 4.35974472e-11 erg 8.50000000e-23 CODATA2022 -auF atomic unit of force 8.23872350e-03 dyn 1.20000000e-12 CODATA2022 -auL atomic unit of length 5.29177211e-09 cm 8.00000000e-19 CODATA2022 -auM atomic unit of mag. dipole mom. 1.85480202e-23 J T^-1 5.60000000e-33 CODATA2022 -auB atomic unit of mag. flux density 2.35051757e+09 G 7.10000000e-01 CODATA2022 -auChi atomic unit of magnetizability 7.89103660e-29 J T^-2 4.80000000e-38 CODATA2022 -amu atomic unit of mass 9.10938370e-28 g 2.80000000e-37 CODATA2022 -aup atomic unit of momentum 1.99285191e-19 dyn s 3.00000000e-29 CODATA2022 -auEps atomic unit of permittivity 1.11265006e-10 F m^-1 1.70000000e-20 CODATA2022 -aut atomic unit of time 2.41888433e-17 s 4.70000000e-29 CODATA2022 -auv atomic unit of velocity 2.18769126e+08 cm / s 3.30000000e-02 CODATA2022 -N_a Avogadro constant 6.02214076e+23 1 / mol 0.00000000e+00 CODATA2022 -mu_B Bohr magneton 9.27401008e-24 J T^-1 2.80000000e-33 CODATA2022 -mu_B_eV_T Bohr magneton in eV/T 5.78838181e-05 eV T^-1 1.70000000e-14 CODATA2022 -mu_B_Hz_T Bohr magneton in Hz/T 1.39962449e+10 Hz T^-1 4.20000000e+00 CODATA2022 -mu_B__mT Bohr magneton in inverse meters per tesla 4.66864481e+01 m^-1 T^-1 2.90000000e-07 CODATA2022 -muB_K_T Bohr magneton in K/T 6.71713816e-01 K T^-1 2.00000000e-10 CODATA2022 -rBhor Bohr radius 5.29177211e-09 cm 8.00000000e-19 CODATA2022 -kB Boltzmann constant 1.38064900e-16 erg / K 0.00000000e+00 CODATA2022 -kB_eV_K Boltzmann constant in eV/K 1.38064900e-16 erg / K 0.00000000e+00 CODATA2022 -kB_Hz_K Boltzmann constant in Hz/K 2.08366191e+10 1 / (K s) 0.00000000e+00 CODATA2022 -kB__MK Boltzmann constant in inverse meters per kelvin 6.95034570e-01 1 / (K cm) 4.00000000e-07 CODATA2022 -Z0 characteristic impedance of vacuum 3.76730314e+02 ohm 5.61366546e-08 CODATA2022 -re classical electron radius 2.81794033e-13 cm 1.30000000e-22 CODATA2022 -lambda_compt Compton wavelength 2.42631024e-10 cm 7.30000000e-20 CODATA2022 -lambda_compt_2pi Compton wavelength over 2 pi 3.86159268e-11 cm 1.80000000e-20 CODATA2022 -G0 conductance quantum 7.74809173e-05 S 0.00000000e+00 CODATA2022 -K_J-90 conventional value of Josephson constant 4.83597900e+14 Hz V^-1 0.00000000e+00 CODATA2022 -R_K-90 conventional value of von Klitzing constant 2.58128070e+04 ohm 0.00000000e+00 CODATA2022 -xu(CuKa1) Cu x unit 1.00207697e-11 cm 2.80000000e-18 CODATA2022 -muD_e deuteron-electron mag. mom. ratio -4.66434555e-04 1.20000000e-12 CODATA2022 -mD_e deuteron-electron mass ratio 3.67048297e+03 1.30000000e-07 CODATA2022 -g_D deuteron g factor 8.57438234e-01 2.20000000e-09 CODATA2022 -muD deuteron mag. mom. 4.33073509e-27 J T^-1 1.10000000e-35 CODATA2022 -muD_Bhor deuteron mag. mom. to Bohr magneton ratio 4.66975457e-04 1.20000000e-12 CODATA2022 -muD_Nuc deuteron mag. mom. to nuclear magneton ratio 8.57438234e-01 2.20000000e-09 CODATA2022 -mD deuteron mass 3.34358377e-24 g 1.00000000e-33 CODATA2022 -mD_E deuteron mass energy equivalent 3.00506323e-03 erg 9.10000000e-13 CODATA2022 -mD_E_MeV deuteron mass energy equivalent in MeV 3.00506323e-03 erg 9.13240681e-13 CODATA2022 -mD_u deuteron mass in u 3.34358377e-24 g 6.64215627e-35 CODATA2022 -MD deuteron molar mass 2.01355321e+00 g / mol 6.10000000e-10 CODATA2022 -muD_n deuteron-neutron mag. mom. ratio -4.48206530e-01 1.10000000e-07 CODATA2022 -muD_p deuteron-proton mag. mom. ratio 3.07012209e-01 7.90000000e-10 CODATA2022 -mD_p deuteron-proton mass ratio 1.99900750e+00 1.10000000e-10 CODATA2022 -RrmsD deuteron rms charge radius 2.12799000e-13 cm 7.40000000e-17 CODATA2022 -eps_0 electric constant 8.85418781e-12 F m^-1 1.30000000e-21 CODATA2022 -qE_m electron charge to mass quotient -1.75882001e+11 C kg^-1 5.30000000e+01 CODATA2022 -muE_D electron-deuteron mag. mom. ratio -2.14392349e+03 5.60000000e-06 CODATA2022 -mE_D electron-deuteron mass ratio 2.72443711e-04 9.60000000e-15 CODATA2022 -g_e electron g factor -2.00231930e+00 3.50000000e-13 CODATA2022 -rg_e electron gyromag. ratio 1.76085963e+11 s^-1 T^-1 5.30000000e+01 CODATA2022 -rg_e_2pi electron gyromag. ratio over 2 pi 2.80249516e+04 MHz T^-1 1.70000000e-04 CODATA2022 -muE electron mag. mom. -9.28476470e-24 J T^-1 2.80000000e-33 CODATA2022 -muE_anom electron mag. mom. anomaly 1.15965218e-03 1.80000000e-13 CODATA2022 -muE_Bhor electron mag. mom. to Bohr magneton ratio -1.00115965e+00 1.80000000e-13 CODATA2022 -muE_Nuc electron mag. mom. to nuclear magneton ratio -1.83828197e+03 1.10000000e-07 CODATA2022 -mE electron mass 9.10938370e-28 g 2.80000000e-37 CODATA2022 -mE_E electron mass energy equivalent 8.18710578e-07 erg 2.50000000e-16 CODATA2022 -mE_MeV electron mass energy equivalent in MeV 8.18710578e-07 erg 2.40326495e-16 CODATA2022 -mE_u electron mass in u 9.10938370e-28 g 2.65686251e-38 CODATA2022 -ME electron molar mass 5.48579909e-04 g / mol 1.70000000e-13 CODATA2022 -muE_mu electron-muon mag. mom. ratio 2.06766988e+02 4.60000000e-06 CODATA2022 -mE_mu electron-muon mass ratio 4.83633169e-03 1.10000000e-10 CODATA2022 -muE_n electron-neutron mag. mom. ratio 9.60920500e+02 2.30000000e-04 CODATA2022 -mE_n electron-neutron mass ratio 5.43867344e-04 2.60000000e-13 CODATA2022 -muE_p electron-proton mag. mom. ratio -6.58210688e+02 2.00000000e-07 CODATA2022 -mE_p electron-proton mass ratio 5.44617021e-04 3.30000000e-14 CODATA2022 -mE_tau electron-tau mass ratio 2.87585000e-04 1.90000000e-08 CODATA2022 -mE_alpha electron to alpha particle mass ratio 1.37093355e-04 4.50000000e-15 CODATA2022 -muE_H_shield electron to shielded helion mag. mom. ratio 8.64058257e+02 1.00000000e-05 CODATA2022 -muE_p_shield electron to shielded proton mag. mom. ratio -6.58227597e+02 7.20000000e-06 CODATA2022 -eV electron volt 1.60217663e-12 erg 0.00000000e+00 CODATA2022 -eV_amu electron volt-atomic mass unit relationship 1.78266192e-33 g 5.31372501e-43 CODATA2022 -eV_hartree electron volt-hartree relationship 3.67493222e-02 E_h 7.10000000e-14 CODATA2022 -eV_Hz electron volt-hertz relationship 2.41798924e+14 1 / s 0.00000000e+00 CODATA2022 -eV_invm electron volt-inverse meter relationship 8.06554394e+03 1 / cm 0.00000000e+00 CODATA2022 -eV_J electron volt-joule relationship 1.60217663e-12 erg 0.00000000e+00 CODATA2022 -eV_K electron volt-kelvin relationship 1.16045181e+04 K 0.00000000e+00 CODATA2022 -eV_kg electron volt-kilogram relationship 1.78266192e-33 g 0.00000000e+00 CODATA2022 -e elementary charge 1.60217663e-19 C 0.00000000e+00 CODATA2022 -e_h elementary charge over h 2.41798926e+14 A J^-1 1.50000000e+06 CODATA2022 -F Faraday constant 9.64853321e+04 C mol^-1 0.00000000e+00 CODATA2022 -F_conv Faraday constant for conventional electric current 9.64853251e+04 C_90 mol^-1 1.20000000e-03 CODATA2022 -G_F Fermi coupling constant 4.54379566e+00 s4 / (g2 cm4) 2.33738613e-06 CODATA2022 -alpha fine-structure constant 7.29735257e-03 1.10000000e-12 CODATA2022 -c1 first radiation constant 3.74177185e-05 St erg 0.00000000e+00 CODATA2022 -c1L first radiation constant for spectral radiance 1.19104297e-05 St erg / rad2 0.00000000e+00 CODATA2022 -Eh_amu hartree-atomic mass unit relationship 4.85087021e-32 g 1.46127438e-41 CODATA2022 -Eh_eV hartree-electron volt relationship 4.35974472e-11 erg 8.49153616e-23 CODATA2022 -Eh Hartree energy 4.35974472e-11 erg 8.50000000e-23 CODATA2022 -Eh_E_eV Hartree energy in eV 4.35974472e-11 erg 8.49153616e-23 CODATA2022 -Eh_Hz hartree-hertz relationship 6.57968392e+15 1 / s 1.30000000e+04 CODATA2022 -Eh_invm hartree-inverse meter relationship 2.19474631e+05 1 / cm 4.30000000e-07 CODATA2022 -Eh_J hartree-joule relationship 4.35974472e-11 erg 8.50000000e-23 CODATA2022 -Eh_K hartree-kelvin relationship 3.15775025e+05 K 6.10000000e-07 CODATA2022 -Eh_kg hartree-kilogram relationship 4.85087021e-32 g 9.40000000e-44 CODATA2022 -mH_e helion-electron mass ratio 5.49588528e+03 2.40000000e-07 CODATA2022 -mH helion mass 5.00641278e-24 g 1.50000000e-33 CODATA2022 -mH_E helion mass energy equivalent 4.49953941e-03 erg 1.40000000e-12 CODATA2022 -mH_E_eV helion mass energy equivalent in MeV 4.49953941e-03 erg 1.36185014e-12 CODATA2022 -mH_u helion mass in u 5.00641278e-24 g 1.61072289e-34 CODATA2022 -MH helion molar mass 3.01493225e+00 g / mol 9.10000000e-10 CODATA2022 -mH_p helion-proton mass ratio 2.99315267e+00 1.30000000e-10 CODATA2022 -Hz_amu hertz-atomic mass unit relationship 7.37249732e-48 g 2.15870079e-57 CODATA2022 -Hz_eV hertz-electron volt relationship 6.62607015e-27 erg 0.00000000e+00 CODATA2022 -Hz_Eh hertz-hartree relationship 1.51982985e-16 E_h 2.90000000e-28 CODATA2022 -Hz_invm hertz-inverse meter relationship 3.33564095e-11 1 / cm 0.00000000e+00 CODATA2022 -Hz_J hertz-joule relationship 6.62607015e-27 erg 0.00000000e+00 CODATA2022 -Hz_K hertz-kelvin relationship 4.79924307e-11 K 0.00000000e+00 CODATA2022 -Hz_kg hertz-kilogram relationship 7.37249732e-48 g 0.00000000e+00 CODATA2022 -invalpha inverse fine-structure constant 1.37035999e+02 2.10000000e-08 CODATA2022 -invm_amu inverse meter-atomic mass unit relationship 2.21021909e-39 g 6.64215627e-49 CODATA2022 -invm_eV inverse meter-electron volt relationship 1.98644586e-18 erg 0.00000000e+00 CODATA2022 -invm_Eh inverse meter-hartree relationship 4.55633525e-08 E_h 8.80000000e-20 CODATA2022 -invm_Hz inverse meter-hertz relationship 2.99792458e+08 1 / s 0.00000000e+00 CODATA2022 -invm_J inverse meter-joule relationship 1.98644586e-18 erg 0.00000000e+00 CODATA2022 -invm_K inverse meter-kelvin relationship 1.43877688e-02 K 0.00000000e+00 CODATA2022 -invm_kg inverse meter-kilogram relationship 2.21021909e-39 g 0.00000000e+00 CODATA2022 -invG0 inverse of conductance quantum 1.29064037e+04 ohm 0.00000000e+00 CODATA2022 -K_J Josephson constant 4.83597848e+14 Hz V^-1 0.00000000e+00 CODATA2022 -J_amu joule-atomic mass unit relationship 1.11265006e-14 g 3.32107813e-24 CODATA2022 -J_eV joule-electron volt relationship 1.00000000e+07 erg 0.00000000e+00 CODATA2022 -J_Eh joule-hartree relationship 2.29371228e+17 E_h 4.50000000e+05 CODATA2022 -J_Hz joule-hertz relationship 1.50919018e+33 1 / s 0.00000000e+00 CODATA2022 -J_invm joule-inverse meter relationship 5.03411657e+22 1 / cm 0.00000000e+00 CODATA2022 -J_K joule-kelvin relationship 7.24297052e+22 K 0.00000000e+00 CODATA2022 -J_kg joule-kilogram relationship 1.11265006e-14 g 0.00000000e+00 CODATA2022 -K_amu kelvin-atomic mass unit relationship 1.53617919e-37 g 4.64950939e-47 CODATA2022 -K_eV kelvin-electron volt relationship 1.38064900e-16 erg 0.00000000e+00 CODATA2022 -K_Eh kelvin-hartree relationship 3.16681156e-06 E_h 6.10000000e-18 CODATA2022 -K_Hz kelvin-hertz relationship 2.08366191e+10 1 / s 0.00000000e+00 CODATA2022 -K_invm kelvin-inverse meter relationship 6.95034800e-01 1 / cm 0.00000000e+00 CODATA2022 -K_J kelvin-joule relationship 1.38064900e-16 erg 0.00000000e+00 CODATA2022 -K_kg kelvin-kilogram relationship 1.53617919e-37 g 0.00000000e+00 CODATA2022 -kg_amu kilogram-atomic mass unit relationship 1.00000000e+03 g 2.98897032e-07 CODATA2022 -kg_eV kilogram-electron volt relationship 8.98755179e+23 erg 0.00000000e+00 CODATA2022 -kg_Eh kilogram-hartree relationship 2.06148579e+34 E_h 4.00000000e+22 CODATA2022 -kg_Hz kilogram-hertz relationship 1.35639249e+50 1 / s 0.00000000e+00 CODATA2022 -kg_invm kilogram-inverse meter relationship 4.52443833e+39 1 / cm 0.00000000e+00 CODATA2022 -kg_J kilogram-joule relationship 8.98755179e+23 erg 0.00000000e+00 CODATA2022 -kg_K kilogram-kelvin relationship 6.50965726e+39 K 0.00000000e+00 CODATA2022 -aSi lattice parameter of silicon 5.43102051e-08 cm 8.90000000e-16 CODATA2022 -n0 Loschmidt constant (273.15 K, 101.325 kPa) 2.68678011e+19 1 / cm3 0.00000000e+00 CODATA2022 -mu0 mag. constant 1.25663706e-06 N A^-2 1.90000000e-16 CODATA2022 -Phi0 mag. flux quantum 2.06783385e-15 Wb 0.00000000e+00 CODATA2022 -R molar gas constant 8.31446262e+07 erg / (K mol) 0.00000000e+00 CODATA2022 -Mu molar mass constant 1.00000000e+00 g / mol 3.00000000e-10 CODATA2022 -MC12 molar mass of carbon-12 1.20000000e+01 g / mol 3.60000000e-09 CODATA2022 -h_mol molar Planck constant 3.99031271e-03 St g / mol 0.00000000e+00 CODATA2022 -ch_mol molar Planck constant times c 1.19626566e+08 cm erg / mol 5.40000000e-02 CODATA2022 -v_mol_ideal_100kPa molar volume of ideal gas (273.15 K, 100 kPa) 2.27109546e+04 cm3 / mol 0.00000000e+00 CODATA2022 -v_mol_ideal_101.325kPa molar volume of ideal gas (273.15 K, 101.325 kPa) 2.24139695e+04 cm3 / mol 0.00000000e+00 CODATA2022 -vSI_mol molar volume of silicon 1.20588320e+01 cm3 / mol 6.00000000e-07 CODATA2022 -xu Mo x unit 1.00209952e-11 cm 5.30000000e-18 CODATA2022 -lambda_compt_mu muon Compton wavelength 1.17344411e-12 cm 2.60000000e-20 CODATA2022 -lambda_compt_mu_2pi muon Compton wavelength over 2 pi 1.86759431e-13 cm 4.20000000e-21 CODATA2022 -mMu_e muon-electron mass ratio 2.06768283e+02 4.60000000e-06 CODATA2022 -g_mu muon g factor -2.00233184e+00 1.30000000e-09 CODATA2022 -muMu muon mag. mom. -4.49044830e-26 J T^-1 1.00000000e-33 CODATA2022 -muMu_anom muon mag. mom. anomaly 1.16592089e-03 6.30000000e-10 CODATA2022 -muMu_Bhor muon mag. mom. to Bohr magneton ratio -4.84197047e-03 1.10000000e-10 CODATA2022 -muMu_Nuc muon mag. mom. to nuclear magneton ratio -8.89059703e+00 2.00000000e-07 CODATA2022 -mMu muon mass 1.88353163e-25 g 4.20000000e-33 CODATA2022 -mMu_E muon mass energy equivalent 1.69283380e-04 erg 3.80000000e-12 CODATA2022 -mMu_E_MeV muon mass energy equivalent in MeV 1.69283380e-04 erg 3.68500626e-12 CODATA2022 -mMu_E_u muon mass in u 1.88353163e-25 g 4.15134767e-33 CODATA2022 -MMu muon molar mass 1.13428926e-01 g / mol 2.50000000e-09 CODATA2022 -mMu_n muon-neutron mass ratio 1.12454517e-01 2.50000000e-09 CODATA2022 -muMu_p muon-proton mag. mom. ratio -3.18334514e+00 7.10000000e-08 CODATA2022 -mMu_p muon-proton mass ratio 1.12609526e-01 2.50000000e-09 CODATA2022 -mMu_tau muon-tau mass ratio 5.94635000e-02 4.00000000e-06 CODATA2022 -1 natural unit of action 1.05457182e-27 erg s 0.00000000e+00 CODATA2022 -1_eV_s natural unit of action in eV s 1.05457182e-27 erg s 0.00000000e+00 CODATA2022 -E natural unit of energy 8.18710578e-07 erg 2.50000000e-16 CODATA2022 -E_MeV natural unit of energy in MeV 8.18710578e-07 erg 2.40326495e-16 CODATA2022 -L natural unit of length 3.86159268e-11 cm 1.20000000e-20 CODATA2022 -M natural unit of mass 9.10938370e-28 g 2.80000000e-37 CODATA2022 -p natural unit of momentum 2.73092449e-17 dyn s 3.40000000e-25 CODATA2022 -p_MeV_c natural unit of momentum in MeV/c 5.10998946e-01 MeV/c 3.10000000e-09 CODATA2022 -t natural unit of time 1.28808867e-21 s 3.90000000e-31 CODATA2022 -v natural unit of velocity 2.99792458e+10 cm / s 0.00000000e+00 CODATA2022 -lambda_compt_n neutron Compton wavelength 1.31959091e-13 cm 7.50000000e-23 CODATA2022 -lambda_compt_n_2pi neutron Compton wavelength over 2 pi 2.10019415e-14 cm 1.40000000e-23 CODATA2022 -muN_e neutron-electron mag. mom. ratio 1.04066882e-03 2.50000000e-10 CODATA2022 -mN_e neutron-electron mass ratio 1.83868366e+03 8.90000000e-07 CODATA2022 -g_n neutron g factor -3.82608545e+00 9.00000000e-07 CODATA2022 -rg_n neutron gyromag. ratio 1.83247171e+08 s^-1 T^-1 4.30000000e+01 CODATA2022 -rg_n_2pi neutron gyromag. ratio over 2 pi 2.91646933e+01 MHz T^-1 6.90000000e-06 CODATA2022 -muN neutron mag. mom. -9.66236510e-27 J T^-1 2.30000000e-33 CODATA2022 -muN_Bhor neutron mag. mom. to Bohr magneton ratio -1.04187563e-03 2.50000000e-10 CODATA2022 -muN_Nuc neutron mag. mom. to nuclear magneton ratio -1.91304273e+00 4.50000000e-07 CODATA2022 -mN neutron mass 1.67492750e-24 g 9.50000000e-34 CODATA2022 -mN_E neutron mass energy equivalent 1.50534976e-03 erg 8.60000000e-13 CODATA2022 -mN_E_MeV neutron mass energy equivalent in MeV 1.50534976e-03 erg 8.65175382e-13 CODATA2022 -mN_u neutron mass in u 1.67492750e-24 g 8.13664143e-34 CODATA2022 -MN neutron molar mass 1.00866492e+00 g / mol 5.70000000e-10 CODATA2022 -mN_mu neutron-muon mass ratio 8.89248406e+00 2.00000000e-07 CODATA2022 -muN_p neutron-proton mag. mom. ratio -6.84979340e-01 1.60000000e-07 CODATA2022 -mN_p neutron-proton mass ratio 1.00137842e+00 4.90000000e-10 CODATA2022 -mN_tau neutron-tau mass ratio 5.28779000e-01 3.60000000e-05 CODATA2022 -muN_p_shield neutron to shielded proton mag. mom. ratio -6.84996940e-01 1.60000000e-07 CODATA2022 -G Newtonian constant of gravitation 6.67430000e-08 cm3 / (g s2) 1.50000000e-12 CODATA2022 -G_hbar_c Newtonian constant of gravitation over h-bar c 6.70883000e-39 (GeV/c^2)^-2 1.50000000e-43 CODATA2022 -mu_N nuclear magneton 5.05078375e-27 J T^-1 1.50000000e-36 CODATA2022 -mu_N_eV_T nuclear magneton in eV/T 3.15245126e-08 eV T^-1 9.60000000e-18 CODATA2022 -mu_N_invm_T nuclear magneton in inverse meters per tesla 2.54262343e-02 m^-1 T^-1 1.60000000e-10 CODATA2022 -mu_N_K_T nuclear magneton in K/T 3.65826778e-04 K T^-1 1.10000000e-13 CODATA2022 -mu_N_MHz_T nuclear magneton in MHz/T 7.62259323e+00 MHz T^-1 2.30000000e-09 CODATA2022 -h Planck constant 6.62607015e-27 erg s 0.00000000e+00 CODATA2022 -h_eV_s Planck constant in eV s 6.62607009e-27 erg s 4.00544159e-35 CODATA2022 -hbar Planck constant over 2 pi 1.05457180e-27 erg s 1.30000000e-35 CODATA2022 -hbar_eV_s Planck constant over 2 pi in eV s 1.05457181e-27 erg s 6.40870654e-36 CODATA2022 -chbar_MeV Planck constant over 2 pi times c in MeV fm 3.16152675e-17 cm erg 1.92261196e-25 CODATA2022 -planck_length Planck length 1.61625500e-33 cm 1.80000000e-38 CODATA2022 -planck_mass Planck mass 2.17643400e-05 g 2.40000000e-10 CODATA2022 -planck_mass_E_GeV Planck mass energy equivalent in GeV 1.95608143e+16 erg 2.24304729e+11 CODATA2022 -planck_temp Planck temperature 1.41678400e+32 K 1.60000000e+27 CODATA2022 -plank_time Planck time 5.39124700e-44 s 6.00000000e-49 CODATA2022 -qP_mP proton charge to mass quotient 9.57883316e+07 C kg^-1 2.90000000e-02 CODATA2022 -lambda_compt_p proton Compton wavelength 1.32140986e-13 cm 4.00000000e-23 CODATA2022 -lambda_compt_p_2pi proton Compton wavelength over 2 pi 2.10308910e-14 cm 9.70000000e-24 CODATA2022 -mP_e proton-electron mass ratio 1.83615267e+03 1.10000000e-07 CODATA2022 -g_p proton g factor 5.58569469e+00 1.60000000e-09 CODATA2022 -rg_p proton gyromag. ratio 2.67522187e+08 s^-1 T^-1 1.10000000e-01 CODATA2022 -rg_p_2pi proton gyromag. ratio over 2 pi 4.25774789e+01 MHz T^-1 2.90000000e-07 CODATA2022 -muP proton mag. mom. 1.41060680e-26 J T^-1 6.00000000e-36 CODATA2022 -muP_Bhor proton mag. mom. to Bohr magneton ratio 1.52103220e-03 4.60000000e-13 CODATA2022 -muP_Nuc proton mag. mom. to nuclear magneton ratio 2.79284734e+00 8.20000000e-10 CODATA2022 -muP_shield proton mag. shielding correction 2.56890000e-05 1.10000000e-08 CODATA2022 -mP proton mass 1.67262192e-24 g 5.10000000e-34 CODATA2022 -mP_E proton mass energy equivalent 1.50327762e-03 erg 4.60000000e-13 CODATA2022 -mP_E_MeV proton mass energy equivalent in MeV 1.50327762e-03 erg 4.64631224e-13 CODATA2022 -mP_u proton mass in u 1.67262192e-24 g 8.80085705e-35 CODATA2022 -MP proton molar mass 1.00727647e+00 g / mol 3.10000000e-10 CODATA2022 -mP_mu proton-muon mass ratio 8.88024337e+00 2.00000000e-07 CODATA2022 -muP_n proton-neutron mag. mom. ratio -1.45989805e+00 3.40000000e-07 CODATA2022 -mP_n proton-neutron mass ratio 9.98623478e-01 4.90000000e-10 CODATA2022 -RrmsP proton rms charge radius 8.41400000e-14 cm 1.90000000e-16 CODATA2022 -mP_tau proton-tau mass ratio 5.28051000e-01 3.60000000e-05 CODATA2022 -kappa quantum of circulation 3.63694755e+00 cm2 / s 1.10000000e-09 CODATA2022 -2kappa quantum of circulation times 2 7.27389510e+00 cm2 / s 2.20000000e-09 CODATA2022 -Rinf Rydberg constant 1.09737316e+05 1 / cm 2.10000000e-07 CODATA2022 -cRinf_Hz Rydberg constant times c in Hz 3.28984196e+15 1 / s 6.40000000e+03 CODATA2022 -hcRinf_eV Rydberg constant times hc in eV 2.17987236e-11 erg 4.16565925e-23 CODATA2022 -hcRinf_J Rydberg constant times hc in J 2.17987236e-11 erg 4.20000000e-23 CODATA2022 -S0_R_100kPa Sackur-Tetrode constant (1 K, 100 kPa) -1.15170754e+00 4.50000000e-10 CODATA2022 -S0_R_101.325kPa Sackur-Tetrode constant (1 K, 101.325 kPa) -1.16487052e+00 4.50000000e-10 CODATA2022 -c2 second radiation constant 1.43877688e+00 K cm 0.00000000e+00 CODATA2022 -rg_h_shield shielded helion gyromag. ratio 2.03789457e+08 s^-1 T^-1 2.40000000e+00 CODATA2022 -rg_h_shield_2pi shielded helion gyromag. ratio over 2 pi 3.24340997e+01 MHz T^-1 4.30000000e-07 CODATA2022 -muH_shield shielded helion mag. mom. -1.07455309e-26 J T^-1 1.30000000e-34 CODATA2022 -muH_shield_Bhor shielded helion mag. mom. to Bohr magneton ratio -1.15867147e-03 1.40000000e-11 CODATA2022 -muH_shield_Nuc shielded helion mag. mom. to nuclear magneton rati -2.12749772e+00 2.50000000e-08 CODATA2022 -muH_shield_p shielded helion to proton mag. mom. ratio -7.61766562e-01 8.90000000e-09 CODATA2022 -muH_shield_p_shield shielded helion to shielded proton mag. mom. ratio -7.61786131e-01 3.30000000e-09 CODATA2022 -rg_p_shield shielded proton gyromag. ratio 2.67515315e+08 s^-1 T^-1 2.90000000e+00 CODATA2022 -rg_p_shield_2pi shielded proton gyromag. ratio over 2 pi 4.25763851e+01 MHz T^-1 5.30000000e-07 CODATA2022 -muP_shield shielded proton mag. mom. 1.41057056e-26 J T^-1 1.50000000e-34 CODATA2022 -muP_shield_Bhor shielded proton mag. mom. to Bohr magneton ratio 1.52099313e-03 1.70000000e-11 CODATA2022 -muP_shield_Nuc shielded proton mag. mom. to nuclear magneton rati 2.79277560e+00 3.00000000e-08 CODATA2022 -c speed of light in vacuum 2.99792458e+10 cm / s 0.00000000e+00 CODATA2022 -g standard acceleration of gravity 9.80665000e+02 cm / s2 0.00000000e+00 CODATA2022 -atm standard atmosphere 1.01325000e+06 P / s 0.00000000e+00 CODATA2022 -sigma Stefan-Boltzmann constant 5.67037442e-05 g / (s3 K4) 0.00000000e+00 CODATA2022 -lambda_compt_tau tau Compton wavelength 6.97771000e-14 cm 4.70000000e-18 CODATA2022 -lambda_compt_tau_2pi tau Compton wavelength over 2 pi 1.11056000e-14 cm 1.00000000e-18 CODATA2022 -mTau_e tau-electron mass ratio 3.47723000e+03 2.30000000e-01 CODATA2022 -mTau tau mass 3.16754000e-24 g 2.10000000e-28 CODATA2022 -mTau_E tau mass energy equivalent 2.84684000e-03 erg 1.90000000e-07 CODATA2022 -mTau_E_MeV tau mass energy equivalent in MeV 2.84677949e-03 erg 2.56348261e-07 CODATA2022 -mTau_u tau mass in u 3.16754469e-24 g 2.15870079e-28 CODATA2022 -MTau tau molar mass 1.90754000e+00 g / mol 1.30000000e-04 CODATA2022 -mTau_mu tau-muon mass ratio 1.68170000e+01 1.10000000e-03 CODATA2022 -mTau_n tau-neutron mass ratio 1.89115000e+00 1.30000000e-04 CODATA2022 -mTau_p tau-proton mass ratio 1.89376000e+00 1.30000000e-04 CODATA2022 -sigma_T Thomson cross section 6.65245873e-25 cm2 6.00000000e-34 CODATA2022 -muPsi_e triton-electron mag. mom. ratio -1.62051442e-03 2.10000000e-11 CODATA2022 -mPsi_e triton-electron mass ratio 5.49692154e+03 2.70000000e-07 CODATA2022 -g_psi triton g factor 5.95792493e+00 1.20000000e-08 CODATA2022 -muPsi triton mag. mom. 1.50460952e-26 J T^-1 3.00000000e-35 CODATA2022 -muPsi_Bhor triton mag. mom. to Bohr magneton ratio 1.62239367e-03 3.20000000e-12 CODATA2022 -muPsi_Nuc triton mag. mom. to nuclear magneton ratio 2.97896247e+00 5.90000000e-09 CODATA2022 -mPsi triton mass 5.00735674e-24 g 1.50000000e-33 CODATA2022 -mPsi_E triton mass energy equivalent 4.50038781e-03 erg 1.40000000e-12 CODATA2022 -mPsi_E_MeV triton mass energy equivalent in MeV 4.50038781e-03 erg 1.36185014e-12 CODATA2022 -mPsi_u triton mass in u 5.00735674e-24 g 1.99264688e-34 CODATA2022 -MPsi triton molar mass 3.01550072e+00 g / mol 9.20000000e-10 CODATA2022 -muPsi_n triton-neutron mag. mom. ratio -1.55718553e+00 3.70000000e-07 CODATA2022 -muPsi_p triton-proton mag. mom. ratio 1.06663991e+00 1.00000000e-08 CODATA2022 -mPsi_p triton-proton mass ratio 2.99371703e+00 1.50000000e-10 CODATA2022 -u unified atomic mass unit 1.66053907e-24 g 5.00000000e-34 CODATA2022 -R_K von Klitzing constant 2.58128075e+04 ohm 0.00000000e+00 CODATA2022 -theta_W weak mixing angle 2.22900000e-01 3.00000000e-04 CODATA2022 -b_freq Wien frequency displacement law constant 5.87892576e+10 1 / (K s) 0.00000000e+00 CODATA2022 -b_lambda Wien wavelength displacement law constant 2.89777196e-01 K cm 0.00000000e+00 CODATA2022 -auMom_um atomic unit of mom.um 1.99285188e-19 dyn s 2.40000000e-27 CODATA2022 -mE_h electron-helion mass ratio 1.81954307e-04 7.90000000e-15 CODATA2022 -mE_psi electron-triton mass ratio 1.81920006e-04 9.00000000e-15 CODATA2022 -g_h helion g factor -4.25525061e+00 5.00000000e-08 CODATA2022 -muH helion mag. mom. -1.07461753e-26 J T^-1 1.30000000e-34 CODATA2022 -muH_Bhor helion mag. mom. to Bohr magneton ratio -1.15874096e-03 1.40000000e-11 CODATA2022 -muH_Nuc helion mag. mom. to nuclear magneton ratio -2.12762531e+00 2.50000000e-08 CODATA2022 -n0 Loschmidt constant (273.15 K, 100 kPa) 2.65164580e+19 1 / cm3 0.00000000e+00 CODATA2022 -p_um natural unit of mom.um 2.73092449e-17 dyn s 3.40000000e-25 CODATA2022 -p_um_MeV_c natural unit of mom.um in MeV/c 5.10998946e-01 MeV/c 3.10000000e-09 CODATA2022 -mN-mP neutron-proton mass difference 2.30557435e-27 g 8.20000000e-34 CODATA2022 -mN-mP_E neutron-proton mass difference energy equivalent 2.07214689e-06 erg 7.40000000e-13 CODATA2022 -mN-mP_E_MeV neutron-proton mass difference energy equivalent i 2.07214689e-06 erg 7.37001252e-13 CODATA2022 -mN-mP_u neutron-proton mass difference in u 2.30557435e-27 g 8.13664143e-34 CODATA2022 -stp standard-state pressure 1.00000000e+06 P / s 0.00000000e+00 CODATA2022 -mAlpha alpha particle relative atomic mass 4.00150618e+00 6.30000000e-11 CODATA2022 -muB_invm_T Bohr magneton in inverse meter per tesla 4.66864478e+01 m^-1 T^-1 1.40000000e-08 CODATA2022 -kB_invm Boltzmann constant in inverse meter per kelvin 6.95034800e-01 1 / (K cm) 0.00000000e+00 CODATA2022 -ampere-90 conventional value of ampere-90 1.00000009e+00 A 0.00000000e+00 CODATA2022 -coulomb-90 conventional value of coulomb-90 1.00000009e+00 C 0.00000000e+00 CODATA2022 -farad-90 conventional value of farad-90 9.99999982e-01 F 0.00000000e+00 CODATA2022 -henry-90 conventional value of henry-90 1.00000002e+00 H 0.00000000e+00 CODATA2022 -ohm-90 conventional value of ohm-90 1.00000002e+00 ohm 0.00000000e+00 CODATA2022 -volt-90 conventional value of volt-90 1.00000011e+00 V 0.00000000e+00 CODATA2022 -watt-90 conventional value of watt-90 1.00000020e+07 erg / s 0.00000000e+00 CODATA2022 -mD_amu_rel deuteron relative atomic mass 2.01355321e+00 4.00000000e-11 CODATA2022 -rg_e_MHz_T electron gyromag. ratio in MHz/T 2.80249514e+04 MHz T^-1 8.50000000e-06 CODATA2022 -mE_amu_rel electron relative atomic mass 5.48579909e-04 1.60000000e-14 CODATA2022 -e_hbar elementary charge over h-bar 1.51926745e+15 A J^-1 0.00000000e+00 CODATA2022 -mH_amu_rel helion relative atomic mass 3.01493225e+00 9.70000000e-11 CODATA2022 -h_shield_shift helion shielding shift 5.99674300e-05 1.00000000e-10 CODATA2022 -F_hyperfine_Cs-133 hyperfine transition frequency of Cs-133 9.19263177e+09 1 / s 0.00000000e+00 CODATA2022 -aSi_220_ideal lattice spacing of ideal Si (220) 1.92015572e-08 cm 3.20000000e-16 CODATA2022 -eta luminous efficacy 6.83000000e-05 s3 rad2 cd / (g cm2) 0.00000000e+00 CODATA2022 -rg_n_MHz_T neutron gyromag. ratio in MHz/T 2.91646931e+01 MHz T^-1 6.90000000e-06 CODATA2022 -mN_amu_rel neutron relative atomic mass 1.00866492e+00 4.90000000e-10 CODATA2022 -mu_N_invm nuclear magneton in inverse meter per tesla 2.54262341e-02 m^-1 T^-1 7.80000000e-12 CODATA2022 -h_eV_Hz Planck constant in eV/Hz 6.62607015e-27 erg s 0.00000000e+00 CODATA2022 -rg_p_MHz_T proton gyromag. ratio in MHz/T 4.25774785e+01 MHz T^-1 1.80000000e-08 CODATA2022 -mP_amu_rel proton relative atomic mass 1.00727647e+00 5.30000000e-11 CODATA2022 -lambda_compt_bar reduced Compton wavelength 3.86159268e-11 cm 1.20000000e-20 CODATA2022 -lambda_compt_mu_bar reduced muon Compton wavelength 1.86759431e-13 cm 4.20000000e-21 CODATA2022 -lambda_compt_n_bar reduced neutron Compton wavelength 2.10019416e-14 cm 1.20000000e-23 CODATA2022 -hbar reduced Planck constant 1.05457182e-27 erg s 0.00000000e+00 CODATA2022 -hbar_eV_s reduced Planck constant in eV s 1.05457182e-27 erg s 0.00000000e+00 CODATA2022 -chbar_MeV reduced Planck constant times c in MeV fm 3.16152677e-17 cm erg 0.00000000e+00 CODATA2022 -lambda_compt_p_bar reduced proton Compton wavelength 2.10308910e-14 cm 6.40000000e-24 CODATA2022 -lambda_compt_tau_bar reduced tau Compton wavelength 1.11053800e-14 cm 7.50000000e-19 CODATA2022 -rg_h_shield_MHz_T shielded helion gyromag. ratio in MHz/T 3.24340994e+01 MHz T^-1 3.80000000e-07 CODATA2022 -rg_p_shield_MHz_T shielded proton gyromag. ratio in MHz/T 4.25763847e+01 MHz T^-1 4.60000000e-07 CODATA2022 -d_shield-p_shield_HD shielding difference of d and p in HD 2.02000000e-08 2.00000000e-11 CODATA2022 -t_shield-p_shield_HT shielding difference of t and p in HT 2.41400000e-08 2.00000000e-11 CODATA2022 -tau_E tau energy equivalent 2.84684357e-03 erg 1.92261196e-07 CODATA2022 -psi_amu_rel triton relative atomic mass 3.01550072e+00 1.20000000e-10 CODATA2022 -muPsi_p triton to proton mag. mom. ratio 1.06663992e+00 2.10000000e-09 CODATA2022 -epsilon0 vacuum electric permittivity 8.85418781e-12 F m^-1 1.30000000e-21 CODATA2022 -mu0 vacuum mag. permeability 1.25663706e-06 N A^-2 1.90000000e-16 CODATA2022 -mWZ W to Z mass ratio 8.81530000e-01 1.70000000e-04 CODATA2022 -au Astronomical Unit 1.49597871e+13 cm 0.00000000e+00 IAU 2012 Resolution B2 -pc Parsec 3.08567758e+18 cm 0.00000000e+00 Derived from au + IAU 2015 Resolution B 2 note [4] -kpc Kiloparsec 3.08567758e+21 cm 0.00000000e+00 Derived from au + IAU 2015 Resolution B 2 note [4] -L_bol0 Luminosity for absolute bolometric magnitude 0 3.01280000e+35 erg / s 0.00000000e+00 IAU 2015 Resolution B 2 -L_sun Nominal solar luminosity 3.82800000e+33 erg / s 0.00000000e+00 IAU 2015 Resolution B 3 -GM_sun Nominal solar mass parameter 1.32712440e+26 cm3 / s2 0.00000000e+00 IAU 2015 Resolution B 3 -M_sun Solar mass 1.98840987e+33 g 4.46880543e+28 IAU 2015 Resolution B 3 + CODATA 2018 -R_sun Nominal solar radius 6.95700000e+10 cm 0.00000000e+00 IAU 2015 Resolution B 3 -GM_jup Nominal Jupiter mass parameter 1.26686530e+23 cm3 / s2 0.00000000e+00 IAU 2015 Resolution B 3 -M_jup Jupiter mass 1.89812460e+30 g 4.26589589e+25 IAU 2015 Resolution B 3 + CODATA 2018 -R_jup Nominal Jupiter equatorial radius 7.14920000e+09 cm 0.00000000e+00 IAU 2015 Resolution B 3 -GM_earth Nominal Earth mass parameter 3.98600400e+20 cm3 / s2 0.00000000e+00 IAU 2015 Resolution B 3 -M_earth Earth mass 5.97216787e+27 g 1.34220095e+23 IAU 2015 Resolution B 3 + CODATA 2018 -R_earth Nominal Earth equatorial radius 6.37810000e+08 cm 0.00000000e+00 IAU 2015 Resolution B 3 diff --git a/assets/eos/helm_table.dat b/assets/dynamic/eos/helm_table.dat similarity index 100% rename from assets/eos/helm_table.dat rename to assets/dynamic/eos/helm_table.dat diff --git a/assets/dynamic/index.yaml b/assets/dynamic/index.yaml new file mode 100644 index 0000000..a37aa49 --- /dev/null +++ b/assets/dynamic/index.yaml @@ -0,0 +1,4 @@ +eos: + helm: "eos/helm_table.dat" +mesh: + sphere: "mesh/sphere.msh" \ No newline at end of file diff --git a/src/resources/mesh/sphere.msh b/assets/dynamic/mesh/sphere.msh similarity index 100% rename from src/resources/mesh/sphere.msh rename to assets/dynamic/mesh/sphere.msh diff --git a/src/resources/const/const.dat b/assets/static/const/const.dat similarity index 100% rename from src/resources/const/const.dat rename to assets/static/const/const.dat diff --git a/src/resources/const/format.sh b/assets/static/const/format.sh similarity index 100% rename from src/resources/const/format.sh rename to assets/static/const/format.sh diff --git a/src/resources/const/meson.build b/assets/static/const/meson.build similarity index 100% rename from src/resources/const/meson.build rename to assets/static/const/meson.build diff --git a/src/resources/meson.build b/assets/static/meson.build similarity index 100% rename from src/resources/meson.build rename to assets/static/meson.build diff --git a/meson.build b/meson.build index f5476a9..bd29da1 100644 --- a/meson.build +++ b/meson.build @@ -2,11 +2,28 @@ project('4DSSE', 'cpp', version: '0.0.1a', default_options: ['cpp_std=c++23'], m # Add default visibility for all C++ targets add_project_arguments('-fvisibility=default', language: 'cpp') +# Determine the mode +mode = 1 +if get_option('user_mode') + mode = 0 +endif + +# Define DATA_DIR based on mode +if mode == 1 + data_dir = meson.project_source_root() + '/assets/dynamic' +else + data_dir = get_option('prefix') + '/' + get_option('datadir') + '/4DSSE' +endif + +# Pass the DATA_DIR definition to the compiler +add_project_arguments('-DDATA_DIR=' + data_dir, language : 'cpp') # Build external dependencies first so that all the embedded resources are available to the other targets subdir('build-config') subdir('subprojects/PicoSHA2') +subdir('assets/static') + # Build the main project subdir('src') if get_option('build_tests') diff --git a/meson_options.txt b/meson_options.txt index c3b5afd..56baeee 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1 +1,2 @@ option('build_tests', type: 'boolean', value: true, description: 'Build tests') +option('user_mode', type: 'boolean', value: false, description: 'Enable user mode (set mode = 0)') diff --git a/src/config/private/config.cpp b/src/config/private/config.cpp index ffce7a3..76e7d43 100644 --- a/src/config/private/config.cpp +++ b/src/config/private/config.cpp @@ -46,6 +46,7 @@ bool Config::loadConfig(const std::string& configFile) { std::cerr << "Error: " << e.what() << std::endl; return false; } + m_loaded = true; return true; } @@ -60,3 +61,45 @@ void Config::addToCache(const std::string &key, const YAML::Node &node) { void Config::registerUnknownKey(const std::string &key) { unknownKeys.push_back(key); } + +bool Config::has(const std::string &key) { + if (!m_loaded) { + throw std::runtime_error("Error! Config file not loaded"); + } + if (isKeyInCache(key)) { return true; } + + YAML::Node node = YAML::Clone(yamlRoot); + std::istringstream keyStream(key); + std::string subKey; + while (std::getline(keyStream, subKey, ':')) { + if (!node[subKey]) { + registerUnknownKey(key); + return false; + } + node = node[subKey]; // go deeper + } + + // Key exists and is of the requested type + addToCache(key, node); + return true; +} + +void recurse_keys(const YAML::Node& node, std::vector& keyList, const std::string& path = "") { + if (node.IsMap()) { + for (const auto& it : node) { + std::string key = it.first.as(); + std::string new_path = path.empty() ? key : path + ":" + key; + recurse_keys(it.second, keyList, new_path); + } + } else { + keyList.push_back(path); + } + +} + +std::vector Config::keys() const { + std::vector keyList; + YAML::Node node = YAML::Clone(yamlRoot); + recurse_keys(node, keyList); + return keyList; +} \ No newline at end of file diff --git a/src/config/public/config.h b/src/config/public/config.h index e8b96a0..be33163 100644 --- a/src/config/public/config.h +++ b/src/config/public/config.h @@ -23,14 +23,18 @@ #include #include -#include #include #include #include #include +#include +// Required for YAML parsing #include "yaml-cpp/yaml.h" +// -- Forward Def of Resource manager to let it act as a friend of Config -- +class ResourceManager; + /** * @class Config * @brief Singleton class to manage configuration settings loaded from a YAML file. @@ -94,6 +98,21 @@ private: */ void registerUnknownKey(const std::string &key); + bool m_loaded = false; + + // Only friends can access get without a default value + template + T get(const std::string &key) { + if (!m_loaded) { + throw std::runtime_error("Error! Config file not loaded"); + } + if (has(key)) { + return getFromCache(key, T()); + } else { + throw std::runtime_error("Error! Key not found in config file"); + } + } + public: /** * @brief Get the singleton instance of the Config class. @@ -136,6 +155,9 @@ public: */ template T get(const std::string &key, T defaultValue) { + if (!m_loaded) { + throw std::runtime_error("Error! Config file not loaded"); + } // --- Check if the key has already been checked for existence if (std::find(unknownKeys.begin(), unknownKeys.end(), key) != unknownKeys.end()) { return defaultValue; // If the key has already been added to the unknown cache do not traverse the YAML tree or hit the cache @@ -171,6 +193,19 @@ public: } } + /** + * @brief Check if the key exists in the given config file + * @param key Key to check; + * @return boolean true or false + */ + bool has(const std::string &key); + + /** + * @brief Get all keys defined in the configuration file. + * @return Vector of all keys in the configuration file. + */ + std::vector keys() const; + /** * @brief Print the configuration file path and the YAML root node. * @param os Output stream. @@ -178,6 +213,10 @@ public: * @return Output stream. */ friend std::ostream& operator<<(std::ostream& os, const Config& config) { + if (!config.m_loaded) { + os << "Config file not loaded" << std::endl; + return os; + } if (!config.debug) { os << "Config file: " << config.configFilePath << std::endl; } else{ @@ -190,6 +229,8 @@ public: // Setup gTest class as a friend friend class configTestPrivateAccessor; + // -- Resource Manager is a friend of config so it can create a seperate instance + friend class ResourceManager; }; #endif \ No newline at end of file diff --git a/src/eos/meson.build b/src/eos/meson.build index ca3e18f..f9979b4 100644 --- a/src/eos/meson.build +++ b/src/eos/meson.build @@ -1,23 +1,34 @@ # Define the library eos_sources = files( 'private/helm.cpp', + 'private/eosIO.cpp' ) eos_headers = files( - 'public/helm.h' + 'public/helm.h', + 'public/eosIO.h' ) +dependencies = [ + const_dep, + quill_dep, + probe_dep, + config_dep, + mfem_dep, + macros_dep, +] # Define the libconst library so it can be linked against by other parts of the build system libeos = static_library('eos', eos_sources, include_directories: include_directories('public'), cpp_args: ['-fvisibility=default'], - dependencies: [const_dep, quill_dep, probe_dep, config_dep, mfem_dep], + dependencies: dependencies, install : true) eos_dep = declare_dependency( include_directories: include_directories('public'), link_with: libeos, + dependencies: dependencies ) # Make headers accessible install_headers(eos_headers, subdir : '4DSSE/eos') \ No newline at end of file diff --git a/src/eos/private/eosIO.cpp b/src/eos/private/eosIO.cpp new file mode 100644 index 0000000..ba3e471 --- /dev/null +++ b/src/eos/private/eosIO.cpp @@ -0,0 +1,36 @@ +#include + +#include "eosIO.h" +#include "helm.h" +#include "debug.h" + +EosIO::EosIO(const std::string filename) : m_filename(filename) { + load(); +} + +std::string EosIO::getFormat() const { + return m_format; +} + + +EOSTable& EosIO::getTable() { + return m_table; +} + +void EosIO::load() { + // Load the EOS table from the file + // For now, just set the format to HELM + + m_format = "helm"; + if (m_format == "helm") { + loadHelm(); + } +} + +void EosIO::loadHelm() { + // Load the HELM table from the file + auto helmTabptr = helmholtz::read_helm_table(m_filename); + m_table = std::move(helmTabptr); + m_loaded = true; +} + diff --git a/src/eos/private/helm.cpp b/src/eos/private/helm.cpp index 90c482e..ed60a3e 100644 --- a/src/eos/private/helm.cpp +++ b/src/eos/private/helm.cpp @@ -24,6 +24,7 @@ #include #include +#include #include #include #include @@ -121,21 +122,22 @@ namespace helmholtz { } // this function reads in the HELM table and stores in the above arrays - HELMTable read_helm_table(const std::string filename) { + std::unique_ptr read_helm_table(const std::string filename) { Config& config = Config::getInstance(); std::string logFile = config.get("EOS:Helm:LogFile", "log"); Probe::LogManager& logManager = Probe::LogManager::getInstance(); quill::Logger* logger = logManager.getLogger(logFile); LOG_INFO(logger, "read_helm_table : Reading HELM table from file {}", filename); - HELMTable table; + // Make a unique pointer to the HELMTable + std::unique_ptr table = std::make_unique(); string data; int i, j; //set T and Rho (d) arrays - for (j=0; jjmax; j++) { table->t[j] = pow(10, tlo + tstp*j); } - for (i=0; iimax; i++) { table->d[i] = pow(10, dlo + dstp*i); } ifstream helm_table(filename); if (!helm_table) { @@ -144,83 +146,83 @@ namespace helmholtz { throw std::runtime_error("Error (" + std::to_string(errorCode) + ") opening file " + filename); } //read the Helmholtz free energy and its derivatives - for (j=0; jjmax; j++) { + for (i=0; iimax; i++){ getline(helm_table, data); stringstream id(data); - id >> table.f[i][j]; - id >> table.fd[i][j]; - id >> table.ft[i][j]; - id >> table.fdd[i][j]; - id >> table.ftt[i][j]; - id >> table.fdt[i][j]; - id >> table.fddt[i][j]; - id >> table.fdtt[i][j]; - id >> table.fddtt[i][j]; + id >> table->f[i][j]; + id >> table->fd[i][j]; + id >> table->ft[i][j]; + id >> table->fdd[i][j]; + id >> table->ftt[i][j]; + id >> table->fdt[i][j]; + id >> table->fddt[i][j]; + id >> table->fdtt[i][j]; + id >> table->fddtt[i][j]; } } //read the pressure derivative with density - for (j=0; jjmax; j++) { + for (i=0; iimax; i++){ getline(helm_table, data); stringstream id(data); - id >> table.dpdf[i][j]; - id >> table.dpdfd[i][j]; - id >> table.dpdft[i][j]; - id >> table.dpdfdt[i][j]; + id >> table->dpdf[i][j]; + id >> table->dpdfd[i][j]; + id >> table->dpdft[i][j]; + id >> table->dpdfdt[i][j]; } } //read the electron chemical potential - for (j=0; jjmax; j++) { + for (i=0; iimax; i++){ getline(helm_table, data); stringstream id(data); - id >> table.ef[i][j]; - id >> table.efd[i][j]; - id >> table.eft[i][j]; - id >> table.efdt[i][j]; + id >> table->ef[i][j]; + id >> table->efd[i][j]; + id >> table->eft[i][j]; + id >> table->efdt[i][j]; } } //read the number density - for (j=0; jjmax; j++) { + for (i=0; iimax; i++){ getline(helm_table, data); stringstream id(data); - id >> table.xf[i][j]; - id >> table.xfd[i][j]; - id >> table.xft[i][j]; - id >> table.xfdt[i][j]; + id >> table->xf[i][j]; + id >> table->xfd[i][j]; + id >> table->xft[i][j]; + id >> table->xfdt[i][j]; } } helm_table.close(); //done reading // construct the temperature and density deltas and their inverses - for (j=0; jjmax; j++) { + double dth = table->t[j+1] - table->t[j]; double dt2 = dth * dth; double dti = 1.0/dth; double dt2i = 1.0/dt2; - table.dt_sav[j] = dth; - table.dt2_sav[j] = dt2; - table.dti_sav[j] = dti; - table.dt2i_sav[j] = dt2i; + table->dt_sav[j] = dth; + table->dt2_sav[j] = dt2; + table->dti_sav[j] = dti; + table->dt2i_sav[j] = dt2i; } - for (i=0; iimax; i++) { + double dd = table->d[i+1] - table->d[i]; double dd2 = dd * dd; double ddi = 1.0/dd; - table.dd_sav[i] = dd; - table.dd2_sav[i] = dd2; - table.ddi_sav[i] = ddi; + table->dd_sav[i] = dd; + table->dd2_sav[i] = dd2; + table->ddi_sav[i] = ddi; } - table.loaded = true; + table->loaded = true; return table; } diff --git a/src/eos/public/eosIO.h b/src/eos/public/eosIO.h new file mode 100644 index 0000000..aab0c59 --- /dev/null +++ b/src/eos/public/eosIO.h @@ -0,0 +1,70 @@ +#ifndef EOSIO_H +#define EOSIO_H + +#include +#include +#include + +// EOS table format includes +#include "helm.h" + +using EOSTable = std::variant< + std::unique_ptr + >; + +/** + * @class EosIO + * @brief Handles the input/output operations for EOS tables. + * + * The EosIO class is responsible for loading and managing EOS tables from files. + * It supports different formats, currently only HELM format. + * + * Example usage: + * @code + * EosIO eosIO("path/to/file"); + * std::string format = eosIO.getFormat(); + * EOSTable& table = eosIO.getTable(); + * @endcode + */ +class EosIO { +private: + std::string m_filename; ///< The filename of the EOS table. + bool m_loaded = false; ///< Flag indicating if the table is loaded. + std::string m_format; ///< The format of the EOS table. + EOSTable m_table; ///< The EOS table data. + + /** + * @brief Loads the EOS table from the file. + */ + void load(); + + /** + * @brief Loads the HELM format EOS table. + */ + void loadHelm(); +public: + /** + * @brief Constructs an EosIO object with the given filename. + * @param filename The filename of the EOS table. + */ + EosIO(const std::string filename); + + /** + * @brief Default destructor. + */ + ~EosIO() = default; + + /** + * @brief Gets the format of the EOS table. + * @return The format of the EOS table as a string. + */ + std::string getFormat() const; + + /** + * @brief Gets the EOS table. + * @return A reference to the EOS table. + */ + EOSTable& getTable(); +}; + +#endif // EOSIO_H \ No newline at end of file diff --git a/src/eos/public/helm.h b/src/eos/public/helm.h index bdbfdad..64e7a8a 100644 --- a/src/eos/public/helm.h +++ b/src/eos/public/helm.h @@ -35,6 +35,8 @@ #include #include +#include "debug.h" + /** * @brief 2D array template alias. * @tparam T Type of the array elements. @@ -139,6 +141,118 @@ namespace helmholtz heap_deallocate_contiguous_2D_memory(xfdt); } + // // Delete copy constructor and copy assignment operator to prevent accidental shallow copies + // HELMTable(const HELMTable&) = delete; + // HELMTable& operator=(const HELMTable&) = delete; + + // // Move constructor + // HELMTable(HELMTable&& other) noexcept + // : loaded(other.loaded), + // f(other.f), fd(other.fd), ft(other.ft), fdd(other.fdd), ftt(other.ftt), fdt(other.fdt), + // fddt(other.fddt), fdtt(other.fdtt), fddtt(other.fddtt), + // dpdf(other.dpdf), dpdfd(other.dpdfd), dpdft(other.dpdft), dpdfdt(other.dpdfdt), + // ef(other.ef), efd(other.efd), eft(other.eft), efdt(other.efdt), + // xf(other.xf), xfd(other.xfd), xft(other.xft), xfdt(other.xfdt) + // { + // other.f = nullptr; + // other.fd = nullptr; + // other.ft = nullptr; + // other.fdd = nullptr; + // other.ftt = nullptr; + // other.fdt = nullptr; + // other.fddt = nullptr; + // other.fdtt = nullptr; + // other.fddtt = nullptr; + // other.dpdf = nullptr; + // other.dpdfd = nullptr; + // other.dpdft = nullptr; + // other.dpdfdt = nullptr; + // other.ef = nullptr; + // other.efd = nullptr; + // other.eft = nullptr; + // other.efdt = nullptr; + // other.xf = nullptr; + // other.xfd = nullptr; + // other.xft = nullptr; + // other.xfdt = nullptr; + // } + + // // Move assignment operator + // HELMTable& operator=(HELMTable&& other) noexcept { + // if (this != &other) { + // // Deallocate current memory + // heap_deallocate_contiguous_2D_memory(f); + // heap_deallocate_contiguous_2D_memory(fd); + // heap_deallocate_contiguous_2D_memory(ft); + // heap_deallocate_contiguous_2D_memory(fdd); + // heap_deallocate_contiguous_2D_memory(ftt); + // heap_deallocate_contiguous_2D_memory(fdt); + // heap_deallocate_contiguous_2D_memory(fddt); + // heap_deallocate_contiguous_2D_memory(fdtt); + // heap_deallocate_contiguous_2D_memory(fddtt); + // heap_deallocate_contiguous_2D_memory(dpdf); + // heap_deallocate_contiguous_2D_memory(dpdfd); + // heap_deallocate_contiguous_2D_memory(dpdft); + // heap_deallocate_contiguous_2D_memory(dpdfdt); + // heap_deallocate_contiguous_2D_memory(ef); + // heap_deallocate_contiguous_2D_memory(efd); + // heap_deallocate_contiguous_2D_memory(eft); + // heap_deallocate_contiguous_2D_memory(efdt); + // heap_deallocate_contiguous_2D_memory(xf); + // heap_deallocate_contiguous_2D_memory(xfd); + // heap_deallocate_contiguous_2D_memory(xft); + // heap_deallocate_contiguous_2D_memory(xfdt); + + // // Transfer ownership of resources + // loaded = other.loaded; + // f = other.f; + // fd = other.fd; + // ft = other.ft; + // fdd = other.fdd; + // ftt = other.ftt; + // fdt = other.fdt; + // fddt = other.fddt; + // fdtt = other.fdtt; + // fddtt = other.fddtt; + // dpdf = other.dpdf; + // dpdfd = other.dpdfd; + // dpdft = other.dpdft; + // dpdfdt = other.dpdfdt; + // ef = other.ef; + // efd = other.efd; + // eft = other.eft; + // efdt = other.efdt; + // xf = other.xf; + // xfd = other.xfd; + // xft = other.xft; + // xfdt = other.xfdt; + + // // Null out the other object's pointers + // other.f = nullptr; + // other.fd = nullptr; + // other.ft = nullptr; + // other.fdd = nullptr; + // other.ftt = nullptr; + // other.fdt = nullptr; + // other.fddt = nullptr; + // other.fdtt = nullptr; + // other.fddtt = nullptr; + // other.dpdf = nullptr; + // other.dpdfd = nullptr; + // other.dpdft = nullptr; + // other.dpdfdt = nullptr; + // other.ef = nullptr; + // other.efd = nullptr; + // other.eft = nullptr; + // other.efdt = nullptr; + // other.xf = nullptr; + // other.xfd = nullptr; + // other.xft = nullptr; + // other.xfdt = nullptr; + // } + // return *this; + // } + friend std::ostream& operator<<(std::ostream& os, const helmholtz::HELMTable& table) { if (!table.loaded) { os << "HELMTable not loaded\n"; @@ -371,7 +485,7 @@ namespace helmholtz * @param filename Path to the file containing the table. * @return HELMTable structure containing the table data. */ - HELMTable read_helm_table(const std::string filename); + std::unique_ptr read_helm_table(const std::string filename); /** * @brief Calculate the Helmholtz EOS components. diff --git a/src/meshIO/meson.build b/src/meshIO/meson.build index 1ea870a..a684138 100644 --- a/src/meshIO/meson.build +++ b/src/meshIO/meson.build @@ -6,14 +6,22 @@ meshIO_sources = files( meshIO_headers = files( 'public/meshIO.h' ) - +dependencies = [ + mfem_dep +] # Define the libmeshIO library so it can be linked against by other parts of the build system libmeshIO = static_library('meshIO', meshIO_sources, include_directories: include_directories('public'), cpp_args: ['-fvisibility=default'], - dependencies: [mfem_dep], + dependencies: dependencies, install : true) +meshio_dep = declare_dependency( + include_directories: include_directories('public'), + link_with: libmeshIO, + dependencies: dependencies +) + # Make headers accessible install_headers(meshIO_headers, subdir : '4DSSE/meshIO') \ No newline at end of file diff --git a/src/meshIO/private/meshIO.cpp b/src/meshIO/private/meshIO.cpp index 01619bb..a894a14 100644 --- a/src/meshIO/private/meshIO.cpp +++ b/src/meshIO/private/meshIO.cpp @@ -26,7 +26,7 @@ #include "meshIO.h" -MeshIO::MeshIO(const std::string &mesh_file) +MeshIO::MeshIO(const std::string mesh_file) { mesh_file_ = mesh_file; std::ifstream mesh_stream(mesh_file); diff --git a/src/meshIO/public/meshIO.h b/src/meshIO/public/meshIO.h index aad8bf7..1a2c4db 100644 --- a/src/meshIO/public/meshIO.h +++ b/src/meshIO/public/meshIO.h @@ -39,7 +39,7 @@ public: * @brief Constructor that initializes the MeshIO object with a mesh file. * @param mesh_file The name of the mesh file. */ - MeshIO(const std::string &mesh_file); + MeshIO(const std::string mesh_file); /** * @brief Destructor for the MeshIO class. diff --git a/src/meson.build b/src/meson.build index 3547118..d2d2399 100644 --- a/src/meson.build +++ b/src/meson.build @@ -1,11 +1,18 @@ -# Build resources first so that all the embedded resources are available to the other targets -subdir('resources') +# Build the main source code in the correct order -# Build the main source code -subdir('dobj') -subdir('const') -subdir('opatIO') -subdir('meshIO') +# Utility Libraries +subdir('misc') subdir('config') subdir('probe') -subdir('eos') \ No newline at end of file +subdir('const') +subdir('dobj') + +# Asset Libraries +subdir('eos') +subdir('opatIO') +subdir('meshIO') + +# Resouce Manager Libraries +subdir('resource') + +# Physics Libraries \ No newline at end of file diff --git a/src/misc/macros/debug.h b/src/misc/macros/debug.h new file mode 100644 index 0000000..284268d --- /dev/null +++ b/src/misc/macros/debug.h @@ -0,0 +1,36 @@ +/** + * @file debug.h + * @brief Defines a macro for triggering a breakpoint in different compilers and platforms. + * + * This file provides a macro `BREAKPOINT()` that triggers a breakpoint + * in the debugger, depending on the compiler and platform being used. + * + * Usage: + * @code + * BREAKPOINT(); // Triggers a breakpoint in the debugger + * @endcode + */ + +#ifdef __GNUC__ // GCC and Clang + /** + * @brief Triggers a breakpoint in GCC and Clang. + */ + #define BREAKPOINT() __builtin_debugtrap() +#elif defined(_MSC_VER) // MSVC + /** + * @brief Triggers a breakpoint in MSVC. + */ + #define BREAKPOINT() __debugbreak() +#elif defined(__APPLE__) && defined(__MACH__) // macOS with Clang and LLDB + #include + /** + * @brief Triggers a breakpoint in macOS with Clang and LLDB. + */ + #define BREAKPOINT() raise(SIGTRAP) +#else + #include + /** + * @brief Triggers a breakpoint in other platforms. + */ + #define BREAKPOINT() std::raise(SIGTRAP) +#endif diff --git a/src/misc/macros/meson.build b/src/misc/macros/meson.build new file mode 100644 index 0000000..f91a3b9 --- /dev/null +++ b/src/misc/macros/meson.build @@ -0,0 +1,21 @@ +# *********************************************************************** +# +# Copyright (C) 2025 -- The 4D-STAR Collaboration +# File Author: Emily Boudreaux +# Last Modified: March 19, 2025 +# +# 4DSSE is free software; you can use it and/or modify +# it under the terms and restrictions the GNU General Library Public +# License version 3 (GPLv3) as published by the Free Software Foundation. +# +# 4DSSE is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the GNU Library General Public License for more details. +# +# You should have received a copy of the GNU Library General Public License +# along with this software; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# *********************************************************************** # +macros_dep = declare_dependency(include_directories: include_directories('.')) diff --git a/src/misc/macros/warning_control.h b/src/misc/macros/warning_control.h new file mode 100644 index 0000000..23bf5a8 --- /dev/null +++ b/src/misc/macros/warning_control.h @@ -0,0 +1,16 @@ +#ifndef WARNING_CONTROL_H +#define WARNING_CONTROL_H + +#if defined(__GNUC__) || defined(__clang__) + #define DEPRECATION_WARNING_OFF _Pragma("GCC diagnostic push") \ + _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") + #define DEPRECATION_WARNING_ON _Pragma("GCC diagnostic pop") +#elif defined(_MSC_VER) + #define DEPRECATION_WARNING_OFF __pragma(warning(push)) __pragma(warning(disable: 4996)) + #define DEPRECATION_WARNING_ON __pragma(warning(pop)) +#else + #define DEPRECATION_WARNING_OFF + #define DEPRECATION_WARNING_ON +#endif + +#endif // WARNING_CONTROL_H diff --git a/src/misc/meson.build b/src/misc/meson.build new file mode 100644 index 0000000..196a8e4 --- /dev/null +++ b/src/misc/meson.build @@ -0,0 +1,2 @@ +# IMPORTANT: DO NOT MAKE MISC DEPEND ON ANY OTHER MODULE AS IT IS THE FIRST MODULE TO BE BUILT +subdir('macros') diff --git a/src/opatIO/meson.build b/src/opatIO/meson.build index c2229bc..238ee6f 100644 --- a/src/opatIO/meson.build +++ b/src/opatIO/meson.build @@ -16,5 +16,9 @@ libopatIO = library('opatIO', install : true, ) +opatio_dep = declare_dependency( + include_directories: include_directories('public'), + link_with: libopatIO, +) # Make headers accessible install_headers(opatIO_headers, subdir : '4DSSE/opatIO') \ No newline at end of file diff --git a/src/opatIO/private/opatIO.cpp b/src/opatIO/private/opatIO.cpp index 43960f5..bdbf45b 100644 --- a/src/opatIO/private/opatIO.cpp +++ b/src/opatIO/private/opatIO.cpp @@ -56,7 +56,7 @@ T swap_bytes(T value) { // Constructor OpatIO::OpatIO() {} -OpatIO::OpatIO(std::string filename) : filename(filename) { +OpatIO::OpatIO(const std::string filename) : filename(filename) { load(); } diff --git a/src/opatIO/public/opatIO.h b/src/opatIO/public/opatIO.h index f822420..49b6bcf 100644 --- a/src/opatIO/public/opatIO.h +++ b/src/opatIO/public/opatIO.h @@ -21,7 +21,6 @@ #ifndef OPATIO_H #define OPATIO_H -#include #include #include #include diff --git a/src/resource/meson.build b/src/resource/meson.build new file mode 100644 index 0000000..bc32862 --- /dev/null +++ b/src/resource/meson.build @@ -0,0 +1,40 @@ +# Define the library +resourceManager_sources = files( + 'private/resourceManager.cpp', + 'private/resourceManagerTypes.cpp' +) + +resourceManager_headers = files( + 'public/resourceManager.h', + 'public/resourceManagerTypes.h' +) + +dependencies = [ + yaml_cpp_dep, + opatio_dep, + eos_dep, + quill_dep, + config_dep, + probe_dep, + mfem_dep, + macros_dep, + meshio_dep +] + +libResourceHeader_dep = declare_dependency(include_directories: include_directories('public')) +# Define the libresourceManager library so it can be linked against by other parts of the build system +libresourceManager = static_library('resourceManager', + resourceManager_sources, + include_directories: include_directories('public'), + cpp_args: ['-fvisibility=default'], + dependencies: dependencies, + install : true) + +resourceManager_dep = declare_dependency( + include_directories: include_directories('public'), + link_with: libresourceManager, + dependencies: dependencies +) + +# Make headers accessible +install_headers(resourceManager_headers, subdir : '4DSSE/resource') \ No newline at end of file diff --git a/src/resource/private/resourceManager.cpp b/src/resource/private/resourceManager.cpp new file mode 100644 index 0000000..ebbe62d --- /dev/null +++ b/src/resource/private/resourceManager.cpp @@ -0,0 +1,68 @@ +#include +#include +#include +#include + +#include "quill/LogMacros.h" + +#include "resourceManager.h" +#include "resourceManagerTypes.h" +#include "debug.h" + +#include "config.h" + +#define STRINGIFY(x) #x +#define TOSTRING(x) STRINGIFY(x) + +ResourceManager::ResourceManager() { + std::string defaultDataDir = TOSTRING(DATA_DIR); + m_dataDir = m_config.get("Data:Dir", defaultDataDir); + // -- Get the index file path using filesytem to make it a system safe path + std::string indexFilePath = m_dataDir + "/index.yaml"; + std::filesystem::path indexFile(indexFilePath); + + m_resourceConfig.loadConfig(indexFile.string()); + std::vector assets = m_resourceConfig.keys(); + for (auto key : assets ) { + load(key); + } +} + + +std::vector ResourceManager::getAvaliableResources() { + std::vector resources; + resources = m_resourceConfig.keys(); + return resources; +} + +const Resource& ResourceManager::getResource(const std::string &name) const { + auto it = m_resources.find(name); + if (it != m_resources.end()) { + return it->second; + } + throw std::runtime_error("Resource " + name + " not found"); +} + + +bool ResourceManager::loadResource(std::string& name) { + return load(name); +} + +bool ResourceManager::load(const std::string& name) { + const std::string resourcePath = m_dataDir + "/" + m_resourceConfig.get(name); + std::filesystem::path resourceFile(resourcePath); + if (!std::filesystem::exists(resourceFile)) { + LOG_ERROR(m_logger, "Resource file not found: {}", resourceFile.string()); + return false; + } + LOG_INFO(m_logger, "Loading resource: {}", resourceFile.string()); + if (m_resources.find(name) != m_resources.end()) { + LOG_INFO(m_logger, "Resource already loaded: {}", name); + return true; + } + Resource resource = createResource(name, resourcePath); + m_resources[name] = std::move(resource); + // -- Check if the resource is already in the map + return true; +} + diff --git a/src/resource/private/resourceManagerTypes.cpp b/src/resource/private/resourceManagerTypes.cpp new file mode 100644 index 0000000..98593bf --- /dev/null +++ b/src/resource/private/resourceManagerTypes.cpp @@ -0,0 +1,41 @@ +#include + +#include "resourceManagerTypes.h" +#include "opatIO.h" +#include "meshIO.h" +#include "eosIO.h" + +#include "debug.h" + +std::string getFirstSegment(const std::string& input) { + size_t pos = input.find(':'); + if (pos == std::string::npos) { + // No colon found, return the entire string + return input; + } else { + // Return substring from start to the position of the first colon + return input.substr(0, pos); + } +} + + +Resource createResource(const std::string& type, const std::string& path) { + static const std::unordered_map> factoryMap = { + {"opac", [](const std::string& p) { return Resource( + std::make_unique(p)); + }}, + {"mesh", [](const std::string& p) { return Resource( + std::make_unique(p)); + }}, + {"eos", [](const std::string& p) { return Resource( + std::make_unique(p)); + }} + // Add more mappings as needed + }; + auto it = factoryMap.find(getFirstSegment(type)); + if (it != factoryMap.end()) { + return it->second(path); + } else { + throw std::invalid_argument("Unknown resource type: " + type); + } +} \ No newline at end of file diff --git a/src/resource/public/resourceManager.h b/src/resource/public/resourceManager.h new file mode 100644 index 0000000..6c34635 --- /dev/null +++ b/src/resource/public/resourceManager.h @@ -0,0 +1,115 @@ +#ifndef RESOURCE_MANAGER_H +#define RESOURCE_MANAGER_H + +#include +#include +#include +#include + +#include "resourceManagerTypes.h" +#include "config.h" +#include "probe.h" +#include "quill/LogMacros.h" + +/** + * @class ResourceManager + * @brief Manages resources within the application. + * + * The ResourceManager class is responsible for loading, storing, and providing access to resources. + * It follows the Singleton design pattern to ensure only one instance of the manager exists. + */ +class ResourceManager { +private: + /** + * @brief Private constructor to prevent instantiation. + */ + ResourceManager(); + + /** + * @brief Deleted copy constructor to prevent copying. + */ + ResourceManager(const ResourceManager&) = delete; + + /** + * @brief Deleted assignment operator to prevent assignment. + */ + ResourceManager& operator=(const ResourceManager&) = delete; + + Config& m_config = Config::getInstance(); + Probe::LogManager& m_logManager = Probe::LogManager::getInstance(); + quill::Logger* m_logger = m_logManager.getLogger("log"); + + Config m_resourceConfig; + std::string m_dataDir; + std::unordered_map m_resources; + + /** + * @brief Loads a resource by name. + * @param name The name of the resource to load. + * @return True if the resource was loaded successfully, false otherwise. + */ + bool load(const std::string& name); + +public: + /** + * @brief Gets the singleton instance of the ResourceManager. + * @return The singleton instance of the ResourceManager. + */ + static ResourceManager& getInstance() { + static ResourceManager instance; + return instance; + } + + /** + * @brief Gets a list of available resources. + * @return A vector of strings containing the names of available resources. + * + * Example usage: + * @code + * ResourceManager& manager = ResourceManager::getInstance(); + * std::vector resources = manager.getAvaliableResources(); + * @endcode + */ + std::vector getAvaliableResources(); + + /** + * @brief Gets a resource by name. + * @param name The name of the resource to retrieve. + * @return A constant reference to the requested resource. + * @throws std::runtime_error if the resource is not found. + * + * Example usage: + * @code + * ResourceManager& manager = ResourceManager::getInstance(); + * const Resource& resource = manager.getResource("exampleResource"); + * @endcode + */ + const Resource& getResource(const std::string &name) const; + + /** + * @brief Loads a resource by name. + * @param name The name of the resource to load. + * @return True if the resource was loaded successfully, false otherwise. + * + * Example usage: + * @code + * ResourceManager& manager = ResourceManager::getInstance(); + * bool success = manager.loadResource("exampleResource"); + * @endcode + */ + bool loadResource(std::string& name); + + /** + * @brief Loads all resources. + * @return An unordered map with resource names as keys and load success as values. + * + * Example usage: + * @code + * ResourceManager& manager = ResourceManager::getInstance(); + * std::unordered_map results = manager.loadAllResources(); + * @endcode + */ + std::unordered_map loadAllResources(); +}; + +#endif // RESOURCE_MANAGER_H \ No newline at end of file diff --git a/src/resource/public/resourceManagerTypes.h b/src/resource/public/resourceManagerTypes.h new file mode 100644 index 0000000..7700e03 --- /dev/null +++ b/src/resource/public/resourceManagerTypes.h @@ -0,0 +1,71 @@ +#ifndef RESOURCE_MANAGER_TYPES_H +#define RESOURCE_MANAGER_TYPES_H + +#include +#include + +#include "opatIO.h" +#include "helm.h" +#include "meshIO.h" +#include "eosIO.h" + +/** + * @file resourceManagerTypes.h + * @brief Defines types and functions for managing resources. + * + * This file provides type definitions and functions for handling different + * types of resources in a unified manner. + */ + +// -- Valid resource types +/** + * @brief A variant type that can hold different types of resources. + * + * The Resource type is a std::variant that can hold a unique pointer to + * an OpatIO, MeshIO, or EosIO object. + * + * Example usage: + * @code + * Resource resource = std::make_unique(...); + * @endcode + */ +using Resource = std::variant< + std::unique_ptr, + std::unique_ptr, + std::unique_ptr>; + +/** + * @brief Extracts the first segment of a given string. + * + * This function takes a string input and returns the first segment + * separated by a delimiter (default is '/'). + * + * @param input The input string to be processed. + * @return The first segment of the input string. + * + * Example usage: + * @code + * std::string segment = getFirstSegment("path/to/resource"); + * // segment == "path" + * @endcode + */ +std::string getFirstSegment(const std::string& input); + +/** + * @brief Creates a resource based on the specified type and path. + * + * This function creates a resource object based on the provided type + * and initializes it using the given path. + * + * @param type The type of the resource to be created (e.g., "OpatIO", "MeshIO", "EosIO"). + * @param path The path to initialize the resource with. + * @return A Resource object initialized with the specified type and path. + * + * Example usage: + * @code + * Resource resource = createResource("OpatIO", "path/to/opat"); + * @endcode + */ +Resource createResource(const std::string& type, const std::string& path); + +#endif // RESOURCE_MANAGER_TYPES_H \ No newline at end of file diff --git a/tests/eos/eosTest.cpp b/tests/eos/eosTest.cpp index 2ff0be7..b1a352b 100644 --- a/tests/eos/eosTest.cpp +++ b/tests/eos/eosTest.cpp @@ -1,11 +1,12 @@ #include #include +#include #include -#include -#include #include #include "helm.h" +#include "resourceManager.h" +#include "config.h" /** * @file constTest.cpp @@ -17,21 +18,20 @@ */ class eosTest : public ::testing::Test {}; -std::string HELM_FILENAME = std::string(getenv("MESON_SOURCE_ROOT")) + "/assets/eos/helm_table.dat"; +std::string TEST_CONFIG = std::string(getenv("MESON_SOURCE_ROOT")) + "/tests/testsConfig.yaml"; + /** * @test Verify default constructor initializes correctly. */ -TEST_F(eosTest, constructor) { - using namespace helmholtz; - EXPECT_NO_THROW(HELMTable table = read_helm_table(HELM_FILENAME)); -} TEST_F(eosTest, read_helm_table) { - using namespace helmholtz; - HELMTable table = read_helm_table(HELM_FILENAME); - // Capture the << operator output as a string + Config::getInstance().loadConfig(TEST_CONFIG); + ResourceManager& rm = ResourceManager::getInstance(); + auto& eos = std::get>(rm.getResource("eos:helm")); + auto& table = eos->getTable(); + auto& helmTable = *std::get>(table); std::stringstream ss; - ss << table; + ss << helmTable; EXPECT_EQ(ss.str(), "HELMTable Data:\n imax: 541, jmax: 201\n Temperature Range: [1000, 1e+13]\n Density Range: [1e-12, 1e+15]\n"); } @@ -58,28 +58,31 @@ TEST_F(eosTest, get_helm_EOS) { eos1.abar = 1.0/asum; eos1.zbar = eos1.abar*zsum; - HELMTable table = read_helm_table(HELM_FILENAME); - EOS eos = get_helm_EOS(eos1, table); - // std::cout << eos << std::endl; + ResourceManager& rm = ResourceManager::getInstance(); + auto& eos = std::get>(rm.getResource("eos:helm")); + auto& table = eos->getTable(); + auto& helmTable = *std::get>(table); + EOS helmEos = get_helm_EOS(eos1, helmTable); + + const double absErr = 1e-12; //Check composition info - EXPECT_DOUBLE_EQ( eos.ye, 8.75e-01); + EXPECT_NEAR( helmEos.ye, 8.75e-01, absErr); //Check E, P, S and derivatives of each wrt Rho and T - EXPECT_DOUBLE_EQ( eos.etaele, 2.3043348231021554e+01); - EXPECT_DOUBLE_EQ( eos.etot, 1.1586558190936826e+17); - EXPECT_DOUBLE_EQ(eos.denerdd, 6.1893000468285858e+10); - EXPECT_DOUBLE_EQ(eos.denerdt, 1.2129708972542575e+08); - EXPECT_DOUBLE_EQ( eos.ptot, 6.9610135220017030e+22); - EXPECT_DOUBLE_EQ(eos.dpresdd, 1.0296440482849070e+17); - EXPECT_DOUBLE_EQ(eos.dpresdt, 7.7171347517311625e+13); - EXPECT_DOUBLE_EQ( eos.stot, 6.0647461970567346e+08); - EXPECT_DOUBLE_EQ(eos.dentrdd,-7.7171347517311645e+01); - EXPECT_DOUBLE_EQ(eos.dentrdt, 1.2129708972542577e+00); + EXPECT_NEAR( helmEos.etaele, 2.3043348231021554e+01, absErr); + EXPECT_NEAR( helmEos.etot, 1.1586558190936826e+17, 1e3); + EXPECT_NEAR(helmEos.denerdd, 6.1893000468285858e+10, 1e-2); + EXPECT_NEAR(helmEos.denerdt, 1.2129708972542575e+08, 1e-7); + EXPECT_NEAR( helmEos.ptot, 6.9610135220017030e+22, 1e10); + EXPECT_NEAR(helmEos.dpresdd, 1.0296440482849070e+17, 1e3); + EXPECT_NEAR(helmEos.dpresdt, 7.7171347517311625e+13, 1.0); + EXPECT_NEAR( helmEos.stot, 6.0647461970567346e+08, 1e-7); + EXPECT_NEAR(helmEos.dentrdd,-7.7171347517311645e+01, absErr); + EXPECT_NEAR(helmEos.dentrdt, 1.2129708972542577e+00, absErr); - const double abs_err = 1.0e-12; // Maxwell relations, should always be zero - EXPECT_NEAR( eos.dse, 0, abs_err); - EXPECT_NEAR( eos.dpe, 0, abs_err); - EXPECT_NEAR( eos.dsp, 0, abs_err); + EXPECT_NEAR( helmEos.dse, 0, absErr); + EXPECT_NEAR( helmEos.dpe, 0, absErr); + EXPECT_NEAR( helmEos.dsp, 0, absErr); } diff --git a/tests/eos/meson.build b/tests/eos/meson.build index 05d2f83..d8154e6 100644 --- a/tests/eos/meson.build +++ b/tests/eos/meson.build @@ -11,7 +11,7 @@ foreach test_file : test_sources test_exe = executable( exe_name, test_file, - dependencies: [gtest_dep, eos_dep, gtest_main], + dependencies: [gtest_dep, eos_dep, gtest_main, resourceManager_dep, config_dep], install_rpath: '@loader_path/../../src' # Ensure runtime library path resolves correctly ) diff --git a/tests/meshIO/meshIOTest.cpp b/tests/meshIO/meshIOTest.cpp index 07eec4f..23f845a 100644 --- a/tests/meshIO/meshIOTest.cpp +++ b/tests/meshIO/meshIOTest.cpp @@ -1,6 +1,5 @@ #include #include "meshIO.h" -#include #include #include "mfem.hpp" diff --git a/tests/meson.build b/tests/meson.build index e744e20..0d89e07 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -11,6 +11,7 @@ subdir('meshIO') subdir('config') subdir('probe') subdir('eos') +subdir('resource') # Subdirectories for sandbox tests subdir('dobj_sandbox') diff --git a/tests/resource/meson.build b/tests/resource/meson.build new file mode 100644 index 0000000..75571d8 --- /dev/null +++ b/tests/resource/meson.build @@ -0,0 +1,24 @@ +# Test files for const +test_sources = [ + 'resourceManagerTest.cpp', +] + +foreach test_file : test_sources + exe_name = test_file.split('.')[0] + message('Building test: ' + exe_name) + + # Create an executable target for each test + test_exe = executable( + exe_name, + test_file, + dependencies: [gtest_dep, resourceManager_dep, gtest_main, macros_dep], + include_directories: include_directories('../../src/resource/public'), + install_rpath: '@loader_path/../../src' # Ensure runtime library path resolves correctly + ) + + # Add the executable as a test + test( + exe_name, + test_exe, + env: ['MESON_SOURCE_ROOT=' + meson.project_source_root(), 'MESON_BUILD_ROOT=' + meson.project_build_root()]) +endforeach diff --git a/tests/resource/resourceManagerTest.cpp b/tests/resource/resourceManagerTest.cpp new file mode 100644 index 0000000..d0264d7 --- /dev/null +++ b/tests/resource/resourceManagerTest.cpp @@ -0,0 +1,61 @@ +#include +#include "resourceManager.h" +#include "config.h" +#include "eosIO.h" +#include "helm.h" +#include "resourceManagerTypes.h" + +#include +#include +#include +#include + +#include "debug.h" + +/** + * @file configTest.cpp + * @brief Unit tests for the resourceManager class. + */ + + +std::string TEST_CONFIG = std::string(getenv("MESON_SOURCE_ROOT")) + "/tests/testsConfig.yaml"; +/** + * @brief Test suite for the resourceManager class. + */ +class resourceManagerTest : public ::testing::Test {}; + +/** + * @brief Test the constructor of the resourceManager class. + */ +TEST_F(resourceManagerTest, constructor) { + Config::getInstance().loadConfig(TEST_CONFIG); + EXPECT_NO_THROW(ResourceManager::getInstance()); +} + +TEST_F(resourceManagerTest, getAvaliableResources) { + Config::getInstance().loadConfig(TEST_CONFIG); + ResourceManager& rm = ResourceManager::getInstance(); + std::vector resources = rm.getAvaliableResources(); + std::set expected = {"eos:helm", "mesh:sphere"}; + std::set actual(resources.begin(), resources.end()); + EXPECT_EQ(expected, actual); +} + +TEST_F(resourceManagerTest, getResource) { + Config::getInstance().loadConfig(TEST_CONFIG); + ResourceManager& rm = ResourceManager::getInstance(); + std::string name = "eos:helm"; + const Resource &r = rm.getResource(name); + // BREAKPOINT(); + const auto &eos = std::get>(r); + EXPECT_EQ("helm", eos->getFormat()); + EOSTable &table = eos->getTable(); + + // -- Extract the Helm table from the EOSTable + helmholtz::HELMTable &helmTable = *std::get>(table); + EXPECT_DOUBLE_EQ(helmTable.f[0][0], -1692098915534.8142); + + EXPECT_THROW(rm.getResource("opac:GS98:high:doesNotExist"), std::runtime_error); +} + + diff --git a/tests/testsConfig.yaml b/tests/testsConfig.yaml new file mode 100644 index 0000000..e82bfc2 --- /dev/null +++ b/tests/testsConfig.yaml @@ -0,0 +1,38 @@ +Debug: true + +Probe: + GLVis: + Visualization: true + # Host: "10.8.0.14" + Host: "localhost" + Port: 19916 + DefaultKeyset: "iimmMMc" + GetRaySolution: + MakeDir: true +Poly: + Solver: + ViewInitialGuess: true + GMRES: + MaxIter: 5000 + RelTol: 1.0e-8 + AbsTol: 1.0e-10 + PrintLevel: 0 + Newton: + MaxIter: 200 + RelTol: 1.0e-8 + AbsTol: 1.0e-10 + PrintLevel: 1 + Newton: + Output: + 1D: + Save: true + Path: "output/Poly/1D/poly.csv" + RaySamples: 1000 + RayCoLatitude: 0.0 + RayLongitude: 0.0 + +# THESE ARE ONLY USED BY THE TEST SUITE AND NOT THE MAIN CODE +# ANY OPTIONS NEEDED FOR THE TEST SUITE SHOULD BE PLACED HERE +Tests: + Poly: + Index: 1.1 \ No newline at end of file