From 76e00da50511d37c186b204d0412e294abaf29ea Mon Sep 17 00:00:00 2001 From: vsr Date: Tue, 16 Aug 2005 10:14:22 +0000 Subject: [PATCH] Sierpinsky sample module --- INSTALL | 4 + LICENCE | 504 ++++++++++ Makefile.in | 96 ++ README | 195 ++++ adm_local/unix/config_files/check_Med.m4 | 43 + .../unix/config_files/check_Randomizer.m4 | 42 + adm_local/unix/config_files/check_Visu.m4 | 42 + adm_local/unix/make_commence.in | 277 ++++++ adm_local/unix/make_omniorb.in | 56 ++ bin/VERSION | 1 + build_configure | 225 +++++ configure.in.base | 399 ++++++++ idl/Makefile.in | 70 ++ idl/Sierpinsky.idl | 36 + resources/SIERPINSKY.png | Bin 0 -> 447 bytes resources/SIERPINSKYCatalog.xml | 166 ++++ resources/SIERPINSKY_en.xml | 19 + resources/go.png | Bin 0 -> 305 bytes resources/graph1.xml | 435 +++++++++ resources/graph2.xml | 892 ++++++++++++++++++ src/Makefile.in | 18 + src/Sierpinsky/Makefile.in | 31 + src/Sierpinsky/SIERPINSKY_Gen_i.cxx | 173 ++++ src/Sierpinsky/SIERPINSKY_Gen_i.hxx | 65 ++ src/SierpinskyGUI/Makefile.in | 39 + src/SierpinskyGUI/SIERPINSKY_icons.po | 11 + src/SierpinskyGUI/SIERPINSKY_msg_en.po | 93 ++ src/SierpinskyGUI/SierpinskyGUI.cxx | 57 ++ src/SierpinskyGUI/SierpinskyGUI.h | 30 + src/SierpinskyGUI/SierpinskyGUI_RunDlg.cxx | 544 +++++++++++ src/SierpinskyGUI/SierpinskyGUI_RunDlg.h | 85 ++ 31 files changed, 4648 insertions(+) create mode 100644 INSTALL create mode 100644 LICENCE create mode 100644 Makefile.in create mode 100755 README create mode 100644 adm_local/unix/config_files/check_Med.m4 create mode 100644 adm_local/unix/config_files/check_Randomizer.m4 create mode 100644 adm_local/unix/config_files/check_Visu.m4 create mode 100644 adm_local/unix/make_commence.in create mode 100644 adm_local/unix/make_omniorb.in create mode 100755 bin/VERSION create mode 100755 build_configure create mode 100644 configure.in.base create mode 100644 idl/Makefile.in create mode 100644 idl/Sierpinsky.idl create mode 100755 resources/SIERPINSKY.png create mode 100644 resources/SIERPINSKYCatalog.xml create mode 100644 resources/SIERPINSKY_en.xml create mode 100644 resources/go.png create mode 100644 resources/graph1.xml create mode 100644 resources/graph2.xml create mode 100755 src/Makefile.in create mode 100644 src/Sierpinsky/Makefile.in create mode 100644 src/Sierpinsky/SIERPINSKY_Gen_i.cxx create mode 100644 src/Sierpinsky/SIERPINSKY_Gen_i.hxx create mode 100644 src/SierpinskyGUI/Makefile.in create mode 100644 src/SierpinskyGUI/SIERPINSKY_icons.po create mode 100644 src/SierpinskyGUI/SIERPINSKY_msg_en.po create mode 100644 src/SierpinskyGUI/SierpinskyGUI.cxx create mode 100644 src/SierpinskyGUI/SierpinskyGUI.h create mode 100644 src/SierpinskyGUI/SierpinskyGUI_RunDlg.cxx create mode 100644 src/SierpinskyGUI/SierpinskyGUI_RunDlg.h diff --git a/INSTALL b/INSTALL new file mode 100644 index 0000000..70ef8cc --- /dev/null +++ b/INSTALL @@ -0,0 +1,4 @@ +This is the version 0.1 of SIERPINSKY module +Requires : + - SALOME KERNEL 2.2.4 + - RANDOMIZER 0.1 diff --git a/LICENCE b/LICENCE new file mode 100644 index 0000000..b1e3f5a --- /dev/null +++ b/LICENCE @@ -0,0 +1,504 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +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 this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. 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 not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +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 +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the 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 +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "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 +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY 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 +LIBRARY (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 LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey 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 library 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 2.1 of the License, or (at your option) any later version. + + This library 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 this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! + + diff --git a/Makefile.in b/Makefile.in new file mode 100644 index 0000000..4fe142f --- /dev/null +++ b/Makefile.in @@ -0,0 +1,96 @@ +############################################################### +# File : Makefile.in +# Author : Vadim SANDLER (OCN) +# Created : 13/07/05 +# Copyright (C) 2005 Open CASCADE +############################################################### + +# source path +top_srcdir=@top_srcdir@ +top_builddir=. +srcdir=@srcdir@ +VPATH=.:@srcdir@:@top_srcdir@/bin:@top_srcdir@/resources:./bin:@top_srcdir@/idl + +@COMMENCE@ + +SUBDIRS = idl src + +RESOURCES_FILES = \ + SIERPINSKYCatalog.xml \ + SIERPINSKY_en.xml \ + SIERPINSKY.png \ + go.png \ + graph1.xml \ + graph2.xml + +BIN_SCRIPT = VERSION + +# copy header files in common directory +ifeq ($(HAVE_SSTREAM),yes) + include_list=include/salome/SALOMEconfig.h +else + include_list=include/salome/SALOMEconfig.h include/salome/sstream +endif + +inc: idl $(include_list) + +include/salome/SALOMEconfig.h: salome_adm/unix/SALOMEconfig.ref + -$(RM) $@ + $(LN_S) ../../$< $@ + +# test if SALOMEconfig.h has changed (contents) +salome_adm/unix/SALOMEconfig.ref: salome_adm/unix/SALOMEconfig.h + @if ! [ -a $@ ]; then \ + cp -p -f $< $@; \ + fi; \ + if ! cmp $< $@; then \ + cp -p -f $< $@; \ + fi; \ + +include/salome/sstream: salome_adm/unix/sstream + -$(RM) $@ + $(LN_S) ../../$< $@ + +depend: depend_idl + +depend_idl: + (cd idl ; $(MAKE) $@) || exit 1 + +# doc is already build : if you want to had documents, go manually to doc and run 'make doc' +#doc: +# (cd doc && $(MAKE) $@) || exit 1 + +install-end: +# finish libtool install +# @$(LT) --mode=finish $(libdir) + +install-include: $(include_list) + $(INSTALL) -d $(includedir) + @for f in X $(include_list); do \ + if test $$f != X; then \ + ($(INSTALL_DATA) -p $$f $(includedir)/. || exit 1); \ + fi; \ + done + +# install script in $(bindir) : +install-bin: $(BIN_SCRIPT) + $(INSTALL) -d $(bindir) + $(INSTALL_PROGRAM) $^ $(bindir) + +uninstall: uninstall-idl + +uninstall-idl: + $(RM) $(idldir)/*.idl + +distclean: distclean-other + +distclean-other: + -$(RM) salome_adm/unix/*~ salome_adm/unix/*% salome_adm/unix/*.bak salome_adm/unix/*.new salome_adm/unix/*.old + -$(RM) salome_adm/unix/make_* + -$(RM) salome_adm/unix/depend salome_adm/unix/SALOMEconfig.h + -$(RM) config.cache config.log config.status + +@MODULE@ + +install: install-bin install-include install-end + diff --git a/README b/README new file mode 100755 index 0000000..2359dd0 --- /dev/null +++ b/README @@ -0,0 +1,195 @@ +============================================================ +README for: +* Randomizer module : version 0.1 +* Sierpinsky module : version 0.1 +============================================================ + +Contents of this file: + +1. Introduction. +2. Prerequisites. +3. Installation. +4. Launching. +5. Functionality. +6. Testing. + +======================================================= +1. Introduction. +======================================================= + +Randomizer and Sierpinsky SALOME-based modules implement simple interface to calculate Sierpinsky fields. + +======================================================= +2. Prerequisites. +======================================================= + +SALOME version 2.2.4 is used as a referense version of SALOME platform. +All other products are those used by SALOME v2.2.4. + +======================================================= +3. Installation. +======================================================= + +The compilation procedure is exactly the same as for other SALOME modules: + +3.1. install SALOME 2.2.4 with all prerequisite products; +3.2. unpack Randomizer and Sierpinsky modules sources; +3.3 set environment: + + source /env_products.csh + + where is a directory where SALOME 2.2.4 is installed to. + +3.4 create build directory for Randomizer module: + + mkdir RANDOMIZER_BUILD + cd RANDOMIZER_BUILD + +3.5 make and install Randomizer module: + + /build_configure + /configure --prefix=${RANDOMIZER_install_dir} + make + make install + + where is a Randomizer module sources directory and + is a directory where you want to install the Randomizer module. + +3.6. Repeat 3.4, 3.5 steps for Sierpinsky module. + +Launch 'configure --help' command to learn more about configuration options. + +======================================================= +4. Launching. +======================================================= + +To launch SALOME application the following steps should be performed: + +4.1. set environment: + + source /env_products.csh + + where is a directory where SALOME 2.2.4 is installed to. + +4.3. add Randomizer and Sierpinsky modules environment: + + setenv RANDOMIZER_ROOT_DIR + setenv SIERPINSKY_ROOT_DIR + + where and are the directories where + you have installed Randomizer and Sierpinsky modules correspondingly (see paragraph 3 above). + +4.4. launch SALOME: + + ${KERNEL_ROOT_DIR}/bin/salome/runSalome --module=MED,VISU,SUPERV,RANDOMIZER,SIERPINSKY + +======================================================= +5. Functionality. +======================================================= + +5.1 Randomizer module + +Randomizer module is implemented as pure Python module. It does not have any GUI. +The IDL interface includes two methods: + +- void InitPoint( out double theX, out double theY ); + + to generate a random 2D point; X and Y coordinates are in [0,1) range; + +- long NextIteration(); + + to calculate next random iteration step: the integer value in range {1,3}. + + The functionality of this module is used by Sierpinsky module to calculate Sierpinsky fields. + +5.2. Sierpinsky module. + +The engine interface includes the following methods: + +- void Init( in double X1, in double Y1, in double X2, in double Y2, in double X3, in double Y3 ); + + to initialize the engine with three points which will be used as reference points in the calculations; + +- void Reset(); + + to initializes the engine with three default reference points: (0.5, 1), (0, 0), (1, 0); + +- void NextPoint( in double X, in double Y, in long iter, out double nextX, out double nextY ); + + calculates next iteration point, basing on the previous one and the iteration step given from + Randomizer engine; this method is called subsequently in the loop to generate the points cloud; + +- boolean ExportToJPEG( in string fileName, in long size ); + + exports the collected points data to the JPEG file; + +- boolean ExportToMED( in string fileName, in double size ); + + exports the collected points data to the MED file. + + The Init() and Reset() methods clear the collected points data and prepare engine to the new calculations. + The JPEG file can be viewed with help of any image viewer supporting JPEG format. + The MED files created by ExportToMED() method can be then imported in the Post-Pro (VISU) module for the + visualization (see below). + +======================================================= +6. Testing. +======================================================= + +6.1. GUI mode. + +Launch SALOME (see paragraph 4) and create a new study. To activate Sierpinsky module click the corresponding +button on the 'Components' toolbar or select it in the components combo-box. + +The only action of the Sierpinsky module's GUI is available via 'Sierpinsky' main menu - it is a 'Run' command +(there is also corresponding button on the toolbar). +This command opens 'Run Sierpinsky Algo' dialog box which allows: + +- to define a start point for the calculations; if 'Random' checkbox is turned on, the start point will +be generated automatically via Randomizer module functionality; + +- to define three reference points for the algo; if 'Random' checkbox is turned on, the reference points +will be generated automatically via Randomizer module functionality; if 'Default' checkbox is turned on +the default values will be used; + +- to enter the number of the points to be calculated; + +- to create JPEG image after calculcations finishing; 'Image size' parameter defines the size of the image side +in pixels; + +- to export results to the MED file after calculcations finishing; 'Mesh size' parameter defines the mesh range. + +- to import generated MED file automatically to the Post-Pro (VISU) module for the further visualisation. + +After pressing the 'Start' button the calculation begins. It is possible to stop the calculation by pressing +'Stop' button. The progress bar in the lower part of the dialog box displays the calculation status. + +6.2. Visualization. + +Activate Post-Pro (VISU) module by clicking the corresponding button on the 'Components' toolbar. +Select 'File/Import from file' menu command. Select the MED file, click 'Open' button. The MED file is imported +to the study. +Note: the MED file can be automatically imported to the study after finishing of the calculations +(see previous paragraph). + +Select 'Post-Pro/.med/Sierpinsky/Families/onNodes' object in the Object Browser, invoke context popup +menu by mouse right-button click and select 'Display Only' command. The cloud of points is displayed in the viewer. +Note: the visualizaion of mesh is only possible in the VTK viewer. + +6.3. Supervisor. + +Activate Supervisor module by clicking the corresponding button on the 'Components' toolbar. +There are two sample Supervisor graphs which allow to test the Randomizer and Sierpinsky modules +functionality. These files can be found in the /share/salome/resources directory +where is the directory where you have installed Sierpinsky module (see paragraph 3). + +Call 'File/Import Dataflow' menu command, then browse to the 'graph1.xml' or 'graph2.xml' file and click 'Open' button. +To launch the graph, call 'Supervisor/Run' menu command or just click the corresponding toolbar button. + +The both graphs implement simple loop to perform calculations. The first graph uses default parameters and +exports the generated data to the JPEG file after calculation finishing. + +The second graph is some more complicated. It uses random start and reference points. After the calculations finishing +it exports the data to the JPEG file and to the MED file, then automatically imports the MED file to the Post-Pro +module and displays it in the new 3d viewer (the 'ImportToVisu' inline node performs the importation and visualizing). + diff --git a/adm_local/unix/config_files/check_Med.m4 b/adm_local/unix/config_files/check_Med.m4 new file mode 100644 index 0000000..18d3ccd --- /dev/null +++ b/adm_local/unix/config_files/check_Med.m4 @@ -0,0 +1,43 @@ +########################################################### +# File : check_Med.m4 +# Author : Vadim SANDLER (OCN) +# Created : 13/07/05 +# Copyright (C) 2005 Open CASCADE +# Check availability of MED binary distribution +########################################################### + +AC_DEFUN([CHECK_MED],[ + +AC_CHECKING(for Med) + +Med_ok=no + +AC_ARG_WITH(med, + [ --with-med=DIR root directory path of MED installation ], + MED_DIR="$withval",MED_DIR="") + +if test "x$MED_DIR" == "x" ; then + # no --with-med-dir option used + if test "x$MED_ROOT_DIR" != "x" ; then + # MED_ROOT_DIR environment variable defined + MED_DIR=$MED_ROOT_DIR + fi +fi + +if test -f ${MED_DIR}/idl/salome/MED.idl ; then + Med_ok=yes + AC_MSG_RESULT(Using Med module distribution in ${MED_DIR}) + + if test "x$MED_ROOT_DIR" == "x" ; then + MED_ROOT_DIR=${MED_DIR} + fi + AC_SUBST(MED_ROOT_DIR) + +else + AC_MSG_WARN("Cannot find Med module sources") +fi + +AC_MSG_RESULT(for Med: $Med_ok) + +])dnl + diff --git a/adm_local/unix/config_files/check_Randomizer.m4 b/adm_local/unix/config_files/check_Randomizer.m4 new file mode 100644 index 0000000..9d6682c --- /dev/null +++ b/adm_local/unix/config_files/check_Randomizer.m4 @@ -0,0 +1,42 @@ +########################################################### +# File : check_Randomizer.m4 +# Author : Vadim SANDLER (OCN) +# Created : 13/07/05 +# Copyright (C) 2005 Open CASCADE +# Check availability of Randomizer binary distribution +########################################################### + +AC_DEFUN([CHECK_RANDOMIZER],[ + +AC_CHECKING(for Randomizer) + +Randomizer_ok=no + +AC_ARG_WITH(rnd, + [ --with-rnd=DIR root directory path of RANDOMIZER module installation ], + RANDOMIZER_DIR="$withval",RANDOMIZER_DIR="") + +if test "x$RANDOMIZER_DIR" == "x" ; then + # no --with-rnd-dir option used + if test "x$RANDOMIZER_ROOT_DIR" != "x" ; then + # RANDOMIZER_ROOT_DIR environment variable defined + RANDOMIZER_DIR=$RANDOMIZER_ROOT_DIR + fi +fi + +if test -f ${RANDOMIZER_DIR}/idl/salome/Randomizer.idl ; then + Randomizer_ok=yes + AC_MSG_RESULT(Using Randomizer module distribution in ${RANDOMIZER_DIR}) + + if test "x$RANDOMIZER_ROOT_DIR" == "x" ; then + RANDOMIZER_ROOT_DIR=${RANDOMIZER_DIR} + fi + AC_SUBST(RANDOMIZER_ROOT_DIR) +else + AC_MSG_WARN("Cannot find Randomizer module sources") +fi + +AC_MSG_RESULT(for Randomizer: $Randomizer_ok) + +])dnl + diff --git a/adm_local/unix/config_files/check_Visu.m4 b/adm_local/unix/config_files/check_Visu.m4 new file mode 100644 index 0000000..7700fb5 --- /dev/null +++ b/adm_local/unix/config_files/check_Visu.m4 @@ -0,0 +1,42 @@ +########################################################### +# File : check_Visu.m4 +# Author : Vadim SANDLER (OCN) +# Created : 13/07/05 +# Copyright (C) 2005 Open CASCADE +# Check availability of VISU binary distribution +########################################################### + +AC_DEFUN([CHECK_VISU],[ + +AC_CHECKING(for VISU) + +Visu_ok=no + +AC_ARG_WITH(visu, + [ --with-visu=DIR root directory path of VISU module installation ], + VISU_DIR="$withval",VISU_DIR="") + +if test "x$VISU_DIR" == "x" ; then + # no --with-visu-dir option used + if test "x$VISU_ROOT_DIR" != "x" ; then + # VISU_ROOT_DIR environment variable defined + VISU_DIR=$VISU_ROOT_DIR + fi +fi + +if test -f ${VISU_DIR}/idl/salome/VISU_Gen.idl ; then + Visu_ok=yes + AC_MSG_RESULT(Using VISU module distribution in ${VISU_DIR}) + + if test "x$VISU_ROOT_DIR" == "x" ; then + VISU_ROOT_DIR=${VISU_DIR} + fi + AC_SUBST(VISU_ROOT_DIR) +else + AC_MSG_WARN("Cannot find VISU module sources") +fi + +AC_MSG_RESULT(for VISU: $Visu_ok) + +])dnl + diff --git a/adm_local/unix/make_commence.in b/adm_local/unix/make_commence.in new file mode 100644 index 0000000..7130d52 --- /dev/null +++ b/adm_local/unix/make_commence.in @@ -0,0 +1,277 @@ +#======================================================================= +# This section of this makefile comes from the file +# 'adm_local/unix/make_commence' which was generated with config.status +# from file adm_local/unix/make_commence.in +#======================================================================= + +# common directories to put headerfiles +inc_builddir=$(top_builddir)/include/salome + +@SET_MAKE@ +SHELL=/bin/sh + +# header missing + +HAVE_SSTREAM=@HAVE_SSTREAM@ + + +LIBS=@LIBS@ +LIBSFORBIN=@LIBS@ +LDFLAGS=@LDFLAGS@ -L$(top_builddir)/lib/salome -Xlinker -rpath-link -Xlinker $(top_builddir)/lib/salome +LDFLAGSFORBIN=@LDFLAGS@ -L$(top_builddir)/lib/salome -Xlinker -rpath-link -Xlinker $(KERNEL_ROOT_DIR)/lib/salome +# add libstdc++ to link c++ library with libtool ! +LDFLAGS+= -lstdc++ +LDFLAGSFORBIN+= -lstdc++ + +CP=@CP@ + +# CPP + +CPP=@CPP@ +CXXCPP=@CXXCPP@ +CPPFLAGS=@CPPFLAGS@ -I$(inc_builddir) -I$(srcdir) -I. + +# C + +CC = @CC@ +CFLAGS = @CFLAGS@ +C_DEPEND_FLAG = @C_DEPEND_FLAG@ + +# C++ + +CXX = @CXX@ +CXXFLAGS = @CXXFLAGS@ +CXX_DEPEND_FLAG = @CXX_DEPEND_FLAG@ + +# BOOST Library + +BOOST_CPPFLAGS = @BOOST_CPPFLAGS@ + +# JAVA + +JAVA_INCLUDES = @JAVA_INCLUDES@ +JAVA_LIBS = @JAVA_LIBS@ +JAVA_LDPATH = @JAVA_LDPATH@ + +# PYTHON + +PYTHON = @PYTHON@ +PYTHONHOME = @PYTHONHOME@ +PYTHON_INCLUDES = @PYTHON_INCLUDES@ +PYTHON_LIBS = @PYTHON_LIBS@ +PYTHON_VERSION = @PYTHON_VERSION@ +# Changes from the SalomePro V1.2c +#PYTHON_SITE = @PYTHON_SITE@ +#PYTHON_SITE_INSTALL = @PYTHON_SITE_INSTALL@ +PYTHON_SITE = $(prefix)/lib/python$(PYTHON_VERSION)/site-packages +PYTHON_SITE_INSTALL = $(prefix)/lib/python$(PYTHON_VERSION)/site-packages/salome + +# QT + +QT_ROOT = @QT_ROOT@ +QT_INCLUDES = @QT_INCLUDES@ +QT_MT_INCLUDES = @QT_INCLUDES@ -DQT_THREAD_SUPPORT +QT_LIBS = @QT_LIBS@ +QT_MT_LIBS = @QT_MT_LIBS@ + +MOC = @MOC@ +UIC = @UIC@ + + +#QWT + +QWT_INCLUDES=@QWT_INCLUDES@ +QWT_LIBS=@QWT_LIBS@ + +# SIP +SIP = @SIP@ +SIP_INCLUDES = @SIP_INCLUDES@ +SIP_LIBS = @SIP_LIBS@ + +# PYQT +PYQT_SIPS = @PYQT_SIPS@ +PYQT_LIBS = @PYQT_LIBS@ + +# openGL +OGL_INCLUDES=@OGL_INCLUDES@ +OGL_LIBS=@OGL_LIBS@ + +# VTK +VTK_INCLUDES=@VTK_INCLUDES@ +VTK_LIBS=@VTK_LIBS@ + +# HDF5 + +HDF5_INCLUDES=@HDF5_INCLUDES@ +HDF5_LIBS=@HDF5_LIBS@ +HDF5_MT_LIBS=@HDF5_MT_LIBS@ + +# MED2 + +MED2_INCLUDES=@MED2_INCLUDES@ +MED2_LIBS=@MED2_LIBS@ +MED2_MT_LIBS=@MED2_MT_LIBS@ + +# OpenCasCade + +OCC_INCLUDES=@CAS_CPPFLAGS@ +OCC_CXXFLAGS=@CAS_CXXFLAGS@ + +#OCC_KERNEL_LIBS=@CAS_KERNEL@ +#OCC_OCAF_LIBS=@CAS_OCAF@ +#OCC_VIEWER_LIBS=@CAS_VIEWER@ +#OCC_MODELER_LIBS=@CAS_MODELER@ +#OCC_DATAEXCHANGE_LIBS=@CAS_DATAEXCHANGE@ +#OCC_LIBS=@CAS_LDFLAGS@ +CAS_KERNEL=@CAS_KERNEL@ +CAS_OCAF=@CAS_OCAF@ +CAS_VIEWER=@CAS_VIEWER@ +CAS_MODELER=@CAS_MODELER@ +CAS_DATAEXCHANGE=@CAS_DATAEXCHANGE@ +CAS_LDPATH=@CAS_LDPATH@ + +# MPICH + +MPICH_INCLUDES=@MPICH_INCLUDES@ +MPICH_LIBS=@MPICH_LIBS@ + +# Swig C++ Python + +SWIG = @SWIG@ +SWIG_FLAGS = @SWIG_FLAGS@ -I$(inc_builddir) -I$(srcdir) -I. + +# OMNIORB + +OMNIORB_ROOT = @OMNIORB_ROOT@ +OMNIORB_INCLUDES = @OMNIORB_INCLUDES@ +OMNIORB_LIBS = @OMNIORB_LIBS@ +OMNIORB_CXXFLAGS = @OMNIORB_CXXFLAGS@ + +OMNIORB_IDL = @OMNIORB_IDL@ +OMNIORB_IDLCXXFLAGS = @OMNIORB_IDLCXXFLAGS@ +OMNIORB_IDLPYFLAGS = @OMNIORB_IDLPYFLAGS@ -I$(top_srcdir)/idl -I$(top_builddir)/idl/salome -I$(KERNEL_ROOT_DIR)/idl/salome \ + -I$(MED_ROOT_DIR)/idl/salome -I$(VISU_ROOT_DIR)/idl/salome -I$(RANDOMIZER_ROOT_DIR)/idl/salome + +OMNIORB_IDL_CLN_H = @OMNIORB_IDL_CLN_H@ +OMNIORB_IDL_CLN_CXX = @OMNIORB_IDL_CLN_CXX@ +OMNIORB_IDL_CLN_OBJ = @OMNIORB_IDL_CLN_OBJ@ + +OMNIORB_IDL_SRV_H = @OMNIORB_IDL_SRV_H@ +OMNIORB_IDL_SRV_CXX = @OMNIORB_IDL_SRV_CXX@ +OMNIORB_IDL_SRV_OBJ = @OMNIORB_IDL_SRV_OBJ@ + +# Default ORB + +CORBA_ROOT = @CORBA_ROOT@ +CORBA_INCLUDES = @CORBA_INCLUDES@ +CORBA_LIBS = @CORBA_LIBS@ +CORBA_CXXFLAGS = @CORBA_CXXFLAGS@ + +IDLCXXFLAGS = -bcxx @IDLCXXFLAGS@ -I$(top_srcdir)/idl -I$(top_builddir)/idl/salome -I$(KERNEL_ROOT_DIR)/idl/salome \ + -I$(MED_ROOT_DIR)/idl/salome -I$(VISU_ROOT_DIR)/idl/salome -I$(RANDOMIZER_ROOT_DIR)/idl/salome + +IDLPYFLAGS = @IDLPYFLAGS@ + +IDL = @IDL@ + +IDL_CLN_H = @IDL_CLN_H@ +IDL_CLN_CXX = @IDL_CLN_CXX@ +IDL_CLN_OBJ = @IDL_CLN_OBJ@ + +IDL_SRV_H = @IDL_SRV_H@ +IDL_SRV_CXX = @IDL_SRV_CXX@ +IDL_SRV_OBJ = @IDL_SRV_OBJ@ + +CPPFLAGS+= $(CORBA_INCLUDES) +CXXFLAGS+= $(CORBA_CXXFLAGS) + +# add corba libs when link salome application ! +#LDFLAGS+= $(CORBA_LIBS) +LIBS+=$(CORBA_LIBS) + +DOXYGEN = @DOXYGEN@ + +## Shared libraries +LT_STATIC_EXEC=@LT_STATIC_EXEC@ +DYNAMIC_DIRS=@DYNAMIC_DIRS@ +LT_LIB=libtool +LT=$(top_builddir)/libtool +LT_COMPILE=$(LT) --mode=compile $(CC) +LT_LINK_LIB=$(LT_LIB) --mode=link $(CC) -rpath $(libdir) +LT_LINK_EXE=$(LT) --mode=link $(CC) $(LT_STATIC_EXEC) -dlopen self -rpath $(bindir) $(DYNAMIC_DIRS) +LT_RUN=$(LT) --mode=execute +LT_INSTALL_PROG=$(LT) --mode=install $(INSTALL_PROGRAM) +LT_INSTALL_LIB=$(LT) --mode=install $(INSTALL_DATA) +LT_UNINSTALL=$(LT) --mode=uninstall $(RM) + +INSTALL=@INSTALL@ +INSTALL_PROGRAM=@INSTALL_PROGRAM@ +INSTALL_DATA=@INSTALL_DATA@ + +# create a symbolic link (or a copie ?) +LN_S=@LN_S@ + +## Installation points +prefix=@prefix@ +exec_prefix=@exec_prefix@ +bindir=@bindir@/salome +libdir=@libdir@/salome +# warning : if user give this path in configure we could have salome/salome :-( +includedir=@includedir@/salome +datadir=@datadir@/salome +idldir=$(prefix)/idl/salome +sharedpydir=@libdir@/python$(PYTHON_VERSION)/site-packages/salome/shared_modules +incmakedir=${prefix}/salome_adm/unix + +docdir=$(datadir)/doc + +# +# begin of package rules +# + +.PHONY: all lib bin inc resources tests install uninstall dep depend depend_idl cleandep mostlyclean clean distclean + +.SUFFIXES: .cxx .cc .c .f .o .lo .idl .py .i .ui .po .qm + +all: + $(MAKE) inc + $(MAKE) depend_idl + $(MAKE) depend + $(MAKE) lib + $(MAKE) bin + $(MAKE) resources + +# +# add target to build administrative files +# + +Makefile: $(top_builddir)/config.status $(srcdir)/Makefile.in + cd $(top_builddir) ; ./config.status + +$(top_builddir)/config.status: $(top_srcdir)/configure + cd $(top_builddir) ; ./config.status --recheck + +# VPATH contain $(srcdir), so make configure is good in top_srcdir and we must add target configure otherwise :-) +ifneq ($(top_srcdir),$(srcdir)) +configure: $(top_srcdir)/configure +endif + +$(top_srcdir)/configure: $(top_srcdir)/configure.in $(top_srcdir)/aclocal.m4 + cd $(top_srcdir) ; autoconf + +$(top_srcdir)/configure.in: $(top_srcdir)/configure.in.base + cd $(top_srcdir) && ./build_configure + + +ACLOCAL_SRC = \ +ac_cxx_bool.m4 check_corba.m4 check_vtk.m4 \ +ac_cxx_depend_flag.m4 check_hdf5.m4 enable_pthreads.m4 \ +ac_cxx_mutable.m4 check_mico.m4 libtool.m4 \ +ac_cxx_namespaces.m4 check_omniorb.m4 pyembed.m4 \ +ac_cxx_partial_specialization.m4 check_opengl.m4 python.m4 \ +ac_cxx_typename.m4 check_pthreads.m4 check_cas.m4 \ +ac_cc_warnings.m4 check_qt.m4 check_med2.m4 \ +check_swig.m4 check_boost.m4 + +$(top_srcdir)/aclocal.m4: $(ACLOCAL_SRC:%=@KERNEL_ROOT_DIR@/salome_adm/unix/config_files/%) + cd $(top_srcdir) ; aclocal --acdir=adm_local/unix/config_files -I @KERNEL_ROOT_DIR@/salome_adm/unix/config_files diff --git a/adm_local/unix/make_omniorb.in b/adm_local/unix/make_omniorb.in new file mode 100644 index 0000000..a43962e --- /dev/null +++ b/adm_local/unix/make_omniorb.in @@ -0,0 +1,56 @@ +#======================================================================= +# Begin specific part to omniorb +# (include from file adm_local/unix/make_omniorb generated by +# adm_local/unix/make_omniorb.in) +#======================================================================= + +# Client and server object are the same with omniorb +# There are one header file and one source file generate + +#IDLOBJ=$(IDLSRC:%.idl=%$(IDL_CLN_OBJ)) + +# dependancies between idl and it's generated files +%$(OMNIORB_IDL_CLN_CXX) %$(OMNIORB_IDL_CLN_H): ${KERNEL_ROOT_DIR}/idl/salome/%.idl + $(OMNIORB_IDL) $(IDLCXXFLAGS) $(OMNIORB_IDLCXXFLAGS) $< + +%$(OMNIORB_IDL_CLN_CXX) %$(OMNIORB_IDL_CLN_H): ${MED_ROOT_DIR}/idl/salome/%.idl + $(OMNIORB_IDL) $(IDLCXXFLAGS) $(OMNIORB_IDLCXXFLAGS) $< + +%$(OMNIORB_IDL_CLN_CXX) %$(OMNIORB_IDL_CLN_H): ${VISU_ROOT_DIR}/idl/salome/%.idl + $(OMNIORB_IDL) $(IDLCXXFLAGS) $(OMNIORB_IDLCXXFLAGS) $< + +%$(OMNIORB_IDL_CLN_CXX) %$(OMNIORB_IDL_CLN_H): ${RANDOMIZER_ROOT_DIR}/idl/salome/%.idl + $(OMNIORB_IDL) $(IDLCXXFLAGS) $(OMNIORB_IDLCXXFLAGS) $< + +%$(OMNIORB_IDL_CLN_CXX) %$(OMNIORB_IDL_CLN_H): ${top_srcdir}/idl/%.idl + $(OMNIORB_IDL) $(IDLCXXFLAGS) $(OMNIORB_IDLCXXFLAGS) $< + +# dependncies between idl files +depend_idl: .depidl + +# we use cpp to generate dependencies between idl files. +# we change cpp output to keep only idl file and transform it to get a suitable rule +.depidl: $(IDL_FILES) + @touch $@ + @for dep in $? dummy; do \ + if [ $$dep != "dummy" ]; then \ + echo Building dependencies for $$dep; \ + basedep=`basename $$dep .idl`; \ + header="$$basedep"$(IDL_CLN_H); \ + sed '\%^'"$$header"':%,\%[^\\]$$%d' <$@ >$@- && mv $@- $@; \ + $(CPP) $(C_DEPEND_FLAG) -I$(srcdir) $$dep 2>/dev/null | \ + sed `echo "s%$$basedep\\.idl%$$header:%g"` | \ + sed 's% $(srcdir)/% %g' | \ + sed 's% $(top_srcdir)/% %g' | \ + sed 's% $(top_builddir)/% %g' | \ + sed 's%^.*:\.o: *%%' | sed 's%^ *\\ *%%'| sed 's%^ *\(.*\):%\1:%' | \ + sed 's/\.idl/$(IDL_CLN_H)/' >>$@; \ + echo '' >>$@; \ + fi; \ + done ; + +-include .depidl + +#======================================================================= +# End specific part to omniorb +#======================================================================= diff --git a/bin/VERSION b/bin/VERSION new file mode 100755 index 0000000..32ae3cd --- /dev/null +++ b/bin/VERSION @@ -0,0 +1 @@ +THIS IS SIERPINSKY COMPONENT - VERSION: 0.1 diff --git a/build_configure b/build_configure new file mode 100755 index 0000000..21340d7 --- /dev/null +++ b/build_configure @@ -0,0 +1,225 @@ +#!/bin/bash + +# +# Tool for updating list of .in file for the SALOME project +# and regenerating configure script +# +# File : build_configure +# Author : Marc Tajchman - CEA +# Created : 10/10/2002 +# + +ORIG_DIR=`pwd` +CONF_DIR=`echo $0 | sed -e "s,[^/]*$,,;s,/$,,;s,^$,.,"` + +######################################################################## +# Test if the KERNEL_ROOT_DIR is set correctly + +if test ! -d "${KERNEL_ROOT_DIR}"; then + echo "failed : KERNEL_ROOT_DIR variable is not correct !" + exit +fi + +# Test if the KERNEL_SRC is set correctly + +#if test ! -d "${KERNEL_SRC}"; then +# echo "failed : KERNEL_SRC variable is not correct !" +# exit +#fi +######################################################################## +# find_in - utility function +# +# usage : +# find_in directory filename +# +# Finds files following the *.in pattern, recursively in the +# directory (first argument). +# Results are appended into the file (second argument) +# +# Difference from the standard unix find is that files are tested +# before directories +# + +find_in() +{ + local i + local f=$2 + +# if the first argument is not a directory, returns + + if [ ! -d "$1" ] ; then + return + fi + +# dont look in the CVS directories + + case $1 in + */CVS) return ;; + *) ;; + esac + +# for each regular file contained in the directory +# test if it's a .in file + + for i in "$1"/* + do + if [ -f "$i" ] ; then + case $i in + *.in) echo " "$i" \\" >> $f;; + *) ;; + esac + fi + done + +# for each subdirectory of the first argument, proceeds recursively + + for i in "$1"/* + do + if [ -d "$i" ] ; then + find_in "$i" "$f" + fi + done +} + + +####################################################################### +# Generate list of .in files (Makefile.in, config.h.in, etc) +# appending it in file configure.in + +cd ${CONF_DIR} +ABS_CONF_DIR=`pwd` + +# +# Common part of the configure.in file +# +chmod u+w configure.in.base +if ! \cp -f configure.in.base configure.in_tmp1 +then + echo + echo "error : can't create files in" ${CONF_DIR} + echo "aborting ..." + chmod u-w configure.in.base + exit +fi +chmod u-w configure.in.base + +if [ -e "${CONF_DIR}/salome_adm" ] ; then + \rm -f ${CONF_DIR}/salome_adm +fi + +# make a link allowing AC_OUTPUT to find the salome_adm/.../*.in files +echo "" >> configure.in_tmp1 +echo 'ln -fs ${KERNEL_ROOT_DIR}/salome_adm ${ROOT_SRCDIR}/salome_adm' >> configure.in_tmp1 + +echo "" >> configure.in_tmp1 +echo "AC_OUTPUT([ \\" >> configure.in_tmp1 + +# +# List of .in files in the adm/unix directory +# These files MUST be on top of AC_OUTPUT list so we +# put them "manually" +# +# Attention, l'ordre d'entrée des fichiers doit être choisi avec +# précision +# +echo " ./salome_adm/unix/SALOMEconfig.h \\" >> configure.in_tmp1 +echo " ./salome_adm/unix/F77config.h \\" >> configure.in_tmp1 +echo " ./salome_adm/unix/sstream \\" >> configure.in_tmp1 + +echo " ./salome_adm/unix/depend \\" >> configure.in_tmp1 +echo " ./adm_local/unix/make_omniorb \\" >> configure.in_tmp1 +echo " ./salome_adm/unix/envScript \\" >> configure.in_tmp1 +echo " ./salome_adm/unix/make_module \\" >> configure.in_tmp1 + +# _CS_gbo Pour assurer ls construction correct de la chaîne de +# dépendance, il apparaît nécessaire de surcharger le make_conclude +# (resp. make_commence) pardéfaut, c'est à dire le make_conclude de +# salome_adm, par le make_conclude (resp. make_commence) du module, +# c'est à dire le make_conclude (resp. make_commence) du répertoire +# adm_local +echo " ./adm_local/unix/make_commence \\" >> configure.in_tmp1 +echo " ./salome_adm/unix/make_conclude \\" >> configure.in_tmp1 + +\rm -f configure.in_tmp2 configure.in_tmp3 +touch configure.in_tmp2 + +find_in . configure.in_tmp2 + +# _CS_gbo_100204 Mise à jour du filtre pour prise en compte des +# restrictions imposées par les versions récente de autoconf. + sed -e '/^ \.\/salome_adm/d' \ + -e '/configure.in/d' \ + -e '/^ \.\/adm_local/d' \ + -e 's/.in / /' configure.in_tmp2 >> configure.in_tmp1 + +echo "])" >> configure.in_tmp1 + +# delete the link created for AC_OUTPUT +echo "" >> configure.in_tmp1 +#echo 'rm -f ${ROOT_SRCDIR}/salome_adm' >> configure.in_tmp1 +\mv configure.in_tmp1 configure.in_new +\rm -f configure.in_tmp2 configure.in_tmp3 + + +######################################################################## +# Create new (or replace old) configure.in file +# Print a message if the file is write protected +# + +echo +if test ! -f configure.in +then + echo -n "Creating new file 'configure.in' ... " + if \mv configure.in_new configure.in >& /dev/null + then + echo "done" + else + echo "error, check your file permissions" + fi +else + echo -n "Updating 'configure.in' file ... " + if ! \cp configure.in configure.in_old >& /dev/null + then + echo + echo + echo "Can't backup previous configure.in" + echo -n "Continue (you will not be able to revert) - (Y/N) ? " + read R + case "x$R" in + xn*) exit;; + xN*) exit;; + esac + echo + echo -n " " + fi + if \cp configure.in_new configure.in >& /dev/null + then + echo "done" + else + echo + echo "error, can't update previous configure.in" + fi +fi + +######################################################################## +# Use autoconf to rebuild the configure script +# + +if test -f configure +then + echo -n "Updating 'configure' script ... " +else + echo -n "Creating 'configure' script ... " +fi + +aclocal --acdir=adm_local/unix/config_files -I ${KERNEL_ROOT_DIR}/salome_adm/unix/config_files +if autoconf +then + echo "done" +else + echo "failed (check file permissions and/or user quotas ...)" +fi + +cd ${ORIG_DIR} + +echo diff --git a/configure.in.base b/configure.in.base new file mode 100644 index 0000000..553ac6f --- /dev/null +++ b/configure.in.base @@ -0,0 +1,399 @@ +# +# PLEASE DO NOT MODIFY configure.in FILE +# +# ALL CHANGES WILL BE DISCARDED BY THE NEXT +# build_configure COMMAND +# +# CHANGES MUST BE MADE IN configure.in.base FILE +# +# +# Author : Marc Tajchman (CEA) +# Created : 28/06/2001 +# Modified by : Patrick GOLDBRONN (CEA) +# Modified by : Marc Tajchman (CEA) +# +# Created from configure.in.base +# + +AC_INIT(src) +AC_CONFIG_AUX_DIR(${KERNEL_ROOT_DIR}/salome_adm/unix/config_files) +AC_CANONICAL_HOST + +PACKAGE=salome +AC_SUBST(PACKAGE) + +VERSION=0.0.1 +AC_SUBST(VERSION) + +dnl +dnl Initialize source and build root directories +dnl + +ROOT_BUILDDIR=`pwd` +ROOT_SRCDIR=`echo $0 | sed -e "s,[[^/]]*$,,;s,/$,,;s,^$,.,"` +cd $ROOT_SRCDIR +ROOT_SRCDIR=`pwd` +cd $ROOT_BUILDDIR + +AC_SUBST(ROOT_SRCDIR) +AC_SUBST(ROOT_BUILDDIR) + +echo +echo Source root directory : $ROOT_SRCDIR +echo Build root directory : $ROOT_BUILDDIR +echo +echo + +if test -z "$AR"; then + AC_CHECK_PROGS(AR,ar xar,:,$PATH) +fi +AC_SUBST(AR) + +dnl Export the AR macro so that it will be placed in the libtool file +dnl correctly. +export AR + +echo +echo --------------------------------------------- +echo testing make +echo --------------------------------------------- +echo + +AC_PROG_MAKE_SET +AC_PROG_INSTALL +dnl +dnl libtool macro check for CC, LD, NM, LN_S, RANLIB, STRIP + pour les librairies dynamiques ! + +AC_ENABLE_DEBUG(yes) +AC_DISABLE_PRODUCTION + +echo --------------------------------------------- +echo testing libtool +echo --------------------------------------------- + +dnl first, we set static to no! +dnl if we want it, use --enable-static +AC_ENABLE_STATIC(no) + +AC_LIBTOOL_DLOPEN +AC_PROG_LIBTOOL + +dnl Fix up the INSTALL macro if it s a relative path. We want the +dnl full-path to the binary instead. +case "$INSTALL" in + *install-sh*) + INSTALL='\${KERNEL_ROOT_DIR}'/salome_adm/unix/config_files/install-sh + ;; +esac + +echo +echo --------------------------------------------- +echo testing C/C++ +echo --------------------------------------------- +echo + +cc_ok=no +dnl inutil car libtool +dnl AC_PROG_CC +AC_PROG_CXX +AC_DEPEND_FLAG +# AC_CC_WARNINGS([ansi]) +cc_ok=yes + +dnl Library libdl : +AC_CHECK_LIB(dl,dlopen) + +dnl add library libm : +AC_CHECK_LIB(m,ceil) + +dnl +dnl Well we use sstream which is not in gcc pre-2.95.3 +dnl We must test if it exists. If not, add it in include ! +dnl + +AC_CXX_HAVE_SSTREAM + +echo +echo --------------------------------------------- +echo BOOST Library +echo --------------------------------------------- +echo + +CHECK_BOOST + +dnl +dnl --------------------------------------------- +dnl testing MPICH +dnl --------------------------------------------- +dnl + +CHECK_MPICH + +echo +echo --------------------------------------------- +echo testing LEX \& YACC +echo --------------------------------------------- +echo + +lex_yacc_ok=no +AC_PROG_YACC +AC_PROG_LEX +lex_yacc_ok=yes + +echo +echo --------------------------------------------- +echo testing python +echo --------------------------------------------- +echo + +CHECK_PYTHON + +dnl echo +dnl echo --------------------------------------------- +dnl echo testing java +dnl echo --------------------------------------------- +dnl echo + +dnl CHECK_JAVA + +echo +echo --------------------------------------------- +echo testing swig +echo --------------------------------------------- +echo + +CHECK_SWIG + +echo +echo --------------------------------------------- +echo testing threads +echo --------------------------------------------- +echo + +ENABLE_PTHREADS + +echo +echo --------------------------------------------- +echo testing omniORB +echo --------------------------------------------- +echo + +CHECK_OMNIORB + +dnl echo +dnl echo --------------------------------------------- +dnl echo testing mico +dnl echo --------------------------------------------- +dnl echo + +dnl CHECK_MICO + +echo +echo --------------------------------------------- +echo default ORB : omniORB +echo --------------------------------------------- +echo + +DEFAULT_ORB=omniORB +CHECK_CORBA + +AC_SUBST_FILE(CORBA) +corba=make_$ORB +CORBA=adm_local/unix/$corba + +echo +echo --------------------------------------------- +echo testing openGL +echo --------------------------------------------- +echo + +CHECK_OPENGL + +echo +echo --------------------------------------------- +echo testing QT +echo --------------------------------------------- +echo + +CHECK_QT + +echo +echo --------------------------------------------- +echo testing VTK +echo --------------------------------------------- +echo + +CHECK_VTK + +echo +echo --------------------------------------------- +echo testing HDF5 +echo --------------------------------------------- +echo + +CHECK_HDF5 + +echo +echo --------------------------------------------- +echo testing MED2 +echo --------------------------------------------- +echo + +CHECK_MED2 + +echo +echo --------------------------------------------- +echo Testing OpenCascade +echo --------------------------------------------- +echo + +CHECK_CAS + +echo +echo --------------------------------------------- +echo Testing html generators +echo --------------------------------------------- +echo + +CHECK_HTML_GENERATORS + +echo +echo --------------------------------------------- +echo Testing Kernel +echo --------------------------------------------- +echo + +CHECK_KERNEL + +echo +echo --------------------------------------------- +echo Testing Med +echo --------------------------------------------- +echo + +CHECK_MED + +echo +echo --------------------------------------------- +echo Testing Visu +echo --------------------------------------------- +echo + +CHECK_VISU + +echo +echo --------------------------------------------- +echo Testing Randomizer +echo --------------------------------------------- +echo + +CHECK_RANDOMIZER + +echo +echo --------------------------------------------- +echo Summary +echo --------------------------------------------- +echo + +echo Configure +variables="cc_ok boost_ok lex_yacc_ok python_ok swig_ok threads_ok OpenGL_ok qt_ok vtk_ok hdf5_ok med2_ok omniORB_ok occ_ok doxygen_ok graphviz_ok Kernel_ok Med_ok Visu_ok Randomizer_ok" + +for var in $variables +do + printf " %10s : " `echo \$var | sed -e "s,_ok,,"` + eval echo \$$var +done + +echo +echo "Default ORB : $DEFAULT_ORB" +echo + +dnl generals files which could be included in every makefile + +AC_SUBST_FILE(COMMENCE) COMMENCE=adm_local/unix/make_commence +AC_SUBST_FILE(CONCLUDE) CONCLUDE=salome_adm/unix/make_conclude +AC_SUBST_FILE(MODULE) MODULE=salome_adm/unix/make_module + +dnl les dependences +AC_SUBST_FILE(DEPEND) DEPEND=salome_adm/unix/depend + +dnl We don t need to say when we re entering directories if we re using +dnl GNU make becuase make does it for us. +if test "X$GMAKE" = "Xyes"; then + AC_SUBST(SETX) SETX=":" +else + AC_SUBST(SETX) SETX="set -x" +fi + +# make other build directories +for rep in salome_adm adm_local doc bin/salome include/salome lib/salome share/salome/resources share/salome/doc idl +do +# if test ! -d $rep ; then +# eval mkdir $rep +# fi + $INSTALL -d $rep +done + +echo +echo --------------------------------------------- +echo copying resource files, shell scripts, and +echo xml files +echo --------------------------------------------- +echo + + +dnl copy resources directories + +#for i in `find $ROOT_SRCDIR -name 'resources' -print` +#do +# local_res=`echo $i | sed -e "s,$ROOT_SRCDIR,.,"` +# local_res_dir=`echo $local_res | sed -e "s,[[^/]]*$,,;s,/$,,;s,^$,.,"` +# mkdir -p $local_res_dir +# cd $local_res_dir +# ln -fs $i +# echo $local_res +# cd $ROOT_BUILDDIR +#done + +dnl copy shells and utilities contained in the bin directory +dnl excluding .in files (treated in AC-OUTPUT below) and CVS +dnl directory + +mkdir -p bin/salome +cd bin/salome +for i in $ROOT_SRCDIR/bin/* +do + local_bin=`echo $i | sed -e "s,$ROOT_SRCDIR,.,"` + case "$local_bin" in + *.in | *~) ;; + ./bin/CVS | ./bin/salome) ;; + *) /usr/bin/install -c $i .; echo $local_bin ;; + esac +done +cd $ROOT_BUILDDIR + +AC_SUBST_FILE(ENVSCRIPT) ENVSCRIPT=salome_adm/unix/envScript + +dnl copy xml files to the build tree (lib directory) +dnl pourquoi ???? + +#cd lib +#for i in `find $ROOT_SRCDIR -name "*.xml" -print` +#do +# ln -fs $i +# echo `echo $i | sed -e "s,$ROOT_SRCDIR,.,"` +#done +#cd $ROOT_BUILDDIR + + +echo +echo --------------------------------------------- +echo generating Makefiles and configure files +echo --------------------------------------------- +echo + +AC_OUTPUT_COMMANDS([ \ + chmod +x ./bin/* \ +]) + +## do not delete this line diff --git a/idl/Makefile.in b/idl/Makefile.in new file mode 100644 index 0000000..cb7e402 --- /dev/null +++ b/idl/Makefile.in @@ -0,0 +1,70 @@ +############################################################### +# File : Makefile.in +# Author : Vadim SANDLER (OCN) +# Created : 13/07/05 +# Copyright (C) 2005 Open CASCADE +############################################################### + +# source path +top_srcdir=@top_srcdir@ +top_builddir=.. +srcdir=@srcdir@ +VPATH=.:${KERNEL_ROOT_DIR}/idl/salome + +@COMMENCE@ + +IDL_FILES = Sierpinsky.idl + +PY_CLIENT_IDL = $(IDL_FILES) + +# we copy all idl file in $(top_builddir)/idl +inc: $(top_builddir)/idl/salome $(IDL_FILES:%=$(top_builddir)/idl/salome/%) + +$(top_builddir)/idl/salome: + mkdir $@ + +$(IDL_FILES:%=$(top_builddir)/idl/salome/%):$(IDL_FILES:%=$(top_srcdir)/idl/%) +# $(CP) $< $@ + cp -f $^ $(top_builddir)/idl/salome + + +lib: pyidl + +PYTHON_BUILD_SITE=$(top_builddir)/lib/python$(PYTHON_VERSION)/site-packages/@PACKAGE@ + +pyidl: $(PYTHON_BUILD_SITE) $(IDL_FILES:%.idl=$(PYTHON_BUILD_SITE)/%_idl.py) + +$(PYTHON_BUILD_SITE): + $(INSTALL) -d $@ + +$(PYTHON_BUILD_SITE)/%_idl.py: $(top_builddir)/idl/salome/%.idl + $(OMNIORB_IDL) $(OMNIORB_IDLPYFLAGS) -C$(PYTHON_BUILD_SITE) $< + + +# install python client (generated from idl file +install: install-pyidl install-idl + +# create directory $(idldir) and copy idl files into it +install-idl: $(IDL_FILES:%=$(top_builddir)/idl/salome/%) + $(INSTALL) -d $(idldir) + $(INSTALL_DATA) $^ $(idldir) + + +install-pyidl: $(IDL_FILES:%=$(top_builddir)/idl/salome/%) + $(INSTALL) -d $(PYTHON_SITE_INSTALL) + @for file in $^ dummy; do \ + if [ $$file != "dummy" ]; then \ + $(OMNIORB_IDL) $(OMNIORB_IDLPYFLAGS) -C$(PYTHON_SITE_INSTALL) $$file ; \ + fi ; \ + done ; + +#@ CONCLUDE @ + +cleandep: + -$(RM) .dep* + +distclean: + -$(RM) *.py + -$(RM) $(IDL_FILES:%=$(top_builddir)/idl/salome/%) + -$(RM) Makefile + diff --git a/idl/Sierpinsky.idl b/idl/Sierpinsky.idl new file mode 100644 index 0000000..a9816f2 --- /dev/null +++ b/idl/Sierpinsky.idl @@ -0,0 +1,36 @@ +/////////////////////////////////////////////////////////// +// File : Sierpinsky.idl +// Author : Vadim SANDLER (OCN) +// Created : 13/07/05 +// Copyright (C) 2005 Open CASCADE +/////////////////////////////////////////////////////////// + +#ifndef __SIERPINSKY_IDL +#define __SIERPINSKY_IDL + +#include "SALOME_Component.idl" + +module SIERPINSKY_ORB { + + interface SIERPINSKY : Engines::Component { + + // Initializes engine with three reference points + void Init( in double X1, in double Y1, in double X2, in double Y2, in double X3, in double Y3 ); + + // Initializes engine with three default reference points: (0.5, 1), (0, 0), (1, 0) + void Reset(); + + // Generates next iteration point + void NextPoint( in double X, in double Y, in long iter, out double nextX, out double nextY ); + + // Exports data to the JPEG image + boolean ExportToJPEG( in string fileName, in long size ); + + // Exports data to the MED file + boolean ExportToMED( in string fileName, in double size ); + + }; + +}; + +#endif // __SIERPINSKY_IDL diff --git a/resources/SIERPINSKY.png b/resources/SIERPINSKY.png new file mode 100755 index 0000000000000000000000000000000000000000..a830145ce4821332cf68836d1f27e6fa140bde50 GIT binary patch literal 447 zcmV;w0YLtVP)8-iS>Bu1WgI5wd&wrb3A+KJBuQ{I z?Le>3fZXB&v)r`B@#mfB{ebLsMHoF2i~{5AGawaGfdy;XX8W*WUceq?8t0AZ6hO_n4!d#%fOR}U+0gb9 z3OIy_$ekEj07qq?Q6$IL#9kEw5>sy$)R-7#_vG^cYR(O`yS*W5OboVr(h}01jMDW0 zyC<9n<{Q=C^;XBUb~n~fCDDGEm99tGC1ewG#=zH*5@QBqyNe;h@t@acW9C%7``L6wCaeR@MHi0002ovPDHLkV1g8_y@LP% literal 0 HcmV?d00001 diff --git a/resources/SIERPINSKYCatalog.xml b/resources/SIERPINSKYCatalog.xml new file mode 100644 index 0000000..a2df5a4 --- /dev/null +++ b/resources/SIERPINSKYCatalog.xml @@ -0,0 +1,166 @@ + + + + + + + SIERPINSKY + Sierpinsky + OTHER + Vadim SANDLER (VSR) + 0.1 + unknown + 0 + SIERPINSKY.png + + + SIERPINSKY + unknown + + + Init + VSR + 0.1 + unknown + 0 + + + X1 + double + unknown + + + Y1 + double + unknown + + + X2 + double + unknown + + + Y2 + double + unknown + + + X3 + double + unknown + + + Y3 + double + unknown + + + + + + + Reset + VSR + 0.1 + unknown + 0 + + + + + + NextPoint + VSR + 0.1 + unknown + 0 + + + X + double + unknown + + + Y + double + unknown + + + iter + long + unknown + + + + + nextX + double + unknown + + + nextY + double + unknown + + + + + + ExportToJPEG + VSR + 0.1 + unknown + 0 + + + fileName + string + unknown + + + size + long + unknown + + + + + return + boolean + unknown + + + + + + ExportToMED + VSR + 0.1 + unknown + 0 + + + fileName + string + unknown + + + size + double + unknown + + + + + return + boolean + unknown + + + + + + + + + diff --git a/resources/SIERPINSKY_en.xml b/resources/SIERPINSKY_en.xml new file mode 100644 index 0000000..fc20528 --- /dev/null +++ b/resources/SIERPINSKY_en.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff --git a/resources/go.png b/resources/go.png new file mode 100644 index 0000000000000000000000000000000000000000..0684dcaa3be9164ad7b5d48eaf9e19454e1bcbe1 GIT binary patch literal 305 zcmeAS@N?(olHy`uVBq!ia0vp^A|TAc1|)ksWqE-VTavfC3&Vd9T(EcfWS|IVfk$L9 z0|U1Z2s2)~TlWVj$X?><>&kwWosXA=W8e0mDxlClPZ!6KiaB?$Y!qxV5IOd-eou_r z#>E#+SFE|wAUWfp + + + + +? + ? + aNewDataFlow_1_3 + 1 + ? + +aNewDataFlow_1_3 + + +long + Loop__nbIter + +long + Loop__iter + +string + ExportToJPEG__fileName + +long + ExportToJPEG__size + + +double + EndLoop__x + +double + EndLoop__y + +long + EndLoop__nbIter + +long + EndLoop__iter + +boolean + ExportToJPEG__return + + + 13/7/2005 - 13:45:3 + 14/7/2005 - 17:9:25 + 2.0 + ? + ? + ? + 0 + 0 + + +RANDOMIZER + RANDOMIZER + InitPoint + 0 + ? + +InitPoint + + + +double + theX + +double + theY + + + 14/7/2005 - 17:9:25 + 14/7/2005 - 17:9:25 + 2.0 + ? + FactoryServerPy + InitPoint from RANDOMIZER + 20 + 7 + +RANDOMIZER + RANDOMIZER + NextIteration + 0 + ? + +NextIteration + + + +long + return + + + 14/7/2005 - 17:9:25 + 14/7/2005 - 17:9:25 + 2.0 + ? + FactoryServerPy + NextIteration from RANDOMIZER + 433 + 115 + +SIERPINSKY + SIERPINSKY + NextPoint + 0 + ? + +NextPoint + + +double + X + +double + Y + +long + iter + + +double + nextX + +double + nextY + + + 14/7/2005 - 17:9:25 + 14/7/2005 - 17:9:25 + 2.0 + ? + localhost/FactoryServer + NextPoint from SIERPINSKY + 638 + 7 + +? + ? + Loop + 4 + EndLoop + +Loop + + +double + x + +double + y + +long + nbIter + +long + iter + + +double + x + +double + y + +long + nbIter + +long + iter + + + +InitLoop + + + + + +MoreLoop + + + + + + +NextLoop + + + + + 14/7/2005 - 17:9:25 + 14/7/2005 - 17:9:25 + 2.0 + ? + ? + Compute Node + 229 + 47 + +? + ? + EndLoop + 5 + Loop + +EndLoop + + +double + x + +double + y + +long + nbIter + +long + iter + + +double + x + +double + y + +long + nbIter + +long + iter + + + +EndLoop + + 14/7/2005 - 17:9:25 + 14/7/2005 - 17:9:25 + 2.0 + ? + ? + Compute Node + 833 + 47 + +SIERPINSKY + SIERPINSKY + ExportToJPEG + 0 + ? + +ExportToJPEG + + +string + fileName + +long + size + + +boolean + return + + + 14/7/2005 - 17:9:25 + 14/7/2005 - 17:9:25 + 2.0 + ? + localhost/FactoryServer + ExportToJPEG from SIERPINSKY + 1032 + 47 + +SIERPINSKY + SIERPINSKY + Reset + 0 + ? + +Reset + + + + + 14/7/2005 - 17:9:25 + 14/7/2005 - 17:9:25 + 2.0 + ? + localhost/FactoryServer + Reset from SIERPINSKY + 19 + 152 + + +InitPoint + theX + Loop + x + + +InitPoint + theY + Loop + y + + +NextIteration + return + NextPoint + iter + + +616 + 118 + +616 + 186 + +NextPoint + nextX + EndLoop + x + + +NextPoint + nextY + EndLoop + y + + +Loop + DoLoop + EndLoop + DoLoop + + +Loop + x + NextPoint + X + + +Loop + y + NextPoint + Y + + +Loop + nbIter + EndLoop + nbIter + + +Loop + iter + EndLoop + iter + + +Loop + Gate + NextIteration + Gate + + +409 + 210 + +409 + 162 + +EndLoop + DoLoop + Loop + DoLoop + + +EndLoop + Gate + ExportToJPEG + Gate + + +Reset + Gate + Loop + Gate + + +205 + 162 + +205 + 227 + + +aNewDataFlow_1_3 + Loop__nbIter + Loop + nbIter + +3 + 500 + + +aNewDataFlow_1_3 + Loop__iter + Loop + iter + +3 + 0 + + +aNewDataFlow_1_3 + ExportToJPEG__fileName + ExportToJPEG + fileName + +18 + + + +aNewDataFlow_1_3 + ExportToJPEG__size + ExportToJPEG + size + +3 + 200 + diff --git a/resources/graph2.xml b/resources/graph2.xml new file mode 100644 index 0000000..47dc13b --- /dev/null +++ b/resources/graph2.xml @@ -0,0 +1,892 @@ + + + + + +? + ? + aNewDataFlow_1 + 1 + ? + +aNewDataFlow_1 + + +long + Loop__nbIter + +long + Loop__iter + +double + ExportToMED__size + +string + getFileNames__medFile + +string + getFileNames__jpegFile + +long + ExportToJPEG__size + + +double + EndLoop__x + +double + EndLoop__y + +long + EndLoop__nbIter + +long + EndLoop__iter + +long + CheckMedFile__ko + +boolean + ExportToJPEG__return + + + 13/7/2005 - 13:45:3 + 14/7/2005 - 17:53:15 + 2.0 + ? + ? + ? + 0 + 0 + + +RANDOMIZER + RANDOMIZER + InitPoint + 0 + ? + +InitPoint + + + +double + theX + +double + theY + + + 14/7/2005 - 17:28:25 + 14/7/2005 - 17:28:25 + 2.0 + ? + FactoryServerPy + InitPoint from RANDOMIZER + 20 + 7 + +RANDOMIZER + RANDOMIZER + NextIteration + 0 + ? + +NextIteration + + + +long + return + + + 14/7/2005 - 17:28:25 + 14/7/2005 - 17:28:25 + 2.0 + ? + FactoryServerPy + NextIteration from RANDOMIZER + 633 + 207 + +SIERPINSKY + SIERPINSKY + NextPoint + 0 + ? + +NextPoint + + +double + X + +double + Y + +long + iter + + +double + nextX + +double + nextY + + + 14/7/2005 - 17:28:25 + 14/7/2005 - 17:28:25 + 2.0 + ? + localhost/FactoryServer + NextPoint from SIERPINSKY + 825 + 7 + +? + ? + Loop + 4 + EndLoop + +Loop + + +double + x + +double + y + +long + nbIter + +long + iter + + +double + x + +double + y + +long + nbIter + +long + iter + + + +InitLoop + + + + + +MoreLoop + + + + + + +NextLoop + + + + + 14/7/2005 - 17:28:25 + 14/7/2005 - 17:28:25 + 2.0 + ? + ? + Compute Node + 432 + 47 + +? + ? + EndLoop + 5 + Loop + +EndLoop + + +double + x + +double + y + +long + nbIter + +long + iter + + +double + x + +double + y + +long + nbIter + +long + iter + + + +EndLoop + + 14/7/2005 - 17:28:25 + 14/7/2005 - 17:28:25 + 2.0 + ? + ? + Compute Node + 1015 + 47 + +SIERPINSKY + SIERPINSKY + ExportToMED + 0 + ? + +ExportToMED + + +string + fileName + +double + size + + +boolean + return + + + 14/7/2005 - 17:28:25 + 14/7/2005 - 17:28:25 + 2.0 + ? + localhost/FactoryServer + ExportToMED from SIERPINSKY + 474 + 484 + +? + ? + ImportToVISU + 3 + ? + +ImportToVISU + + +string + fileName + + + + +ImportToVISU + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 14/7/2005 - 17:28:25 + 14/7/2005 - 17:28:25 + 2.0 + ? + ? + Compute Node + 861 + 460 + +? + ? + CheckMedFile + 6 + EndOfCheckMedFile + +ImportToVISU_1 + + +long + ok + + +long + ok + +long + ko + + + +CheckMedFile + + + + 14/7/2005 - 17:28:25 + 14/7/2005 - 17:28:25 + 2.0 + ? + ? + Compute Node + 662 + 524 + +? + ? + EndOfCheckMedFile + 7 + CheckMedFile + +EndImportToVISU + + + + + +EndImportToVISU + + 14/7/2005 - 17:28:25 + 14/7/2005 - 17:28:25 + 2.0 + ? + ? + Compute Node + 1054 + 520 + +SIERPINSKY + SIERPINSKY + Init + 0 + ? + +Init + + +double + X1 + +double + Y1 + +double + X2 + +double + Y2 + +double + X3 + +double + Y3 + + + + 14/7/2005 - 17:28:25 + 14/7/2005 - 17:28:25 + 2.0 + ? + localhost/FactoryServer + Init from SIERPINSKY + 234 + 185 + +RANDOMIZER + RANDOMIZER + InitPoint_1 + 0 + ? + +InitPoint + + + +double + theX + +double + theY + + + 14/7/2005 - 17:28:25 + 14/7/2005 - 17:28:25 + 2.0 + ? + FactoryServerPy + InitPoint from RANDOMIZER + 20 + 185 + +RANDOMIZER + RANDOMIZER + InitPoint_2 + 0 + ? + +InitPoint + + + +double + theX + +double + theY + + + 14/7/2005 - 17:28:25 + 14/7/2005 - 17:28:25 + 2.0 + ? + FactoryServerPy + InitPoint from RANDOMIZER + 20 + 317 + +RANDOMIZER + RANDOMIZER + InitPoint_3 + 0 + ? + +InitPoint + + + +double + theX + +double + theY + + + 14/7/2005 - 17:28:25 + 14/7/2005 - 17:28:25 + 2.0 + ? + FactoryServerPy + InitPoint from RANDOMIZER + 20 + 448 + +? + ? + getFileNames + 3 + ? + +getFileNames + + +string + medFile + +string + jpegFile + + +string + medFile + +string + jpegFile + + + +getMedFileName + + + + 14/7/2005 - 17:28:25 + 14/7/2005 - 17:28:25 + 2.0 + ? + ? + Compute Node + 21 + 594 + +SIERPINSKY + SIERPINSKY + ExportToJPEG + 0 + ? + +ExportToJPEG + + +string + fileName + +long + size + + +boolean + return + + + 14/7/2005 - 17:28:25 + 14/7/2005 - 17:28:25 + 2.0 + ? + localhost/FactoryServer + ExportToJPEG from SIERPINSKY + 474 + 658 + + +InitPoint + theX + Loop + x + + +InitPoint + theY + Loop + y + + +NextIteration + return + NextPoint + iter + + +807 + 118 + +807 + 278 + +NextPoint + nextX + EndLoop + x + + +NextPoint + nextY + EndLoop + y + + +Loop + DoLoop + EndLoop + DoLoop + + +Loop + x + NextPoint + X + + +Loop + y + NextPoint + Y + + +Loop + nbIter + EndLoop + nbIter + + +Loop + iter + EndLoop + iter + + +Loop + Gate + NextIteration + Gate + + +615 + 302 + +615 + 162 + +EndLoop + DoLoop + Loop + DoLoop + + +EndLoop + Gate + ExportToMED + Gate + + +457 + 599 + +457 + 377 + +1195 + 377 + +1195 + 162 + +EndLoop + Gate + ExportToJPEG + Gate + + +457 + 773 + +457 + 377 + +1195 + 377 + +1195 + 162 + +ExportToMED + return + CheckMedFile + ok + + +ImportToVISU + Gate + EndOfCheckMedFile + Default + + +CheckMedFile + ok + ImportToVISU + Gate + + +Init + Gate + Loop + Gate + + +412 + 162 + +412 + 380 + +InitPoint_1 + theX + Init + X1 + + +InitPoint_1 + theY + Init + Y1 + + +InitPoint_2 + theX + Init + X2 + + +198 + 296 + +198 + 388 + +InitPoint_2 + theY + Init + Y2 + + +204 + 316 + +204 + 408 + +InitPoint_3 + theX + Init + X3 + + +210 + 336 + +210 + 519 + +InitPoint_3 + theY + Init + Y3 + + +216 + 356 + +216 + 539 + +getFileNames + medFile + ExportToMED + fileName + + +355 + 555 + +355 + 665 + +getFileNames + medFile + ImportToVISU + fileName + + +842 + 531 + +842 + 430 + +355 + 430 + +355 + 665 + +getFileNames + jpegFile + ExportToJPEG + fileName + + +356 + 729 + +356 + 685 + + +aNewDataFlow_1 + Loop__nbIter + Loop + nbIter + +3 + 500 + + +aNewDataFlow_1 + Loop__iter + Loop + iter + +3 + 0 + + +aNewDataFlow_1 + ExportToMED__size + ExportToMED + size + +7 + 100 + + +aNewDataFlow_1 + getFileNames__medFile + getFileNames + medFile + +18 + + + +aNewDataFlow_1 + getFileNames__jpegFile + getFileNames + jpegFile + +18 + + + +aNewDataFlow_1 + ExportToJPEG__size + ExportToJPEG + size + +3 + 100 + diff --git a/src/Makefile.in b/src/Makefile.in new file mode 100755 index 0000000..34badc0 --- /dev/null +++ b/src/Makefile.in @@ -0,0 +1,18 @@ +############################################################### +# File : Makefile.in +# Author : Vadim SANDLER (OCN) +# Created : 13/07/05 +# Copyright (C) 2005 Open CASCADE +############################################################### + +top_srcdir=@top_srcdir@ +top_builddir=.. +srcdir=@srcdir@ +VPATH=.:@srcdir@ + + +@COMMENCE@ + +SUBDIRS = Sierpinsky SierpinskyGUI + +@MODULE@ diff --git a/src/Sierpinsky/Makefile.in b/src/Sierpinsky/Makefile.in new file mode 100644 index 0000000..cafbee7 --- /dev/null +++ b/src/Sierpinsky/Makefile.in @@ -0,0 +1,31 @@ +############################################################### +# File : Makefile.in +# Author : Vadim SANDLER (OCN) +# Created : 13/07/05 +# Copyright (C) 2005 Open CASCADE +############################################################### + +# source path +top_srcdir=@top_srcdir@ +top_builddir=../.. +srcdir=@srcdir@ +VPATH=.:@srcdir@:@top_srcdir@/idl:$(top_builddir)/idl:${KERNEL_ROOT_DIR}/idl/salome + +@COMMENCE@ + +EXPORT_HEADERS = SIERPINSKY_Gen_i.hxx + +# Libraries targets +LIB = libSIERPINSKYEngine.la + +LIB_SRC = SIERPINSKY_Gen_i.cxx + +LIB_SERVER_IDL = Sierpinsky.idl +LIB_CLIENT_IDL = SALOME_Component.idl SALOME_Exception.idl SALOMEDS.idl + +CPPFLAGS += -I${KERNEL_ROOT_DIR}/include/salome $(BOOST_CPPFLAGS) $(HDF5_INCLUDES) + +LDFLAGS += -L${KERNEL_ROOT_DIR}/lib/salome -lSalomeContainer -lSalomeNS -lOpUtil -lRegistry -lSalomeNotification -lSALOMELocalTrace -lgd -lMEDWrapper +LDFLAGSFORBIN += -L${KERNEL_ROOT_DIR}/lib/salome -lSalomeContainer -lSalomeNS -lOpUtil -lRegistry -lSalomeNotification -lSALOMELocalTrace -lgd -lMEDWrapper + +@CONCLUDE@ diff --git a/src/Sierpinsky/SIERPINSKY_Gen_i.cxx b/src/Sierpinsky/SIERPINSKY_Gen_i.cxx new file mode 100644 index 0000000..6f94aca --- /dev/null +++ b/src/Sierpinsky/SIERPINSKY_Gen_i.cxx @@ -0,0 +1,173 @@ +/////////////////////////////////////////////////////////// +// File : SIERPINSKY_Gen_i.cxx +// Author : Vadim SANDLER (OCN) +// Created : 13/07/05 +// Copyright (C) 2005 Open CASCADE +/////////////////////////////////////////////////////////// + +#include "SIERPINSKY_Gen_i.hxx" +#include +#include + +using namespace MED; + +/*! + * Engine factory + */ +extern "C" +{ + PortableServer::ObjectId * SIERPINSKYEngine_factory( CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa, + PortableServer::ObjectId* contId, + const char* instanceName, + const char* interfaceName ) +{ + SIERPINSKY_Gen_i* anEngine = new SIERPINSKY_Gen_i( orb, poa, contId, instanceName, interfaceName ); + return anEngine->getId() ; + } +} + +/*! + * Default constructor + */ +SIERPINSKY_Gen_i::SIERPINSKY_Gen_i() +{ +} + +/*! + * Constructor + */ +SIERPINSKY_Gen_i::SIERPINSKY_Gen_i( CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa, + PortableServer::ObjectId* contId, + const char* instanceName, + const char* interfaceName ) +: Engines_Component_i( orb, poa, contId, instanceName, interfaceName ) +{ + // activate servant + _thisObj = this; + _id = poa->activate_object(_thisObj); + // set default values + Reset(); +} + +/*! + * Destructor + */ +SIERPINSKY_Gen_i::~SIERPINSKY_Gen_i() +{ + myPoints.clear(); +} + +/*! + * Initializes engine with three reference points + */ +void SIERPINSKY_Gen_i::Init( CORBA::Double theX1, CORBA::Double theY1, + CORBA::Double theX2, CORBA::Double theY2, + CORBA::Double theX3, CORBA::Double theY3 ) +{ + myRefPoints[0] = MyPoint( theX1, theY1 ); + myRefPoints[1] = MyPoint( theX2, theY2 ); + myRefPoints[2] = MyPoint( theX3, theY3 ); + myPoints.clear(); +} + +/*! + * Initializes engine with three default reference points: (0.5, 1), (0, 0), (1, 0) + */ +void SIERPINSKY_Gen_i::Reset() +{ + myRefPoints[0] = MyPoint( 0.5, 1.0 ); + myRefPoints[1] = MyPoint( 0.0, 0.0 ); + myRefPoints[2] = MyPoint( 1.0, 0.0 ); + myPoints.clear(); +} + +/*! + * Generates next iteration point + */ +void SIERPINSKY_Gen_i::NextPoint( CORBA::Double theX, CORBA::Double theY, + CORBA::Long theIter, + CORBA::Double& theNextX, CORBA::Double& theNextY ) +{ + double x = theIter < 1 || theIter > 3 ? theX : ( theX + myRefPoints[ theIter-1 ].myX ) / 2; + double y = theIter < 1 || theIter > 3 ? theY : ( theY + myRefPoints[ theIter-1 ].myY ) / 2; + myPoints.push_back( MyPoint( x, y ) ); + theNextX = x; + theNextY = y; +} + +/*! + * Exports data to the JPEG image + */ +CORBA::Boolean SIERPINSKY_Gen_i::ExportToJPEG( const char* theFileName, CORBA::Long theSize ) +{ + if ( theSize <= 0 ) return false; + + // open file + FILE* fileDescriptor = fopen( theFileName, "wb" ); + if ( !fileDescriptor ) return false; + + // create an image + gdImagePtr image = gdImageCreate( theSize, theSize ); + int white = gdImageColorAllocate( image, 255, 255, 255 ); + int black = gdImageColorAllocate( image, 0, 0, 0 ); + + gdImageRectangle( image, 0, 0, theSize-1, theSize-1, white ); + + // draw points + std::list::const_iterator iter; + for ( iter = myPoints.begin(); iter != myPoints.end(); ++iter ) { + gdImageSetPixel( image, (int)( (*iter).myX * theSize ), theSize - (int)( (*iter).myY * theSize ), black ); + } + + // export jpeg image + gdImageJpeg( image, fileDescriptor, 95 ); + fclose( fileDescriptor ); + gdImageDestroy( image ); + + return true; +} + +/*! + * Exports data to the MED file + */ +CORBA::Boolean SIERPINSKY_Gen_i::ExportToMED( const char* theFileName, CORBA::Double theSize ) +{ + TErr anError; + + // if file already exists - remove it (MED cannot overwrite files correctly) + FILE* aFile = fopen( theFileName, "rb" ); + if ( aFile ) { + fclose( aFile ); + if ( remove( theFileName ) ) return false; // can't remove file + } + + // create MED 2.2 file + PWrapper aMed = CrWrapper( theFileName, MED::eV2_2 ); + + // create 2D mesh + PMeshInfo aMesh = aMed->CrMeshInfo( 2, "Sierpinsky" ); + aMed->SetMeshInfo( aMesh, &anError ); + if ( anError < 0 ) return false; + + // create nodes + TFloatVector nodes; + TIntVector connect; + std::list::const_iterator iter; + int ind = 1; + for ( iter = myPoints.begin(); iter != myPoints.end(); ++iter ) { + nodes.push_back( (*iter).myX * theSize ); + nodes.push_back( (*iter).myY * theSize ); + connect.push_back( ind++ ); + } + PNodeInfo aNodes = aMed->CrNodeInfo( aMesh, MED::eCART, nodes, TStringVector(2), TStringVector(2), TIntVector( myPoints.size() ), TIntVector() ); + aMed->SetNodeInfo( aNodes, &anError ); + if ( anError < 0 ) return false; + + PCellInfo aCells = aMed->CrCellInfo( aMesh, MED::eMAILLE, MED::ePOINT1, eNOD, connect, TIntVector( myPoints.size() ), TIntVector( myPoints.size() ) ); + aMed->SetCellInfo( aCells, &anError ); + if ( anError < 0 ) return false; + + return true; +} diff --git a/src/Sierpinsky/SIERPINSKY_Gen_i.hxx b/src/Sierpinsky/SIERPINSKY_Gen_i.hxx new file mode 100644 index 0000000..5f1df19 --- /dev/null +++ b/src/Sierpinsky/SIERPINSKY_Gen_i.hxx @@ -0,0 +1,65 @@ +/////////////////////////////////////////////////////////// +// File : SIERPINSKY_Gen_i.hxx +// Author : Vadim SANDLER (OCN) +// Created : 13/07/05 +// Copyright (C) 2005 Open CASCADE +/////////////////////////////////////////////////////////// + +#ifndef __SIERPINSKY_GEN_I_HXX +#define __SIERPINSKY_GEN_I_HXX + +#include "SALOME_Component_i.hxx" + +#include +#include CORBA_SERVER_HEADER(Sierpinsky) +#include CORBA_CLIENT_HEADER(SALOMEDS) + +#include + +struct MyPoint +{ + double myX; + double myY; + MyPoint( const double x = 0., const double y = 0. ) : myX( x ), myY( y ) {} +}; + +class SIERPINSKY_Gen_i: public virtual POA_SIERPINSKY_ORB::SIERPINSKY, + public virtual Engines_Component_i +{ +public: + // Default constructor + SIERPINSKY_Gen_i(); + // Constructor + SIERPINSKY_Gen_i( CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa, + PortableServer::ObjectId* contId, + const char* instanceName, + const char* interfaceName ); + // Destructor + ~SIERPINSKY_Gen_i(); + + // Initializes engine with three reference points + void Init( CORBA::Double theX1, CORBA::Double theY1, + CORBA::Double theX2, CORBA::Double theY2, + CORBA::Double theX3, CORBA::Double theY3 ); + + // Initializes engine with three default reference points: (0.5, 1), (0, 0), (1, 0) + void Reset(); + + // Generates next iteration point + void NextPoint( CORBA::Double theX, CORBA::Double theY, + CORBA::Long theIter, + CORBA::Double& theNextX, CORBA::Double& theNextY ); + + // Exports data to the JPEG image + CORBA::Boolean ExportToJPEG( const char* theFileName, CORBA::Long theSize ); + + // Exports data to the MED file + CORBA::Boolean ExportToMED( const char* theFileName, CORBA::Double theSize ); + +private: + std::list myPoints; + MyPoint myRefPoints[3]; +}; + +#endif // __SIERPINSKY_GEN_I_HXX diff --git a/src/SierpinskyGUI/Makefile.in b/src/SierpinskyGUI/Makefile.in new file mode 100644 index 0000000..93900a7 --- /dev/null +++ b/src/SierpinskyGUI/Makefile.in @@ -0,0 +1,39 @@ +############################################################### +# File : Makefile.in +# Author : Vadim SANDLER (OCN) +# Created : 13/07/05 +# Copyright (C) 2005 Open CASCADE +############################################################### + +# source path +top_srcdir=@top_srcdir@ +top_builddir=../.. +srcdir=@srcdir@ +VPATH=.:@srcdir@:@top_srcdir@/idl:$(top_builddir)/idl:${RANDOMIZER_ROOT_DIR}/idl/salome + +@COMMENCE@ + +EXPORT_HEADERS = \ + SierpinskyGUI.h \ + SierpinskyGUI_RunDlg.h + +PO_FILES = SIERPINSKY_msg_en.po SIERPINSKY_icons.po + +# Libraries targets +LIB = libSIERPINSKYGUI.la + +LIB_SRC = \ + SierpinskyGUI.cxx \ + SierpinskyGUI_RunDlg.cxx + +LIB_MOC = \ + SierpinskyGUI_RunDlg.h + +LIB_CLIENT_IDL = SALOME_Component.idl SALOME_Exception.idl SALOMEDS.idl Sierpinsky.idl Randomizer.idl \ +SALOME_GenericObj.idl SALOMEDS_Attributes.idl SALOME_Comm.idl MED.idl VISU_Gen.idl + +CPPFLAGS+= $(QT_INCLUDES) $(OCC_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome -I${RANDOMIZER_ROOT_DIR}/include/salome +CXXFLAGS+= $(QT_INCLUDES) $(OCC_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome -I${RANDOMIZER_ROOT_DIR}/include/salome +LDFLAGS+= -L${KERNEL_ROOT_DIR}/lib/salome $(QT_LIBS) -lSalomeGUI -lSIERPINSKYEngine -L${RANDOMIZER_ROOT_DIR}/lib/salome + +@CONCLUDE@ diff --git a/src/SierpinskyGUI/SIERPINSKY_icons.po b/src/SierpinskyGUI/SIERPINSKY_icons.po new file mode 100644 index 0000000..b386757 --- /dev/null +++ b/src/SierpinskyGUI/SIERPINSKY_icons.po @@ -0,0 +1,11 @@ +# This is a Qt message file in .po format. Each msgid starts with +# a scope. This scope should *NOT* be translated - eg. "Foo::Bar" +# would be translated to "Pub", not "Foo::Pub". +msgid "" +msgstr "" +"Project-Id-Version: PROJECT VERSION\n" +"POT-Creation-Date: 2002-05-28 10:57:43 AM CEST\n" +"PO-Revision-Date: YYYY-MM-DD\n" +"Last-Translator: FULLNAME \n" +"Content-Type: text/plain; charset=iso-8859-1\n" + diff --git a/src/SierpinskyGUI/SIERPINSKY_msg_en.po b/src/SierpinskyGUI/SIERPINSKY_msg_en.po new file mode 100644 index 0000000..0681603 --- /dev/null +++ b/src/SierpinskyGUI/SIERPINSKY_msg_en.po @@ -0,0 +1,93 @@ +# This is a Qt message file in .po format. Each msgid starts with +# a scope. This scope should *NOT* be translated - eg. translating +# from French to English, "Foo::Bar" would be translated to "Pub", +# not "Foo::Pub". +msgid "" +msgstr "" +"Project-Id-Version: PROJECT VERSION\n" +"POT-Creation-Date: 2003-11-19 03:10:19 PM CET\n" +"PO-Revision-Date: YYYY-MM-DD\n" +"Last-Translator: FULLNAME \n" +"Content-Type: text/plain; charset=iso-8859-1\n" + +msgid "SierpinskyGUI_RunDlg::CAPTION" +msgstr "Run Sierpinsky Algo" + +msgid "SierpinskyGUI_RunDlg::START_POINT" +msgstr "Start point" + +msgid "SierpinskyGUI_RunDlg::RANDOM" +msgstr "Random" + +msgid "SierpinskyGUI_RunDlg::BASE_POINTS" +msgstr "Base points" + +msgid "SierpinskyGUI_RunDlg::DEFAULT" +msgstr "Default" + +msgid "SierpinskyGUI_RunDlg::NB_ITERATIONS" +msgstr "Number of iterations:" + +msgid "SierpinskyGUI_RunDlg::RESULTS" +msgstr "Results" + +msgid "SierpinskyGUI_RunDlg::EXPORT_2_JPEG" +msgstr "Export to JPEG" + +msgid "SierpinskyGUI_RunDlg::IMAGE_SIZE" +msgstr "Image size:" + +msgid "SierpinskyGUI_RunDlg::EXPORT_2_MED" +msgstr "Export to MED" + +msgid "SierpinskyGUI_RunDlg::MESH_SIZE" +msgstr "Mesh size:" + +msgid "SierpinskyGUI_RunDlg::IMPORT_MED_2_VISU" +msgstr "Import to Post-Pro" + +msgid "SierpinskyGUI_RunDlg::START_BTN" +msgstr "&Start" + +msgid "SierpinskyGUI_RunDlg::STOP_BTN" +msgstr "&Stop" + +msgid "SierpinskyGUI_RunDlg::CANCEL_BTN" +msgstr "&Cancel" + +msgid "JPEG_FILES" +msgstr "JPEG files (*.jpg; *.jpeg)" + +msgid "MED_FILES" +msgstr "MED files (*.med)" + +msgid "EXPORT_JPEG_FILE" +msgstr "Export JPEG image" + +msgid "EXPORT_MED_FILE" +msgstr "Export MED file" + +msgid "SierpinskyGUI_RunDlg::OK_BTN" +msgstr "&OK" + +msgid "SierpinskyGUI_RunDlg::ERR_ERROR" +msgstr "Warning" + +msgid "SierpinskyGUI_RunDlg::EXEC_ERROR" +msgstr "Can't run execution!" + +msgid "SierpinskyGUI_RunDlg::WRN_WARNING" +msgstr "Warning" + +msgid "SierpinskyGUI_RunDlg::YES_BTN" +msgstr "&Yes" + +msgid "SierpinskyGUI_RunDlg::NO_BTN" +msgstr "&No" + +msgid "SierpinskyGUI_RunDlg::JPEG_PARAMETERS_ERROR" +msgstr "JPEG file name is not given or image size is 0.\nContinue?" + +msgid "SierpinskyGUI_RunDlg::MED_PARAMETERS_ERROR" +msgstr "MED file name is not given or mesh size is 0.\nContinue?" + diff --git a/src/SierpinskyGUI/SierpinskyGUI.cxx b/src/SierpinskyGUI/SierpinskyGUI.cxx new file mode 100644 index 0000000..ef8568c --- /dev/null +++ b/src/SierpinskyGUI/SierpinskyGUI.cxx @@ -0,0 +1,57 @@ +/////////////////////////////////////////////////////////// +// File : SierpinskyGUI.cxx +// Author : Vadim SANDLER (OCN) +// Created : 13/07/05 +// Copyright (C) 2005 Open CASCADE +/////////////////////////////////////////////////////////// + +#include "SierpinskyGUI.h" +#include "SierpinskyGUI_RunDlg.h" + +#include "QAD_Desktop.h" + +SierpinskyGUI* SierpinskyGUI::GetSierpinskyGUI() +{ + static SierpinskyGUI gui; + return &gui; +} + +/*! + * Constructor + */ +SierpinskyGUI::SierpinskyGUI( const QString& name, QObject* parent ) +{ +} + +/*! + * Destructor + */ +SierpinskyGUI::~SierpinskyGUI() +{ +} + +/*! + * Processes GUI event + */ +bool SierpinskyGUI::OnGUIEvent( int theCommandID, QAD_Desktop* parent ) +{ + switch( theCommandID ) { + case 10000: + { + SierpinskyGUI_RunDlg* aDlg = new SierpinskyGUI_RunDlg( parent ); + aDlg->exec(); + break; + } + } + return true; +} + +/*! + * GUI factory + */ +extern "C" +{ + Standard_EXPORT SALOMEGUI* GetComponentGUI() { + return SierpinskyGUI::GetSierpinskyGUI(); + } +} diff --git a/src/SierpinskyGUI/SierpinskyGUI.h b/src/SierpinskyGUI/SierpinskyGUI.h new file mode 100644 index 0000000..c296982 --- /dev/null +++ b/src/SierpinskyGUI/SierpinskyGUI.h @@ -0,0 +1,30 @@ +/////////////////////////////////////////////////////////// +// File : SierpinskyGUI.h +// Author : Vadim SANDLER (OCN) +// Created : 13/07/05 +// Copyright (C) 2005 Open CASCADE +/////////////////////////////////////////////////////////// + +#ifndef __SIERPINSKYGUI_H +#define __SIERPINSKYGUI_H + +#include "SALOMEGUI.h" + +class QAD_Desktop; + +class SierpinskyGUI : public SALOMEGUI +{ +public: + // Constructor + SierpinskyGUI( const QString& name = "", QObject* parent = 0 ); + // Destructor + ~SierpinskyGUI(); + + // Get the only instance of GUI + static SierpinskyGUI* SierpinskyGUI::GetSierpinskyGUI(); + + // Processes GUI event + virtual bool OnGUIEvent( int theCommandID, QAD_Desktop* parent ); +}; + +#endif // __SIERPINSKYGUI_H diff --git a/src/SierpinskyGUI/SierpinskyGUI_RunDlg.cxx b/src/SierpinskyGUI/SierpinskyGUI_RunDlg.cxx new file mode 100644 index 0000000..146bea9 --- /dev/null +++ b/src/SierpinskyGUI/SierpinskyGUI_RunDlg.cxx @@ -0,0 +1,544 @@ +/////////////////////////////////////////////////////////// +// File : SierpinskyGUI_RunDlg.cxx +// Author : Vadim SANDLER (OCN) +// Created : 13/07/05 +// Copyright (C) 2005 Open CASCADE +/////////////////////////////////////////////////////////// + +#include "SierpinskyGUI_RunDlg.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include CORBA_SERVER_HEADER(Sierpinsky) +#include CORBA_CLIENT_HEADER(Randomizer) +#include CORBA_CLIENT_HEADER(SALOMEDS) +#include CORBA_CLIENT_HEADER(VISU_Gen) + +/*! + * Get Randomizer component engine + */ +static RANDOMIZER_ORB::RANDOMIZER_var getRandomizerEngine() +{ + static RANDOMIZER_ORB::RANDOMIZER_var aGen; + if( CORBA::is_nil( aGen ) ) { + if( QAD_Desktop* aDesktop = QAD_Application::getDesktop() ) { + Engines::Component_var aComponent = aDesktop->getEngine( "FactoryServerPy","RANDOMIZER" ); + aGen = RANDOMIZER_ORB::RANDOMIZER::_narrow( aComponent ); + } + } + return aGen; +} + +/*! + * Get Sierpinsky component engine + */ +static SIERPINSKY_ORB::SIERPINSKY_var getSierpinskyEngine() +{ + static SIERPINSKY_ORB::SIERPINSKY_var aGen; + if( CORBA::is_nil( aGen ) ) { + if( QAD_Desktop* aDesktop = QAD_Application::getDesktop() ) { + Engines::Component_var aComponent = aDesktop->getEngine( "FactoryServer","SIERPINSKY" ); + aGen = SIERPINSKY_ORB::SIERPINSKY::_narrow( aComponent ); + } + } + return aGen; +} + +/*! + * Get VISU component engine + */ +static VISU::VISU_Gen_var getVisuEngine() +{ + static VISU::VISU_Gen_var aGen; + if( CORBA::is_nil( aGen ) ) { + if( QAD_Desktop* aDesktop = QAD_Application::getDesktop() ) { + Engines::Component_var aComponent = aDesktop->getEngine( "FactoryServer","VISU" ); + aGen = VISU::VISU_Gen::_narrow( aComponent ); + } + } + return aGen; +} + +#define MY_EVENT QEvent::User + 555 +class MyEvent : public QCustomEvent +{ +public: + MyEvent( const int iter ) : QCustomEvent( MY_EVENT ), myIter( iter ) {} + int iter() const { return myIter; } + +private: + int myIter; +}; + +/*! + * Progress thread class + */ +class MyThread : public QThread +{ +public: + MyThread( SierpinskyGUI_RunDlg* parent, const double x, const double y, const int nbIter ) : + myParent( parent ), myStopped( false ), myX( x ), myY( y ), myNbIter( nbIter ) { start(); } + + void init( const double x, const double y, const int nbIter ) + { + myX = x; myY = y; + myNbIter = nbIter; + myStopped = false; + start(); + } + void stop() { myStopped = true; } + +protected: + void run() + { + while ( !myStopped && myNbIter-- ) { + int ni = getRandomizerEngine()->NextIteration(); + getSierpinskyEngine()->NextPoint( myX, myY, ni, myX, myY ); + QApplication::postEvent( myParent, new MyEvent( myNbIter ) ); + msleep( 50 ); + } + } + +private: + SierpinskyGUI_RunDlg* myParent; + bool myStopped; + double myX; + double myY; + int myNbIter; +}; + +#define MARGIN_SIZE 11 +#define SPACING_SIZE 6 + +/*! + * Constructor + */ +SierpinskyGUI_RunDlg::SierpinskyGUI_RunDlg( QWidget* parent ) + : QDialog( parent, "SierpinskyGUI_RunDlg", true, + WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose ), + myThread( 0 ) +{ + setCaption( tr( "CAPTION" ) ); + setSizeGripEnabled( true ); + + QGridLayout* topLayout = new QGridLayout( this ); + topLayout->setMargin( MARGIN_SIZE ); topLayout->setSpacing( SPACING_SIZE ); + + // start point group + box1 = new QGroupBox( tr( "START_POINT" ), this ); + box1->setColumnLayout( 0, Qt::Vertical ); + box1->layout()->setMargin( 0 ); box1->layout()->setSpacing( 0 ); + QGridLayout* box1Layout = new QGridLayout( box1->layout() ); + box1Layout->setAlignment( Qt::AlignTop ); + box1Layout->setMargin( MARGIN_SIZE ); box1Layout->setSpacing( SPACING_SIZE ); + + QLabel* labX = new QLabel( "X:", box1 ); + myStartX = new QAD_SpinBoxDbl( box1, 0.0, 1.0, 0.1 ); + myStartX->setMinimumWidth( 150 ); + + QLabel* labY = new QLabel( "Y:", box1 ); + myStartY = new QAD_SpinBoxDbl( box1, 0.0, 1.0, 0.1 ); + myStartY->setMinimumWidth( 150 ); + + myStartRandom = new QCheckBox( tr( "RANDOM" ), box1 ); + + box1Layout->addWidget( labX, 0, 0 ); + box1Layout->addWidget( myStartX, 0, 1 ); + box1Layout->addWidget( labY, 0, 2 ); + box1Layout->addWidget( myStartY, 0, 3 ); + box1Layout->addWidget( myStartRandom, 1, 1 ); + + // base points group + box2 = new QGroupBox( tr( "BASE_POINTS" ), this ); + box2->setColumnLayout( 0, Qt::Vertical ); + box2->layout()->setMargin( 0 ); box2->layout()->setSpacing( 0 ); + QGridLayout* box2Layout = new QGridLayout( box2->layout() ); + box2Layout->setAlignment( Qt::AlignTop ); + box2Layout->setMargin( MARGIN_SIZE ); box2Layout->setSpacing( SPACING_SIZE ); + + QLabel* labX1 = new QLabel( "X1:", box2 ); + myX1 = new QAD_SpinBoxDbl( box2, 0.0, 1.0, 0.1 ); + myX1->setMinimumWidth( 150 ); + + QLabel* labY1 = new QLabel( "Y1:", box2 ); + myY1 = new QAD_SpinBoxDbl( box2, 0.0, 1.0, 0.1 ); + myY1->setMinimumWidth( 150 ); + + QLabel* labX2 = new QLabel( "X2:", box2 ); + myX2 = new QAD_SpinBoxDbl( box2, 0.0, 1.0, 0.1 ); + myX2->setMinimumWidth( 150 ); + + QLabel* labY2 = new QLabel( "Y2:", box2 ); + myY2 = new QAD_SpinBoxDbl( box2, 0.0, 1.0, 0.1 ); + myY2->setMinimumWidth( 150 ); + + QLabel* labX3 = new QLabel( "X3:", box2 ); + myX3 = new QAD_SpinBoxDbl( box2, 0.0, 1.0, 0.1 ); + myX3->setMinimumWidth( 150 ); + + QLabel* labY3 = new QLabel( "Y3:", box2 ); + myY3 = new QAD_SpinBoxDbl( box2, 0.0, 1.0, 0.1 ); + myY3->setMinimumWidth( 150 ); + + myBaseRandom = new QCheckBox( tr( "RANDOM" ), box2 ); + myBaseDefault = new QCheckBox( tr( "DEFAULT" ), box2 ); + + box2Layout->addWidget( labX1, 0, 0 ); + box2Layout->addWidget( myX1, 0, 1 ); + box2Layout->addWidget( labY1, 0, 2 ); + box2Layout->addWidget( myY1, 0, 3 ); + box2Layout->addWidget( labX2, 1, 0 ); + box2Layout->addWidget( myX2, 1, 1 ); + box2Layout->addWidget( labY2, 1, 2 ); + box2Layout->addWidget( myY2, 1, 3 ); + box2Layout->addWidget( labX3, 2, 0 ); + box2Layout->addWidget( myX3, 2, 1 ); + box2Layout->addWidget( labY3, 2, 2 ); + box2Layout->addWidget( myY3, 2, 3 ); + box2Layout->addWidget( myBaseRandom, 3, 1 ); + box2Layout->addWidget( myBaseDefault, 3, 3 ); + + // number of iterations + QLabel* labIter = new QLabel( tr( "NB_ITERATIONS" ), this ); + myIter = new QSpinBox( 1, 100000, 1, this ); + + // results + box3 = new QGroupBox( tr( "RESULTS" ), this ); + box3->setColumnLayout( 0, Qt::Vertical ); + box3->layout()->setMargin( 0 ); box3->layout()->setSpacing( 0 ); + QGridLayout* box3Layout = new QGridLayout( box3->layout() ); + box3Layout->setAlignment( Qt::AlignTop ); + box3Layout->setMargin( MARGIN_SIZE ); box3Layout->setSpacing( SPACING_SIZE ); + + myJpegCheck = new QCheckBox( tr( "EXPORT_2_JPEG" ), box3 ); + myJpegFile = new QLineEdit( box3 ); + myJpegFile->setMinimumWidth( 300 ); + + myJpegBtn = new QPushButton( "...", box3 ); + myJpegBtn->setFixedSize( 20, 20 ); + + QLabel* labJpeg = new QLabel( tr( "IMAGE_SIZE" ), box3 ); + myJpegSize = new QSpinBox( 0, 1280, 10, box3 ); + myJpegSize->setMinimumWidth( 150 ); + + QFrame* line = new QFrame( box3 ); + line->setFrameStyle( QFrame::HLine | QFrame::Sunken ); + + myMedCheck = new QCheckBox( tr( "EXPORT_2_MED" ), box3 ); + myMedFile = new QLineEdit( box3 ); + myMedFile->setMinimumWidth( 300 ); + + myMedBtn = new QPushButton( "...", box3 ); + myMedBtn->setFixedSize( 20, 20 ); + + QLabel* labMed = new QLabel( tr( "MESH_SIZE" ), box3 ); + myMedSize = new QAD_SpinBoxDbl( box3, 0.0, 1000, 1.0 ); + myMedSize->setMinimumWidth( 150 ); + + myVisuCheck = new QCheckBox( tr( "IMPORT_MED_2_VISU" ), box3 ); + + box3Layout->addMultiCellWidget( myJpegCheck, 0, 0, 0, 3 ); + box3Layout->addMultiCellWidget( myJpegFile, 1, 1, 0, 2 ); + box3Layout->addWidget( myJpegBtn, 1, 3 ); + box3Layout->addWidget( labJpeg, 2, 0 ); + box3Layout->addWidget( myJpegSize, 2, 1 ); + box3Layout->addMultiCellWidget( line, 3, 3, 0, 3 ); + box3Layout->addMultiCellWidget( myMedCheck, 4, 4, 0, 3 ); + box3Layout->addMultiCellWidget( myMedFile, 5, 5, 0, 2 ); + box3Layout->addWidget( myMedBtn, 5, 3 ); + box3Layout->addWidget( labMed, 6, 0 ); + box3Layout->addWidget( myMedSize, 6, 1 ); + box3Layout->addMultiCellWidget( myVisuCheck, 7, 7, 0, 3 ); + + // progress bar + myProgress = new QProgressBar( this ); + myProgress->setPercentageVisible( false ); + myProgress->setFixedHeight( 10 ); + + // common buttons + myStartBtn = new QPushButton( tr( "START_BTN" ), this ); + myCancelBtn = new QPushButton( tr( "CANCEL_BTN" ), this ); + QHBoxLayout* btnLayout = new QHBoxLayout; + btnLayout->addWidget( myStartBtn ); + btnLayout->addStretch(); + btnLayout->addWidget( myCancelBtn ); + + topLayout->addMultiCellWidget( box1, 0, 0, 0, 1 ); + topLayout->addMultiCellWidget( box2, 1, 1, 0, 1 ); + topLayout->addWidget( labIter, 2, 0 ); + topLayout->addWidget( myIter, 2, 1 ); + topLayout->addMultiCellWidget( box3, 3, 3, 0, 1 ); + topLayout->addMultiCellWidget( myProgress,4, 4, 0, 1 ); + topLayout->addMultiCellLayout( btnLayout, 5, 5, 0, 1 ); + + // signals and slots connections + connect( myJpegBtn, SIGNAL( clicked() ), this, SLOT( onBrowse() ) ); + connect( myMedBtn, SIGNAL( clicked() ), this, SLOT( onBrowse() ) ); + connect( myStartRandom, SIGNAL( clicked() ), this, SLOT( updateState() ) ); + connect( myBaseRandom, SIGNAL( clicked() ), this, SLOT( toggled() ) ); + connect( myBaseDefault, SIGNAL( clicked() ), this, SLOT( toggled() ) ); + connect( myJpegCheck, SIGNAL( clicked() ), this, SLOT( updateState() ) ); + connect( myMedCheck, SIGNAL( clicked() ), this, SLOT( updateState() ) ); + connect( myStartBtn, SIGNAL( clicked() ), this, SLOT( accept() ) ); + connect( myCancelBtn, SIGNAL( clicked() ), this, SLOT( close() ) ); + + // initial state + myStartX->setValue( 0.0 ); myStartY->setValue( 0.0 ); + myStartRandom->setChecked( true ); + myX1->setValue( 0.5 ); myY1->setValue( 1.0 ); + myX2->setValue( 0.0 ); myY2->setValue( 0.0 ); + myX3->setValue( 1.0 ); myY3->setValue( 0.0 ); + myBaseRandom->setChecked( false ); + myBaseDefault->setChecked( true ); + myIter->setValue( 1000 ); + myJpegCheck->setChecked( false ); + myJpegSize->setValue( 200 ); + myMedCheck->setChecked( false ); + myMedSize->setValue( 100 ); + myVisuCheck->setChecked( true ); + updateState(); +} + +/*! + * Destructor + */ +SierpinskyGUI_RunDlg::~SierpinskyGUI_RunDlg() +{ + if ( myThread ) { + myThread->stop(); + myThread->wait(); + delete myThread; + } +} + +/*! + * Browse file + */ +void SierpinskyGUI_RunDlg::onBrowse() +{ + const QObject* snd = sender(); + bool jpg = snd == myJpegBtn; + QString aFileName = QAD_FileDlg::getFileName( this, + jpg ? myJpegFile->text() : myMedFile->text(), + QStringList::split( ":", jpg ? tr( "JPEG_FILES") : tr( "MED_FILES" ) ), + jpg ? tr( "EXPORT_JPEG_FILE" ) : tr( "EXPORT_MED_FILE" ), + false ); + if ( !aFileName.isEmpty() ) { + jpg ? myJpegFile->setText( aFileName ) : myMedFile->setText( aFileName ); + } +} + +/*! + * Update widgets state + */ +void SierpinskyGUI_RunDlg::updateState() +{ + myStartX->setEnabled( !myStartRandom->isChecked() ); + myStartY->setEnabled( !myStartRandom->isChecked() ); + + myX1->setEnabled( !myBaseRandom->isChecked() && !myBaseDefault->isChecked() ); + myY1->setEnabled( !myBaseRandom->isChecked() && !myBaseDefault->isChecked() ); + myX2->setEnabled( !myBaseRandom->isChecked() && !myBaseDefault->isChecked() ); + myY2->setEnabled( !myBaseRandom->isChecked() && !myBaseDefault->isChecked() ); + myX3->setEnabled( !myBaseRandom->isChecked() && !myBaseDefault->isChecked() ); + myY3->setEnabled( !myBaseRandom->isChecked() && !myBaseDefault->isChecked() ); + + myJpegFile->setEnabled( myJpegCheck->isChecked() ); + myJpegBtn->setEnabled( myJpegCheck->isChecked() ); + myJpegSize->setEnabled( myJpegCheck->isChecked() ); + + myMedFile->setEnabled( myMedCheck->isChecked() ); + myMedBtn->setEnabled( myMedCheck->isChecked() ); + myMedSize->setEnabled( myMedCheck->isChecked() ); + myVisuCheck->setEnabled( myMedCheck->isChecked() ); +} + +/*! + * Toggle 'Base points' mode + */ +void SierpinskyGUI_RunDlg::toggled() +{ + const QObject* snd = sender(); + if ( snd == myBaseRandom && myBaseRandom->isChecked() ) myBaseDefault->setChecked( false ); + if ( snd == myBaseDefault && myBaseDefault->isChecked() ) myBaseRandom->setChecked( false ); + updateState(); +} + +/*! + * Called when user presses 'Start' button + */ +void SierpinskyGUI_RunDlg::accept() +{ + RANDOMIZER_ORB::RANDOMIZER_var aRandGen = getRandomizerEngine(); + SIERPINSKY_ORB::SIERPINSKY_var aSierpGen = getSierpinskyEngine(); + + if( CORBA::is_nil( aRandGen ) || CORBA::is_nil( aSierpGen ) ) { + QAD_MessageBox::error1( this, + tr( "ERR_ERROR" ), + tr( "EXEC_ERROR" ), + tr( "OK_BTN") ); + return; + } + + // JPEG file + QString aJPEGFile; + int aJPEGSize = 0; + if ( myJpegCheck->isChecked() ) { + aJPEGFile = myJpegFile->text().stripWhiteSpace(); + aJPEGSize = myJpegSize->value(); + if ( aJPEGFile.isEmpty() || aJPEGSize <= 0 ) { + int res = QAD_MessageBox::warn2( this, + tr( "WRN_WARNING" ), + tr( "JPEG_PARAMETERS_ERROR" ), + tr( "YES_BTN"), tr( "NO_BTN" ), 0, 1, 0 ); + if ( res ) return; + } + } + + // MED file + QString aMEDFile; + double aMEDSize = 0; + if ( myMedCheck->isChecked() ) { + aMEDFile = myMedFile->text().stripWhiteSpace(); + aMEDSize = myMedSize->value(); + if ( aMEDFile.isEmpty() || aMEDSize <= 0 ) { + int res = QAD_MessageBox::warn2( this, + tr( "WRN_WARNING" ), + tr( "MED_PARAMETERS_ERROR" ), + tr( "YES_BTN"), tr( "NO_BTN" ), 0, 1, 0 ); + if ( res ) return; + } + } + + // start point + double x = myStartX->value(); + double y = myStartY->value(); + if ( myStartRandom->isChecked() ) + aRandGen->InitPoint( x, y ); + + // base points + if ( myBaseDefault->isChecked() ) { + aSierpGen->Reset(); // use default values from engine + } + else { + double x1 = myX1->value(); + double y1 = myY1->value(); + double x2 = myX2->value(); + double y2 = myY2->value(); + double x3 = myX3->value(); + double y3 = myY3->value(); + if ( myBaseRandom->isChecked() ) { + aRandGen->InitPoint( x1, y1 ); + aRandGen->InitPoint( x2, y2 ); + aRandGen->InitPoint( x3, y3 ); + } + aSierpGen->Init( x1, y1, x2, y2, x3, y3 ); + } + + // nb of iterations + int iter = myIter->value(); + + // start execution + myProgress->setTotalSteps( iter ); + myProgress->setProgress( 0 ); + if ( !myThread ) + myThread = new MyThread( this, x, y, iter ); + else + myThread->init( x, y, iter ); + disconnect( myStartBtn, SIGNAL( clicked() ), this, SLOT( accept() ) ); + connect( myStartBtn, SIGNAL( clicked() ), this, SLOT( stop() ) ); + myStartBtn->setText( tr( "STOP_BTN" ) ); + box1->setEnabled( false ); + box2->setEnabled( false ); + box3->setEnabled( false ); + myIter->setEnabled( false ); +} + +/*! + * Called when user presses 'Stop' button + */ +void SierpinskyGUI_RunDlg::stop() +{ + myThread->stop(); + disconnect( myStartBtn, SIGNAL( clicked() ), this, SLOT( stop() ) ); + connect( myStartBtn, SIGNAL( clicked() ), this, SLOT( accept() ) ); + myStartBtn->setText( tr( "START_BTN" ) ); + myProgress->setProgress( 0 ); + box1->setEnabled( true ); + box2->setEnabled( true ); + box3->setEnabled( true ); + myIter->setEnabled( true ); +} + +/*! + * Progress thread calls this method to update progress bar state + */ +void SierpinskyGUI_RunDlg::nextStep( const int step ) +{ + if ( !step ) { + disconnect( myStartBtn, SIGNAL( clicked() ), this, SLOT( stop() ) ); + connect( myStartBtn, SIGNAL( clicked() ), this, SLOT( accept() ) ); + myStartBtn->setText( tr( "START_BTN" ) ); + myProgress->setProgress( 0 ); + box1->setEnabled( true ); + box2->setEnabled( true ); + box3->setEnabled( true ); + myIter->setEnabled( true ); + + // export to JPEG + if ( myJpegCheck->isChecked() ) { + QString aJPEGFile = myJpegFile->text().stripWhiteSpace(); + int aJPEGSize = myJpegSize->value(); + if ( !aJPEGFile.isEmpty() && aJPEGSize > 0 ) { + bool res = getSierpinskyEngine()->ExportToJPEG( aJPEGFile.latin1(), aJPEGSize ); + } + } + // export to MED + if ( myMedCheck->isChecked() ) { + QString aMEDFile = myMedFile->text().stripWhiteSpace(); + double aMEDSize = myMedSize->value(); + if ( !aMEDFile.isEmpty() && aMEDSize > 0 ) { + bool res = getSierpinskyEngine()->ExportToMED( aMEDFile.latin1(), aMEDSize ); + if ( res && myVisuCheck->isChecked() ) { + VISU::VISU_Gen_var aVisuGen = getVisuEngine(); + if ( !CORBA::is_nil( aVisuGen ) ) { + VISU::Result_var aResult = aVisuGen->ImportFile( aMEDFile.latin1() ); + if ( !CORBA::is_nil( aResult ) ) + aVisuGen->MeshOnEntity( aResult, "Sierpinsky", VISU::NODE ); + QAD_Application::getDesktop()->getActiveStudy()->updateObjBrowser( true ); + } + } + } + } + } + else { + myProgress->setProgress( myProgress->totalSteps() - step ); + } +} + +/*! + * Process progress event + */ +void SierpinskyGUI_RunDlg::customEvent( QCustomEvent* e ) +{ + if ( e->type() == MY_EVENT ) { + MyEvent* me = (MyEvent*)e; + nextStep( me->iter() ); + } +} diff --git a/src/SierpinskyGUI/SierpinskyGUI_RunDlg.h b/src/SierpinskyGUI/SierpinskyGUI_RunDlg.h new file mode 100644 index 0000000..428e5b7 --- /dev/null +++ b/src/SierpinskyGUI/SierpinskyGUI_RunDlg.h @@ -0,0 +1,85 @@ +/////////////////////////////////////////////////////////// +// File : SierpinskyGUI_RunDlg.h +// Author : Vadim SANDLER (OCN) +// Created : 13/07/05 +// Copyright (C) 2005 Open CASCADE +/////////////////////////////////////////////////////////// + +#ifndef __SIERPINSKYGUI_RUNDLG_H +#define __SIERPINSKYGUI_RUNDLG_H + +#include + +class QLineEdit; +class QCheckBox; +class QSpinBox; +class QPushButton; +class QGroupBox; +class QAD_SpinBoxDbl; +class MyThread; +class QProgressBar; + +class SierpinskyGUI_RunDlg : public QDialog +{ + Q_OBJECT + +public: + // Constructor + SierpinskyGUI_RunDlg( QWidget* ); + // Destructor + ~SierpinskyGUI_RunDlg(); + + // Progress thread calls this method to update progress bar state + void nextStep( const int ); + +protected: + // process progress event + void customEvent( QCustomEvent* ); + +protected slots: + void accept(); // Called when user presses 'Start' button + void stop(); // Called when user presses 'Stop' button + void onBrowse(); // Browse file + void updateState(); // Update widgets state + void toggled(); // Toggle 'Base points' mode + +private: + // widgets + QGroupBox* box1; + QAD_SpinBoxDbl* myStartX; + QAD_SpinBoxDbl* myStartY; + QCheckBox* myStartRandom; + + QGroupBox* box2; + QAD_SpinBoxDbl* myX1; + QAD_SpinBoxDbl* myY1; + QAD_SpinBoxDbl* myX2; + QAD_SpinBoxDbl* myY2; + QAD_SpinBoxDbl* myX3; + QAD_SpinBoxDbl* myY3; + QCheckBox* myBaseRandom; + QCheckBox* myBaseDefault; + + QSpinBox* myIter; + + QGroupBox* box3; + QCheckBox* myJpegCheck; + QLineEdit* myJpegFile; + QPushButton* myJpegBtn; + QSpinBox* myJpegSize; + QCheckBox* myMedCheck; + QLineEdit* myMedFile; + QPushButton* myMedBtn; + QAD_SpinBoxDbl* myMedSize; + QCheckBox* myVisuCheck; + + QPushButton* myStartBtn; + QPushButton* myCancelBtn; + + QProgressBar* myProgress; + + // progress thread + MyThread* myThread; +}; + +#endif // __SIERPINSKYGUI_RUNDLG_H -- 2.39.2