From 51b2585dfd031ee6a0ee1a4dd1665b18ed15f4fa Mon Sep 17 00:00:00 2001 From: Renaud Barate Date: Thu, 23 Aug 2012 10:58:13 +0200 Subject: [PATCH] First version of PARAMETRIC module --- AUTHORS | 1 + CMakeLists.txt | 54 ++ COPYING | 674 ++++++++++++++++++ COPYING.LESSER | 165 +++++ doc/CMakeLists.txt | 30 + doc/conf.py.in | 211 ++++++ doc/index.rst | 24 + idl/CMakeLists.txt | 33 + idl/PARAMETRIC_Gen.idl | 35 + resources/CMakeLists.txt | 23 + resources/PARAMETRIC.png | Bin 0 -> 1760 bytes resources/PARAMETRICCatalog.xml | 68 ++ resources/PARAMETRIC_small.png | Bin 0 -> 499 bytes resources/SalomeApp.xml.in | 18 + resources/edit_param_study.png | Bin 0 -> 678 bytes resources/export_to_csv_file.png | Bin 0 -> 638 bytes resources/new_param_study.png | Bin 0 -> 608 bytes resources/param_study.png | Bin 0 -> 473 bytes resources/run_param_study.png | Bin 0 -> 847 bytes src/CMakeLists.txt | 22 + src/PARAMETRIC/CMakeLists.txt | 18 + src/PARAMETRIC/PARAMETRIC.py | 209 ++++++ src/PARAMETRICGUI/CMakeLists.txt | 18 + src/PARAMETRICGUI/PARAMETRICGUI.py | 237 ++++++ src/salome/CMakeLists.txt | 18 + src/salome/parametric/CMakeLists.txt | 18 + src/salome/parametric/__init__.py | 0 src/salome/parametric/gui/CMakeLists.txt | 32 + src/salome/parametric/gui/__init__.py | 0 src/salome/parametric/gui/definevalues.py | 61 ++ src/salome/parametric/gui/eficas/__init__.py | 0 src/salome/parametric/gui/eficas/appli.py | 124 ++++ .../configuration_parametric_exec_params.py | 43 ++ .../gui/eficas/parametric_exec_params_cata.py | 39 + src/salome/parametric/gui/eficas/prefs.py | 18 + .../eficas/prefs_parametric_exec_params.py | 21 + src/salome/parametric/gui/mainpanel.py | 34 + src/salome/parametric/gui/selectvars.py | 34 + src/salome/parametric/gui/varrange.ui | 92 +++ src/salome/parametric/gui/wizard.py | 122 ++++ src/salome/parametric/gui/wizard.ui | 115 +++ src/salome/parametric/study.py | 171 +++++ 42 files changed, 2782 insertions(+) create mode 100644 AUTHORS create mode 100644 CMakeLists.txt create mode 100644 COPYING create mode 100644 COPYING.LESSER create mode 100644 doc/CMakeLists.txt create mode 100644 doc/conf.py.in create mode 100644 doc/index.rst create mode 100644 idl/CMakeLists.txt create mode 100644 idl/PARAMETRIC_Gen.idl create mode 100644 resources/CMakeLists.txt create mode 100644 resources/PARAMETRIC.png create mode 100644 resources/PARAMETRICCatalog.xml create mode 100644 resources/PARAMETRIC_small.png create mode 100644 resources/SalomeApp.xml.in create mode 100644 resources/edit_param_study.png create mode 100644 resources/export_to_csv_file.png create mode 100644 resources/new_param_study.png create mode 100644 resources/param_study.png create mode 100644 resources/run_param_study.png create mode 100644 src/CMakeLists.txt create mode 100644 src/PARAMETRIC/CMakeLists.txt create mode 100644 src/PARAMETRIC/PARAMETRIC.py create mode 100644 src/PARAMETRICGUI/CMakeLists.txt create mode 100644 src/PARAMETRICGUI/PARAMETRICGUI.py create mode 100644 src/salome/CMakeLists.txt create mode 100644 src/salome/parametric/CMakeLists.txt create mode 100644 src/salome/parametric/__init__.py create mode 100644 src/salome/parametric/gui/CMakeLists.txt create mode 100644 src/salome/parametric/gui/__init__.py create mode 100644 src/salome/parametric/gui/definevalues.py create mode 100644 src/salome/parametric/gui/eficas/__init__.py create mode 100644 src/salome/parametric/gui/eficas/appli.py create mode 100644 src/salome/parametric/gui/eficas/configuration_parametric_exec_params.py create mode 100644 src/salome/parametric/gui/eficas/parametric_exec_params_cata.py create mode 100644 src/salome/parametric/gui/eficas/prefs.py create mode 100644 src/salome/parametric/gui/eficas/prefs_parametric_exec_params.py create mode 100644 src/salome/parametric/gui/mainpanel.py create mode 100644 src/salome/parametric/gui/selectvars.py create mode 100644 src/salome/parametric/gui/varrange.ui create mode 100644 src/salome/parametric/gui/wizard.py create mode 100644 src/salome/parametric/gui/wizard.ui create mode 100644 src/salome/parametric/study.py diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000..30717dd --- /dev/null +++ b/AUTHORS @@ -0,0 +1 @@ +Renaud Barate - EDF R&D diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..96f656d --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,54 @@ +# Copyright (C) 2012 EDF +# +# This file is part of SALOME PARAMETRIC module. +# +# SALOME PARAMETRIC module is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# SALOME PARAMETRIC module 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 Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with SALOME PARAMETRIC module. If not, see . + +CMAKE_MINIMUM_REQUIRED(VERSION 2.8) +PROJECT(PARAMETRIC) +SET(VERSION "6.6.0") +SET(SHORT_VERSION "6.6") + +SET(KERNEL_ROOT_DIR $ENV{KERNEL_ROOT_DIR}) +IF(NOT KERNEL_ROOT_DIR) + MESSAGE(FATAL_ERROR "Environment variable KERNEL_ROOT_DIR not set") +ENDIF(NOT KERNEL_ROOT_DIR) + +SET(GUI_ROOT_DIR $ENV{GUI_ROOT_DIR}) +IF(NOT GUI_ROOT_DIR) + MESSAGE(FATAL_ERROR "Environment variable GUI_ROOT_DIR not set") +ENDIF(NOT GUI_ROOT_DIR) + +SET(CMAKE_MODULE_PATH ${KERNEL_ROOT_DIR}/salome_adm/cmake_files + ${GUI_ROOT_DIR}/adm_local/cmake_files) + +FIND_PACKAGE(OMNIORB) +FIND_PACKAGE(PYTHON) +FIND_PACKAGE(SPHINX) +FIND_PACKAGE(SIPPYQT) + +SET(BINDIR bin/salome) +SET(RESDIR share/salome/resources/parametric) +SET(LIBDIR lib/salome) +SET(PYTHONDIR lib/python${PYTHON_VERSION}/site-packages/salome) +SET(DOCDIR share/doc/salome/gui/PARAMETRIC) + +ADD_SUBDIRECTORY(idl) +ADD_SUBDIRECTORY(src) +IF(SPHINX_IS_OK) + ADD_SUBDIRECTORY(doc) +ELSE(SPHINX_IS_OK) + MESSAGE(STATUS "Sphinx not found, doc will not be built") +ENDIF(SPHINX_IS_OK) +ADD_SUBDIRECTORY(resources) diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..94a9ed0 --- /dev/null +++ b/COPYING @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/COPYING.LESSER b/COPYING.LESSER new file mode 100644 index 0000000..65c5ca8 --- /dev/null +++ b/COPYING.LESSER @@ -0,0 +1,165 @@ + GNU LESSER 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. + + + This version of the GNU Lesser General Public License incorporates +the terms and conditions of version 3 of the GNU General Public +License, supplemented by the additional permissions listed below. + + 0. Additional Definitions. + + As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the GNU +General Public License. + + "The Library" refers to a covered work governed by this License, +other than an Application or a Combined Work as defined below. + + An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + + A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". + + The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + + The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + + 1. Exception to Section 3 of the GNU GPL. + + You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + + 2. Conveying Modified Versions. + + If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + + a) under this License, provided that you make a good faith effort to + ensure that, in the event an Application does not supply the + function or data, the facility still operates, and performs + whatever part of its purpose remains meaningful, or + + b) under the GNU GPL, with none of the additional permissions of + this License applicable to that copy. + + 3. Object Code Incorporating Material from Library Header Files. + + The object code form of an Application may incorporate material from +a header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + + a) Give prominent notice with each copy of the object code that the + Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the object code with a copy of the GNU GPL and this license + document. + + 4. Combined Works. + + You may convey a Combined Work under terms of your choice that, +taken together, effectively do not restrict modification of the +portions of the Library contained in the Combined Work and reverse +engineering for debugging such modifications, if you also do each of +the following: + + a) Give prominent notice with each copy of the Combined Work that + the Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the Combined Work with a copy of the GNU GPL and this license + document. + + c) For a Combined Work that displays copyright notices during + execution, include the copyright notice for the Library among + these notices, as well as a reference directing the user to the + copies of the GNU GPL and this license document. + + d) Do one of the following: + + 0) Convey the Minimal Corresponding Source under the terms of this + License, and the Corresponding Application Code in a form + suitable for, and under terms that permit, the user to + recombine or relink the Application with a modified version of + the Linked Version to produce a modified Combined Work, in the + manner specified by section 6 of the GNU GPL for conveying + Corresponding Source. + + 1) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (a) uses at run time + a copy of the Library already present on the user's computer + system, and (b) will operate properly with a modified version + of the Library that is interface-compatible with the Linked + Version. + + e) Provide Installation Information, but only if you would otherwise + be required to provide such information under section 6 of the + GNU GPL, and only to the extent that such information is + necessary to install and execute a modified version of the + Combined Work produced by recombining or relinking the + Application with a modified version of the Linked Version. (If + you use option 4d0, the Installation Information must accompany + the Minimal Corresponding Source and Corresponding Application + Code. If you use option 4d1, you must provide the Installation + Information in the manner specified by section 6 of the GNU GPL + for conveying Corresponding Source.) + + 5. Combined Libraries. + + You may place library facilities that are a work based on the +Library side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + + a) Accompany the combined library with a copy of the same work based + on the Library, uncombined with any other library facilities, + conveyed under the terms of this License. + + b) Give prominent notice with the combined library that part of it + is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + + 6. Revised Versions of the GNU Lesser General Public License. + + The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser 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 +Library as you received it specifies that a certain numbered version +of the GNU Lesser General Public License "or any later version" +applies to it, you have the option of following the terms and +conditions either of that published version or of any later version +published by the Free Software Foundation. If the Library as you +received it does not specify a version number of the GNU Lesser +General Public License, you may choose any version of the GNU Lesser +General Public License ever published by the Free Software Foundation. + + If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt new file mode 100644 index 0000000..88a078f --- /dev/null +++ b/doc/CMakeLists.txt @@ -0,0 +1,30 @@ +# Copyright (C) 2012 EDF +# +# This file is part of SALOME PARAMETRIC module. +# +# SALOME PARAMETRIC module is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# SALOME PARAMETRIC module 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 Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with SALOME PARAMETRIC module. If not, see . + +MESSAGE(STATUS "Creation of ${CMAKE_CURRENT_BINARY_DIR}/conf.py") +CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/conf.py.in ${CMAKE_CURRENT_BINARY_DIR}/conf.py @ONLY) + +SET(RSTFILES index.rst) +SET(OUTDIR ${CMAKE_CURRENT_BINARY_DIR}/html) + +ADD_CUSTOM_TARGET(BUILD_DOC ALL + COMMAND ${SPHINX_EXECUTABLE} -c ${CMAKE_CURRENT_BINARY_DIR} + -d ${CMAKE_CURRENT_BINARY_DIR}/doctrees + ${CMAKE_CURRENT_SOURCE_DIR} ${OUTDIR} + ) + +INSTALL(DIRECTORY ${OUTDIR}/ DESTINATION ${DOCDIR}) diff --git a/doc/conf.py.in b/doc/conf.py.in new file mode 100644 index 0000000..e732d85 --- /dev/null +++ b/doc/conf.py.in @@ -0,0 +1,211 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2012 EDF +# +# This file is part of SALOME PARAMETRIC module. +# +# SALOME PARAMETRIC module is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# SALOME PARAMETRIC module 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 Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with SALOME PARAMETRIC module. If not, see . + +# PARAMETRIC module documentation build configuration file, created by +# sphinx-quickstart on Thu Jun 3 17:09:51 2010. +# +# This file is execfile()d with the current directory set to its containing dir. +# +# Note that not all possible configuration values are present in this +# autogenerated file. +# +# All configuration values have a default; values that are commented out +# serve to show the default. + +import sys, os + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +#sys.path.append(os.path.abspath('.')) + +# -- General configuration ----------------------------------------------------- + +# Add any Sphinx extension module names here, as strings. They can be extensions +# coming with Sphinx (named 'sphinx.ext.*') or your custom ones. +extensions = [] + +# Add any paths that contain templates here, relative to this directory. +#templates_path = ['_templates'] + +# The suffix of source filenames. +source_suffix = '.rst' + +# The encoding of source files. +#source_encoding = 'utf-8' + +# The master toctree document. +master_doc = 'index' + +# General information about the project. +project = u'Parametric module' +copyright = u'2012, EDF' + +# The version info for the project you're documenting, acts as replacement for +# |version| and |release|, also used in various other places throughout the +# built documents. +# +# The short X.Y version. +version = '@SHORT_VERSION@' +# The full version, including alpha/beta/rc tags. +release = '@VERSION@' + +# The language for content autogenerated by Sphinx. Refer to documentation +# for a list of supported languages. +#language = None + +# There are two options for replacing |today|: either, you set today to some +# non-false value, then it is used: +#today = '' +# Else, today_fmt is used as the format for a strftime call. +#today_fmt = '%B %d, %Y' + +# List of documents that shouldn't be included in the build. +#unused_docs = [] + +# List of directories, relative to source directory, that shouldn't be searched +# for source files. +#exclude_trees = ['_build'] + +# The reST default role (used for this markup: `text`) to use for all documents. +#default_role = None + +# If true, '()' will be appended to :func: etc. cross-reference text. +#add_function_parentheses = True + +# If true, the current module name will be prepended to all description +# unit titles (such as .. function::). +#add_module_names = True + +# If true, sectionauthor and moduleauthor directives will be shown in the +# output. They are ignored by default. +#show_authors = False + +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = 'sphinx' + +# A list of ignored prefixes for module index sorting. +#modindex_common_prefix = [] + + +# -- Options for HTML output --------------------------------------------------- + +# The theme to use for HTML and HTML Help pages. Major themes that come with +# Sphinx are currently 'default' and 'sphinxdoc'. +html_theme = 'default' + +# Theme options are theme-specific and customize the look and feel of a theme +# further. For a list of options available for each theme, see the +# documentation. +#html_theme_options = {} + +# Add any paths that contain custom themes here, relative to this directory. +#html_theme_path = [] + +# The name for this set of Sphinx documents. If None, it defaults to +# " v documentation". +#html_title = None + +# A shorter title for the navigation bar. Default is the same as html_title. +#html_short_title = None + +# The name of an image file (relative to this directory) to place at the top +# of the sidebar. +#html_logo = None + +# The name of an image file (within the static path) to use as favicon of the +# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 +# pixels large. +#html_favicon = None + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ['_static'] + +# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, +# using the given strftime format. +#html_last_updated_fmt = '%b %d, %Y' + +# If true, SmartyPants will be used to convert quotes and dashes to +# typographically correct entities. +#html_use_smartypants = True + +# Custom sidebar templates, maps document names to template names. +#html_sidebars = {} + +# Additional templates that should be rendered to pages, maps page names to +# template names. +#html_additional_pages = {} + +# If false, no module index is generated. +#html_use_modindex = True + +# If false, no index is generated. +#html_use_index = True + +# If true, the index is split into individual pages for each letter. +#html_split_index = False + +# If true, links to the reST sources are added to the pages. +#html_show_sourcelink = True + +# If true, an OpenSearch description file will be output, and all pages will +# contain a tag referring to it. The value of this option must be the +# base URL from which the finished HTML is served. +#html_use_opensearch = '' + +# If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml"). +#html_file_suffix = '' + +# Output file base name for HTML help builder. +#htmlhelp_basename = 'PARAMETRICmoduledoc' + + +# -- Options for LaTeX output -------------------------------------------------- + +# The paper size ('letter' or 'a4'). +#latex_paper_size = 'letter' + +# The font size ('10pt', '11pt' or '12pt'). +#latex_font_size = '10pt' + +# Grouping the document tree into LaTeX files. List of tuples +# (source start file, target name, title, author, documentclass [howto/manual]). +#latex_documents = [ +# ('index', 'PARAMETRICmodule.tex', u'PARAMETRIC module Documentation', +# u'EDF', 'manual'), +#] + +# The name of an image file (relative to this directory) to place at the top of +# the title page. +#latex_logo = None + +# For "manual" documents, if this is true, then toplevel headings are parts, +# not chapters. +#latex_use_parts = False + +# Additional stuff for the LaTeX preamble. +#latex_preamble = '' + +# Documents to append as an appendix to all manuals. +#latex_appendices = [] + +# If false, no module index is generated. +#latex_use_modindex = True diff --git a/doc/index.rst b/doc/index.rst new file mode 100644 index 0000000..358bd9f --- /dev/null +++ b/doc/index.rst @@ -0,0 +1,24 @@ +.. + Copyright (C) 2012 EDF + + This file is part of SALOME PARAMETRIC module. + + SALOME PARAMETRIC module is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + SALOME PARAMETRIC module 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 Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with SALOME PARAMETRIC module. If not, see . + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +Parametric module documentation +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +This documentation covers the usage of Parametric module in Salome. diff --git a/idl/CMakeLists.txt b/idl/CMakeLists.txt new file mode 100644 index 0000000..bde3c0c --- /dev/null +++ b/idl/CMakeLists.txt @@ -0,0 +1,33 @@ +# Copyright (C) 2012 EDF +# +# This file is part of SALOME PARAMETRIC module. +# +# SALOME PARAMETRIC module is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# SALOME PARAMETRIC module 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 Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with SALOME PARAMETRIC module. If not, see . + +INCLUDE(UseOMNIORB) + +INCLUDE_DIRECTORIES( + ${OMNIORB_INCLUDE_DIRS} + ${KERNEL_ROOT_DIR}/include/salome + ${CMAKE_CURRENT_BINARY_DIR} +) + +SET(PARAMETRIC_IDL_FILES PARAMETRIC_Gen.idl) +SET(IDL_INCLUDE_DIRS ${KERNEL_ROOT_DIR}/idl/salome) + +OMNIORB_ADD_MODULE(SalomeIDLPARAMETRIC "${PARAMETRIC_IDL_FILES}" "${IDL_INCLUDE_DIRS}") +TARGET_LINK_LIBRARIES(SalomeIDLPARAMETRIC ${CORBA_LIBS} ${KERNEL_LDFLAGS} ${SalomeIDLKernel}) +SET_TARGET_PROPERTIES(SalomeIDLPARAMETRIC PROPERTIES COMPILE_FLAGS "${OMNIORB_DEFINITIONS}") + +INSTALL(TARGETS SalomeIDLPARAMETRIC DESTINATION ${LIBDIR}) diff --git a/idl/PARAMETRIC_Gen.idl b/idl/PARAMETRIC_Gen.idl new file mode 100644 index 0000000..e5a57ec --- /dev/null +++ b/idl/PARAMETRIC_Gen.idl @@ -0,0 +1,35 @@ +// Copyright (C) 2012 EDF +// +// This file is part of SALOME PARAMETRIC module. +// +// SALOME PARAMETRIC module is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// SALOME PARAMETRIC module 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 Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with SALOME PARAMETRIC module. If not, see . + +#ifndef __PARAMETRIC_GEN__ +#define __PARAMETRIC_GEN__ + +#include "SALOME_Component.idl" +#include "SALOMEDS.idl" + +module PARAMETRIC_ORB +{ + +interface PARAMETRIC_Gen : Engines::EngineComponent, SALOMEDS::Driver +{ + void RunStudy(in long studyID, in SALOMEDS::ID caseEntry) + raises (SALOME::SALOME_Exception); +}; + +}; + +#endif diff --git a/resources/CMakeLists.txt b/resources/CMakeLists.txt new file mode 100644 index 0000000..f2d894d --- /dev/null +++ b/resources/CMakeLists.txt @@ -0,0 +1,23 @@ +# Copyright (C) 2012 EDF +# +# This file is part of SALOME PARAMETRIC module. +# +# SALOME PARAMETRIC module is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# SALOME PARAMETRIC module 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 Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with SALOME PARAMETRIC module. If not, see . + +INSTALL(DIRECTORY ./ DESTINATION ${RESDIR} FILES_MATCHING PATTERN "*.png") +INSTALL(FILES PARAMETRICCatalog.xml DESTINATION ${RESDIR}) + +MESSAGE(STATUS "Creation of ${CMAKE_CURRENT_BINARY_DIR}/SalomeApp.xml") +CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/SalomeApp.xml.in ${CMAKE_CURRENT_BINARY_DIR}/SalomeApp.xml @ONLY) +INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/SalomeApp.xml DESTINATION ${RESDIR}) diff --git a/resources/PARAMETRIC.png b/resources/PARAMETRIC.png new file mode 100644 index 0000000000000000000000000000000000000000..8345243d100946fa9c072abf5c24b78706742256 GIT binary patch literal 1760 zcmV<61|Ru}P)Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2iyo2 z4G}Vb{M5Ao000?uMObu0Z*6U5Zgc=ca%Ew3Wn>_CX>@2HM@dakSAh-}000I%Nkl+ z5n?cgl7NAL5F2@^8WgF-1c+2b1q~orz)D&R*cYK)TDpDt`A5%|)3Yz#cJJMLckxUn zyLaxnbI$iS&&)jYoH?~5x{g|{mLxU9@TjTng_H0}oPqOzGj2CAbg2#vdYECE1>l^5>zFMY}jx{7br}4dPBQ zyXW5yaRI~$;<+BcUlUh~aee=OhzcO4ihFwiUsHgO?q5AaOaL)Le7i91a_T6`$Lv~t zLr4H|l=xc(e2chQOxnFVhkyWLPw_pmxdQ)$_~^juZgBy`kv+6}hqzGeG4T3ZQ~=Q? zE)^Rq@DGZ~^}9|B3LwT6pyjkqoG)tiyjFV)dUG>z4-PC9KZUa*OX_{Swibh*i$_cF z!F4#g5%3C|Z+aIHBgKy^CjVb?YNM~+-U6+@9~R=cQt{LHOys3TU%#!%@Q2{>3jBh? zUa0-;&dyI9a?|acoX+#`x3T1hYRIcVI**GV|%klg;Rc zZG#Md0q!cnzld4Qf*;f|KwMFo=APNz72J>;1H@Go_{C!X)^NKUEP%MU0>4P?-8ze| z1_~g)S%LqR*t2EeWqQK|5c4YV4~bDt2L1rKkSrvx(d~r#2q5MZj!jp3xEW?oCX%zs ztz}vnGPdcSpg62D z;{RfIf*HkJ{e7~k7x3rFR=GJ?!2+|Mfb17!A)iU)|Vmf$yukM#k6d@*`g!5?WA z@Ldu>OeqGtuJqkL%>6F1wF16`oYHh)Mu!PuT9^@ztMzBAY)$Q#IJNlrEM`PD?r=`c z>6nj+rQ&tC20u)6)<4W#YsZA*Vd^AI#{NYfhw;VVuCh_P92FL)Rrce|thD;RVksApOXJi^?U05_K4|0>$ZB=UIW9-klw_X0hpxZ$6M z)%}279u|hn!|CDB&_3wXU=iNxED3Nt`3PB7x##)aqAt8U%n3ga>-&J+68;>nFJLFP zj2|FwDZxKVP9Pnn`|l*@m7r_kFh86cE&6Coyl02Kc~@U~S+P9r;#ftF zE5N6OtHO(YKtCQX4TrbpF4XPzVHzQ4S5{pW9-G&lUI7wFaDrZ8h@y>HN6fFj28zOCA}Ia>Q!{mN1Yz1#!z*6_P< zW<92)))L_BKM2X8p6~pR@m25*;pTAIP=xML0P(f}>-UPWYjTjKS!Qw>d`-9}8uP@b zxdN;m^R@sB&dN9|^AFRzz*mM#VsIXEHb;OJ@D%Hp}8|hW}0!V7R_KJtW>2_`d*6IQ|EqPAG2ng_cYJ0000xp literal 0 HcmV?d00001 diff --git a/resources/PARAMETRICCatalog.xml b/resources/PARAMETRICCatalog.xml new file mode 100644 index 0000000..b4cdb79 --- /dev/null +++ b/resources/PARAMETRICCatalog.xml @@ -0,0 +1,68 @@ + + + + + + + + + + + PARAMETRIC + PARAMETRIC + Data + EDF-RD + 1.0 + + 0 + SO + + + PARAMETRIC + + + + + RunStudy + EDF-RD + 1.0 + + 0 + + + + studyID + long + + + detCaseEntry + string + + + + + + + + + + + + diff --git a/resources/PARAMETRIC_small.png b/resources/PARAMETRIC_small.png new file mode 100644 index 0000000000000000000000000000000000000000..e34a23a07f35d8d8d02a9c1bc5a7c7a8d4554525 GIT binary patch literal 499 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|*pj^6T^Rm@ z;DWu&Cj&(|3p^r=85p>QL70(Y)*K0-AbW|YuPgf<4lzD1)$n+gjX)vE64!_l=ltB< z)VvY~=c3falGGH1^30M91$R&1fbd2>aiCRxo-U3d7N?h9+Mj*JQH15g`8d5Wrvqv- z9Y;kcvIMdOGAAuu#GWLm^TmEckhS)IR&LgM6D2do+Zl^nI}(zY&lMEf&Eh&cqW-wj z?9)#_oMUF6miqAQnd;5_RcfxkzDIrxt1*~(K(ElRM$rEV&lYth@gvGIM>&sP>&wVy zdM^2q_q}NP23OIwFM0)Mh|gYRd~UgU(;kg$E-%wRh;MP9;QwgmqTA;a{1qlx#@xN_ zC~()R_-w)jyYLfSk?QA9K8+Ca=WL;JKI~g@}(6nu)T0ncdgDu-czopp0_=2mA2@2-uj9C+DBRY zhfNi4etio5q^4uGre*5~gD;2v6-w9LdbKg_wnvkx~H6zs@|VOuWt?##4oy}jCZ n4x98{G2XFJIbhCb`5(+Pt!u;-jrMN^20w$RtDnm{r-UW|r>@9% literal 0 HcmV?d00001 diff --git a/resources/SalomeApp.xml.in b/resources/SalomeApp.xml.in new file mode 100644 index 0000000..2b66099 --- /dev/null +++ b/resources/SalomeApp.xml.in @@ -0,0 +1,18 @@ + +
+ + + + + + +
+
+ + +
+
+ + +
+
diff --git a/resources/edit_param_study.png b/resources/edit_param_study.png new file mode 100644 index 0000000000000000000000000000000000000000..e23c246d3d3b8f9f269199d33decd4837fc412cf GIT binary patch literal 678 zcmV;X0$KfuP)Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2iyo2 z4hI@kmv_Mc000?uMObu0Z*6U5Zgc=ca%Ew3Wn>_CX>@2HM@dakSAh-}00063NklbIh60f7KOqYUs3I_Q0 z<|&8!1*OF#Tj>Jj-9wlgJ3Pxo$Ba(gTfqbYr-qK?8u|W1J-vNI41+MJHC8T%*1Da7>$+{N|Gm_KzVCzY<9QxZ%KE#tKsK9g8Dbr5<#IGg zhl+TfN3mGMah&!7g+ieXoHR{HrS?eb`#z52P%4#Lq;FO5|4ab<0dY?+NP%YA{r~^~ M07*qoM6N<$f|vp^yZ`_I literal 0 HcmV?d00001 diff --git a/resources/export_to_csv_file.png b/resources/export_to_csv_file.png new file mode 100644 index 0000000000000000000000000000000000000000..a02af297fb562f4f1e116b37e5456d5c6ecf7cc4 GIT binary patch literal 638 zcmV-^0)hRBP)}h1x=A6E;b4_NoD-_2^M1EKM;hJ7TI(bmZ_|?N|4xE zh`~(?wM-<&5HV;HBP_|9?7r{Zxihmf7Q6Xa2x;`dFt->U&bgd{e^gZ#SXX|-A$0<6QTr;!Oahs&gxh$-^Bwnt2n7!xTaM3m*PKWH>^LWqX| zV-$6P+Rqxx-?mU6P#176pw5#UW%o~m#$FQjrU!Fwdj zF_{p(qX-1=$aCoi7->fs9Js)>s{=F}Iay}0)}iWAby(Xz)elRouWb-Q=#F5W$EpLM z@9Y`Ad|X9!AK*K)!-z%Xh=T-)$wx5Rz3t(VA!gq#;C;Y*-?;-uEY{isK+j1vy>s_^ zrd-0KmiK3ZjV)NjFiVq{e6r*z7N3k)LT#i zJm5&llagn*UPqcuItC6uQ@Q-G;+*IE+SK@!p$8K&LX5HVuwAAY6Iqs%Wrh&uD*O-q Y1wV4Cgi61cMF0Q*07*qoM6N<$f@whz1^@s6 literal 0 HcmV?d00001 diff --git a/resources/new_param_study.png b/resources/new_param_study.png new file mode 100644 index 0000000000000000000000000000000000000000..83bb8de3d1ee25cf437ba33edb48c2ba29ad12e1 GIT binary patch literal 608 zcmV-m0-ybfP)Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2iyo2 z4gnRCa?REN000?uMObu0Z*6U5Zgc=ca%Ew3Wn>_CX>@2HM@dakSAh-}0005INklrY!g${viMSg)kLo=nMQ@RwI zQ0Qc%L3SL|qQPKOtvXfsNbae04r~lq_kRg_B+wy%M-}ecEfZ1%ucsyn> z7|`i-01WHOwr!OONMfZb0KV_%PMY`v7!HT511$t5AjOPowMxI=UkR-M1VK;=OMtan z4cB!`p_>3v6qUjN>h*f|UF8*OGw&-|m?XO0F4O50*L87SmsYD)>@e$YX)GPujqiJ$ zpMNVq!#sD!+`^>W@Vp-L`JB=-EOI4rZ&k9}&4nd)jbVFdXEiXXar zTwZn*IY_dk3#25Mwa70>b91-2$ zb)s{WIQp@O*f9^09R5g6NhhInI+0E#ok(h?(9)mg$Ky}NPQL70(Y)*K0-AbW|YuPgf<4l!O8?xqv-xPd~FC9V-A&iT2y zsd*&~&PAz-C8;S2<(VZJ3hti10pX2&;y|lRJY5_^EKX0Ibg=7?frzXBk_CCO{i|=D z+5eOEuldoRypFs#y1Il`C};-$PFuLKx3{%Yb&8$E_r3R|r!LbxCgHYtqC~R6v4pix z%XSy;jJff)OlP_`gXXiD;*3Gf{YS-(pUDu@6nod5s0imL=zwSzW#C&e^n~Ntthfhh3 zEV7Z)>{=vtBggE`_umZje3x&C*z&HaxNnh$#azGM7l&tmogc(dAHMB^R>LgYLSP^> Nc)I$ztaD0e0sw2>z%Bp) literal 0 HcmV?d00001 diff --git a/resources/run_param_study.png b/resources/run_param_study.png new file mode 100644 index 0000000000000000000000000000000000000000..16063a182feb44f2cbecc7dba8a5aada396701b8 GIT binary patch literal 847 zcmV-V1F-ywP)h3@&vz3-^#EKhm(x~LQ)L6-B82LB zzO1{f%(`hba@Eixwj)1{XD6wo|XIEDj1fjz2cK3r}7}#tV;Bd5~veIU+tECi4~LI6osMXlrXJ)GLYoH$Za=wq z@9y>X_BJpK15rGI*ZUYgpYQ(3iTI+bs_LrMYK5XGC@wBWYwIP4$z-~+xA*A{0f1;U ziVq(G*x1-WCZj-66mVP-Or~P+JP)3?007eIG!ltZ1cUnshr<8>-ES+nIy$aB@OZ|M zO34t#6Krqqfafh}Y;3^MQ5XjYhnSpvh@G9?F#wCInt7E60Gg&A=yYTm03!&3-D0sI zKVOgXaw|Bl2%;$B>@0<~wKc4)tc)jEj;sIx002ovPDHLkV1hm$hK~RM literal 0 HcmV?d00001 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 0000000..765f780 --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,22 @@ +# Copyright (C) 2012 EDF +# +# This file is part of SALOME PARAMETRIC module. +# +# SALOME PARAMETRIC module is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# SALOME PARAMETRIC module 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 Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with SALOME PARAMETRIC module. If not, see . + +ADD_SUBDIRECTORY(PARAMETRIC) +ADD_SUBDIRECTORY(PARAMETRICGUI) +ADD_SUBDIRECTORY(salome) + +INSTALL(DIRECTORY salome DESTINATION ${PYTHONDIR} FILES_MATCHING PATTERN "*.py") diff --git a/src/PARAMETRIC/CMakeLists.txt b/src/PARAMETRIC/CMakeLists.txt new file mode 100644 index 0000000..1eef9a6 --- /dev/null +++ b/src/PARAMETRIC/CMakeLists.txt @@ -0,0 +1,18 @@ +# Copyright (C) 2012 EDF +# +# This file is part of SALOME PARAMETRIC module. +# +# SALOME PARAMETRIC module is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# SALOME PARAMETRIC module 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 Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with SALOME PARAMETRIC module. If not, see . + +INSTALL(FILES PARAMETRIC.py DESTINATION ${BINDIR}) diff --git a/src/PARAMETRIC/PARAMETRIC.py b/src/PARAMETRIC/PARAMETRIC.py new file mode 100644 index 0000000..850164d --- /dev/null +++ b/src/PARAMETRIC/PARAMETRIC.py @@ -0,0 +1,209 @@ +# Copyright (C) 2012 EDF +# +# This file is part of SALOME PARAMETRIC module. +# +# SALOME PARAMETRIC module is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# SALOME PARAMETRIC module 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 Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with SALOME PARAMETRIC module. If not, see . + +import logging +import threading +import inspect +import traceback +import re +import copy + +import salome +import SALOME +import SALOME_ModuleCatalog +import PARAMETRIC_ORB__POA +from SALOME_ComponentPy import SALOME_ComponentPy_i +from SALOME_DriverPy import SALOME_DriverPy_i +import SALOMERuntime +import loader +import pilot + +from salome.kernel.logger import Logger +from salome.kernel import termcolor +logger = Logger("PARAMETRIC", color = termcolor.BLUE) +logger.setLevel(logging.DEBUG) + +from salome.parametric.study import ParametricStudyEditor + +class PARAMETRIC(PARAMETRIC_ORB__POA.PARAMETRIC_Gen, SALOME_ComponentPy_i, SALOME_DriverPy_i): + + lock = threading.Lock() + + def __init__(self, orb, poa, contID, containerName, instanceName, interfaceName): + SALOME_ComponentPy_i.__init__(self, orb, poa, contID, containerName, instanceName, interfaceName, 0) + SALOME_DriverPy_i.__init__(self, interfaceName) + self.salome_runtime = None + self.session_catalog = None + + def _raiseSalomeError(self): + message = "Error in component %s running in container %s." % (self._instanceName, self._containerName) + logger.exception(message) + message += " " + traceback.format_exc() + exc = SALOME.ExceptionStruct(SALOME.INTERNAL_ERROR, message, + inspect.stack()[1][1], inspect.stack()[1][2]) + raise SALOME.SALOME_Exception(exc) + + def _get_salome_runtime(self): + if self.salome_runtime is None: + # Initialize runtime for YACS + SALOMERuntime.RuntimeSALOME.setRuntime() + self.salome_runtime = SALOMERuntime.getSALOMERuntime() + mc = salome.naming_service.Resolve('/Kernel/ModulCatalog') + if mc is None: + raise Exception ("Internal error: Cannot find SALOME Module Catalog") + ior = salome.orb.object_to_string(mc) + self.session_catalog = self.salome_runtime.loadCatalog("session", ior) + self.salome_runtime.addCatalog(self.session_catalog) + return self.salome_runtime + + def _parse_entry(self, selected_value): + """ + Find entry if selected_value is something like "name (entry)" + """ + entry = selected_value + match = re.search("\((.*)\)$", entry) + if match is not None: + entry = match.group(1) + return entry + + def RunStudy(self, studyId, caseEntry): + try: + self.beginService("PARAMETRIC.RunStudy") + + PARAMETRIC.lock.acquire() + salome.salome_init() + PARAMETRIC.lock.release() + + # Get parametric study from the case in Salome study + ed = ParametricStudyEditor(studyId) + param_study = ed.get_parametric_study(caseEntry) + + # Generate YACS schema + runtime = self._get_salome_runtime() + proc = pilot.Proc("ParametricSchema") + param_input_tc = runtime.getTypeCode("SALOME_TYPES/ParametricInput") + if param_input_tc is None: + raise Exception ("Internal error: No typecode found for type 'SALOME_TYPES/ParametricInput'") + foreach = pilot.ForEachLoop("ForEach", param_input_tc) + foreach.edGetNbOfBranchesPort().edInit(param_study.get_exec_param("NUMBER_OF_PARALLEL_COMPUTATIONS")) + proc.edAddChild(foreach) + + solver_code = param_study.get_exec_param("SOLVER_CODE") + solver_compo_inst = proc.createComponentInstance(solver_code) + solver_compo_def = self.session_catalog._componentMap[solver_code] + + distrib_container = proc.createContainer("DistribContainer") + distrib_container.setProperty("hostname", "localhost") + solver_compo_inst.setContainer(distrib_container) + + init_solver = solver_compo_def._serviceMap["Init"].clone(None) + init_solver.setComponent(solver_compo_inst) + init_solver.getInputPort("studyID").edInit(studyId) + entry = self._parse_entry(param_study.get_exec_param("DETERMINISTIC_CASE_ENTRY")) + init_solver.getInputPort("detCaseEntry").edInit(entry) + foreach.edSetInitNode(init_solver) + + exec_solver = solver_compo_def._serviceMap["Exec"].clone(None) + exec_solver.setComponent(solver_compo_inst) + foreach.edSetNode(exec_solver) + + finalize_solver = solver_compo_def._serviceMap["Finalize"].clone(None) + finalize_solver.setComponent(solver_compo_inst) + foreach.edSetFinalizeNode(finalize_solver) + + param_output_tc = runtime.getTypeCode("SALOME_TYPES/ParametricOutput") + if param_output_tc is None: + raise Exception ("Internal error: No typecode found for type 'SALOME_TYPES/ParametricOutput'") + seq_param_output_tc = proc.createSequenceTc("", "seq_param_output", param_output_tc) + aggregator = runtime.createScriptNode(SALOMERuntime.PythonNode.KIND, "Aggregator") + aggregator_input_port = aggregator.edAddInputPort("results", seq_param_output_tc) + proc.edAddChild(aggregator) + + #proc.edAddLink(init_data_output_port, foreach.edGetSeqOfSamplesPort()) + proc.edAddLink(foreach.edGetSamplePort(), exec_solver.getInputPort("paramInput")) + proc.edAddCFLink(foreach, aggregator) + proc.edAddLink(exec_solver.getOutputPort("paramOutput"), aggregator_input_port) + + # Set input data + if param_study.data is None: + param_study.generate_data() + + seqsamples = [] + refsample = {"inputVarList": [], + "outputVarList": [], + "inputValues": [[[]]], + "specificParameters": [], + } + for varname in param_study.output_vars: + refsample["outputVarList"].append(varname) + + for i in range(param_study.datasize): + sample = copy.deepcopy(refsample) + for var in param_study.input_vars: + sample["inputVarList"].append(var.name) + sample["inputValues"][0][0].append([param_study.data[var.name][i]]) + seqsamples.append(sample) + foreach.edGetSeqOfSamplesPort().edInitPy(seqsamples) + + logger.debug("Checking validity...") + if not proc.isValid(): + raise Exception("The schema is not valid and can not be executed.") + + logger.debug("Checking consistency...") + info = pilot.LinkInfo(pilot.LinkInfo.ALL_DONT_STOP) + proc.checkConsistency(info) + if info.areWarningsOrErrors(): + logger.error(info.getGlobalRepr()) + raise Exception("The schema is not consistent and can not be executed.") + logger.debug("Schema validated") + + # Launch computation + executor = pilot.ExecutorSwig() + executor.RunPy(proc) + state = proc.getEffectiveState() + if proc.getEffectiveState() != pilot.DONE: + msg = proc.getErrorReport() + if msg != "": + raise Exception("YACS schema execution ended with errors:\n%s" % msg) + else: + raise Exception("YACS schema execution failed. No error report available.") + + # Get output values + seqresults = aggregator.getInputPort("results").getPyObj() + for varname in param_study.output_vars: + param_study.data[varname] = [] + param_study.data["__ERROR_MESSAGE__"] = [] + + for result in seqresults: + if result["returnCode"] == 0: + valuelist = result["outputValues"][0][0] + if len(valuelist) != len(param_study.output_vars): + raise Exception("Incoherent number of result variables") + for i in range(len(valuelist)): + param_study.data[param_study.output_vars[i]].append(valuelist[i][0]) + param_study.data["__ERROR_MESSAGE__"].append(None) + else: + for varname in param_study.output_vars: + param_study.data[varname].append(None) + param_study.data["__ERROR_MESSAGE__"].append(result["errorMessage"]) + + # Save results in Salome study + ed.set_parametric_study_at_entry(param_study, caseEntry) + + self.endService("PARAMETRIC.RunStudy") + except: + self._raiseSalomeError() diff --git a/src/PARAMETRICGUI/CMakeLists.txt b/src/PARAMETRICGUI/CMakeLists.txt new file mode 100644 index 0000000..3334038 --- /dev/null +++ b/src/PARAMETRICGUI/CMakeLists.txt @@ -0,0 +1,18 @@ +# Copyright (C) 2012 EDF +# +# This file is part of SALOME PARAMETRIC module. +# +# SALOME PARAMETRIC module is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# SALOME PARAMETRIC module 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 Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with SALOME PARAMETRIC module. If not, see . + +INSTALL(FILES PARAMETRICGUI.py DESTINATION ${BINDIR}) diff --git a/src/PARAMETRICGUI/PARAMETRICGUI.py b/src/PARAMETRICGUI/PARAMETRICGUI.py new file mode 100644 index 0000000..06da82d --- /dev/null +++ b/src/PARAMETRICGUI/PARAMETRICGUI.py @@ -0,0 +1,237 @@ +# Copyright (C) 2012 EDF +# +# This file is part of SALOME PARAMETRIC module. +# +# SALOME PARAMETRIC module is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# SALOME PARAMETRIC module 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 Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with SALOME PARAMETRIC module. If not, see . + +import os +import logging + +from PyQt4 import QtGui, QtCore +from PyQt4.QtCore import Qt + +import salome +import SALOME + +# Get SALOME PyQt interface +import SalomePyQt +sgPyQt = SalomePyQt.SalomePyQt() + +from salome.kernel.studyedit import getStudyEditor, getActiveStudyId +from salome.kernel.logger import Logger +from salome.kernel import termcolor +logger = Logger("PARAMETRICGUI", color = termcolor.GREEN_FG) +#logger.setLevel(logging.ERROR) +from salome.kernel.parametric import study_exchange_vars + +import PARAMETRIC +from salome.parametric.gui.mainpanel import MainPanel +from salome.parametric.study import ParametricStudyEditor + +################################################ +# GUI context class +# Used to store actions, menus, toolbars, etc... +################################################ + +class GUIcontext: + # menus/toolbars/actions IDs + PARAMETRIC_MENU = 0 + CREATE_PARAMETRIC_STUDY = 1 + RUN_PARAMETRIC_STUDY = 2 + EXPORT_DATA_TO_CSV = 3 + EDIT_PARAMETRIC_STUDY = 4 + + # constructor + def __init__( self ): + # create top-level menu + mid = sgPyQt.createMenu("Parametric", -1, GUIcontext.PARAMETRIC_MENU, sgPyQt.defaultMenuGroup()) + # create toolbar + tid = sgPyQt.createTool("Parametric") + # create actions and fill menu and toolbar with actions + a = sgPyQt.createAction(GUIcontext.CREATE_PARAMETRIC_STUDY, + "Create parametric study", + "Create parametric study", + "Create a new parametric study", + "new_param_study.png") + sgPyQt.createMenu( a, mid ) + sgPyQt.createTool( a, tid ) + + # Actions for popup menus + sgPyQt.createAction(GUIcontext.RUN_PARAMETRIC_STUDY, + "Run parametric study", + "Run parametric study", + "Run the selected parametric study", + "run_param_study.png") + + sgPyQt.createAction(GUIcontext.EXPORT_DATA_TO_CSV, + "Export data to CSV file", + "Export data to CSV file", + "Export data to CSV file", + "export_to_csv_file.png") + + sgPyQt.createAction(GUIcontext.EDIT_PARAMETRIC_STUDY, + "Edit parametric study", + "Edit parametric study", + "Edit the selected parametric study", + "edit_param_study.png") + +################################################ +# Global variables +################################################ + +# study-to-context map +__study2context__ = {} +# current context +__current_context__ = None + +################################################ +# Internal methods +################################################ + +### +# get current GUI context +### +def _getContext(): + global __current_context__ + return __current_context__ + +### +# set and return current GUI context +# study ID is passed as parameter +### +def _setContext( studyID ): + global __study2context__, __current_context__ + if not __study2context__.has_key(studyID): + __study2context__[studyID] = GUIcontext() + __current_context__ = __study2context__[studyID] + return __current_context__ + +################################################ +# Callback functions + +# called when module is initialized +# return map of popup windows to be used by the module +def windows(): + wm = {} + wm[SalomePyQt.WT_ObjectBrowser] = Qt.LeftDockWidgetArea + return wm + +# called when module is activated +# returns True if activating is successfull and False otherwise +def activate(): + ctx = _setContext(getActiveStudyId()) + return True + +# called when module is deactivated +def deactivate(): + pass + +# called when active study is changed +# active study ID is passed as parameter +def activeStudyChanged(studyID): + ctx = _setContext(studyID) + +# called when popup menu is invoked +# popup menu and menu context are passed as parameters +def createPopupMenu(popup, context): + logger.debug("createPopupMenu(): context = %s" % context) + ed = getStudyEditor() + _setContext(ed.studyId) + if salome.sg.SelectedCount() == 1: + # one object is selected + sobj = ed.study.FindObjectID(salome.sg.getSelected(0)) + selectedType = ed.getTypeId(sobj) + logger.debug("Selected type: %s" % selectedType) + if selectedType == salome.parametric.study.PARAM_STUDY_TYPE_ID: + popup.addAction(sgPyQt.action(GUIcontext.EDIT_PARAMETRIC_STUDY)) + popup.addAction(sgPyQt.action(GUIcontext.RUN_PARAMETRIC_STUDY)) + popup.addAction(sgPyQt.action(GUIcontext.EXPORT_DATA_TO_CSV)) + +# process GUI action +def OnGUIEvent( commandID ) : + logger.debug("OnGUIEvent: commandID = %d" % commandID) + if dict_command.has_key( commandID ): + command = dict_command[commandID] + try: + command() + except: + logger.exception("Error while running command %s" % command) + else: + logger.error("The command %d is not implemented" % commandID) + + +################################################ +# GUI actions implementation + +def new_study(): + panel = MainPanel() + panel.new_study() + +def edit_study(): + study_id = sgPyQt.getStudyId() + entry = salome.sg.getSelected(0) + ed = ParametricStudyEditor(study_id) + panel = MainPanel() + panel.edit_study(ed.get_parametric_study(entry)) + +def run_study(): + qapp = QtGui.QApplication + try: + qapp.setOverrideCursor(QtGui.QCursor(QtCore.Qt.WaitCursor)) + study_id = sgPyQt.getStudyId() + entry = salome.sg.getSelected(0) + engine = salome.lcc.FindOrLoadComponent("ParametricContainer", "PARAMETRIC") + engine.RunStudy(study_id, entry) + qapp.restoreOverrideCursor() + except SALOME.SALOME_Exception, exc: + qapp.restoreOverrideCursor() + logger.exception("An error happened while trying to run parametric study.") + QtGui.QMessageBox.critical(sgPyQt.getDesktop(), + qapp.translate("run_study", "Error"), + qapp.translate("run_study", "An error happened while trying to run parametric study: %s" % exc.details.text)) + except Exception, exc: + qapp.restoreOverrideCursor() + logger.exception("An error happened while trying to run parametric study.") + QtGui.QMessageBox.critical(sgPyQt.getDesktop(), + qapp.translate("run_study", "Error"), + qapp.translate("run_study", "An error happened while trying to run parametric study: %s" % exc)) + +def export_to_csv(): + qapp = QtGui.QApplication + try: + qapp.setOverrideCursor(QtGui.QCursor(QtCore.Qt.WaitCursor)) + study_id = sgPyQt.getStudyId() + entry = salome.sg.getSelected(0) + ed = ParametricStudyEditor(study_id) + param_study = ed.get_parametric_study(entry) + filename = QtGui.QFileDialog.getSaveFileName(sgPyQt.getDesktop(), + qapp.translate("export_to_csv", "Export data to CSV file"), + filter = qapp.translate("export_to_csv", "CSV files (*.csv)")) + if filename is not None and len(filename) > 0: + param_study.export_data_to_csv_file(filename) + qapp.restoreOverrideCursor() + except Exception, exc: + qapp.restoreOverrideCursor() + logger.exception("Export to CSV file failed") + QtGui.QMessageBox.critical(sgPyQt.getDesktop(), + qapp.translate("export_to_csv", "Error"), + qapp.translate("export_to_csv", "Export to CSV file failed: %s" % exc)) + +# ----------------------- # +dict_command = { + GUIcontext.CREATE_PARAMETRIC_STUDY: new_study, + GUIcontext.RUN_PARAMETRIC_STUDY: run_study, + GUIcontext.EXPORT_DATA_TO_CSV: export_to_csv, + GUIcontext.EDIT_PARAMETRIC_STUDY: edit_study +} diff --git a/src/salome/CMakeLists.txt b/src/salome/CMakeLists.txt new file mode 100644 index 0000000..7735ed8 --- /dev/null +++ b/src/salome/CMakeLists.txt @@ -0,0 +1,18 @@ +# Copyright (C) 2012 EDF +# +# This file is part of SALOME PARAMETRIC module. +# +# SALOME PARAMETRIC module is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# SALOME PARAMETRIC module 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 Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with SALOME PARAMETRIC module. If not, see . + +ADD_SUBDIRECTORY(parametric) diff --git a/src/salome/parametric/CMakeLists.txt b/src/salome/parametric/CMakeLists.txt new file mode 100644 index 0000000..d3de504 --- /dev/null +++ b/src/salome/parametric/CMakeLists.txt @@ -0,0 +1,18 @@ +# Copyright (C) 2012 EDF +# +# This file is part of SALOME PARAMETRIC module. +# +# SALOME PARAMETRIC module is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# SALOME PARAMETRIC module 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 Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with SALOME PARAMETRIC module. If not, see . + +ADD_SUBDIRECTORY(gui) diff --git a/src/salome/parametric/__init__.py b/src/salome/parametric/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/salome/parametric/gui/CMakeLists.txt b/src/salome/parametric/gui/CMakeLists.txt new file mode 100644 index 0000000..8fccb25 --- /dev/null +++ b/src/salome/parametric/gui/CMakeLists.txt @@ -0,0 +1,32 @@ +# Copyright (C) 2012 EDF +# +# This file is part of SALOME PARAMETRIC module. +# +# SALOME PARAMETRIC module is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# SALOME PARAMETRIC module 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 Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with SALOME PARAMETRIC module. If not, see . + +SET(PYUIC_FILES wizard_ui.py varrange_ui.py) +SET(INSTALL_DIR ${PYTHONDIR}/salome/parametric/gui) + +FOREACH(OUTPUT ${PYUIC_FILES}) + STRING(REPLACE "_ui.py" ".ui" INPUT ${OUTPUT}) + SET(INPUT ${CMAKE_CURRENT_SOURCE_DIR}/${INPUT}) + SET(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${OUTPUT}) + ADD_CUSTOM_COMMAND(OUTPUT ${OUTPUT} + COMMAND ${PYUIC_EXECUTABLE} -o ${OUTPUT} ${INPUT} + MAIN_DEPENDENCY ${INPUT} + ) + INSTALL(FILES ${OUTPUT} DESTINATION ${INSTALL_DIR}) +ENDFOREACH(OUTPUT ${PYUIC_FILES}) + +ADD_CUSTOM_TARGET(BUILD_PY_UI_FILES ALL DEPENDS ${PYUIC_FILES}) diff --git a/src/salome/parametric/gui/__init__.py b/src/salome/parametric/gui/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/salome/parametric/gui/definevalues.py b/src/salome/parametric/gui/definevalues.py new file mode 100644 index 0000000..5fd1166 --- /dev/null +++ b/src/salome/parametric/gui/definevalues.py @@ -0,0 +1,61 @@ +# Copyright (C) 2012 EDF +# +# This file is part of SALOME PARAMETRIC module. +# +# SALOME PARAMETRIC module is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# SALOME PARAMETRIC module 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 Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with SALOME PARAMETRIC module. If not, see . + +from PyQt4 import QtGui, QtCore +from PyQt4.QtCore import Qt + +from varrange_ui import Ui_VariableRange + + +class VariableRange(QtGui.QWidget, Ui_VariableRange): + + def __init__(self, parent = None): + QtGui.QWidget.__init__(self, parent) + self.setAttribute(Qt.WA_DeleteOnClose) + self.setupUi(self) + + +class DefineValuesFrame(QtGui.QWidget): + + def __init__(self, parent = None): + QtGui.QWidget.__init__(self, parent) + self.setLayout(QtGui.QVBoxLayout(self)) + self.varwidgets = {} + + def set_variables(self, varlist): + previous_set = set(self.varwidgets.keys()) + new_set = set([var.name for var in varlist]) + var_to_remove = previous_set - new_set + var_to_add = new_set - previous_set + for var in var_to_remove: + self.varwidgets[var].close() + del self.varwidgets[var] + for var in var_to_add: + varrange = VariableRange(self) + varrange.nameLabel.setText(var) + self.varwidgets[var] = varrange + self.layout().addWidget(varrange) + + def set_ranges_from_param_study(self, param_study): + for var in param_study.input_vars: + varrange = VariableRange(self) + varrange.nameLabel.setText(var.name) + varrange.fromSpinBox.setValue(var.min) + varrange.toSpinBox.setValue(var.max) + varrange.stepSpinBox.setValue(var.step) + self.varwidgets[var.name] = varrange + self.layout().addWidget(varrange) diff --git a/src/salome/parametric/gui/eficas/__init__.py b/src/salome/parametric/gui/eficas/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/salome/parametric/gui/eficas/appli.py b/src/salome/parametric/gui/eficas/appli.py new file mode 100644 index 0000000..e9a03c0 --- /dev/null +++ b/src/salome/parametric/gui/eficas/appli.py @@ -0,0 +1,124 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2012 EDF +# +# This file is part of SALOME PARAMETRIC module. +# +# SALOME PARAMETRIC module is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# SALOME PARAMETRIC module 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 Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with SALOME PARAMETRIC module. If not, see . + +import os +import sys +import re +import tempfile + +from PyQt4.QtGui import QMessageBox + +import salome +import SalomePyQt +sgPyQt = SalomePyQt.SalomePyQt() + +from salome.kernel.logger import Logger +from salome.kernel import termcolor +logger = Logger("salome.openturns.eficas_yacs_schema.appli", + color = termcolor.GREEN_FG) +from salome.kernel.studyedit import getStudyEditor + +import eficasSalome + + +class SalomeEntry: + + enable_salome_selection = True + help_message = u"Une entrée de l'arbre d'étude de Salome est attendue" + + def __init__(self, entryStr): + self._entry = entryStr + + @staticmethod + def __convert__(entryStr): + return SalomeEntry(entryStr) + + @staticmethod + def get_selected_value(selected_entry, study_editor): + sobj = study_editor.study.FindObjectID(selected_entry) + name = sobj.GetName() + return "%s (%s)" % (name, selected_entry) + +def parse_entry(selected_value): + """ + Find entry if selected_value is something like "name (entry)" + """ + entry = selected_value + match = re.search("\((.*)\)$", entry) + if match is not None: + entry = match.group(1) + return entry + +class EficasFrame(eficasSalome.MyEficas): + """ + This class launches Eficas for PARAMETRIC module. The messages in this class are in + french because they are displayed in Eficas interface. + + """ + def __init__(self, parent = None): + self.codedir = os.path.dirname(__file__) + sys.path[:0] = [self.codedir] + eficasSalome.MyEficas.__init__(self, parent, "parametric_exec_params") + self.editor = getStudyEditor() + + def selectGroupFromSalome(self, kwType = None, editor = None): + """ + Select an entry from Salome object browser + """ + nbEntries = salome.sg.SelectedCount() + if nbEntries < 1: + msg = u"Veuillez sélectionner une entrée de l'arbre d'étude de Salome" + QMessageBox.information(self, self.tr(u"Sélection depuis Salome"), self.tr(msg)) + return [], msg + elif nbEntries > 1: + msg = u"Une seule entrée doit être sélectionnée dans l'arbre d'étude de Salome" + QMessageBox.information(self, self.tr(u"Sélection depuis Salome"), self.tr(msg)) + return [], msg + else: + try: + value = kwType.get_selected_value(salome.sg.getSelected(0), self.editor) + msg = u"L'entrée de l'arbre d'étude de Salome a été sélectionnée" + return [value], msg + except Exception, e: + QMessageBox.information(self, self.tr(u"Sélection depuis Salome"), self.tr(unicode(e))) + return [], unicode(e) + + def get_text_jdc(self): + """ + Return the currently edited JDC as text + """ + editor_index = self.viewmanager.myQtab.currentIndex() + if editor_index < 0: + return None + eficas_editor = self.viewmanager.dict_editors[editor_index] + return eficas_editor.get_text_JDC(eficas_editor.format) + + def closeEvent(self, event): + while self.codedir in sys.path: + sys.path.remove(self.codedir) + eficasSalome.MyEficas.closeEvent(self, event) + + def set_exec_params_from_param_study(self, param_study): + # No clean way to load JDC directly in Eficas, use a temp file instead + (fd, filename) = tempfile.mkstemp() + os.close(fd) + f = open(filename, "w") + f.write(param_study.exec_params) + f.close() + self.viewmanager.handleOpen(filename) diff --git a/src/salome/parametric/gui/eficas/configuration_parametric_exec_params.py b/src/salome/parametric/gui/eficas/configuration_parametric_exec_params.py new file mode 100644 index 0000000..d6768e9 --- /dev/null +++ b/src/salome/parametric/gui/eficas/configuration_parametric_exec_params.py @@ -0,0 +1,43 @@ +# Copyright (C) 2012 EDF +# +# This file is part of SALOME PARAMETRIC module. +# +# SALOME PARAMETRIC module is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# SALOME PARAMETRIC module 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 Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with SALOME PARAMETRIC module. If not, see . + +import os + +from Editeur.catadesc import CatalogDescription +from InterfaceQT4.configuration import CONFIG_BASE + +class CONFIG(CONFIG_BASE): + + def __init__(self, appli, repIni): + """ + This class stores the configuration parameters for Eficas + """ + CONFIG_BASE.__init__(self, appli, repIni, '.parametric_exec_params') + + # Configuration parameters + self.savedir = os.getenv("HOME") + catapath = os.path.join(os.path.dirname(__file__), "parametric_exec_params_cata.py") + self.catalogues = (CatalogDescription("parametric_exec_params", catapath),) + + def save_params(self): + pass + +def make_config(appli, rep): + return CONFIG(appli, rep) + +def make_config_style(appli, rep): + return None diff --git a/src/salome/parametric/gui/eficas/parametric_exec_params_cata.py b/src/salome/parametric/gui/eficas/parametric_exec_params_cata.py new file mode 100644 index 0000000..d63aa97 --- /dev/null +++ b/src/salome/parametric/gui/eficas/parametric_exec_params_cata.py @@ -0,0 +1,39 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2012 EDF +# +# This file is part of SALOME PARAMETRIC module. +# +# SALOME PARAMETRIC module is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# SALOME PARAMETRIC module 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 Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with SALOME PARAMETRIC module. If not, see . + +from salome.parametric.gui.eficas.appli import SalomeEntry +from Accas import * + +JdC = JDC_CATA(regles = (UN_PARMI('EXECUTION_PARAMETERS',)), + ) + +EXECUTION_PARAMETERS = PROC( + nom = "EXECUTION_PARAMETERS", op = None, + fr = u"Paramètres d'exécution de l'étude paramétrique", + PARAMETRIC_STUDY_NAME = SIMP(statut = "o", typ = 'TXM', + defaut = "Parametric Study", + fr = u"Nom de l'étude paramétrique qui sera créée dans l'arbre d'étude de Salome"), + SOLVER_CODE = SIMP(statut = "o", typ = 'TXM', + defaut = "DEVIATION", + fr = u"Nom du composant de calcul"), + DETERMINISTIC_CASE_ENTRY = SIMP(statut = "o", typ = SalomeEntry, + fr = u"Cas déterministe dans l'arbre d'étude de Salome"), + NUMBER_OF_PARALLEL_COMPUTATIONS = SIMP(statut = "o", typ = 'I', defaut = 1, + fr = u"Nombre de branches de calcul parallèles"), +) diff --git a/src/salome/parametric/gui/eficas/prefs.py b/src/salome/parametric/gui/eficas/prefs.py new file mode 100644 index 0000000..95b5101 --- /dev/null +++ b/src/salome/parametric/gui/eficas/prefs.py @@ -0,0 +1,18 @@ +# Copyright (C) 2012 EDF +# +# This file is part of SALOME PARAMETRIC module. +# +# SALOME PARAMETRIC module is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# SALOME PARAMETRIC module 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 Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with SALOME PARAMETRIC module. If not, see . + +code = "parametric_exec_params" diff --git a/src/salome/parametric/gui/eficas/prefs_parametric_exec_params.py b/src/salome/parametric/gui/eficas/prefs_parametric_exec_params.py new file mode 100644 index 0000000..07e2224 --- /dev/null +++ b/src/salome/parametric/gui/eficas/prefs_parametric_exec_params.py @@ -0,0 +1,21 @@ +# Copyright (C) 2012 EDF +# +# This file is part of SALOME PARAMETRIC module. +# +# SALOME PARAMETRIC module is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# SALOME PARAMETRIC module 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 Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with SALOME PARAMETRIC module. If not, see . + +import os + +repIni = os.path.dirname(__file__) +INSTALLDIR = os.getenv("EFICAS_ROOT") diff --git a/src/salome/parametric/gui/mainpanel.py b/src/salome/parametric/gui/mainpanel.py new file mode 100644 index 0000000..f34451a --- /dev/null +++ b/src/salome/parametric/gui/mainpanel.py @@ -0,0 +1,34 @@ +# Copyright (C) 2012 EDF +# +# This file is part of SALOME PARAMETRIC module. +# +# SALOME PARAMETRIC module is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# SALOME PARAMETRIC module 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 Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with SALOME PARAMETRIC module. If not, see . + +import SalomePyQt +sgPyQt = SalomePyQt.SalomePyQt() + +from wizard import Wizard + +class MainPanel(): + + def new_study(self): + wizard = Wizard(sgPyQt.getDesktop()) + id = sgPyQt.createView("New Parametric Study", wizard) + wizard.view_id = id + + def edit_study(self, param_study): + wizard = Wizard(sgPyQt.getDesktop()) + wizard.set_study(param_study) + id = sgPyQt.createView(param_study.get_exec_param("PARAMETRIC_STUDY_NAME"), wizard) + wizard.view_id = id diff --git a/src/salome/parametric/gui/selectvars.py b/src/salome/parametric/gui/selectvars.py new file mode 100644 index 0000000..274aa22 --- /dev/null +++ b/src/salome/parametric/gui/selectvars.py @@ -0,0 +1,34 @@ +# Copyright (C) 2012 EDF +# +# This file is part of SALOME PARAMETRIC module. +# +# SALOME PARAMETRIC module is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# SALOME PARAMETRIC module 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 Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with SALOME PARAMETRIC module. If not, see . + +from PyQt4 import QtGui, QtCore + +from salome.kernel.parametric import study_exchange_vars +from salome.gui.selectvars import MySelectVarsDialog + +class SelectVarsFrame(MySelectVarsDialog): + + def __init__(self, parent = None): + MySelectVarsDialog.__init__(self, parent) + self.OKButton.hide() + self.cancelButton.hide() + + def set_vars_from_param_study(self, param_study): + input_var_list = [study_exchange_vars.Variable(var.name) for var in param_study.input_vars] + output_var_list = [study_exchange_vars.Variable(varname) for varname in param_study.output_vars] + exchange_vars = study_exchange_vars.ExchangeVariables(input_var_list, output_var_list) + self.setExchangeVariables(exchange_vars) diff --git a/src/salome/parametric/gui/varrange.ui b/src/salome/parametric/gui/varrange.ui new file mode 100644 index 0000000..5eaae3d --- /dev/null +++ b/src/salome/parametric/gui/varrange.ui @@ -0,0 +1,92 @@ + + + VariableRange + + + + 0 + 0 + 588 + 84 + + + + Variable Range + + + + + + Variable: + + + + + + + + 75 + true + + + + Name + + + + + + + Range: From + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + 0.000000000000000 + + + + + + + To + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + 10.000000000000000 + + + + + + + Step + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + 1.000000000000000 + + + + + + + + diff --git a/src/salome/parametric/gui/wizard.py b/src/salome/parametric/gui/wizard.py new file mode 100644 index 0000000..4cc7255 --- /dev/null +++ b/src/salome/parametric/gui/wizard.py @@ -0,0 +1,122 @@ +# Copyright (C) 2012 EDF +# +# This file is part of SALOME PARAMETRIC module. +# +# SALOME PARAMETRIC module is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# SALOME PARAMETRIC module 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 Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with SALOME PARAMETRIC module. If not, see . + +from PyQt4 import QtCore, QtGui + +import salome +import SalomePyQt +sgPyQt = SalomePyQt.SalomePyQt() + +from wizard_ui import Ui_Wizard +from selectvars import SelectVarsFrame +from definevalues import DefineValuesFrame +from salome.parametric.gui.eficas.appli import EficasFrame +from salome.parametric.study import ParametricVariable, ParametricStudy, ParametricStudyEditor + + +class Wizard(QtGui.QWidget, Ui_Wizard): + + def __init__(self, parent = None): + QtGui.QWidget.__init__(self, parent) + self.setupUi(self) + self.connect(self.nextButton, QtCore.SIGNAL("clicked()"), self.next_step) + self.connect(self.previousButton, QtCore.SIGNAL("clicked()"), self.previous_step) + self.connect(self.OKButton, QtCore.SIGNAL("clicked()"), self.validate) + self.connect(self.cancelButton, QtCore.SIGNAL("clicked()"), self.close) + self.select_vars_frame = SelectVarsFrame(self) + self.innerFrame.layout().addWidget(self.select_vars_frame) + self.define_values_frame = DefineValuesFrame(self) + self.innerFrame.layout().addWidget(self.define_values_frame) + self.exec_params_frame = EficasFrame(self) + self.innerFrame.layout().addWidget(self.exec_params_frame) + self.reset_step() + self.step = 1 + self.step_methods[self.step](self) + self.entry = None + self.view_id = None + + def next_step(self): + self.reset_step() + self.step += 1 + self.step_methods[self.step](self) + + def previous_step(self): + self.reset_step() + self.step -= 1 + self.step_methods[self.step](self) + + def reset_step(self): + self.select_vars_frame.hide() + self.define_values_frame.hide() + self.exec_params_frame.hide() + self.OKButton.hide() + self.previousButton.show() + self.nextButton.show() + + def define_variables(self): + self.select_vars_frame.show() + self.previousButton.hide() + + def define_values(self): + exchange_vars = self.select_vars_frame.getSelectedExchangeVariables() + self.define_values_frame.set_variables(exchange_vars.inputVarList) + self.define_values_frame.show() + + def define_exec_params(self): + self.exec_params_frame.show() + self.nextButton.hide() + self.OKButton.show() + + def validate(self): + param_study = ParametricStudy() + # Input variables + for (name, range_widget) in self.define_values_frame.varwidgets.iteritems(): + min = range_widget.fromSpinBox.value() + max = range_widget.toSpinBox.value() + step = range_widget.stepSpinBox.value() + var = ParametricVariable(name, min, max, step) + param_study.add_input_variable(var) + # Output variables + exch_vars = self.select_vars_frame.getSelectedExchangeVariables() + for outvar in exch_vars.outputVarList: + param_study.add_output_variable(outvar.name) + # Execution parameters + exec_params_comm = self.exec_params_frame.get_text_jdc() + param_study.set_exec_params(exec_params_comm) + # Save to Salome study + ed = ParametricStudyEditor() + if self.entry is not None: + ed.set_parametric_study_at_entry(param_study, self.entry) + else: + ed.add_parametric_study(param_study) + salome.sg.updateObjBrowser(0) + self.close() + + def set_study(self, param_study): + self.entry = param_study.entry + self.select_vars_frame.set_vars_from_param_study(param_study) + self.define_values_frame.set_ranges_from_param_study(param_study) + self.exec_params_frame.set_exec_params_from_param_study(param_study) + + def close(self): + QtGui.QWidget.close(self) + if self.view_id is not None: + sgPyQt.closeView(self.view_id) + + step_methods = {1: define_variables, + 2: define_values, + 3: define_exec_params} diff --git a/src/salome/parametric/gui/wizard.ui b/src/salome/parametric/gui/wizard.ui new file mode 100644 index 0000000..eaad0d5 --- /dev/null +++ b/src/salome/parametric/gui/wizard.ui @@ -0,0 +1,115 @@ + + + Wizard + + + + 0 + 0 + 566 + 305 + + + + Wizard + + + + + + + + Step 1 + + + + + + + Step 2 + + + + + + + Step 3 + + + + + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + + + Qt::Vertical + + + + 20 + 198 + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + << Previous + + + + + + + Next >> + + + + + + + OK + + + + + + + Cancel + + + + + + + + + + diff --git a/src/salome/parametric/study.py b/src/salome/parametric/study.py new file mode 100644 index 0000000..de68dd5 --- /dev/null +++ b/src/salome/parametric/study.py @@ -0,0 +1,171 @@ +# Copyright (C) 2012 EDF +# +# This file is part of SALOME PARAMETRIC module. +# +# SALOME PARAMETRIC module is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# SALOME PARAMETRIC module 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 Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with SALOME PARAMETRIC module. If not, see . + +import cPickle +import numpy + +from salome.kernel.studyedit import getStudyEditor + +# module constants +MODULE_NAME = "PARAMETRIC" + +COMPONENT_NAME = "Parametric" +COMPONENT_ICON = "PARAMETRIC_small.png" + +PARAM_STUDY_ICON = "param_study.png" +PARAM_STUDY_TYPE_ID = 1 + +def jdc_to_dict(jdc, command_list): + """ + This tricky function transforms a JdC with a single command into a + dictionary that can be used more easily from a Python context (thanks to + M. Courtois and G. Boulant). + """ + context = {} + for command in command_list: + context[command] = _args_to_dict + exec "parameters = " + jdc.strip() in context + return context['parameters'] + +def _args_to_dict(**kwargs): + return kwargs + +class ParametricStudyEditor: + """ + This class provides utility methods to edit the component "Parametric" in + the study. The parameter `studyId` defines the ID of the study to edit. If + it is :const:`None`, the edited study will be the current study. + """ + def __init__(self, study_id = None): + self.editor = getStudyEditor(study_id) + self.param_comp = None + + def find_or_create_param_component(self): + """ + Find the component "Parametric" or create it if none is found + :return: the SComponent found or created. + """ + if self.param_comp is None: + self.param_comp = self.editor.findOrCreateComponent(MODULE_NAME, COMPONENT_NAME, COMPONENT_ICON) + return self.param_comp + + def add_parametric_study(self, parametric_study): + self.find_or_create_param_component() + sobj = self.editor.createItem(self.param_comp, "__NEW_STUDY__") + self._set_sobj(parametric_study, sobj) + + def set_parametric_study_at_entry(self, parametric_study, entry): + sobj = self.editor.study.FindObjectID(entry) + self._set_sobj(parametric_study, sobj) + + def _set_sobj(self, parametric_study, sobj): + self.editor.setItem(sobj, + name = parametric_study.get_exec_param("PARAMETRIC_STUDY_NAME"), + comment = cPickle.dumps(parametric_study), + icon = PARAM_STUDY_ICON, + typeId = PARAM_STUDY_TYPE_ID) + + def get_parametric_study(self, entry): + sobj = self.editor.study.FindObjectID(entry) + if sobj is None or self.editor.getTypeId(sobj) != PARAM_STUDY_TYPE_ID: + raise Exception("No valid parametric study at entry %s" % entry) + param_study = cPickle.loads(sobj.GetComment()) + param_study.entry = entry + return param_study + + +class ParametricVariable: + + def __init__(self, name, min = None, max = None, step = None): + self.name = name + self.min = min + self.max = max + self.step = step + + +class ParametricStudy: + + def __init__(self): + self.input_vars = [] + self.output_vars = [] + self.exec_params = None + self.data = None + self.datasize = 0 + self._value_dict = None + self.entry = None + + def add_input_variable(self, var): + self.input_vars.append(var) + + def add_output_variable(self, varname): + self.output_vars.append(varname) + + def set_exec_params(self, params): + self.exec_params = params + + def get_exec_param(self, name): + param_dict = jdc_to_dict(self.exec_params, ["EXECUTION_PARAMETERS"]) + return param_dict[name] + + def generate_data(self): + self.data = {} + self.datasize = 0 + for var in self.input_vars: + self.data[var.name] = [] + self._value_dict = {} + self._fill_data(self.input_vars) + + def _fill_data(self, remaining_var_list): + if len(remaining_var_list) == 0: + for (name, value) in self._value_dict.iteritems(): + self.data[name].append(value) + self.datasize += 1 + else: + var = remaining_var_list[0] + next_var_list = remaining_var_list[1:] + for value in numpy.arange(var.min, var.max, var.step): + self._value_dict[var.name] = value + self._fill_data(next_var_list) + + def export_data_to_csv_file(self, filepath, sep = ","): + if self.data is None: + raise Exception("Parametric study does not contain any data") + f = open(filepath, "w") + + # Header + for invar in self.input_vars: + f.write(invar.name + sep) + for outvarname in self.output_vars: + f.write(outvarname + sep) + f.write("Error message\n") + + # Data + for i in range(self.datasize): + for invar in self.input_vars: + f.write(self._format_value(self.data[invar.name][i]) + sep) + for outvarname in self.output_vars: + f.write(self._format_value(self.data[outvarname][i]) + sep) + f.write(self._format_value(self.data["__ERROR_MESSAGE__"][i]) + "\n") + + f.close() + + def _format_value(self, value): + if value is None: + val = "" + else: + val = unicode(value) + return val.encode("utf-8") -- 2.39.2