pax_global_header00006660000000000000000000000064114222732510014511gustar00rootroot0000000000000052 comment=697347b9737f6e1f10669a2c91ad3dba6a78382b cba-0.3.6/000077500000000000000000000000001142227325100122445ustar00rootroot00000000000000cba-0.3.6/Makefile000066400000000000000000000005211142227325100137020ustar00rootroot00000000000000#top level makefile for cba, cba-gtk CBADIR=$(CURDIR)/src GTKDIR=$(CURDIR)/src/gui all: ( cd $(CBADIR); $(MAKE) ) ( cd $(GTKDIR); $(MAKE) ) clean: ( cd $(CBADIR); $(MAKE) clean ) ( cd $(GTKDIR); $(MAKE) clean ) install: ( cd $(CBADIR); $(MAKE) $(DESTDIR) install ) ( cd $(GTKDIR); $(MAKE) $(DESTDIR) install ) cba-0.3.6/licence.txt000066400000000000000000001045131142227325100144130ustar00rootroot00000000000000 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 . cba-0.3.6/materials.xml000066400000000000000000000142051142227325100147510ustar00rootroot00000000000000 kN cm S235 21000 8100 0.0000785 0.000012 24 13.9 S275 21000 8100 0.0000785 0.000012 27.5 15.9 S355 21000 8100 0.0000785 0.000012 36 20.8 S450 21000 8100 0.0000785 0.000012 44 25.4 Fe360 21000 8100 0.0000785 0.000012 23.5 13.6 Fe430 21000 8100 0.0000785 0.000012 27.5 15.9 Fe510 21000 8100 0.0000785 0.000012 35.5 20.5 C16 800 50 0.000006 0.000005 1.6 1 0.05 1.7 0.22 0.18 C24 1100 69 0.000006 0.000005 2.4 1.4 0.05 2.1 0.25 0.25 C30 1200 75 0.000006 0.0000055 3 1.8 0.06 2.3 0.27 0.3 GL24h 1160 72 0.000005 0.000005 2.4 1.65 0.04 2.4 0.27 0.27 GL28h 1260 78 0.000005 0.000005 2.8 1.95 0.045 2.65 0.3 0.32 GL32h 1370 85 0.000005 0.000005 3.2 2.25 0.05 2.9 0.33 0.38 GL36h 1470 91 0.000005 0.000005 3.6 2.6 0.06 3.1 0.36 0.43 C12/15 2180 908 0.000025 0.00001 1.2 0.16 0.17 C16/20 2340 975 0.000025 0.00001 1.6 0.19 0.2 C20/25 2490 1038 0.000025 0.00001 2 0.22 0.23 C25/30 2670 1113 0.000025 0.00001 2.5 0.26 0.27 C30/37 2830 1179 0.000025 0.00001 3 0.29 0.3 C35/45 2990 1246 0.000025 0.00001 3.5 0.32 0.34 C40/50 3140 1308 0.000025 0.00001 4 0.35 0.37 C45/55 3280 1367 0.000025 0.00001 4.5 0.38 0.4 C50/60 3430 1429 0.000025 0.00001 5 0.41 0.43 C55/67 3570 1488 0.000025 0.00001 5.5 0.42 0.44 C60/75 3700 1542 0.000025 0.00001 6 0.44 0.45 C70/85 3970 1654 0.000025 0.00001 7 0.46 0.46 C80/95 4230 1763 0.000025 0.00001 8 0.48 0.48 C90/105 4480 1867 0.000025 0.00001 9 0.5 0.49 C100/115 4730 1971 0.000025 0.00001 10 0.52 0.49 cba-0.3.6/readme.txt000066400000000000000000000111011142227325100142340ustar00rootroot00000000000000cba 0.3.6 07/2010 G.P.L. -------------------------------------- calculates member forces and support reactions of a continuous beam files: cba [cba.exe] binary cba-gtk [wxCBA.exe] binary (gui) materials.xml material database (gui) sections.xml section database (gui) readme.txt this file licence.txt g.p.l. /src source code /src/gui source code (gui) usage: ./cba [cba.exe] -i inputfile [-o outputfile -p plotfile] -i inputfile textfile, has to have the following format: SPANS lengths of spans INERTIA moments of inertia per span (optional, default is 1.0) ELASTICITY modulus of elasticity for the beam (optional, default is 1.0) CONSTRAINTS constraints def/rot per support (optional, default is -1 0) def = support displacement rot = support rotation -1 supported 0 not supported >0 spring LOAD load matrix: span type perm live start len span = number of span to be loaded load type = 1 - uniformly distributed load 2 - point load 3 - partial udl 4 - moment load 5 - trapezoidal load (c=0 triangular) 6 - partial triangular load (c<0 ascending, c>0 descending) perm = value of permanent load (can be zero) live = value of live load (can be zero) start = start for load type 3,5-6, or point for load type 2/4 len = length for load type 3,5-6 (can be negative for lt6) FACTORS load factors perm/live (optional, default is 1.0 1.0 [1.0 0.0]) you can also set the load factors for disburdening loads, this would be e.g. 1.35 1.5 1.35 0.0 -o outputfile (optional) - result file, contains the max/min results per span -p plotfile (optional) - result file, contains 7 results along the beam for graphical output: x, Mmax, Mmin, Vmax, Vmin (with load factors) dmax, dmin (characteristic) you can use this data with your favourite spreadsheet application or a graph-plotter like gnuplot, this would be for "-p results.dat" and the moments: plot "results.dat" using 1:($2*(-1)) title 'Mmax' with lines, \ "results.dat" using 1:($3*(-1)) title 'Mmin' with lines example: continuous steel beam (hea200), 2 spans (5.8m, 4.2m) permanent load 10.0 kN/m, live load 5.0 kN/m first create a textfile example.txt: SPANS 5.8 4.2 INERTIA 3.69e-5 3.69e-5 ELASTICITY 2.1e8 CONSTRAINTS -1 0 -1 0 -1 0 LOAD 1 1 10.0 5.0 0 0 LOAD 2 1 10.0 5.0 0 0 FACTORS 1.35 1.5 then run: cba -i example.txt -o results.txt -p results.dat 2 files should have been created: results.txt with max/min results (move on with the design) results.dat with results along the beam, which form the graph usage (gui): linux: ./cba-gtk (wxWidgets-2.8 runtime libraries have to be installed) win32: wxCBA.exe (there is no installer, youŽll only need this file and the databases) the small user interface is powered by wxwidgets library and covers almost all of the features of cbeam_class, use the commandline tool if you want different moments of inertia, higher precision or batch processing on the first run a settings file (settings.xml) will be created in ~./cba [win32: settings.xml will be created in the folder you run wxCBA.exe in] you can copy the database files (sections.xml, materials.xml) to this folder, or store them elsewhere and change the location in settings compiling: cmd: g++ cba_main.cpp cbeam_class.cpp -o cba[.exe] gui: should be easily compiled using an ide that includes wxwidgets library (e.g. code::blocks, wxDev-C++) there are makefiles provided in /src for linux, try make (you will need wxwidgets-dev libraries for the gui) before you type make install, check if the paths in the makefile fit your needs credits: Colin Caprani (www.colincaprani.com) - well done sourcecode cba.m (octave/mathcad - gpl) wxWidgets - great framework changelog: 0.3.1 09/2009 released at sourceforge 0.3.2 09/2009 added output of plot data (gui) added user dialog for creating a new beam (gui) 0.3.3 11/2009 added small graphical output/ printout (gui) removed solve/save button and plot data (gui) 0.3.4 12/2009 added system graph, loadtypes, restraints and load factors (gui) fixed 2 bugs in cbeam_class 0.3.5 02/2010 added material/section database (gui) 0.3.6 07/2010 added two more loadtypes fixed bug in cbeam_class (vertical nodal loads for lt3/4) comments: feel free to write your comments/suggestions to pierrot cba-0.3.6/sections.xml000066400000000000000000003425221142227325100146250ustar00rootroot00000000000000 cm 100 21.2 349.2 72.8 133.8 26.8 9.6 10 0.5 0.8 1.2 16 4.4 41.5 20.6 5.23 2581 2.66 1.14 1.54 120 25.3 606.2 106.3 230.9 38.5 11.4 12 0.5 0.8 1.2 19.2 5.3 59.7 29.4 5.99 6472 3.21 1.12 1.53 140 31.4 1033.1 155.4 389.3 55.6 13.3 14 0.55 0.85 1.2 23.8 6.85 86.7 42.4 8.12 15064 3.75 1.12 1.53 160 38.8 1673 220.1 615.6 76.9 15.2 16 0.6 0.9 1.5 28.8 8.58 122.6 58.8 12.19 31410 4.25 1.11 1.53 180 45.3 2510.3 293.6 924.6 102.7 17.1 18 0.6 0.95 1.5 34.2 9.69 162.4 78.2 14.79 60211 4.82 1.11 1.52 200 53.8 3692.2 388.6 1335.5 133.6 19 20 0.65 1 1.8 40 11.7 214.7 101.9 20.98 108000 5.31 1.11 1.53 220 64.3 5409.7 515.2 1954.6 177.7 21 22 0.7 1.1 1.8 48.4 13.93 284.2 135.3 28.45 193266 5.88 1.1 1.52 240 76.8 7763.2 675.1 2768.8 230.7 23 24 0.75 1.2 2.1 57.6 16.35 372.3 175.8 41.55 328486 6.4 1.1 1.52 260 86.8 10454.9 836.4 3667.6 282.1 25 26 0.75 1.25 2.4 65 17.81 459.9 215.1 52.37 516352 6.91 1.1 1.52 280 97.3 13673.3 1012.8 4762.6 340.2 27 28 0.8 1.3 2.4 72.8 20.56 556.1 259.1 62.09 785367 7.46 1.1 1.52 300 112.5 18263.5 1259.6 6309.6 420.6 29 30 0.85 1.4 2.7 84 23.46 691.6 320.6 85.17 1199770 7.97 1.1 1.52 320 124.4 22928.6 1479.3 6985.2 465.7 31 30 0.9 1.55 2.7 93 26.51 814 354.9 107.97 1512360 7.99 1.1 1.52 340 133.5 27693.1 1678.4 7436 495.7 33 30 0.95 1.65 2.7 99 29.78 925.2 378 127.19 1824360 7.98 1.1 1.52 360 142.8 33089.8 1890.8 7886.8 525.8 35 30 1 1.75 2.7 105 33.25 1044.2 401.1 148.82 2176580 7.97 1.1 1.53 400 159 45069.4 2311.2 8563.8 570.9 39 30 1.1 1.9 2.7 114 40.81 1280.9 436.4 189.03 2942080 7.94 1.11 1.53 450 178 63721.6 2896.4 9465.3 631 44 30 1.15 2.1 2.7 126 48.19 1607.9 482.8 243.75 4147630 7.92 1.11 1.53 500 197.5 86974.7 3550 10367 691.1 49 30 1.2 2.3 2.7 138 56.04 1974.4 529.3 309.27 5643050 7.91 1.11 1.53 550 211.8 111932 4145.6 10819 721.3 54 30 1.25 2.4 2.7 144 64.5 2310.9 553.5 351.53 7188910 7.86 1.11 1.53 600 226.5 141208 4786.7 11271.3 751.4 59 30 1.3 2.5 2.7 150 73.45 2675.2 577.8 397.8 8978200 7.81 1.12 1.54 650 241.6 175178 5474.3 11723.9 781.6 64 30 1.35 2.6 2.7 156 82.89 3068.1 602.4 448.29 11027100 7.77 1.12 1.54 700 260.5 215301 6240.6 12178.8 811.9 69 30 1.45 2.7 2.7 162 96.14 3515.9 628.4 513.89 13351900 7.7 1.13 1.55 800 285.8 303443 7682.1 12638.7 842.6 79 30 1.5 2.8 3 168 114.3 4349.7 656.1 596.87 18290300 7.57 1.13 1.56 900 320.5 422075 9484.8 13547.5 903.2 89 30 1.6 3 3 180 137.6 5405.5 707.2 736.76 24961500 7.49 1.14 1.57 1000 346.8 553846 11188.8 14004.5 933.6 99 30 1.65 3.1 3 186 158.24 6412.2 734.9 822.4 32073900 7.4 1.15 1.57 100 26 449.5 89.9 167.3 33.5 10 10 0.6 1 1.2 20 5.4 52.1 25.7 9.24 3375 2.68 1.16 1.54 120 34 864.4 144.1 317.5 52.9 12 12 0.65 1.1 1.2 26.4 7.09 82.6 40.5 13.84 9410 3.24 1.15 1.53 140 43 1509.2 215.6 549.7 78.5 14 14 0.7 1.2 1.2 33.6 8.96 122.7 59.9 20.05 22479 3.79 1.14 1.53 160 54.3 2492 311.5 889.2 111.2 16 16 0.8 1.3 1.5 41.6 11.76 177 85 31.23 47943 4.31 1.14 1.53 180 65.3 3831.1 425.7 1362.8 151.4 18 18 0.85 1.4 1.5 50.4 14.11 240.7 115.5 42.16 93746 4.86 1.13 1.53 200 78.1 5696.2 569.6 2003.4 200.3 20 20 0.9 1.5 1.8 60 16.65 321.3 152.9 59.28 171125 5.39 1.13 1.53 220 91 8091 735.5 2843.3 258.5 22 22 0.95 1.6 1.8 70.4 19.38 413.5 196.9 76.56 295418 5.94 1.12 1.52 240 106 11259.3 938.3 3922.7 326.9 24 24 1 1.7 2.1 81.6 22.3 526.6 249.2 102.68 486946 6.47 1.12 1.52 260 118.4 14919.4 1147.6 5134.5 395 26 26 1 1.75 2.4 91 24.25 641.5 301.1 123.77 753651 6.99 1.12 1.52 280 131.4 19270.3 1376.4 6594.5 471 28 28 1.05 1.8 2.4 100.8 27.51 767.2 358.8 143.71 1130150 7.53 1.11 1.52 300 149.1 25165.7 1677.7 8562.8 570.9 30 30 1.1 1.9 2.7 114 30.91 934.3 435.1 185.04 1687790 8.05 1.11 1.52 320 161.3 30823.5 1926.5 9238.8 615.9 32 30 1.15 2.05 2.7 123 34.44 1074.6 469.5 225.06 2068710 8.06 1.12 1.52 340 170.9 36656.4 2156.3 9689.9 646 34 30 1.2 2.15 2.7 129 38.22 1204.1 492.9 257.2 2453630 8.04 1.12 1.53 360 180.6 43193.4 2399.6 10141.2 676.1 36 30 1.25 2.25 2.7 135 42.19 1341.5 516.2 292.45 2883250 8.03 1.12 1.53 400 197.8 57680.5 2884 10819 721.3 40 30 1.35 2.4 2.7 144 50.76 1615.9 552 355.74 3817150 7.99 1.12 1.53 450 218 79887.5 3550.6 11721.3 781.4 45 30 1.4 2.6 2.7 156 59.36 1991.2 598.8 440.47 5258450 7.96 1.12 1.53 500 238.6 107176 4287 12623.9 841.6 50 30 1.45 2.8 2.7 168 68.44 2407.3 645.8 538.44 7017700 7.94 1.12 1.53 550 254.1 136691 4970.6 13076.9 871.8 55 30 1.5 2.9 2.7 174 78.15 2795.3 670.6 600.33 8855760 7.89 1.12 1.54 600 270 171041 5701.4 13530.2 902 60 30 1.55 3 2.7 180 88.35 3212.6 695.5 667.17 10965400 7.84 1.13 1.54 650 286.3 210616 6480.5 13984 932.3 65 30 1.6 3.1 2.7 186 99.04 3659.9 720.7 739.2 13362700 7.79 1.13 1.55 700 306.4 256888 7339.7 14440.8 962.7 70 30 1.7 3.2 2.7 192 113.56 4163.6 747.5 830.93 16064100 7.72 1.13 1.55 800 334.2 359083 8977.1 14903.7 993.6 80 30 1.75 3.3 3 198 134.23 5114.4 776.6 946.02 21840200 7.6 1.14 1.56 900 371.3 494065 10979.2 15815.9 1054.4 90 30 1.85 3.5 3 210 160.03 6292 829.2 1137.46 29461400 7.52 1.15 1.57 1000 400 644748 12895 16275.8 1085.1 100 30 1.9 3.6 3 216 183.16 7427.6 858.1 1254.42 37636500 7.42 1.15 1.58 100 53.2 1142.6 190.4 399.2 75.3 12 10.6 1.2 2 1.2 42.4 12 117.9 58.2 68.21 9925 2.89 1.24 1.54 120 66.4 2017.6 288.2 702.8 111.6 14 12.6 1.25 2.1 1.2 52.92 14.88 175.3 85.8 91.66 24786 3.44 1.22 1.54 140 80.6 3291.4 411.4 1144.3 156.8 16 14.6 1.3 2.2 1.2 64.24 17.94 246.9 120.3 120.01 54329 3.99 1.2 1.53 160 97.1 5098.3 566.5 1758.8 211.9 18 16.6 1.4 2.3 1.5 76.36 21.98 337.3 162.7 162.43 108054 4.52 1.19 1.54 180 113.3 7483.1 748.3 2580.1 277.4 20 18.6 1.45 2.4 1.5 89.28 25.52 441.7 212.6 203.27 199326 5.07 1.18 1.53 200 131.3 10641.9 967.4 3651.2 354.5 22 20.6 1.5 2.5 1.8 103 29.25 567.6 271.6 259.4 346258 5.6 1.17 1.53 220 149.4 14604.8 1217.1 5012 443.5 24 22.6 1.55 2.6 1.8 117.52 33.17 709.7 339.3 315.26 572684 6.16 1.17 1.53 240 199.6 24289.5 1799.2 8152.6 657.5 27 24.8 1.8 3.2 2.1 158.72 42.84 1058.5 503 627.89 1151990 6.77 1.18 1.53 260 219.6 31306.8 2159.1 10448.6 779.7 29 26.8 1.8 3.25 2.4 174.2 46.35 1261.8 596.2 719.01 1728350 7.31 1.17 1.53 280 240.2 39547.3 2551.4 13162.8 914.1 31 28.8 1.85 3.3 2.4 190.08 51.25 1482.8 698.3 807.28 2520230 7.85 1.16 1.53 300 303.1 59201 3482.4 19403.1 1251.8 34 31 2.1 3.9 2.7 241.8 63.21 2038.8 956.6 1407.57 4386030 8.47 1.17 1.53 320 312 68134.8 3795.8 19709.3 1275.7 35.9 30.9 2.1 4 2.7 247.2 66.99 2217.5 975.4 1500.58 5003860 8.43 1.17 1.53 340 315.8 76371.6 4051.5 19710.7 1275.8 37.7 30.9 2.1 4 2.7 247.2 70.77 2358.8 976.4 1506.14 5584500 8.41 1.16 1.53 360 318.8 84867 4297.1 19521.8 1267.6 39.5 30.8 2.1 4 2.7 246.4 74.55 2494.7 971.2 1507.43 6137020 8.35 1.16 1.53 400 325.8 104119 4820.3 19335.5 1259.6 43.2 30.7 2.1 4 2.7 245.6 82.32 2785.3 967.1 1514.59 7410300 8.28 1.16 1.54 450 335.4 131484 5501.4 19339.1 1259.9 47.8 30.7 2.1 4 2.7 245.6 91.98 3165.5 969.6 1528.79 9251500 8.22 1.15 1.54 500 344.3 161929 6180.5 19154.7 1251.9 52.4 30.6 2.1 4 2.7 244.8 101.64 3547.1 966 1538.72 11186700 8.14 1.15 1.54 550 354.4 197984 6922.5 19158.4 1252.2 57.2 30.6 2.1 4 2.7 244.8 111.72 3966.3 968.7 1553.54 13515600 8.08 1.15 1.55 600 363.7 237447 7659.6 18975.5 1244.3 62 30.5 2.1 4 2.7 244 121.8 4386 965.2 1564.09 15907600 8 1.15 1.55 650 373.7 281668 8433.2 18979.2 1244.5 66.8 30.5 2.1 4 2.7 244 131.88 4828.5 967.8 1578.91 18649500 7.95 1.15 1.56 700 383 329278 9197.7 18797.4 1236.7 71.6 30.4 2.1 4 2.7 243.2 141.96 5269.5 964.4 1589.46 21397500 7.87 1.15 1.56 800 404.3 442598 10874.6 18627.4 1229.5 81.4 30.3 2.1 4 3 242.4 162.54 6243.9 965.2 1645.64 27775300 7.72 1.15 1.57 900 423.6 570434 12537 18451.8 1222 91 30.2 2.1 4 3 241.6 182.7 7220.9 964.4 1671.01 34746300 7.59 1.15 1.58 1000 444.2 722299 14331.3 18459.3 1222.5 100.8 30.2 2.1 4 3 241.6 203.28 8284 969.8 1701.26 43015000 7.5 1.16 1.59 80 7.64 80.1 20 8.5 3.7 8 4.6 0.38 0.52 0.5 4.78 2.84 11.6 2.9 0.69 118 1.18 1.16 1.58 100 10.3 171 34.2 15.9 5.8 10 5.5 0.41 0.57 0.7 6.27 3.87 19.7 4.6 1.2 351 1.39 1.15 1.58 120 13.2 317.8 53 27.7 8.6 12 6.4 0.44 0.63 0.7 8.06 5 30.4 6.8 1.73 890 1.63 1.15 1.57 140 16.4 541.2 77.3 44.9 12.3 14 7.3 0.47 0.69 0.7 10.07 6.26 44.2 9.6 2.44 1981 1.86 1.14 1.56 160 20.1 869.3 108.7 68.3 16.7 16 8.2 0.5 0.74 0.9 12.14 7.63 61.9 13 3.6 3959 2.08 1.14 1.57 180 23.9 1317 146.3 100.9 22.2 18 9.1 0.53 0.8 0.9 14.56 9.12 83.2 17.3 4.79 7431 2.31 1.14 1.56 200 28.5 1943.2 194.3 142.4 28.5 20 10 0.56 0.85 1.2 17 10.72 110.3 22.3 6.98 12988 2.52 1.14 1.57 220 33.4 2771.8 252 204.9 37.3 22 11 0.59 0.92 1.2 20.24 12.44 142.7 29.1 9.06 22672 2.79 1.13 1.56 240 39.1 3891.6 324.3 283.6 47.3 24 12 0.62 0.98 1.5 23.52 14.27 183.3 37 12.87 37391 3.02 1.13 1.56 270 45.9 5789.8 428.9 419.9 62.2 27 13.5 0.66 1.02 1.5 27.54 17.15 242 48.5 15.94 70578 3.41 1.13 1.56 300 53.8 8356.1 557.1 603.8 80.5 30 15 0.71 1.07 1.5 32.1 20.54 314.2 62.6 20.11 125934 3.79 1.13 1.56 330 62.6 11766.9 713.1 788.1 98.5 33 16 0.75 1.15 1.8 36.8 23.89 402.2 76.8 28.14 199097 4.01 1.13 1.56 360 72.7 16265.6 903.6 1043.5 122.8 36 17 0.8 1.27 1.8 43.18 27.78 509.6 95.5 37.32 313580 4.28 1.13 1.56 400 84.5 23128.3 1156.4 1317.8 146.4 40 18 0.86 1.35 2.1 48.6 33.24 653.6 114.5 51.07 490048 4.49 1.13 1.56 450 98.8 33742.9 1499.7 1675.9 176.4 45 19 0.94 1.46 2.1 55.48 40.93 850.9 138.2 66.87 791005 4.72 1.13 1.57 500 115.5 48198.5 1927.9 2141.7 214.2 50 20 1.02 1.6 2.1 64 49.37 1097.1 167.9 89.28 1249370 4.96 1.14 1.57 550 134.4 67116.5 2440.6 2667.6 254.1 55 21 1.11 1.72 2.4 72.24 59.14 1393.5 200.3 123.23 1884100 5.15 1.14 1.58 600 156 92083.4 3069.4 3387.3 307.9 60 22 1.2 1.9 2.4 83.6 69.72 1756.2 242.8 165.41 2845530 5.41 1.14 1.58 50x30x2.9 4.21 13.2 5.29 5.8 3.87 5 3 0.29 1.58 2.63 60x40x2.9 5.37 25.8 8.59 13.5 6.77 6 4 0.29 2.15 3.22 60x40x4.0 7.19 32.8 10.9 17 8.52 6 4 0.4 2.88 4.31 60x40x5.0 8.73 38.1 12.7 19.5 9.77 6 4 0.5 3.49 5.24 70x40x4.0 7.99 48.5 13.9 19.6 9.82 7 4 0.4 2.91 5.08 70x40x5.0 9.73 56.8 16.2 22.6 11.3 7 4 0.5 3.54 6.19 70x40x6.3 11.8 65.4 18.7 25.5 12.8 7 4 0.63 4.29 7.51 80x40x4.0 8.79 68.2 17.1 22.2 11.1 8 4 0.4 2.93 5.86 80x40x5.0 10.7 80.3 20.1 25.7 12.9 8 4 0.5 3.57 7.13 80x40x6.3 13.1 93.3 23.3 29.2 14.6 8 4 0.63 4.37 8.73 80x40x8.0 16 106 26.5 32.1 16.1 8 4 0.8 5.33 10.67 90x50x3.2 8.44 89.1 19.8 35.3 14.1 9 5 0.32 3.01 5.43 90x50x4.0 10.4 107 23.8 41.9 16.8 9 5 0.4 3.71 6.69 90x50x5.0 12.7 127 28.3 49.2 19.7 9 5 0.5 4.54 8.16 90x50x6.3 15.6 150 33.3 57 22.8 9 5 0.63 5.57 10.03 90x50x7.1 17.3 162 36 60.9 24.4 9 5 0.71 6.18 11.12 90x50x8.0 19.2 174 38.6 64.6 25.8 9 5 0.8 6.86 12.34 100x50x3.6 10.1 128 25.6 42.6 17 10 5 0.36 3.37 6.73 100x50x4.0 11.2 140 27.9 46.2 18.5 10 5 0.4 3.73 7.47 100x50x4.5 12.5 153 30.7 50.4 20.2 10 5 0.45 4.17 8.33 100x50x5.0 13.7 167 33.3 54.3 21.7 10 5 0.5 4.57 9.13 100x50x5.6 15.2 181 36.2 58.6 23.4 10 5 0.56 5.07 10.13 100x50x6.3 16.9 197 39.4 63 25.2 10 5 0.63 5.63 11.27 100x50x7.1 18.7 214 42.7 67.5 27 10 5 0.71 6.23 12.47 100x50x8.0 20.8 230 46 71.7 28.7 10 5 0.8 6.93 13.87 100x50x10.0 24.9 259 51.8 78.4 31.4 10 5 1 8.3 16.6 100x60x3.6 10.9 145 28.9 64.8 21.6 10 6 0.36 4.09 6.81 100x60x4.5 13.4 174 34.8 77.3 25.8 10 6 0.45 5.03 8.38 100x60x5.0 14.7 189 37.8 83.6 27.9 10 6 0.5 5.51 9.19 100x60x5.6 16.3 206 41.2 90.6 30.2 10 6 0.56 6.11 10.19 100x60x6.3 18.1 225 45 98.1 32.7 10 6 0.63 6.79 11.31 100x60x7.1 20.2 244 48.8 106 35.3 10 6 0.71 7.58 12.63 100x60x8.0 22.4 264 52.8 113 37.8 10 6 0.8 8.4 14 100x60x8.8 24.2 279 55.9 119 39.7 10 6 0.88 9.08 15.13 120x60x4.0 13.6 249 41.5 83.1 27.7 12 6 0.4 4.53 9.07 120x60x5.0 16.7 299 49.9 98.8 32.9 12 6 0.5 5.57 11.13 120x60x6.3 20.7 358 59.7 116 38.8 12 6 0.63 6.9 13.8 120x60x7.1 23 391 65.2 126 41.9 12 6 0.71 7.67 15.33 120x60x8.0 25.6 425 70.8 135 45 12 6 0.8 8.53 17.07 120x60x8.8 27.8 452 75.3 142 47.5 12 6 0.88 9.27 18.53 120x60x10.0 30.9 488 81.4 152 50.5 12 6 1 10.3 20.6 120x80x5.0 18.7 365 60.9 193 48.2 12 8 0.5 7.48 11.22 120x80x6.3 23.2 440 73.3 230 57.6 12 8 0.63 9.28 13.92 120x80x8.0 28.8 525 87.5 273 68.1 12 8 0.8 11.52 17.28 120x80x10.0 34.9 609 102 313 78.1 12 8 1 13.96 20.94 140x70x4.0 16 404 57.7 136 38.8 14 7 0.4 5.33 10.67 140x70x5.0 19.7 488 69.8 163 46.5 14 7 0.5 6.57 13.13 140x70x6.3 24.4 589 84.2 194 55.3 14 7 0.63 8.13 16.27 140x70x7.1 27.3 647 92.4 211 60.2 14 7 0.71 9.1 18.2 140x70x8.0 30.4 707 101 228 65.1 14 7 0.8 10.13 20.27 140x70x8.8 33 756 108 242 69.1 14 7 0.88 11 22 140x70x10.0 36.9 823 118 260 74.3 14 7 1 12.3 24.6 140x80x4.0 16.8 441 62.9 184 46 14 8 0.4 6.11 10.69 140x80x5.0 20.7 534 76.3 221 55.3 14 8 0.5 7.53 13.17 140x80x6.3 25.7 646 92.3 265 66.2 14 8 0.63 9.35 16.35 140x80x8.0 32 776 111 314 78.5 14 8 0.8 11.64 20.36 140x80x10.0 38.9 908 130 362 90.5 14 8 1 14.15 24.75 150x100x5.0 23.7 739 98.5 392 78.5 15 10 0.5 9.48 14.22 150x100x6.3 29.5 898 120 474 94.8 15 10 0.63 11.8 17.7 150x100x8.0 36.8 1090 145 569 114 15 10 0.8 14.72 22.08 150x100x10.0 44.9 1280 171 665 133 15 10 1 17.96 26.94 150x100x12.5 54.6 1490 198 763 153 15 10 1.25 21.84 32.76 160x80x4.0 18.4 612 76.5 207 51.7 16 8 0.4 6.13 12.27 160x80x5.0 22.7 744 93 249 62.3 16 8 0.5 7.57 15.13 160x80x6.3 28.2 903 113 299 74.8 16 8 0.63 9.4 18.8 160x80x8.0 35.2 1090 136 356 89 16 8 0.8 11.73 23.47 160x80x10.0 42.9 1280 161 411 103 16 8 1 14.3 28.6 160x80x12.5 52.1 1490 186 465 116 16 8 1.25 17.37 34.73 160x90x5.6 26.4 886 111 358 79.5 16 9 0.56 9.5 16.9 160x90x7.1 32.9 1080 135 431 95.7 16 9 0.71 11.84 21.06 160x90x8.0 36.8 1180 148 470 105 16 9 0.8 13.25 23.55 160x90x10.0 44.9 1400 175 547 122 16 9 1 16.16 28.74 180x100x5.0 26.7 1150 128 460 92 18 10 0.5 9.54 17.16 180x100x5.6 29.8 1270 141 506 101 18 10 0.56 10.64 19.16 180x100x6.3 33.3 1410 156 557 111 18 10 0.63 11.89 21.41 180x100x7.1 37.2 1560 173 613 123 18 10 0.71 13.29 23.91 180x100x8.0 41.6 1710 190 671 134 18 10 0.8 14.86 26.74 180x100x8.8 45.4 1850 205 720 144 18 10 0.88 16.21 29.19 180x100x10.0 50.9 2040 226 787 157 18 10 1 18.18 32.72 180x100x12.5 62.1 2380 265 908 182 18 10 1.25 22.18 39.92 200x100x6.3 35.8 1830 183 613 123 20 10 0.63 11.93 23.87 200x100x8.0 44.8 2230 223 739 148 20 10 0.8 14.93 29.87 200x100x10.0 54.9 2660 266 869 174 20 10 1 18.3 36.6 200x100x12.5 67.1 3140 314 1000 201 20 10 1.25 22.37 44.73 200x100x16.0 83 3680 368 1150 229 20 10 1.6 27.67 55.33 200x120x6.3 38.3 2070 207 929 155 20 12 0.63 14.36 23.94 200x120x8.0 48 2530 253 1130 188 20 12 0.8 18 30 200x120x10.0 58.9 3030 303 1340 223 20 12 1 22.09 36.81 200x120x12.5 72.1 3580 358 1560 260 20 12 1.25 27.04 45.06 200x120x14.2 80.7 3910 391 1690 282 20 12 1.42 30.26 50.44 200x150x10.0 64.9 3570 357 2260 302 20 15 1 27.81 37.09 220x120x6.3 40.8 2610 237 1010 168 22 12 0.63 14.4 26.4 220x120x8.0 51.2 3200 291 1230 205 22 12 0.8 18.07 33.13 220x120x10.0 62.9 3840 349 1460 243 22 12 1 22.2 40.7 220x120x12.5 77.1 4560 415 1710 285 22 12 1.25 27.21 49.89 220x120x14.2 86.3 5000 454 1850 309 22 12 1.42 30.46 55.84 220x120x16.0 95.8 5410 492 1990 331 22 12 1.6 33.81 61.99 250x150x6.3 48.4 4140 331 1870 250 25 15 0.63 18.15 30.25 250x150x8.0 60.8 5110 409 2300 306 25 15 0.8 22.8 38 250x150x10.0 74.9 6170 494 2750 367 25 15 1 28.09 46.81 250x150x12.5 92.1 7390 591 3270 435 25 15 1.25 34.54 57.56 250x150x16.0 115 8880 710 3870 516 25 15 1.6 43.13 71.88 260x140x6.3 48.4 4350 335 1660 237 26 14 0.63 16.94 31.46 260x140x8.0 60.8 5370 413 2030 290 26 14 0.8 21.28 39.52 260x140x10.0 74.9 6490 499 2430 347 26 14 1 26.22 48.69 260x140x12.5 92.1 7770 597 2880 411 26 14 1.25 32.24 59.87 260x180x6.3 53.4 5170 397 2930 325 26 18 0.63 21.85 31.55 260x180x8.0 67.2 6390 492 3610 401 26 18 0.8 27.49 39.71 260x180x10.0 82.9 7740 595 4350 483 26 18 1 33.91 48.99 260x180x12.5 102 9300 715 5200 577 26 18 1.25 41.73 60.27 260x180x16.0 128 11250 865 6230 692 26 18 1.6 52.36 75.64 300x200x8.0 76.8 9720 648 5180 518 30 20 0.8 30.72 46.08 300x200x10.0 94.9 11820 788 6280 628 30 20 1 37.96 56.94 300x200x12.5 117 14270 952 7540 754 30 20 1.25 46.8 70.2 300x200x16.0 147 17390 1160 9110 911 30 20 1.6 58.8 88.2 400x200x8.0 92.8 19560 978 6660 666 40 20 0.8 30.93 61.87 400x200x10.0 115 23910 1200 8080 808 40 20 1 38.33 76.67 400x200x12.5 142 29060 1450 9740 974 40 20 1.25 47.33 94.67 400x200x16.0 179 35740 1790 11820 1180 40 20 1.6 59.67 119.33 450x250x10.0 135 36890 1640 14820 1190 45 25 1 48.21 86.79 450x250x12.5 167 45030 2000 17970 1440 45 25 1.25 59.64 107.36 450x250x16.0 211 55710 2480 22040 1760 45 25 1.6 75.36 135.64 500x300x8.0 125 43730 1750 19950 1330 50 30 0.8 46.88 78.13 500x300x10.0 155 53760 2150 24440 1630 50 30 1 58.13 96.88 500x300x12.5 192 65810 2630 29780 1990 50 30 1.25 72 120 500x300x16.0 243 81780 3270 36770 2450 50 30 1.6 91.13 151.88 40x2.9 4.21 9.54 4.77 9.54 4.77 4 0.29 2.11 2.11 40x4.0 5.59 11.8 5.91 11.8 5.91 4 0.4 2.8 2.8 40x5.0 6.73 13.4 6.68 13.4 6.68 4 0.5 3.37 3.37 50x2.9 5.37 19.7 7.87 19.7 7.87 5 0.29 2.69 2.69 50x4.0 7.19 25 9.99 25 9.99 5 0.4 3.6 3.6 50x5.0 8.73 28.9 11.6 28.9 11.6 5 0.5 4.37 4.37 50x6.3 10.6 32.8 13.1 32.8 13.1 5 0.63 5.3 5.3 60x2.9 6.53 35.2 11.7 35.2 11.7 6 0.29 3.27 3.27 60x4.0 8.79 45.4 15.1 45.4 15.1 6 0.4 4.4 4.4 60x5.0 10.7 53.3 17.8 53.3 17.8 6 0.5 5.35 5.35 60x6.3 13.1 61.6 20.5 61.6 20.5 6 0.63 6.55 6.55 60x8.0 16 69.7 23.2 69.7 23.2 6 0.8 8 8 70x3.2 8.44 62.3 17.8 62.3 17.8 7 0.32 4.22 4.22 70x4.0 10.4 74.7 21.3 74.7 21.3 7 0.4 5.2 5.2 70x5.0 12.7 88.5 25.3 88.5 25.3 7 0.5 6.35 6.35 70x6.3 15.6 104 29.7 104 29.7 7 0.63 7.8 7.8 70x7.1 17.3 112 32 112 32 7 0.71 8.65 8.65 70x8.0 19.2 120 34.2 120 34.2 7 0.8 9.6 9.6 80x3.6 10.9 105 26.2 105 26.2 8 0.36 5.45 5.45 80x4.0 12 114 28.6 114 28.6 8 0.4 6 6 80x4.5 13.4 126 31.5 126 31.5 8 0.45 6.7 6.7 80x5.0 14.7 137 34.2 137 34.2 8 0.5 7.35 7.35 80x5.6 16.3 149 37.2 149 37.2 8 0.56 8.15 8.15 80x6.3 18.1 162 40.5 162 40.5 8 0.63 9.05 9.05 80x7.1 20.2 176 43.9 176 43.9 8 0.71 10.1 10.1 80x8.0 22.4 189 47.3 189 47.3 8 0.8 11.2 11.2 80x8.8 24.2 200 50 200 50 8 0.88 12.1 12.1 80x10.0 26.9 214 53.5 214 53.5 8 1 13.45 13.45 90x3.6 12.3 152 33.8 152 33.8 9 0.36 6.15 6.15 90x5.0 16.7 200 44.4 200 44.4 9 0.5 8.35 8.35 90x5.6 18.6 218 48.5 218 48.5 9 0.56 9.3 9.3 90x6.3 20.7 238 53 238 53 9 0.63 10.35 10.35 90x8.0 25.6 281 62.6 281 62.6 9 0.8 12.8 12.8 90x10.0 30.9 322 71.6 322 71.6 9 1 15.45 15.45 100x4.0 15.2 232 46.4 232 46.4 10 0.4 7.6 7.6 100x5.0 18.7 279 55.9 279 55.9 10 0.5 9.35 9.35 100x6.3 23.2 336 67.1 336 67.1 10 0.63 11.6 11.6 100x7.1 25.8 367 73.4 367 73.4 10 0.71 12.9 12.9 100x8.0 28.8 400 79.9 400 79.9 10 0.8 14.4 14.4 100x10.0 34.9 462 92.4 462 92.4 10 1 17.45 17.45 100x12.5 42.1 522 104 522 104 10 1.25 21.05 21.05 110x8.0 32 547 99.4 547 99.4 11 0.8 16 16 110x10.0 38.9 637 116 637 116 11 1 19.45 19.45 120x4.0 18.4 410 68.4 410 68.4 12 0.4 9.2 9.2 120x4.5 20.6 455 75.8 455 75.8 12 0.45 10.3 10.3 120x5.0 22.7 498 83 498 83 12 0.5 11.35 11.35 120x5.6 25.3 547 91.2 547 91.2 12 0.56 12.65 12.65 120x6.3 28.2 603 100 603 100 12 0.63 14.1 14.1 120x8.0 35.2 726 121 726 121 12 0.8 17.6 17.6 120x10.0 42.9 852 142 852 142 12 1 21.45 21.45 120x12.5 52.1 982 164 982 164 12 1.25 26.05 26.05 140x5.0 26.7 807 115 807 115 14 0.5 13.35 13.35 140x5.6 29.8 891 127 891 127 14 0.56 14.9 14.9 140x6.3 33.3 984 141 984 141 14 0.63 16.65 16.65 140x7.1 37.2 1090 155 1090 155 14 0.71 18.6 18.6 140x8.0 41.6 1200 171 1200 171 14 0.8 20.8 20.8 140x8.8 45.4 1290 184 1290 184 14 0.88 22.7 22.7 140x10.0 50.9 1420 202 1420 202 14 1 25.45 25.45 140x12.5 62.1 1650 236 1650 236 14 1.25 31.05 31.05 150x6.3 35.8 1220 163 1220 163 15 0.63 17.9 17.9 150x8.0 44.8 1490 199 1490 199 15 0.8 22.4 22.4 150x10.0 54.9 1770 236 1770 236 15 1 27.45 27.45 150x12.5 67.1 2080 277 2080 277 15 1.25 33.55 33.55 150x16.0 83 2430 324 2430 324 15 1.6 41.5 41.5 160x6.3 38.3 1500 187 1500 187 16 0.63 19.15 19.15 160x8.0 48 1830 229 1830 229 16 0.8 24 24 160x8.8 52.4 1980 247 1980 247 16 0.88 26.2 26.2 160x10.0 58.9 2190 273 2190 273 16 1 29.45 29.45 160x12.5 72.1 2580 322 2580 322 16 1.25 36.05 36.05 160x14.2 80.7 2810 351 2810 351 16 1.42 40.35 40.35 160x16.0 89.4 3030 379 3030 379 16 1.6 44.7 44.7 180x6.3 43.3 2170 241 2170 241 18 0.63 21.65 21.65 180x8.0 54.4 2660 296 2660 296 18 0.8 27.2 27.2 180x8.8 59.4 2880 320 2880 320 18 0.88 29.7 29.7 180x10.0 66.9 3190 355 3190 355 18 1 33.45 33.45 180x12.5 82.1 3790 421 3790 421 18 1.25 41.05 41.05 180x14.2 92 4150 462 4150 462 18 1.42 46 46 180x16.0 102 4500 500 4500 500 18 1.6 51 51 200x6.3 48.4 3010 301 3010 301 20 0.63 24.2 24.2 200x8.0 60.8 3710 371 3710 371 20 0.8 30.4 30.4 200x10.0 74.9 4470 447 4470 447 20 1 37.45 37.45 200x12.5 92.1 5340 534 5340 534 20 1.25 46.05 46.05 200x16.0 115 6390 639 6390 639 20 1.6 57.5 57.5 220x6.3 53.4 4050 368 4050 368 22 0.63 26.7 26.7 220x8.0 67.2 5000 455 5000 455 22 0.8 33.6 33.6 220x10.0 82.9 6050 550 6050 550 22 1 41.45 41.45 220x12.5 102 7250 659 7250 659 22 1.25 51 51 220x16.0 128 8750 795 8750 795 22 1.6 64 64 250x8.0 76.8 7450 596 7450 596 25 0.8 38.4 38.4 250x10.0 94.9 9060 724 9060 724 25 1 47.45 47.45 250x12.5 117 10920 873 10920 873 25 1.25 58.5 58.5 250x16.0 147 13270 1060 13270 1060 25 1.6 73.5 73.5 260x8.0 80 8420 648 8420 648 26 0.8 40 40 260x8.8 87.6 9160 705 9160 705 26 0.88 43.8 43.8 260x10.0 98.9 10240 788 10240 788 26 1 49.45 49.45 260x11.0 108 11110 855 11110 855 26 1.1 54 54 260x12.5 122 12360 951 12360 951 26 1.25 61 61 260x14.2 137 13710 1050 13710 1050 26 1.42 68.5 68.5 260x16.0 153 15060 1160 15060 1160 26 1.6 76.5 76.5 300x8.0 92.8 13130 875 13130 875 30 0.8 46.4 46.4 300x10.0 115 16030 1070 16030 1070 30 1 57.5 57.5 300x12.5 142 19440 1300 19440 1300 30 1.25 71 71 300x16.0 179 23850 1590 23850 1590 30 1.6 89.5 89.5 350x10.0 135 25880 1480 25880 1480 35 1 67.5 67.5 350x12.5 167 31540 1800 31540 1800 35 1.25 83.5 83.5 350x16.0 211 38940 2230 38940 2230 35 1.6 105.5 105.5 400x10.0 155 39130 1960 39130 1960 40 1 77.5 77.5 400x12.5 192 47840 2390 47840 2390 40 1.25 96 96 400x16.0 243 59340 2970 59340 2970 40 1.6 121.5 121.5 21.3x3.2 1.82 0.768 0.722 0.768 0.722 2.13 0.32 0.91 0.91 26.9x2.3 1.78 1.36 1.01 1.36 1.01 2.69 0.23 0.89 0.89 26.9x3.2 2.38 1.7 1.27 1.7 1.27 2.69 0.32 1.19 1.19 33.7x3.2 3.07 3.6 2.14 3.6 2.14 3.37 0.32 1.54 1.54 33.7x4.0 3.73 4.19 2.49 4.19 2.49 3.37 0.4 1.87 1.87 38.0x3.2 3.5 5.34 2.81 5.34 2.81 3.8 0.32 1.75 1.75 38.0x5.0 5.18 7.22 3.8 7.22 3.8 3.8 0.5 2.59 2.59 38.0x6.3 6.27 8.19 4.31 8.19 4.31 3.8 0.63 3.14 3.14 42.4x3.2 3.94 7.62 3.59 7.62 3.59 4.24 0.32 1.97 1.97 42.4x4.0 4.83 8.99 4.24 8.99 4.24 4.24 0.4 2.42 2.42 48.3x3.2 4.53 11.6 4.8 11.6 4.8 4.83 0.32 2.27 2.27 48.3x6.3 8.31 18.7 7.76 18.7 7.76 4.83 0.63 4.16 4.16 60.3x4.0 7.07 28.2 9.34 28.2 9.34 6.03 0.4 3.54 3.54 60.3x5.0 8.69 33.5 11.1 33.5 11.1 6.03 0.5 4.35 4.35 60.3x6.3 10.7 39.5 13.1 39.5 13.1 6.03 0.63 5.35 5.35 76.1x4.0 9.06 59.1 15.5 59.1 15.5 7.61 0.4 4.53 4.53 76.1x5.0 11.2 70.9 18.6 70.9 18.6 7.61 0.5 5.6 5.6 76.1x6.3 13.8 84.8 22.3 84.8 22.3 7.61 0.63 6.9 6.9 88.9x5.0 13.2 116 26.2 116 26.2 8.89 0.5 6.6 6.6 88.9x6.3 16.3 140 31.5 140 31.5 8.89 0.63 8.15 8.15 88.9x8.0 20.3 168 37.8 168 37.8 8.89 0.8 10.15 10.15 88.9x10.0 24.8 196 44.1 196 44.1 8.89 1 12.4 12.4 88.9x12.5 30 225 50.6 225 50.6 8.89 1.25 15 15 101.6x4.0 12.3 146 28.8 146 28.8 10.16 0.4 6.15 6.15 101.6x5.0 15.2 177 34.9 177 34.9 10.16 0.5 7.6 7.6 101.6x6.3 18.9 215 42.3 215 42.3 10.16 0.63 9.45 9.45 101.6x8.0 23.5 260 51.1 260 51.1 10.16 0.8 11.75 11.75 101.6x10.0 28.8 305 60.1 305 60.1 10.16 1 14.4 14.4 101.6x12.5 35 354 69.7 354 69.7 10.16 1.25 17.5 17.5 108.0x4.0 13.1 177 32.8 177 32.8 10.8 0.4 6.55 6.55 108.0x8.0 25.1 316 58.5 316 58.5 10.8 0.8 12.55 12.55 108.0x12.5 37.5 435 80.5 435 80.5 10.8 1.25 18.75 18.75 114.3x6.3 21.4 313 54.7 313 54.7 11.43 0.63 10.7 10.7 114.3x8.0 26.7 379 66.4 379 66.4 11.43 0.8 13.35 13.35 114.3x10.0 32.8 450 78.7 450 78.7 11.43 1 16.4 16.4 127.0x10.0 36.8 634 99.8 634 99.8 12.7 1 18.4 18.4 127.0x12.5 45 746 117 746 117 12.7 1.25 22.5 22.5 127.0x16.0 55.8 877 138 877 138 12.7 1.6 27.9 27.9 127.0x20.0 67.2 996 157 996 157 12.7 2 33.6 33.6 139.7x6.3 26.4 589 84.3 589 84.3 13.97 0.63 13.2 13.2 139.7x8.0 33.1 720 103 720 103 13.97 0.8 16.55 16.55 139.7x10.0 40.7 862 123 862 123 13.97 1 20.35 20.35 159.0x5.0 24.2 718 90.3 718 90.3 15.9 0.5 12.1 12.1 159.0x6.3 30.2 882 111 882 111 15.9 0.63 15.1 15.1 159.0x8.0 38 1080 136 1080 136 15.9 0.8 19 19 159.0x10.0 46.8 1300 164 1300 164 15.9 1 23.4 23.4 168.3x6.3 32.1 1050 125 1050 125 16.83 0.63 16.05 16.05 168.3x8.0 40.3 1300 154 1300 154 16.83 0.8 20.15 20.15 168.3x10.0 49.7 1560 186 1560 186 16.83 1 24.85 24.85 168.3x12.5 61.2 1870 222 1870 222 16.83 1.25 30.6 30.6 168.3x16.0 76.6 2240 267 2240 267 16.83 1.6 38.3 38.3 177.8x6.3 33.9 1250 141 1250 141 17.78 0.63 16.95 16.95 177.8x8.0 42.7 1540 173 1540 173 17.78 0.8 21.35 21.35 177.8x12.5 64.9 2230 251 2230 251 17.78 1.25 32.45 32.45 177.8x16.0 81.3 2690 302 2690 302 17.78 1.6 40.65 40.65 193.7x6.3 37.1 1630 168 1630 168 19.37 0.63 18.55 18.55 193.7x8.0 46.7 2020 208 2020 208 19.37 0.8 23.35 23.35 193.7x10.0 57.7 2440 252 2440 252 19.37 1 28.85 28.85 193.7x12.5 71.2 2930 303 2930 303 19.37 1.25 35.6 35.6 193.7x16.0 89.3 3550 367 3550 367 19.37 1.6 44.65 44.65 193.7x20.0 109 4170 431 4170 431 19.37 2 54.5 54.5 193.7x25.0 132 4820 497 4820 497 19.37 2.5 66 66 219.1x10.0 65.7 3600 328 3600 328 21.91 1 32.85 32.85 219.1x12.5 81.1 4340 397 4340 397 21.91 1.25 40.55 40.55 219.1x16.0 102 5300 483 5300 483 21.91 1.6 51 51 219.1x20.0 125 6260 572 6260 572 21.91 2 62.5 62.5 244.5x6.3 47.1 3350 274 3350 274 24.45 0.63 23.55 23.55 244.5x8.0 59.4 4160 340 4160 340 24.45 0.8 29.7 29.7 244.5x10.0 73.7 5070 415 5070 415 24.45 1 36.85 36.85 244.5x12.5 91.1 6150 503 6150 503 24.45 1.25 45.55 45.55 244.5x16.0 115 7530 616 7530 616 24.45 1.6 57.5 57.5 244.5x20.0 141 8960 733 8960 733 24.45 2 70.5 70.5 273.0x6.3 52.8 4700 344 4700 344 27.3 0.63 26.4 26.4 273.0x8.0 66.6 5850 429 5850 429 27.3 0.8 33.3 33.3 273.0x10.0 82.6 7150 524 7150 524 27.3 1 41.3 41.3 273.0x16.0 129 10710 784 10710 784 27.3 1.6 64.5 64.5 273.0x20.0 159 12800 938 12800 938 27.3 2 79.5 79.5 273.0x25.0 195 15130 1110 15130 1110 27.3 2.5 97.5 97.5 273.0x30.0 229 17160 1260 17160 1260 27.3 3 114.5 114.5 273.0x40.0 293 20460 1500 20460 1500 27.3 4 146.5 146.5 323.9x8.0 79.4 9910 612 9910 612 32.39 0.8 39.7 39.7 323.9x10.0 98.6 12160 751 12160 751 32.39 1 49.3 49.3 323.9x12.5 122 14850 917 14850 917 32.39 1.25 61 61 323.9x16.0 155 18390 1140 18390 1140 32.39 1.6 77.5 77.5 323.9x20.0 191 22140 1370 22140 1370 32.39 2 95.5 95.5 323.9x25.0 235 26400 1630 26400 1630 32.39 2.5 117.5 117.5 323.9x30.0 277 30220 1870 30220 1870 32.39 3 138.5 138.5 323.9x50.0 430 41690 2570 41690 2570 32.39 5 215 215 355.6x20.0 211 29790 1680 29790 1680 35.56 2 105.5 105.5 355.6x25.0 260 35680 2010 35680 2010 35.56 2.5 130 130 355.6x40.0 397 50170 2820 50170 2820 35.56 4 198.5 198.5 368.0x8.0 90.5 14660 797 14660 797 36.8 0.8 45.25 45.25 368.0x10.0 112 18030 980 18030 980 36.8 1 56 56 368.0x12.5 140 22080 1200 22080 1200 36.8 1.25 70 70 368.0x16.0 177 27460 1490 27460 1490 36.8 1.6 88.5 88.5 368.0x20.0 219 33210 1800 33210 1800 36.8 2 109.5 109.5 368.0x30.0 319 45850 2490 45850 2490 36.8 3 159.5 159.5 406.4x12.5 155 30030 1480 30030 1480 40.64 1.25 77.5 77.5 406.4x16.0 196 37450 1840 37450 1840 40.64 1.6 98 98 406.4x20.0 243 45430 2240 45430 2240 40.64 2 121.5 121.5 457.0x16.0 222 53960 2360 53960 2360 45.7 1.6 111 111 457.0x25.0 339 79420 3480 79420 3480 45.7 2.5 169.5 169.5 457.0x30.0 402 92170 4030 92170 4030 45.7 3 201 201 457.0x40.0 524 114900 5030 114900 5030 45.7 4 262 262 457.0x50.0 639 134400 5880 134400 5880 45.7 5 319.5 319.5 508.0x16.0 247 74910 2950 74910 2950 50.8 1.6 123.5 123.5 508.0x20.0 307 91430 3600 91430 3600 50.8 2 153.5 153.5 50 7.12 26.4 10.6 9.12 3.75 5 3.8 0.5 0.7 0.35 1.37 2.47 5.32 2.15 0 1.12 27.8 60 6.46 31.6 10.5 4.51 2.16 6 3 0.6 0.6 0.3 0.91 1.5 3.6 3.24 0 0.939 21.9 65 9.03 57.5 17.7 14.1 5.07 6.5 4.2 0.55 0.75 0.4 1.42 2.6 6.3 3.16 0 1.61 77.3 80 11 106 26.5 19.4 6.36 8 4.5 0.6 0.8 0.4 1.45 2.67 7.2 4.32 15.9 2.16 168 100 13.5 206 41.2 29.3 8.49 10 5 0.6 0.85 0.45 1.55 2.93 8.5 5.49 24.4 2.81 414 120 17 364 60.7 43.2 11.1 12 5.5 0.7 0.9 0.45 1.6 3.03 9.9 7.77 36.3 4.15 900 140 20.4 605 86.4 62.7 14.8 14 6 0.7 1 0.5 1.75 3.37 12 9.1 51.3 5.68 1800 160 24 925 116 85.3 18.3 16 6.5 0.75 1.05 0.55 1.84 3.56 13.65 11.21 68.7 7.39 3260 180 28 1350 150 114 22.4 18 7 0.8 1.1 0.55 1.92 3.75 15.4 13.52 89.4 9.55 5570 200 32.2 1910 191 148 27 20 7.5 0.85 1.15 0.6 2.01 3.94 17.25 16.02 114 11.9 9070 220 37.4 2690 245 197 33.6 22 8 0.9 1.25 0.65 2.14 4.2 20 18.68 146 16 14600 240 42.3 3600 300 248 39.6 24 8.5 0.95 1.3 0.65 2.23 4.39 22.1 21.57 179 19.7 22100 260 48.3 4820 371 317 47.7 26 9 1 1.4 0.7 2.36 4.66 25.2 24.6 221 25.5 33300 280 53.3 6280 448 399 57.2 28 9.5 1 1.5 0.75 2.53 5.02 28.5 26.5 266 31 48500 300 58.8 8030 535 495 67.8 30 10 1 1.6 0.8 2.7 5.41 32 28.4 316 37.4 69100 320 75.8 10870 679 597 80.6 32 10 1.4 1.75 0.875 2.6 4.82 35 42.35 412 66.7 96100 350 77.3 12840 734 570 75 35 10 1.4 1.6 0.8 2.4 4.45 32 46.76 459 61.2 114000 380 80.4 15760 829 615 78.7 38 10.2 1.35 1.6 0.8 2.38 4.58 32.64 49.14 507 59.1 146000 400 91.5 20350 1020 846 102 40 11 1.4 1.8 0.9 2.65 5.11 39.6 53.48 618 81.6 221000 cba-0.3.6/src/000077500000000000000000000000001142227325100130335ustar00rootroot00000000000000cba-0.3.6/src/Makefile000077500000000000000000000005431142227325100145000ustar00rootroot00000000000000# makefile for cba CXX := c++ CXXFLAGS := -O OBJECTS := cbeam_class.o cba_main.o cba: $(OBJECTS) $(CXX) $(OBJECTS) -o cba cbeam_class.o: cbeam_class.cpp $(CXX) $(CXXFLAGS) -c cbeam_class.cpp -o cbeam_class.o cba_main.o: cba_main.cpp $(CXX) $(CXXFLAGS) -c cba_main.cpp -o cba_main.o clean: rm $(OBJECTS) install: install cba $(DESTDIR)/usr/bin cba-0.3.6/src/cba_main.cpp000066400000000000000000000305041142227325100152720ustar00rootroot00000000000000#include #include #include #include #include #include #include #include "cbeam_class.h" using namespace std; char *help = "usage: cba -i inputfile [-o outputfile -p plotfile]\n" " \n" "input file format: \n" " \n" "#SPANS lengths of spans \n" "#INERTIA moments of inertia (optional) \n" "#ELASTICITY modulus of elasticity (optional)\n" "#CONSTRAINTS constraints def/rot (optional) \n" "#LOAD load matrix: span type perm live start len\n" "#FACTORS load factors perm/live (optional) \n" "#EXAMPLE: \n" " SPANS 4.2 5.8 \n" " INERTIA 3.69e-5 3.69e-5 \n" " ELASTICITY 2.1e8 \n" " CONSTRAINTS -1 0 -1 0 -1 0 \n" " LOAD 1 1 10.0 5.0 0 0 \n" " LOAD 2 1 10.0 5.0 0 0 \n" " FACTORS 1.35 1.5 \n"; vector dbl_s(string); string _s(double); string _s(double, int); string _s(int); vector lmSort(vector< vector >); vector resOut(vector< vector >, vector< vector >); int main(int argc, char *argv[]) { if (argc<2) { cout << help; exit(1); } string infilename; string outfilename; string plotfilename; for (int i=1; ii+1) infilename=argv[i+1]; if (s=="-o" || s=="-O" && argc>i+1) outfilename=argv[i+1]; if (s=="-p" || s=="-P" && argc>i+1) plotfilename=argv[i+1]; } if (infilename=="") { cout << help; exit(1); } //------------- reading inputfile ------------- ifstream inFile(infilename.c_str()); if (inFile.fail()) { cerr << "unable to open input-file for reading: " << infilename << endl; exit(1); } vector L; vector E; vector I; vector R; vector F; vector ld; vector< vector > LM; int nl=0; while (inFile.good()) { string s; getline(inFile,s,'\n'); if (s.find("#")==-1) //ignore comments { transform(s.begin(),s.end(),s.begin(),::toupper); //ignore lowercase if (s.find("SPAN")!=-1) L=dbl_s(s); if (s.find("INER")!=-1) I=dbl_s(s); if (s.find("ELAS")!=-1) E=dbl_s(s); if (s.find("CONS")!=-1) R=dbl_s(s); if (s.find("FACT")!=-1) F=dbl_s(s); if (s.find("LOAD")!=-1) LM.push_back(dbl_s(s)); } } double Es; if (E.size()>=1) Es=E[0]; //------------- construct beam object ------------- cBeam *bm; bm = new cBeam(); //------------- create output string array ------------- string line; vector output; //------------- set geometry values ------------- if (!bm->SetGeometry(L,Es,I,R)) { cout << "geometry not right" < > geo(4); geo=bm->GetGeometry(); L.clear(); L=geo[0]; E.clear(); E=geo[1]; I.clear(); I=geo[2]; R.clear(); R=geo[3]; int nf=L.size(); //resize E to 1 E.resize(1); //check if I=const bool c=true; for (int i=1; iSetLoads(LM)) { cout << "no loads" < > LMg(bm->GetLoadsG()); //get back permanent loads vector< vector > LMq(bm->GetLoadsQ()); //get back live loads output.push_back(""); line = "permanent loads:"; output.push_back(line); for (int i=0; iSolve()) { cout << "problem could not be solved" < > res(bm->GetResults()); vector< vector > max(bm->GetMax()); vector< vector > sup(bm->GetReaction()); line = "results: characteristic loads (1.0 1.0)"; output.push_back(line); output.push_back(sep); for (int i=0; i=2) { if (F.size()>=4) bm->SetLoadFactors(F[0],F[1],F[2],F[3]); else bm->SetLoadFactors(F[0],F[1]); bm->Solve(); max=bm->GetMax(); sup=bm->GetReaction(); line = "design loads ("+_s(F[0])+" "+_s(F[1]); if (F.size()>=4) line+=(" "+_s(F[2])+" "+_s(F[3])+")"); else line+=")"; output.push_back(line); output.push_back(sep); for (int i=0; iGetResults().at(i); ofstream plotfile(plotfilename.c_str()); if(plotfile) { plotfile.flush(); if (res.size()==7) { plotfile<<"#x\tMdmax\tMdmin\tVdmax\tVdmin\tdmax\tdmin"< dbl_s(string str) { istringstream tokens(str); string buf; vector v; tokens>>buf; while (tokens>>buf) { stringstream k; k << buf; double x; k >> x; v.push_back(x); } return v; } //return string from values string _s(double x) { string buf; stringstream k(buf); k << x; k >> buf; return buf; } string _s(double x, int p) { string buf; stringstream k(buf); k.precision(p); k << fixed << x; k >> buf; return buf; } string _s(int x) { string buf; stringstream k(buf); k << x; k >> buf; return buf; } //sort loads for output vector lmSort(vector< vector > LM) { string line; vector output; //find number of loaded spans int nf=0; for (int i=0; inf) nf=int(LM[i][0]); vector< vector > ldvalue(nf); vector< vector > ldstart(nf); vector< vector > ldend(nf); for (int lt=1; lt<=6; lt++) { for (int i=0; imax) max=ldvalue[i].size(); for (int k=0; kk) line+=("\t"+_s(ldvalue[i][k])); else line+=("\t"); } output.push_back(line); if (lt>1) { line = " a="; for (int i=0; ik) line+=("\t"+_s(ldstart[i][k])); else line+=("\t"); } output.push_back(line); } if (lt==3 || lt>=5) { line = " l\'="; for (int i=0; ik) line+=("\t"+_s(ldend[i][k])); else line+=("\t"); } output.push_back(line); } } } return output; } //prepare max/min results for output vector resOut(vector< vector > maxValues, vector< vector > reactions) { string line; vector output; //results if (maxValues.size()==7) { for (int j=1; j<7; j++) //skip x (Mmax) { switch (j) { case 1: line = "Mmax:\t"; break; case 2: line = "Mmin:\t"; break; case 3: line = "Vmax:\t"; break; case 4: line = "Vmin:\t"; break; case 5: line = "dmax:\t"; break; case 6: line = "dmin:\t"; break; } for (int i=0; i Li, double Ei, vector Ii, vector Ri) { //set span lengths [L] L.clear(); for (int i=0; i0) L.push_back(Li[i]); //check if length >0 int nf=L.size(); //number of spans if (nf>0) { //set elastic modulus [E] if (Ei>0.0001) E=Ei; else E=1; //set default if not given //set moments of inertia [I] I.clear(); for (int i=0; i0) I.push_back(Ii[i]); //check if inertia >0 if (I.size()!=nf) //check if I fits to the span numbers { I.clear(); if (Ii.size()==1) for (int i=0; in) m=n; for (int i=0; i Li) { //creating empty values, if only spans are given double Ei=1; vector Ii; vector Ri; if (SetGeometry(Li,Ei,Ii,Ri)) return true; else return false; } vector< vector > cBeam::GetGeometry() { vector< vector > v; v.push_back(L); v.push_back(vector(L.size(),E)); v.push_back(I); v.push_back(R); return v; } bool cBeam::SetLoads(vector< vector > LMi) { LMg.clear(); LMq.clear(); vector ld; for (int i=0; i2) //span, type and 1 load must be given { if (ld[0]>0 && int(ld[0])<=L.size()) //load has to be on a span { for (int j=0; j<2; j++) { if (ld.size()>2+j) { if(ld[2+j]!=0) //if permanent/live load is given { vector l; l.push_back(ld[0]); //fill in span l.push_back(ld[1]); //fill in type l.push_back(ld[2+j]); //fill in permanent/live load double span=L[int(ld[0])-1]; //get length for this span if (ld.size()>4) //fill in start if given or zero { if (ld[4]<0) ld[4]=0; //check if load sits on the span if (ld[4]>span) ld[4]=span; l.push_back(ld[4]); } else l.push_back(0); if (ld.size()>5) //fill in length if given or zero { if (ld[1]<6) //check if load fits the span { if (ld[5]<0) ld[5]=0; if ((ld[4]+ld[5])>span) ld[5]=span-ld[4]; } else //lt6: length can be negative { if (ld[5]>0) if ((ld[4]+ld[5])>span) ld[5]=span-ld[4]; if (ld[5]<0) if ((ld[4]+ld[5])<0) ld[5]=-ld[4]; } l.push_back(ld[5]); } else l.push_back(0); if (!((ld[1]==3 || ld[1]==6) && ld[2+j]*ld[5]==0)) //check if p*c=0 { if (j==0) LMg.push_back(l); //fill into permanent load matrix if (j==1) LMq.push_back(l); //fill into live load matrix } } } } } } } if ((LMg.size()+LMq.size())>0) return true; else return false; } //get permanent loads vector< vector > cBeam::GetLoadsG() { return LMg; } //get live loads vector< vector > cBeam::GetLoadsQ() { return LMq; } void cBeam::SetLoadFactors(double g, double q) { lfG=g; lfQ=q; } void cBeam::SetLoadFactors(double g, double q, double g_min, double q_min) { lfG=g; lfQ=q; lfG_min=g_min; lfQ_min=q_min; //keep this zero, if you want to have save results } bool cBeam::Solve() { int nf=L.size(); if (nf!=0) //check if someone called this without setting geometry { int lmG=LMg.size(); int lmQ=LMq.size(); int lmSize = lmG+lmQ; vector< vector > LM; vector< vector > w(lmSize,vector(5,0)); vector< vector > wmax(lmSize,vector(5,0)); vector< vector > wmin(lmSize,vector(5,0)); for (int i=0; i > cBeam::GetResults() { int nf=L.size(); vector< vector > r(7); double px=0; for (int i=0; i0) px+=L[i-1]; for (int j=0; j > cBeam::GetMax() { int nf=L.size(); vector< vector > r(7); //get x(Mmax) for (int i=0; ires) { res = Res[1][i][j]; pos = j; } } r[0].push_back(Res[0][i][pos]); } // get max/min values for (int i=0; ires) res = Res[k][i][j]; //max if (k%2==0 && Res[k][i][j] > cBeam::GetReaction() { return Rf; } //------------------------- private functions for calculating ---------------------------- //calculate stiffness matrix of one beam element vector< vector > cBeam::k_beam(double Lb, double Ib, double Eb) { vector< vector > kb(4,vector(4,0)); double kfv, kmv, kft, kmt, kmth; kfv = 12*Eb*Ib/pow(Lb,3); kmv = 6*Eb*Ib/pow(Lb,2); kft = kmv; kmt = 4*Eb*Ib/Lb; kmth = 2*Eb*Ib/Lb; kb[0][0]=kfv; kb[0][1]=kft; kb[0][2]=-kfv; kb[0][3]=kft; kb[1][0]=kmv; kb[1][1]=kmt; kb[1][2]=-kmv; kb[1][3]=kmth; kb[2][0]=-kfv; kb[2][1]=-kft; kb[2][2]=kfv; kb[2][3]=-kft; kb[3][0]=kft; kb[3][1]=kmth; kb[3][2]=-kft; kb[3][3]=kmt; return kb; } //building the global stiffness matrix void cBeam::build_ksys(vector L, double E, vector I, vector R) { ksys.clear(); int N = L.size(); int ndof=2*(N+1); int dof_i; for (int i=0; i(ndof,0)); //zero matrix vector< vector > kb(4,vector(4,0)); for (int i=0; i 0) ksys[i][i] = ksys[i][i]+ R[i]; //spring supports } } //empty and build result matrix void cBeam::build_res_matrix() { int nf=L.size(); //support reactions Rf.clear(); Rf.assign(2,vector(nf+1,0)); //calculate x=L[i]/npts along the beam vector< vector > px(nf,vector(npts+1,0)); for (int i=0; i > zero(nf,vector(npts+1,0)); Res.push_back(px); for (int i=0; i<6; i++) Res.push_back(zero); } //solve the continuous beam problem for a given load matrix void cBeam::cba_solve(vector< vector > LM) { int N = L.size(); int ndof=2*(N+1); int dof_i; vector m(ndof,0); //zero right hand side vector nl(4,0); //nodal loads for (int i=0; i m //calculate member end actions vector dmbr(4,0); // end deformations vector fmbr(4,0); // end forces vector rf(N+1,0); // reaction forces vector< vector > kb(4,vector(4,0)); for (int i=0; i nl for (int j=0; j<4; j++) fmbr[j]=0; for (int j=0; j<4; j++) { for (int k=0; k<4; k++) fmbr[j]+=kb[j][k]*dmbr[k]; fmbr[j]+=nl[j]; } rf[i]+=fmbr[0]; //reaction forces rf[i+1]+=fmbr[2]; set_mbr_values(i,fmbr,dmbr,LM); // set member forces } for (int i=0; iRf[0][i]) Rf[0][i]=rf[i]; //max if (rf[i] cBeam::solve_glsys (vector< vector > A, vector b) { int n=A.size(); vector x(n,0); for (int i=0; i=0; j--) { for (int k=j+1; k cBeam::get_cnl(int iSpan, vector< vector > LM) { vector nl(4,0); double l, p, a, b, c, s, t; int loadtype; l=L[iSpan]; for (int i=0; i0) s=a+c/3; //descending else { a+=c; s=a-2*c/3; } //ascending t=l-s; nl[0] += p*fabs(c)*((2*s+l)*pow(t,2)+pow(c,2)*(s-t)/6+2*pow(c,3)/135)/(2*pow(l,3)); nl[1] += p*fabs(c)*(s*pow(t,2)+pow(c,2)*(s-2*t)/18+pow(c,3)/135)/(2*pow(l,2)); nl[2] += p*fabs(c)*((2*t+l)*pow(s,2)+pow(c,2)*(t-s)/6-2*pow(c,3)/135)/(2*pow(l,3)); nl[3] += -p*fabs(c)*(t*pow(s,2)+pow(c,2)*(t-2*s)/18-pow(c,3)/135)/(2*pow(l,2)); break; } } } return nl; } // sets M, V, rt, def of member void cBeam::set_mbr_values(int iSpan, vector fmbr, vector dmbr, vector< vector > LM) { vector x(npts+1,0); for (int i=0; i Mt(npts+1,0); vector Vt(npts+1,0); vector Rt(npts+1,0); vector Dt(npts+1,0); double l, p, a, b, c, Va, Ra; //values caused by applied loads int loadtype; l=L[iSpan]; for (int i=0; i0) { Vt[j]+=Va; Mt[j]+=Va*x[j]; Rt[j]+=(Va/2)*pow(x[j],2) + Ra; Dt[j]+=(Va/6)*pow(x[j],3) + Ra*x[j]; if (x[j]>a) { Vt[j]-=p; Mt[j]-=p*(x[j]-a); Rt[j]-=(p/2)*pow((x[j]-a),2); Dt[j]-=(p/6)*pow((x[j]-a),3); } } } break; case 3: //partial udls b = c+a; Va = (l-b+c/2)*c*p/l; Ra=-((Va/6)*pow(l,3)+(p/24)*pow((l-b),4)-(p/24)*pow((l-a),4))/l; for (int j=0; ja) { Vt[j]-=p*(x[j]-a); Mt[j]-=(p/2)*pow((x[j]-a),2); Rt[j]-=(p/6)*pow((x[j]-a),3); Dt[j]-=(p/24)*pow((x[j]-a),4); if (x[j]>b) { Vt[j]+=p*(x[j]-b); Mt[j]+=(p/2)*pow((x[j]-b),2); Rt[j]+=(p/6)*pow((x[j]-b),3); Dt[j]+=(p/24)*pow((x[j]-b),4); } } } break; case 4: //moment load b = l-a; Va = p/l; Ra = (p/6)*(3*pow(b,2)/l-l); for (int j=0; j0) { Vt[j]+=Va -(p/2)*pow(x[j],2)/a; Mt[j]+=Va*x[j] -(p/6)*pow(x[j],3)/a; Rt[j]+=Ra +(Va/2)*pow(x[j],2) -(p/24)*pow(x[j],4)/a; Dt[j]+=Ra*x[j] +(Va/6)*pow(x[j],3) -(p/120)*pow(x[j],5)/a; if (x[j]>a) { Vt[j]+=(p/2) *(pow(x[j]-a,2))/a; Mt[j]+=(p/6) *(pow(x[j]-a,3))/a; Rt[j]+=(p/24) *(pow(x[j]-a,4))/a; Dt[j]+=(p/120) *(pow(x[j]-a,5))/a; } } else { Vt[j]+=Va -p*x[j]; Mt[j]+=Va*x[j] -(p/2)*pow(x[j],2); Rt[j]+=Ra +(Va/2)*pow(x[j],2) -(p/6)*pow(x[j],3); Dt[j]+=Ra*x[j] +(Va/6)*pow(x[j],3) -(p/24)*pow(x[j],4); } if (x[j]>(a+c)) { Vt[j]+=(p/2) *(pow(x[j]-(a+c),2))/b; Mt[j]+=(p/6) *(pow(x[j]-(a+c),3))/b; Rt[j]+=(p/24) *(pow(x[j]-(a+c),4))/b; Dt[j]+=(p/120) *(pow(x[j]-(a+c),5))/b; } } break; case 6: //partial triangular loads if (c>0) //descending { b=l-(a+c); double Va = p*c*(b+2*c/3)/(2*l); double Ra = -p*c*(pow(l,2)*(2*c/3+b)-2*pow(c,3)/5-3*b*pow(c,2)/2-2*pow(b,2)*c-pow(b,3))/(12*l); for (int j=0; ja) { Vt[j]+=(p/2)*(pow(x[j]-a,2)/c) -p*(x[j]-a); Mt[j]+=(p/6)*(pow(x[j]-a,3)/c) -(p/2)*pow(x[j]-a,2); Rt[j]+=(p/24)*(pow(x[j]-a,4)/c) -(p/6)*pow(x[j]-a,3); Dt[j]+=(p/120)*(pow(x[j]-a,5)/c) -(p/24)*pow(x[j]-a,4); if (x[j]>(a+c)) { Vt[j]-=(p/2) *(pow(x[j]-(a+c),2)/c); Mt[j]-=(p/6) *(pow(x[j]-(a+c),3)/c); Rt[j]-=(p/24) *(pow(x[j]-(a+c),4)/c); Dt[j]-=(p/120) *(pow(x[j]-(a+c),5)/c); } } } } else if (c<0) //ascending { a+=c; c=fabs(c); b=l-(a+c); double Va = p*c*(b+c/3)/(2*l); double Ra = -p*c*(pow(l,2)*(c/3+b)-pow(c,3)/10-b*pow(c,2)/2-pow(b,2)*c-pow(b,3))/(12*l); for (int j=0; ja) { Vt[j]-=(p/2)*(pow(x[j]-a,2)/c); Mt[j]-=(p/6)*(pow(x[j]-a,3)/c); Rt[j]-=(p/24)*(pow(x[j]-a,4)/c); Dt[j]-=(p/120)*(pow(x[j]-a,5)/c); if (x[j]>(a+c)) { Vt[j]+=(p/2) *(pow(x[j]-(a+c),2)/c) +p*(x[j]-(a+c)); Mt[j]+=(p/6) *(pow(x[j]-(a+c),3)/c) +(p/2)*pow(x[j]-(a+c),2); Rt[j]+=(p/24) *(pow(x[j]-(a+c),4)/c) +(p/6)*pow(x[j]-(a+c),3); Dt[j]+=(p/120) *(pow(x[j]-(a+c),5)/c) +(p/24)*pow(x[j]-(a+c),4); } } } } break; } } } //add results at npts for the two moments applied at each end, Ma and Mb double Ma=fmbr[1]; double Mb=fmbr[3]; Va = (Ma+Mb)/l; Ra = Ma*l/3 - Mb*l/6; for (int j=0; j Res[1][iSpan][i]) Res[1][iSpan][i]=ResValue; if (ResValue < Res[2][iSpan][i]) Res[2][iSpan][i]=ResValue; //shear ResValue=Vt[i]; if (ResValue > Res[3][iSpan][i]) Res[3][iSpan][i]=ResValue; if (ResValue < Res[4][iSpan][i]) Res[4][iSpan][i]=ResValue; //deformations - in force direction positive ResValue=-Dt[i]; if (ResValue > Res[5][iSpan][i]) Res[5][iSpan][i]=ResValue; if (ResValue < Res[6][iSpan][i]) Res[6][iSpan][i]=ResValue; } } cba-0.3.6/src/cbeam_class.h000066400000000000000000000112351142227325100154420ustar00rootroot00000000000000//cbeam_class.h continuous beam analysis class - header file /* cbeam_class 0.3.6 07/2010 G.P.L. this c++ class analyses members and forces for a given beam sourcecode (GPL) partly based on CBA.m for octave/mathcad by C.Caprani www.colincaprani.com 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 . usage: cBeam obj Constructor SetGeometry(L,E,I,R) L vector of span lengths required, returns false if not supplied E double elastic modulus not necessarily, default=1 I vector of moments of inertia not necessarily, default=1 R vector of constraints def/rot not necessarily, default=(-1,0) SetLoads(LM) LM load matrix every vector of loads can have the following parts (have to have the first 3) LM[i,0] = number of span to be loaded LM[i,1] = load type: 1 - uniformly distributed load 2 - point load 3 - partial udl 4 - moment load 5 - trapezoidal load (c=0 triangular) 6 - partial triangular load (c<0 ascending, c>0 descending) LM[i,2] = value of permanent load (can be zero) LM[i,3] = value of live load (can be zero) LM[i,4] = start for load type 3/5/6, or point for load type 2/4 LM[i,5] = length for load type 3/5/6 SetGamma(g,q) set the load design factors for permanent/live loads 2 values: gmax qmax defaults= 1.0 1.0 Solve() solves the continuous beam problem for the given geometry, loads and factors GetResults() returns [7,npts*nf] vector with results along the beam x Mmax Mmin Vmax Vmin dmax dmin GetMax() returns [7,nf] vector with max/min results per span x(Mmax) Mmax Mmin Vmax Vmin dmax dmin GetReaction() returns [2,nf+1] vector with max/min support reactions Rmax Rmin */ #ifndef cbeam_class #define cbeam_class #include #include using namespace std; class cBeam { public: cBeam(); ~cBeam(); bool SetGeometry(vector, double, vector, vector); bool SetGeometry(vector); bool SetLoads(vector< vector >); void SetLoadFactors(double, double); void SetLoadFactors(double, double, double, double); vector< vector > GetGeometry(); vector< vector > GetLoadsG(); vector< vector > GetLoadsQ(); bool Solve(); vector< vector > GetResults(); vector< vector > GetMax(); vector< vector > GetReaction(); private: vector L; //spans double E; //elastic modulus vector I; //moments of inertia vector R; //constraints vector< vector > LMg; //load matrix permanant loads vector< vector > LMq; //load matrix live loads double lfG; //safety factor permanent/live loads double lfQ; double lfG_min; double lfQ_min; vector< vector > ksys; //stiffness matrix vector< vector > k_beam(double, double, double); void build_ksys(vector, double, vector, vector); void build_res_matrix(); void cba_solve(vector< vector >); vector solve_glsys (vector< vector >, vector); vector get_cnl(int iSpan, vector< vector >); void set_mbr_values(int, vector, vector, vector< vector >); int npts; //precision vector< vector > Rf; //support reactions vector< vector< vector > > Res; //results along the beam }; #endif cba-0.3.6/src/gui/000077500000000000000000000000001142227325100136175ustar00rootroot00000000000000cba-0.3.6/src/gui/Makefile000077500000000000000000000007511142227325100152650ustar00rootroot00000000000000# makefile for cba-gtk CXX := gcc CXXFLAGS := `wx-config --cflags` -Wall -g -Os LDFLAGS := `wx-config --libs` -s -lstdc++ SRCDIR=$(CURDIR) SOURCE = \ $(SRCDIR)/cbeam_class.cpp \ $(SRCDIR)/cbaGUI_drawings.cpp \ $(SRCDIR)/cbaGUI_dialogs.cpp \ $(SRCDIR)/cbaGUI.cpp OBJECTS = $(SOURCE:.cpp=.o) cba-gtk: $(OBJECTS) $(CXX) $(OBJECTS) $(LDFLAGS) -o cba-gtk %.o: %.cxx $(CXX) $(CXXFLAGS) -c $(SOURCE) -o $(OBJECTS) clean: rm $(OBJECTS) install: install cba-gtk $(DESTDIR)/usr/bin cba-0.3.6/src/gui/cba.xpm000066400000000000000000000027301142227325100150740ustar00rootroot00000000000000/* XPM */ static char * cba_xpm[] = { "32 32 16 1", " c #000300", ". c #1A1B19", "+ c #292B28", "@ c #3F413E", "# c #4C4E4B", "$ c #636562", "% c #717370", "& c #80827F", "* c #8C8E8B", "= c #9FA19E", "- c #AFB1AE", "; c #B9BBB8", "> c #CFD1CD", ", c #D8DAD7", "' c #EBEDEA", ") c #FDFFFC", "))))))))))))))))))))))))))))))))", "))))))))))))))))))))))))))))))))", "))))))))))))))))))))))))))))))))", "))))))))))))))))))))))))))))))))", "))))))))))))))))))))))))))))))))", "))))))))))))))))))))))))))))))))", "))))));&))))-=))))==))))==))))))", "))))))-$))))*&))))*&))))**))))))", "))))))-$))))*&))))*&))))**))))))", "))))))-$))))*&))))*&))))**))))))", "))))))-$))))*&))))*&))))**))))))", "))))))-$))))*&))))*&))))**))))))", "))))';*$>,';&%>'';&&>'';%&>'))))", ")))))@ ;'. ,'. ,'. ,))))", "))))); $))= &))= &))* &)))))", "))))))#.')))++')))++')))++))))))", ")))))),=))));-))));-))))-;))))))", "))))))))))))))))))))))))))))))))", "))))),,,,,,,,,,,,,,,,,,,,,,)))))", "))))'$;;;;;;;;;&*;;;;;;;;;$)))))", "))))% '))))))))+#))))))))> *))))", "))), $)))))))* ;)))))))@ .')))", ")))# >)))))'. +))))))- %)))", "))- #)))))$ *))))'+ ,))", ")'+ -)))> .')))& #))", ")>%%%%$$*)))=%%%%$$;)))&%%%%$$')", "))))))))))))))))))))))))))))))))", "))))))))))))))))))))))))))))))))", "))))))))))))))))))))))))))))))))", "))))))))))))))))))))))))))))))))", "))))))))))))))))))))))))))))))))", "))))))))))))))))))))))))))))))))"}; cba-0.3.6/src/gui/cbaGUI.cpp000066400000000000000000001534461142227325100154320ustar00rootroot00000000000000//cbaGUI.cpp #include "cbaGUI.h" //--------------- MainApp --------------- IMPLEMENT_APP(MainApp) bool MainApp::OnInit() { wxString title(_T("wxCBA")); #ifdef __WXGTK__ title = _T("cba-gtk"); #endif frame = new MainFrame(title); frame->Show(TRUE); SetTopWindow(frame); return TRUE; } int MainApp::OnExit() { return 0; } //--------------- MainFrame --------------- BEGIN_EVENT_TABLE(MainFrame, wxFrame) EVT_MENU(ID_QUIT, MainFrame::OnQuit) EVT_MENU(ID_INFO, MainFrame::OnInfo) EVT_MENU(ID_NEW, MainFrame::OnNewBeam) EVT_MENU(ID_OPEN, MainFrame::OnOpenFile) EVT_MENU(ID_SAVE, MainFrame::OnSaveInput) EVT_MENU(ID_SET, MainFrame::OnSettings) EVT_BUTTON(ID_BT_SP_ADD, MainFrame::OnSpanAdd) EVT_BUTTON(ID_BT_SP_DEL, MainFrame::OnSpanDel) EVT_BUTTON(ID_BT_EI, MainFrame::OnSetEI) EVT_BUTTON(ID_BT_RST, MainFrame::OnSetRst) EVT_BUTTON(ID_BT_LD_ADD, MainFrame::OnLoadAdd) EVT_BUTTON(ID_BT_LD_DEL, MainFrame::OnLoadDel) EVT_BUTTON(ID_BT_LD_FAC, MainFrame::OnSetLF) EVT_CHECKBOX(ID_CHK_SW, MainFrame::OnChkSw) EVT_BUTTON(ID_BT_COPY, MainFrame::OnClipRes) EVT_BUTTON(ID_BT_SAVE, MainFrame::OnSaveRes) EVT_BUTTON(ID_BT_PRINT, MainFrame::OnPrint) EVT_GRID_CELL_CHANGE(MainFrame::OnCellInputGrid) EVT_NOTEBOOK_PAGE_CHANGED(ID_NB_RES, MainFrame::OnSysPage) EVT_NOTEBOOK_PAGE_CHANGED(ID_NB_INP, MainFrame::OnLoadPage) EVT_RADIOBUTTON(wxID_ANY, MainFrame::OnRadioButton) END_EVENT_TABLE() MainFrame::MainFrame(const wxString& title) : wxFrame(NULL, wxID_ANY, title) { //set defaults Store.E=1.0; Store.I=1.0; wxString setDir = wxGetCwd(); #ifdef __WXGTK__ //change to user home dir in linux setDir = wxFileName::GetHomeDir()+wxFileName::GetPathSeparator()+_T(".cba"); if (!wxFileName::DirExists(setDir)) wxMkdir(setDir); //set decimal point to "." setlocale(LC_NUMERIC, "C"); #endif //read values stored in settings.xml wxString setFile = setDir+wxFileName::GetPathSeparator()+_T("settings.xml"); SettingsDialog *dialog = new SettingsDialog(this, -1, _T(""), setFile); SetDefaults(dialog->GetItems()); CreateGUIControls(); } MainFrame::~MainFrame() { } void MainFrame::CreateGUIControls() { //Main window SetBackgroundColour(wxColour(*wxWHITE)); SetSize(50, 50, 600, 600); //Icon SetIcon(wxIcon(cba_xpm)); //Menu wxMenu *menuFile = new wxMenu; menuFile->Append(ID_NEW, _T("Create &New Beam") ); menuFile->AppendSeparator(); menuFile->Append(ID_OPEN, _T("Open &Input File") ); menuFile->Append(ID_SAVE, _T("&Save Input Data") ); menuFile->AppendSeparator(); menuFile->Append(ID_SET, _T("Se&ttings") ); menuFile->AppendSeparator(); menuFile->Append(ID_QUIT, _T("E&xit") ); wxMenu *menuAbout = new wxMenu; menuAbout->Append(ID_INFO, _T("A&bout") ); wxMenuBar *menuBar = new wxMenuBar; menuBar->Append( menuFile, _T("&File") ); menuBar->Append( menuAbout, _T("&Info") ); SetMenuBar( menuBar ); //input grids NbInp = new wxNotebook(this, ID_NB_INP, wxDefaultPosition, wxSize(600,150), wxNB_BOTTOM); udl_Grid = new wxGrid(NbInp, -1, wxPoint(0,0), wxDefaultSize); pl_Grid = new wxGrid(NbInp, -1, wxPoint(0,0), wxDefaultSize); pudl_Grid = new wxGrid(NbInp, -1, wxPoint(0,0), wxDefaultSize); ml_Grid = new wxGrid(NbInp, -1, wxPoint(0,0), wxDefaultSize); tz_Grid = new wxGrid(NbInp, -1, wxPoint(0,0), wxDefaultSize); ptr_Grid = new wxGrid(NbInp, -1, wxPoint(0,0), wxDefaultSize); for (int i=0; i<6; i++) { wxArrayString rows; rows.Add(_T("l=")); switch (i) { case 0: grid=udl_Grid; rows.Add(_T("g:")); rows.Add(_T("q:")); break; case 1: grid=pl_Grid; rows.Add(_T("G:")); rows.Add(_T("Q:")); rows.Add(_T("a=")); break; case 2: grid=pudl_Grid; rows.Add(_T("g\':")); rows.Add(_T("q\':")); rows.Add(_T("a=")); rows.Add(_T("l\'=")); break; case 3: grid=ml_Grid; rows.Add(_T("Mg:")); rows.Add(_T("Mq:")); rows.Add(_T("a=")); break; case 4: grid=tz_Grid; rows.Add(_T("g:")); rows.Add(_T("q:")); rows.Add(_T("a=")); rows.Add(_T("l\'=")); break; case 5: grid=ptr_Grid; rows.Add(_T("g\':")); rows.Add(_T("q\':")); rows.Add(_T("a=")); rows.Add(_T("l\'=")); break; } grid->CreateGrid(0,0,wxGrid::wxGridSelectCells); grid->SetLabelBackgroundColour(*wxWHITE); grid->SetColLabelSize(20); grid->SetRowLabelSize(40); grid->SetDefaultColSize(50); grid->SetDefaultRowSize(20); grid->SetDefaultCellAlignment(wxALIGN_CENTRE, wxALIGN_CENTRE ); grid->AppendCols(1); grid->SetColLabelValue(0, _T("1")); grid->AppendRows(rows.GetCount()); grid->SetCellBackgroundColour(0, 0, wxColour(255,255,150,255)); for (size_t j=0; jSetRowLabelValue(j, rows[j]); } wxImageList *images = new wxImageList(24,16); images->Add(wxIcon(udl_xpm)); images->Add(wxIcon(pl_xpm)); images->Add(wxIcon(pudl_xpm)); images->Add(wxIcon(ml_xpm)); images->Add(wxIcon(tz_xpm)); images->Add(wxIcon(ptr_xpm)); NbInp->SetImageList(images); NbInp->AddPage(udl_Grid, _T("p"), true, 0); NbInp->AddPage(pl_Grid, _T("P"), false, 1); NbInp->AddPage(pudl_Grid, _T("p\'"), false, 2); NbInp->AddPage(ml_Grid, _T("M"), false, 3); NbInp->AddPage(tz_Grid, _T("tz"), false, 4); NbInp->AddPage(ptr_Grid, _T("tr\'"), false, 5); grid=udl_Grid; grid->SetFocus(); //input buttons wxPanel *PanelBtLd = new wxPanel(this, -1, wxDefaultPosition, wxSize(340,40)); BtLdDel = new wxButton(PanelBtLd, ID_BT_LD_DEL, _T("-load"), wxPoint(0,0), wxSize(50,25)); BtLdAdd = new wxButton(PanelBtLd, ID_BT_LD_ADD, _T("+load"), wxPoint(60,0), wxSize(50,25)); BtLdFac = new wxButton(PanelBtLd, ID_BT_LD_FAC, _T("LF"), wxPoint(130,0), wxSize(40,25)); ChkSw = new wxCheckBox(PanelBtLd, ID_CHK_SW, _T("self-weight"), wxPoint(200,0), wxSize(95,25)); ChkSw->Show(false); wxPanel *PanelBtGeo = new wxPanel(this, -1, wxDefaultPosition, wxSize(240,40)); BtEI = new wxButton(PanelBtGeo, ID_BT_EI, _T("EI"), wxPoint(0,0), wxSize(40,25)); BtRst = new wxButton(PanelBtGeo, ID_BT_RST, _T("R"), wxPoint(50,0), wxSize(40,25)); BtSpDel = new wxButton(PanelBtGeo, ID_BT_SP_DEL, _T("-span"), wxPoint(110,0), wxSize(50,25)); BtSpAdd = new wxButton(PanelBtGeo, ID_BT_SP_ADD, _T("+span"), wxPoint(170,0), wxSize(50,25)); wxBoxSizer *H1sizer = new wxBoxSizer(wxHORIZONTAL); H1sizer->Add(PanelBtLd, 1, wxTOP, 10); H1sizer->Add(PanelBtGeo, 0, wxALIGN_RIGHT | wxTOP, 10); wxBoxSizer *V1sizer = new wxBoxSizer(wxVERTICAL); V1sizer->Add(NbInp, 1, wxEXPAND | wxALL, 10); V1sizer->Add(H1sizer, 0, wxEXPAND | wxBOTTOM | wxLEFT | wxRIGHT, 10); //choice forces/stresses wxPanel *PanelFS = new wxPanel(this, -1, wxDefaultPosition, wxSize(340,40)); BtFc = new wxRadioButton(PanelFS, ID_BT_FC, _T("Forces"), wxPoint(5,0), wxSize(60,25), wxRB_SINGLE); BtSt = new wxRadioButton(PanelFS, ID_BT_ST, _T("Stresses"), wxPoint(80,0), wxSize(80,25), wxRB_SINGLE); BtFc->SetValue(true); //results NbRes = new wxNotebook(this, ID_NB_RES, wxDefaultPosition, wxSize(600,340), wxNB_BOTTOM); system = new GraphFrame; system->Create(NbRes, -1, wxDefaultPosition, wxDefaultSize, wxVSCROLL); system->SetBackgroundColour(wxColour(*wxWHITE)); system->SetType(0); graph = new GraphFrame; graph->Create(NbRes, -1, wxDefaultPosition, wxDefaultSize, wxVSCROLL); graph->SetBackgroundColour(wxColour(*wxWHITE)); graph->SetType(1); TcRes = new wxTextCtrl(NbRes, ID_TC_RES, _T(""), wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE); NbRes->AddPage(system, _T("System")); NbRes->AddPage(graph, _T("Graph")); NbRes->AddPage(TcRes, _T("Results")); NbRes->SetSelection(1); NbRes->SetSelection(0); //result buttons wxPanel *PanelBtRes = new wxPanel(this, -1, wxDefaultPosition, wxSize(240,40)); BtCopy = new wxBitmapButton(PanelBtRes, ID_BT_COPY, wxBitmap(copy_xpm), wxPoint(0,0), wxSize(50,25)); BtSave = new wxBitmapButton(PanelBtRes, ID_BT_SAVE, wxBitmap(save_xpm), wxPoint(60,0), wxSize(50,25)); BtPrint = new wxBitmapButton(PanelBtRes, ID_BT_PRINT, wxBitmap(print_xpm), wxPoint(120,0), wxSize(50,25)); wxBoxSizer *H2sizer = new wxBoxSizer(wxHORIZONTAL); H2sizer->Add(PanelFS, 1, wxTOP, 10); H2sizer->Add(PanelBtRes, 0, wxALIGN_RIGHT | wxTOP, 10); wxBoxSizer *V2sizer = new wxBoxSizer(wxVERTICAL); V2sizer->Add(NbRes, 1, wxEXPAND | wxALL, 10); V2sizer->Add(H2sizer, 0, wxEXPAND | wxBOTTOM | wxLEFT | wxRIGHT, 10); wxBoxSizer *Vsizer = new wxBoxSizer(wxVERTICAL); Vsizer->Add(V1sizer, 0, wxEXPAND | wxTOP | wxLEFT | wxRIGHT, 20); Vsizer->Add(V2sizer, 1, wxEXPAND | wxBOTTOM | wxLEFT | wxRIGHT, 20); SetSizer(Vsizer); Vsizer->SetSizeHints(this); //Statusbar CreateStatusBar(); SetStatusText( _T("continuous beam analysis") ); } void MainFrame::OnQuit(wxCommandEvent& event) { Close(TRUE); } void MainFrame::OnInfo(wxCommandEvent &event) { wxString info = _T("cba 0.3.6"); info+=_T("\ncontinuous beam analysis"); info+=_T("\nhttp://cbeam.sourceforge.net/"); wxMessageBox(info, _T("About"), wxOK , this); } //--------------- create a new beam by user dialog --------------- void MainFrame::OnNewBeam(wxCommandEvent& event) { wxArrayString items; BeamDialog *dialog = new BeamDialog(this, -1, _T("Create New Beam:")); if (dialog->ShowModal()) items = dialog->GetItems(); if (items.GetCount()>3) { long int nf; items[0].ToLong(&nf); double l; ChkValue(items[1]).ToDouble(&l); if (nf>0 && l>0) { Store.L.clear(); Store.LMg.clear(); Store.LMq.clear(); for (int i=0; i ld(5,0); ld[0]=i+1; ld[1]=1; ld[2]=p; if (lc==0) Store.LMg.push_back(ld); if (lc==1) Store.LMq.push_back(ld); } } } //set defaults Store.E=1.0; Store.I=1.0; Store.R.clear(); for (int i=0; i<(nf+1*2); i++) if (i%2==0) Store.R.push_back(-1); else Store.R.push_back(0); FillInputGrids(); Solve(); } } } //--------------- open file for input data --------------- void MainFrame::OnOpenFile(wxCommandEvent& event) { wxArrayString text; wxFileDialog *openFileDialog = new wxFileDialog(this,_T("Open Input File:"), _T(""), _T(""), _T("*"), wxFD_OPEN); if (openFileDialog->ShowModal() == wxID_OK) { wxString fileName = openFileDialog->GetPath(); wxTextFile *txtFile = new wxTextFile(fileName); if (txtFile->Exists()) { txtFile->Open(); for (size_t line=0; lineGetLineCount(); line++) text.Add(txtFile->GetLine(line)); txtFile->Close(); } //converting text to values vector L; double E(1), I(1); vector R; vector F; vector< vector > LM; for (int i=0; i0) { wxString head(cut[0]); if (head.Len()>3) head=head.Left(4); vector val; for (int j=1; j0) L.push_back(val[k]); if (head==_T("ELAS")) if (val.size()>0) E=val[0]; if (head==_T("INER")) if (val.size()>0) I=val[0]; if (head==_T("CONS")) for (int k=0; k ld; for (int k=0; k0) LM.push_back(ld); } //gui values if (head==_T("UNIT")) { if (cut.GetCount()>1) Store.fcUnit=cut[1]; if (cut.GetCount()>2) Store.lnUnit=cut[2]; } if (head==_T("MATE")) { if (cut.GetCount()>1) Store.Mat=cut[1]+spc; if (cut.GetCount()>2) Store.Mat+=cut[2]; } if (head==_T("SECT")) { Store.Sec.Empty(); for (int j=1; jSetDbLoc(Store.dbMat, Store.dbSec); dialog->SetUnits(Store.fcUnit, Store.lnUnit); dialog->SetMat(Store.Mat); dialog->SetSec(Store.Sec); SetMatSec(dialog->GetItems()); } if (head==_T("SELF")) { if (cut.GetCount()>1) if (cut[1]==_T("YES")) ChkSw->SetValue(true); else ChkSw->SetValue(false); } } } } //use the first inertia for the whole beam vector Ivec; for (int i=0; iSetGeometry(L,E,Ivec,R)) { vector< vector > geo(4); geo=bm->GetGeometry(); Store.L=bm->GetGeometry()[0]; Store.E=bm->GetGeometry()[1][0]; Store.I=bm->GetGeometry()[2][0]; Store.R=bm->GetGeometry()[3]; if (bm->SetLoads(LM)) { Store.LMg=bm->GetLoadsG(); Store.LMq=bm->GetLoadsQ(); } FillInputGrids(); Solve(); } else wxMessageBox(_T("This file seems to be not valid, try again."), _T("Input File Reading Failure"), wxOK); delete bm; } } //--------------- save input data --------------- void MainFrame::OnSaveInput(wxCommandEvent& event) { wxFileDialog *saveFileDialog = new wxFileDialog(this,_T("Save Input To:"), _T(""), _T("*.txt"), _T("*.txt"), wxFD_SAVE); if (saveFileDialog->ShowModal() == wxID_OK) { wxString fileName = saveFileDialog->GetPath(); wxString saveDir = wxFileName(fileName).GetPath(); wxTextFile *File = new wxTextFile; File->Create(fileName); wxString txt, line; line=_T("#cba input file"); File->AddLine(line); if (Store.L.size()>0) { line=_T("SPANS"); for (size_t i=0; iAddLine(line); } if (Store.E!=1) { line.Printf(_T("ELASTICITY %4.2e"), Store.E); File->AddLine(line); } if (Store.I!=1) { line.Printf(_T("INERTIA %4.2e"), Store.I); File->AddLine(line); } if (Store.R.size()>0) { line=_T("CONSTRAINTS"); for (size_t i=0; iAddLine(line); } //dont save self weight size_t start(0); if (ChkSw->IsChecked()) start=Store.L.size(); for (size_t i=start; iAddLine(line); } for (size_t i=0; iAddLine(line); } if (!Store.ldFac.IsEmpty()) File->AddLine(_T("FACTORS ")+Store.ldFac); if (!Store.Mat.IsEmpty() && !Store.Sec.IsEmpty()) { File->AddLine(_T("#gui values - ignored by cba")); File->AddLine(_T("UNITS ")+Store.fcUnit+_T(" ")+Store.lnUnit); File->AddLine(_T("MATERIAL ")+Store.Mat); File->AddLine(_T("SECTION ")+Store.Sec); if (ChkSw->IsChecked()) File->AddLine(_T("SELFWT YES")); else File->AddLine(_T("SELFWT NO")); } File->Write(); File->Close(); wxMessageBox(_T("Input data saved to ")+fileName, _T("File saved"), wxOK); } } //--------------- change global settings --------------- void MainFrame::OnSettings(wxCommandEvent& event) { wxString setDir = wxGetCwd(); #ifdef __WXGTK__ //change to user home dir in linux setDir = wxFileName::GetHomeDir()+wxFileName::GetPathSeparator()+_T(".cba"); #endif //read values stored in settings.xml wxArrayString items; wxString setFile = setDir+wxFileName::GetPathSeparator()+_T("settings.xml"); SettingsDialog *dialog = new SettingsDialog(this, -1, _T("Global Settings"), setFile); if (dialog->ShowModal()) items = dialog->GetItems(); if (!items.IsEmpty()) { SetDefaults(items); Solve(); } } void MainFrame::SetDefaults(wxArrayString items) { if (!items.IsEmpty()) { for (size_t i=0; i0 double l; wxString lStr=grid->GetCellValue(0, grid->GetNumberCols()-1); lStr.ToDouble(&l); if (l>0) { addCols(udl_Grid, 1); addCols(pl_Grid, 1); addCols(pudl_Grid, 1); addCols(ml_Grid, 1); addCols(tz_Grid, 1); addCols(ptr_Grid, 1); Solve(); } } void MainFrame::OnSpanDel(wxCommandEvent& event) { addCols(udl_Grid, -1); addCols(pl_Grid, -1); addCols(pudl_Grid, -1); addCols(ml_Grid, -1); addCols(tz_Grid, -1); addCols(ptr_Grid, -1); Solve(); } void MainFrame::OnSetEI(wxCommandEvent& event) { MatSecDialog *dialog = new MatSecDialog(this, -1, _T("Set Material/Section:")); dialog->SetDbLoc(Store.dbMat, Store.dbSec); dialog->SetUnits(Store.fcUnit, Store.lnUnit); dialog->SetMat(Store.Mat); dialog->SetSec(Store.Sec); wxArrayString items; if (dialog->ShowModal()) items = dialog->GetItems(); SetMatSec(items); Solve(); } void MainFrame::SetMatSec(wxArrayString items) { for (size_t i=0; i0) val=1.0; Store.E=val; break; //elasticity case 1: Store.g0=val; break; //density case 2: Store.g0*=val; break; //area case 3: if (!val>0) val=1.0; Store.I=val; break; //inertia case 4: Store.Wy=val; break; //sec modulus case 5: Store.Az=val; break; //shear area case 6: Store.Mat=vStr; break; //material case 7: Store.Sec=vStr; break; //section } } //show selfweight checkbox if (Store.g0>0) ChkSw->Show(true); else { ChkSw->SetValue(false); ChkSw->Show(false); } //show force/stress buttons if (NbRes->GetSelection()==1 && Store.Wy*Store.Az>0) { BtFc->Show(true); BtSt->Show(true); //resize the window to show wxSize sz = this->GetClientSize(); sz.SetHeight(sz.GetHeight()+1); this->SetClientSize(sz); } else { BtFc->SetValue(true); BtSt->SetValue(false); BtFc->Show(false); BtSt->Show(false); } } void MainFrame::OnSetRst(wxCommandEvent& event) { if (int(Store.L.size())>0) { wxArrayString labels; labels.Add(_T("def")); labels.Add(_T("rot")); wxArrayString defaults; for (int i=0; iShowModal()) items = dialog->GetValues(); if (items.GetCount()>0) { Store.R.clear(); for (size_t i=0; iGetSelection()) { case 0: rows=2; break; case 1: rows=3; break; case 2: rows=4; break; case 3: rows=3; break; case 4: rows=4; break; case 5: rows=4; break; } addRows(rows); } void MainFrame::OnLoadDel(wxCommandEvent& event) { int rows(0); switch (NbInp->GetSelection()) { case 0: rows=2; break; case 1: rows=3; break; case 2: rows=4; break; case 3: rows=3; break; case 4: rows=4; break; case 5: rows=4; break; } if (grid->GetNumberRows()>rows+1) addRows(-rows); else { for (int i=0; iGetNumberCols(); i++) for (int j=1; j<=grid->GetNumberRows(); j++) grid->SetCellValue(j, i, _T("")); Solve(); } } void MainFrame::OnSetLF(wxCommandEvent& event) { wxString factors; LoadFactorDialog *dialog = new LoadFactorDialog(this, -1, _T("Set Load Factors:"), Store.ldFac); if (dialog->ShowModal()) factors = dialog->GetFactors(); if (!factors.IsEmpty()) { Store.ldFac=factors; Solve(); } else if (!Store.ldFac.IsEmpty()) { Store.ldFac.Empty(); Solve(); } } void MainFrame::OnChkSw(wxCommandEvent& event) { Solve(); } //--------------- output --------------- void MainFrame::OnClipRes(wxCommandEvent& event) { TcRes->SetSelection(-1, -1); TcRes->Copy(); TcRes->SetInsertionPoint(0); wxMessageBox(_T("Results were copied successfully to clipboard."), _T("Clipboard"), wxOK); } void MainFrame::OnSaveRes(wxCommandEvent& event) { wxArrayString txtLines; wxString saveWhat; //save plot data if graph is selected if (NbRes->GetSelection()==1) { txtLines=CreatePlotTable(); saveWhat=_T("Plot Data"); } else { for (int i=0; iGetNumberOfLines(); i++) txtLines.Add(TcRes->GetLineText(i)); saveWhat=_T("Results"); } wxFileDialog *saveFileDialog = new wxFileDialog(this,_T("Save ")+saveWhat+_T(" To:"), _T(""), _T("*.txt"), _T("*.txt"), wxFD_SAVE); if (saveFileDialog->ShowModal() == wxID_OK) { wxString fileName = saveFileDialog->GetPath(); wxTextFile *txtFile = new wxTextFile; txtFile->Create(fileName); for (size_t i=0; iAddLine(txtLines[i]); txtFile->Write(); txtFile->Close(); wxMessageBox(saveWhat+_T(" saved successfully to ")+wxFileName(fileName).GetFullName(), _T("Save"), wxOK); } } void MainFrame::OnPrint(wxCommandEvent& event) { wxPrintDialogData printDialogData; wxPrintPreview *preview = new wxPrintPreview(new PrintFrame, new PrintFrame, &printDialogData); if (!preview->Ok()) { delete preview; wxMessageBox(_T("Maybe printer is not set correctly?"), _T("Printing"), wxOK); return; } wxPreviewFrame *frame = new wxPreviewFrame(preview, this, _T("Print Preview"), wxPoint(100, 100), wxSize(600, 650)); frame->Centre(wxBOTH); frame->Initialize(); frame->Show(); } void MainFrame::OnSysPage(wxNotebookEvent& event) { bool rb(true); if (Store.Wy*Store.Az==0) rb=false; switch (event.GetSelection()) { case 0: rb=false; break; case 1: graph->SetType(1+(int)BtSt->GetValue()); break; case 2: rb=false; break; } BtFc->Show(rb); BtSt->Show(rb); if (rb) { //resize the window to show the buttons wxSize sz = this->GetClientSize(); sz.SetHeight(sz.GetHeight()+1); this->SetClientSize(sz); } } void MainFrame::OnRadioButton(wxCommandEvent& event) { int id = event.GetId(); bool set(true); if (id==ID_BT_FC) set=false; BtFc->SetValue(!set); BtSt->SetValue(set); graph->SetType(1+(int)set); } void MainFrame::OnLoadPage(wxNotebookEvent& event) { switch (event.GetSelection()) { case 0: grid=udl_Grid; break; case 1: grid=pl_Grid; break; case 2: grid=pudl_Grid; break; case 3: grid=ml_Grid; break; case 4: grid=tz_Grid; break; case 5: grid=ptr_Grid; break; } grid->SetFocus(); } void MainFrame::OnCellInputGrid(wxGridEvent& event) { int row = event.GetRow(); int col = event.GetCol(); wxString val=grid->GetCellValue(row,col); //change span length in all grids if (row==0) { udl_Grid->SetCellValue(0, col, ChkValue(val)); pl_Grid->SetCellValue(0, col, ChkValue(val)); pudl_Grid->SetCellValue(0, col, ChkValue(val)); ml_Grid->SetCellValue(0, col, ChkValue(val)); tz_Grid->SetCellValue(0, col, ChkValue(val)); ptr_Grid->SetCellValue(0, col, ChkValue(val)); } else grid->SetCellValue(row, col, ChkValue(val)); Solve(); } //--------------- solve using cbeam_class --------------- void MainFrame::Solve() { //get input values vector< vector > LM = ReadInput(); //add self weight if chosen if (ChkSw->IsChecked()) { system->SetSW(true); vector< vector > g; for (size_t i=0; i ld; ld.push_back(double(i+1)); //nr span ld.push_back(1.0); //load type = 1 (udl) ld.push_back(Store.g0); //load value = g0 g.push_back(ld); } //push it in front for (size_t i=0; iSetSW(false); } //construct beam object cBeam *bm = new cBeam(); //set geometry vector I; for (size_t i=0; iClear(); system->Clear(); graph->Clear(); if (bm->SetGeometry(Store.L, Store.E, I, Store.R)) { //get geometry values checked by cbeam class vector< vector > geometry = bm->GetGeometry(); if (int(geometry.size())>3) { Store.L=geometry[0]; Store.E=geometry[1][0]; Store.I=geometry[2][0]; Store.R=geometry[3]; } if (bm->SetLoads(LM)) { //enter checked loads into results Store.LMg=bm->GetLoadsG(); Store.LMq=bm->GetLoadsQ(); //solve the analysis problem bm->Solve(); vector< vector > results = bm->GetResults(); system->SetSystem(Store.L, Store.R, Store.LMg, Store.LMq); graph->SetSystem(Store.L, Store.R, Store.LMg, Store.LMq); if (Store.E*Store.I!=1) graph->SetEI(true); else graph->SetEI(false); graph->SetSec(Store.Wy, Store.Az); graph->SetLF(false); graph->SetResults(results); wxArrayString chRes, dsRes; chRes = resOut(bm->GetMax(), bm->GetReaction()); //if factors are given if (!Store.ldFac.IsEmpty()) { vector lf; wxString fStr(Store.ldFac); while (!fStr.IsEmpty()) { wxString vStr = fStr.BeforeFirst(_T(' ')); fStr=fStr.AfterFirst(_T(' ')); double val; vStr.ToDouble(&val); lf.push_back(val); } if (lf.size()>1) bm->SetLoadFactors(lf[0], lf[1]); if (lf.size()>3) bm->SetLoadFactors(lf[0], lf[1], lf[2], lf[3]); bm->Solve(); dsRes = resOut(bm->GetMax(), bm->GetReaction()); //change the result matrix for M/V graph for (size_t i=1; i<5; i++) results[i]=bm->GetResults()[i]; graph->SetLF(true); graph->SetResults(results); } UpdateResultText(chRes, dsRes, strOut(bm->GetMax())); } for (size_t i=0; iAppendText(Store.resTxt[i]+_T("\n")); TcRes->SetInsertionPoint(0); int nf = int(Store.L.size()); int nl = int(Store.LMg.size()+Store.LMq.size()); if (ChkSw->IsChecked()) nl-=nf; wxString sts; sts.Printf(_T("continuous beam %d spans %d loads"),nf, nl); if (nf==1) sts.Printf(_T("single-span beam %d loads"),nl); SetStatusText(sts); } else TcRes->AppendText(_T("problem could not be solved\ncheck geometry and/or loads\n")); delete bm; } vector< vector > MainFrame::ReadInput() { Store.L.clear(); vector< vector > LM; int n=grid->GetNumberCols(); for (int i=0; iGetCellValue(0, i); clStr.ToDouble(&d); Store.L.push_back(d); //building the load matrix for this span vector ld; wxGrid *ldGrid(grid); int nl(0); for (int j=0; j<6; j++) { switch (j) { case 0: ldGrid=udl_Grid; nl=2; break; case 1: ldGrid=pl_Grid; nl=3; break; case 2: ldGrid=pudl_Grid; nl=4; break; case 3: ldGrid=ml_Grid; nl=3; break; case 4: ldGrid=tz_Grid; nl=4; break; case 5: ldGrid=ptr_Grid; nl=4; break; } int nrLoads = (ldGrid->GetNumberRows()-1)/nl; for (int k=0; kGetCellValue(k*nl+r, i); clStr.ToDouble(&d); ld.push_back(d); } LM.push_back(ld); } } } return LM; } void MainFrame::UpdateResultText(wxArrayString chRes, wxArrayString dsRes, wxString strRes) { wxArrayString resTxt; wxString nStr, line; //add span numbers int nf = int(Store.L.size()); nStr.Printf(_T("continuous beam %d spans:"),nf); if (nf==1) nStr.Printf(_T("single-span beam:")); resTxt.Add(nStr); //add span lengths line=_T("l:"); for (int i=0; i0) { resTxt.Add(_T("")); resTxt.Add(_T("permanent loads:")); for (size_t i=0; i0) { resTxt.Add(_T("")); resTxt.Add(_T("live loads:")); for (size_t i=0; i > LM) { wxString line, unit, valStr; wxArrayString output; //find number of loaded spans int nf=0; for (size_t i=0; inf) nf=int(LM[i][0]); vector< vector > ldvalue(nf); vector< vector > ldstart(nf); vector< vector > ldlen(nf); //create output string for different load types for (int lt=1; lt<=6; lt++) { for (int i=0; imax) max=int(ldvalue[i].size()); for (int k=0; kk) { valStr.Printf(_T("%4.2f"),ldvalue[i][k]); line+=(_T("\t")+valStr); } else line+=(_T("\t")); } line+=_T("\t")+unit; output.Add(line); //add start point for load type 2-6 if (lt>1) { line = _T(" a="); for (int i=0; ik) { valStr.Printf(_T("%4.2f"),ldstart[i][k]); line+=(_T("\t")+valStr); } else line+=(_T("\t")); } line+=_T("\t")+Store.lnUnit; output.Add(line); } //add len for load type 3, 5 and 6 if (lt==3 || lt>=5) { line = _T(" l\'="); for (int i=0; ik) { valStr.Printf(_T("%4.2f"),ldlen[i][k]); line+=(_T("\t")+valStr); } else line+=(_T("\t")); } line+=_T("\t")+Store.lnUnit; output.Add(line); } } } return output; } //--------------- prepare max/min results for output --------------- wxArrayString MainFrame::resOut(vector< vector > maxValues, vector< vector > reactions) { wxString line, unit; wxArrayString output; //max/min results for (int j=1; j > maxValues) { wxString line; size_t n = maxValues.size(); //Mmax, Mmin -> Sigma if (Store.Wy>0 && n>2) { line+= _T("\nSigma:"); size_t m = maxValues[1].size(); if (maxValues[2].size()v) v=-maxValues[2][i]; v/=Store.Wy; wxString rStr; if (v>1000) rStr.Printf(_T("%4.1fk"),v/1000); else rStr.Printf(_T("%4.1f"),v); line+=_T("\t")+rStr; } line+=(_T("\t")+Store.fcUnit+_T("/")+Store.lnUnit+_T("2")); } //Vmax, Vmin -> Tau if (Store.Az>0 && n>4) { line+= _T("\nTau:"); size_t m = maxValues[3].size(); if (maxValues[4].size()v) v=-maxValues[4][i]; v/=Store.Az; wxString rStr; if (v>1000) rStr.Printf(_T("%4.1fk"),v/1000); else rStr.Printf(_T("%4.1f"),v); line+=_T("\t")+rStr; } line+=(_T("\t")+Store.fcUnit+_T("/")+Store.lnUnit+_T("2")); } return line; } //--------------- create results along the beam --------------- wxArrayString MainFrame::CreatePlotTable() { wxString line, valStr; wxArrayString output; //design values if factors are given if (!Store.ldFac.IsEmpty()) line=(_T("#x\tMdmax\tMdmin\tVdmax\tVdmin\tdmax\tdmin")); else line=(_T("#x\tMmax\tMmin\tVmax\tVmin\tdmax\tdmin")); output.Add(line); int nf=int(Store.L.size()); vector< vector > results = graph->GetResults(); if (results.size()>6) { for (int i=0;iDeleteCols(0, grid->GetNumberCols()); if (grid->GetNumberRows()>rows+1) grid->DeleteRows(rows+1, grid->GetNumberRows()); grid->ClearGrid(); for (int i=0; iSetCellValue(0, i, lStr); //build a matrix for loads on this span vector< vector > spanLd; for (int lc=0; lc<2; lc++) { vector< vector > LM; switch (lc) { case 0: LM=Store.LMg; break; case 1: LM=Store.LMq; break; } for (int k=0; k sl(4,0); sl[0+lc]=ld; sl[2]=a; sl[3]=b; spanLd.push_back(sl); } } } } //fill in loads int row(1); for (int k=row; kGetNumberRows(); k++) grid->SetCellValue(k, i, _T("")); for (int k=0; kGetCellValue(row,i)+grid->GetCellValue(row+1,i); clStr.ToDouble(&d); if (d!=0) { addRows(rows); row+=rows; } grid->SetCellValue(row, i, g); grid->SetCellValue(row+1, i, q); if (rows>2) grid->SetCellValue(row+2, i, a); if (rows>3) grid->SetCellValue(row+3, i, b); } } } grid=udl_Grid; grid->MovePageUp(); grid->SetGridCursor(0,0); NbInp->SetSelection(0); } void MainFrame::addCols(wxGrid *Grid, int n) { int oldNr = Grid->GetNumberCols(); int newNr = oldNr+n; if (newNr > oldNr) //extend { for (int i=oldNr+1; i<=newNr; i++) { wxString nrStr; nrStr.Printf(_T("%d"),i); Grid->AppendCols(1); Grid->SetColLabelValue(i-1, nrStr); Grid->SetCellBackgroundColour(0, i-1, wxColour(255,255,150,255)); if (i>1) // clone previous { for (int j=0; j<=Grid->GetNumberRows(); j++) { Grid->SetCellValue(j, i-1, Grid->GetCellValue(j, i-2)); Grid->SetCellBackgroundColour(j, i-1, Grid->GetCellBackgroundColour(j, i-2)); } } } } if (newNr < oldNr) //implode { if (newNr>0) for (int i=oldNr-1; i>=newNr; i--) Grid->DeleteCols(i); } Grid->SetGridCursor(0, newNr-1); Grid->SetFocus(); } void MainFrame::addRows(int n) { int oldNr = grid->GetNumberRows(); int newNr = oldNr+n; wxColour bg_colour(250,225,200,255); if (grid->GetCellBackgroundColour(oldNr-1, 0)==bg_colour) bg_colour=wxColour(*wxWHITE); if (newNr > oldNr) //extend { //it would make no sense to add too many empty rows wxString clStr; for (int i=oldNr-n; iGetNumberCols(); j++) clStr+=grid->GetCellValue(i, j); if (!clStr.IsEmpty()) { for (int i=oldNr; in) label=grid->GetRowLabelValue(i-n); grid->AppendRows(1); grid->SetRowLabelValue(i, label); for (int j=0; jGetNumberCols(); j++) grid->SetCellBackgroundColour(i, j, bg_colour); } grid->MovePageDown(); grid->SetGridCursor(oldNr, 0); } } if (newNr < oldNr) //implode { if (newNr>1) { for (int i=oldNr-1; i>=newNr; i--) grid->DeleteRows(i); grid->MovePageUp(); grid->SetGridCursor(newNr-1, 0); Solve(); } } grid->SetFocus(); } wxString MainFrame::ChkValue(wxString valStr) { wxString chkStr(valStr); //entered commas will be changed to points if (chkStr.Find(_T(",")) > -1) chkStr.Replace( _T(","),_T(".") ); double d; chkStr.ToDouble(&d); chkStr.Empty(); chkStr.Printf(_T("%4.2f"),d); return chkStr; } int MainFrame::Draw(wxDC& dc, wxRect bounds, int type) { //this is for printout int ratio(1); switch (type) { case 0 : ratio = graph->DrawHead(dc, bounds, Store.Head); break; case 1 : ratio = system->DrawSystem(dc, bounds, 0); break; case 2 : ratio = graph->DrawResultText(dc, bounds, Store.resTxt); break; case 3 : graph->DrawResults(dc, bounds, 0); break; case 4 : graph->DrawResults(dc, bounds, 1); break; case 5 : graph->DrawResults(dc, bounds, 2); break; } return ratio; } //---------------- PrintFrame ------------------------- void PrintFrame::GetPageInfo(int *minPage, int *maxPage, int *selPageFrom, int *selPageTo) { *minPage = 1; *maxPage = 2; *selPageFrom = 1; *selPageTo = 2; } bool PrintFrame::HasPage(int pageNum) { return (pageNum > 0 && pageNum <= 2); } bool PrintFrame::OnBeginDocument(int startPage, int endPage) { if (!wxPrintout::OnBeginDocument(startPage, endPage)) return false; else return true; } bool PrintFrame::OnPrintPage(int page) { wxDC& dc = *GetDC(); //scale margins wxPageSetupDialogData *prt_setup = new wxPageSetupDialogData(); wxRect bounds = GetLogicalPageMarginsRect(*prt_setup); //set a frame int marg = int(bounds.width*0.05); bounds.x+=2*marg; bounds.y+=marg; bounds.width-=4*marg; bounds.height-=2*marg; //set the font size int fs = int(bounds.height/110); wxFont txtFont(*wxNORMAL_FONT); txtFont.SetPointSize(fs); dc.SetFont(txtFont); dc.SetPen(wxPen(wxColour(*wxBLACK),1)); int ratio; wxRect area(bounds); int whtspc = int(bounds.height/20); if (page==1) { //draw head area.height=bounds.height/10; ratio = frame->Draw(dc, area, 0); area.y+=int(area.height*ratio/100)+whtspc/2; //draw system in the upper third area.height=bounds.height/3; ratio = frame->Draw(dc, area, 1); area.y+=int(area.height*ratio/100)+whtspc; //draw text area.height=bounds.height-area.y; ratio = frame->Draw(dc, area, 2); area.y+=int(area.height*ratio/100)+whtspc; //see what is left area.height=bounds.height-area.y; if (area.height>0) { //draw some results if they fit resNo = area.height/(bounds.height/5); for (int i=0; iDraw(dc, area, i+3); area.y+=area.height; } } else resNo=0; } if (page==2) { //draw head area.height=bounds.height/10; ratio = frame->Draw(dc, area, 0); area.y+=int(area.height*ratio/100+whtspc/2); //draw the rest of results area.height=bounds.height-area.y; for (int i=resNo; i<3; i++) { area.height=bounds.height/5; frame->Draw(dc, area, i+3); area.y+=area.height; } } return true; } cba-0.3.6/src/gui/cbaGUI.h000066400000000000000000000113351142227325100150650ustar00rootroot00000000000000//cbaGUI.h /* cbeam_gui 0.3.6 07/2010 G.P.L. this is a small frontend for the cbeam_class (continuous beam analysis) cbeam_class has to be included 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 . */ #ifndef cbeam_gui #define cbeam_gui #include #include #include #include #include #include #include #include "cbeam_class.h" #include "cbaGUI_dialogs.h" #include "cbaGUI_drawings.h" #include "cbaGUI_bitmaps.h" //--------------- MainApp --------------- class MainApp: public wxApp { virtual bool OnInit(); int OnExit(); }; //--------------- MainFrame --------------- class MainFrame: public wxFrame { public: MainFrame(const wxString& title); virtual ~MainFrame(); int Draw(wxDC&, wxRect, int); DECLARE_EVENT_TABLE() private: void CreateGUIControls(); void OnQuit(wxCommandEvent&); void OnInfo(wxCommandEvent&); void OnNewBeam(wxCommandEvent&); void OnOpenFile(wxCommandEvent&); void OnSaveInput(wxCommandEvent&); void OnSettings(wxCommandEvent&); void SetDefaults(wxArrayString); void OnSpanAdd(wxCommandEvent&); void OnSpanDel(wxCommandEvent&); void OnSetEI(wxCommandEvent&); void SetMatSec(wxArrayString); void OnSetRst(wxCommandEvent&); void OnLoadAdd(wxCommandEvent&); void OnLoadDel(wxCommandEvent&); void OnSetLF(wxCommandEvent&); void OnChkSw(wxCommandEvent&); void OnClipRes(wxCommandEvent&); void OnSaveRes(wxCommandEvent&); void OnPrint(wxCommandEvent&); void OnSysPage(wxNotebookEvent&); void OnLoadPage(wxNotebookEvent&); void OnRadioButton(wxCommandEvent&); void OnCellInputGrid(wxGridEvent&); void Solve(); vector< vector > ReadInput(); void UpdateResultText(wxArrayString, wxArrayString, wxString); wxArrayString lmSort(vector< vector >); wxArrayString resOut(vector< vector >, vector< vector >) ; wxString strOut(vector< vector >); wxArrayString CreatePlotTable(); void FillInputGrids(); void addCols(wxGrid*, int); void addRows(int); wxString ChkValue(wxString valStr); wxGrid *udl_Grid, *pl_Grid, *pudl_Grid, *ml_Grid, *tz_Grid, *ptr_Grid; wxGrid *grid; wxNotebook *NbInp, *NbRes; wxTextCtrl *TcRes; wxButton *BtLdAdd, *BtLdDel, *BtLdFac; wxButton *BtEI, *BtRst, *BtSpAdd, *BtSpDel; wxCheckBox *ChkSw; wxBitmapButton *BtCopy, *BtSave, *BtPrint; wxRadioButton *BtFc, *BtSt; GraphFrame *system, *graph; class Store_values { public: vector L; vector R; double E,I; double Wy,Az; double g0; vector< vector > LMg; vector< vector > LMq; wxArrayString resTxt; wxString Mat, Sec; wxString dbMat, dbSec; wxString fcUnit, lnUnit; wxString ldFac; wxString Head; }; Store_values Store; enum { ID_QUIT = wxID_HIGHEST, ID_INFO, ID_NEW, ID_OPEN, ID_SAVE, ID_SET, ID_NB_INP, ID_IGRID, ID_BT_LD_ADD, ID_BT_LD_DEL, ID_BT_LD_FAC, ID_BT_EI, ID_BT_RST, ID_BT_SP_ADD, ID_BT_SP_DEL, ID_CHK_SW, ID_NB_RES, ID_TC_RES, ID_BT_FC, ID_BT_ST, ID_BT_COPY, ID_BT_SAVE, ID_BT_PRINT, }; }; //---------------- declare the main frame ------------------------- MainFrame *frame; //---------------- PrintFrame ------------------------- class PrintFrame: public wxPrintout { public: PrintFrame(const wxChar *title = _T("cba")) : wxPrintout(title) {} virtual ~PrintFrame() {} void GetPageInfo(int *minPage, int *maxPage, int *selPageFrom, int *selPageTo); bool HasPage(int page); bool OnBeginDocument(int startPage, int endPage); bool OnPrintPage(int page); private: int resNo; }; #endif cba-0.3.6/src/gui/cbaGUI_bitmaps.h000066400000000000000000000172521142227325100166100ustar00rootroot00000000000000//cbaGUI_bitmaps.h #ifndef cbaGUI_bitmaps #define cbaGUI_bitmaps /* XPM */ static char * cba_xpm[] = { "32 32 16 1", " c #000300", ". c #1A1B19", "+ c #292B28", "@ c #3F413E", "# c #4C4E4B", "$ c #636562", "% c #717370", "& c #80827F", "* c #8C8E8B", "= c #9FA19E", "- c #AFB1AE", "; c #B9BBB8", "> c #CFD1CD", ", c #D8DAD7", "' c #EBEDEA", ") c #FDFFFC", "))))))))))))))))))))))))))))))))", "))))))))))))))))))))))))))))))))", "))))))))))))))))))))))))))))))))", "))))))))))))))))))))))))))))))))", "))))))))))))))))))))))))))))))))", "))))))))))))))))))))))))))))))))", "))))));&))))-=))))==))))==))))))", "))))))-$))))*&))))*&))))**))))))", "))))))-$))))*&))))*&))))**))))))", "))))))-$))))*&))))*&))))**))))))", "))))))-$))))*&))))*&))))**))))))", "))))))-$))))*&))))*&))))**))))))", "))))';*$>,';&%>'';&&>'';%&>'))))", ")))))@ ;'. ,'. ,'. ,))))", "))))); $))= &))= &))* &)))))", "))))))#.')))++')))++')))++))))))", ")))))),=))));-))));-))))-;))))))", "))))))))))))))))))))))))))))))))", "))))),,,,,,,,,,,,,,,,,,,,,,)))))", "))))'$;;;;;;;;;&*;;;;;;;;;$)))))", "))))% '))))))))+#))))))))> *))))", "))), $)))))))* ;)))))))@ .')))", ")))# >)))))'. +))))))- %)))", "))- #)))))$ *))))'+ ,))", ")'+ -)))> .')))& #))", ")>%%%%$$*)))=%%%%$$;)))&%%%%$$')", "))))))))))))))))))))))))))))))))", "))))))))))))))))))))))))))))))))", "))))))))))))))))))))))))))))))))", "))))))))))))))))))))))))))))))))", "))))))))))))))))))))))))))))))))", "))))))))))))))))))))))))))))))))"}; /* XPM */ static char * udl_xpm[] = { "24 16 2 1", " c None", ". c #000000", " ", " ", " ", " .............. ", " . . . . ", " . . . . ", " . . . . ", " . . . . ", " . . . . ", " . . . . ", " ... . . ... ", " . . . . ", " .............. ", " ", " ", " "}; /* XPM */ static char * pl_xpm[] = { "24 16 2 1", " c None", ". c #000000", " ", " ", " ", " . ", " . ", " . ", " . ", " . ", " . ", " ....... ", " ..... ", " ... ", " . ", " ", " ", " "}; /* XPM */ static char * pudl_xpm[] = { "24 16 2 1", " c None", ". c #000000", " ", " ", " ", " ....... ", " . . ", " . . ", " . . ", " . . ", " . . ", " . . ", " ... ... ", " . . ", " ............ ", " ", " ", " "}; /* XPM */ static char * ml_xpm[] = { "24 16 22 1", " c None", ". c #000000", "+ c #020202", "@ c #303030", "# c #282828", "$ c #393939", "% c #262626", "& c #222222", "* c #080808", "= c #040404", "- c #343434", "; c #131313", "> c #464646", ", c #010101", "' c #454545", ") c #212121", "! c #0E0E0E", "~ c #0F0F0F", "{ c #202020", "] c #313131", "^ c #2F2F2F", "/ c #232323", " ", " ", " ... ", " +@#$%&* ", " =- ; ", " > , ", " ..=' ) ", " ,! # ", " ~{ ] ", " ; ", " ^ ", " ^ ", " /! ", " ", " ", " "}; /* XPM */ static char * tz_xpm[] = { "24 16 2 1", " c None", ". c #000000", " ", " ", " ", " ........ ", " . . ", " . . . . ", " . . . . ", " . . . . ", " . . . . ", " . . . . ", " . ... ... . ", " . . . . ", " .................. ", " ", " ", " "}; /* XPM */ static char * ptr_xpm[] = { "24 16 2 1", " c None", ". c #000000", " ", " ", " ", " . ", " .. ", " . . ", " . . ", " . . ", " . . ", " . . ", " ... . ", " . ", " .............. ", " ", " ", " "}; /* XPM */ static const char * save_xpm[] = { /* columns rows colors chars-per-pixel */ "16 15 21 1", ": c #AAC1E8", "1 c #B9CDED", "O c #FFFFFF", " c #2C58A0", "* c #B0C6EA", "; c #2D59A3", "X c #1C3866", "= c #C3D4EF", "2 c #CBD9F1", "- c #DAE5F6", "# c #97B4E3", ". c None", "$ c #274D8B", "& c #9FB9E5", "@ c #5584D1", "% c #82A5DE", "o c #3A70CA", "< c #A5BEE7", ", c #D2DFF4", "+ c #3467BC", "> c #C0D1EE", /* pixels */ " .", " XoOOOOOOOOO+X .", " @oO#######O+@ .", " @oOOOOOOOOO+@ .", " @oO#######O+@ .", " @oOOOOOOOOO+@ .", " @@+++++++++@@ .", " @@@@@@@@@@@@@ .", " @@@$$$$$$$$@@ .", " @@$%%%&*=-O$@ .", " @@$%X;;*=-O$@ .", " @@$%X;;:>,O$@ .", " @@$%X;;<12O$@ .", " @@$<<2OOOOO$@ .", ". .." }; /* XPM */ static char *copy_xpm[] = { /* columns rows colors chars-per-pixel */ "16 15 23 1", "o c #97C4E7", "* c #FFFFFF", "@ c #60A9DA", "= c #D1E5F5", "& c #C3DDF1", ". c #7EA6C0", " c None", "X c #2F93CD", "O c #85BBE2", ", c #EFF6FC", "; c #DEEDF8", "+ c #72B2DD", "3 c #F7FBFD", "4 c #FAFCFE", ": c #DAEAF7", "< c #E9F3FA", "1 c #E2EFF8", "- c #FDFDFE", "% c #B6D5EE", "$ c #A5CCEA", "> c #E5F0F9", "# c #AFD1EC", "2 c #F4F9FD", /* pixels */ " .....XX ", " .oO+@X#X ", " .$oO+X##X ", " .%$o........ ", " .&%$.*=&#o.-. ", " .=&%.*;=&#.--. ", " .:=&.*>;=&.... ", " .>:=.*,>;=&#o. ", " .<1:.*2,>:=&#. ", " .2<1.*32,>:=&. ", " .32<.*432,>:=. ", " .32<.*-432,>:. ", " .....**-432,>. ", " .***-432,. ", " .......... " }; /* XPM */ static char *print_xpm[] = { /* columns rows colors chars-per-pixel */ "16 15 39 1", "< c #E3E4E6", "+ c #C3C3C4", "i c #FFFFFF", ": c #74879B", "# c #5A89A6", "a c #F1F4F7", "r c #5A809C", "@ c #BDCCD9", "e c #7A92A4", "% c #3F6F93", "t c #9FA2A6", "3 c #939495", "w c #5F666D", "9 c #65839E", "5 c #4A7291", "$ c #4B7F9E", " c None", "O c #DFE0E2", "o c #F3F3F3", "; c #84A5BB", "& c #467291", ". c #7897AD", "* c #407598", "4 c #CFCFD0", "7 c #6F90A6", "y c #6A89A2", "0 c #AAADB2", "1 c #D2D3D4", "u c #4F7592", ", c #BCBDBE", "p c #57778E", "q c #979BA0", "2 c #ABABAC", "- c #E7E7E7", "= c #D6DEE6", "> c #9FA0A0", "8 c #829EB5", "X c #8FB0C3", "6 c #5D7C93", /* pixels */ " .XXXXXXXX ", " .oooooooX ", " .OOOOOOOX ", " .+++++++X ", "@##$%&&&&&%*##@ ", "$=-;:>,<123$-=$ ", ".44.5678.96$44. ", "7,,,,,,,,,,,,,7 ", "900qwwwwwwwe009 ", "rtt9ryyyyyyuttr ", "6qq6iiiiiii%qq6 ", "633paiiiiii%336 ", "XXX*iiiiiii%XXX ", " 6iiiiiii% ", " $XXXXXXX# " }; #endif cba-0.3.6/src/gui/cbaGUI_dialogs.cpp000077500000000000000000001647701142227325100171410ustar00rootroot00000000000000//cbaGUI_dialogs.cpp #include "cbaGUI_dialogs.h" //---------------- new beam dialog ------------------------- BEGIN_EVENT_TABLE(BeamDialog, wxDialog) EVT_BUTTON(ID_BT_OK, BeamDialog::OnClose) EVT_BUTTON(ID_BT_ESC, BeamDialog::OnClose) EVT_TEXT(wxID_ANY, BeamDialog::OnTcCheck) END_EVENT_TABLE() BeamDialog::BeamDialog(wxFrame *parent, wxWindowID id, const wxString &title) : wxDialog(parent, id, title, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER) { SetBackgroundColour(wxColour(*wxWHITE)); wxPoint pos = wxGetMousePosition(); SetSize(pos.x, pos.y, 200, 200); wxBoxSizer *TcSizer = new wxBoxSizer(wxVERTICAL); //spin control for number of spans TcNum = new wxSpinCtrl(this, 1000, _T("1"), wxDefaultPosition, wxSize(180,25), wxSP_ARROW_KEYS, 1, 20, 1); TcSizer->Add(new wxStaticText(this, -1, _T("Number of spans:"), wxDefaultPosition, wxSize(180,20)), 0, wxTOP, 10); TcSizer->Add(TcNum, 0, wxEXPAND); //text controls wxArrayString labels; labels.Add(_T("Length of Spans:")); labels.Add(_T("Permanent Load:")); labels.Add(_T("Live Load:")); wxArrayString defaults; defaults.Add(_T("1.00")); defaults.Add(_T("0.00")); defaults.Add(_T("0.00")); for (int i=1001; i<=1003; i++) { TcSizer->Add(new wxStaticText(this, -1, labels[i-1001], wxDefaultPosition, wxSize(180,20)), 0, wxTOP, 10); TcSizer->Add(new wxTextCtrl(this, i, defaults[i-1001], wxDefaultPosition, wxSize(180,25)), 0, wxEXPAND); } //buttons wxBoxSizer *BtSizer = new wxBoxSizer(wxHORIZONTAL); BtSizer->Add(new wxButton( this, ID_BT_OK, _T("OK"), wxDefaultPosition, wxSize(60,25)), 0, wxALL, 10); BtSizer->Add(new wxButton( this, ID_BT_ESC, _T("Cancel"), wxDefaultPosition, wxSize(60,25)), 0, wxALL, 10); wxBoxSizer *Vsizer = new wxBoxSizer(wxVERTICAL); Vsizer->Add(TcSizer, 1, wxEXPAND | wxALIGN_LEFT | wxALL, 20); Vsizer->Add(BtSizer, 0, wxALIGN_CENTER | wxBOTTOM, 20); SetSizer(Vsizer); Vsizer->SetSizeHints(this); } void BeamDialog::OnClose(wxCommandEvent &event) { text.Clear(); int id = event.GetId(); if (id==ID_BT_OK) { int nr = TcNum->GetValue(); wxString nrText; nrText << nr; text.Add(nrText); for (int i=1001; i<=1003; i++) { wxTextCtrl *ctrl = (wxTextCtrl*) FindWindowById(i, this); text.Add(ctrl->GetValue()); } } Close(TRUE); } void BeamDialog::OnTcCheck(wxCommandEvent &event) { //entered commas will be changed to points int id = event.GetId(); if (id!=1000) //TcNum { wxTextCtrl *ctrl = (wxTextCtrl*) FindWindowById(id, this); wxString vStr=ctrl->GetValue(); if (vStr.Find(_T(",")) > -1) vStr.Replace( _T(","),_T(".")); ctrl->ChangeValue(vStr); ctrl->SetInsertionPointEnd(); } } //---------------- load factor dialog ------------------------- BEGIN_EVENT_TABLE(LoadFactorDialog, wxDialog) EVT_BUTTON(ID_BT_OK, LoadFactorDialog::OnClose) EVT_BUTTON(ID_BT_ESC, LoadFactorDialog::OnClose) EVT_CHECKBOX(ID_CHK, LoadFactorDialog::OnChkBox) EVT_TEXT(wxID_ANY, LoadFactorDialog::OnTcCheck) END_EVENT_TABLE() LoadFactorDialog::LoadFactorDialog(wxFrame *parent, wxWindowID id, const wxString &title, wxString input) : wxDialog(parent, id, title, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER) { SetBackgroundColour(wxColour(*wxWHITE)); wxPoint pos = wxGetMousePosition(); SetSize(pos.x, pos.y, 200, 200); //check box max/min ChkMin = new wxCheckBox(this, ID_CHK, _T("disburdening"), wxDefaultPosition, wxSize(150,25)); ChkMin->SetValue(true); //text controls wxArrayString labels; labels.Add(_T("permanent loads:")); labels.Add(_T("live loads:")); labels.Add(_T("permanent loads (min):")); labels.Add(_T("live loads (min):")); wxBoxSizer *TcMaxSizer = new wxBoxSizer(wxVERTICAL); for (int i=0; i<2; i++) { TcMaxSizer->Add(new wxStaticText(this, -1, labels[i], wxDefaultPosition, wxSize(150,20)), 0, wxTOP, 10); TcMaxSizer->Add(new wxTextCtrl(this, 1000+i, _T(""), wxDefaultPosition, wxSize(150,25)), 0, wxEXPAND); } //minimum load factors wxBoxSizer *TcMinSizer = new wxBoxSizer(wxVERTICAL); for (int i=2; i<4; i++) { wxTextCtrl *min = new wxTextCtrl(this, 1000+i, _T(""), wxDefaultPosition, wxSize(150,25), wxTE_RICH); min->SetDefaultStyle(wxTextAttr(*wxRED)); TcMinSizer->Add(new wxStaticText(this, -1, labels[i], wxDefaultPosition, wxSize(150,20)), 0, wxTOP, 10); TcMinSizer->Add(min, 0, wxEXPAND); } //buttons wxBoxSizer *BtSizer = new wxBoxSizer(wxHORIZONTAL); BtSizer->Add(new wxButton( this, ID_BT_OK, _T("OK"), wxDefaultPosition, wxSize(60,25)), 0, wxALL, 10); BtSizer->Add(new wxButton( this, ID_BT_ESC, _T("Cancel"), wxDefaultPosition, wxSize(60,25)), 0, wxALL, 10); Vsizer = new wxBoxSizer(wxVERTICAL); Vsizer->Add(ChkMin, 0, wxALIGN_LEFT | wxTOP | wxLEFT | wxRIGHT, 20); Vsizer->Add(TcMaxSizer, 1, wxEXPAND | wxALIGN_LEFT | wxLEFT | wxRIGHT, 20); Vsizer->Add(TcMinSizer, 1, wxEXPAND | wxALIGN_LEFT | wxLEFT | wxRIGHT, 20); Vsizer->Add(BtSizer, 0, wxALIGN_CENTER | wxALL, 20); SetSizer(Vsizer); Vsizer->SetSizeHints(this); //set defaults text=input; bool disb(false); for (int i=0; i<4; i++) { wxTextCtrl *text = (wxTextCtrl*) FindWindowById(1000+i, this); text->ChangeValue(_T("1.00")); if (i==3) text->ChangeValue(_T("0.00")); wxString value = input.BeforeFirst(_T(' ')); if (!value.IsEmpty()) { text->ChangeValue(value); if (i>1) disb=true; } input = input.AfterFirst(_T(' ')); } //set checkbox if disburdening factors are given if (disb) ChkMin->SetValue(true); else { ChkMin->SetValue(false); Vsizer->Hide(2); Vsizer->SetSizeHints(this); Vsizer->Fit(this); } } void LoadFactorDialog::OnClose(wxCommandEvent &event) { if (event.GetId()==ID_BT_OK) { text.Empty(); wxChar spc(_T(' ')); wxString valMax, valMin; for (int i=0; i<4; i++) { wxTextCtrl *ctrl = (wxTextCtrl*) FindWindowById(1000+i, this); wxString vStr = ctrl->GetValue(); double d; vStr.ToDouble(&d); vStr.Printf(_T("%4.2f"),d); if (i<2) valMax+= vStr+spc; else valMin+= vStr+spc; } valMax=valMax.BeforeLast(spc); valMin=valMin.BeforeLast(spc); //check if factors are default if (valMax!=_T("1.00 1.00")) text+=valMax; if (ChkMin->IsChecked()) { if (valMin!=_T("1.00 0.00")) text+=spc+valMin; if (valMax==_T("1.00 1.00") && valMin!=_T("1.00 0.00")) text=valMax+spc+valMin; } } Close(TRUE); } void LoadFactorDialog::OnChkBox(wxCommandEvent &event) { if (event.IsChecked()) { Vsizer->Show(2, true); Vsizer->SetSizeHints(this); Vsizer->Fit(this); } else { Vsizer->Hide(2); Vsizer->SetSizeHints(this); Vsizer->Fit(this); } } void LoadFactorDialog::OnTcCheck(wxCommandEvent &event) { //entered commas will be changed to points wxTextCtrl *ctrl = (wxTextCtrl*) FindWindowById(event.GetId(), this); wxString vStr=ctrl->GetValue(); if (vStr.Find(_T(",")) > -1) vStr.Replace( _T(","),_T(".")); ctrl->ChangeValue(vStr); ctrl->SetInsertionPointEnd(); } //---------------- constraints dialog ------------------------- BEGIN_EVENT_TABLE(ConstraintsDialog, wxDialog) EVT_BUTTON(ID_BT_OK, ConstraintsDialog::OnClose) EVT_BUTTON(ID_BT_ESC, ConstraintsDialog::OnClose) END_EVENT_TABLE() ConstraintsDialog::ConstraintsDialog(wxFrame *parent, wxWindowID id, const wxString &title, wxArrayString values) : wxDialog(parent, id, title, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER) { SetBackgroundColour(wxColour(*wxWHITE)); wxPoint pos = wxGetMousePosition(); SetSize(pos.x, pos.y, 200, 200); //grid grid = new wxGrid(this, -1, wxPoint(0,0), wxSize(200,120)); grid->CreateGrid(0,0,wxGrid::wxGridSelectCells); grid->SetLabelBackgroundColour(*wxWHITE); grid->SetColLabelSize(20); grid->SetRowLabelSize(40); grid->SetDefaultColSize(75); grid->SetDefaultRowSize(20); grid->SetDefaultCellAlignment(wxALIGN_CENTRE, wxALIGN_CENTRE ); grid->AppendCols(2); grid->SetColLabelValue(0, _T("def")); grid->SetColLabelValue(1, _T("rot")); //expl wxStaticText *expl = new wxStaticText(this, -1, _T(""), wxDefaultPosition, wxSize(150,60)); expl->SetLabel(_T("-1 ... supported\n 0 ... not supported\n>0 ... spring\n")); //buttons wxBoxSizer *BtSizer = new wxBoxSizer(wxHORIZONTAL); BtSizer->Add(new wxButton(this, ID_BT_OK, _T("OK"), wxDefaultPosition, wxSize(60,25)), 0, wxALL, 10); BtSizer->Add(new wxButton(this, ID_BT_ESC, _T("Cancel"), wxDefaultPosition, wxSize(60,25)), 0, wxALL, 10); wxBoxSizer *Vsizer = new wxBoxSizer(wxVERTICAL); Vsizer->Add(grid, 1, wxEXPAND | wxGROW | wxALIGN_LEFT | wxTOP | wxLEFT | wxRIGHT, 20); Vsizer->Add(expl, 0, wxALIGN_CENTER | wxTOP, 10); Vsizer->Add(BtSizer, 0, wxALIGN_CENTER | wxBOTTOM, 20); SetSizer(Vsizer ); Vsizer->SetSizeHints(this); //set values int rows=int(values.GetCount()/2); for (int i=0; iAppendRows(1); grid->SetCellValue(i, 0, values[i*2]); grid->SetCellValue(i, 1, values[i*2+1]); } } void ConstraintsDialog::OnClose(wxCommandEvent &event) { values.Clear(); int id = event.GetId(); if (id==ID_BT_OK) { int cols=grid->GetNumberCols(); int rows=grid->GetNumberRows(); for (int i=0; iGetCellValue(i, j)); } Close(TRUE); } //---------------- materials/sections dialog ------------------------- BEGIN_EVENT_TABLE(MatSecDialog, wxDialog) EVT_BUTTON(ID_BT_OK, MatSecDialog::OnClose) EVT_BUTTON(ID_BT_ESC, MatSecDialog::OnClose) EVT_TREE_SEL_CHANGED(ID_MAT_TREE, MatSecDialog::OnMatChanged) EVT_TREE_SEL_CHANGED(ID_SEC_TREE, MatSecDialog::OnSecChanged) EVT_LIST_ITEM_SELECTED(ID_MAT_LIST, MatSecDialog::OnMatTable) EVT_LIST_ITEM_SELECTED(ID_SEC_LIST, MatSecDialog::OnSecTable) EVT_CHECKBOX(ID_CHK_ROT, MatSecDialog::OnChkRot) EVT_CHECKBOX(ID_CHK_HOL, MatSecDialog::OnChkHol) EVT_BUTTON(ID_BT_SET, MatSecDialog::OnSetRes) EVT_TEXT(wxID_ANY, MatSecDialog::OnTcCheck) END_EVENT_TABLE() MatSecDialog::MatSecDialog(wxFrame *parent, wxWindowID id, const wxString &title) : wxDialog(parent, id, title, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER) { SetBackgroundColour(wxColour(*wxWHITE)); wxPoint pos = wxGetMousePosition(); SetSize(pos.x, pos.y, 300, 300); //material database MatTree = new wxTreeCtrl(this, ID_MAT_TREE, wxDefaultPosition, wxSize(120,180)); MatTree->AddRoot(_T("materials")); MatList = new wxListCtrl(this, ID_MAT_LIST, wxDefaultPosition, wxSize(300,180), wxLC_REPORT); wxBoxSizer *MatSizer = new wxBoxSizer(wxHORIZONTAL); MatSizer->Add(MatTree, 0, wxEXPAND | wxLEFT, 10); MatSizer->Add(MatList, 1, wxEXPAND | wxLEFT, 10); //section database SecTree = new wxTreeCtrl(this, ID_SEC_TREE, wxDefaultPosition, wxSize(120,180)); wxTreeItemId rootId = SecTree->AddRoot(_T("sections")); defId = SecTree->AppendItem(rootId, _T("def")); dbId = SecTree->AppendItem(rootId, _T("db")); SecTree->Expand(SecTree->GetRootItem()); SecList = new wxListCtrl(this, ID_SEC_LIST, wxDefaultPosition, wxSize(300,180), wxLC_REPORT); //defined sections SecTree->AppendItem(defId, _T("Rect")); SecTree->AppendItem(defId, _T("Isec")); SecTree->AppendItem(defId, _T("Tube")); SecTree->Expand(defId); wxPanel *PanelSec = new wxPanel(this, -1, wxDefaultPosition, wxSize(100,100)); wxArrayString dim; dim.Add(_T("h")); dim.Add(_T("b")); dim.Add(_T("t")); dim.Add(_T("s")); for (int i=0; i<4; i++) { new wxStaticText(PanelSec, 800+i, dim[i], wxPoint(0,5+i*30), wxSize(45,25)); new wxTextCtrl(PanelSec, 900+i, _T(""), wxPoint(50,i*30), wxSize(50,25)); } wxBoxSizer *V2sizer = new wxBoxSizer(wxVERTICAL); V2sizer->Add(PanelSec, 1, wxLEFT, 10); V2sizer->Add(new wxButton( this, ID_BT_SET, _T("Set >>"), wxDefaultPosition, wxSize(60,25)), 0, wxALIGN_RIGHT); //drawing window secgraph = new SecGraph; secgraph->Create(this, -1, wxDefaultPosition, wxSize(100,100), wxVSCROLL); DefSec = new wxBoxSizer(wxHORIZONTAL); DefSec->Add(secgraph, 1, wxEXPAND); DefSec->Add(V2sizer, 0, wxEXPAND | wxALL, 10); SecSizer = new wxBoxSizer(wxHORIZONTAL); SecSizer->Add(SecTree, 0, wxEXPAND | wxLEFT, 10); SecSizer->Add(SecList, 1, wxEXPAND | wxLEFT, 10); SecSizer->Add(DefSec, 1, wxEXPAND | wxLEFT, 10); //checkbox for 90° rotation ChkRot = new wxCheckBox(this, ID_CHK_ROT, _T("90°"), wxDefaultPosition, wxSize(120,30)); ChkRot->SetValue(false); //check box solid/hollow ChkHol = new wxCheckBox(this, ID_CHK_HOL, _T("hollow"), wxDefaultPosition, wxSize(120,30)); ChkHol->SetValue(false); wxBoxSizer *ChkSizer = new wxBoxSizer(wxHORIZONTAL); ChkSizer->Add(ChkRot, 0, wxLEFT, 10); ChkSizer->Add(ChkHol, 1, wxLEFT, 10); //text controls for results wxGridSizer *ResSizer = new wxGridSizer(3); for (int i=0; i<6; i++) { int tc(1000); wxString label; switch (i) { case 0 : tc= 1000; label=_T("Elasticity"); break; case 1 : tc= 1001; label=_T("Density"); break; case 2 : tc= 1004; label=_T("Section Modulus"); break; case 3 : tc= 1003; label=_T("Inertia"); break; case 4 : tc= 1002; label=_T("Section Area"); break; case 5 : tc= 1005; label=_T("Shear Area"); break; } wxPanel *panel = new wxPanel(this, -1, wxDefaultPosition, wxSize(150,45)); new wxStaticText(panel, tc+100, label, wxPoint(0,0), wxSize(150,20)); new wxTextCtrl(panel, tc, _T(""), wxPoint(0,20), wxSize(150,25)); ResSizer->Add(panel, 0, wxEXPAND | wxALL, 5); } //buttons wxBoxSizer *BtSizer = new wxBoxSizer(wxHORIZONTAL); BtSizer->Add(new wxButton( this, ID_BT_OK, _T("OK"), wxDefaultPosition, wxSize(80,25)), 0, wxALL, 10); BtSizer->Add(new wxButton( this, ID_BT_ESC, _T("Cancel"), wxDefaultPosition, wxSize(80,25)), 0, wxALL, 10); Vsizer = new wxBoxSizer(wxVERTICAL); Vsizer->Add(MatSizer, 1, wxEXPAND | wxTOP | wxLEFT | wxRIGHT, 20); Vsizer->Add(SecSizer, 1, wxEXPAND | wxTOP | wxLEFT | wxRIGHT, 20); Vsizer->Add(ChkSizer, 0, wxEXPAND | wxLEFT | wxRIGHT, 20); Vsizer->Add(ResSizer, 0, wxEXPAND | wxALIGN_LEFT | wxTOP | wxLEFT | wxRIGHT, 25); Vsizer->Add(BtSizer, 0, wxALIGN_CENTER | wxALL, 20); SetSizer(Vsizer); Vsizer->SetSizeHints(this); } void MatSecDialog::OnClose(wxCommandEvent &event) { int id = event.GetId(); if (id!=ID_BT_OK) { for (int i=0; i<6; i++) { wxTextCtrl *ctrl = (wxTextCtrl*) FindWindowById(1000+i, this); ctrl->Clear(); } } Close(TRUE); } void MatSecDialog::OnMatChanged(wxTreeEvent& event) { wxTreeItemId itemId = event.GetItem(); if (itemId!=MatTree->GetRootItem()) { wxString table = MatTree->GetItemText(itemId); SetMatList(table); } else { if (MatTree->ItemHasChildren(itemId)) MatList->ClearAll(); } //clear textcontrols for (int i=0; i<2; i++) { wxTextCtrl *ctrl = (wxTextCtrl*) FindWindowById(1000+i, this); ctrl->Clear(); } } void MatSecDialog::OnSecChanged(wxTreeEvent& event) { wxTreeItemId item = event.GetItem(); if (item!=SecTree->GetRootItem()) { if (SecTree->GetItemParent(item)!=SecTree->GetRootItem()) { wxString table = SecTree->GetItemText(item); //defined section if (SecTree->GetItemParent(item)==defId) { //copy table values coming from database wxTreeItemId fromId = event.GetOldItem(); if (SecTree->GetItemParent(fromId)==dbId) CopyTableToTc(SecTree->GetItemText(fromId)); ShowDefSec(true); secgraph->SetType(table, ChkHol->GetValue(), ChkRot->GetValue()); CalcSec(); UpdateSecTc(); } //section from database if (SecTree->GetItemParent(item)==dbId) { ShowDefSec(false); SetSecList(table); } } else { ShowDefSec(false); SecList->ClearAll(); } } else { ShowDefSec(false); SecList->ClearAll(); } //clear textcontrols if (SecTree->GetItemParent(item)!=defId) { for (int i=2; i<6; i++) { wxTextCtrl *ctrl = (wxTextCtrl*) FindWindowById(1000+i, this); ctrl->Clear(); } } } void MatSecDialog::OnMatTable(wxListEvent& event) { wxListItem item; item.m_itemId = event.m_itemIndex; //set elasticity & density item.m_col = 1; item.m_mask = wxLIST_MASK_TEXT; MatList->GetItem(item); wxString E = item.m_text; item.m_col = 2; item.m_mask = wxLIST_MASK_TEXT; MatList->GetItem(item); wxString rho = item.m_text; //convert unit wxChar cs(_T(',')); double f = ConvUnit(dbMatUnit.BeforeFirst(cs), fcUnit, _T("1")); double l2 = ConvUnit(dbMatUnit.AfterFirst(cs), lnUnit, _T("2")); double l3 = ConvUnit(dbMatUnit.AfterFirst(cs), lnUnit, _T("3")); if (l2>0) E = sMult(E, f/l2); if (l3>0) rho = sMult(rho, f/l3); wxTextCtrl *ctrl; ctrl = (wxTextCtrl*) FindWindowById(1000, this); ctrl->ChangeValue(E); ctrl = (wxTextCtrl*) FindWindowById(1001, this); ctrl->ChangeValue(rho); } void MatSecDialog::OnSecTable(wxListEvent& event) { wxListItem item; item.m_itemId = event.m_itemIndex; wxString u_exp(_T("2432")); for (int i=0; i<4; i++) { item.m_col = i+1; item.m_mask = wxLIST_MASK_TEXT; SecList->GetItem(item); wxString val = item.m_text; val = sMult(val, ConvUnit(dbSecUnit, lnUnit, u_exp.Mid(i,1))); wxTextCtrl *ctrl = (wxTextCtrl*) FindWindowById(1002+i, this); ctrl->ChangeValue(val); } } void MatSecDialog::OnChkRot(wxCommandEvent &event) { //rotate defined section for (int i=0; i<4; i+=2) { wxTextCtrl *ctrl1 = (wxTextCtrl*) FindWindowById(900+i, this); wxTextCtrl *ctrl2 = (wxTextCtrl*) FindWindowById(900+i+1, this); wxString swap = ctrl1->GetValue(); ctrl1->ChangeValue(ctrl2->GetValue()); ctrl2->ChangeValue(swap); } //remember selection wxTreeItemId t_item = SecTree->GetSelection(); long l_item = -1; l_item = SecList->GetNextItem(l_item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); //trigger event to refresh SecTree->SelectItem(SecTree->GetItemParent(t_item)); SecTree->SelectItem(t_item); if (l_item!=-1) SecList->SetItemState(l_item, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED); } void MatSecDialog::OnChkHol(wxCommandEvent &event) { //trigger event to refresh wxTreeItemId t_item = SecTree->GetSelection(); SecTree->SelectItem(SecTree->GetItemParent(t_item)); SecTree->SelectItem(t_item); } void MatSecDialog::OnSetRes(wxCommandEvent &event) { CalcSec(); } void MatSecDialog::OnTcCheck(wxCommandEvent &event) { //entered commas will be changed to points wxTextCtrl *ctrl = (wxTextCtrl*) FindWindowById(event.GetId(), this); wxString vStr=ctrl->GetValue(); if (vStr.Find(_T(",")) > -1) vStr.Replace( _T(","),_T(".") ); ctrl->ChangeValue(vStr); ctrl->SetInsertionPointEnd(); } void MatSecDialog::SetDbLoc(wxString mat, wxString sec) { //material database if (wxFile::Exists(mat)) { dbMat=mat; wxChar cs(_T(',')); wxString tables = QueryDB(dbMat); dbMatUnit = tables.BeforeFirst(cs); tables=tables.AfterFirst(cs); dbMatUnit+= cs+tables.BeforeFirst(cs); tables=tables.AfterFirst(cs); while (!tables.IsEmpty()) { MatTree->AppendItem(MatTree->GetRootItem(), tables.BeforeFirst(cs)); tables=tables.AfterFirst(cs); } MatTree->Expand(MatTree->GetRootItem()); MatTree->ScrollTo(MatTree->GetRootItem()); } else { MatList->InsertColumn(0, _T("")); MatList->InsertItem(0, _T("Material database not found, choose in settings!")); MatList->SetColumnWidth(0, wxLIST_AUTOSIZE ); } //section database if (wxFile::Exists(sec)) { dbSec=sec; wxChar cs(_T(',')); wxString tables = QueryDB(dbSec); dbSecUnit = tables.BeforeFirst(cs); tables=tables.AfterFirst(cs); while (!tables.IsEmpty()) { SecTree->AppendItem(dbId, tables.BeforeFirst(cs)); tables=tables.AfterFirst(cs); } SecTree->Expand(dbId); SecTree->ScrollTo(SecTree->GetRootItem()); //dbUnit = defSecUnit for (int i=0; i<4; i++) { wxStaticText *txt = (wxStaticText*) FindWindowById(800+i, this); wxString label=txt->GetLabel(); label+=_T(" [")+dbSecUnit+_T("]"); txt->SetLabel(label); } } else { SecList->InsertColumn(0, _T("")); SecList->InsertItem(0, _T("Section database not found, choose in settings!")); SecList->SetColumnWidth(0, wxLIST_AUTOSIZE ); } } void MatSecDialog::SetUnits(wxString fc, wxString ln) { fcUnit=fc; lnUnit=ln; //set label units for (int i=0; i<6; i++) { wxStaticText *txt = (wxStaticText*) FindWindowById(1100+i, this); wxString label = txt->GetLabel(); switch (i) { case 0 : label+=_T(" [")+fcUnit+_T("/")+lnUnit+_T("2]"); break; case 1 : label+=_T(" [")+fcUnit+_T("/")+lnUnit+_T("3]"); break; case 2 : label+=_T(" [")+lnUnit+_T("2]"); break; case 3 : label+=_T(" [")+lnUnit+_T("4]"); break; case 4 : label+=_T(" [")+lnUnit+_T("3]"); break; case 5 : label+=_T(" [")+lnUnit+_T("2]"); break; } txt->SetLabel(label); } //set default len unit if section database is not fount if (dbSecUnit.IsEmpty()) { dbSecUnit=lnUnit; for (int i=0; i<4; i++) { wxStaticText *txt = (wxStaticText*) FindWindowById(800+i, this); wxString label=txt->GetLabel(); label+=_T(" [")+dbSecUnit+_T("]"); txt->SetLabel(label); } } } void MatSecDialog::SetMat(wxString input) { if (!dbMat.IsEmpty()) { wxString mat=input.BeforeFirst(_T(' ')); wxString table=input.AfterFirst(_T(' ')); //try choosing table in tree bool found(false); wxTreeItemIdValue cookie; wxTreeItemId t_item = MatTree->GetFirstChild(MatTree->GetRootItem(), cookie); while(t_item.IsOk()) { if (MatTree->GetItemText(t_item).MakeUpper()==mat.MakeUpper()) { MatTree->SelectItem(t_item); found=true; break; } t_item = MatTree->GetNextChild(MatTree->GetRootItem(), cookie); } //set table to list if material is found if (found) { long l_item = MatList->FindItem(-1, table); if (l_item!=-1) { MatList->SetItemState(l_item, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED); MatList->EnsureVisible(l_item); } } //set default if not if (input.IsEmpty()) { wxTreeItemIdValue cookie; MatTree->SelectItem(MatTree->GetFirstChild(MatTree->GetRootItem(), cookie)); } } } void MatSecDialog::SetSec(wxString input) { //set default if no section is given if (input.IsEmpty()) { wxTreeItemIdValue cookie; SecTree->SelectItem(SecTree->GetFirstChild(dbId, cookie)); } //check rotation (last value) wxChar spc(_T(' ')); wxString rot = input.AfterLast(spc).MakeUpper(); if (rot==_T("ROT")) { ChkRot->SetValue(true); input=input.BeforeLast(spc); } else ChkRot->SetValue(false); //get section type wxString type = input.BeforeFirst(spc).MakeUpper(); input=input.AfterFirst(spc); //try choosing table in tree bool found(false); wxTreeItemIdValue cookie; wxTreeItemId t_item = SecTree->GetFirstChild(dbId, cookie); while(t_item.IsOk()) { if (SecTree->GetItemText(t_item).MakeUpper()==type) { SecTree->SelectItem(t_item); found=true; break; } t_item = SecTree->GetNextChild(dbId, cookie); } //set table to list if section is found if (found) { long l_item = SecList->FindItem(-1, input); if (l_item!=-1) { SecList->SetItemState(l_item, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED); SecList->EnsureVisible(l_item); } } //try defined sections if (type==_T("RECT")) { int row(0); while (!input.IsEmpty()) { wxString val=input.BeforeFirst(spc); input=input.AfterFirst(spc); wxTextCtrl *ctrl = (wxTextCtrl*) FindWindowById(900+row, this); ctrl->ChangeValue(val); row++; if (row==4) break; } if (row>2) ChkHol->SetValue(true); else ChkHol->SetValue(false); wxTreeItemIdValue cookie; SecTree->SelectItem(SecTree->GetFirstChild(defId, cookie)); } if (type==_T("ISEC")) { int row(0); while (!input.IsEmpty()) { wxString val=input.BeforeFirst(spc); input=input.AfterFirst(spc); wxTextCtrl *ctrl = (wxTextCtrl*) FindWindowById(900+row, this); ctrl->ChangeValue(val); row++; if (row==4) break; } ChkHol->SetValue(false); wxTreeItemIdValue cookie; SecTree->GetFirstChild(defId, cookie); SecTree->SelectItem(SecTree->GetNextChild(defId, cookie)); } if (type==_T("TUBE")) { wxString val=input.BeforeFirst(spc); input=input.AfterFirst(spc); wxTextCtrl *ctrl = (wxTextCtrl*) FindWindowById(901, this); ctrl->ChangeValue(val); val=input.BeforeFirst(spc); if (!val.IsEmpty()) { ctrl = (wxTextCtrl*) FindWindowById(903, this); ctrl->ChangeValue(val); ChkHol->SetValue(true); } else ChkHol->SetValue(false); ChkRot->SetValue(false); wxTreeItemIdValue cookie; SecTree->GetFirstChild(defId, cookie); SecTree->GetNextChild(defId, cookie); SecTree->SelectItem(SecTree->GetNextChild(defId, cookie)); } } void MatSecDialog::SetEI(wxString E, wxString I) { //if thereÂŽs no section nor material wxTextCtrl *ctrl; ctrl = (wxTextCtrl*) FindWindowById(1000, this); ctrl->ChangeValue(E); ctrl = (wxTextCtrl*) FindWindowById(1003, this); ctrl->ChangeValue(I); } wxArrayString MatSecDialog::GetItems() { text.Clear(); for (int i=0; i<6; i++) { wxTextCtrl *ctrl = (wxTextCtrl*) FindWindowById(1000+i, this); text.Add(ctrl->GetValue()); } //append material wxString mat; bool sel(false); wxTreeItemId item_m = MatTree->GetSelection(); if (item_m!=MatTree->GetRootItem()) { mat = MatTree->GetItemText(item_m); long item = -1; for ( ;; ) { item = MatList->GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); if (item==-1) break; mat+=_T(" ")+MatList->GetItemText(item); sel=true; } } if (!sel) mat.Empty(); //only chosen material text.Add(mat); //append section wxString sec; sel=false; wxTreeItemId item_s = SecTree->GetSelection(); if (item_s!=SecTree->GetRootItem()) { if (SecTree->GetItemParent(item_s)==defId) { sec=SecTree->GetItemText(item_s); for (int i=0; i<4; i++) { wxTextCtrl *ctrl = (wxTextCtrl*) FindWindowById(900+i, this); if (ctrl->IsShown()) sec+=_T(" ")+ctrl->GetValue(); } if (ChkRot->GetValue()) sec+=_T(" rot"); sel=true; } if (SecTree->GetItemParent(item_s)==dbId) { sec=SecTree->GetItemText(item_s); long item = -1; for ( ;; ) { item = SecList->GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); if (item==-1) break; sec+=_T(" ")+SecList->GetItemText(item); sel=true; } if (ChkRot->GetValue()) sec+=_T(" rot"); } } if (!sel) sec.Empty(); text.Add(sec); return text; } void MatSecDialog::SetMatList(wxString table) { //set cols and labels MatList->ClearAll(); MatList->InsertColumn(0, table); //set tables wxArrayString values = QueryTable(dbMat, table, _T("E,rho")); wxChar cs(_T(',')); MatList->InsertColumn(1, (_T("E [")+dbMatUnit.BeforeFirst(cs)+_T("/")+dbMatUnit.AfterLast(cs)+_T("2]"))); MatList->InsertColumn(2, (_T("rho [")+dbMatUnit.BeforeFirst(cs)+_T("/")+dbMatUnit.AfterLast(cs)+_T("3]"))); //attach values to list for (size_t row=0; rowInsertItem(row, line.BeforeFirst(cs)); line=line.AfterFirst(cs); MatList->SetItem(row, 1, line.BeforeFirst(cs)); line=line.AfterFirst(cs); MatList->SetItem(row, 2, line.BeforeFirst(cs)); line=line.AfterFirst(cs); } } void MatSecDialog::SetSecList(wxString table) { wxString select = _T("A,Iy,Wy,Az"); if (ChkRot->GetValue()) select = _T("A,Iz,Wz,Ay"); wxArrayString values = QueryTable(dbSec, table, select); wxString u_exp(_T("2432")); wxChar cs(_T(',')); //set cols and labels SecList->ClearAll(); SecList->InsertColumn(0, table); int col(1); while (!select.IsEmpty()) { wxString label = (select.BeforeFirst(cs)+_T(" [")+dbSecUnit+u_exp.Mid(col-1,1)+_T("]")); SecList->InsertColumn(col, label); select=select.AfterFirst(cs); col++; } //attach values to list for (size_t row=0; rowInsertItem(row, name); col=1; while (!line.IsEmpty()) { SecList->SetItem(row, col, line.BeforeFirst(cs)); line=line.AfterFirst(cs); col++; } } } void MatSecDialog:: CopyTableToTc(wxString table) { //set defined section from selected db wxString sel; long item = -1; for ( ;; ) { item = SecList->GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); if (item==-1) break; sel = SecList->GetItemText(item); } if (!sel.IsEmpty()) { wxString h, t, b, s; wxChar cs(_T(',')); //query table twice because it searches recursively wxArrayString tbls = QueryTable(dbSec, table, _T("h,t")); for (size_t row=0; rowGetValue()) { wxString swap; swap=h; h=b; b=swap; swap=t; t=s; s=t; } //fill into tc for (int i=0; i<4; i++) { wxTextCtrl *ctrl = (wxTextCtrl*) FindWindowById(900+i, this); switch (i) { case 0: ctrl->ChangeValue(h); break; case 1: ctrl->ChangeValue(b); break; case 2: ctrl->ChangeValue(t); break; case 3: ctrl->ChangeValue(s); break; } } //set section to hollow if (SecTree->GetItemText(SecTree->GetSelection()).MakeUpper()!=_T("ISEC")) ChkHol->SetValue(true); else ChkHol->SetValue(false); } } wxString MatSecDialog::QueryDB(wxString dbLoc) { //query database to get tables wxString tables; //check file beforehand otherwise wxwidgets will throw an exception wxString head; if (wxFile::Exists(dbLoc)) { wxTextFile *xmlFile = new wxTextFile; xmlFile->Open(dbLoc); head = xmlFile->GetFirstLine(); xmlFile->Close(); } if (head.Left(5)==_T("GetChildren(); while (child) { wxString nStr=child->GetName(); if (nStr==_T("units")) //get units { wxXmlNode *subchild = child->GetChildren(); while (subchild) { tables+=subchild->GetNodeContent()+cs; subchild = subchild->GetNext(); } } else if (nStr!=tbl) //get table names { if (child->GetType()==1) { tables+=nStr+cs; tbl=nStr; } } child = child->GetNext(); } } } return tables; } wxArrayString MatSecDialog::QueryTable(wxString dbLoc, wxString table, wxString select) { //query database to get values for a certain table wxArrayString values; wxXmlDocument doc; if (doc.Load(dbLoc)) { wxXmlNode *child = doc.GetRoot()->GetChildren(); while (child) { if (child->GetName()==table) { wxXmlNode *subchild = child->GetChildren(); wxChar cs(_T(',')); wxString val(subchild->GetNodeContent()+cs); //get the name wxString sel(select); while (subchild) { wxString label=sel.BeforeFirst(cs); if (subchild->GetName()==label) { val+=subchild->GetNodeContent()+cs; sel=sel.AfterFirst(cs); } subchild = subchild->GetNext(); } values.Add (val); } child = child->GetNext(); } } return values; } double MatSecDialog::ConvUnit(wxString from, wxString to, wxString u_exp) { double f(1); //units are related to kN, m wxArrayString units; units.Add(_T("kN, 1")); units.Add(_T("N, 1000")); units.Add(_T("kip, 0.22480894")); units.Add(_T("m, 1")); units.Add(_T("cm, 100")); units.Add(_T("mm, 1000")); units.Add(_T("ft, 3.28084")); units.Add(_T("in, 39.37008")); for (size_t i=0; iShow(set); SecSizer->Hide(hd); SecSizer->Show(sh, true); Vsizer->SetSizeHints(this); Vsizer->Fit(this); //resize the dialog to fit all in wxSize sz = this->GetClientSize(); sz.SetHeight(sz.GetHeight()+1); this->SetClientSize(sz); } void MatSecDialog::UpdateSecTc() { wxString table = SecTree->GetItemText(SecTree->GetSelection()); for (int i=0; i<4; i++) { wxStaticText *txt = (wxStaticText*) FindWindowById(800+i, this); wxTextCtrl *ctrl = (wxTextCtrl*) FindWindowById(900+i, this); bool set; if (i==1) //b { set=true; if (table.MakeUpper()==_T("TUBE")) set=false; txt->Show(set); ctrl->Show(set); } if (i>1) //t,s { set=ChkHol->GetValue(); if (table.MakeUpper()==_T("ISEC")) set=true; if (i==3 && table.MakeUpper()==_T("TUBE")) set=false; txt->Show(set); ctrl->Show(set); } } } void MatSecDialog::CalcSec() { double b, h, s, t; double A(0), I(0), W(0), Av(0); wxString table = SecTree->GetItemText(SecTree->GetSelection()); for (int i=0; i<4; i++) { wxTextCtrl *ctrl = (wxTextCtrl*) FindWindowById(900+i, this); wxString input=ctrl->GetValue(); input = sMult(input, ConvUnit(dbSecUnit, lnUnit, _T("1"))); //convert unit switch (i) { case 0: input.ToDouble(&h); break; case 1: input.ToDouble(&b); break; case 2: input.ToDouble(&t); break; case 3: input.ToDouble(&s); break; } } if (table.MakeUpper()==_T("RECT")) { A=b*h; I=b*pow(h,3)/12; W=I/(h/2); Av=A/1.5; if (ChkHol->GetValue()) { double bi=(b-2*s); double hi=(h-2*t); A-=(bi*hi); I-=(bi*pow(hi,3)/12); W=I/(h/2); Av=A*(b*s)/(b*s+h*t); } } if (table.MakeUpper()==_T("ISEC")) { double bi=b-s; double hi=h-2*t; A=b*h-(bi*hi); I=(b*pow(h,3)-bi*pow(hi,3))/12; W=I/(h/2); Av=(h-t)*s; if (ChkRot->GetValue()) { hi=h-t; bi=b-2*s; A=h*b-(hi*bi); I=(2*s*pow(h,3)+bi*pow(t,3))/12; W=I/(h/2); Av=2*h*s; } } if (table.MakeUpper()==_T("TUBE")) { double pi=3.1415926; A=pi/4*pow(h,2); I=pi/64*pow(h,4); W=I/(h/2); Av=A/2; if (ChkHol->GetValue()) { double hi=(h-2*t); A-=pi/4*pow(hi,2); I-=pi/64*pow(hi,4); W=I/(h/2); Av=A/2; } } if (A*W*I*Av>0) { for (int i=0; i<4; i++) { double val(0); switch (i) { case 0: val=A; break; case 1: val=I; break; case 2: val=W; break; case 3: val=Av; break; } wxString rStr; rStr.Printf(_T("%1.2e"), val); wxTextCtrl *ctrl = (wxTextCtrl*) FindWindowById(1002+i, this); ctrl->ChangeValue(rStr); } } } //----------------- defined section drawing canvas ----------------- BEGIN_EVENT_TABLE(MatSecDialog::SecGraph, wxScrolledWindow) EVT_PAINT(MatSecDialog::SecGraph::OnPaint) EVT_SIZE(MatSecDialog::SecGraph::OnSize) END_EVENT_TABLE() void MatSecDialog::SecGraph::OnPaint(wxPaintEvent& event) { wxPaintDC dc(this); //get window dimensions wxSize sz = GetClientSize(); wxRect bounds(0, 0, sz.x, sz.y); dc.Clear(); dc.DrawRectangle(bounds); //keep it quadratical bounds.x+=bounds.width/2; bounds.y+=bounds.height/2; if (bounds.height>bounds.width) bounds.height=bounds.width; else bounds.width=bounds.height; switch (type) { case 0 : DrawRect(dc, bounds, false, false); break; case 1 : DrawRect(dc, bounds, false, true); break; case 2 : DrawRect(dc, bounds, true, false); break; case 3 : DrawRect(dc, bounds, true, true); break; case 4 : DrawIsec(dc, bounds, false); break; case 5 : DrawIsec(dc, bounds, true); break; case 6 : DrawTube(dc, bounds, false); break; case 7 : DrawTube(dc, bounds, true); break; } } void MatSecDialog::SecGraph::OnSize(wxSizeEvent& event) { Refresh(); } void MatSecDialog::SecGraph::SetType(wxString sec, bool hollow, bool rot) { if (sec.MakeUpper()==_T("RECT")) if (!hollow) { if (!rot) type=0; else type=1; } else { if (!rot) type=2; else type=3; } if (sec.MakeUpper()==_T("ISEC")) if (!rot) type=4; else type=5; if (sec.MakeUpper()==_T("TUBE")) if (!hollow) type=6; else type=7; Refresh(); } void MatSecDialog::SecGraph::DrawRect(wxDC& dc, wxRect bounds, bool hollow, bool rot) { int x0 = bounds.x; int y0 = bounds.y; int width, height, sf; if (!rot) { height=int(bounds.height*0.62); width=int(bounds.height*0.38); sf=int(0.08*height); } else { width=int(bounds.width*0.62); height=int(bounds.width*0.38); sf=int(0.08*width); } dc.SetPen(wxPen(wxColour(*wxBLACK),2)); dc.DrawRectangle(x0-width/2, y0-height/2, width, height); dc.SetPen(wxPen(wxColour(*wxBLACK),1)); DrawDim(dc, wxPoint(x0-width/2, y0+height/2), width, sf, _T("b"), 0); DrawDim(dc, wxPoint(x0+width/2, y0+height/2), height, sf, _T("h"), 1); if (hollow) { int t = int(sf*1.25); dc.DrawRectangle(x0-width/2+t, y0-height/2+t, width-(2*t), height-(2*t)); DrawDim(dc, wxPoint(x0-width/2, y0-height/2-3*sf), t, sf, _T("s"), 0); DrawDim(dc, wxPoint(x0+width/2-t, y0-height/2-3*sf), t, sf, _T("s"), 0); DrawDim(dc, wxPoint(x0-width/2-3*sf, y0+height/2), t, sf, _T("t"), 1); DrawDim(dc, wxPoint(x0-width/2-3*sf, y0-height/2+t), t, sf, _T("t"), 1); } } void MatSecDialog::SecGraph::DrawIsec(wxDC& dc, wxRect bounds, bool rot) { int x0 = bounds.x; int y0 = bounds.y; if (!rot) { int height = int(bounds.height*0.62); int width = int(bounds.height*0.38); int t = int(0.08*height); dc.SetPen(wxPen(wxColour(*wxBLACK),2)); dc.DrawLine(x0-t/2, y0-height/2+t, x0-t/2, y0+height/2-t); dc.DrawLine(x0+t/2, y0-height/2+t, x0+t/2, y0+height/2-t); dc.DrawRectangle(x0-width/2, y0-height/2, width, t); dc.DrawRectangle(x0-width/2, y0+height/2-t, width, t); int sf = t; dc.SetPen(wxPen(wxColour(*wxBLACK),1)); DrawDim(dc, wxPoint(x0-width/2, y0+height/2), width, sf, _T("b"), 0); DrawDim(dc, wxPoint(x0+width/2, y0+height/2), height, sf, _T("h"), 1); DrawDim(dc, wxPoint(x0-t/2, y0-height/2-3*sf), t, sf, _T("s"), 0); DrawDim(dc, wxPoint(x0-width/2-3*sf, y0+height/2), t, sf, _T("t"), 1); DrawDim(dc, wxPoint(x0-width/2-3*sf, y0-height/2+t), t, sf, _T("t"), 1); } else { int width = int(bounds.width*0.62); int height = int(bounds.width*0.38); int t = int(0.08*width); dc.SetPen(wxPen(wxColour(*wxBLACK),2)); dc.DrawLine(x0-width/2+t, y0+t/2, x0+width/2-t, y0+t/2); dc.DrawLine(x0-width/2+t, y0-t/2, x0+width/2-t, y0-t/2); dc.DrawRectangle(x0-width/2, y0-height/2, t, height); dc.DrawRectangle(x0+width/2-t, y0-height/2, t, height); int sf = t; dc.SetPen(wxPen(wxColour(*wxBLACK),1)); DrawDim(dc, wxPoint(x0-width/2, y0+height/2), width, sf, _T("b"), 0); DrawDim(dc, wxPoint(x0+width/2, y0+height/2), height, sf, _T("h"), 1); DrawDim(dc, wxPoint(x0-width/2, y0-height/2-3*sf), t, sf, _T("s"), 0); DrawDim(dc, wxPoint(x0+width/2-t, y0-height/2-3*sf), t, sf, _T("s"), 0); DrawDim(dc, wxPoint(x0-width/2-3*sf, y0+t/2), t, sf, _T("t"), 1); } } void MatSecDialog::SecGraph::DrawTube(wxDC& dc, wxRect bounds, bool hollow) { int x0 = bounds.x; int y0 = bounds.y; int radius=int(bounds.height*0.25); int sf=int(0.16*radius); dc.SetPen(wxPen(wxColour(*wxBLACK),2)); dc.DrawCircle(x0, y0, radius); dc.SetPen(wxPen(wxColour(*wxBLACK),1)); DrawDim(dc, wxPoint(x0+radius, y0+radius), radius*2, sf, _T("h"), 1); if (hollow) { int t = int(sf*1.25); dc.DrawCircle(x0, y0, radius-t); DrawDim(dc, wxPoint(x0-radius-3*sf, y0-radius+t), t, sf, _T("t"), 1); } } void MatSecDialog::SecGraph::DrawDim(wxDC& dc, wxPoint pos, int len, int sf, wxString txt, bool rot) { wxPoint from(pos), to, d1, d2, tpos; double angle; if (!rot) { from.y+=2*sf; to=from; to.x+=len; d1.x=0; d1.y=sf/2; d2.x=+sf/3; d2.y=-sf/3; tpos=from; tpos.x+=int(len/2-0.2*sf); tpos.y-=int(sf*1.8); angle=0; } else { from.x+=2*sf; to=from; to.y-=len; d1.x=sf/2; d1.y=0; d2.x=sf/3; d2.y=sf/3; tpos=from; tpos.y-=int(len/2-0.2*sf); tpos.x-=int(sf*1.8); angle=90; } dc.DrawLine(from.x, from.y, to.x, to.y); dc.DrawLine(from.x+d1.x, from.y+d1.y, from.x-d1.x, from.y-d1.y); dc.DrawLine(from.x+d2.x, from.y+d2.y, from.x-d2.x, from.y-d2.y); dc.DrawLine(to.x+d1.x, to.y+d1.y, to.x-d1.x, to.y-d1.y); dc.DrawLine(to.x+d2.x, to.y+d2.y, to.x-d2.x, to.y-d2.y); wxFont txtFont(*wxNORMAL_FONT); txtFont.SetPointSize(sf); dc.SetFont(txtFont); dc.DrawRotatedText(txt, tpos.x, tpos.y, angle); } //---------------- settings dialog ------------------------- BEGIN_EVENT_TABLE(SettingsDialog, wxDialog) EVT_BUTTON(ID_BT_OK, SettingsDialog::OnClose) EVT_BUTTON(ID_BT_ESC, SettingsDialog::OnClose) EVT_BUTTON(ID_BT_LF, SettingsDialog::OnSetLF) EVT_BUTTON(ID_BT_MAT, SettingsDialog::OnSetDB) EVT_BUTTON(ID_BT_SEC, SettingsDialog::OnSetDB) END_EVENT_TABLE() SettingsDialog::SettingsDialog(wxFrame *parent, wxWindowID id, const wxString &title, wxString file) : wxDialog(parent, id, title, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER) { SetBackgroundColour(wxColour(*wxWHITE)); wxPoint pos = wxGetMousePosition(); SetSize(pos.x, pos.y, 200, 200); //check box header ChkHd = new wxCheckBox(this, ID_CHK, _T("print header"), wxDefaultPosition, wxSize(220,30)); ChkHd->SetValue(true); //text control header TcHd = new wxTextCtrl(this, -1, _T(""), wxDefaultPosition, wxSize(250,60), wxTE_MULTILINE); //combo box force/len units wxPanel *u_panel = new wxPanel(this, -1, wxDefaultPosition, wxSize(250,50)); new wxStaticText(u_panel, -1, _T("Force Units:"), wxPoint(0,0), wxSize(90,20)); new wxStaticText(u_panel, -1, _T("Length Units:"), wxPoint(100,0), wxSize(90,20)); wxArrayString units; units.Add(_T("N")); units.Add(_T("kN")); units.Add(_T("kip")); CbFc = new wxComboBox(u_panel, -1, _T("kN"), wxPoint(0,20), wxSize(60,25), units, wxCB_READONLY); units.Empty(); units.Add(_T("mm")); units.Add(_T("cm")); units.Add(_T("m")); units.Add(_T("in")); units.Add(_T("ft")); CbLn = new wxComboBox(u_panel, -1, _T("m"), wxPoint(100,20), wxSize(60,25), units, wxCB_READONLY); //button load factors wxButton *BtLF = new wxButton(this, ID_BT_LF, _T("LF"), wxDefaultPosition, wxSize(35,25)); wxBoxSizer *H1sizer = new wxBoxSizer(wxHORIZONTAL); H1sizer->Add(u_panel, 1); H1sizer->Add(BtLF, 0, wxALIGN_BOTTOM | wxLEFT, 12); //text control mat/sec database TcMat = new wxTextCtrl(this, -1, _T(""), wxPoint(0,20), wxSize(150,25)); wxButton *BtMat = new wxButton(this, ID_BT_MAT, _T("Mat"), wxDefaultPosition, wxSize(35,25)); wxBoxSizer *H2sizer = new wxBoxSizer(wxHORIZONTAL); H2sizer->Add(TcMat, 1, wxRIGHT, 12); H2sizer->Add(BtMat, 0); TcSec = new wxTextCtrl(this, -1, _T(""), wxPoint(0,20), wxSize(150,25)); wxButton *BtSec = new wxButton(this, ID_BT_SEC, _T("Sec"), wxDefaultPosition, wxSize(35,25)); wxBoxSizer *H3sizer = new wxBoxSizer(wxHORIZONTAL); H3sizer->Add(TcSec, 1, wxRIGHT | wxTOP, 12); H3sizer->Add(BtSec, 0, wxTOP, 12); //buttons wxBoxSizer *BtSizer = new wxBoxSizer(wxHORIZONTAL); BtSizer->Add(new wxButton( this, ID_BT_OK, _T("OK"), wxDefaultPosition, wxSize(60,25)), 0, wxALL, 10); BtSizer->Add(new wxButton( this, ID_BT_ESC, _T("Cancel"), wxDefaultPosition, wxSize(60,25)), 0, wxALL, 10); //layout wxBoxSizer *Vsizer = new wxBoxSizer(wxVERTICAL); Vsizer->Add(ChkHd, 0, wxALIGN_LEFT | wxRIGHT | wxLEFT | wxTOP, 20); Vsizer->Add(TcHd, 1, wxEXPAND | wxRIGHT | wxLEFT , 20); Vsizer->Add(H1sizer, 0, wxEXPAND | wxALL, 20); Vsizer->Add(new wxStaticText(this, -1, _T("Material/Section Database:"), wxDefaultPosition, wxSize(200,20)), 0, wxRIGHT | wxLEFT, 20); Vsizer->Add(H2sizer, 0, wxEXPAND | wxRIGHT | wxLEFT, 20); Vsizer->Add(H3sizer, 0, wxEXPAND | wxRIGHT | wxLEFT, 20); Vsizer->Add(BtSizer, 0, wxALIGN_CENTER | wxALL, 20); SetSizer(Vsizer); Vsizer->SetSizeHints(this); //read or create file, set defaults if (!wxFile::Exists(file)) CreateDefaultFile(file); ReadXmlFile(file); xmLoc = file; } void SettingsDialog::OnClose(wxCommandEvent &event) { if (event.GetId()==ID_BT_OK) ChangeXmlFile(); Close(TRUE); } void SettingsDialog::OnSetLF(wxCommandEvent& event) { wxString factors; LoadFactorDialog *dialog = new LoadFactorDialog((wxFrame*) this, -1, _T("Set Load Factors"), ldFac); if (dialog->ShowModal()) factors = dialog->GetFactors(); if (!factors.IsEmpty()) ldFac=factors; else if (!ldFac.IsEmpty()) ldFac.Empty(); } void SettingsDialog::OnSetDB(wxCommandEvent& event) { int id = event.GetId(); if (id==ID_BT_MAT) { wxString file = TcMat->GetValue(); wxFileDialog *openFileDialog = new wxFileDialog(this, _T("Choose Material Database"), wxFileName(file).GetPath(), wxFileName(file).GetFullName(), _T("*.xml"), wxFD_OPEN); if (openFileDialog->ShowModal() == wxID_OK) TcMat->ChangeValue(openFileDialog->GetPath()); } if (id==ID_BT_SEC) { wxString file = TcSec->GetValue(); wxFileDialog *openFileDialog = new wxFileDialog(this, _T("Choose Section Database"), wxFileName(file).GetPath(), wxFileName(file).GetFullName(), _T("*.xml"), wxFD_OPEN); if (openFileDialog->ShowModal() == wxID_OK) TcSec->ChangeValue(openFileDialog->GetPath()); } } void SettingsDialog::ReadXmlFile(wxString file) { //check file beforehand otherwise wxwidgets will throw an exception wxTextFile *xmlFile = new wxTextFile; xmlFile->Open(file); wxString head = xmlFile->GetFirstLine(); xmlFile->Close(); if (head.Left(5)==_T("GetChildren(); while (child) { wxString name = child->GetName(); if (name==_T("header") || name==_T("noheader")) { TcHd->Clear(); wxXmlNode *subchild = child->GetChildren(); while (subchild) { wxString cStr = subchild->GetNodeContent(); if (!cStr.IsEmpty()) TcHd->AppendText(cStr+_T("\n")); subchild = subchild->GetNext(); } if (name==_T("header")) ChkHd->SetValue(true); else ChkHd->SetValue(false); } if (name==_T("units")) { wxXmlNode *subchild = child->GetChildren(); while (subchild) { if (subchild->GetName()==_T("force")) CbFc->SetValue(subchild->GetNodeContent()); if (subchild->GetName()==_T("length")) CbLn->SetValue(subchild->GetNodeContent()); subchild = subchild->GetNext(); } } if (name==_T("factors")) { wxXmlNode *subchild = child->GetChildren(); while (subchild) { if (subchild->GetName()==_T("load")) ldFac=subchild->GetNodeContent(); subchild = subchild->GetNext(); } } if (name==_T("database")) { wxXmlNode *subchild = child->GetChildren(); while (subchild) { if (subchild->GetName()==_T("materials")) TcMat->ChangeValue(subchild->GetNodeContent()); if (subchild->GetName()==_T("sections")) TcSec->ChangeValue(subchild->GetNodeContent()); subchild = subchild->GetNext(); } } child = child->GetNext(); } } } } void SettingsDialog::ChangeXmlFile() { wxTextFile *xmlFile = new wxTextFile; xmlFile->Open(xmLoc); xmlFile->Clear(); wxArrayString xmlBody; xmlBody.Add(_T("")); xmlBody.Add(_T("")); wxString head = TcHd->GetValue(); if (ChkHd->GetValue()) xmlBody.Add(_T("
")); else xmlBody.Add(_T(" ")); while (!head.IsEmpty()) { wxString line = head.BeforeFirst(_T('\n')); xmlBody.Add(_T(" ")+ChkXML(line)+_T("")); head=head.AfterFirst(_T('\n')); } if (ChkHd->GetValue()) xmlBody.Add(_T("
")); else xmlBody.Add(_T(" ")); wxString fcUnit = CbFc->GetValue(); wxString lnUnit = CbLn->GetValue(); ; xmlBody.Add(_T(" ")); xmlBody.Add(_T(" ")+fcUnit+_T("")); xmlBody.Add(_T(" ")+lnUnit+_T("")); xmlBody.Add(_T(" ")); xmlBody.Add(_T(" ")); xmlBody.Add(_T(" ")+ldFac+_T("")); xmlBody.Add(_T(" ")); wxString dbMat = TcMat->GetValue(); wxString dbSec = TcSec->GetValue(); xmlBody.Add(_T(" ")); xmlBody.Add(_T(" ")+dbMat+_T("")); xmlBody.Add(_T(" ")+dbSec+_T("")); xmlBody.Add(_T(" ")); xmlBody.Add(_T("
")); for (size_t i=0; iAddLine(xmlBody[i]); xmlFile->Write(); xmlFile->Close(); } wxString SettingsDialog::ChkXML(wxString line) { wxString cStr(line); cStr.Replace(_T("<"), _T("<")); cStr.Replace(_T(">"), _T(">")); cStr.Replace(_T("&"), _T("&")); cStr.Replace(_T("\""), _T(""")); cStr.Replace(_T("'"), _T("'")); cStr.Replace(_T("'"), _T("'")); cStr.Replace(_T("`"), _T("'")); return cStr; } void SettingsDialog::CreateDefaultFile(wxString file) { //create xml file wxTextFile *xmlFile = new wxTextFile; xmlFile->Create(file); wxArrayString xmlBody; xmlBody.Add(_T("")); xmlBody.Add(_T("")); xmlBody.Add(_T("
")); xmlBody.Add(_T(" cba 0.3.6")); xmlBody.Add(_T(" continuous beam analysis")); xmlBody.Add(_T("
")); xmlBody.Add(_T(" ")); xmlBody.Add(_T(" kN")); xmlBody.Add(_T(" m")); xmlBody.Add(_T(" ")); xmlBody.Add(_T(" ")); xmlBody.Add(_T(" ")); xmlBody.Add(_T(" ")); xmlBody.Add(_T(" ")); //changed default database path for debian xmlBody.Add(_T(" /usr/share/cba/materials.xml")); xmlBody.Add(_T(" /usr/share/cba/sections.xml")); xmlBody.Add(_T(" ")); xmlBody.Add(_T("
")); for (size_t i=0; iAddLine(xmlBody[i]); xmlFile->Write(); xmlFile->Close(); } wxArrayString SettingsDialog::GetItems() { wxArrayString text; wxString head = TcHd->GetValue(); if (ChkHd->GetValue()) text.Add(head); else text.Add(_T("")); text.Add(CbFc->GetValue()); text.Add(CbLn->GetValue()); text.Add(ldFac); text.Add(TcMat->GetValue()); text.Add(TcSec->GetValue()); return text; } cba-0.3.6/src/gui/cbaGUI_dialogs.h000066400000000000000000000113661142227325100165730ustar00rootroot00000000000000//cbaGUI_dialogs.h #ifndef cbaGUI_dialogs #define cbaGUI_dialogs #include #include #include #include #include #include #include #include #include //---------------- new beam dialog ------------------------- class BeamDialog: public wxDialog { public: BeamDialog(wxFrame*, wxWindowID, const wxString&); void OnClose(wxCommandEvent&); void OnTcCheck(wxCommandEvent&); wxArrayString GetItems() { return text; } DECLARE_EVENT_TABLE() private: wxSpinCtrl *TcNum; wxArrayString text; enum { ID_BT_OK = wxID_HIGHEST, ID_BT_ESC, }; }; //---------------- load factor dialog ------------------------- class LoadFactorDialog: public wxDialog { public: LoadFactorDialog(wxFrame*, wxWindowID, const wxString&, wxString); void OnClose(wxCommandEvent&); void OnChkBox(wxCommandEvent&); void OnTcCheck(wxCommandEvent&); wxString GetFactors() { return text; } DECLARE_EVENT_TABLE() private: wxCheckBox *ChkMin; wxBoxSizer *Vsizer; wxString text; enum { ID_BT_OK = wxID_HIGHEST, ID_BT_ESC, ID_CHK, }; }; //---------------- constraints dialog ------------------------- class ConstraintsDialog: public wxDialog { public: ConstraintsDialog(wxFrame*, wxWindowID, const wxString&, wxArrayString); void OnClose(wxCommandEvent&); wxArrayString GetValues() { return values; } DECLARE_EVENT_TABLE() private: wxGrid *grid; wxArrayString values; enum { ID_BT_OK = wxID_HIGHEST, ID_BT_ESC, }; }; //---------------- materials/sections dialog ------------------------- class MatSecDialog: public wxDialog { public: MatSecDialog(wxFrame*, wxWindowID, const wxString&); void SetDbLoc(wxString, wxString); void SetUnits(wxString, wxString); void SetMat(wxString); void SetSec(wxString); void SetEI(wxString, wxString); wxArrayString GetItems(); DECLARE_EVENT_TABLE() private: void OnClose(wxCommandEvent&); void OnMatChanged(wxTreeEvent&); void OnSecChanged(wxTreeEvent&); void OnMatTable(wxListEvent&); void OnSecTable(wxListEvent&); void OnChkRot(wxCommandEvent&); void OnChkHol(wxCommandEvent&); void OnSetRes(wxCommandEvent&); void OnTcCheck(wxCommandEvent&); void SetMatList(wxString); void SetSecList(wxString); void CopyTableToTc(wxString); wxString QueryDB(wxString); wxArrayString QueryTable(wxString, wxString, wxString); double ConvUnit(wxString, wxString, wxString); wxString sMult(wxString, double); void ShowDefSec(bool); void UpdateSecTc(); void CalcSec(); wxTreeCtrl *MatTree, *SecTree; wxListCtrl *MatList, *SecList; wxBoxSizer *DefSec, *SecSizer, *Vsizer; wxCheckBox *ChkRot, *ChkHol; wxTreeItemId defId, dbId; wxString dbMat, dbSec; wxString dbMatUnit, dbSecUnit; wxString fcUnit, lnUnit; wxArrayString text; enum { ID_BT_OK = wxID_HIGHEST, ID_BT_ESC, ID_BT_SET, ID_MAT_TREE, ID_MAT_LIST, ID_SEC_TREE, ID_SEC_LIST, ID_CHK_ROT, ID_CHK_HOL, }; //drawing canvas class SecGraph: public wxScrolledWindow { public: SecGraph() {}; virtual ~SecGraph() {}; void SetType(wxString, bool, bool); DECLARE_EVENT_TABLE() private: void OnPaint(wxPaintEvent&); void OnSize(wxSizeEvent&); void DrawRect(wxDC&, wxRect, bool, bool); void DrawIsec(wxDC&, wxRect, bool); void DrawTube(wxDC&, wxRect, bool); void DrawDim(wxDC&, wxPoint, int, int, wxString, bool); int type; }; SecGraph *secgraph; }; //---------------- settings dialog ------------------------- class SettingsDialog: public wxDialog { public: SettingsDialog(wxFrame*, wxWindowID, const wxString&, wxString); wxArrayString GetItems(); DECLARE_EVENT_TABLE() private: void OnClose(wxCommandEvent&); void OnSetLF(wxCommandEvent&); void OnSetDB(wxCommandEvent&); void ReadXmlFile(wxString); void ChangeXmlFile(); wxString ChkXML(wxString); void CreateDefaultFile(wxString); wxCheckBox *ChkHd; wxComboBox *CbFc, *CbLn; wxTextCtrl *TcHd, *TcMat, *TcSec; wxString xmLoc, ldFac; enum { ID_BT_OK = wxID_HIGHEST, ID_BT_ESC, ID_BT_LF, ID_BT_MAT, ID_BT_SEC, ID_CHK, }; }; #endif cba-0.3.6/src/gui/cbaGUI_drawings.cpp000066400000000000000000000444121142227325100173200ustar00rootroot00000000000000//cbaGUI_drawings.cpp #include "cbaGUI_drawings.h" //---------------- GraphFrame ------------------------- BEGIN_EVENT_TABLE(GraphFrame, wxScrolledWindow) EVT_PAINT(GraphFrame::OnPaint) EVT_SIZE(GraphFrame::OnSize) END_EVENT_TABLE() void GraphFrame::OnPaint(wxPaintEvent& event) { wxPaintDC dc(this); dc.Clear(); //get window dimensions wxSize sz = GetClientSize(); wxRect bounds(0, 0, sz.x, sz.y); //set a frame int marg = int(bounds.width*0.05); bounds.x+=marg; bounds.y+=marg; bounds.width-=2*marg; bounds.height-=2*marg; //set font int fs = int(6+bounds.height/100); wxFont txtFont(*wxNORMAL_FONT); txtFont.SetPointSize(fs); dc.SetFont(txtFont); dc.SetPen(wxPen(wxColour(*wxBLACK),1)); // draw switch (type) { case 0 : DrawSystem(dc, bounds, true); break; case 1 : DrawResults(dc, bounds, 3); break; case 2 : DrawStress(dc, bounds); break; } } void GraphFrame::OnSize(wxSizeEvent& event) { Refresh(); } void GraphFrame::SetSystem(vector L, vector R, vector< vector > LMg, vector< vector > LMq) { Store.L = L; Store.R = R; Store.LMg = LMg; Store.LMq = LMq; Refresh(); } void GraphFrame::SetResults(vector< vector > results) { Store.results = results; Refresh(); } void GraphFrame::SetType(int inp) { type=inp; Refresh(); } vector< vector > GraphFrame::GetResults() { return Store.results; } void GraphFrame::Clear() { Store.results.clear(); Store.LMg.clear(); Store.LMq.clear(); Refresh(); } int GraphFrame::DrawSystem (wxDC& dc, wxRect bounds, bool dim) { int ratio(0); //return page usage for printing //get span numbers int nf(Store.L.size()); if (nf>=1) { //set x scale factor for spans double x_max(0); for (int l=0; lbounds.height) dy=int(bounds.height/(max+2)); //set origin wxCoord x0(bounds.x); wxCoord y0(bounds.y+max*dy); wxRect area (x0, y0, 0, dy); //return ratio for printout ratio=int(max*dy*100/bounds.height); //draw beam DrawBeam (dc, bounds, y0, dim); //get max/min load for scaling vector max_ld; for (int lt=1; lt<=6; lt++) { vector vec; for (int i=0; imax_ld[0]) max_ld[0]=m; } //draw loads for each span double l(0); for (int i=0; i > LM; switch (lc) { case 0: LM=Store.LMg; //draw permanent loads dc.SetPen(wxPen(wxColour(*wxBLUE),1)); dc.SetBrush(wxBrush(wxColour(*wxBLUE), wxVERTICAL_HATCH)); break; case 1: LM=Store.LMq; //draw live loads dc.SetPen(wxPen(wxColour(*wxRED),1)); dc.SetBrush(wxBrush(wxColour(*wxRED), wxVERTICAL_HATCH)); break; } for (int j=0; j LMi, double max_ld) { //set some vertical space between loads int spc = int(bounds.height*0.05); int x0 = bounds.x; int y0 = bounds.y-spc; int wd = bounds.width; int ht = bounds.height-2*spc; int ispan = int(LMi[0]); int type = int(LMi[1]); double ld = LMi[2]; double a = LMi[3]; double l = LMi[4]; //scale load if (ld>=0) ht=int(0.5*ht+0.5*ht*ld/max_ld); else { ht=-int(0.5*ht+0.5*ht*-ld/max_ld); y0+=ht; } //scale load position double L = Store.L[ispan-1]; int xa = x0+int(wd*a/L); int xl = int(wd*l/L); wxBrush brush = dc.GetBrush(); switch (type) { case 1: //load type 1 - udl dc.DrawRectangle(x0, y0-ht, wd, ht); break; case 2: //load type 2 - point load dc.DrawLine(xa, y0-ht, xa, y0); DrawArrow (dc, wxPoint(xa, y0), ht/3); break; case 3: //load type 3 - partial udl dc.DrawRectangle(xa, y0-ht, xl, ht); break; case 4: //load type 4 - moment load brush.SetStyle(wxTRANSPARENT); dc.SetBrush(brush); if (ld>0) { dc.DrawArc(xa, y0, xa-ht/2, y0-ht/2, xa, y0-ht/2); DrawArrow (dc, wxPoint(xa-ht/2, y0-ht/3), ht/3); } else { dc.DrawArc(xa-ht/2, y0-ht/2, xa, y0-ht, xa, y0-ht/2); DrawArrow (dc, wxPoint(xa-ht/2, int(y0-0.67*ht)), -ht/3); } brush.SetStyle(wxVERTICAL_HATCH); dc.SetBrush(brush); break; case 5: //load type 5 - trapezoidal loads DrawTrapeze(dc, wxPoint(x0, y0), wd, -ht, xa-x0, xa-x0+xl); break; case 6: //load type 6 - partial triangular loads if (xl!=0) DrawTrapeze(dc, wxPoint(xa, y0), xl, -ht, 0, 0); break; } } void GraphFrame::DrawArrow (wxDC& dc, wxPoint origin, int sf) { wxCoord x(origin.x); wxCoord y(origin.y); dc.DrawLine(x, y, x+sf/2, y-sf); dc.DrawLine(x+sf/2, y-sf, x-sf/2, y-sf); dc.DrawLine(x-sf/2, y-sf, x, y); } void GraphFrame::DrawTrapeze (wxDC& dc, wxPoint a, int wd, int ht, int xa, int xb) { wxPoint b(a), c(a), d(a); b.x+=wd; c.x+=xb; c.y+=ht; d.x+=xa; d.y+=ht; wxPoint pts[4] ={a,b,c,d}; dc.DrawPolygon(4, pts); } int GraphFrame::GetLoadLines() { //get span numbers int nf=Store.L.size(); //get max number of loads per span int mg(0), mq(0); for (int i=1; i<=nf; i++) { int ng(0); for (int j=0; jmg) mg=ng; int nq(0); for (int j=0; jmq) mq=nq; } return mg+mq; } double GraphFrame::GetVecPeak(vector vec) { double max(0), min(0); for (int i=0; imax) max=vec[i]; for (int i=0; i0) valStr=(_T("Sigma:")); val--; break; case 3: if (!Store.LF) valStr=(_T("V:")); else valStr=(_T("Vd:")); break; case 4: if (Store.Az>0) valStr=(_T("Tau:")); val--; break; case 5: if (!Store.EI) valStr=(_T("EId:")); else { valStr=_T("d:"); prec=_T("%1.3f"); //scale deflection values } break; } dc.DrawText(valStr, x0, wxCoord(y0-height*0.3)); //set scale factor for x double x_max=Store.results[0].back(); double x_scale=width/x_max; //set scale factor for y and global max/min value double y_max=GetVecPeak(Store.results[val]); double y_min=GetVecPeak(Store.results[val+1]); double y_scale=(0.40*height); if (y_max>y_min) y_scale/=y_max; else y_scale/=y_min; for (int j=0; j<2; j++) { wxCoord x_prv(x0), y_prv(y0); switch (j) { case 0: dc.SetPen(wxPen(wxColour(*wxBLUE),1)); break; case 1: dc.SetPen(wxPen(wxColour(*wxRED),1)); break; } bool xtxt(true); for (int i=0; i0) y/=Store.Wy; if (valStr==_T("Tau:") && Store.Az>0) y/=Store.Az; wxString valY; if (y<-1000 || y>1000) { valY.Printf(prec,y/1000); valY+=_T("k"); } else valY.Printf(prec,y); int fs = int(1.6*wxFont(dc.GetFont()).GetPointSize()); dc.DrawText(valY, x_coord-fs, y_coord+j*-fs); xtxt=false; //draw only one text } //draw vertical line dc.DrawLine(x_coord, y0, x_coord, y_coord); x_prv=x_coord; y_prv=y_coord; } } } void GraphFrame::DrawBeam (wxDC& dc, wxRect bounds, wxCoord y0, bool dim) { int width = bounds.width; int height = bounds.height; int x0 = bounds.x; dc.SetPen(wxPen(wxColour(*wxBLACK),1)); dc.DrawLine(x0, y0, x0+width, y0); //set scale factor for x double x_max(0); for (size_t l=0; l0) //spring support deflection { dc.DrawLine(x, y, x, int(y+0.1*sf)); dc.DrawLine(x, int(y+0.1*sf), x-sf/2, int(y+0.2*sf)); dc.DrawLine(x-sf/2, int(y+0.2*sf), x+sf/2, int(y+0.4*sf)); dc.DrawLine(x+sf/2, int(y+0.4*sf), x-sf/2, int(y+0.6*sf)); dc.DrawLine(x-sf/2, int(y+0.6*sf), x+sf/2, int(y+0.8*sf)); dc.DrawLine(x+sf/2, int(y+0.8*sf), x, int(y+0.9*sf)); dc.DrawLine(x, int(y+0.9*sf), x, y+sf); dc.DrawLine(x-sf/2, y+sf, x+sf/2, y+sf); } if (rot<0) //fixed support rotation { dc.DrawLine(x-sf/2, y-sf/2, x+sf/2, y+sf/2); dc.DrawLine(x+sf/2, y-sf/2, x-sf/2, y+sf/2); } if (rot>0) //spring support rotation { dc.DrawLine(x-sf/2, y+sf/2, x-sf/2, y+sf); wxBrush brush = dc.GetBrush(); dc.SetBrush(wxBrush(brush.GetColour(), wxTRANSPARENT)); dc.DrawArc(x-sf/2, y+sf/2, x, y, x, y+sf/2); dc.SetBrush(brush); } } void GraphFrame::DrawDim(wxDC& dc, wxPoint pos, int len, int sf, wxString txt) { wxPoint from(pos); from.y+=2*sf; wxPoint to(from); to.x+=len; wxPoint d1, d2; d1.x=0; d1.y=sf/2; d2.x=+sf/3; d2.y=-sf/3; dc.DrawLine(from.x, from.y, to.x, to.y); dc.DrawLine(from.x+d1.x, from.y+d1.y, from.x-d1.x, from.y-d1.y); dc.DrawLine(from.x+d2.x, from.y+d2.y, from.x-d2.x, from.y-d2.y); dc.DrawLine(to.x+d1.x, to.y+d1.y, to.x-d1.x, to.y-d1.y); dc.DrawLine(to.x+d2.x, to.y+d2.y, to.x-d2.x, to.y-d2.y); wxSize ext=dc.GetTextExtent(txt); wxPoint tpos(from); tpos.x+=int((len-ext.x)/2); tpos.y+=int(ext.y/5); dc.DrawText(txt, tpos.x, tpos.y); } int GraphFrame::DrawResultText (wxDC& dc, wxRect bounds, wxArrayString resTxt) { int x0 = bounds.x; int y0 = bounds.y; //set scale factor for text wxFont font = dc.GetFont(); int fs = font.GetPointSize(); //see if it fits on the page int lines = resTxt.GetCount(); int ht = lines*3*fs/2; int ratio = (int) 100*ht/bounds.height; if (ratio>100) { fs = (int) fs*100/ratio; ratio=100; } font.SetPointSize(fs); dc.SetFont(font); //output as table with fixed cols for (size_t i=0; ix0+bounds.width) break; } y0+=3*fs/2; } return ratio; } int GraphFrame::DrawHead (wxDC& dc, wxRect bounds, wxString headTxt) { int ratio(0); if (!headTxt.IsEmpty()) { //get font size int fs = dc.GetFont().GetPointSize(); //draw header text int y0 = bounds.y; while (!headTxt.IsEmpty()) { dc.DrawText(headTxt.BeforeFirst(_T('\n')), bounds.x, y0); headTxt=headTxt.AfterFirst(_T('\n')); y0+=3*fs/2; if (y0>(bounds.y+bounds.height)) break; } //draw a line y0+=3*fs/2; wxPen pen = dc.GetPen(); dc.SetPen(wxPen(wxColour(*wxLIGHT_GREY),1)); dc.DrawLine(bounds.x, y0, bounds.x+bounds.width, y0); dc.SetPen(pen); ratio = int((y0-bounds.y)*100/bounds.height); } return ratio; } cba-0.3.6/src/gui/cbaGUI_drawings.h000066400000000000000000000036561142227325100167720ustar00rootroot00000000000000//cbaGUI_drawings.h #ifndef cbaGUI_drawings #define cbaGUI_drawings #include #include #include #include using namespace std; //---------------- GraphFrame ------------------------- class GraphFrame: public wxScrolledWindow { public: GraphFrame() {}; virtual ~GraphFrame() {}; void SetSystem(vector, vector, vector< vector >, vector< vector >); void SetResults(vector< vector >); void SetSec(double mod, double sha) { Store.Wy=mod; Store.Az=sha; } void SetEI(bool set) { Store.EI=set; } void SetLF(bool set) { Store.LF=set; } void SetSW(bool set) { Store.SW=set; } void SetType(int); vector< vector > GetResults(); void Clear(); int DrawSystem (wxDC&, wxRect, bool); int DrawResultText(wxDC&, wxRect, wxArrayString); int DrawHead(wxDC&, wxRect, wxString); void DrawResults(wxDC&, wxRect, int); DECLARE_EVENT_TABLE() private: void OnPaint(wxPaintEvent&); void OnSize(wxSizeEvent&); void DrawLoad(wxDC&, wxRect, vector, double); void DrawArrow(wxDC&, wxPoint, int); void DrawTrapeze(wxDC&, wxPoint, int, int, int, int); int GetLoadLines(); double GetVecPeak(vector); void DrawValues(wxDC&, wxRect, int); void DrawStress (wxDC&, wxRect); void DrawBeam(wxDC&, wxRect, wxCoord, bool); void DrawSupport(wxDC&, wxPoint, wxCoord, int); void DrawDim(wxDC&, wxPoint, int, int, wxString); class Store_values { public: vector L; vector R; double Wy, Az; bool EI, LF, SW; vector< vector > LMg; vector< vector > LMq; vector< vector > results; }; Store_values Store; int type; }; #endif cba-0.3.6/src/gui/cbeam_class.cpp000066400000000000000000000724171142227325100165720ustar00rootroot00000000000000//cbeam_class.cpp continuous beam analysis class GPLv3 - implementation #include "cbeam_class.h" cBeam::cBeam() { npts = 100; //default points per span lfG=1.0; //default safety factors for permanant/live loads lfQ=1.0; lfG_min=1.0; //safety factors for disburdening loads lfQ_min=0.0; } cBeam::~cBeam() { } bool cBeam::SetGeometry(vector Li, double Ei, vector Ii, vector Ri) { //set span lengths [L] L.clear(); for (int i=0; i0) L.push_back(Li[i]); //check if length >0 int nf=L.size(); //number of spans if (nf>0) { //set elastic modulus [E] if (Ei>0.0001) E=Ei; else E=1; //set default if not given //set moments of inertia [I] I.clear(); for (int i=0; i0) I.push_back(Ii[i]); //check if inertia >0 if (I.size()!=nf) //check if I fits to the span numbers { I.clear(); if (Ii.size()==1) for (int i=0; in) m=n; for (int i=0; i Li) { //creating empty values, if only spans are given double Ei=1; vector Ii; vector Ri; if (SetGeometry(Li,Ei,Ii,Ri)) return true; else return false; } vector< vector > cBeam::GetGeometry() { vector< vector > v; v.push_back(L); v.push_back(vector(L.size(),E)); v.push_back(I); v.push_back(R); return v; } bool cBeam::SetLoads(vector< vector > LMi) { LMg.clear(); LMq.clear(); vector ld; for (int i=0; i2) //span, type and 1 load must be given { if (ld[0]>0 && int(ld[0])<=L.size()) //load has to be on a span { for (int j=0; j<2; j++) { if (ld.size()>2+j) { if(ld[2+j]!=0) //if permanent/live load is given { vector l; l.push_back(ld[0]); //fill in span l.push_back(ld[1]); //fill in type l.push_back(ld[2+j]); //fill in permanent/live load double span=L[int(ld[0])-1]; //get length for this span if (ld.size()>4) //fill in start if given or zero { if (ld[4]<0) ld[4]=0; //check if load sits on the span if (ld[4]>span) ld[4]=span; l.push_back(ld[4]); } else l.push_back(0); if (ld.size()>5) //fill in length if given or zero { if (ld[1]<6) //check if load fits the span { if (ld[5]<0) ld[5]=0; if ((ld[4]+ld[5])>span) ld[5]=span-ld[4]; } else //lt6: length can be negative { if (ld[5]>0) if ((ld[4]+ld[5])>span) ld[5]=span-ld[4]; if (ld[5]<0) if ((ld[4]+ld[5])<0) ld[5]=-ld[4]; } l.push_back(ld[5]); } else l.push_back(0); if (!((ld[1]==3 || ld[1]==6) && ld[2+j]*ld[5]==0)) //check if p*c=0 { if (j==0) LMg.push_back(l); //fill into permanent load matrix if (j==1) LMq.push_back(l); //fill into live load matrix } } } } } } } if ((LMg.size()+LMq.size())>0) return true; else return false; } //get permanent loads vector< vector > cBeam::GetLoadsG() { return LMg; } //get live loads vector< vector > cBeam::GetLoadsQ() { return LMq; } void cBeam::SetLoadFactors(double g, double q) { lfG=g; lfQ=q; } void cBeam::SetLoadFactors(double g, double q, double g_min, double q_min) { lfG=g; lfQ=q; lfG_min=g_min; lfQ_min=q_min; //keep this zero, if you want to have save results } bool cBeam::Solve() { int nf=L.size(); if (nf!=0) //check if someone called this without setting geometry { int lmG=LMg.size(); int lmQ=LMq.size(); int lmSize = lmG+lmQ; vector< vector > LM; vector< vector > w(lmSize,vector(5,0)); vector< vector > wmax(lmSize,vector(5,0)); vector< vector > wmin(lmSize,vector(5,0)); for (int i=0; i > cBeam::GetResults() { int nf=L.size(); vector< vector > r(7); double px=0; for (int i=0; i0) px+=L[i-1]; for (int j=0; j > cBeam::GetMax() { int nf=L.size(); vector< vector > r(7); //get x(Mmax) for (int i=0; ires) { res = Res[1][i][j]; pos = j; } } r[0].push_back(Res[0][i][pos]); } // get max/min values for (int i=0; ires) res = Res[k][i][j]; //max if (k%2==0 && Res[k][i][j] > cBeam::GetReaction() { return Rf; } //------------------------- private functions for calculating ---------------------------- //calculate stiffness matrix of one beam element vector< vector > cBeam::k_beam(double Lb, double Ib, double Eb) { vector< vector > kb(4,vector(4,0)); double kfv, kmv, kft, kmt, kmth; kfv = 12*Eb*Ib/pow(Lb,3); kmv = 6*Eb*Ib/pow(Lb,2); kft = kmv; kmt = 4*Eb*Ib/Lb; kmth = 2*Eb*Ib/Lb; kb[0][0]=kfv; kb[0][1]=kft; kb[0][2]=-kfv; kb[0][3]=kft; kb[1][0]=kmv; kb[1][1]=kmt; kb[1][2]=-kmv; kb[1][3]=kmth; kb[2][0]=-kfv; kb[2][1]=-kft; kb[2][2]=kfv; kb[2][3]=-kft; kb[3][0]=kft; kb[3][1]=kmth; kb[3][2]=-kft; kb[3][3]=kmt; return kb; } //building the global stiffness matrix void cBeam::build_ksys(vector L, double E, vector I, vector R) { ksys.clear(); int N = L.size(); int ndof=2*(N+1); int dof_i; for (int i=0; i(ndof,0)); //zero matrix vector< vector > kb(4,vector(4,0)); for (int i=0; i 0) ksys[i][i] = ksys[i][i]+ R[i]; //spring supports } } //empty and build result matrix void cBeam::build_res_matrix() { int nf=L.size(); //support reactions Rf.clear(); Rf.assign(2,vector(nf+1,0)); //calculate x=L[i]/npts along the beam vector< vector > px(nf,vector(npts+1,0)); for (int i=0; i > zero(nf,vector(npts+1,0)); Res.push_back(px); for (int i=0; i<6; i++) Res.push_back(zero); } //solve the continuous beam problem for a given load matrix void cBeam::cba_solve(vector< vector > LM) { int N = L.size(); int ndof=2*(N+1); int dof_i; vector m(ndof,0); //zero right hand side vector nl(4,0); //nodal loads for (int i=0; i m //calculate member end actions vector dmbr(4,0); // end deformations vector fmbr(4,0); // end forces vector rf(N+1,0); // reaction forces vector< vector > kb(4,vector(4,0)); for (int i=0; i nl for (int j=0; j<4; j++) fmbr[j]=0; for (int j=0; j<4; j++) { for (int k=0; k<4; k++) fmbr[j]+=kb[j][k]*dmbr[k]; fmbr[j]+=nl[j]; } rf[i]+=fmbr[0]; //reaction forces rf[i+1]+=fmbr[2]; set_mbr_values(i,fmbr,dmbr,LM); // set member forces } for (int i=0; iRf[0][i]) Rf[0][i]=rf[i]; //max if (rf[i] cBeam::solve_glsys (vector< vector > A, vector b) { int n=A.size(); vector x(n,0); for (int i=0; i=0; j--) { for (int k=j+1; k cBeam::get_cnl(int iSpan, vector< vector > LM) { vector nl(4,0); double l, p, a, b, c, s, t; int loadtype; l=L[iSpan]; for (int i=0; i0) s=a+c/3; //descending else { a+=c; s=a-2*c/3; } //ascending t=l-s; nl[0] += p*fabs(c)*((2*s+l)*pow(t,2)+pow(c,2)*(s-t)/6+2*pow(c,3)/135)/(2*pow(l,3)); nl[1] += p*fabs(c)*(s*pow(t,2)+pow(c,2)*(s-2*t)/18+pow(c,3)/135)/(2*pow(l,2)); nl[2] += p*fabs(c)*((2*t+l)*pow(s,2)+pow(c,2)*(t-s)/6-2*pow(c,3)/135)/(2*pow(l,3)); nl[3] += -p*fabs(c)*(t*pow(s,2)+pow(c,2)*(t-2*s)/18-pow(c,3)/135)/(2*pow(l,2)); break; } } } return nl; } // sets M, V, rt, def of member void cBeam::set_mbr_values(int iSpan, vector fmbr, vector dmbr, vector< vector > LM) { vector x(npts+1,0); for (int i=0; i Mt(npts+1,0); vector Vt(npts+1,0); vector Rt(npts+1,0); vector Dt(npts+1,0); double l, p, a, b, c, Va, Ra; //values caused by applied loads int loadtype; l=L[iSpan]; for (int i=0; i0) { Vt[j]+=Va; Mt[j]+=Va*x[j]; Rt[j]+=(Va/2)*pow(x[j],2) + Ra; Dt[j]+=(Va/6)*pow(x[j],3) + Ra*x[j]; if (x[j]>a) { Vt[j]-=p; Mt[j]-=p*(x[j]-a); Rt[j]-=(p/2)*pow((x[j]-a),2); Dt[j]-=(p/6)*pow((x[j]-a),3); } } } break; case 3: //partial udls b = c+a; Va = (l-b+c/2)*c*p/l; Ra=-((Va/6)*pow(l,3)+(p/24)*pow((l-b),4)-(p/24)*pow((l-a),4))/l; for (int j=0; ja) { Vt[j]-=p*(x[j]-a); Mt[j]-=(p/2)*pow((x[j]-a),2); Rt[j]-=(p/6)*pow((x[j]-a),3); Dt[j]-=(p/24)*pow((x[j]-a),4); if (x[j]>b) { Vt[j]+=p*(x[j]-b); Mt[j]+=(p/2)*pow((x[j]-b),2); Rt[j]+=(p/6)*pow((x[j]-b),3); Dt[j]+=(p/24)*pow((x[j]-b),4); } } } break; case 4: //moment load b = l-a; Va = p/l; Ra = (p/6)*(3*pow(b,2)/l-l); for (int j=0; j0) { Vt[j]+=Va -(p/2)*pow(x[j],2)/a; Mt[j]+=Va*x[j] -(p/6)*pow(x[j],3)/a; Rt[j]+=Ra +(Va/2)*pow(x[j],2) -(p/24)*pow(x[j],4)/a; Dt[j]+=Ra*x[j] +(Va/6)*pow(x[j],3) -(p/120)*pow(x[j],5)/a; if (x[j]>a) { Vt[j]+=(p/2) *(pow(x[j]-a,2))/a; Mt[j]+=(p/6) *(pow(x[j]-a,3))/a; Rt[j]+=(p/24) *(pow(x[j]-a,4))/a; Dt[j]+=(p/120) *(pow(x[j]-a,5))/a; } } else { Vt[j]+=Va -p*x[j]; Mt[j]+=Va*x[j] -(p/2)*pow(x[j],2); Rt[j]+=Ra +(Va/2)*pow(x[j],2) -(p/6)*pow(x[j],3); Dt[j]+=Ra*x[j] +(Va/6)*pow(x[j],3) -(p/24)*pow(x[j],4); } if (x[j]>(a+c)) { Vt[j]+=(p/2) *(pow(x[j]-(a+c),2))/b; Mt[j]+=(p/6) *(pow(x[j]-(a+c),3))/b; Rt[j]+=(p/24) *(pow(x[j]-(a+c),4))/b; Dt[j]+=(p/120) *(pow(x[j]-(a+c),5))/b; } } break; case 6: //partial triangular loads if (c>0) //descending { b=l-(a+c); double Va = p*c*(b+2*c/3)/(2*l); double Ra = -p*c*(pow(l,2)*(2*c/3+b)-2*pow(c,3)/5-3*b*pow(c,2)/2-2*pow(b,2)*c-pow(b,3))/(12*l); for (int j=0; ja) { Vt[j]+=(p/2)*(pow(x[j]-a,2)/c) -p*(x[j]-a); Mt[j]+=(p/6)*(pow(x[j]-a,3)/c) -(p/2)*pow(x[j]-a,2); Rt[j]+=(p/24)*(pow(x[j]-a,4)/c) -(p/6)*pow(x[j]-a,3); Dt[j]+=(p/120)*(pow(x[j]-a,5)/c) -(p/24)*pow(x[j]-a,4); if (x[j]>(a+c)) { Vt[j]-=(p/2) *(pow(x[j]-(a+c),2)/c); Mt[j]-=(p/6) *(pow(x[j]-(a+c),3)/c); Rt[j]-=(p/24) *(pow(x[j]-(a+c),4)/c); Dt[j]-=(p/120) *(pow(x[j]-(a+c),5)/c); } } } } else if (c<0) //ascending { a+=c; c=fabs(c); b=l-(a+c); double Va = p*c*(b+c/3)/(2*l); double Ra = -p*c*(pow(l,2)*(c/3+b)-pow(c,3)/10-b*pow(c,2)/2-pow(b,2)*c-pow(b,3))/(12*l); for (int j=0; ja) { Vt[j]-=(p/2)*(pow(x[j]-a,2)/c); Mt[j]-=(p/6)*(pow(x[j]-a,3)/c); Rt[j]-=(p/24)*(pow(x[j]-a,4)/c); Dt[j]-=(p/120)*(pow(x[j]-a,5)/c); if (x[j]>(a+c)) { Vt[j]+=(p/2) *(pow(x[j]-(a+c),2)/c) +p*(x[j]-(a+c)); Mt[j]+=(p/6) *(pow(x[j]-(a+c),3)/c) +(p/2)*pow(x[j]-(a+c),2); Rt[j]+=(p/24) *(pow(x[j]-(a+c),4)/c) +(p/6)*pow(x[j]-(a+c),3); Dt[j]+=(p/120) *(pow(x[j]-(a+c),5)/c) +(p/24)*pow(x[j]-(a+c),4); } } } } break; } } } //add results at npts for the two moments applied at each end, Ma and Mb double Ma=fmbr[1]; double Mb=fmbr[3]; Va = (Ma+Mb)/l; Ra = Ma*l/3 - Mb*l/6; for (int j=0; j Res[1][iSpan][i]) Res[1][iSpan][i]=ResValue; if (ResValue < Res[2][iSpan][i]) Res[2][iSpan][i]=ResValue; //shear ResValue=Vt[i]; if (ResValue > Res[3][iSpan][i]) Res[3][iSpan][i]=ResValue; if (ResValue < Res[4][iSpan][i]) Res[4][iSpan][i]=ResValue; //deformations - in force direction positive ResValue=-Dt[i]; if (ResValue > Res[5][iSpan][i]) Res[5][iSpan][i]=ResValue; if (ResValue < Res[6][iSpan][i]) Res[6][iSpan][i]=ResValue; } } cba-0.3.6/src/gui/cbeam_class.h000066400000000000000000000112351142227325100162260ustar00rootroot00000000000000//cbeam_class.h continuous beam analysis class - header file /* cbeam_class 0.3.6 07/2010 G.P.L. this c++ class analyses members and forces for a given beam sourcecode (GPL) partly based on CBA.m for octave/mathcad by C.Caprani www.colincaprani.com 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 . usage: cBeam obj Constructor SetGeometry(L,E,I,R) L vector of span lengths required, returns false if not supplied E double elastic modulus not necessarily, default=1 I vector of moments of inertia not necessarily, default=1 R vector of constraints def/rot not necessarily, default=(-1,0) SetLoads(LM) LM load matrix every vector of loads can have the following parts (have to have the first 3) LM[i,0] = number of span to be loaded LM[i,1] = load type: 1 - uniformly distributed load 2 - point load 3 - partial udl 4 - moment load 5 - trapezoidal load (c=0 triangular) 6 - partial triangular load (c<0 ascending, c>0 descending) LM[i,2] = value of permanent load (can be zero) LM[i,3] = value of live load (can be zero) LM[i,4] = start for load type 3/5/6, or point for load type 2/4 LM[i,5] = length for load type 3/5/6 SetGamma(g,q) set the load design factors for permanent/live loads 2 values: gmax qmax defaults= 1.0 1.0 Solve() solves the continuous beam problem for the given geometry, loads and factors GetResults() returns [7,npts*nf] vector with results along the beam x Mmax Mmin Vmax Vmin dmax dmin GetMax() returns [7,nf] vector with max/min results per span x(Mmax) Mmax Mmin Vmax Vmin dmax dmin GetReaction() returns [2,nf+1] vector with max/min support reactions Rmax Rmin */ #ifndef cbeam_class #define cbeam_class #include #include using namespace std; class cBeam { public: cBeam(); ~cBeam(); bool SetGeometry(vector, double, vector, vector); bool SetGeometry(vector); bool SetLoads(vector< vector >); void SetLoadFactors(double, double); void SetLoadFactors(double, double, double, double); vector< vector > GetGeometry(); vector< vector > GetLoadsG(); vector< vector > GetLoadsQ(); bool Solve(); vector< vector > GetResults(); vector< vector > GetMax(); vector< vector > GetReaction(); private: vector L; //spans double E; //elastic modulus vector I; //moments of inertia vector R; //constraints vector< vector > LMg; //load matrix permanant loads vector< vector > LMq; //load matrix live loads double lfG; //safety factor permanent/live loads double lfQ; double lfG_min; double lfQ_min; vector< vector > ksys; //stiffness matrix vector< vector > k_beam(double, double, double); void build_ksys(vector, double, vector, vector); void build_res_matrix(); void cba_solve(vector< vector >); vector solve_glsys (vector< vector >, vector); vector get_cnl(int iSpan, vector< vector >); void set_mbr_values(int, vector, vector, vector< vector >); int npts; //precision vector< vector > Rf; //support reactions vector< vector< vector > > Res; //results along the beam }; #endif