From baafd500e618bc3f10c03ff03b103cec933c90d6 Mon Sep 17 00:00:00 2001 From: vsr Date: Thu, 9 Aug 2012 14:24:43 +0000 Subject: [PATCH] Merge from V6_main_20120808 08Aug12 --- AUTHORS | 0 COPYING | 504 +++++ ChangeLog | 0 HEXABLOCKPLUGIN_version.h.in | 35 + INSTALL | 1 + Makefile.am | 58 + NEWS | 0 README | 0 adm_local/Makefile.am | 22 + adm_local/unix/Makefile.am | 22 + adm_local/unix/config_files/Makefile.am | 23 + .../config_files/check_HEXABLOCKPLUGIN.m4 | 78 + adm_local/unix/make_common_starter.am | 94 + bin/Makefile.am | 30 + bin/VERSION.in | 3 + build_configure | 138 ++ clean_configure | 25 + configure.ac | 417 ++++ env_HEXABLOCKPLUGIN_src.sh | 3 + idl/HEXABLOCKPlugin_Algorithm.idl | 63 + idl/Makefile.am | 129 ++ resources/HEXABLOCKPlugin.xml | 52 + resources/Makefile.am | 36 + resources/SalomeApp.xml | 29 + resources/mesh_hypo_HEXABLOCK.png | Bin 0 -> 616 bytes resources/mesh_tree_hypo_HEXABLOCK.png | Bin 0 -> 278 bytes .../HEXABLOCKPluginGUI_HypothesisCreator.cxx | 822 +++++++ .../HEXABLOCKPluginGUI_HypothesisCreator.h | 161 ++ src/GUI/HEXABLOCKPlugin_images.ts | 38 + src/GUI/HEXABLOCKPlugin_msg_en.ts | 166 ++ src/GUI/Makefile.am | 67 + src/HEXABLOCKPlugin/HEXABLOCKPlugin_Defs.hxx | 37 + .../HEXABLOCKPlugin_FromSkin_3D.cxx | 1580 +++++++++++++ .../HEXABLOCKPlugin_FromSkin_3D.hxx | 70 + .../HEXABLOCKPlugin_HEXABLOCK.cxx | 403 ++++ .../HEXABLOCKPlugin_HEXABLOCK.hxx | 66 + .../HEXABLOCKPlugin_HEXABLOCK_i.cxx | 88 + .../HEXABLOCKPlugin_HEXABLOCK_i.hxx | 54 + .../HEXABLOCKPlugin_Hypothesis.cxx | 134 ++ .../HEXABLOCKPlugin_Hypothesis.hxx | 79 + .../HEXABLOCKPlugin_Hypothesis_i.cxx | 126 ++ .../HEXABLOCKPlugin_Hypothesis_i.hxx | 76 + src/HEXABLOCKPlugin/HEXABLOCKPlugin_i.cxx | 76 + src/HEXABLOCKPlugin/HEXABLOCKPlugin_mesh.cxx | 1947 +++++++++++++++++ src/HEXABLOCKPlugin/HEXABLOCKPlugin_mesh.hxx | 217 ++ src/HEXABLOCKPlugin/Makefile.am | 69 + src/Makefile.am | 34 + 47 files changed, 8072 insertions(+) create mode 100755 AUTHORS create mode 100755 COPYING create mode 100755 ChangeLog create mode 100755 HEXABLOCKPLUGIN_version.h.in create mode 100755 INSTALL create mode 100755 Makefile.am create mode 100755 NEWS create mode 100755 README create mode 100755 adm_local/Makefile.am create mode 100755 adm_local/unix/Makefile.am create mode 100755 adm_local/unix/config_files/Makefile.am create mode 100755 adm_local/unix/config_files/check_HEXABLOCKPLUGIN.m4 create mode 100755 adm_local/unix/make_common_starter.am create mode 100755 bin/Makefile.am create mode 100755 bin/VERSION.in create mode 100755 build_configure create mode 100755 clean_configure create mode 100755 configure.ac create mode 100644 env_HEXABLOCKPLUGIN_src.sh create mode 100755 idl/HEXABLOCKPlugin_Algorithm.idl create mode 100755 idl/Makefile.am create mode 100755 resources/HEXABLOCKPlugin.xml create mode 100755 resources/Makefile.am create mode 100755 resources/SalomeApp.xml create mode 100755 resources/mesh_hypo_HEXABLOCK.png create mode 100755 resources/mesh_tree_hypo_HEXABLOCK.png create mode 100755 src/GUI/HEXABLOCKPluginGUI_HypothesisCreator.cxx create mode 100755 src/GUI/HEXABLOCKPluginGUI_HypothesisCreator.h create mode 100755 src/GUI/HEXABLOCKPlugin_images.ts create mode 100755 src/GUI/HEXABLOCKPlugin_msg_en.ts create mode 100755 src/GUI/Makefile.am create mode 100755 src/HEXABLOCKPlugin/HEXABLOCKPlugin_Defs.hxx create mode 100755 src/HEXABLOCKPlugin/HEXABLOCKPlugin_FromSkin_3D.cxx create mode 100755 src/HEXABLOCKPlugin/HEXABLOCKPlugin_FromSkin_3D.hxx create mode 100755 src/HEXABLOCKPlugin/HEXABLOCKPlugin_HEXABLOCK.cxx create mode 100755 src/HEXABLOCKPlugin/HEXABLOCKPlugin_HEXABLOCK.hxx create mode 100755 src/HEXABLOCKPlugin/HEXABLOCKPlugin_HEXABLOCK_i.cxx create mode 100755 src/HEXABLOCKPlugin/HEXABLOCKPlugin_HEXABLOCK_i.hxx create mode 100755 src/HEXABLOCKPlugin/HEXABLOCKPlugin_Hypothesis.cxx create mode 100755 src/HEXABLOCKPlugin/HEXABLOCKPlugin_Hypothesis.hxx create mode 100755 src/HEXABLOCKPlugin/HEXABLOCKPlugin_Hypothesis_i.cxx create mode 100755 src/HEXABLOCKPlugin/HEXABLOCKPlugin_Hypothesis_i.hxx create mode 100755 src/HEXABLOCKPlugin/HEXABLOCKPlugin_i.cxx create mode 100755 src/HEXABLOCKPlugin/HEXABLOCKPlugin_mesh.cxx create mode 100755 src/HEXABLOCKPlugin/HEXABLOCKPlugin_mesh.hxx create mode 100755 src/HEXABLOCKPlugin/Makefile.am create mode 100755 src/Makefile.am diff --git a/AUTHORS b/AUTHORS new file mode 100755 index 0000000..e69de29 diff --git a/COPYING b/COPYING new file mode 100755 index 0000000..b1e3f5a --- /dev/null +++ b/COPYING @@ -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/ChangeLog b/ChangeLog new file mode 100755 index 0000000..e69de29 diff --git a/HEXABLOCKPLUGIN_version.h.in b/HEXABLOCKPLUGIN_version.h.in new file mode 100755 index 0000000..3fc901b --- /dev/null +++ b/HEXABLOCKPLUGIN_version.h.in @@ -0,0 +1,35 @@ +// Copyright (C) 2009-2012 CEA/DEN, EDF R&D +// +// 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. +// +// 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 +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +// File : HEXABLOCKPLUGIN_version.h +// Author : Lioka RAZAFINDRAZAKA (CEA) +// Module : SALOME +// +#if !defined(__HEXABLOCKPLUGIN_VERSION_H__) +#define __HEXABLOCKPLUGIN_VERSION_H__ + +/* + HEXABLOCKPLUGIN_VERSION is (major << 16) + (minor << 8) + patch. +*/ + +#define HEXABLOCKPLUGIN_VERSION_STR "@VERSION@" +#define HEXABLOCKPLUGIN_VERSION @XVERSION@ +#define HEXABLOCKPLUGIN_DEVELOPMENT @VERSION_DEV@ + +#endif // __HEXABLOCKPLUGIN_VERSION_H__ diff --git a/INSTALL b/INSTALL new file mode 100755 index 0000000..9953d28 --- /dev/null +++ b/INSTALL @@ -0,0 +1 @@ +SALOME2 : HEXABLOCKPLUGIN module (SMESH plugin) diff --git a/Makefile.am b/Makefile.am new file mode 100755 index 0000000..041ce58 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,58 @@ +# Copyright (C) 2009-2012 CEA/DEN, EDF R&D +# +# 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. +# +# 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 +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +# -* Makefile *- +# Author : Lioka RAZAFINDRAZAKA (CEA) +# Date : 2010/11/08 +# Modified by : Alexander BORODIN (OCN) - autotools usage +# $Header: +# +include $(top_srcdir)/adm_local/unix/make_common_starter.am + +if HEXABLOCKPLUGIN_ENABLE_GUI + ACLOCAL_AMFLAGS = -I adm_local/unix/config_files \ + -I ${KERNEL_ROOT_DIR}/salome_adm/unix/config_files \ + -I ${GUI_ROOT_DIR}/adm_local/unix/config_files \ + -I ${MED_ROOT_DIR}/adm_local/unix/config_files \ + -I ${GEOM_ROOT_DIR}/adm_local/unix/config_files \ + -I ${HEXABLOCK_ROOT_DIR}/adm_local/unix/config_files \ + -I ${SMESH_ROOT_DIR}/adm_local/unix/config_files +else !HEXABLOCKPLUGIN_ENABLE_GUI + ACLOCAL_AMFLAGS = -I adm_local/unix/config_files \ + -I ${KERNEL_ROOT_DIR}/salome_adm/unix/config_files \ + -I ${MED_ROOT_DIR}/adm_local/unix/config_files \ + -I ${GEOM_ROOT_DIR}/adm_local/unix/config_files \ + -I ${HEXABLOCK_ROOT_DIR}/adm_local/unix/config_files \ + -I ${SMESH_ROOT_DIR}/adm_local/unix/config_files +endif + +SUBDIRS = idl adm_local resources src bin + +DIST_SUBDIRS = idl adm_local resources src bin + +DISTCLEANFILES = a.out aclocal.m4 configure local-install.sh + +salomeinclude_DATA = HEXABLOCKPLUGIN_version.h + +EXTRA_DIST += \ + build_configure \ + clean_configure + +dist-hook: + rm -rf `find $(distdir) -name CVS` diff --git a/NEWS b/NEWS new file mode 100755 index 0000000..e69de29 diff --git a/README b/README new file mode 100755 index 0000000..e69de29 diff --git a/adm_local/Makefile.am b/adm_local/Makefile.am new file mode 100755 index 0000000..a8219b0 --- /dev/null +++ b/adm_local/Makefile.am @@ -0,0 +1,22 @@ +# Copyright (C) 2009-2012 CEA/DEN, EDF R&D +# +# 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. +# +# 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 +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +include $(top_srcdir)/adm_local/unix/make_common_starter.am + +SUBDIRS = unix diff --git a/adm_local/unix/Makefile.am b/adm_local/unix/Makefile.am new file mode 100755 index 0000000..8473d5e --- /dev/null +++ b/adm_local/unix/Makefile.am @@ -0,0 +1,22 @@ +# Copyright (C) 2009-2012 CEA/DEN, EDF R&D +# +# 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. +# +# 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 +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +include $(top_srcdir)/adm_local/unix/make_common_starter.am + +SUBDIRS = config_files diff --git a/adm_local/unix/config_files/Makefile.am b/adm_local/unix/config_files/Makefile.am new file mode 100755 index 0000000..71cf40e --- /dev/null +++ b/adm_local/unix/config_files/Makefile.am @@ -0,0 +1,23 @@ +# Copyright (C) 2009-2012 CEA/DEN, EDF R&D +# +# 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. +# +# 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 +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +include $(top_srcdir)/adm_local/unix/make_common_starter.am + +dist_admlocalm4_DATA = \ + check_HEXABLOCKPLUGIN.m4 diff --git a/adm_local/unix/config_files/check_HEXABLOCKPLUGIN.m4 b/adm_local/unix/config_files/check_HEXABLOCKPLUGIN.m4 new file mode 100755 index 0000000..bb80030 --- /dev/null +++ b/adm_local/unix/config_files/check_HEXABLOCKPLUGIN.m4 @@ -0,0 +1,78 @@ +dnl Copyright (C) 2009-2012 CEA/DEN, EDF R&D +dnl +dnl This library is free software; you can redistribute it and/or +dnl modify it under the terms of the GNU Lesser General Public +dnl License as published by the Free Software Foundation; either +dnl version 2.1 of the License. +dnl +dnl This library is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +dnl Lesser General Public License for more details. +dnl +dnl You should have received a copy of the GNU Lesser General Public +dnl License along with this library; if not, write to the Free Software +dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +dnl +dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +dnl + +# Check availability of HEXABLOCKPLUGIN binary distribution +# +# Author : Lioka RAZAFINDRAZAKA (CEA) +#------------------------------------------------------------ + +AC_DEFUN([CHECK_HEXABLOCKPLUGIN],[ + +HEXABLOCKPLUGIN_LDFLAGS="" +HEXABLOCKPLUGIN_CXXFLAGS="" + +AC_CHECKING(for GHS3dPlugin) + +HEXABLOCKPLUGIN_ok=no + +AC_ARG_WITH(ghs, + --with-HEXABLOCKPlugin=DIR root directory path of HEXABLOCKPLUGIN build or installation, + HEXABLOCKPLUGIN_DIR="$withval",HEXABLOCKPLUGIN_DIR="") + +if test "x$HEXABLOCKPLUGIN_DIR" = "x" ; then + +# no --with-gui-dir option used + + if test "x$HEXABLOCKPLUGIN_ROOT_DIR" != "x" ; then + + # SALOME_ROOT_DIR environment variable defined + HEXABLOCKPLUGIN_DIR=$HEXABLOCKPLUGIN_ROOT_DIR + + else + + # search Salome binaries in PATH variable + AC_PATH_PROG(TEMP, libHexaBlockEngine.so) + if test "x$TEMP" != "x" ; then + HEXABLOCKPLUGIN_DIR=`dirname $TEMP` + fi + + fi + +fi + +if test -f ${HEXABLOCKPLUGIN_DIR}/lib/salome/libHexaBlockEngine.so ; then + HEXABLOCKPLUGIN_ok=yes + AC_MSG_RESULT(Using HEXABLOCKPLUGIN module distribution in ${HEXABLOCKPLUGIN_DIR}) + + if test "x$HEXABLOCKPLUGIN_ROOT_DIR" == "x" ; then + HEXABLOCKPLUGIN_ROOT_DIR=${HEXABLOCKPLUGIN_DIR} + fi + HEXABLOCKPLUGIN_CXXFLAGS+=-I${HEXABLOCKPLUGIN_ROOT_DIR}/include/salome + HEXABLOCKPLUGIN_LDFLAGS+=-L${HEXABLOCKPLUGIN_ROOT_DIR}/lib${LIB_LOCATION_SUFFIX}/salome + AC_SUBST(HEXABLOCKPLUGIN_ROOT_DIR) + AC_SUBST(HEXABLOCKPLUGIN_LDFLAGS) + AC_SUBST(HEXABLOCKPLUGIN_CXXFLAGS) +else + AC_MSG_WARN("Cannot find compiled HEXABLOCKPLUGIN module distribution") +fi + +AC_MSG_RESULT(for HEXABLOCKPLUGIN: $HEXABLOCKPLUGIN_ok) + +])dnl + diff --git a/adm_local/unix/make_common_starter.am b/adm_local/unix/make_common_starter.am new file mode 100755 index 0000000..ba9f279 --- /dev/null +++ b/adm_local/unix/make_common_starter.am @@ -0,0 +1,94 @@ +# Copyright (C) 2009-2012 CEA/DEN, EDF R&D +# +# 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. +# +# 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 +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +# ============================================================ +# The following is to avoid PACKAGE_... env variable +# redefinition compilation warnings +# ============================================================ +# +AM_CXXFLAGS = @KERNEL_CXXFLAGS@ -include SALOMEconfig.h +AM_CPPFLAGS = @KERNEL_CXXFLAGS@ -include SALOMEconfig.h + +# ============================================================ +# This file defines the common definitions used in several +# Makefile. This file must be included, if needed, by the file +# Makefile.am. +# ============================================================ +# Standard directory for installation +# +salomeincludedir = $(includedir)/salome +libdir = $(prefix)/lib@LIB_LOCATION_SUFFIX@/salome +bindir = $(prefix)/bin/salome +salomescriptdir = $(bindir) +salomepythondir = $(pythondir)/salome +salomepyexecdir = $(pyexecdir)/salome + +# Directory for installing idl files +salomeidldir = $(prefix)/idl/salome + +# Directory for installing resource files +salomeresdir = $(prefix)/share/salome/resources/@MODULE_NAME@ + +# Directories for installing admin files +admlocaldir = $(prefix)/adm_local +admlocalunixdir = $(admlocaldir)/unix +admlocalm4dir = $(admlocaldir)/unix/config_files + +# Shared modules installation directory +sharedpkgpythondir = $(salomepythondir)/shared_modules + +# Documentation directory +docdir = $(datadir)/doc/salome + +# common rules + +# meta object implementation files generation (moc) +%_moc.cxx: %.h + $(MOC) $< -o $@ + +# translation (*.qm) files generation (lrelease) +%.qm: %.ts + $(LRELEASE) $< -qm $@ + +# resource files generation (qrcc) +qrc_%.cxx: %.qrc + $(QRCC) $< -o $@ -name $(*F) + +# qt forms files generation (uic) +ui_%.h: %.ui + $(UIC) -o $@ $< + +# extra distributed files +EXTRA_DIST = $(MOC_FILES:%_moc.cxx=%.h) $(QRC_FILES:qrc_%.cxx=%.qrc) \ + $(UIC_FILES:ui_%.h=%.ui) $(nodist_salomeres_DATA:%.qm=%.ts) + +# customize clean operation +mostlyclean-local: + rm -f @builddir@/*_moc.cxx + rm -f @builddir@/*.qm + rm -f @builddir@/ui_*.h + rm -f @builddir@/qrc_*.cxx + +# tests +tests: unittest + +unittest: $(UNIT_TEST_PROG) + @if test "x$(UNIT_TEST_PROG)" != "x"; then \ + $(UNIT_TEST_PROG); \ + fi; diff --git a/bin/Makefile.am b/bin/Makefile.am new file mode 100755 index 0000000..18059c1 --- /dev/null +++ b/bin/Makefile.am @@ -0,0 +1,30 @@ +# Copyright (C) 2009-2012 CEA/DEN, EDF R&D +# +# 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. +# +# 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 +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +# -* Makefile *- +# Author : Lioka RAZAFINDRAZAKA (CEA) +# Module : HEXABLOCKPLUGIN +# +include $(top_srcdir)/adm_local/unix/make_common_starter.am + +# non-distributed files +nodist_salomescript_DATA = VERSION + +# distributed files +dist_salomescript_SCRIPTS = diff --git a/bin/VERSION.in b/bin/VERSION.in new file mode 100755 index 0000000..5d92d97 --- /dev/null +++ b/bin/VERSION.in @@ -0,0 +1,3 @@ +[SALOME HEXABLOCKPLUGIN] : @VERSION@ +[DEVELOPMENT] : @VERSION_DEV@ +[DESCRIPTION] : HEXABLOCK meshing plug-in for SALOME Mesh module diff --git a/build_configure b/build_configure new file mode 100755 index 0000000..e3d4f52 --- /dev/null +++ b/build_configure @@ -0,0 +1,138 @@ +#!/bin/bash +# Copyright (C) 2009-2012 CEA/DEN, EDF R&D +# +# 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. +# +# 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 +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +# Tool for updating list of .in file for the SALOME project +# and regenerating configure script +# Author : Lioka RAZAFINDRAZAKA (CEA) +# Date : 2010/11/08 +# $Header$ +# +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 GEOM_ROOT_DIR is set correctly + +if test ! -d "${GEOM_ROOT_DIR}"; then + echo "failed : GEOM_ROOT_DIR variable is not correct !" + exit +fi + +######################################################################## +# Test if the HEXABLOCK_ROOT_DIR is set correctly + +if test ! -d "${HEXABLOCK_ROOT_DIR}"; then + echo "failed : HEXABLOCK_ROOT_DIR variable is not correct !" + exit +fi + +######################################################################## +# Test if the MED_ROOT_DIR is set correctly + +if test ! -d "${MED_ROOT_DIR}"; then + echo "failed : MED_ROOT_DIR variable is not correct !" + exit +fi + +######################################################################## +# Test if the SMESH_ROOT_DIR is set correctly + +if test ! -d "${SMESH_ROOT_DIR}"; then + echo "failed : SMESH_ROOT_DIR variable is not correct !" + exit +fi + +cd ${CONF_DIR} +ABS_CONF_DIR=`pwd` + +####################################################################### + +# ____________________________________________________________________ +# aclocal creates the aclocal.m4 file from the standard macro and the +# custom macro embedded in the directory adm_local/unix/config_files +# and KERNEL config_files directory. +# output: +# aclocal.m4 +# autom4te.cache (directory) +echo "======================================================= aclocal" + +if test -d "${GUI_ROOT_DIR}"; then + aclocal -I adm_local/unix/config_files \ + -I ${KERNEL_ROOT_DIR}/salome_adm/unix/config_files \ + -I ${GUI_ROOT_DIR}/adm_local/unix/config_files \ + -I ${MED_ROOT_DIR}/adm_local/unix/config_files \ + -I ${GEOM_ROOT_DIR}/adm_local/unix/config_files \ + -I ${HEXABLOCK_ROOT_DIR}/adm_local/unix/config_files \ + -I ${SMESH_ROOT_DIR}/adm_local/unix/config_files || exit 1 +else + aclocal -I adm_local/unix/config_files \ + -I ${KERNEL_ROOT_DIR}/salome_adm/unix/config_files \ + -I ${MED_ROOT_DIR}/adm_local/unix/config_files \ + -I ${GEOM_ROOT_DIR}/adm_local/unix/config_files \ + -I ${HEXABLOCK_ROOT_DIR}/adm_local/unix/config_files \ + -I ${SMESH_ROOT_DIR}/adm_local/unix/config_files || exit 1 +fi + +# ____________________________________________________________________ +# libtoolize creates some configuration files (ltmain.sh, +# config.guess and config.sub). It only depends on the libtool +# version. The files are created in the directory specified with the +# AC_CONFIG_AUX_DIR() tag (see configure.ac). +# output: +# adm_local/unix/config_files/config.guess +# adm_local/unix/config_files/config.sub +# adm_local/unix/config_files/ltmain.sh +echo "==================================================== libtoolize" + +libtoolize --force --copy --automake || exit 1 + +# ____________________________________________________________________ +# autoconf creates the configure script from the file configure.ac (or +# configure.in if configure.ac doesn't exist) +# output: +# configure +echo "====================================================== autoconf" + +autoconf + +# ____________________________________________________________________ +# automake creates some scripts used in building process +# (install-sh, missing, ...). It only depends on the automake +# version. The files are created in the directory specified with the +# AC_CONFIG_AUX_DIR() tag (see configure.ac). This step also +# creates the Makefile.in files from the Makefile.am files. +# output: +# adm_local/unix/config_files/compile +# adm_local/unix/config_files/depcomp +# adm_local/unix/config_files/install-sh +# adm_local/unix/config_files/missing +# adm_local/unix/config_files/py-compile +# Makefile.in (from Makefile.am) +echo "====================================================== automake" + +automake --copy --gnu --add-missing diff --git a/clean_configure b/clean_configure new file mode 100755 index 0000000..a5d9070 --- /dev/null +++ b/clean_configure @@ -0,0 +1,25 @@ +#!/bin/sh +# Copyright (C) 2009-2012 CEA/DEN, EDF R&D +# +# 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. +# +# 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 +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +rm -rf autom4te.cache aclocal.m4 configure make_config +find . -name "*~" -print -exec rm {} \; +find . -name "*.pyc" -print -exec rm {} \; +find . -name Makefile.in | xargs rm -f +( cd adm_local/unix/config_files && rm -f config.* depcomp install-sh l*.m4 ltmain.sh missing py-compile ) diff --git a/configure.ac b/configure.ac new file mode 100755 index 0000000..1fec193 --- /dev/null +++ b/configure.ac @@ -0,0 +1,417 @@ +# Copyright (C) 2009-2012 CEA/DEN, EDF R&D +# +# 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. +# +# 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 +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +# 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 : Lioka RAZAFINDRAZAKA (CEA) +# Date : 2010/11/08 +# Modified by : Patrick GOLDBRONN (CEA) +# Modified by : Marc Tajchman (CEA) +# Created from configure.in.base +# +AC_INIT([Salome2 Project HEXABLOCKPLUGIN module],[6.5.0], [webmaster.salome@opencascade.com], [SalomeHEXABLOCKPLUGIN]) +AC_CONFIG_AUX_DIR(adm_local/unix/config_files) +AC_CANONICAL_HOST +AC_CANONICAL_TARGET +AM_INIT_AUTOMAKE([-Wno-portability]) + +XVERSION=`echo $VERSION | awk -F. '{printf("0x%02x%02x%02x",$1,$2,$3)}'` +AC_SUBST(XVERSION) +VERSION_DEV=0 +AC_SUBST(VERSION_DEV) + +# set up MODULE_NAME variable for dynamic construction of directories (resources, etc.) +MODULE_NAME=HEXABLOCKplugin +AC_SUBST(MODULE_NAME) + +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 + +AC_CHECK_PROG(SHELL,sh) +AC_SUBST(SHELL) + +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 +AC_LOCAL_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}/adm_local/unix/config_files/install-sh -c" + ;; +esac + +echo +echo --------------------------------------------- +echo testing C/C++ +echo --------------------------------------------- +echo + +cc_ok=no +dnl inutil car libtool +dnl AC_PROG_CC +AC_PROG_CXX +AC_CXX_WARNINGS +AC_CXX_TEMPLATE_OPTIONS +AC_DEPEND_FLAG +# AC_CC_WARNINGS([ansi]) +cc_ok=yes + +dnl Library libdl : +AC_CHECK_LIB(dl,dlopen) + +dnl Library librt : for alpha/osf +AC_CHECK_LIB(rt,nanosleep) + +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 + +dnl +dnl --------------------------------------------- +dnl testing MPICH +dnl --------------------------------------------- +dnl + +dnl CHECK_MPICH + +echo +echo --------------------------------------------- +echo testing MPI +echo --------------------------------------------- +echo + +CHECK_MPI + +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 + +AM_PATH_PYTHON(2.3) + +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 GUI +echo --------------------------------------------- +echo + +CHECK_GUI_MODULE + +gui_ok=no +if test "${SalomeGUI_need}" != "no" -a "${FullGUI_ok}" = "yes" ; then + gui_ok=yes +fi + +AM_CONDITIONAL(HEXABLOCKPLUGIN_ENABLE_GUI, [test "${gui_ok}" = "yes"]) + +if test "${SalomeGUI_need}" == "yes"; then + if test "${FullGUI_ok}" != "yes"; then + AC_MSG_WARN(For configure HEXABLOCKPLUGIN module necessary full GUI!) + fi +elif test "${SalomeGUI_need}" == "auto"; then + if test "${FullGUI_ok}" != "yes"; then + AC_MSG_WARN(Full GUI not found. Build will be done without GUI!) + fi +elif test "${SalomeGUI_need}" == "no"; then + echo Build without GUI option has been chosen +fi + +if test "${gui_ok}" = "yes"; then + + 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 +fi + +echo +echo --------------------------------------------- +echo Testing HDF5 +echo --------------------------------------------- +echo + +CHECK_HDF5 + +echo +echo --------------------------------------------- +echo BOOST Library +echo --------------------------------------------- +echo + +CHECK_BOOST + +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 Geom +echo --------------------------------------------- +echo + +CHECK_GEOM + +echo +echo --------------------------------------------- +echo Testing Med +echo --------------------------------------------- +echo + +CHECK_MED + +echo +echo --------------------------------------------- +echo Testing SMesh +echo --------------------------------------------- +echo + +CHECK_SMESH + +echo +echo --------------------------------------------- +echo Testing HEXABLOCK +echo --------------------------------------------- +echo + +CHECK_HEXABLOCK + +echo +echo --------------------------------------------- +echo Summary +echo --------------------------------------------- +echo + +echo Configure +if test "${gui_ok}" = "yes"; then + variables="cc_ok boost_ok threads_ok omniORB_ok occ_ok doxygen_ok OpenGL_ok qt_ok vtk_ok Kernel_ok gui_ok Geom_ok Med_ok SMesh_ok HEXABLOCK_ok" +elif test "${SalomeGUI_need}" != "no"; then + variables="cc_ok boost_ok threads_ok omniORB_ok occ_ok doxygen_ok Kernel_ok gui_ok Geom_ok Med_ok SMesh_ok HEXABLOCK_ok" +else + variables="cc_ok boost_ok threads_ok omniORB_ok occ_ok doxygen_ok Kernel_ok Geom_ok Med_ok SMesh_ok HEXABLOCK_ok" +fi + +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 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 +echo +echo --------------------------------------------- +echo generating Makefiles and configure files +echo --------------------------------------------- +echo + +AC_OUTPUT_COMMANDS([ \ + chmod +x ./bin/*; \ +]) + +# This list is initiated using autoscan and must be updated manually +# when adding a new file .in to manage. When you execute +# autoscan, the Makefile list is generated in the output file configure.scan. +# This could be helpfull to update de configuration. +AC_OUTPUT([ \ + adm_local/Makefile \ + adm_local/unix/Makefile \ + adm_local/unix/config_files/Makefile \ + bin/VERSION \ + bin/Makefile \ + HEXABLOCKPLUGIN_version.h \ + src/Makefile \ + src/HEXABLOCKPlugin/Makefile \ + src/GUI/Makefile \ + resources/Makefile \ + idl/Makefile \ + Makefile \ +]) diff --git a/env_HEXABLOCKPLUGIN_src.sh b/env_HEXABLOCKPLUGIN_src.sh new file mode 100644 index 0000000..4578c00 --- /dev/null +++ b/env_HEXABLOCKPLUGIN_src.sh @@ -0,0 +1,3 @@ +#------ HEXABLOCKPLUGIN_src ------ +export HEXABLOCKPLUGIN_SRC_DIR=${INST_ROOT}/HEXABLOCKPLUGIN_SRC_6.2.0 +## diff --git a/idl/HEXABLOCKPlugin_Algorithm.idl b/idl/HEXABLOCKPlugin_Algorithm.idl new file mode 100755 index 0000000..8250c3d --- /dev/null +++ b/idl/HEXABLOCKPlugin_Algorithm.idl @@ -0,0 +1,63 @@ +// Copyright (C) 2009-2012 CEA/DEN, EDF R&D +// +// 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. +// +// 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 +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +// File : HEXABLOCK_Algorithm.idl +// Author : Lioka RAZAFINDRAZAKA (CEA) +// $Header$ +// +#ifndef _HEXABLOCK_Algorithm_IDL_ +#define _HEXABLOCK_Algorithm_IDL_ + +#include "SALOME_Exception.idl" +#include "SMESH_Hypothesis.idl" + +#include "Document.idl" +/*! + * HEXABLOCKPlugin: interfaces to HEXABLOCK related hypotheses and algorithms + */ +module HEXABLOCKPlugin +{ + + /*! + * HEXABLOCKPlugin_HEXABLOCK: interface of "hexaBlock" algorithm + */ + interface HEXABLOCKPlugin_HEXABLOCK : SMESH::SMESH_3D_Algo + { + }; + + /*! + * Parameters of "HexaBlock" algorithm + */ + interface HEXABLOCKPlugin_Hypothesis : SMESH::SMESH_Hypothesis + { + /*! + * Define the document to be meshed, mandatory + */ + void SetDocument(in HEXABLOCK_ORB::Document doc); + HEXABLOCK_ORB::Document GetDocument(); + + /*! + * To define the hight dimension to generated: 3 = hexas, 2 = quads, 1 = segments, 0 = nodes + */ + void SetDimension(in long dim); + long GetDimension(); + }; +}; + +#endif diff --git a/idl/Makefile.am b/idl/Makefile.am new file mode 100755 index 0000000..9d5ca99 --- /dev/null +++ b/idl/Makefile.am @@ -0,0 +1,129 @@ +# Copyright (C) 2009-2012 CEA/DEN, EDF R&D +# +# 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. +# +# 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 +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +# This Makefile is responsible of generating the client and server +# implementation of IDL interfaces for both C++ and python usage. +# The building process of the C++ files is in charge of each source +# package and then is not manage here. +# +include $(top_srcdir)/adm_local/unix/make_common_starter.am + +BASEIDL_FILES = HEXABLOCKPlugin_Algorithm.idl + +BASEIDL_FILES_PY=$(BASEIDL_FILES:%.idl=%_idl.py) + +# This variable defines the files to be installed +dist_salomeidl_DATA = $(BASEIDL_FILES) + +# GUI idl common library +lib_LTLIBRARIES = libSalomeIDLHEXABLOCKPLUGIN.la + +# Sources built from idl files +nodist_libSalomeIDLHEXABLOCKPLUGIN_la_SOURCES = \ + HEXABLOCKPlugin_AlgorithmSK.cc \ + HEXABLOCKPlugin_AlgorithmDynSK.cc +HEXABLOCKPlugin_AlgorithmDynSK.cc: HEXABLOCKPlugin_AlgorithmSK.cc + +# header files must be exported: other modules have to use this library +nodist_salomeinclude_HEADERS = $(BASEIDL_FILES:%.idl=%.hh) + +libSalomeIDLHEXABLOCKPLUGIN_la_CPPFLAGS = \ + -I$(top_builddir)/idl \ + $(CORBA_CXXFLAGS) \ + $(CORBA_INCLUDES) \ + $(KERNEL_CXXFLAGS) \ + $(GEOM_CXXFLAGS) \ + $(HEXABLOCK_CXXFLAGS) \ + $(SMESH_CXXFLAGS) + +libSalomeIDLHEXABLOCKPLUGIN_la_LDFLAGS = -no-undefined -version-info=0:0:0 +libSalomeIDLHEXABLOCKPLUGIN_la_LIBADD = \ + $(KERNEL_LDFLAGS) -lSalomeIDLKernel \ + $(GEOM_LDFLAGS) -lSalomeIDLGEOM \ + $(HEXABLOCK_LDFLAGS) -lSalomeIDLHEXABLOCK \ + $(SMESH_LDFLAGS) -lSalomeIDLSMESH \ + @CORBA_LIBS@ + +# These variables defines the building process of CORBA files +OMNIORB_IDL = @OMNIORB_IDL@ +OMNIORB_IDLCXXFLAGS = @OMNIORB_IDLCXXFLAGS@ +OMNIORB_IDLPYFLAGS = \ + @OMNIORB_IDLPYFLAGS@ \ + -I$(top_builddir)/idl/salome \ + -I$(KERNEL_ROOT_DIR)/idl/salome \ + -I$(GEOM_ROOT_DIR)/idl/salome \ + -I$(HEXABLOCK_ROOT_DIR)/idl/salome \ + -I$(SMESH_ROOT_DIR)/idl/salome + +IDLCXXFLAGS = \ + -bcxx \ + @IDLCXXFLAGS@ \ + -I$(top_builddir)/idl/salome \ + -I$(KERNEL_ROOT_DIR)/idl/salome \ + -I$(GEOM_ROOT_DIR)/idl/salome \ + -I$(HEXABLOCK_ROOT_DIR)/idl/salome \ + -I$(SMESH_ROOT_DIR)/idl/salome +IDLPYFLAGS = \ + @IDLPYFLAGS@ \ + -I$(KERNEL_ROOT_DIR)/idl/salome \ + -I$(GEOM_ROOT_DIR)/idl/salome \ + -I$(HEXABLOCK_ROOT_DIR)/idl/salome \ + -I$(SMESH_ROOT_DIR)/idl/salome + +# potential problem on parallel make on the following - multiple outputs +SUFFIXES = .idl .hh SK.cc +.idlSK.cc: + $(OMNIORB_IDL) $(IDLCXXFLAGS) $(OMNIORB_IDLCXXFLAGS) $< +.idl.hh: + $(OMNIORB_IDL) $(IDLCXXFLAGS) $(OMNIORB_IDLCXXFLAGS) $< + +install-exec-local: $(BASEIDL_FILES:%=$(top_srcdir)/idl/%) + $(INSTALL) -d $(DESTDIR)$(salomepythondir) + ls $^ | while read file; do \ + $(OMNIORB_IDL) $(IDLPYFLAGS) -C$(DESTDIR)$(salomepythondir) $$file ; \ + done + +# we want to remove only staff generated for IDL files and nothing more +uninstall-local: + @for modulen in HEXABLOCKPlugin ; do \ + test -d $(DESTDIR)$(salomepythondir)/$${modulen} && echo "Removing $(DESTDIR)$(salomepythondir)/$${modulen}" && rm -rf $(DESTDIR)$(salomepythondir)/$${modulen} ; \ + test -d $(DESTDIR)$(salomepythondir)/$${modulen}__POA && echo "Removing $(DESTDIR)$(salomepythondir)/$${modulen}__POA" && rm -rf $(DESTDIR)$(salomepythondir)/$${modulen}__POA ; \ + done ; \ + for filen in $(BASEIDL_FILES_PY) ; do \ + echo "Removing $(DESTDIR)$(salomepythondir)/$${filen}" && rm -f $(DESTDIR)$(salomepythondir)/$${filen}* ; \ + done + +mostlyclean-local: + -rm -f *.hh *.cc .depidl + +# we use cpp to generate dependencies between idl files. +# option x c tells the preprocessor to consider idl as a c file. +# if an idl is modified, all idl dependencies are rebuilt + +.depidl: $(BASEIDL_FILES) + @echo "" > $@ + @for dep in $^ dummy; do \ + if [ $$dep != "dummy" ]; then \ + echo Building dependencies for $$dep; \ + $(CPP) $(C_DEPEND_FLAG) -x c -I$(srcdir) -I$(KERNEL_ROOT_DIR)/idl/salome -I$(GEOM_ROOT_DIR)/idl/salome -I$(HEXABLOCK_ROOT_DIR)/idl/salome -I$(SMESH_ROOT_DIR)/idl/salome $$dep 2>/dev/null | \ + sed 's/\.o/\SK.cc/' >>$@; \ + fi; \ + done ; + +-include .depidl diff --git a/resources/HEXABLOCKPlugin.xml b/resources/HEXABLOCKPlugin.xml new file mode 100755 index 0000000..a5c7c29 --- /dev/null +++ b/resources/HEXABLOCKPlugin.xml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/resources/Makefile.am b/resources/Makefile.am new file mode 100755 index 0000000..0e89788 --- /dev/null +++ b/resources/Makefile.am @@ -0,0 +1,36 @@ +# Copyright (C) 2009-2012 CEA/DEN, EDF R&D +# +# 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. +# +# 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 +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +# -* Makefile *- +# Author : Lioka RAZAFINDRAZAKA (CEA) +# Date : 2010/11/08 +# Modified by : Alexander BORODIN (OCN) - autotools usage +# $Header$ +# +include $(top_srcdir)/adm_local/unix/make_common_starter.am + +dist_salomeres_DATA = \ + HEXABLOCKPlugin.xml \ + SalomeApp.xml + +if HEXABLOCKPLUGIN_ENABLE_GUI + dist_salomeres_DATA += \ + mesh_hypo_HEXABLOCK.png \ + mesh_tree_hypo_HEXABLOCK.png +endif diff --git a/resources/SalomeApp.xml b/resources/SalomeApp.xml new file mode 100755 index 0000000..64e860a --- /dev/null +++ b/resources/SalomeApp.xml @@ -0,0 +1,29 @@ + + +
+ +
+
+ + +
+
diff --git a/resources/mesh_hypo_HEXABLOCK.png b/resources/mesh_hypo_HEXABLOCK.png new file mode 100755 index 0000000000000000000000000000000000000000..3fb67d507bc568b7a406c497e52e76a68b61262b GIT binary patch literal 616 zcmV-u0+;=XP)gk0*WI5 zYK&P=DhHv(ok~os#Qtm3x^86>yemH)59hsgylw%-5w$PvREIIfYF)Q-`fH7We5-B-}HkHZ%;m1IbZ_q{%pYlPG9F?n-(n>+z0&(EC&>c_wn@oZe_JbH65Rw zS9n*crw5Y(iX$o#pYX0S_t~=-@pm}yX>vn~;)vESZJs|7=D9u}E-L)$PGAMbK??wt za*0y8^e9MDc4CVqgi{EoO8^Rwc}@pa)+^iv9qxiIrfIC)J^UX_pJp>T<@kMCfK_W$ zb7gI-I<%g2zv*ZY>djVZ`}|7mE4psdQ$ z-6Y5-Q9-heuUp3sl~+H>~rToA)Pq!JRcbY~o};nfq4fXC4-u RA_a6VgQu&X%Q~loCIDO +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include + +#ifdef _DEBUG_ +static int MYDEBUG = 1; +#else +static int MYDEBUG = 0; +#endif + + +// tabs +enum { + STD_TAB = 0, + ADV_TAB, + ENF_VER_TAB +}; + +// Enforced vertices array columns +enum { + ENF_VER_X_COLUMN = 0, + ENF_VER_Y_COLUMN, + ENF_VER_Z_COLUMN, + ENF_VER_SIZE_COLUMN, + ENF_VER_NB_COLUMNS +}; + +// Enforced vertices inputs +enum { + ENF_VER_BTNS = 0, + ENF_VER_X_COORD, + ENF_VER_Y_COORD, + ENF_VER_Z_COORD, + ENF_VER_SIZE, + ENF_VER_VERTEX_BTN, + ENF_VER_SEPARATOR, + ENF_VER_REMOVE_BTN, +}; + +namespace { + +#ifdef WIN32 +#include +#else +#include +#endif + + int maxAvailableMemory() + { +#ifdef WIN32 + // See http://msdn.microsoft.com/en-us/library/aa366589.aspx + MEMORYSTATUSEX statex; + statex.dwLength = sizeof (statex); + int err = GlobalMemoryStatusEx (&statex); + if (err != 0) { + int totMB = + statex.ullTotalPhys / 1024 / 1024 + + statex.ullTotalPageFile / 1024 / 1024 + + statex.ullTotalVirtual / 1024 / 1024; + return (int) ( 0.7 * totMB ); + } +#else + struct sysinfo si; + int err = sysinfo( &si ); + if ( err == 0 ) { + int totMB = + si.totalram * si.mem_unit / 1024 / 1024 + + si.totalswap * si.mem_unit / 1024 / 1024 ; + return (int) ( 0.7 * totMB ); + } +#endif + return 0; + } +} + +class QDoubleValidator; + +// +// BEGIN DoubleLineEditDelegate +// + +DoubleLineEditDelegate::DoubleLineEditDelegate(QObject *parent) + : QItemDelegate(parent) +{ +} + +QWidget *DoubleLineEditDelegate::createEditor(QWidget *parent, + const QStyleOptionViewItem &/* option */, + const QModelIndex &/* index */) const +{ + QLineEdit *editor = new QLineEdit(parent); + editor->setValidator(new QDoubleValidator(parent)); + + return editor; +} + +void DoubleLineEditDelegate::setEditorData(QWidget *editor, + const QModelIndex &index) const +{ + QString value = index.model()->data(index, Qt::EditRole).toString(); + + QLineEdit *lineEdit = static_cast(editor); + lineEdit->setText(value); +} + +void DoubleLineEditDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, + const QModelIndex &index) const +{ + QLineEdit *lineEdit = static_cast(editor); + bool ok; + double value = lineEdit->text().toDouble(&ok); + + if (ok) { + model->setData(index, value, Qt::EditRole); + if(MYDEBUG) MESSAGE("Value " << value << " was set at index(" << index.row() << "," << index.column() << ")"); + } +} + +void DoubleLineEditDelegate::updateEditorGeometry(QWidget *editor, + const QStyleOptionViewItem &option, const QModelIndex &/* index */) const +{ + editor->setGeometry(option.rect); +} + +// +// END DoubleLineEditDelegate +// + +HEXABLOCKPluginGUI_HypothesisCreator::HEXABLOCKPluginGUI_HypothesisCreator( const QString& theHypType ) +: SMESHGUI_GenericHypothesisCreator( theHypType ) +{ +} + +HEXABLOCKPluginGUI_HypothesisCreator::~HEXABLOCKPluginGUI_HypothesisCreator() +{ +} + +QFrame* HEXABLOCKPluginGUI_HypothesisCreator::buildFrame() +{ + QFrame* fr = new QFrame( 0 ); + QVBoxLayout* lay = new QVBoxLayout( fr ); + lay->setMargin( 5 ); + lay->setSpacing( 0 ); + + // tab + QTabWidget* tab = new QTabWidget( fr ); + tab->setTabShape( QTabWidget::Rounded ); + tab->setTabPosition( QTabWidget::North ); + lay->addWidget( tab ); + + // basic parameters + myStdGroup = new QWidget(); + QGridLayout* aStdLayout = new QGridLayout( myStdGroup ); + aStdLayout->setSpacing( 6 ); + aStdLayout->setMargin( 11 ); + + int row = 0; + myName = 0; + if( isCreation() ) + { + aStdLayout->addWidget( new QLabel( tr( "SMESH_NAME" ), myStdGroup ), row, 0, 1, 1 ); + myName = new QLineEdit( myStdGroup ); + aStdLayout->addWidget( myName, row++, 1, 1, 1 ); + } + + myToMeshHolesCheck = new QCheckBox( tr( "HEXABLOCK_TO_MESH_HOLES" ), myStdGroup ); + aStdLayout->addWidget( myToMeshHolesCheck, row++, 0, 1, 2 ); + + aStdLayout->addWidget( new QLabel( tr( "HEXABLOCK_OPTIMIZATIOL_LEVEL" ), myStdGroup ), row, 0 ); + myOptimizationLevelCombo = new QComboBox( myStdGroup ); + aStdLayout->addWidget( myOptimizationLevelCombo, row++, 1, 1, 1 ); + + QStringList types; + types << tr( "LEVEL_NONE" ) << tr( "LEVEL_LIGHT" ) << tr( "LEVEL_MEDIUM" ) << tr( "LEVEL_STANDARDPLUS" ) << tr( "LEVEL_STRONG" ); + myOptimizationLevelCombo->addItems( types ); + + aStdLayout->setRowStretch( row, 5 ); + + // advanced parameters + myAdvGroup = new QWidget(); + QGridLayout* anAdvLayout = new QGridLayout( myAdvGroup ); + anAdvLayout->setSpacing( 6 ); + anAdvLayout->setMargin( 11 ); + + myMaximumMemoryCheck = new QCheckBox( tr( "MAX_MEMORY_SIZE" ), myAdvGroup ); + myMaximumMemorySpin = new QSpinBox( myAdvGroup ); + myMaximumMemorySpin->setMinimum( 1 ); + myMaximumMemorySpin->setMaximum( maxAvailableMemory() ); + myMaximumMemorySpin->setSingleStep( 10 ); + QLabel* aMegabyteLabel = new QLabel( tr( "MEGABYTE" ), myAdvGroup ); + + myInitialMemoryCheck = new QCheckBox( tr( "INIT_MEMORY_SIZE" ), myAdvGroup ); + myInitialMemorySpin = new QSpinBox( myAdvGroup ); + myInitialMemorySpin->setMinimum( 1 ); + myInitialMemorySpin->setMaximum( maxAvailableMemory() ); + myInitialMemorySpin->setSingleStep( 10 ); + QLabel* aMegabyteLabel2 = new QLabel( tr( "MEGABYTE" ), myAdvGroup ); + + QLabel* aWorkinDirLabel = new QLabel( tr( "WORKING_DIR" ), myAdvGroup ); + myWorkingDir = new QLineEdit( myAdvGroup ); + //myWorkingDir->setReadOnly( true ); + QPushButton* dirBtn = new QPushButton( tr( "SELECT_DIR" ), myAdvGroup ); + dirBtn->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) ); + + myKeepFiles = new QCheckBox( tr( "KEEP_WORKING_FILES" ), myAdvGroup ); + + QLabel* aVerboseLevelLabel = new QLabel( tr( "VERBOSE_LEVEL" ), myAdvGroup ); + myVerboseLevelSpin = new QSpinBox( myAdvGroup ); + myVerboseLevelSpin->setMinimum( 0 ); + myVerboseLevelSpin->setMaximum( 10 ); + myVerboseLevelSpin->setSingleStep( 1 ); + + myToCreateNewNodesCheck = new QCheckBox( tr( "TO_ADD_NODES" ), myAdvGroup ); + + myRemoveInitialCentralPointCheck = new QCheckBox( tr( "NO_INITIAL_CENTRAL_POINT" ), myAdvGroup ); + + myBoundaryRecoveryCheck = new QCheckBox( tr( "RECOVERY_VERSION" ), myAdvGroup ); + + myFEMCorrectionCheck = new QCheckBox( tr( "FEM_CORRECTION" ), myAdvGroup ); + + QLabel* aTextOptionLabel = new QLabel( tr( "TEXT_OPTION" ), myAdvGroup ); + myTextOption = new QLineEdit( myAdvGroup ); + + anAdvLayout->addWidget( myMaximumMemoryCheck, 0, 0, 1, 1 ); + anAdvLayout->addWidget( myMaximumMemorySpin, 0, 1, 1, 1 ); + anAdvLayout->addWidget( aMegabyteLabel, 0, 2, 1, 1 ); + anAdvLayout->addWidget( myInitialMemoryCheck, 1, 0, 1, 1 ); + anAdvLayout->addWidget( myInitialMemorySpin, 1, 1, 1, 1 ); + anAdvLayout->addWidget( aMegabyteLabel2, 1, 2, 1, 1 ); + anAdvLayout->addWidget( aWorkinDirLabel, 2, 0, 1, 1 ); + anAdvLayout->addWidget( myWorkingDir, 2, 1, 1, 2 ); + anAdvLayout->addWidget( dirBtn, 2, 3, 1, 1 ); + anAdvLayout->addWidget( myKeepFiles, 3, 0, 1, 4 ); + anAdvLayout->addWidget( aVerboseLevelLabel, 4, 0, 1, 1 ); + anAdvLayout->addWidget( myVerboseLevelSpin, 4, 1, 1, 1 ); + anAdvLayout->addWidget( myToCreateNewNodesCheck, 5, 0, 1, 4 ); + anAdvLayout->addWidget( myRemoveInitialCentralPointCheck, 6, 0, 1, 4 ); + anAdvLayout->addWidget( myBoundaryRecoveryCheck, 7, 0, 1, 4 ); + anAdvLayout->addWidget( myFEMCorrectionCheck, 8, 0, 1, 4 ); + anAdvLayout->addWidget( aTextOptionLabel, 9, 0, 1, 1 ); + anAdvLayout->addWidget( myTextOption, 9, 1, 1, 2 ); + + // Size Maps parameters + myEnfGroup = new QWidget(); + QGridLayout* anSmpLayout = new QGridLayout(myEnfGroup); + + mySmpModel = new QStandardItemModel(0, ENF_VER_NB_COLUMNS); + myEnforcedTableView = new QTableView(myEnfGroup); + myEnforcedTableView->setModel(mySmpModel); + myEnforcedTableView->setSortingEnabled(true); + myEnforcedTableView->setItemDelegateForColumn(ENF_VER_SIZE_COLUMN,new DoubleLineEditDelegate(this)); + anSmpLayout->addWidget(myEnforcedTableView, 1, 0, 9, 1); + QStringList enforcedHeaders; + enforcedHeaders << tr( "HEXABLOCK_ENF_VER_X_COLUMN" )<< tr( "HEXABLOCK_ENF_VER_Y_COLUMN" ) << tr( "HEXABLOCK_ENF_VER_Z_COLUMN" ) << tr( "HEXABLOCK_ENF_VER_SIZE_COLUMN" ); + mySmpModel->setHorizontalHeaderLabels(enforcedHeaders); + myEnforcedTableView->setAlternatingRowColors(true); + myEnforcedTableView->verticalHeader()->hide(); + myEnforcedTableView->horizontalHeader()->setResizeMode(QHeaderView::Stretch); + + QLabel* myXCoordLabel = new QLabel( tr( "HEXABLOCK_ENF_VER_X_LABEL" ), myEnfGroup ); + anSmpLayout->addWidget(myXCoordLabel, ENF_VER_X_COORD, 1, 1, 1); + myXCoord = new QLineEdit(myEnfGroup); + myXCoord->setValidator(new QDoubleValidator(myEnfGroup)); + anSmpLayout->addWidget(myXCoord, ENF_VER_X_COORD, 2, 1, 1); + QLabel* myYCoordLabel = new QLabel( tr( "HEXABLOCK_ENF_VER_Y_LABEL" ), myEnfGroup ); + anSmpLayout->addWidget(myYCoordLabel, ENF_VER_Y_COORD, 1, 1, 1); + myYCoord = new QLineEdit(myEnfGroup); + myYCoord->setValidator(new QDoubleValidator(myEnfGroup)); + anSmpLayout->addWidget(myYCoord, ENF_VER_Y_COORD, 2, 1, 1); + QLabel* myZCoordLabel = new QLabel( tr( "HEXABLOCK_ENF_VER_Z_LABEL" ), myEnfGroup ); + anSmpLayout->addWidget(myZCoordLabel, ENF_VER_Z_COORD, 1, 1, 1); + myZCoord = new QLineEdit(myEnfGroup); + myZCoord->setValidator(new QDoubleValidator(myEnfGroup)); + anSmpLayout->addWidget(myZCoord, ENF_VER_Z_COORD, 2, 1, 1); + QLabel* mySizeLabel = new QLabel( tr( "HEXABLOCK_ENF_VER_SIZE_LABEL" ), myEnfGroup ); + anSmpLayout->addWidget(mySizeLabel, ENF_VER_SIZE, 1, 1, 1); + mySizeValue = new QLineEdit(myEnfGroup); + mySizeValue->setValidator(new QDoubleValidator(myEnfGroup)); + anSmpLayout->addWidget(mySizeValue, ENF_VER_SIZE, 2, 1, 1); + + addVertexButton = new QPushButton(tr("HEXABLOCK_ENF_VER_VERTEX"),myEnfGroup); + anSmpLayout->addWidget(addVertexButton, ENF_VER_VERTEX_BTN, 1, 1, 2); + addVertexButton->setEnabled(false); + + QFrame *line = new QFrame(myEnfGroup); + line->setFrameShape(QFrame::HLine); + line->setFrameShadow(QFrame::Sunken); + anSmpLayout->addWidget(line, ENF_VER_SEPARATOR, 1, 1, 2); + + removeVertexButton = new QPushButton(tr("HEXABLOCK_ENF_VER_REMOVE"),myEnfGroup); + anSmpLayout->addWidget(removeVertexButton, ENF_VER_REMOVE_BTN, 1, 1, 2); + + // add tabs + tab->insertTab( STD_TAB, myStdGroup, tr( "SMESH_ARGUMENTS" ) ); + tab->insertTab( ADV_TAB, myAdvGroup, tr( "HEXABLOCK_ADV_ARGS" ) ); + tab->insertTab( ENF_VER_TAB, myEnfGroup, tr( "HEXABLOCK_ENFORCED_VERTICES" ) ); + tab->setCurrentIndex( STD_TAB ); + + // connections + connect( myMaximumMemoryCheck, SIGNAL( toggled( bool ) ), this, SLOT( updateWidgets() ) ); + connect( myInitialMemoryCheck, SIGNAL( toggled( bool ) ), this, SLOT( updateWidgets() ) ); + connect( myBoundaryRecoveryCheck, SIGNAL( toggled( bool ) ), this, SLOT( updateWidgets() ) ); + connect( dirBtn, SIGNAL( clicked() ), this, SLOT( onDirBtnClicked() ) ); + connect( myXCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( checkVertexIsDefined() ) ); + connect( myYCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( checkVertexIsDefined() ) ); + connect( myZCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( checkVertexIsDefined() ) ); + connect( mySizeValue, SIGNAL( textChanged(const QString&) ), this, SLOT( checkVertexIsDefined() ) ); + connect( this, SIGNAL( vertexDefined(bool) ), addVertexButton, SLOT( setEnabled(bool) ) ); + connect( addVertexButton, SIGNAL( clicked() ), this, SLOT( onVertexBtnClicked() ) ); + connect( removeVertexButton, SIGNAL( clicked() ), this, SLOT( onRemoveVertexBtnClicked() ) ); + + + + return fr; +} + +bool HEXABLOCKPluginGUI_HypothesisCreator::smpVertexExists(double x, double y, double z) const +{ + const int rowCount = mySmpModel->rowCount(); + for (int i=0 ; i < rowCount ; i++) { + double myX = mySmpModel->data(mySmpModel->index(i, ENF_VER_X_COLUMN)).toDouble(); + if (myX == x) { +// MESSAGE("Found x value " << x << " at row " << i); + double myY = mySmpModel->data(mySmpModel->index(i, ENF_VER_Y_COLUMN)).toDouble(); + if (myY == y) { +// MESSAGE("Found y value " << y << " at row " << i); + double myZ = mySmpModel->data(mySmpModel->index(i, ENF_VER_Z_COLUMN)).toDouble(); + if (myZ == z) { + if (MYDEBUG){ + MESSAGE("Found x value " << x << " at row " << i); + MESSAGE("Found y value " << y << " at row " << i); + MESSAGE("Found z value " << z << " at row " << i); + } + return true; + } + } + } + } +// MESSAGE("Not found x,y,z values: " << x << " " << y << " " << z); + return false; +} + +bool HEXABLOCKPluginGUI_HypothesisCreator::checkVertexIsDefined() +{ + bool val = (!myXCoord->text().isEmpty())&&(!myYCoord->text().isEmpty())&&(!myZCoord->text().isEmpty())&&(!mySizeValue->text().isEmpty()); + bool isDefined = val; + if (val) + isDefined = ! smpVertexExists(myXCoord->text().toDouble(),myYCoord->text().toDouble(),myZCoord->text().toDouble()); + + emit vertexDefined(isDefined); + return isDefined; +} + +void HEXABLOCKPluginGUI_HypothesisCreator::onVertexBtnClicked() +{ + if (MYDEBUG) MESSAGE("HEXABLOCKPluginGUI_HypothesisCreator::onVertexBtnClicked()"); + const int row = mySmpModel->rowCount() ; + double x = myXCoord->text().toDouble(); + double y = myYCoord->text().toDouble(); + double z = myZCoord->text().toDouble(); + double size = mySizeValue->text().toDouble(); + + if (smpVertexExists(x,y,z)) return; + +// double size = 10.0; + // ENF_VER_X_COLUMN + mySmpModel->setData(mySmpModel->index(row, ENF_VER_X_COLUMN),x); + mySmpModel->setItem( row, ENF_VER_X_COLUMN, new QStandardItem(QString::number(x)) ); + mySmpModel->item( row, ENF_VER_X_COLUMN )->setFlags( Qt::ItemIsSelectable ); + // ENF_VER_Y_COLUMN + mySmpModel->setData(mySmpModel->index(row, ENF_VER_Y_COLUMN),y); + mySmpModel->setItem( row, ENF_VER_Y_COLUMN, new QStandardItem(QString::number(y)) ); + mySmpModel->item( row, ENF_VER_Y_COLUMN )->setFlags( Qt::ItemIsSelectable ); + // ENF_VER_Z_COLUMN + mySmpModel->setData(mySmpModel->index(row, ENF_VER_Z_COLUMN),z); + mySmpModel->setItem( row, ENF_VER_Z_COLUMN, new QStandardItem(QString::number(z)) ); + mySmpModel->item( row, ENF_VER_Z_COLUMN )->setFlags( Qt::ItemIsSelectable ); + // ENF_VER_SIZE_COLUMN + mySmpModel->setData(mySmpModel->index(row, ENF_VER_SIZE_COLUMN),size); + mySmpModel->setItem( row, ENF_VER_SIZE_COLUMN, new QStandardItem(QString::number(size,'f')) ); + + myEnforcedTableView->clearSelection(); + myEnforcedTableView->scrollTo( mySmpModel->item( row, ENF_VER_SIZE_COLUMN )->index() ); + checkVertexIsDefined(); +} + +void HEXABLOCKPluginGUI_HypothesisCreator::onRemoveVertexBtnClicked() +{ + QList selectedRows; + QList selectedIndex = myEnforcedTableView->selectionModel()->selectedIndexes(); + int row; + QModelIndex index; + foreach( index, selectedIndex ) { + row = index.row(); + if ( !selectedRows.contains( row ) ) + selectedRows.append( row ); + } + qSort( selectedRows ); + QListIterator it( selectedRows ); + it.toBack(); + while ( it.hasPrevious() ) { + row = it.previous(); + if (MYDEBUG) MESSAGE("delete row #"<< row); + mySmpModel->removeRow(row ); + } + myEnforcedTableView->clearSelection(); +} +void HEXABLOCKPluginGUI_HypothesisCreator::onDirBtnClicked() +{ + QString dir = SUIT_FileDlg::getExistingDirectory( dlg(), myWorkingDir->text(), QString() ); + if ( !dir.isEmpty() ) + myWorkingDir->setText( dir ); +} + +void HEXABLOCKPluginGUI_HypothesisCreator::updateWidgets() +{ + myMaximumMemorySpin->setEnabled( myMaximumMemoryCheck->isChecked() ); + myInitialMemoryCheck->setEnabled( !myBoundaryRecoveryCheck->isChecked() ); + myInitialMemorySpin->setEnabled( myInitialMemoryCheck->isChecked() && !myBoundaryRecoveryCheck->isChecked() ); + myOptimizationLevelCombo->setEnabled( !myBoundaryRecoveryCheck->isChecked() ); +} + +bool HEXABLOCKPluginGUI_HypothesisCreator::checkParams(QString& msg) const +{ + if (MYDEBUG) MESSAGE("HEXABLOCKPluginGUI_HypothesisCreator::checkParams"); + + if ( !QFileInfo( myWorkingDir->text().trimmed() ).isWritable() ) { + SUIT_MessageBox::warning( dlg(), + tr( "SMESH_WRN_WARNING" ), + tr( "HEXABLOCK_PERMISSION_DENIED" ) ); + return false; + } + + return true; +} + +void HEXABLOCKPluginGUI_HypothesisCreator::retrieveParams() const +{ + if (MYDEBUG) MESSAGE("HEXABLOCKPluginGUI_HypothesisCreator::retrieveParams"); + HEXABLOCKHypothesisData data; + readParamsFromHypo( data ); + + if ( myName ) + myName->setText( data.myName ); + + myToMeshHolesCheck ->setChecked ( data.myToMeshHoles ); + myOptimizationLevelCombo ->setCurrentIndex( data.myOptimizationLevel ); + myMaximumMemoryCheck ->setChecked ( data.myMaximumMemory > 0 ); + myMaximumMemorySpin ->setValue ( qMax( data.myMaximumMemory, + myMaximumMemorySpin->minimum() )); + myInitialMemoryCheck ->setChecked ( data.myInitialMemory > 0 ); + myInitialMemorySpin ->setValue ( qMax( data.myInitialMemory, + myInitialMemorySpin->minimum() )); + myWorkingDir ->setText ( data.myWorkingDir ); + myKeepFiles ->setChecked ( data.myKeepFiles ); + myVerboseLevelSpin ->setValue ( data.myVerboseLevel ); + myToCreateNewNodesCheck ->setChecked ( data.myToCreateNewNodes ); + myRemoveInitialCentralPointCheck ->setChecked ( data.myRemoveInitialCentralPoint ); + myBoundaryRecoveryCheck ->setChecked ( data.myBoundaryRecovery ); + myFEMCorrectionCheck ->setChecked ( data.myFEMCorrection ); + myTextOption ->setText ( data.myTextOption ); + + TEnforcedVertexValues::const_iterator it; + int row = 0; + for(it = data.myEnforcedVertices.begin() ; it != data.myEnforcedVertices.end(); it++ ) + { + double x = it->at(0); + double y = it->at(1); + double z = it->at(2); + double size = it->at(3); + // ENF_VER_X_COLUMN + mySmpModel->setData(mySmpModel->index(row, ENF_VER_X_COLUMN),x); + mySmpModel->setItem( row, ENF_VER_X_COLUMN, new QStandardItem(QString::number(x)) ); + mySmpModel->item( row, ENF_VER_X_COLUMN )->setFlags( Qt::ItemIsSelectable ); + // ENF_VER_Y_COLUMN + mySmpModel->setData(mySmpModel->index(row, ENF_VER_Y_COLUMN),y); + mySmpModel->setItem( row, ENF_VER_Y_COLUMN, new QStandardItem(QString::number(y)) ); + mySmpModel->item( row, ENF_VER_Y_COLUMN )->setFlags( Qt::ItemIsSelectable ); + // ENF_VER_Z_COLUMN + mySmpModel->setData(mySmpModel->index(row, ENF_VER_Z_COLUMN),z); + mySmpModel->setItem( row, ENF_VER_Z_COLUMN, new QStandardItem(QString::number(z)) ); + mySmpModel->item( row, ENF_VER_Z_COLUMN )->setFlags( Qt::ItemIsSelectable ); + // ENF_VER_SIZE_COLUMN + mySmpModel->setData(mySmpModel->index(row, ENF_VER_SIZE_COLUMN),size); + mySmpModel->setItem( row, ENF_VER_SIZE_COLUMN, new QStandardItem(QString::number(size)) ); + + if (MYDEBUG) MESSAGE("Row " << row << ": (" << x << ","<< y << ","<< z << ") ="<< size); + row++; + } + + HEXABLOCKPluginGUI_HypothesisCreator* that = (HEXABLOCKPluginGUI_HypothesisCreator*)this; + that->updateWidgets(); +} + +QString HEXABLOCKPluginGUI_HypothesisCreator::storeParams() const +{ + if (MYDEBUG) MESSAGE("HEXABLOCKPluginGUI_HypothesisCreator::storeParams"); + HEXABLOCKHypothesisData data; + readParamsFromWidgets( data ); + storeParamsToHypo( data ); + + QString valStr = ""; + + if ( !data.myBoundaryRecovery ) + valStr = "-c " + QString::number( !data.myToMeshHoles ); + + if ( data.myOptimizationLevel >= 0 && data.myOptimizationLevel < 5 && !data.myBoundaryRecovery) { + const char* level[] = { "none" , "light" , "standard" , "standard+" , "strong" }; + valStr += " -o "; + valStr += level[ data.myOptimizationLevel ]; + } + if ( data.myMaximumMemory > 0 ) { + valStr += " -m "; + valStr += QString::number( data.myMaximumMemory ); + } + if ( data.myInitialMemory > 0 && !data.myBoundaryRecovery ) { + valStr += " -M "; + valStr += QString::number( data.myInitialMemory ); + } + valStr += " -v "; + valStr += QString::number( data.myVerboseLevel ); + + if ( !data.myToCreateNewNodes ) + valStr += " -p0"; + + if ( data.myRemoveInitialCentralPoint ) + valStr += " -no_initial_central_point"; + + if ( data.myBoundaryRecovery ) + valStr += " -C"; + + if ( data.myFEMCorrection ) + valStr += " -FEM"; + + valStr += " "; + valStr += data.myTextOption; + + valStr += " #BEGIN ENFORCED VERTICES#"; + // Add size map parameters storage + for (int i=0 ; irowCount() ; i++) { + valStr += " ("; + double x = mySmpModel->data(mySmpModel->index(i,ENF_VER_X_COLUMN)).toDouble(); + double y = mySmpModel->data(mySmpModel->index(i,ENF_VER_Y_COLUMN)).toDouble(); + double z = mySmpModel->data(mySmpModel->index(i,ENF_VER_Z_COLUMN)).toDouble(); + double size = mySmpModel->data(mySmpModel->index(i,ENF_VER_SIZE_COLUMN)).toDouble(); + valStr += QString::number( x ); + valStr += ","; + valStr += QString::number( y ); + valStr += ","; + valStr += QString::number( z ); + valStr += ")="; + valStr += QString::number( size ); + if (i!=mySmpModel->rowCount()-1) + valStr += ";"; + } + valStr += " #END ENFORCED VERTICES#"; + if (MYDEBUG) MESSAGE(valStr.toStdString()); + return valStr; +} + +bool HEXABLOCKPluginGUI_HypothesisCreator::readParamsFromHypo( HEXABLOCKHypothesisData& h_data ) const +{ + if (MYDEBUG) MESSAGE("HEXABLOCKPluginGUI_HypothesisCreator::readParamsFromHypo"); + HEXABLOCKPlugin::HEXABLOCKPlugin_Hypothesis_var h = + HEXABLOCKPlugin::HEXABLOCKPlugin_Hypothesis::_narrow( initParamsHypothesis() ); + + HypothesisData* data = SMESH::GetHypothesisData( hypType() ); + h_data.myName = isCreation() && data ? hypName() : ""; + + /* fkl to update: + h_data.myToMeshHoles = h->GetToMeshHoles(); + h_data.myMaximumMemory = h->GetMaximumMemory(); + h_data.myInitialMemory = h->GetInitialMemory(); + h_data.myInitialMemory = h->GetInitialMemory(); + h_data.myOptimizationLevel = h->GetOptimizationLevel(); + h_data.myKeepFiles = h->GetKeepFiles(); + h_data.myWorkingDir = h->GetWorkingDirectory(); + h_data.myVerboseLevel = h->GetVerboseLevel(); + h_data.myToCreateNewNodes = h->GetToCreateNewNodes(); + h_data.myRemoveInitialCentralPoint = h->GetToRemoveCentralPoint(); + h_data.myBoundaryRecovery = h->GetToUseBoundaryRecoveryVersion(); + h_data.myFEMCorrection = h->GetFEMCorrection(); + h_data.myTextOption = h->GetTextOption(); + + HEXABLOCKPlugin::HEXABLOCKEnforcedVertexList_var vertices = h->GetEnforcedVertices(); + MESSAGE("vertices->length(): " << vertices->length()); + h_data.myEnforcedVertices.clear(); + for (int i=0 ; ilength() ; i++) { + HEXABLOCKEnforcedVertex myVertex; + myVertex.push_back(vertices[i].x); + myVertex.push_back(vertices[i].y); + myVertex.push_back(vertices[i].z); + myVertex.push_back(vertices[i].size); + MESSAGE("Add enforced vertex ("<< myVertex[0] << ","<< myVertex[1] << ","<< myVertex[2] << ") ="<< myVertex[3]); + h_data.myEnforcedVertices.push_back(myVertex); + } + */ + + return true; +} + +bool HEXABLOCKPluginGUI_HypothesisCreator::storeParamsToHypo( const HEXABLOCKHypothesisData& h_data ) const +{ + if (MYDEBUG) MESSAGE("HEXABLOCKPluginGUI_HypothesisCreator::storeParamsToHypo"); + HEXABLOCKPlugin::HEXABLOCKPlugin_Hypothesis_var h = + HEXABLOCKPlugin::HEXABLOCKPlugin_Hypothesis::_narrow( hypothesis() ); + + bool ok = true; + try + { + if( isCreation() ) + SMESH::SetName( SMESH::FindSObject( h ), h_data.myName.toLatin1().constData() ); + + /* fkl to update: + if ( h->GetToMeshHoles() != h_data.myToMeshHoles ) // avoid duplication of DumpPython commands + h->SetToMeshHoles ( h_data.myToMeshHoles ); + if ( h->GetMaximumMemory() != h_data.myMaximumMemory ) + h->SetMaximumMemory ( h_data.myMaximumMemory ); + if ( h->GetInitialMemory() != h_data.myInitialMemory ) + h->SetInitialMemory ( h_data.myInitialMemory ); + if ( h->GetInitialMemory() != h_data.myInitialMemory ) + h->SetInitialMemory ( h_data.myInitialMemory ); + if ( h->GetOptimizationLevel() != h_data.myOptimizationLevel ) + h->SetOptimizationLevel( h_data.myOptimizationLevel ); + if ( h->GetKeepFiles() != h_data.myKeepFiles ) + h->SetKeepFiles ( h_data.myKeepFiles ); + if ( h->GetWorkingDirectory() != h_data.myWorkingDir ) + h->SetWorkingDirectory ( h_data.myWorkingDir.toLatin1().constData() ); + if ( h->GetVerboseLevel() != h_data.myVerboseLevel ) + h->SetVerboseLevel ( h_data.myVerboseLevel ); + if ( h->GetToCreateNewNodes() != h_data.myToCreateNewNodes ) + h->SetToCreateNewNodes( h_data.myToCreateNewNodes ); + if ( h->GetToRemoveCentralPoint() != h_data.myRemoveInitialCentralPoint ) + h->SetToRemoveCentralPoint( h_data.myRemoveInitialCentralPoint ); + if ( h->GetToUseBoundaryRecoveryVersion() != h_data.myBoundaryRecovery ) + h->SetToUseBoundaryRecoveryVersion( h_data.myBoundaryRecovery ); + if ( h->GetFEMCorrection() != h_data.myFEMCorrection ) + h->SetFEMCorrection( h_data.myFEMCorrection ); + if ( h->GetTextOption() != h_data.myTextOption ) + h->SetTextOption ( h_data.myTextOption.toLatin1().constData() ); + + int nbVertex = (int) h_data.myEnforcedVertices.size(); + HEXABLOCKPlugin::HEXABLOCKEnforcedVertexList_var vertexHyp = h->GetEnforcedVertices(); + int nbVertexHyp = vertexHyp->length(); + + MESSAGE("Store params for size maps: " << nbVertex << " enforced vertices"); + MESSAGE("h->GetEnforcedVertices()->length(): " << nbVertexHyp); + + // Some vertices were removed + if (nbVertex < nbVertexHyp) { +// if (nbVertex == 0) +// h->ClearEnforcedVertices(); +// else { + // iterate over vertices of hypo + for(int i = 0 ; i RemoveEnforcedVertex(x,y,z); + } +// } + } + + TEnforcedVertexValues::const_iterator it; + for(it = h_data.myEnforcedVertices.begin() ; it != h_data.myEnforcedVertices.end(); it++ ) { + double x = it->at(0); + double y = it->at(1); + double z = it->at(2); + double size = it->at(3); + MESSAGE("(" << x << ", " + << y << ", " + << z << ") = " + << size ); + double mySize; + try { + mySize = h->GetEnforcedVertex(x,y,z); + MESSAGE("Old size: " << mySize); + if (mySize != size) { + MESSAGE("Setting new size: " << size); + h->SetEnforcedVertex(x,y,z,size); + } + } + catch (...) { + MESSAGE("Setting new size: " << size); + h->SetEnforcedVertex(x,y,z,size); + } + } + */ + } + catch ( const SALOME::SALOME_Exception& ex ) + { + SalomeApp_Tools::QtCatchCorbaException( ex ); + ok = false; + } + return ok; +} + +bool HEXABLOCKPluginGUI_HypothesisCreator::readParamsFromWidgets( HEXABLOCKHypothesisData& h_data ) const +{ + if (MYDEBUG) MESSAGE("HEXABLOCKPluginGUI_HypothesisCreator::readParamsFromWidgets"); + h_data.myName = myName ? myName->text() : ""; + h_data.myToMeshHoles = myToMeshHolesCheck->isChecked(); + h_data.myMaximumMemory = myMaximumMemoryCheck->isChecked() ? myMaximumMemorySpin->value() : -1; + h_data.myInitialMemory = myInitialMemoryCheck->isChecked() ? myInitialMemorySpin->value() : -1; + h_data.myOptimizationLevel = myOptimizationLevelCombo->currentIndex(); + h_data.myKeepFiles = myKeepFiles->isChecked(); + h_data.myWorkingDir = myWorkingDir->text().trimmed(); + h_data.myVerboseLevel = myVerboseLevelSpin->value(); + h_data.myToCreateNewNodes = myToCreateNewNodesCheck->isChecked(); + h_data.myRemoveInitialCentralPoint = myRemoveInitialCentralPointCheck->isChecked(); + h_data.myBoundaryRecovery = myBoundaryRecoveryCheck->isChecked(); + h_data.myFEMCorrection = myFEMCorrectionCheck->isChecked(); + h_data.myTextOption = myTextOption->text(); + h_data.myEnforcedVertices.clear(); + + for (int i=0 ; irowCount() ; i++) { + HEXABLOCKEnforcedVertex myVertex; + myVertex.push_back(mySmpModel->data(mySmpModel->index(i,ENF_VER_X_COLUMN)).toDouble()); + myVertex.push_back(mySmpModel->data(mySmpModel->index(i,ENF_VER_Y_COLUMN)).toDouble()); + myVertex.push_back(mySmpModel->data(mySmpModel->index(i,ENF_VER_Z_COLUMN)).toDouble()); + myVertex.push_back(mySmpModel->data(mySmpModel->index(i,ENF_VER_SIZE_COLUMN)).toDouble()); + if (MYDEBUG) MESSAGE("Add new enforced vertex (" << myVertex[0] << ", " + << myVertex[1] << ", " + << myVertex[2] << ") = " + << myVertex[3]); + h_data.myEnforcedVertices.push_back(myVertex); + } + + return true; +} + +QString HEXABLOCKPluginGUI_HypothesisCreator::caption() const +{ + return tr( "HEXABLOCK_TITLE" ); +} + +QPixmap HEXABLOCKPluginGUI_HypothesisCreator::icon() const +{ + return SUIT_Session::session()->resourceMgr()->loadPixmap( "HEXABLOCKPlugin", tr( "ICON_DLG_HEXABLOCK_PARAMETERS" ) ); +} + +QString HEXABLOCKPluginGUI_HypothesisCreator::type() const +{ + return tr( "HEXABLOCK_HYPOTHESIS" ); +} + +QString HEXABLOCKPluginGUI_HypothesisCreator::helpPage() const +{ + return "HEXABLOCK_hypo_page.html"; +} + +//============================================================================= +/*! GetHypothesisCreator + * + */ +//============================================================================= +extern "C" +{ + HEXABLOCKPLUGINGUI_EXPORT + SMESHGUI_GenericHypothesisCreator* GetHypothesisCreator( const QString& aHypType ) + { + if ( aHypType == "HEXABLOCK_Parameters" ) + return new HEXABLOCKPluginGUI_HypothesisCreator( aHypType ); + return 0; + } +} diff --git a/src/GUI/HEXABLOCKPluginGUI_HypothesisCreator.h b/src/GUI/HEXABLOCKPluginGUI_HypothesisCreator.h new file mode 100755 index 0000000..d2ecc42 --- /dev/null +++ b/src/GUI/HEXABLOCKPluginGUI_HypothesisCreator.h @@ -0,0 +1,161 @@ +// Copyright (C) 2009-2012 CEA/DEN, EDF R&D +// +// 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. +// +// 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 +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +// HEXABLOCKPlugin GUI: GUI for plugged-in mesher HEXABLOCKPlugin +// File : HEXABLOCKPluginGUI_HypothesisCreator.h +// Author : Lioka RAZAFINDRAZAKA (CEA) +// Module : HEXABLOCKPlugin +// +#ifndef HEXABLOCKPLUGINGUI_HypothesisCreator_HeaderFile +#define HEXABLOCKPLUGINGUI_HypothesisCreator_HeaderFile + +#ifdef WIN32 + #if defined HEXABLOCKPluginGUI_EXPORTS + #define HEXABLOCKPLUGINGUI_EXPORT __declspec( dllexport ) + #else + #define HEXABLOCKPLUGINGUI_EXPORT __declspec( dllimport ) + #endif +#else + #define HEXABLOCKPLUGINGUI_EXPORT +#endif + +#include +// #include + +#include +#include +#include +#include CORBA_SERVER_HEADER(HEXABLOCKPlugin_Algorithm) + +class QWidget; +class QComboBox; +class QCheckBox; +class QLineEdit; +class QSpinBox; +class QStandardItemModel; +class QTableView; +class QHeaderView; +class QDoubleSpinBox; + +class LightApp_SelectionMgr; + +typedef std::vector HEXABLOCKEnforcedVertex; +typedef std::vector TEnforcedVertexValues; + +typedef struct +{ + bool myToMeshHoles,myKeepFiles,myToCreateNewNodes,myBoundaryRecovery,myFEMCorrection,myRemoveInitialCentralPoint; + int myMaximumMemory,myInitialMemory,myOptimizationLevel; + QString myName,myWorkingDir,myTextOption; + short myVerboseLevel; + TEnforcedVertexValues myEnforcedVertices; +} HEXABLOCKHypothesisData; + +/*! + \brief Class for creation of HEXABLOCK2D and HEXABLOCK3D hypotheses +*/ +class HEXABLOCKPLUGINGUI_EXPORT HEXABLOCKPluginGUI_HypothesisCreator : public SMESHGUI_GenericHypothesisCreator +{ + Q_OBJECT + +public: + HEXABLOCKPluginGUI_HypothesisCreator( const QString& ); + virtual ~HEXABLOCKPluginGUI_HypothesisCreator(); + + virtual bool checkParams(QString& msg) const; + virtual QString helpPage() const; + +protected: + virtual QFrame* buildFrame (); + virtual void retrieveParams() const; + virtual QString storeParams () const; + + virtual QString caption() const; + virtual QPixmap icon() const; + virtual QString type() const; + +protected slots: + void onDirBtnClicked(); + void updateWidgets(); + void onVertexBtnClicked(); + void onRemoveVertexBtnClicked(); + bool checkVertexIsDefined(); + +signals: + void vertexDefined(bool); + +private: + bool readParamsFromHypo( HEXABLOCKHypothesisData& ) const; + bool readParamsFromWidgets( HEXABLOCKHypothesisData& ) const; + bool storeParamsToHypo( const HEXABLOCKHypothesisData& ) const; + bool smpVertexExists(double, double, double) const; + +private: + QWidget* myStdGroup; + QLineEdit* myName; + QCheckBox* myToMeshHolesCheck; + QComboBox* myOptimizationLevelCombo; + + QWidget* myAdvGroup; + QCheckBox* myMaximumMemoryCheck; + QSpinBox* myMaximumMemorySpin; + QCheckBox* myInitialMemoryCheck; + QSpinBox* myInitialMemorySpin; + QLineEdit* myWorkingDir; + QCheckBox* myKeepFiles; + QSpinBox* myVerboseLevelSpin; + QCheckBox* myToCreateNewNodesCheck; + QCheckBox* myRemoveInitialCentralPointCheck; + QCheckBox* myBoundaryRecoveryCheck; + QCheckBox* myFEMCorrectionCheck; +QLineEdit* myTextOption; + + QWidget* myEnfGroup; + QStandardItemModel* mySmpModel; + QTableView* myEnforcedTableView; + QLineEdit* myXCoord; + QLineEdit* myYCoord; + QLineEdit* myZCoord; + QLineEdit* mySizeValue; + QPushButton* addVertexButton; + QPushButton* removeVertexButton; + + LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */ +// SVTK_Selector* mySelector; +}; + +class DoubleLineEditDelegate : public QItemDelegate +{ + Q_OBJECT + +public: + DoubleLineEditDelegate(QObject *parent = 0); + + QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, + const QModelIndex &index) const; + + void setEditorData(QWidget *editor, const QModelIndex &index) const; + void setModelData(QWidget *editor, QAbstractItemModel *model, + const QModelIndex &index) const; + + void updateEditorGeometry(QWidget *editor, + const QStyleOptionViewItem &option, const QModelIndex &index) const; +}; + +#endif diff --git a/src/GUI/HEXABLOCKPlugin_images.ts b/src/GUI/HEXABLOCKPlugin_images.ts new file mode 100755 index 0000000..2b8aff0 --- /dev/null +++ b/src/GUI/HEXABLOCKPlugin_images.ts @@ -0,0 +1,38 @@ + + + + + @default + + ICON_DLG_HEXABLOCK_PARAMETERS + mesh_hypo_HEXABLOCK.png + + + ICON_SMESH_TREE_ALGO_HEXABLOCK_3D + mesh_tree_hypo_HEXABLOCK.png + + + ICON_SMESH_TREE_HYPO_HEXABLOCK_Parameters + mesh_tree_hypo_HEXABLOCK.png + + + diff --git a/src/GUI/HEXABLOCKPlugin_msg_en.ts b/src/GUI/HEXABLOCKPlugin_msg_en.ts new file mode 100755 index 0000000..229650f --- /dev/null +++ b/src/GUI/HEXABLOCKPlugin_msg_en.ts @@ -0,0 +1,166 @@ + + + + + @default + + HEXABLOCK_ADV_ARGS + Advanced + + + HEXABLOCK_HYPOTHESIS + HEXABLOCK + + + HEXABLOCK_OPTIMIZATIOL_LEVEL + Optimization level + + + HEXABLOCK_PERMISSION_DENIED + Working directory is not writable + + + HEXABLOCK_STD_ARGS + Parameters + + + HEXABLOCK_TITLE + Hypothesis Construction + + + HEXABLOCK_TO_MESH_HOLES + To mesh holes + + + INIT_MEMORY_SIZE + Initial memory size + + + KEEP_WORKING_FILES + To keep working files + + + LEVEL_NONE + None + + + LEVEL_LIGHT + Light + + + LEVEL_MEDIUM + Medium (standard) + + + LEVEL_STANDARDPLUS + Standard+ + + + LEVEL_STRONG + Strong + + + MAX_MEMORY_SIZE + Maximum memory size + + + MEGABYTE + Megabytes + + + NO_INITIAL_CENTRAL_POINT + To remove initial central point + + + RECOVERY_VERSION + To use boundary recovery version + + + FEM_CORRECTION + To use FEM correction + + + SELECT_DIR + ... + + + TEXT_OPTION + Option as text + + + TO_ADD_NODES + To create new nodes + + + VERBOSE_LEVEL + Verbose level + + + WORKING_DIR + Working directory + + + HEXABLOCK_ENFORCED_VERTICES + Enforced vertices + + + HEXABLOCK_ENF_VER_X_COLUMN + X + + + HEXABLOCK_ENF_VER_Y_COLUMN + Y + + + HEXABLOCK_ENF_VER_Z_COLUMN + Z + + + HEXABLOCK_ENF_VER_SIZE_COLUMN + Size + + + HEXABLOCK_ENF_VER_X_LABEL + X: + + + HEXABLOCK_ENF_VER_Y_LABEL + Y: + + + HEXABLOCK_ENF_VER_Z_LABEL + Z: + + + HEXABLOCK_ENF_VER_SIZE_LABEL + Size: + + + HEXABLOCK_ENF_VER_VERTEX + Add enforced vertex + + + HEXABLOCK_ENF_VER_REMOVE + Remove vertex + + + diff --git a/src/GUI/Makefile.am b/src/GUI/Makefile.am new file mode 100755 index 0000000..e7f84d2 --- /dev/null +++ b/src/GUI/Makefile.am @@ -0,0 +1,67 @@ +# Copyright (C) 2009-2012 CEA/DEN, EDF R&D +# +# 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. +# +# 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 +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +# -* Makefile *- +# Author : Lioka RAZAFINDRAZAKA (CEA) +# Modified by : Alexander BORODIN (OCN) - autotools usage +# Module : HEXABLOCKPLUGIN +# Date : 2010/11/08 +# +include $(top_srcdir)/adm_local/unix/make_common_starter.am + +# header files +salomeinclude_HEADERS = + +# Libraries targets +lib_LTLIBRARIES = libHEXABLOCKPluginGUI.la + +dist_libHEXABLOCKPluginGUI_la_SOURCES = HEXABLOCKPluginGUI_HypothesisCreator.cxx + +MOC_FILES = HEXABLOCKPluginGUI_HypothesisCreator_moc.cxx +nodist_libHEXABLOCKPluginGUI_la_SOURCES= $(MOC_FILES) + +libHEXABLOCKPluginGUI_la_CPPFLAGS = \ + $(QT_INCLUDES) \ + $(KERNEL_CXXFLAGS) \ + $(GUI_CXXFLAGS) \ + $(GEOM_CXXFLAGS) \ + $(HEXABLOCK_CXXFLAGS) \ + $(MED_CXXFLAGS) \ + $(SMESH_CXXFLAGS) \ + $(BOOST_CPPFLAGS) \ + $(CORBA_CXXFLAGS) \ + $(CORBA_INCLUDES) \ + $(CAS_CPPFLAGS) \ + -I$(srcdir)/.. \ + -I$(top_builddir)/idl + +libHEXABLOCKPluginGUI_la_LDFLAGS = \ + ../../idl/libSalomeIDLHEXABLOCKPLUGIN.la \ + $(QT_LIBS) \ + $(KERNEL_LDFLAGS) -lSALOMELocalTrace \ + $(HEXABLOCK_LDFLAGS) -lSalomeIDLHEXABLOCK \ + $(MED_LDFLAGS) -lSalomeIDLMED \ + $(SMESH_LDFLAGS) -lSMESH \ + $(GUI_LDFLAGS) -lsuit -lqtx -lSalomeApp \ + $(CAS_KERNEL) + +# resources files +nodist_salomeres_DATA= \ + HEXABLOCKPlugin_images.qm \ + HEXABLOCKPlugin_msg_en.qm diff --git a/src/HEXABLOCKPlugin/HEXABLOCKPlugin_Defs.hxx b/src/HEXABLOCKPlugin/HEXABLOCKPlugin_Defs.hxx new file mode 100755 index 0000000..f2ed997 --- /dev/null +++ b/src/HEXABLOCKPlugin/HEXABLOCKPlugin_Defs.hxx @@ -0,0 +1,37 @@ +// Copyright (C) 2009-2012 CEA/DEN, EDF R&D +// +// 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. +// +// 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 +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +//============================================================================= +// File : HEXABLOCKPlugin_Defs.hxx +// Author : Lioka RAZAFINDRAZAKA (CEA) +// +#ifndef _HEXABLOCKPlugin_DEFS_HXX_ +#define _HEXABLOCKPlugin_DEFS_HXX_ + +#ifdef WIN32 + #if defined HEXABLOCKPLUGIN_EXPORTS || defined HEXABLOCKEngine_EXPORTS + #define HEXABLOCKPLUGIN_EXPORT __declspec( dllexport ) + #else + #define HEXABLOCKPLUGIN_EXPORT __declspec( dllimport ) + #endif +#else + #define HEXABLOCKPLUGIN_EXPORT +#endif + +#endif diff --git a/src/HEXABLOCKPlugin/HEXABLOCKPlugin_FromSkin_3D.cxx b/src/HEXABLOCKPlugin/HEXABLOCKPlugin_FromSkin_3D.cxx new file mode 100755 index 0000000..1dc0e31 --- /dev/null +++ b/src/HEXABLOCKPlugin/HEXABLOCKPlugin_FromSkin_3D.cxx @@ -0,0 +1,1580 @@ +// Copyright (C) 2009-2011 CEA/DEN, EDF R&D +// +// 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. +// +// 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 +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +// File : SMESH_HexaFromSkin_3D.cxx +// Created : Wed Jan 27 12:28:07 2010 +// Author : Edward AGAPOV (eap) +// +#include "HEXABLOCKPlugin_FromSkin_3D.hxx" + +#include "SMDS_VolumeOfNodes.hxx" +#include "SMDS_VolumeTool.hxx" +#include "SMESH_Block.hxx" +#include "SMESH_MesherHelper.hxx" + +#include + +//#include "utilities.h" +#include + +// Define error message and _MYDEBUG_ if needed +#ifdef _DEBUG_ +#define BAD_MESH_ERR \ + error(SMESH_Comment("Can't detect block-wise structure of the input 2D mesh.\n" \ + __FILE__ ":" )<<__LINE__) +//#define _MYDEBUG_ +#else +#define BAD_MESH_ERR \ + error(SMESH_Comment("Can't detect block-wise structure of the input 2D mesh")) +#endif + +// Debug output +#ifdef _MYDEBUG_ +#define _DUMP_(msg) cout << msg << endl +#else +#define _DUMP_(msg) +#endif + + +#ifdef _DEBUG_ +static int MYDEBUG = 1; +#else +static int MYDEBUG = 0; +#endif + + +namespace +{ + enum EBoxSides //!< sides of the block + { + B_BOTTOM=0, B_RIGHT, B_TOP, B_LEFT, B_FRONT, B_BACK, NB_BLOCK_SIDES + }; +#ifdef _MYDEBUG_ + const char* SBoxSides[] = //!< names of block sides + { + "BOTTOM", "RIGHT", "TOP", "LEFT", "FRONT", "BACK", "UNDEFINED" + }; +#endif + enum EQuadEdge //!< edges of quadrangle side + { + Q_BOTTOM = 0, Q_RIGHT, Q_TOP, Q_LEFT, NB_QUAD_SIDES + }; + + + //================================================================================ + /*! + * \brief return logical coordinates (i.e. min or max) of ends of edge + */ + //================================================================================ + + bool getEdgeEnds(EQuadEdge edge, bool& xMax1, bool& yMax1, bool& xMax2, bool& yMax2 ) + { + xMax1=0, yMax1=0, xMax2=1, yMax2=1; + switch( edge ) + { + case Q_BOTTOM: yMax2 = 0; break; + case Q_RIGHT: xMax1 = 1; break; + case Q_TOP: yMax1 = 1; break; + case Q_LEFT: xMax2 = 0; break; + default: + return false; + } + return true; + } + + //================================================================================ + /*! + * \brief return true if a node is at block corner + * + * This check is valid for simple cases only + */ + //================================================================================ + + bool isCornerNode( const SMDS_MeshNode* n ) + { + int nbF = n ? n->NbInverseElements( SMDSAbs_Face ) : 1; + if ( nbF % 2 ) + return true; + + set nodesInInverseFaces; + SMDS_ElemIteratorPtr fIt = n->GetInverseElementIterator(SMDSAbs_Face ); + while ( fIt->more() ) + { + const SMDS_MeshElement* face = fIt->next(); + nodesInInverseFaces.insert( face->begin_nodes(), face->end_nodes() ); + } + + return nodesInInverseFaces.size() != ( 6 + (nbF/2-1)*3 ); + } + + //================================================================================ + /*! + * \brief check element type + */ + //================================================================================ + + bool isQuadrangle(const SMDS_MeshElement* e) + { + return ( e && e->NbCornerNodes() == 4 ); + } + + //================================================================================ + /*! + * \brief return opposite node of a quadrangle face + */ + //================================================================================ + + const SMDS_MeshNode* oppositeNode(const SMDS_MeshElement* quad, int iNode) + { + return quad->GetNode( (iNode+2) % 4 ); + } + + //================================================================================ + /*! + * \brief Convertor of a pair of integers to a sole index + */ + struct _Indexer + { + int _xSize, _ySize; + _Indexer( int xSize=0, int ySize=0 ): _xSize(xSize), _ySize(ySize) {} + int size() const { return _xSize * _ySize; } + int operator()(int x, int y) const { return y * _xSize + x; } + }; + //================================================================================ + /*! + * \brief Oriented convertor of a pair of integers to a sole index + */ + class _OrientedIndexer : public _Indexer + { + public: + enum OriFlags //!< types of block side orientation + { + REV_X = 1, REV_Y = 2, SWAP_XY = 4, MAX_ORI = REV_X|REV_Y|SWAP_XY + }; + _OrientedIndexer( const _Indexer& indexer, const int oriFlags ): + _Indexer( indexer._xSize, indexer._ySize ), + _xSize (indexer._xSize), _ySize(indexer._ySize), + _xRevFun((oriFlags & REV_X) ? & reverse : & lazy), + _yRevFun((oriFlags & REV_Y) ? & reverse : & lazy), + _swapFun((oriFlags & SWAP_XY ) ? & swap : & lazy) + { + (*_swapFun)( _xSize, _ySize ); + } + //!< Return index by XY + int operator()(int x, int y) const + { + (*_xRevFun)( x, const_cast( _xSize )); + (*_yRevFun)( y, const_cast( _ySize )); + (*_swapFun)( x, y ); + return _Indexer::operator()(x,y); + } + //!< Return index for a corner + int corner(bool xMax, bool yMax) const + { + int x = xMax, y = yMax, size = 2; + (*_xRevFun)( x, size ); + (*_yRevFun)( y, size ); + (*_swapFun)( x, y ); + return _Indexer::operator()(x ? _Indexer::_xSize-1 : 0 , y ? _Indexer::_ySize-1 : 0); + } + int xSize() const { return _xSize; } + int ySize() const { return _ySize; } + private: + _Indexer _indexer; + int _xSize, _ySize; + + typedef void (*TFun)(int& x, int& y); + TFun _xRevFun, _yRevFun, _swapFun; + + static void lazy (int&, int&) {} + static void reverse(int& x, int& size) { x = size - x - 1; } + static void swap (int& x, int& y) { std::swap(x,y); } + }; + //================================================================================ + /*! + * \brief Structure corresponding to the meshed side of block + */ + struct _BlockSide + { + vector _grid; + _Indexer _index; + int _nbBlocksExpected; + int _nbBlocksFound; + +#ifdef _DEBUG_ // want to get SIGSEGV in case of invalid index +#define _grid_access_(pobj, i) pobj->_grid[ ((i) < pobj->_grid.size()) ? i : int(1e100)] +#else +#define _grid_access_(pobj, i) pobj->_grid[ i ] +#endif + //!< Return node at XY + const SMDS_MeshNode* getNode(int x, int y) const { return _grid_access_(this, _index( x,y ));} + //!< Set node at XY + void setNode(int x, int y, const SMDS_MeshNode* n) { _grid_access_(this, _index( x,y )) = n; } + //!< Return an edge + SMESH_OrientedLink getEdge(EQuadEdge edge) const + { + bool x1, y1, x2, y2; getEdgeEnds( edge, x1, y1, x2, y2 ); + return SMESH_OrientedLink( getCornerNode ( x1, y1 ), getCornerNode( x2, y2 )); + } + //!< Return a corner node + const SMDS_MeshNode* getCornerNode(bool isXMax, bool isYMax) const + { + return getNode( isXMax ? _index._xSize-1 : 0 , isYMax ? _index._ySize-1 : 0 ); + } + const SMDS_MeshElement* getCornerFace(const SMDS_MeshNode* cornerNode) const; + //!< True if all blocks this side belongs to have been found + bool isBound() const { return _nbBlocksExpected <= _nbBlocksFound; } + //!< Return coordinates of node at XY + gp_XYZ getXYZ(int x, int y) const { return SMESH_TNodeXYZ( getNode( x, y )); } + //!< Return gravity center of the four corners and the middle node + gp_XYZ getGC() const + { + gp_XYZ xyz = + getXYZ( 0, 0 ) + + getXYZ( _index._xSize-1, 0 ) + + getXYZ( 0, _index._ySize-1 ) + + getXYZ( _index._xSize-1, _index._ySize-1 ) + + getXYZ( _index._xSize/2, _index._ySize/2 ); + return xyz / 5; + } + //!< Return number of mesh faces + int getNbFaces() const { return (_index._xSize-1) * (_index._ySize-1); } + }; + //================================================================================ + /*! + * \brief _BlockSide with changed orientation + */ + struct _OrientedBlockSide + { + _BlockSide* _side; + _OrientedIndexer _index; + + _OrientedBlockSide( _BlockSide* side=0, const int oriFlags=0 ): + _side(side), _index(side ? side->_index : _Indexer(), oriFlags ) {} + //!< return coordinates by XY + gp_XYZ xyz(int x, int y) const + { + return SMESH_TNodeXYZ( _grid_access_(_side, _index( x, y )) ); + } + //!< safely return a node by XY + const SMDS_MeshNode* node(int x, int y) const + { + int i = _index( x, y ); + return ( i < 0 || i >= _side->_grid.size()) ? 0 : _side->_grid[i]; + } + //!< Return an edge + SMESH_OrientedLink edge(EQuadEdge edge) const + { + bool x1, y1, x2, y2; getEdgeEnds( edge, x1, y1, x2, y2 ); + return SMESH_OrientedLink( cornerNode ( x1, y1 ), cornerNode( x2, y2 )); + } + //!< Return a corner node + const SMDS_MeshNode* cornerNode(bool isXMax, bool isYMax) const + { + return _grid_access_(_side, _index.corner( isXMax, isYMax )); + } + //!< return its size in nodes + int getHoriSize() const { return _index.xSize(); } + int getVertSize() const { return _index.ySize(); } + //!< True if _side has been initialized + operator bool() const { return _side; } + //! Direct access to _side + const _BlockSide* operator->() const { return _side; } + _BlockSide* operator->() { return _side; } + }; + //================================================================================ + /*! + * \brief Meshed skin of block + */ + struct _Block + { + _OrientedBlockSide _side[6]; // 6 sides of a sub-block + set _corners; + + const _OrientedBlockSide& getSide(int i) const { return _side[i]; } + bool setSide( int i, const _OrientedBlockSide& s) + { + if (( _side[i] = s )) + { + _corners.insert( s.cornerNode(0,0)); + _corners.insert( s.cornerNode(1,0)); + _corners.insert( s.cornerNode(0,1)); + _corners.insert( s.cornerNode(1,1)); + } + return s; + } + void clear() { for (int i=0;i<6;++i) _side[i]=0; _corners.clear(); } + bool hasSide( const _OrientedBlockSide& s) const + { + if ( s ) for (int i=0;i<6;++i) if ( _side[i] && _side[i]._side == s._side ) return true; + return false; + } + int nbSides() const { int n=0; for (int i=0;i<6;++i) if ( _side[i] ) ++n; return n; } + bool isValid() const; + }; + //================================================================================ + /*! + * \brief Skin mesh possibly containing several meshed blocks + */ + class _Skin + { + public: + + int findBlocks(SMESH_Mesh& mesh); + //!< return i-th block + const _Block& getBlock(int i) const { return _blocks[i]; } + //!< return error description + const SMESH_Comment& error() const { return _error; } + + private: + bool fillSide( _BlockSide& side, + const SMDS_MeshElement* cornerQuad, + const SMDS_MeshNode* cornerNode); + bool fillRowsUntilCorner(const SMDS_MeshElement* quad, + const SMDS_MeshNode* n1, + const SMDS_MeshNode* n2, + vector& verRow1, + vector& verRow2, + bool alongN1N2 ); + _OrientedBlockSide findBlockSide( EBoxSides startBlockSide, + EQuadEdge sharedSideEdge1, + EQuadEdge sharedSideEdge2, + bool withGeometricAnalysis, + set< _BlockSide* >& sidesAround); + //!< update own data and data of the side bound to block + void setSideBoundToBlock( _BlockSide& side ) + { + if ( side._nbBlocksFound++, side.isBound() ) + for ( int e = 0; e < int(NB_QUAD_SIDES); ++e ) + _edge2sides[ side.getEdge( (EQuadEdge) e ) ].erase( &side ); + } + //!< store reason of error + int error(const SMESH_Comment& reason) { _error = reason; return 0; } + + SMESH_Comment _error; + + list< _BlockSide > _allSides; + vector< _Block > _blocks; + + //map< const SMDS_MeshNode*, set< _BlockSide* > > _corner2sides; + map< SMESH_OrientedLink, set< _BlockSide* > > _edge2sides; + }; + + //================================================================================ + /*! + * \brief Find and return number of submeshes corresponding to blocks + */ + //================================================================================ + + int _Skin::findBlocks(SMESH_Mesh& mesh) + { + SMESHDS_Mesh* meshDS = mesh.GetMeshDS(); + + // Find a node at any block corner + + SMDS_NodeIteratorPtr nIt = meshDS->nodesIterator(/*idInceasingOrder=*/true); + if ( !nIt->more() ) return error("Empty mesh"); + + const SMDS_MeshNode* nCorner = 0; + while ( nIt->more() ) + { + nCorner = nIt->next(); + if ( isCornerNode( nCorner )) + break; + else + nCorner = 0; + } + if ( !nCorner ) + return BAD_MESH_ERR; + + // -------------------------------------------------------------------- + // Find all block sides starting from mesh faces sharing the corner node + // -------------------------------------------------------------------- + + int nbFacesOnSides = 0; + TIDSortedElemSet cornerFaces; // corner faces of found _BlockSide's + list< const SMDS_MeshNode* > corners( 1, nCorner ); + list< const SMDS_MeshNode* >::iterator corner = corners.begin(); + while ( corner != corners.end() ) + { + SMDS_ElemIteratorPtr faceIt = (*corner)->GetInverseElementIterator( SMDSAbs_Face ); + while ( faceIt->more() ) + { + const SMDS_MeshElement* face = faceIt->next(); + if ( !cornerFaces.insert( face ).second ) + continue; // already loaded block side + + if ( !isQuadrangle( face )) + return error("Non-quadrangle elements in the input mesh"); + + if ( _allSides.empty() || !_allSides.back()._grid.empty() ) + _allSides.push_back( _BlockSide() ); + + _BlockSide& side = _allSides.back(); + if ( !fillSide( side, face, *corner ) ) + { + if ( !_error.empty() ) + return false; + } + else + { + for ( int isXMax = 0; isXMax < 2; ++isXMax ) + for ( int isYMax = 0; isYMax < 2; ++isYMax ) + { + const SMDS_MeshNode* nCorner = side.getCornerNode(isXMax,isYMax ); + corners.push_back( nCorner ); + cornerFaces.insert( side.getCornerFace( nCorner )); + } + for ( int e = 0; e < int(NB_QUAD_SIDES); ++e ) + _edge2sides[ side.getEdge( (EQuadEdge) e ) ].insert( &side ); + + nbFacesOnSides += side.getNbFaces(); + } + } + ++corner; + + // find block sides of other domains if any + if ( corner == corners.end() && nbFacesOnSides < mesh.NbQuadrangles() ) + { + while ( nIt->more() ) + { + nCorner = nIt->next(); + if ( isCornerNode( nCorner )) + corner = corners.insert( corner, nCorner ); + } + nbFacesOnSides = mesh.NbQuadrangles(); + } + } + + if ( _allSides.empty() ) + return BAD_MESH_ERR; + if ( _allSides.back()._grid.empty() ) + _allSides.pop_back(); + _DUMP_("Nb detected sides "<< _allSides.size()); + + // --------------------------- + // Organize sides into blocks + // --------------------------- + + // analyse sharing of sides by blocks and sort sides by nb of adjacent sides + int nbBlockSides = 0; // total nb of block sides taking into account their sharing + multimap sortedSides; + { + list < _BlockSide >::iterator sideIt = _allSides.begin(); + for ( ; sideIt != _allSides.end(); ++sideIt ) + { + _BlockSide& side = *sideIt; + bool isSharedSide = true; + int nbAdjacent = 0; + for ( int e = 0; e < int(NB_QUAD_SIDES) && isSharedSide; ++e ) + { + int nbAdj = _edge2sides[ side.getEdge( (EQuadEdge) e ) ].size(); + nbAdjacent += nbAdj; + isSharedSide = ( nbAdj > 2 ); + } + side._nbBlocksFound = 0; + side._nbBlocksExpected = isSharedSide ? 2 : 1; + nbBlockSides += side._nbBlocksExpected; + sortedSides.insert( make_pair( nbAdjacent, & side )); + } + } + + // find sides of each block + int nbBlocks = 0; + while ( nbBlockSides >= 6 ) + { + // get any side not bound to all blocks it belongs to + multimap::iterator i_side = sortedSides.begin(); + while ( i_side != sortedSides.end() && i_side->second->isBound()) + ++i_side; + + // start searching for block sides from the got side + bool ok = true; + if ( _blocks.empty() || _blocks.back()._side[B_FRONT] ) + _blocks.resize( _blocks.size() + 1 ); + + _Block& block = _blocks.back(); + block.setSide( B_FRONT, i_side->second ); + setSideBoundToBlock( *i_side->second ); + nbBlockSides--; + + // edges of adjacent sides of B_FRONT corresponding to front's edges + EQuadEdge edgeOfFront[4] = { Q_BOTTOM, Q_RIGHT, Q_TOP, Q_LEFT }; + EQuadEdge edgeOfAdj [4] = { Q_BOTTOM, Q_LEFT, Q_BOTTOM, Q_LEFT }; + // first find all sides detectable w/o advanced analysis, + // then repeat the search, which then may pass without advanced analysis + set< _BlockSide* > sidesAround; + for ( int advAnalys = 0; advAnalys < 2; ++advAnalys ) + { + // try to find 4 sides adjacent to a FRONT side + for ( int i = 0; (ok || !advAnalys) && i < NB_QUAD_SIDES; ++i ) + if ( !block._side[i] ) + ok = block.setSide( i, findBlockSide( B_FRONT, edgeOfFront[i], edgeOfAdj[i], + advAnalys, sidesAround)); + // try to find a BACK side by a TOP one + if ( ok || !advAnalys) + if ( !block._side[B_BACK] && block._side[B_TOP] ) + ok = block.setSide( B_BACK, findBlockSide( B_TOP, Q_TOP, Q_TOP, + advAnalys, sidesAround )); + if ( !advAnalys ) ok = true; + } + ok = block.isValid(); + if ( ok ) + { + // check if just found block is same as one of previously found blocks + bool isSame = false; + for ( int i = 1; i < _blocks.size() && !isSame; ++i ) + isSame = ( block._corners == _blocks[i-1]._corners ); + ok = !isSame; + } + + // count the found sides + _DUMP_(endl << "** Block " << _blocks.size() << " valid: " << block.isValid()); + for (int i = 0; i < NB_BLOCK_SIDES; ++i ) + { + _DUMP_("\tSide "<< SBoxSides[i] <<" "<< block._side[ i ]._side); + if ( block._side[ i ] ) + { + if ( ok && i != B_FRONT) + { + setSideBoundToBlock( *block._side[ i ]._side ); + nbBlockSides--; + } + _DUMP_("\t corners "<< + block._side[ i ].cornerNode(0,0)->GetID() << ", " << + block._side[ i ].cornerNode(1,0)->GetID() << ", " << + block._side[ i ].cornerNode(1,1)->GetID() << ", " << + block._side[ i ].cornerNode(0,1)->GetID() << ", "<GetNodeIndex( nCorner ); + const SMDS_MeshNode* nOnEdge = firstQuad->GetNode( (iCorner+1) % 4); + + // find out size of block side + vector horRow1, horRow2, verRow1, verRow2; + if ( !fillRowsUntilCorner( firstQuad, nCorner, nOnEdge, horRow1, horRow2, true ) || + !fillRowsUntilCorner( firstQuad, nCorner, nOnEdge, verRow1, verRow2, false )) + return false; + nbX = horRow1.size(), nbY = verRow1.size(); + + // store found nodes + side._index._xSize = horRow1.size(); + side._index._ySize = verRow1.size(); + side._grid.resize( side._index.size(), NULL ); + + for ( x = 0; x < horRow1.size(); ++x ) + { + side.setNode( x, 0, horRow1[x] ); + side.setNode( x, 1, horRow2[x] ); + } + for ( y = 0; y < verRow1.size(); ++y ) + { + side.setNode( 0, y, verRow1[y] ); + side.setNode( 1, y, verRow2[y] ); + } + } + // Find the rest nodes + + y = 1; // y of the row to fill + TIDSortedElemSet emptySet, avoidSet; + while ( ++y < nbY ) + { + // get next firstQuad in the next row of quadrangles + // + // n2up + // o---o <- y row + // | | + // o---o o o o o <- found nodes + //n1down n2down + // + int i1down, i2down, i2up; + const SMDS_MeshNode* n1down = side.getNode( 0, y-1 ); + const SMDS_MeshNode* n2down = side.getNode( 1, y-1 ); + avoidSet.clear(); avoidSet.insert( firstQuad ); + firstQuad = SMESH_MeshEditor::FindFaceInSet( n1down, n2down, emptySet, avoidSet, + &i1down, &i2down); + if ( !isQuadrangle( firstQuad )) + return BAD_MESH_ERR; + + const SMDS_MeshNode* n2up = oppositeNode( firstQuad, i1down ); + avoidSet.clear(); avoidSet.insert( firstQuad ); + + // find the rest nodes in the y-th row by faces in the row + + x = 1; + while ( ++x < nbX ) + { + const SMDS_MeshElement* quad = SMESH_MeshEditor::FindFaceInSet( n2up, n2down, emptySet, + avoidSet, &i2up, &i2down); + if ( !isQuadrangle( quad )) + return BAD_MESH_ERR; + + n2up = oppositeNode( quad, i2down ); + n2down = oppositeNode( quad, i2up ); + avoidSet.clear(); avoidSet.insert( quad ); + + side.setNode( x, y, n2up ); + } + } + + // check side validity + bool ok = + side.getCornerFace( side.getCornerNode( 0, 0 )) && + side.getCornerFace( side.getCornerNode( 1, 0 )) && + side.getCornerFace( side.getCornerNode( 0, 1 )) && + side.getCornerFace( side.getCornerNode( 1, 1 )); + + return ok; + } + + //================================================================================ + /*! + * \brief Return true if it's possible to make a loop over corner2Sides starting + * from the startSide + */ + //================================================================================ + + bool isClosedChainOfSides( _BlockSide* startSide, + map< const SMDS_MeshNode*, list< _BlockSide* > > & corner2Sides ) + { + // get start and end nodes + const SMDS_MeshNode *n1 = 0, *n2 = 0, *n; + for ( int y = 0; y < 2; ++y ) + for ( int x = 0; x < 2; ++x ) + { + n = startSide->getCornerNode(x,y); + if ( !corner2Sides.count( n )) continue; + if ( n1 ) + n2 = n; + else + n1 = n; + } + if ( !n2 ) return false; + + map< const SMDS_MeshNode*, list< _BlockSide* > >::iterator + c2sides = corner2Sides.find( n1 ); + if ( c2sides == corner2Sides.end() ) return false; + + int nbChainLinks = 1; + n = n1; + _BlockSide* prevSide = startSide; + while ( n != n2 ) + { + // get the next side sharing n + list< _BlockSide* > & sides = c2sides->second; + _BlockSide* nextSide = ( sides.back() == prevSide ? sides.front() : sides.back() ); + if ( nextSide == prevSide ) return false; + + // find the next corner of the nextSide being in corner2Sides + n1 = n; + n = 0; + for ( int y = 0; y < 2 && !n; ++y ) + for ( int x = 0; x < 2; ++x ) + { + n = nextSide->getCornerNode(x,y); + c2sides = corner2Sides.find( n ); + if ( n == n1 || c2sides == corner2Sides.end() ) + n = 0; + else + break; + } + if ( !n ) return false; + + prevSide = nextSide; + nbChainLinks++; + } + + return ( n == n2 && nbChainLinks == NB_QUAD_SIDES ); + } + + //================================================================================ + /*! + * \brief Try to find a block side adjacent to the given side by given edge + */ + //================================================================================ + + _OrientedBlockSide _Skin::findBlockSide( EBoxSides startBlockSide, + EQuadEdge sharedSideEdge1, + EQuadEdge sharedSideEdge2, + bool withGeometricAnalysis, + set< _BlockSide* >& sidesAround) + { + _Block& block = _blocks.back(); + _OrientedBlockSide& side1 = block._side[ startBlockSide ]; + + // get corner nodes of the given block edge + SMESH_OrientedLink edge = side1.edge( sharedSideEdge1 ); + const SMDS_MeshNode* n1 = edge.node1(); + const SMDS_MeshNode* n2 = edge.node2(); + if ( edge._reversed ) swap( n1, n2 ); + + // find all sides sharing both nodes n1 and n2 + set< _BlockSide* > sidesOnEdge = _edge2sides[ edge ]; // copy a set + + // exclude loaded sides of block from sidesOnEdge + for (int i = 0; i < NB_BLOCK_SIDES; ++i ) + if ( block._side[ i ] ) + sidesOnEdge.erase( block._side[ i ]._side ); + + int nbSidesOnEdge = sidesOnEdge.size(); + _DUMP_("nbSidesOnEdge "<< nbSidesOnEdge << " " << n1->GetID() << "-" << n2->GetID() ); + if ( nbSidesOnEdge == 0 ) + return 0; + + _BlockSide* foundSide = 0; + if ( nbSidesOnEdge == 1 ) + { + foundSide = *sidesOnEdge.begin(); + } + else + { + set< _BlockSide* >::iterator sideIt = sidesOnEdge.begin(); + int nbLoadedSides = block.nbSides(); + if ( nbLoadedSides > 1 ) + { + // Find the side having more than 2 corners common with already loaded sides + for (; !foundSide && sideIt != sidesOnEdge.end(); ++sideIt ) + { + _BlockSide* sideI = *sideIt; + int nbCommonCorners = + block._corners.count( sideI->getCornerNode(0,0)) + + block._corners.count( sideI->getCornerNode(1,0)) + + block._corners.count( sideI->getCornerNode(0,1)) + + block._corners.count( sideI->getCornerNode(1,1)); + if ( nbCommonCorners > 2 ) + foundSide = sideI; + } + } + + if ( !foundSide ) + { + if ( !withGeometricAnalysis ) + { + sidesAround.insert( sidesOnEdge.begin(), sidesOnEdge.end() ); + return 0; + } + if ( nbLoadedSides == 1 ) + { + // Issue 0021529. There are at least 2 sides by each edge and + // position of block gravity center is undefined. + // Find a side starting from which we can walk around the startBlockSide + + // fill in corner2Sides + map< const SMDS_MeshNode*, list< _BlockSide* > > corner2Sides; + for ( sideIt = sidesAround.begin(); sideIt != sidesAround.end(); ++sideIt ) + { + _BlockSide* sideI = *sideIt; + corner2Sides[ sideI->getCornerNode(0,0) ].push_back( sideI ); + corner2Sides[ sideI->getCornerNode(1,0) ].push_back( sideI ); + corner2Sides[ sideI->getCornerNode(0,1) ].push_back( sideI ); + corner2Sides[ sideI->getCornerNode(1,1) ].push_back( sideI ); + } + // remove corners of startBlockSide from corner2Sides + set::iterator nIt = block._corners.begin(); + for ( ; nIt != block._corners.end(); ++nIt ) + corner2Sides.erase( *nIt ); + + // select a side + for ( sideIt = sidesOnEdge.begin(); sideIt != sidesOnEdge.end(); ++sideIt ) + { + if ( isClosedChainOfSides( *sideIt, corner2Sides )) + { + foundSide = *sideIt; + break; + } + } + if ( !foundSide ) + return 0; + } + else + { + // Select one of found sides most close to startBlockSide + + gp_XYZ p1 ( n1->X(),n1->Y(),n1->Z()), p2 (n2->X(),n2->Y(),n2->Z()); + gp_Vec p1p2( p1, p2 ); + + const SMDS_MeshElement* face1 = side1->getCornerFace( n1 ); + gp_XYZ p1Op = SMESH_TNodeXYZ( oppositeNode( face1, face1->GetNodeIndex(n1))); + gp_Vec side1Dir( p1, p1Op ); + gp_Ax2 pln( p1, p1p2, side1Dir ); // plane with normal p1p2 and X dir side1Dir + _DUMP_(" Select adjacent for "<< side1._side << " - side dir (" + << side1Dir.X() << ", " << side1Dir.Y() << ", " << side1Dir.Z() << ")" ); + + map < double , _BlockSide* > angleOfSide; + for (sideIt = sidesOnEdge.begin(); sideIt != sidesOnEdge.end(); ++sideIt ) + { + _BlockSide* sideI = *sideIt; + const SMDS_MeshElement* faceI = sideI->getCornerFace( n1 ); + gp_XYZ p1Op = SMESH_TNodeXYZ( oppositeNode( faceI, faceI->GetNodeIndex(n1))); + gp_Vec sideIDir( p1, p1Op ); + // compute angle of (sideIDir projection to pln) and (X dir of pln) + gp_Vec2d sideIDirProj( sideIDir * pln.XDirection(), sideIDir * pln.YDirection()); + double angle = sideIDirProj.Angle( gp::DX2d() ); + if ( angle < 0 ) angle += 2. * M_PI; // angle [0-2*PI] + angleOfSide.insert( make_pair( angle, sideI )); + _DUMP_(" "<< sideI << " - side dir (" + << sideIDir.X() << ", " << sideIDir.Y() << ", " << sideIDir.Z() << ")" + << " angle " << angle); + } + + gp_XYZ gc(0,0,0); // gravity center of already loaded block sides + for (int i = 0; i < NB_BLOCK_SIDES; ++i ) + if ( block._side[ i ] ) + gc += block._side[ i ]._side->getGC(); + gc /= nbLoadedSides; + + gp_Vec gcDir( p1, gc ); + gp_Vec2d gcDirProj( gcDir * pln.XDirection(), gcDir * pln.YDirection()); + double gcAngle = gcDirProj.Angle( gp::DX2d() ); + foundSide = gcAngle < 0 ? angleOfSide.rbegin()->second : angleOfSide.begin()->second; + } + } + _DUMP_(" selected "<< foundSide ); + } + + // Orient the found side correctly + + // corners of found side corresponding to nodes n1 and n2 + bool xMax1, yMax1, xMax2, yMax2; + if ( !getEdgeEnds( sharedSideEdge2, xMax1, yMax1, xMax2, yMax2 )) + return error(SMESH_Comment("Internal error at ")<<__FILE__<<":"<<__LINE__), + _OrientedBlockSide(0); + + for ( int ori = 0; ori < _OrientedIndexer::MAX_ORI+1; ++ori ) + { + _OrientedBlockSide orientedSide( foundSide, ori ); + const SMDS_MeshNode* n12 = orientedSide.cornerNode( xMax1, yMax1); + const SMDS_MeshNode* n22 = orientedSide.cornerNode( xMax2, yMax2); + if ( n1 == n12 && n2 == n22 ) + return orientedSide; + } + error(SMESH_Comment("Failed to orient a block side found by edge ")<& row1, + vector& row2, + const bool alongN1N2 ) + { + const SMDS_MeshNode* corner1 = n1; + + // Store nodes of quad in the rows and find new n1 and n2 to get + // the next face so that new n2 is on block edge + int i1 = quad->GetNodeIndex( n1 ); + int i2 = quad->GetNodeIndex( n2 ); + row1.clear(); row2.clear(); + row1.push_back( n1 ); + if ( alongN1N2 ) + { + row1.push_back( n2 ); + row2.push_back( oppositeNode( quad, i2 )); + row2.push_back( n1 = oppositeNode( quad, i1 )); + } + else + { + row2.push_back( n2 ); + row1.push_back( n2 = oppositeNode( quad, i2 )); + row2.push_back( n1 = oppositeNode( quad, i1 )); + } + + if ( isCornerNode( row1[1] )) + return true; + + // Find the rest nodes + TIDSortedElemSet emptySet, avoidSet; + while ( !isCornerNode( n2 ) ) + { + avoidSet.clear(); avoidSet.insert( quad ); + quad = SMESH_MeshEditor::FindFaceInSet( n1, n2, emptySet, avoidSet, &i1, &i2 ); + if ( !isQuadrangle( quad )) + return BAD_MESH_ERR; + + row1.push_back( n2 = oppositeNode( quad, i1 )); + row2.push_back( n1 = oppositeNode( quad, i2 )); + } + return n1 != corner1; + } + + //================================================================================ + /*! + * \brief Return a corner face by a corner node + */ + //================================================================================ + + const SMDS_MeshElement* _BlockSide::getCornerFace(const SMDS_MeshNode* cornerNode) const + { + int x, y, isXMax, isYMax, found = 0; + for ( isXMax = 0; isXMax < 2; ++isXMax ) + { + for ( isYMax = 0; isYMax < 2; ++isYMax ) + { + x = isXMax ? _index._xSize-1 : 0; + y = isYMax ? _index._ySize-1 : 0; + found = ( getNode(x,y) == cornerNode ); + if ( found ) break; + } + if ( found ) break; + } + if ( !found ) return 0; + int dx = isXMax ? -1 : +1; + int dy = isYMax ? -1 : +1; + const SMDS_MeshNode* n1 = getNode(x,y); + const SMDS_MeshNode* n2 = getNode(x+dx,y); + const SMDS_MeshNode* n3 = getNode(x,y+dy); + const SMDS_MeshNode* n4 = getNode(x+dx,y+dy); + return SMDS_Mesh::FindFace(n1, n2, n3, n4 ); + } + + //================================================================================ + /*! + * \brief Checks own validity + */ + //================================================================================ + + bool _Block::isValid() const + { + bool ok = ( nbSides() == 6 ); + + // check only corners depending on side selection + EBoxSides adjacent[4] = { B_BOTTOM, B_RIGHT, B_TOP, B_LEFT }; + EQuadEdge edgeAdj [4] = { Q_TOP, Q_RIGHT, Q_TOP, Q_RIGHT }; + EQuadEdge edgeBack[4] = { Q_BOTTOM, Q_RIGHT, Q_TOP, Q_LEFT }; + + for ( int i=0; ok && i < NB_QUAD_SIDES; ++i ) + { + SMESH_OrientedLink eBack = _side[ B_BACK ].edge( edgeBack[i] ); + SMESH_OrientedLink eAdja = _side[ adjacent[i] ].edge( edgeAdj[i] ); + ok = ( eBack == eAdja ); + } + return ok; + } + +} // namespace + + + + + +HEXA_NS::Hexa* _block2Hexa( const _Block& block, + HEXA_NS::Document* doc, + std::map vertexNode ) +{ + const SMDS_MeshNode* n000 = block.getSide(B_BOTTOM).cornerNode( 0, 0 ); + const SMDS_MeshNode* n100 = block.getSide(B_BOTTOM).cornerNode( 1, 0 ); + const SMDS_MeshNode* n010 = block.getSide(B_BOTTOM).cornerNode( 0, 1 ); + const SMDS_MeshNode* n110 = block.getSide(B_BOTTOM).cornerNode( 1, 1 ); + const SMDS_MeshNode* n001 = block.getSide(B_TOP).cornerNode( 0, 0 ); + const SMDS_MeshNode* n101 = block.getSide(B_TOP).cornerNode( 1, 0 ); + const SMDS_MeshNode* n011 = block.getSide(B_TOP).cornerNode( 0, 1 ); + const SMDS_MeshNode* n111 = block.getSide(B_TOP).cornerNode( 1, 1 ); + + list nodeFromBlock; + nodeFromBlock.push_back(n000); + nodeFromBlock.push_back(n100); + nodeFromBlock.push_back(n010); + nodeFromBlock.push_back(n110); + nodeFromBlock.push_back(n001); + nodeFromBlock.push_back(n101); + nodeFromBlock.push_back(n011); + nodeFromBlock.push_back(n111); + nodeFromBlock.sort(); + + + HEXA_NS::Hexa* hexa = NULL; + int nHexa = doc->countUsedHexa(); + for (int j=0; j getUsedHexa(j); + list nodeFromHexa; + int nVx = hexa->countVertex(); + for ( int i=0; i getVertex(i); + const SMDS_MeshNode* n = vertexNode[v]; + nodeFromHexa.push_back(n); + } + nodeFromHexa.sort(); + + if ( nodeFromBlock == nodeFromHexa ){ +// std::cout << "OK block match hexa "<< hexa <<" id = "<getId()< > columns; + int x, xSize, y, ySize, z, zSize; + _Indexer colIndex; + + for ( int i = 0; i < nbBlocks; ++i ) + { + const _Block& block = skin.getBlock( i ); + + // ------------------------------------------ + // Fill columns of nodes with existing nodes + // ------------------------------------------ + + xSize = block.getSide(B_BOTTOM).getHoriSize(); + ySize = block.getSide(B_BOTTOM).getVertSize(); + zSize = block.getSide(B_FRONT ).getVertSize(); + int X = xSize - 1, Y = ySize - 1, Z = zSize - 1; + colIndex = _Indexer( xSize, ySize ); + columns.resize( colIndex.size() ); + + // fill node columns by front and back box sides + for ( x = 0; x < xSize; ++x ) { + vector< const SMDS_MeshNode* >& column0 = columns[ colIndex( x, 0 )]; + vector< const SMDS_MeshNode* >& column1 = columns[ colIndex( x, Y )]; + column0.resize( zSize ); + column1.resize( zSize ); + for ( z = 0; z < zSize; ++z ) { + column0[ z ] = block.getSide(B_FRONT).node( x, z ); + column1[ z ] = block.getSide(B_BACK) .node( x, z ); + } + } + // fill node columns by left and right box sides + for ( y = 1; y < ySize-1; ++y ) { + vector< const SMDS_MeshNode* >& column0 = columns[ colIndex( 0, y )]; + vector< const SMDS_MeshNode* >& column1 = columns[ colIndex( X, y )]; + column0.resize( zSize ); + column1.resize( zSize ); + for ( z = 0; z < zSize; ++z ) { + column0[ z ] = block.getSide(B_LEFT) .node( y, z ); + column1[ z ] = block.getSide(B_RIGHT).node( y, z ); + } + } + // get nodes from top and bottom box sides + for ( x = 1; x < xSize-1; ++x ) { + for ( y = 1; y < ySize-1; ++y ) { + vector< const SMDS_MeshNode* >& column = columns[ colIndex( x, y )]; + column.resize( zSize ); + column.front() = block.getSide(B_BOTTOM).node( x, y ); + column.back() = block.getSide(B_TOP) .node( x, y ); + } + } + + // ---------------------------- + // Add internal nodes of a box + // ---------------------------- + // projection points of internal nodes on box sub-shapes by which + // coordinates of internal nodes are computed + vector pointOnShape( SMESH_Block::ID_Shell ); + + // projections on vertices are constant + pointOnShape[ SMESH_Block::ID_V000 ] = block.getSide(B_BOTTOM).xyz( 0, 0 ); + pointOnShape[ SMESH_Block::ID_V100 ] = block.getSide(B_BOTTOM).xyz( X, 0 ); + pointOnShape[ SMESH_Block::ID_V010 ] = block.getSide(B_BOTTOM).xyz( 0, Y ); + pointOnShape[ SMESH_Block::ID_V110 ] = block.getSide(B_BOTTOM).xyz( X, Y ); + pointOnShape[ SMESH_Block::ID_V001 ] = block.getSide(B_TOP).xyz( 0, 0 ); + pointOnShape[ SMESH_Block::ID_V101 ] = block.getSide(B_TOP).xyz( X, 0 ); + pointOnShape[ SMESH_Block::ID_V011 ] = block.getSide(B_TOP).xyz( 0, Y ); + pointOnShape[ SMESH_Block::ID_V111 ] = block.getSide(B_TOP).xyz( X, Y ); + + for ( x = 1; x < xSize-1; ++x ) + { + gp_XYZ params; // normalized parameters of internal node within a unit box + params.SetCoord( 1, x / double(X) ); + for ( y = 1; y < ySize-1; ++y ) + { + params.SetCoord( 2, y / double(Y) ); + // column to fill during z loop + vector< const SMDS_MeshNode* >& column = columns[ colIndex( x, y )]; + // projections on horizontal edges + pointOnShape[ SMESH_Block::ID_Ex00 ] = block.getSide(B_BOTTOM).xyz( x, 0 ); + pointOnShape[ SMESH_Block::ID_Ex10 ] = block.getSide(B_BOTTOM).xyz( x, Y ); + pointOnShape[ SMESH_Block::ID_E0y0 ] = block.getSide(B_BOTTOM).xyz( 0, y ); + pointOnShape[ SMESH_Block::ID_E1y0 ] = block.getSide(B_BOTTOM).xyz( X, y ); + pointOnShape[ SMESH_Block::ID_Ex01 ] = block.getSide(B_TOP).xyz( x, 0 ); + pointOnShape[ SMESH_Block::ID_Ex11 ] = block.getSide(B_TOP).xyz( x, Y ); + pointOnShape[ SMESH_Block::ID_E0y1 ] = block.getSide(B_TOP).xyz( 0, y ); + pointOnShape[ SMESH_Block::ID_E1y1 ] = block.getSide(B_TOP).xyz( X, y ); + // projections on horizontal sides + pointOnShape[ SMESH_Block::ID_Fxy0 ] = block.getSide(B_BOTTOM).xyz( x, y ); + pointOnShape[ SMESH_Block::ID_Fxy1 ] = block.getSide(B_TOP) .xyz( x, y ); + for ( z = 1; z < zSize-1; ++z ) // z loop + { + params.SetCoord( 3, z / double(Z) ); + // projections on vertical edges + pointOnShape[ SMESH_Block::ID_E00z ] = block.getSide(B_FRONT).xyz( 0, z ); + pointOnShape[ SMESH_Block::ID_E10z ] = block.getSide(B_FRONT).xyz( X, z ); + pointOnShape[ SMESH_Block::ID_E01z ] = block.getSide(B_BACK).xyz( 0, z ); + pointOnShape[ SMESH_Block::ID_E11z ] = block.getSide(B_BACK).xyz( X, z ); + // projections on vertical sides + pointOnShape[ SMESH_Block::ID_Fx0z ] = block.getSide(B_FRONT).xyz( x, z ); + pointOnShape[ SMESH_Block::ID_Fx1z ] = block.getSide(B_BACK) .xyz( x, z ); + pointOnShape[ SMESH_Block::ID_F0yz ] = block.getSide(B_LEFT) .xyz( y, z ); + pointOnShape[ SMESH_Block::ID_F1yz ] = block.getSide(B_RIGHT).xyz( y, z ); + + // compute internal node coordinates + gp_XYZ coords; + SMESH_Block::ShellPoint( params, pointOnShape, coords ); + column[ z ] = aHelper->AddNode( coords.X(), coords.Y(), coords.Z() ); + +#ifdef DEB_GRID + // debug + //cout << "----------------------------------------------------------------------"<::max(); + bool isForw = true; + for ( int xMax = 0; xMax < 2; ++xMax ) + for ( int yMax = 0; yMax < 2; ++yMax ) + for ( int zMax = 0; zMax < 2; ++zMax ) + { + x = xMax ? xSize-1 : 1; + y = yMax ? ySize-1 : 1; + z = zMax ? zSize-1 : 1; + vector< const SMDS_MeshNode* >& col00 = columns[ colIndex( x-1, y-1 )]; + vector< const SMDS_MeshNode* >& col10 = columns[ colIndex( x , y-1 )]; + vector< const SMDS_MeshNode* >& col01 = columns[ colIndex( x-1, y )]; + vector< const SMDS_MeshNode* >& col11 = columns[ colIndex( x , y )]; + + const SMDS_MeshNode* n000 = col00[z-1]; + const SMDS_MeshNode* n100 = col10[z-1]; + const SMDS_MeshNode* n010 = col01[z-1]; + const SMDS_MeshNode* n110 = col11[z-1]; + const SMDS_MeshNode* n001 = col00[z]; + const SMDS_MeshNode* n101 = col10[z]; + const SMDS_MeshNode* n011 = col01[z]; + const SMDS_MeshNode* n111 = col11[z]; + SMDS_VolumeOfNodes probeVolume (n000,n010,n110,n100, + n001,n011,n111,n101); + SMDS_VolumeTool volTool( &probeVolume ); + double Nx=0.,Ny=0.,Nz=0.; + for ( int iFace = 0; iFace < volTool.NbFaces(); ++iFace ) + { + double nx,ny,nz; + volTool.GetFaceNormal( iFace, nx,ny,nz ); + Nx += nx; + Ny += ny; + Nz += nz; + } + double quality = Nx*Nx + Ny*Ny + Nz*Nz; + if ( quality < badness ) + { + badness = quality; + isForw = volTool.IsForward(); + } + } + + // add elements + for ( x = 0; x < xSize-1; ++x ) { + for ( y = 0; y < ySize-1; ++y ) { + vector< const SMDS_MeshNode* >& col00 = columns[ colIndex( x, y )]; + vector< const SMDS_MeshNode* >& col10 = columns[ colIndex( x+1, y )]; + vector< const SMDS_MeshNode* >& col01 = columns[ colIndex( x, y+1 )]; + vector< const SMDS_MeshNode* >& col11 = columns[ colIndex( x+1, y+1 )]; + // bottom face normal of a hexa mush point outside the volume + if ( isForw ) + for ( z = 0; z < zSize-1; ++z ) + aHelper->AddVolume(col00[z], col01[z], col11[z], col10[z], + col00[z+1], col01[z+1], col11[z+1], col10[z+1]); + else + for ( z = 0; z < zSize-1; ++z ) + aHelper->AddVolume(col00[z], col10[z], col11[z], col01[z], + col00[z+1], col10[z+1], col11[z+1], col01[z+1]); + } + } + } // loop on blocks + + return true; +} + + +//================================================================================ +/*! + * \brief Main method, which generates hexaheda + */ +//================================================================================ +bool SMESH_HexaFromSkin_3D::Compute( SMESH_Mesh & aMesh, SMESH_MesherHelper* aHelper, + std::map& volumesOnHexa, + std::map vertexNode ) + { + if(MYDEBUG) MESSAGE("SMESH_HexaFromSkin_3D::Compute BEGIN"); + _Skin skin; + int nbBlocks = skin.findBlocks(aMesh); + if ( nbBlocks == 0 ) + return error( skin.error()); + + vector< vector< const SMDS_MeshNode* > > columns; + int x, xSize, y, ySize, z, zSize; + _Indexer colIndex; + + for ( int i = 0; i < nbBlocks; ++i ) + { + const _Block& block = skin.getBlock( i ); + + // ------------------------------------------ + // Fill columns of nodes with existing nodes + // ------------------------------------------ + + xSize = block.getSide(B_BOTTOM).getHoriSize(); + ySize = block.getSide(B_BOTTOM).getVertSize(); + zSize = block.getSide(B_FRONT ).getVertSize(); + int X = xSize - 1, Y = ySize - 1, Z = zSize - 1; + colIndex = _Indexer( xSize, ySize ); + columns.resize( colIndex.size() ); + + // fill node columns by front and back box sides + for ( x = 0; x < xSize; ++x ) { + vector< const SMDS_MeshNode* >& column0 = columns[ colIndex( x, 0 )]; + vector< const SMDS_MeshNode* >& column1 = columns[ colIndex( x, Y )]; + column0.resize( zSize ); + column1.resize( zSize ); + for ( z = 0; z < zSize; ++z ) { + column0[ z ] = block.getSide(B_FRONT).node( x, z ); + column1[ z ] = block.getSide(B_BACK) .node( x, z ); + } + } + // fill node columns by left and right box sides + for ( y = 1; y < ySize-1; ++y ) { + vector< const SMDS_MeshNode* >& column0 = columns[ colIndex( 0, y )]; + vector< const SMDS_MeshNode* >& column1 = columns[ colIndex( X, y )]; + column0.resize( zSize ); + column1.resize( zSize ); + for ( z = 0; z < zSize; ++z ) { + column0[ z ] = block.getSide(B_LEFT) .node( y, z ); + column1[ z ] = block.getSide(B_RIGHT).node( y, z ); + } + } + // get nodes from top and bottom box sides + for ( x = 1; x < xSize-1; ++x ) { + for ( y = 1; y < ySize-1; ++y ) { + vector< const SMDS_MeshNode* >& column = columns[ colIndex( x, y )]; + column.resize( zSize ); + column.front() = block.getSide(B_BOTTOM).node( x, y ); + column.back() = block.getSide(B_TOP) .node( x, y ); + } + } + + // ---------------------------- + // Add internal nodes of a box + // ---------------------------- + // projection points of internal nodes on box subshapes by which + // coordinates of internal nodes are computed + vector pointOnShape( SMESH_Block::ID_Shell ); + + // projections on vertices are constant + pointOnShape[ SMESH_Block::ID_V000 ] = block.getSide(B_BOTTOM).xyz( 0, 0 ); + pointOnShape[ SMESH_Block::ID_V100 ] = block.getSide(B_BOTTOM).xyz( X, 0 ); + pointOnShape[ SMESH_Block::ID_V010 ] = block.getSide(B_BOTTOM).xyz( 0, Y ); + pointOnShape[ SMESH_Block::ID_V110 ] = block.getSide(B_BOTTOM).xyz( X, Y ); + pointOnShape[ SMESH_Block::ID_V001 ] = block.getSide(B_TOP).xyz( 0, 0 ); + pointOnShape[ SMESH_Block::ID_V101 ] = block.getSide(B_TOP).xyz( X, 0 ); + pointOnShape[ SMESH_Block::ID_V011 ] = block.getSide(B_TOP).xyz( 0, Y ); + pointOnShape[ SMESH_Block::ID_V111 ] = block.getSide(B_TOP).xyz( X, Y ); + + for ( x = 1; x < xSize-1; ++x ) + { + gp_XYZ params; // normalized parameters of internal node within a unit box + params.SetCoord( 1, x / double(X) ); + for ( y = 1; y < ySize-1; ++y ) + { + params.SetCoord( 2, y / double(Y) ); + // column to fill during z loop + vector< const SMDS_MeshNode* >& column = columns[ colIndex( x, y )]; + // projections on horizontal edges + pointOnShape[ SMESH_Block::ID_Ex00 ] = block.getSide(B_BOTTOM).xyz( x, 0 ); + pointOnShape[ SMESH_Block::ID_Ex10 ] = block.getSide(B_BOTTOM).xyz( x, Y ); + pointOnShape[ SMESH_Block::ID_E0y0 ] = block.getSide(B_BOTTOM).xyz( 0, y ); + pointOnShape[ SMESH_Block::ID_E1y0 ] = block.getSide(B_BOTTOM).xyz( X, y ); + pointOnShape[ SMESH_Block::ID_Ex01 ] = block.getSide(B_TOP).xyz( x, 0 ); + pointOnShape[ SMESH_Block::ID_Ex11 ] = block.getSide(B_TOP).xyz( x, Y ); + pointOnShape[ SMESH_Block::ID_E0y1 ] = block.getSide(B_TOP).xyz( 0, y ); + pointOnShape[ SMESH_Block::ID_E1y1 ] = block.getSide(B_TOP).xyz( X, y ); + // projections on horizontal sides + pointOnShape[ SMESH_Block::ID_Fxy0 ] = block.getSide(B_BOTTOM).xyz( x, y ); + pointOnShape[ SMESH_Block::ID_Fxy1 ] = block.getSide(B_TOP) .xyz( x, y ); + for ( z = 1; z < zSize-1; ++z ) // z loop + { + params.SetCoord( 3, z / double(Z) ); + // projections on vertical edges + pointOnShape[ SMESH_Block::ID_E00z ] = block.getSide(B_FRONT).xyz( 0, z ); + pointOnShape[ SMESH_Block::ID_E10z ] = block.getSide(B_FRONT).xyz( X, z ); + pointOnShape[ SMESH_Block::ID_E01z ] = block.getSide(B_BACK).xyz( 0, z ); + pointOnShape[ SMESH_Block::ID_E11z ] = block.getSide(B_BACK).xyz( X, z ); + // projections on vertical sides + pointOnShape[ SMESH_Block::ID_Fx0z ] = block.getSide(B_FRONT).xyz( x, z ); + pointOnShape[ SMESH_Block::ID_Fx1z ] = block.getSide(B_BACK) .xyz( x, z ); + pointOnShape[ SMESH_Block::ID_F0yz ] = block.getSide(B_LEFT) .xyz( y, z ); + pointOnShape[ SMESH_Block::ID_F1yz ] = block.getSide(B_RIGHT).xyz( y, z ); + + // compute internal node coordinates + gp_XYZ coords; + SMESH_Block::ShellPoint( params, pointOnShape, coords ); + column[ z ] = aHelper->AddNode( coords.X(), coords.Y(), coords.Z() ); + +#ifdef DEB_GRID + // debug + //cout << "----------------------------------------------------------------------"<& col00 = columns[ colIndex( x, y )]; + vector< const SMDS_MeshNode* >& col10 = columns[ colIndex( x+1, y )]; + vector< const SMDS_MeshNode* >& col01 = columns[ colIndex( x, y+1 )]; + vector< const SMDS_MeshNode* >& col11 = columns[ colIndex( x+1, y+1 )]; + // bottom face normal of a hexa mush point outside the volume + if ( isForw ) + for ( z = 0; z < zSize-1; ++z ){ + SMDS_MeshVolume* newVolume = + aHelper->AddVolume(col00[z], col01[z], col11[z], col10[z], + col00[z+1], col01[z+1], col11[z+1], col10[z+1]); + volumesOnBlock.push_back( newVolume ); + } + else + for ( z = 0; z < zSize-1; ++z ){ + SMDS_MeshVolume* newVolume = + aHelper->AddVolume(col00[z], col10[z], col11[z], col01[z], + col00[z+1], col10[z+1], col11[z+1], col01[z+1]); + volumesOnBlock.push_back( newVolume ); + } + } + } +// std::cout << "block i = " << i << std::endl; + HEXA_NS::Hexa* currentHexa = _block2Hexa( block, _doc, vertexNode ); + if ( currentHexa != NULL ){ +// std::cout<<"===== found ->"<"<& nbByType = aResMap[ aMesh.GetSubMesh( aShape )]; + if ( entity >= nbByType.size() ) + nbByType.resize( SMDSEntity_Last, 0 ); + + for ( int i = 0; i < nbBlocks; ++i ) + { + const _Block& block = skin.getBlock( i ); + + int nbX = block.getSide(B_BOTTOM).getHoriSize(); + int nbY = block.getSide(B_BOTTOM).getVertSize(); + int nbZ = block.getSide(B_FRONT ).getVertSize(); + + int nbHexa = (nbX-1) * (nbY-1) * (nbZ-1); + int nbNodes = (nbX-2) * (nbY-2) * (nbZ-2); + if ( secondOrder ) + nbNodes += + (nbX-2) * (nbY-2) * (nbZ-1) + + (nbX-2) * (nbY-1) * (nbZ-2) + + (nbX-1) * (nbY-2) * (nbZ-2); + + + nbByType[ entity ] += nbHexa; + nbByType[ SMDSEntity_Node ] += nbNodes; + } + + return true; +} + +//================================================================================ +/*! + * \brief Abstract method must be defined but does nothing + */ +//================================================================================ + +bool SMESH_HexaFromSkin_3D::CheckHypothesis(SMESH_Mesh&, const TopoDS_Shape&, + Hypothesis_Status& aStatus) +{ + aStatus = SMESH_Hypothesis::HYP_OK; + return true; +} + +//================================================================================ +/*! + * \brief Abstract method must be defined but just reports an error as this + * algo is not intended to work with shapes + */ +//================================================================================ + +bool SMESH_HexaFromSkin_3D::Compute(SMESH_Mesh&, const TopoDS_Shape&) +{ + return error("Algorithm can't work with geometrical shapes"); +} + + diff --git a/src/HEXABLOCKPlugin/HEXABLOCKPlugin_FromSkin_3D.hxx b/src/HEXABLOCKPlugin/HEXABLOCKPlugin_FromSkin_3D.hxx new file mode 100755 index 0000000..aac1fa8 --- /dev/null +++ b/src/HEXABLOCKPlugin/HEXABLOCKPlugin_FromSkin_3D.hxx @@ -0,0 +1,70 @@ +// Copyright (C) 2009-2012 CEA/DEN, EDF R&D +// +// 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. +// +// 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 +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +// File : SMESH_HexaFromSkin_3D.hxx +// Created : Wed Jan 27 12:23:21 2010 +// Author : Edward AGAPOV (eap) +// +#ifndef __SMESH_HexaFromSkin_3D_HXX__ +#define __SMESH_HexaFromSkin_3D_HXX__ + +#include "SMESH_StdMeshers.hxx" +#include "SMESH_3D_Algo.hxx" + +// from HexaBlocks +#include "hexa_base.hxx" +#include "HexDocument.hxx" +#include "HexVertex.hxx" +// #include "HexEdge.hxx" +// #include "HexQuad.hxx" +#include "HexHexa.hxx" +#include "HEXABLOCKPlugin_mesh.hxx" + +/*! + * \brief Alorithm generating hexahedral mesh from 2D skin of block + */ + +class STDMESHERS_EXPORT SMESH_HexaFromSkin_3D : public SMESH_3D_Algo +{ +public: +// SMESH_HexaFromSkin_3D(int hypId, int studyId, SMESH_Gen* gen); + SMESH_HexaFromSkin_3D(int hypId, int studyId, SMESH_Gen* gen, HEXA_NS::Document* doc); + virtual ~SMESH_HexaFromSkin_3D(); + + virtual bool Compute(SMESH_Mesh & aMesh, SMESH_MesherHelper* aHelper); + virtual bool Compute(SMESH_Mesh & aMesh, SMESH_MesherHelper* aHelper, + std::map& volumesOnHexa, + std::map vertexNode ); + + virtual bool CheckHypothesis(SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape, + Hypothesis_Status& aStatus); + + virtual bool Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape); + + virtual bool Evaluate(SMESH_Mesh & aMesh, + const TopoDS_Shape & aShape, + MapShapeNbElems& aResMap); + +private: + HEXA_NS::Document* _doc; + +}; + +#endif diff --git a/src/HEXABLOCKPlugin/HEXABLOCKPlugin_HEXABLOCK.cxx b/src/HEXABLOCKPlugin/HEXABLOCKPlugin_HEXABLOCK.cxx new file mode 100755 index 0000000..9c5fdca --- /dev/null +++ b/src/HEXABLOCKPlugin/HEXABLOCKPlugin_HEXABLOCK.cxx @@ -0,0 +1,403 @@ +// Copyright (C) 2009-2012 CEA/DEN, EDF R&D +// +// 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. +// +// 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 +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +//============================================================================= +// File : HEXABLOCKPlugin_HEXABLOCK.cxx +// Created : +// Author : Lioka RAZAFINDRAZAKA (CEA) +// Project : SALOME +// $Header$ +//============================================================================= +// +#include "HEXABLOCKPlugin_HEXABLOCK.hxx" +#include "HEXABLOCKPlugin_Hypothesis.hxx" + +#include "TopExp_Explorer.hxx" + +#include + +#include "SMESH_Gen.hxx" +#include "SMESH_Mesh.hxx" +#include "SMESH_MesherHelper.hxx" + +#include "HEXABLOCKPlugin_mesh.hxx" + +#include "HexQuad.hxx" +#include "HexEdge.hxx" +#include "HexVertex.hxx" +#include "HexPropagation.hxx" + +#include "utilities.h" + +using namespace std; + +#ifdef _DEBUG_ +static int MYDEBUG = 1; +#else +static int MYDEBUG = 0; +#endif + +//============================================================================= +/*! + * + */ +//============================================================================= + +HEXABLOCKPlugin_HEXABLOCK::HEXABLOCKPlugin_HEXABLOCK(int hypId, int studyId, SMESH_Gen* gen) + : SMESH_3D_Algo(hypId, studyId, gen) +{ + if(MYDEBUG) MESSAGE("HEXABLOCKPlugin_HEXABLOCK::HEXABLOCKPlugin_HEXABLOCK"); + _name = "HEXABLOCK_3D"; + _shapeType = (1 << TopAbs_SHELL) | (1 << TopAbs_SOLID);// 1 bit /shape type + _compatibleHypothesis.push_back("HEXABLOCK_Parameters"); + _requireShape = false; // can work without shape + _requireDiscreteBoundary = false; + _hyp = NULL; + _supportSubmeshes = false; + _iShape = 0; + _nbShape = 0; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +HEXABLOCKPlugin_HEXABLOCK::~HEXABLOCKPlugin_HEXABLOCK() +{ + if(MYDEBUG) MESSAGE("HEXABLOCKPlugin_HEXABLOCK::~HEXABLOCKPlugin_HEXABLOCK"); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +bool HEXABLOCKPlugin_HEXABLOCK::CheckHypothesis ( SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape, + Hypothesis_Status& aStatus ) +{ + aStatus = SMESH_Hypothesis::HYP_OK; + + // there is only one compatible Hypothesis so far + _hyp = 0; + const list & hyps = GetUsedHypothesis(aMesh, aShape); + if ( !hyps.empty() ) + _hyp = static_cast ( hyps.front() ); + + return true; +} + +//============================================================================= +/*! + *Here we are going to use the HEXABLOCK mesher + */ +//============================================================================= + +bool HEXABLOCKPlugin_HEXABLOCK::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape& theShape) { + if(MYDEBUG) MESSAGE("HEXABLOCKPlugin_HEXABLOCK::Compute with a shape"); + + SMESHDS_Mesh* meshDS = theMesh.GetMeshDS(); + if ( (_iShape == 0) && (_nbShape == 0) ) { + TopExp_Explorer expShape ( meshDS->ShapeToMesh(), TopAbs_SOLID ); + for ( ; expShape.More(); expShape.Next() ) { + _nbShape++; + } + } + + // to prevent from displaying error message after computing, + for ( int i = 0; i < _nbShape; ++i ) + if ( SMESH_subMesh* sm = theMesh.GetSubMeshContaining( theShape )) + { + SMESH_subMeshIteratorPtr smIt = sm->getDependsOnIterator(/*includeSelf=*/true, + /*complexShapeFirst=*/false); + while ( smIt->more() ) + { + sm = smIt->next(); + if ( !sm->IsMeshComputed() ) + sm->SetIsAlwaysComputed( true ); + } + } + + + _iShape++; + + if ( _iShape == _nbShape ) { + _nbShape = 0; + _iShape = 0; + + switch (_hyp->GetDimension()) { + case 0 : return( Compute0D(theMesh) ); + case 1 : return( Compute1D(theMesh) ); + case 2 : return( Compute2D(theMesh) ); + default: return( Compute3D(theMesh) ); + }; + } +} + +//============================================================================= +/*! + *Here we are going to use the HEXABLOCK mesher w/o geometry + */ +//============================================================================= + +bool HEXABLOCKPlugin_HEXABLOCK::Compute(SMESH_Mesh& theMesh, + SMESH_MesherHelper* aHelper) +{ + if(MYDEBUG) MESSAGE("HEXABLOCKPlugin_HEXABLOCK::Compute without a shape"); + + switch (_hyp->GetDimension()) { + case 0 : return( Compute0D(theMesh) ); + case 1 : return( Compute1D(theMesh) ); + case 2 : return( Compute2D(theMesh) ); + default: return( Compute3D(theMesh) ); + } +} + +//============================================================================= +/*! + * + */ +//============================================================================= +bool HEXABLOCKPlugin_HEXABLOCK::Evaluate(SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape, + MapShapeNbElems& aResMap) +{ + if(MYDEBUG) MESSAGE("HEXABLOCKPlugin_HEXABLOCK::Evaluate: do nothing"); + + return true; +} + +//============================================================================= +/*! + * Generate hexehedral + */ +//============================================================================= + +bool HEXABLOCKPlugin_HEXABLOCK::Compute3D(SMESH_Mesh& theMesh) { + if(MYDEBUG) MESSAGE("HEXABLOCKPlugin_HEXABLOCK::Compute 3D Begin"); + + SMESH_HexaBlocks hexaBuilder(theMesh); + + HEXA_NS::Document* doc = _hyp->GetDocument(); + // doc->reorderFaces (); // 0) Abu 06/03/2012 + + hexaBuilder.computeDoc(doc); + hexaBuilder.buildGroups(doc); + + if(MYDEBUG) MESSAGE("HEXABLOCKPlugin_HEXABLOCK::Compute 3D End"); + return true; +} + +//============================================================================= +/*! + * Generate quadrangles + */ +//============================================================================= + +bool HEXABLOCKPlugin_HEXABLOCK::Compute2D(SMESH_Mesh& theMesh) +{ + if(MYDEBUG) MESSAGE("HEXABLOCKPlugin_HEXABLOCK::Compute 2D"); + + HEXA_NS::Document* doc = _hyp->GetDocument(); + // doc->reorderFaces (); // 0) Abu 06/03/2012 + + SMESH_HexaBlocks hexaBuilder(theMesh); + + // A) Vertex computation + int nVertex = doc->countUsedVertex(); + HEXA_NS::Vertex* vertex = NULL; + for ( int j=0; j getUsedVertex(j); + hexaBuilder.computeVertex(*vertex); + }; + + // B) Edges computation + int nbPropa = 0; + HEXA_NS::Propagation* propa = NULL; + HEXA_NS::Law* law = NULL; + HEXA_NS::Edges edges; + + nbPropa = doc->countPropagation(); + for (int j=0; j < nbPropa; ++j ){ //Computing each edge's propagations of the document + propa = doc->getPropagation(j); + edges = propa->getEdges(); + law = propa->getLaw(); + if (law == NULL){ + law = doc->getLaw(0); // default law + }; + for( HEXA_NS::Edges::const_iterator iter = edges.begin(); iter != edges.end(); ++iter ) { + hexaBuilder.computeEdge(**iter, *law); + }; + }; + + // C) Quad computation + std::map quadWays = hexaBuilder.computeQuadWays(doc); + int nQuad = doc->countUsedQuad(); + HEXA_NS::Quad* quad = NULL; + for (int j=0; j getUsedQuad(j); + int id = quad->getId(); + if ( quadWays.count(quad) > 0 ) + hexaBuilder.computeQuad(*quad, quadWays[quad]); + else + if(MYDEBUG) MESSAGE("NO QUAD WAY ID = "<_is_nil() ) { +// SMESH_Mesh_i* aNewImpl = dynamic_cast( GetServant( aNewMesh ).in() ); +// Document_impl* docServant = dynamic_cast( GetServant( docIn ).in() ); +// ASSERT( aNewImpl ); +// ASSERT( docServant ); + +// HEXA_NS::Document* doc = docServant->GetImpl(); +// SMESH_HexaBlocks hexaBuilder(aNewImpl); + +// // A) Vertex computation +// int nVertex = doc->countVertex(); +// HEXA_NS::Vertex* vertex = NULL; +// for ( int j=0; j getUsedVertex(j); +// hexaBuilder.computeVertex(*vertex); +// } + +// // B) Edges computation +// int nbPropa = 0; +// HEXA_NS::Propagation* propa = NULL; +// HEXA_NS::Law* law = NULL; +// HEXA_NS::Edges edges; + +// nbPropa = doc->countPropagation(); +// for (int j=0; j < nbPropa; ++j ){//Computing each edge's propagations of the document +// propa = doc->getPropagation(j); +// edges = propa->getEdges(); +// law = propa->getLaw(); +// // ASSERT( law ); +// if (law == NULL){ +// law = doc->getLaw(0); // default law +// } +// for( HEXA_NS::Edges::const_iterator iter = edges.begin(); +// iter != edges.end(); +// ++iter ){ +// hexaBuilder.computeEdge(**iter, *law); +// } +// } + +// // C) Quad computation +// std::map quadWays = hexaBuilder.computeQuadWays(*doc); +// int nQuad = doc->countQuad(); +// HEXA_NS::Quad* quad = NULL; +// for (int j=0; j getQuad(j); +// int id = quad->getId(); +// if ( quadID == id and (quadWays.count(quad) > 0) ) +// hexaBuilder.computeQuad( *quad, quadWays[quad] ); + +// if ( quadWays.count(quad) == 0 ) +// if(MYDEBUG) MESSAGE("NO QUAD WAY ID = "<GetDocument(); + // doc->reorderFaces (); // 0) Abu 06/03/2012 + + SMESH_HexaBlocks hexaBuilder(theMesh); + + // A) Vertex computation + int nVertex = doc->countUsedVertex(); + HEXA_NS::Vertex* vertex = NULL; + for ( int j=0; j getUsedVertex(j); + hexaBuilder.computeVertex(*vertex); + }; + + // B) Edges computation + int nbPropa = 0; + HEXA_NS::Propagation* propa = NULL; + HEXA_NS::Law* law = NULL; + HEXA_NS::Edges edges; + + nbPropa = doc->countPropagation(); + for (int j=0; j < nbPropa; ++j ){//Computing each edge's propagations of the document + propa = doc->getPropagation(j); + edges = propa->getEdges(); + law = propa->getLaw(); + // ASSERT( law ); + if (law == NULL){ + law = doc->getLaw(0); // default law + }; + for( HEXA_NS::Edges::const_iterator iter = edges.begin(); iter != edges.end(); ++iter ) { + hexaBuilder.computeEdge(**iter, *law); + }; + }; + + // C) build Groups + hexaBuilder.buildGroups(doc); + + return true; +} + +bool HEXABLOCKPlugin_HEXABLOCK::Compute0D(SMESH_Mesh& theMesh) +{ + if(MYDEBUG) MESSAGE("HEXABLOCKPlugin_HEXABLOCK::Compute 0D"); + + HEXA_NS::Document* doc = _hyp->GetDocument(); + // doc->reorderFaces (); // 0) Abu 06/03/2012 + + SMESH_HexaBlocks hexaBuilder(theMesh); + + // A) Vertex computation + int nVertex = doc->countUsedVertex(); + HEXA_NS::Vertex* vertex = NULL; + for ( int j=0; j getUsedVertex(j); + hexaBuilder.computeVertex(*vertex); + }; + + // B) build Groups + hexaBuilder.buildGroups(doc); + + return true; +} diff --git a/src/HEXABLOCKPlugin/HEXABLOCKPlugin_HEXABLOCK.hxx b/src/HEXABLOCKPlugin/HEXABLOCKPlugin_HEXABLOCK.hxx new file mode 100755 index 0000000..5817a42 --- /dev/null +++ b/src/HEXABLOCKPlugin/HEXABLOCKPlugin_HEXABLOCK.hxx @@ -0,0 +1,66 @@ +// Copyright (C) 2009-2012 CEA/DEN, EDF R&D +// +// 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. +// +// 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 +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +//============================================================================= +// File : HEXABLOCKPlugin_HEXABLOCK.hxx +// Author : Lioka RAZAFINDRAZAKA (CEA) +// Project : SALOME +// $Header$ +//============================================================================= +// +#ifndef _HEXABLOCKPlugin_HEXABLOCK_HXX_ +#define _HEXABLOCKPlugin_HEXABLOCK_HXX_ + +#include "SMESH_3D_Algo.hxx" +#include "SMESH_Mesh.hxx" + +class SMESH_Mesh; +class HEXABLOCKPlugin_Hypothesis; + +class HEXABLOCKPlugin_HEXABLOCK: public SMESH_3D_Algo +{ +public: + HEXABLOCKPlugin_HEXABLOCK(int hypId, int studyId, SMESH_Gen* gen); + virtual ~HEXABLOCKPlugin_HEXABLOCK(); + + virtual bool CheckHypothesis(SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape, + Hypothesis_Status& aStatus); + + virtual bool Compute(SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape); + + virtual bool Evaluate(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape, + MapShapeNbElems& aResMap); + + virtual bool Compute(SMESH_Mesh& theMesh, + SMESH_MesherHelper* aHelper); + + bool Compute3D(SMESH_Mesh& aMesh); + bool Compute2D(SMESH_Mesh& aMesh); + bool Compute1D(SMESH_Mesh& aMesh); + bool Compute0D(SMESH_Mesh& aMesh); + +private: + const HEXABLOCKPlugin_Hypothesis* _hyp; + int _iShape; + int _nbShape; +}; + +#endif diff --git a/src/HEXABLOCKPlugin/HEXABLOCKPlugin_HEXABLOCK_i.cxx b/src/HEXABLOCKPlugin/HEXABLOCKPlugin_HEXABLOCK_i.cxx new file mode 100755 index 0000000..65428ab --- /dev/null +++ b/src/HEXABLOCKPlugin/HEXABLOCKPlugin_HEXABLOCK_i.cxx @@ -0,0 +1,88 @@ +// Copyright (C) 2009-2012 CEA/DEN, EDF R&D +// +// 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. +// +// 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 +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +// SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses +// File : HEXABLOCKPlugin_HEXABLOCK_i.cxx +// Author : Lioka RAZAFINDRAZAKA (CEA) +// Module : HEXABLOCKPlugin +// $Header$ +// +#include "HEXABLOCKPlugin_HEXABLOCK_i.hxx" +#include "SMESH_Gen.hxx" +#include "HEXABLOCKPlugin_HEXABLOCK.hxx" + +#include "utilities.h" + +#ifdef _DEBUG_ +static int MYDEBUG = 1; +#else +static int MYDEBUG = 0; +#endif + +using namespace std; + +//============================================================================= +/*! + * HEXABLOCKPlugin_HEXABLOCK_i::HEXABLOCKPlugin_HEXABLOCK_i + * + * Constructor + */ +//============================================================================= + +HEXABLOCKPlugin_HEXABLOCK_i::HEXABLOCKPlugin_HEXABLOCK_i (PortableServer::POA_ptr thePOA, + int theStudyId, + ::SMESH_Gen* theGenImpl ) + : SALOME::GenericObj_i( thePOA ), + SMESH_Hypothesis_i( thePOA ), + SMESH_Algo_i( thePOA ), + SMESH_3D_Algo_i( thePOA ) +{ + if(MYDEBUG) MESSAGE( "HEXABLOCKPlugin_HEXABLOCK_i::HEXABLOCKPlugin_HEXABLOCK_i" ); + myBaseImpl = new ::HEXABLOCKPlugin_HEXABLOCK (theGenImpl->GetANewId(), + theStudyId, + theGenImpl ); +} + +//============================================================================= +/*! + * HEXABLOCKPlugin_HEXABLOCK_i::~HEXABLOCKPlugin_HEXABLOCK_i + * + * Destructor + */ +//============================================================================= + +HEXABLOCKPlugin_HEXABLOCK_i::~HEXABLOCKPlugin_HEXABLOCK_i() +{ + if(MYDEBUG) MESSAGE( "HEXABLOCKPlugin_HEXABLOCK_i::~HEXABLOCKPlugin_HEXABLOCK_i" ); +} + +//============================================================================= +/*! + * HEXABLOCKPlugin_HEXABLOCK_i::GetImpl + * + * Get implementation + */ +//============================================================================= + +::HEXABLOCKPlugin_HEXABLOCK* HEXABLOCKPlugin_HEXABLOCK_i::GetImpl() +{ + if(MYDEBUG) MESSAGE( "HEXABLOCKPlugin_HEXABLOCK_i::GetImpl" ); + return ( ::HEXABLOCKPlugin_HEXABLOCK* )myBaseImpl; +} + diff --git a/src/HEXABLOCKPlugin/HEXABLOCKPlugin_HEXABLOCK_i.hxx b/src/HEXABLOCKPlugin/HEXABLOCKPlugin_HEXABLOCK_i.hxx new file mode 100755 index 0000000..b0ffdef --- /dev/null +++ b/src/HEXABLOCKPlugin/HEXABLOCKPlugin_HEXABLOCK_i.hxx @@ -0,0 +1,54 @@ +// Copyright (C) 2009-2012 CEA/DEN, EDF R&D +// +// 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. +// +// 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 +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +// File : HEXABLOCKPlugin_HEXABLOCK_i.hxx +// Author : Lioka RAZAFINDRAZAKA (CEA) +// Module : HEXABLOCKPlugin +// $Header$ +// +#ifndef _HEXABLOCKPlugin_HEXABLOCK_I_HXX_ +#define _HEXABLOCKPlugin_HEXABLOCK_I_HXX_ + +#include +#include CORBA_SERVER_HEADER(HEXABLOCKPlugin_Algorithm) +#include CORBA_SERVER_HEADER(SALOME_Exception) + +#include "SMESH_3D_Algo_i.hxx" +#include "HEXABLOCKPlugin_HEXABLOCK.hxx" + +// ====================================================== +// HEXABLOCK 3d algorithm +// ====================================================== +class HEXABLOCKPlugin_HEXABLOCK_i: + public virtual POA_HEXABLOCKPlugin::HEXABLOCKPlugin_HEXABLOCK, + public virtual SMESH_3D_Algo_i +{ +public: + // Constructor + HEXABLOCKPlugin_HEXABLOCK_i (PortableServer::POA_ptr thePOA, + int theStudyId, + ::SMESH_Gen* theGenImpl ); + // Destructor + virtual ~HEXABLOCKPlugin_HEXABLOCK_i(); + + // Get implementation + ::HEXABLOCKPlugin_HEXABLOCK* GetImpl(); +}; + +#endif diff --git a/src/HEXABLOCKPlugin/HEXABLOCKPlugin_Hypothesis.cxx b/src/HEXABLOCKPlugin/HEXABLOCKPlugin_Hypothesis.cxx new file mode 100755 index 0000000..c13474f --- /dev/null +++ b/src/HEXABLOCKPlugin/HEXABLOCKPlugin_Hypothesis.cxx @@ -0,0 +1,134 @@ +// Copyright (C) 2009-2012 CEA/DEN, EDF R&D +// +// 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. +// +// 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 +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +//============================================================================= +// File : HEXABLOCKPlugin_Hypothesis.cxx +// Created : Wed Apr 2 12:36:29 2008 +// Author : Lioka RAZAFINDRAZAKA (CEA) +//============================================================================= +// +#include "HEXABLOCKPlugin_Hypothesis.hxx" + +//======================================================================= +//function : HEXABLOCKPlugin_Hypothesis +//======================================================================= + +HEXABLOCKPlugin_Hypothesis::HEXABLOCKPlugin_Hypothesis(int hypId, int studyId, SMESH_Gen * gen) + : SMESH_Hypothesis(hypId, studyId, gen), + _document(NULL), + _dimension(3) +{ + _name = "HEXABLOCK_Parameters"; + _param_algo_dim = 3; +} + +//======================================================================= +//function : GetDocument +//======================================================================= + +HEXA_NS::Document* HEXABLOCKPlugin_Hypothesis::GetDocument() const +{ + return(_document); +} + +//======================================================================= +//function : SetDocument +//======================================================================= + +void HEXABLOCKPlugin_Hypothesis::SetDocument(HEXA_NS::Document* doc) +{ + _document = doc; +} + +//======================================================================= +//function : GetDimension +//======================================================================= + +int HEXABLOCKPlugin_Hypothesis::GetDimension() const +{ + return(_dimension); +} + +//======================================================================= +//function : SetDimension +//======================================================================= + +void HEXABLOCKPlugin_Hypothesis::SetDimension(int dim) +{ + _dimension = dim; +} + +//======================================================================= +//function : SaveTo +//======================================================================= + +std::ostream & HEXABLOCKPlugin_Hypothesis::SaveTo(std::ostream & save) +{ +//save << _document->getXML() << " "; + save <<_dimension << " "; + + return save; +} + +//======================================================================= +//function : LoadFrom +//======================================================================= + +std::istream & HEXABLOCKPlugin_Hypothesis::LoadFrom(std::istream & load) +{ + bool isOK = true; + int i; + +// char* str; +// isOK = (load >> str); +// if (isOK) +// _document = xml_2_doc(str); +// else +// load.clear(ios::badbit | load.rdstate()); + + isOK = (load >> i); + if (isOK) + _dimension = i; + else + load.clear(ios::badbit | load.rdstate()); + + return load; +} + +//======================================================================= +//function : SetParametersByMesh +//======================================================================= + +bool HEXABLOCKPlugin_Hypothesis::SetParametersByMesh(const SMESH_Mesh* ,const TopoDS_Shape&) +{ + return false; +} + + +//================================================================================ +/*! + * \brief Return false + */ +//================================================================================ + +bool HEXABLOCKPlugin_Hypothesis::SetParametersByDefaults(const TDefaults& /*dflts*/, + const SMESH_Mesh* /*theMesh*/) +{ + return false; +} diff --git a/src/HEXABLOCKPlugin/HEXABLOCKPlugin_Hypothesis.hxx b/src/HEXABLOCKPlugin/HEXABLOCKPlugin_Hypothesis.hxx new file mode 100755 index 0000000..27407b6 --- /dev/null +++ b/src/HEXABLOCKPlugin/HEXABLOCKPlugin_Hypothesis.hxx @@ -0,0 +1,79 @@ +// Copyright (C) 2009-2012 CEA/DEN, EDF R&D +// +// 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. +// +// 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 +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +// HEXABLOCKPlugin : C++ implementation +// File : HEXABLOCKPlugin_Hypothesis.hxx +// Created : Wed Apr 2 12:21:17 2008 +// Author : Lioka RAZAFINDRAZAKA (CEA) +// +#ifndef HEXABLOCKPlugin_Hypothesis_HeaderFile +#define HEXABLOCKPlugin_Hypothesis_HeaderFile + +#include "HEXABLOCKPlugin_Defs.hxx" + +#include + +#include "HexDocument.hxx" + +#include + +#include +#include + +class HEXABLOCKPLUGIN_EXPORT HEXABLOCKPlugin_Hypothesis: public SMESH_Hypothesis +{ +public: + + HEXABLOCKPlugin_Hypothesis(int hypId, int studyId, SMESH_Gen * gen); + + /*! + * Define the document to be meshed, mandatory + */ + void SetDocument(HEXA_NS::Document* doc); + HEXA_NS::Document* GetDocument() const; + + /*! + * To define the hight dimension to generated: 3 = hexas, 2 = quads, 1 = segments, 0 = nodes + */ + void SetDimension(int dim); + int GetDimension() const; + + // Persistence + virtual std::ostream & SaveTo(std::ostream & save); + virtual std::istream & LoadFrom(std::istream & load); + friend HEXABLOCKPLUGIN_EXPORT std::ostream & operator <<(std::ostream & save, HEXABLOCKPlugin_Hypothesis & hyp); + friend HEXABLOCKPLUGIN_EXPORT std::istream & operator >>(std::istream & load, HEXABLOCKPlugin_Hypothesis & hyp); + + /*! + * \brief Does nothing + */ + virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape); + + /*! + * \brief Does nothing + */ + virtual bool SetParametersByDefaults(const TDefaults& dflts, const SMESH_Mesh* theMesh=0); + +private: + HEXA_NS::Document* _document; + int _dimension; +}; + + +#endif diff --git a/src/HEXABLOCKPlugin/HEXABLOCKPlugin_Hypothesis_i.cxx b/src/HEXABLOCKPlugin/HEXABLOCKPlugin_Hypothesis_i.cxx new file mode 100755 index 0000000..4e864ea --- /dev/null +++ b/src/HEXABLOCKPlugin/HEXABLOCKPlugin_Hypothesis_i.cxx @@ -0,0 +1,126 @@ +// Copyright (C) 2009-2012 CEA/DEN, EDF R&D +// +// 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. +// +// 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 +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +// File : HEXABLOCKPlugin_Hypothesis_i.cxx +// Created : Wed Apr 2 13:53:01 2008 +// Author : Lioka RAZAFINDRAZAKA (CEA) +// +#include +#include +#include + +#include "HEXABLOCK.hxx" +#include "HEXABLOCKPlugin_Hypothesis_i.hxx" +#include "HexDocument_impl.hxx" + +#include +#include + +#ifdef _DEBUG_ +static int MYDEBUG = 1; +#else +static int MYDEBUG = 0; +#endif + +//======================================================================= +//function : HEXABLOCKPlugin_Hypothesis_i +//======================================================================= + +HEXABLOCKPlugin_Hypothesis_i::HEXABLOCKPlugin_Hypothesis_i (PortableServer::POA_ptr thePOA, + int theStudyId, + ::SMESH_Gen* theGenImpl) + : SALOME::GenericObj_i( thePOA ), + SMESH_Hypothesis_i( thePOA ) +{ + if(MYDEBUG) MESSAGE( "HEXABLOCKPlugin_Hypothesis_i::HEXABLOCKPlugin_Hypothesis_i" ); + myBaseImpl = new ::HEXABLOCKPlugin_Hypothesis (theGenImpl->GetANewId(), + theStudyId, + theGenImpl); + _poa = PortableServer::POA::_duplicate(thePOA); +} + +//======================================================================= +//function : ~HEXABLOCKPlugin_Hypothesis_i +//======================================================================= + +HEXABLOCKPlugin_Hypothesis_i::~HEXABLOCKPlugin_Hypothesis_i() +{ + if(MYDEBUG) MESSAGE( "HEXABLOCKPlugin_Hypothesis_i::~HEXABLOCKPlugin_Hypothesis_i" ); +} + +//============================================================================= +/*! + * Get implementation + */ +//============================================================================= + +::HEXABLOCKPlugin_Hypothesis* HEXABLOCKPlugin_Hypothesis_i::GetImpl() +{ + return (::HEXABLOCKPlugin_Hypothesis*)myBaseImpl; +} + +//================================================================================ +/*! + * \brief Verify whether hypothesis supports given entity type + */ +//================================================================================ + +CORBA::Boolean HEXABLOCKPlugin_Hypothesis_i::IsDimSupported( SMESH::Dimension type ) +{ + return type == SMESH::DIM_3D; +} + +//================================================================================ +/*! + * Define the document to be meshed, mandatory + */ +//================================================================================ + +HEXABLOCK_ORB::Document_ptr HEXABLOCKPlugin_Hypothesis_i::GetDocument() { + ASSERT(myBaseImpl); + HEXA_NS::Document* d = this->GetImpl()->GetDocument(); + Document_impl* servantCorba = new Document_impl(_poa, d); + HEXABLOCK_ORB::Document_ptr result = servantCorba->_this(); + return result; +} + +void HEXABLOCKPlugin_Hypothesis_i::SetDocument(HEXABLOCK_ORB::Document_ptr doc) { + Document_impl* docServant = ::DownCast(doc); + if ( docServant ) { + HEXA_NS::Document* d = docServant->GetImpl(); + ASSERT(myBaseImpl); + this->GetImpl()->SetDocument(d); + } +} + +//================================================================================ +/*! + * To define the hight dimension to generated: 3 = hexas, 2 = quads, 1 = segments, 0 = nodes + */ +//================================================================================ + +CORBA::Long HEXABLOCKPlugin_Hypothesis_i::GetDimension() { + ASSERT(myBaseImpl); + return this->GetImpl()->GetDimension(); +} + +void HEXABLOCKPlugin_Hypothesis_i::SetDimension(CORBA::Long dim) { + ASSERT(myBaseImpl); + this->GetImpl()->SetDimension(dim); +} diff --git a/src/HEXABLOCKPlugin/HEXABLOCKPlugin_Hypothesis_i.hxx b/src/HEXABLOCKPlugin/HEXABLOCKPlugin_Hypothesis_i.hxx new file mode 100755 index 0000000..4a0add0 --- /dev/null +++ b/src/HEXABLOCKPlugin/HEXABLOCKPlugin_Hypothesis_i.hxx @@ -0,0 +1,76 @@ +// Copyright (C) 2009-2012 CEA/DEN, EDF R&D +// +// 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. +// +// 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 +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +// HEXABLOCKPlugin : C++ implementation +// File : HEXABLOCKPlugin_Hypothesis_i.hxx +// Date : 2010/11/08 +// Project : SALOME +// +#ifndef _HEXABLOCKPlugin_Hypothesis_i_HXX_ +#define _HEXABLOCKPlugin_Hypothesis_i_HXX_ + +#include "HEXABLOCKPlugin_Defs.hxx" + +#include +#include CORBA_SERVER_HEADER(HEXABLOCKPlugin_Algorithm) +#include CORBA_CLIENT_HEADER(Document) + +#include "SMESH_Hypothesis_i.hxx" +#include "HEXABLOCKPlugin_Hypothesis.hxx" + +class SMESH_Gen; + +// HEXABLOCKPlugin parameters hypothesis + +class HEXABLOCKPLUGIN_EXPORT HEXABLOCKPlugin_Hypothesis_i: + public virtual POA_HEXABLOCKPlugin::HEXABLOCKPlugin_Hypothesis, + public virtual SMESH_Hypothesis_i +{ + public: + // Constructor + HEXABLOCKPlugin_Hypothesis_i (PortableServer::POA_ptr thePOA, + int theStudyId, + ::SMESH_Gen* theGenImpl); + // Destructor + virtual ~HEXABLOCKPlugin_Hypothesis_i(); + + /*! + * Define the document to be meshed, mandatory + */ + HEXABLOCK_ORB::Document_ptr GetDocument(); + void SetDocument(HEXABLOCK_ORB::Document_ptr doc); + + /*! + * To define the hight dimension to generated: 3 = hexas, 2 = quads, 1 = segments, 0 = nodes + */ + CORBA::Long GetDimension(); + void SetDimension(CORBA::Long dim); + + // Get implementation + ::HEXABLOCKPlugin_Hypothesis* GetImpl(); + + // Verify whether hypothesis supports given entity type + CORBA::Boolean IsDimSupported( SMESH::Dimension type ); + + private: + PortableServer::POA_var _poa;// POA reference + +}; + +#endif diff --git a/src/HEXABLOCKPlugin/HEXABLOCKPlugin_i.cxx b/src/HEXABLOCKPlugin/HEXABLOCKPlugin_i.cxx new file mode 100755 index 0000000..01c0968 --- /dev/null +++ b/src/HEXABLOCKPlugin/HEXABLOCKPlugin_i.cxx @@ -0,0 +1,76 @@ +// Copyright (C) 2009-2012 CEA/DEN, EDF R&D +// +// 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. +// +// 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 +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +// SMESH HEXABLOCKPlugin : implementaion of SMESH idl descriptions +// File : HEXABLOCKPlugin.cxx +// Author : Lioka RAZAFINDRAZAKA (CEA) +// Module : SMESH +// $Header$ +// +#include "SMESH_Hypothesis_i.hxx" + +#include "utilities.h" + +#include "HEXABLOCKPlugin_HEXABLOCK_i.hxx" +#include "HEXABLOCKPlugin_Hypothesis_i.hxx" + + +#ifdef _DEBUG_ +static int MYDEBUG = 1; +#else +static int MYDEBUG = 0; +#endif + + +using namespace std; + +template class HEXABLOCKPlugin_Creator_i:public HypothesisCreator_i +{ + // as we have 'module HEXABLOCKPlugin' in HEXABLOCKPlugin_Algorithm.idl + virtual std::string GetModuleName() { return "HEXABLOCKPlugin"; } +}; + +//============================================================================= +/*! + * + */ +//============================================================================= + +extern "C" +{ + HEXABLOCKPLUGIN_EXPORT + GenericHypothesisCreator_i* GetHypothesisCreator (const char* aHypName) + { + if(MYDEBUG) MESSAGE("GetHypothesisCreator " << aHypName); + + GenericHypothesisCreator_i* aCreator = 0; + + // Hypotheses + + // Algorithm + if (strcmp(aHypName, "HEXABLOCK_3D") == 0) + aCreator = new HEXABLOCKPlugin_Creator_i; + // Hypothesis + else if (strcmp(aHypName, "HEXABLOCK_Parameters") == 0) + aCreator = new HEXABLOCKPlugin_Creator_i; + else ; + + return aCreator; + } +} diff --git a/src/HEXABLOCKPlugin/HEXABLOCKPlugin_mesh.cxx b/src/HEXABLOCKPlugin/HEXABLOCKPlugin_mesh.cxx new file mode 100755 index 0000000..b0a2c6a --- /dev/null +++ b/src/HEXABLOCKPlugin/HEXABLOCKPlugin_mesh.cxx @@ -0,0 +1,1947 @@ +// Copyright (C) 2009-2012 CEA/DEN, EDF R&D +// +// 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. +// +// 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 +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File : SMESH_HexaBlocks.cxx +// Author : +// Module : SMESH +// + +#include +#include + +// CasCade includes +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +// SMESH includes +#include "SMDS_MeshNode.hxx" +#include "SMDS_MeshVolume.hxx" +#include "SMESH_Gen.hxx" +#include "SMESH_MesherHelper.hxx" +#include "SMESHDS_Group.hxx" + +// HEXABLOCK includes +#include "HexDocument.hxx" +#include "HexVertex.hxx" +#include "HexEdge.hxx" +#include "HexQuad.hxx" +#include "HexHexa.hxx" +#include "HexPropagation.hxx" +#include "HexShape.hxx" +#include "HexGroup.hxx" + +// HEXABLOCKPLUGIN includes +#include "HEXABLOCKPlugin_mesh.hxx" +#include "HEXABLOCKPlugin_FromSkin_3D.hxx" + +// other includes +#include "Basics_Utils.hxx" +#include "utilities.h" + +#ifdef WNT +#include +#else +#include +#endif + +#include + +#ifndef EXCEPTION +#define EXCEPTION(TYPE, MSG) {\ + std::ostringstream aStream;\ + aStream<<__FILE__<<"["<<__LINE__<<"]::"<getBrep(); + TopoDS_Shape shape = string2shape( strBrep ); + ok = shape2coord( shape, x, y, z ); +// ASSERT(ok); + if (!ok) throw (SALOME_Exception(LOCALIZED("vertex association : shape2coord() error "))); + newNode = _theMeshDS->AddNode(x, y, z); + if (_node.count(&vx) >= 1 and MYDEBUG) MESSAGE("_node : ALREADY"); + _node[&vx] = newNode;//needed in computeEdge() + _vertex[newNode] = &vx; + + if (MYDEBUG){ + MESSAGE("computeVertexByAssoc() : ASSOC found " << vx.getName()); + /// vx.printName(); + MESSAGE("( "<< x <<","<< y <<","<< z <<" )"); + } + + if(MYDEBUG) MESSAGE("computeVertexByAssoc() : end >>>>>>>>"); + return ok; +} + +bool SMESH_HexaBlocks::computeVertexByModel(HEXA_NS::Vertex& vx) +{ + if(MYDEBUG) MESSAGE("computeVertexByModel() : : begin <<<<<<"); + bool ok = true; + + SMDS_MeshNode* newNode = NULL; // new node on mesh + double x, y, z; //new node coordinates + +// vx.printName(); +// std::cout << std::endl; + x = vx.getX(); + y = vx.getY(); + z = vx.getZ(); + + newNode = _theMeshDS->AddNode(x, y, z); + + if (_node.count(&vx) >= 1 and MYDEBUG) MESSAGE("_node : ALREADY"); + _node[&vx] = newNode;//needed in computeEdge() + _vertex[newNode] = &vx; + if (MYDEBUG){ + MESSAGE("computeVertexByModel() :" << vx.getName()); + /// vx.printName(); + MESSAGE("( "<< x <<","<< y <<","<< z <<" )"); + } + + if(MYDEBUG) MESSAGE("computeVertexByModel() : end >>>>>>>>"); + return ok; +} + +// -------------------------------------------------------------- +// Edge computing +// -------------------------------------------------------------- +bool SMESH_HexaBlocks::computeEdge(HEXA_NS::Edge& edge, HEXA_NS::Law& law) +{ + bool ok = false; + + ok = computeEdgeByAssoc( edge, law); + if ( ok == false ){ + ok = computeEdgeByShortestWire( edge, law); + } + if ( ok == false ){ + ok = computeEdgeByPlanWire( edge, law); + } + if ( ok == false ){ + ok = computeEdgeByIsoWire( edge, law); + } + if ( ok == false ){ + ok = computeEdgeBySegment( edge, law); + } + if (ok == true){ + _computeEdgeOK = true; + } + return ok; +} + + + +bool SMESH_HexaBlocks::computeEdgeByAssoc( HEXA_NS::Edge& edge, HEXA_NS::Law& law ) +{ + if(MYDEBUG) MESSAGE("computeEdgeByAssoc(edgeID = "< associations = edge.getAssociations(); + if ( associations.size() == 0 ){ + return false; + } + //vertex from edge + HEXA_NS::Vertex* vx0 = NULL; + HEXA_NS::Vertex* vx1 = NULL; + + // way of discretization + if (edge.getWay() == true){ + vx0 = edge.getVertex(0); + vx1 = edge.getVertex(1); + } else { + vx0 = edge.getVertex(1); + vx1 = edge.getVertex(0); + } + // nodes on mesh + SMDS_MeshNode* FIRST_NODE = _node[vx0]; + SMDS_MeshNode* LAST_NODE = _node[vx1]; + + + // A) Build myCurve + std::list< BRepAdaptor_Curve* > myCurve; + double myCurve_length; + std::map< BRepAdaptor_Curve*, double> myCurve_lengths; + std::map< BRepAdaptor_Curve*, bool> myCurve_ways; + std::map< BRepAdaptor_Curve*, double> myCurve_starts; + gp_Pnt myCurve_start( FIRST_NODE->X(), FIRST_NODE->Y(), FIRST_NODE->Z() ); + gp_Pnt myCurve_end( LAST_NODE->X(), LAST_NODE->Y(), LAST_NODE->Z() ); + + + _buildMyCurve( + associations, + myCurve_start, + myCurve_end, + myCurve, + myCurve_length, + myCurve_lengths, + myCurve_ways, + myCurve_starts, + edge + ); + + + // B) Build nodes and edges on mesh from myCurve + SMDS_MeshNode* node_a = NULL; + SMDS_MeshNode* node_b = NULL; + SMDS_MeshEdge* edge_ab = NULL; + SMESHNodes nodesOnEdge; + SMESHEdges edgesOnEdge; //backup for group creation +// Xx nodesXxOnEdge; + + node_a = FIRST_NODE; + nodesOnEdge.push_back(FIRST_NODE); +// nodesXxOnEdge.push_back(0.); + // _nodeXx[FIRST_NODE] = 0.; + + gp_Pnt ptOnMyCurve; + double u, myCurve_u; + double myCurve_start_u = 0.; + int nbNodes = law.getNodes(); //law of discretization + if (MYDEBUG) MESSAGE("nbNodes -> "< "< "< "<AddNode( ptOnMyCurve.X(), ptOnMyCurve.Y(), ptOnMyCurve.Z() ); + edge_ab = _theMeshDS->AddEdge( node_a, node_b ); + nodesOnEdge.push_back( node_b ); + edgesOnEdge.push_back( edge_ab ); +// nodesXxOnEdge.push_back( u ); + if (_nodeXx.count(node_b) >= 1 ) ASSERT(false); + _nodeXx[node_b] = u; + node_a = node_b; + } + edge_ab = _theMeshDS->AddEdge( node_a, LAST_NODE ); + nodesOnEdge.push_back( LAST_NODE ); + edgesOnEdge.push_back( edge_ab ); +// nodesXxOnEdge.push_back( 1. ); + // _nodeXx[LAST_NODE] = 1.; + _nodesOnEdge[&edge] = nodesOnEdge; + _edgesOnEdge[&edge] = edgesOnEdge; + + + +// _edgeXx[&edge] = nodesXxOnEdge; + + if(MYDEBUG) MESSAGE("computeEdgeByAssoc() : end >>>>>>>>"); + return ok; +} + + + + +bool SMESH_HexaBlocks::computeEdgeByShortestWire( HEXA_NS::Edge& edge, HEXA_NS::Law& law) +{ + if(MYDEBUG) MESSAGE("computeEdgeByShortestWire() not implemented"); + return false; +} + +bool SMESH_HexaBlocks::computeEdgeByPlanWire( HEXA_NS::Edge& edge, HEXA_NS::Law& law) +{ + if(MYDEBUG) MESSAGE("computeEdgeByPlanWire() not implemented"); + return false; +} + +bool SMESH_HexaBlocks::computeEdgeByIsoWire( HEXA_NS::Edge& edge, HEXA_NS::Law& law) +{ + if(MYDEBUG) MESSAGE("computeEdgeByIsoWire() not implemented"); + return false; +} + + +bool SMESH_HexaBlocks::computeEdgeBySegment(HEXA_NS::Edge& edge, HEXA_NS::Law& law) +{ + if(MYDEBUG) MESSAGE("computeEdgeBySegment() : : begin <<<<<<"); + ASSERT( _computeVertexOK ); + bool ok = true; + + //vertex from edge + HEXA_NS::Vertex* vx0 = NULL; + HEXA_NS::Vertex* vx1 = NULL; + + // way of discretization + if (edge.getWay() == true){ + vx0 = edge.getVertex(0); + vx1 = edge.getVertex(1); + } else { + vx0 = edge.getVertex(1); + vx1 = edge.getVertex(0); + } + + // nodes on mesh + SMDS_MeshNode* FIRST_NODE = _node[vx0]; + SMDS_MeshNode* LAST_NODE = _node[vx1]; + SMDS_MeshNode* node_a = NULL; //new node (to be added) + SMDS_MeshNode* node_b = NULL; //new node (to be added) + + // node and edge creation + SMESHNodes nodesOnEdge; + SMESHEdges edgesOnEdge; + + double u; // + double newNodeX, newNodeY, newNodeZ; + SMDS_MeshEdge* newEdge = NULL; + + node_a = FIRST_NODE; + nodesOnEdge.push_back(FIRST_NODE); + + //law of discretization + int nbNodes = law.getNodes(); + if (MYDEBUG) MESSAGE("nbNodes -> "<X() + u * ( LAST_NODE->X() - FIRST_NODE->X() ); + newNodeY = FIRST_NODE->Y() + u * ( LAST_NODE->Y() - FIRST_NODE->Y() ); + newNodeZ = FIRST_NODE->Z() + u * ( LAST_NODE->Z() - FIRST_NODE->Z() ); + node_b = _theMeshDS->AddNode(newNodeX, newNodeY, newNodeZ); + newEdge = _theMeshDS->AddEdge(node_a, node_b); + edgesOnEdge.push_back(newEdge); + nodesOnEdge.push_back(node_b); + if (_nodeXx.count(node_b) >= 1 ) ASSERT(false); + _nodeXx[ node_b ] = u; + if(MYDEBUG) MESSAGE("_nodeXx <-"<AddEdge(node_a, LAST_NODE); + nodesOnEdge.push_back(LAST_NODE); + edgesOnEdge.push_back(newEdge); + + _nodesOnEdge[&edge] = nodesOnEdge; + _edgesOnEdge[&edge] = edgesOnEdge; + + if(MYDEBUG) MESSAGE("computeEdgeBySegment() : end >>>>>>>>"); + return ok; +} + + +// -------------------------------------------------------------- +// Quad computing +// -------------------------------------------------------------- +std::map SMESH_HexaBlocks::computeQuadWays( HEXA_NS::Document* doc ) +{ + std::map quadWays; + std::map > edgeWays; + std::list skinQuad; + std::list workingQuad; + HEXA_NS::Quad* first_q = NULL; + HEXA_NS::Quad* q = NULL; + HEXA_NS::Edge* e = NULL; + HEXA_NS::Vertex *e_0, *e_1 = NULL; + + // FIRST STEP: eliminate free quad + internal quad + int nTotalQuad = doc->countUsedQuad(); + for (int i=0; i < nTotalQuad; ++i ){ + q = doc->getUsedQuad(i); + switch ( q->getNbrParents() ){ // parent == hexaedron + case 0: case 2: quadWays[q] = true; break; + case 1: skinQuad.push_back(q); break; + default: if ( q->getNbrParents() > 2 ) ASSERT(false); + } + } + + // SECOND STEP: setting edges ways + while ( skinQuad.size()>0 ){ + if(MYDEBUG) MESSAGE("SEARCHING INITIAL QUAD ..." ); + for ( std::list::iterator it = skinQuad.begin(); it != skinQuad.end(); it++ ){ + _searchInitialQuadWay( *it, e_0, e_1 ); + if ( e_0 != NULL and e_1 != NULL ){ + q = first_q = *it; + break; + } + } + if ( e_0 == NULL and e_1 == NULL ) ASSERT(false);// should never happened, + if(MYDEBUG) MESSAGE("INITIAL QUAD FOUND!" ); + for ( int j=0 ; j < 4 ; ++j ){ + e = q->getEdge(j); + if ( (e_0 == e->getVertex(0)) and (e_1 == e->getVertex(1)) or + (e_0 == e->getVertex(1)) and (e_1 == e->getVertex(0)) ){ + break; + } + } + if(MYDEBUG) MESSAGE("INITIAL EDGE WAY FOUND!" ); + + edgeWays[e] = std::make_pair( e_0, e_1 ); + workingQuad.push_back(q); + + while ( workingQuad.size() > 0 ){ + if(MYDEBUG) MESSAGE("COMPUTE QUAD WAY ... ID ="<< q->getId()); + HEXA_NS::Vertex *lastVertex=NULL, *firstVertex = NULL; + int i = 0; + std::map > localEdgeWays; + while ( localEdgeWays.size() != 4 ){ + HEXA_NS::Edge* e = q->getEdge(i%4); + if ( lastVertex == NULL ){ + if ( edgeWays.count(e) == 1 ){ + if ( q == first_q ){ + localEdgeWays[e] = std::make_pair( edgeWays[e].first, edgeWays[e].second ); + } else { + localEdgeWays[e] = std::make_pair( edgeWays[e].second, edgeWays[e].first); + } + firstVertex = localEdgeWays[e].first; + lastVertex = localEdgeWays[e].second; + } + } else { + HEXA_NS::Vertex* e_0 = e->getVertex(0); + HEXA_NS::Vertex* e_1 = e->getVertex(1); + + if ( lastVertex == e_0 ){ + firstVertex = e_0; lastVertex = e_1; + } else if ( lastVertex == e_1 ){ + firstVertex = e_1; lastVertex = e_0; + } else if ( firstVertex == e_0 ) { + firstVertex = e_1; lastVertex = e_0; + } else if ( firstVertex == e_1 ) { + firstVertex = e_0; lastVertex = e_1; + } else { + ASSERT(false); + } + localEdgeWays[e] = std::make_pair( firstVertex, lastVertex ); + if ( edgeWays.count(e) == 0 ){ // keep current value if present otherwise add it + edgeWays[e] = localEdgeWays[e]; + } + } + ++i; + } + + + //add new working quad + for ( int i=0 ; i < 4; ++i ){ + HEXA_NS::Quad* next_q = NULL; + HEXA_NS::Edge* e = q->getEdge(i); + for ( int j=0 ; j < e->getNbrParents(); ++j ){ + next_q = e->getParent(j); + if ( next_q == q ){ + next_q = NULL; + } + int fromSkin = std::count( skinQuad.begin(), skinQuad.end(), next_q ); + if (fromSkin != 0){ + int fromWorkingQuad = std::count( workingQuad.begin(), workingQuad.end(), next_q ); + if ( fromWorkingQuad == 0 ){ + workingQuad.push_front( next_q ); + } + } + } + } + + // setting quad way + HEXA_NS::Edge* e0 = q->getEdge(0); + HEXA_NS::Vertex* e0_0 = e0->getVertex(0); + + if ( e0_0 == localEdgeWays[ e0 ].first ){ + quadWays[q] = true; + } else if ( e0_0 == localEdgeWays[ e0 ].second ){ + quadWays[q] = false; + } else { + ASSERT(false); + } + workingQuad.remove( q ); + skinQuad.remove( q ); + q = workingQuad.back(); + } + } + + return quadWays; +} + + + + + +// std::map SMESH_HexaBlocks::computeQuadWays( HEXA_NS::Document& doc, std::map initQuads ) +// { +// std::map quadWays; +// // std::map edgeWays; +// // std::map > edgeWays; +// std::map > workingQuads; +// +// std::list skinQuad; +// std::list notSkinQuad; +// // std::list workingQuad; +// HEXA_NS::Quad* first_q = NULL; +// HEXA_NS::Quad* q = NULL; +// HEXA_NS::Edge* e = NULL; +// HEXA_NS::Vertex *e_0, *e_1 = NULL; +// +// // FIRST STEP: eliminate free quad + internal quad +// int nTotalQuad = doc.countQuad(); +// for (int i=0; i < nTotalQuad; ++i ){ +// q = doc.getQuad(i); +// switch ( q->getNbrParents() ){ // parent == hexaedron +// case 0: case 2: quadWays[q] = true; break; +// // case 0: case 2: notSkinQuad.push_back(q); break; //CS_TEST +// case 1: skinQuad.push_back(q); break; +// default: if ( q->getNbrParents() > 2 ) ASSERT(false); +// } +// } +// +// +// // SECOND STEP +// q = first_q = skinQuad.front(); +// e = q->getUsedEdge(0); +// e_0 = e->getVertex(0); +// e_1 = e->getVertex(1); +// +// workingQuads[q] = std::make_pair( e_0, e_1 ); +// +// while ( workingQuads.size() > 0 ){ +// MESSAGE("CURRENT QUAD ------>"<< q->getId()); +// HEXA_NS::Vertex *lastVertex=NULL, *firstVertex = NULL; +// int i = 0; +// +// std::map > localEdgeWays; +// while ( localEdgeWays.size() != 4 ){ +// HEXA_NS::Edge* e = q->getUsedEdge(i%4); +// if ( lastVertex == NULL ){ +// HEXA_NS::Vertex* e_0 = e->getVertex(0); +// HEXA_NS::Vertex* e_1 = e->getVertex(1); +// +// if ( (workingQuads[q].first == e_0 and workingQuads[q].second == e_1) +// or (workingQuads[q].first == e_1 and workingQuads[q].second == e_0) ){ +// if ( q == first_q ){ +// localEdgeWays[e] = std::make_pair( workingQuads[q].first, workingQuads[q].second ); +// MESSAGE("FIRST QUAD "); +// } else { +// localEdgeWays[e] = std::make_pair( workingQuads[q].second, workingQuads[q].first); +// MESSAGE("NOT FIRST QUAD "); +// } +// firstVertex = localEdgeWays[e].first; +// lastVertex = localEdgeWays[e].second; +// } +// } else { +// HEXA_NS::Vertex* e_0 = e->getVertex(0); +// HEXA_NS::Vertex* e_1 = e->getVertex(1); +// if ( lastVertex == e_0 ){ +// localEdgeWays[e] = std::make_pair( e_0, e_1 ); +// firstVertex = e_0; +// lastVertex = e_1; +// } else if ( lastVertex == e_1 ){ +// localEdgeWays[e] = std::make_pair( e_1, e_0 ); +// firstVertex = e_1; +// lastVertex = e_0; +// } else if ( firstVertex == e_0 ) { +// localEdgeWays[e] = std::make_pair( e_1, e_0 ); +// firstVertex = e_1; +// lastVertex = e_0; +// } else if ( firstVertex == e_1 ) { +// localEdgeWays[e] = std::make_pair( e_0, e_1 ); +// firstVertex = e_0; +// lastVertex = e_1; +// } else { +// ASSERT(false); +// } +// } +// ++i; +// } +// +// +// //add new working quad +// for ( int i=0 ; i < 4; ++i ){ +// HEXA_NS::Quad* next_q = NULL; +// HEXA_NS::Edge* e = q->getUsedEdge(i); +// MESSAGE("NB PARENTS ="<< e->getNbrParents() ); +// for ( int j=0 ; j < e->getNbrParents(); ++j ){ +// next_q = e->getParent(j); +// if ( next_q == q ){ +// next_q = NULL; +// } +// int fromSkin = std::count( skinQuad.begin(), skinQuad.end(), next_q ); +// if (fromSkin != 0){ +// // int fromWorkingQuad = std::count( workingQuads.begin(), workingQuads.end(), next_q ); +// int fromWorkingQuad = workingQuads.count( next_q ); +// // MESSAGE("CHECK QUAD:"<< newWorkingQuad->getId()); +// if ( fromWorkingQuad == 0 ){ +// // workingQuads.push_front( next_q ); +// workingQuads[ next_q ] = localEdgeWays[e]; +// // MESSAGE("EDGE :"<getId()<<"ADD QUAD :"<< newWorkingQuad->getId()); +// } +// } +// } +// } +// +// //setting quad way +// HEXA_NS::Edge* e0 = q->getUsedEdge(0); +// HEXA_NS::Vertex* e0_0 = e0->getVertex(0); +// +// if ( e0_0 == localEdgeWays[ e0 ].first ){ +// quadWays[q] = true; +// } else if ( e0_0 == localEdgeWays[ e0 ].second ){ +// quadWays[q] = false; +// } else { +// ASSERT(false); +// } +// MESSAGE("quadWays ID ="<< q->getId() << ", WAY = " << quadWays[q] ); +// +// // workingQuad.remove( q ); +// workingQuads.erase( q ); +// skinQuad.remove( q ); +// *workingQuads.begin(); +// q = (*workingQuads.begin()).first; +// } +// return quadWays; +// } + + +bool SMESH_HexaBlocks::computeQuad( HEXA_NS::Quad& quad, bool way ) +{ + bool ok = false; + + ok = computeQuadByAssoc(quad, way); + if ( ok == false ){ + ok = computeQuadByFindingGeom(quad, way); + } + if ( ok == false ){ + ok = computeQuadByLinearApproximation(quad, way); + } + if (ok == true){ + _computeQuadOK = true; + } + return ok; +} + + +bool SMESH_HexaBlocks::computeQuadByAssoc( HEXA_NS::Quad& quad, bool way ) +{ +// int id = quad.getId(); +// if ( id != 11 ) return false; //7 + if (MYDEBUG){ + MESSAGE("computeQuadByLinearApproximation() : : begin <<<<<<"); + MESSAGE("quadID = "< xx, yy; + + // Elements for quad computation + SMDS_MeshNode *S1, *S2, *S4, *S3; + +// bool initOk = _computeQuadInit( quad, eh, eb, eg, ed, S1, S2, S3, S4 ); + bool initOk = _computeQuadInit( quad, nodesOnQuad, xx, yy ); + if ( initOk == false ){ + return false; + } + + const std::vector shapes = quad.getAssociations(); + if ( shapes.size() == 0 ){ + if(MYDEBUG) MESSAGE("computeQuadByAssoc() : end >>>>>>>>"); + return false; + } + TopoDS_Shape shapeOrCompound = _getShapeOrCompound( shapes ); +// bool quadWay = _computeQuadWay( quad, S1, S2, S3, S4, &shapeOrCompound ); +// bool quadWay = _computeQuadWay( quad ); + + + std::map interpolatedPoints; + int iSize = nodesOnQuad.size(); + int jSize = nodesOnQuad[0].size(); + + S1 = nodesOnQuad[0][0]; +// S2 = nodesOnQuad[bNodes.size()-1][0]; + S2 = nodesOnQuad[iSize-1][0]; + S4 = nodesOnQuad[0][jSize-1]; + S3 = nodesOnQuad[iSize-1][jSize-1]; + + + for (int j = 1; j < jSize; ++j){ + for (int i = 1; i < iSize; ++i){ + SMDS_MeshNode* n1 = nodesOnQuad[i-1][j]; + SMDS_MeshNode* n2 = nodesOnQuad[i-1][j-1]; + SMDS_MeshNode* n3 = nodesOnQuad[i][j-1]; + SMDS_MeshNode* n4 = nodesOnQuad[i][j]; + + if ( n4 == NULL ){ + double newNodeX, newNodeY, newNodeZ; + SMDS_MeshNode* Ph = nodesOnQuad[i][jSize-1]; //dNodes[h_i]; + SMDS_MeshNode* Pb = nodesOnQuad[i][0]; //bNodes[b_i]; + SMDS_MeshNode* Pg = nodesOnQuad[0][j]; //gNodes[g_j]; + SMDS_MeshNode* Pd = nodesOnQuad[iSize-1][j]; //dNodes[d_j]; + double u = xx[i]; + double v = yy[j]; + + _nodeInterpolationUV(u, v, Pg, Pd, Ph, Pb, S1, S2, S3, S4, newNodeX, newNodeY, newNodeZ); + gp_Pnt newPt = gp_Pnt( newNodeX, newNodeY, newNodeZ );//interpolated point + gp_Pnt pt1; + gp_Pnt pt3; + if ( interpolatedPoints.count(n1) > 0 ){ + pt1 = interpolatedPoints[n1]; + } else { + pt1 = gp_Pnt( n1->X(), n1->Y(), n1->Z() ); + } + if ( interpolatedPoints.count(n3) > 0 ){ + pt3 = interpolatedPoints[n3]; + } else { + pt3 = gp_Pnt( n3->X(), n3->Y(), n3->Z() ); + } + gp_Vec vec1( newPt, pt1 ); + gp_Vec vec2( newPt, pt3 ); + + gp_Pnt ptOnShape = _intersect(newPt, vec1, vec2, shapeOrCompound); + newNodeX = ptOnShape.X(); + newNodeY = ptOnShape.Y(); + newNodeZ = ptOnShape.Z(); + n4 = _theMeshDS->AddNode( newNodeX, newNodeY, newNodeZ ); + nodesOnQuad[i][j] = n4; + interpolatedPoints[ n4 ] = newPt; + + if (MYDEBUG) { + MESSAGE("u parameter is "<X() << "," << n1->Y() << "," << n1->Z() << ")"); + MESSAGE("n2 (" << n2->X() << "," << n2->Y() << "," << n2->Z() << ")"); + MESSAGE("n4 (" << n4->X() << "," << n4->Y() << "," << n4->Z() << ")"); + MESSAGE("n3 (" << n3->X() << "," << n3->Y() << "," << n3->Z() << ")"); + } + + if ( way == true ){ + if (MYDEBUG) MESSAGE("AddFace( n1, n2, n3, n4 )"); + newFace = _theMeshDS->AddFace( n1, n2, n3, n4 ); + } else { + if (MYDEBUG) MESSAGE("AddFace( n4, n3, n2, n1 )"); + newFace = _theMeshDS->AddFace( n4, n3, n2, n1 ); + } + facesOnQuad.push_back(newFace); + } + } + _quadNodes[ &quad ] = nodesOnQuad; + _facesOnQuad[&quad] = facesOnQuad; + + if(MYDEBUG) MESSAGE("computeQuadByLinearApproximation() : end >>>>>>>>"); + return ok; +} + + +bool SMESH_HexaBlocks::computeQuadByFindingGeom( HEXA_NS::Quad& quad, bool way ) +{ + if(MYDEBUG) MESSAGE("computeQuadByFindingGeom() not implemented"); + return false; +} + +bool SMESH_HexaBlocks::_computeQuadInit( + HEXA_NS::Quad& quad, + ArrayOfSMESHNodes& nodesOnQuad, + std::vector& xx, std::vector& yy) +{ + if(MYDEBUG) MESSAGE("_computeQuadInit() : begin ---------------"); + bool ok = true; + + SMDS_MeshNode *S1, *S2, *S4, *S3; + HEXA_NS::Edge *eh, *eb, *eg, *ed; + HEXA_NS::Edge *e1, *e2, *e3, *e4; + HEXA_NS::Vertex *e1_0, *e1_1, *e2_0, *e2_1, *e3_0, *e3_1, *e4_0, *e4_1; + + e1 = quad.getEdge(0); + e2 = quad.getEdge(1); + e3 = quad.getEdge(2); + e4 = quad.getEdge(3); + + e1_0 = e1->getVertex(0); e1_1 = e1->getVertex(1); + e2_0 = e2->getVertex(0); e2_1 = e2->getVertex(1); + e3_0 = e3->getVertex(0); e3_1 = e3->getVertex(1); + e4_0 = e4->getVertex(0); e4_1 = e4->getVertex(1); + + //S1, S2 + S1 = _node[e1_0]; S2 = _node[e1_1]; + eb = e1; eh = e3; + //S4 + if ( e1_0 == e2_0 ){ + S4 = _node[e2_1]; + eg = e2; ed = e4; + } else if ( e1_0 == e2_1 ){ + S4 = _node[e2_0]; + eg = e2; ed = e4; + } else if ( e1_0 == e4_0 ){ + S4 = _node[e4_1]; + eg = e4; ed = e2; + } else if ( e1_0 == e4_1 ){ + S4 = _node[e4_0]; + eg = e4; ed = e2; + } else { + ASSERT(false); + } + //S3 + if ( S4 == _node[e3_0] ){ + S3 = _node[e3_1]; + } else if ( S4 == _node[e3_1] ){ + S3 = _node[e3_0]; + } else { + ASSERT(false); + } + + SMESHNodes hNodes = _nodesOnEdge[eh]; + SMESHNodes bNodes = _nodesOnEdge[eb]; + SMESHNodes gNodes = _nodesOnEdge[eg]; + SMESHNodes dNodes = _nodesOnEdge[ed]; + nodesOnQuad.resize( bNodes.size(), SMESHNodes(gNodes.size(), static_cast(NULL)) ); + + + int i, j, _i, _j; +// int &b_i = i, &h_i = i, &g_j = j, &d_j = j; + int *b_i = &i, *h_i = &i, *g_j = &j, *d_j = &j; + bool uWay = true, vWay = true; + + if ( bNodes[0] != S1 ){ + b_i = &_i; + uWay = false; + ASSERT( bNodes[bNodes.size()-1] == S1 ); + } else { + ASSERT( bNodes[0] == S1); + } + if ( hNodes[0] != S4 ){ + h_i = &_i; + } else { + ASSERT( hNodes[0] == S4 ); + } + if ( gNodes[0] != S1 ){ + g_j = &_j; + vWay = false; + } else { + ASSERT( gNodes[0] == S1 ); + } + if ( dNodes[0] != S2 ){ + d_j = &_j; + } else { + ASSERT( dNodes[0] == S2 ); + } + + //bNodes, hNodes + double u; + for (i = 0, _i = bNodes.size()-1; i < bNodes.size(); ++i, --_i){ + nodesOnQuad[i][0] = bNodes[*b_i]; + nodesOnQuad[i][gNodes.size()-1 ] = hNodes[*h_i]; + + u = _nodeXx[ bNodes[*b_i] ]; + if ( uWay == true ){ + xx.push_back(u); + } else { + xx.push_back(1.-u); + } + } + if ( S1 != nodesOnQuad[0][0] ){ + if(MYDEBUG) MESSAGE("ZZZZZZZZZZZZZZZZ quadID = "<X() << "," << n1->Y() << "," << n1->Z() << ")"); + MESSAGE("n2 (" << n2->X() << "," << n2->Y() << "," << n2->Z() << ")"); + MESSAGE("n4 (" << n4->X() << "," << n4->Y() << "," << n4->Z() << ")"); + MESSAGE("n3 (" << n3->X() << "," << n3->Y() << "," << n3->Z() << ")"); + } + + if ( way == true ){ + if (MYDEBUG) MESSAGE("AddFace( n1, n2, n3, n4 )"); + newFace = _theMeshDS->AddFace( n1, n2, n3, n4 ); + } else { + if (MYDEBUG) MESSAGE("AddFace( n4, n3, n2, n1 )"); + newFace = _theMeshDS->AddFace( n4, n3, n2, n1 ); + } + facesOnQuad.push_back(newFace); + } + } + _quadNodes[ &quad ] = nodesOnQuad; + _facesOnQuad[&quad] = facesOnQuad; + + if(MYDEBUG) MESSAGE("computeQuadByLinearApproximation() : end >>>>>>>>"); + return ok; +} + + +// -------------------------------------------------------------- +// Hexa computing +// -------------------------------------------------------------- +bool SMESH_HexaBlocks::computeHexa( HEXA_NS::Document* doc ) +{ + if(MYDEBUG) MESSAGE("computeHexa() : : begin <<<<<<"); + bool ok=false; + + SMESH_MesherHelper aHelper(*_theMesh); + TopoDS_Shape shape = _theMesh->GetShapeToMesh(); + aHelper.SetSubShape( shape ); + aHelper.SetElementsOnShape( true ); + + SMESH_Gen* gen = _theMesh->GetGen(); + SMESH_HexaFromSkin_3D algo( gen->GetANewId(), 0, gen, doc ); + algo.InitComputeError(); + try { + ok = algo.Compute( *_theMesh, &aHelper, _volumesOnHexa, _node ); + } catch(...) { + if(MYDEBUG) MESSAGE("SMESH_HexaFromSkin_3D error!!! "); + } + if (MYDEBUG){ + MESSAGE("SMESH_HexaFromSkin_3D.comment = "<myComment); + MESSAGE("computeHexa() : end >>>>>>>>"); + } + return ok; +} + + + +// -------------------------------------------------------------- +// Document computing +// -------------------------------------------------------------- +bool SMESH_HexaBlocks::computeDoc( HEXA_NS::Document* doc ) +{ + if(MYDEBUG) MESSAGE("computeDoc() : : begin <<<<<<"); + bool ok = true; + + // A) Vertex computation + + int nVertex = doc->countUsedVertex(); + HEXA_NS::Vertex* vertex = NULL; + + for (int j=0; j getUsedVertex(j); + ok = computeVertex(*vertex); + } + + // B) Edges computation + int nbPropa = 0; + HEXA_NS::Propagation* propa = NULL; + HEXA_NS::Law* law = NULL; + HEXA_NS::Edges edges; + + nbPropa = doc->countPropagation(); + for (int j=0; j < nbPropa; ++j ){//Computing each edge's propagations of the document + propa = doc->getPropagation(j); + edges = propa->getEdges(); + law = propa->getLaw(); +// ASSERT( law ); + if (law == NULL){ + law = doc->getLaw(0); // default law + } + for( HEXA_NS::Edges::const_iterator iter = edges.begin(); + iter != edges.end(); + ++iter ){ + ok = computeEdge(**iter, *law); + } + } + // C) Quad computation + std::map quadWays = computeQuadWays(doc); + int nQuad = doc->countUsedQuad(); + HEXA_NS::Quad* q = NULL; + for (int j=0; j getUsedQuad(j); + int id = q->getId(); + if ( quadWays.count(q) > 0 ) + ok = computeQuad( *q, quadWays[q] ); + else + if(MYDEBUG) MESSAGE("NO QUAD WAY ID = "<>>>>>>>"); + return ok; +} + + +void SMESH_HexaBlocks::buildGroups(HEXA_NS::Document* doc) +{ + if (MYDEBUG){ + MESSAGE("_addGroups() : : begin <<<<<<"); + MESSAGE("_addGroups() : : nb. hexas= " << doc->countUsedHexa()); + MESSAGE("_addGroups() : : nb. quads= " << doc->countUsedQuad()); + MESSAGE("_addGroups() : : nb. edges= " << doc->countUsedEdge()); + MESSAGE("_addGroups() : : nb. nodes= " << doc->countUsedVertex()); + } + // Looping on each groups of the document + for ( int i=0; i < doc->countGroup(); i++ ){ + _fillGroup( doc->getGroup(i) ); + }; + + if(MYDEBUG) MESSAGE("_addGroups() : end >>>>>>>>"); +} + +// -------------------------------------------------------------- +// PRIVATE METHODS +// -------------------------------------------------------------- +double SMESH_HexaBlocks::_Xx( double i, HEXA_NS::Law law, double nbNodes) //, double pos0 ) +{ + double result; + double u0; + + HEXA_NS::KindLaw k = law.getKind(); + double coeff = law.getCoefficient(); + switch (k){ + case HEXA_NS::Uniform: + result = (i+1)/(nbNodes+1); + if(MYDEBUG) MESSAGE( "_Xx():" << " Uniform u("<>>>>>>>"); + return length; +} + + +void SMESH_HexaBlocks::_buildMyCurve( + const std::vector & associations, //IN + const gp_Pnt& myCurve_start, //IN + const gp_Pnt& myCurve_end, //IN + std::list< BRepAdaptor_Curve* >& myCurve, //INOUT + double& myCurve_length, //INOUT + std::map< BRepAdaptor_Curve*, double>& myCurve_lengths,//INOUT + std::map< BRepAdaptor_Curve*, bool>& myCurve_ways, //INOUT + std::map< BRepAdaptor_Curve*, double>& myCurve_starts, //INOUT + HEXA_NS::Edge& edge) // For error diagnostic +{ + if(MYDEBUG) MESSAGE("_buildMyCurve() : : begin <<<<<<"); + bool myCurve_way = true; + myCurve_length = 0.; + BRepAdaptor_Curve* thePreviousCurve = NULL; + BRepAdaptor_Curve* theCurve = NULL; + + gp_Pnt theCurve_start, theCurve_end; + gp_Pnt thePreviousCurve_start , thePreviousCurve_end; + + for ( std::vector ::const_iterator assoc = associations.begin(); + assoc != associations.end(); + ++assoc ){ + string theBrep = (*assoc)->getBrep(); + double ass_debut = std::min ((*assoc)->debut, (*assoc)->fin); + double ass_fin = std::max ((*assoc)->debut, (*assoc)->fin); + TopoDS_Shape theShape = string2shape( theBrep ); + TopoDS_Edge theEdge = TopoDS::Edge( theShape ); + double theCurve_length = _edgeLength( theEdge ); + if (MYDEBUG) + MESSAGE("_edgeLength ->"< 0 ){ + double f, l; + Handle(Geom_Curve) testCurve = BRep_Tool::Curve(theEdge, f, l); + theCurve = new BRepAdaptor_Curve( theEdge ); + + GCPnts_AbscissaPoint discret_start (*theCurve, + theCurve_length*ass_debut, + theCurve->FirstParameter() ); + GCPnts_AbscissaPoint discret_end (*theCurve, + theCurve_length*ass_fin, + theCurve->FirstParameter() ); + double u_start = discret_start.Parameter(); + double u_end = discret_end.Parameter(); + ASSERT( discret_start.IsDone() && discret_end.IsDone() ); + theCurve_start = theCurve->Value( u_start); + theCurve_end = theCurve->Value( u_end ); + theCurve_length = theCurve_length*( ass_fin - ass_debut); + + if (MYDEBUG){ + MESSAGE("testCurve->f ->"<l ->"<FirstParameter ->"<FirstParameter()); + MESSAGE("testCurve->LastParameter ->"<LastParameter()); + + MESSAGE("FirstParameter ->"<FirstParameter()); + MESSAGE("LastParameter ->"<LastParameter()); + MESSAGE("theCurve_length ->"<debut ->"<< ass_debut ); + MESSAGE("(*assoc)->fin ->"<< ass_fin ); + MESSAGE("u_start ->"<"< 0 ){ + + }// for + + + if ( myCurve_way == false ){ + std::list< BRepAdaptor_Curve* > tmp( myCurve.size() ); + std::copy( myCurve.rbegin(), myCurve.rend(), tmp.begin() ); + myCurve = tmp; + } + + if (MYDEBUG) { + MESSAGE("myCurve_way was :"<>>>>>>>"); + } +} + + + + +gp_Pnt SMESH_HexaBlocks::_getPtOnMyCurve( + const double& myCurve_u, //IN + std::map< BRepAdaptor_Curve*, bool>& myCurve_ways, //IN + std::map< BRepAdaptor_Curve*, double>& myCurve_lengths,//IN + std::map< BRepAdaptor_Curve*, double>& myCurve_starts, //IN + std::list< BRepAdaptor_Curve* >& myCurve, //INOUT + double& myCurve_start ) //INOUT +// std::map< BRepAdaptor_Curve*, double>& myCurve_firsts, +// std::map< BRepAdaptor_Curve*, double>& myCurve_lasts, +{ + if(MYDEBUG) MESSAGE("_getPtOnMyCurve() : : begin <<<<<<"); + gp_Pnt ptOnMyCurve; + + // looking for curve which contains parameter myCurve_u + BRepAdaptor_Curve* curve = myCurve.front(); + double curve_start = myCurve_start; + double curve_end = curve_start + myCurve_lengths[curve]; + double curve_u; + GCPnts_AbscissaPoint discret; + + if (MYDEBUG){ + MESSAGE("looking for curve: c = "<>>>>>>>"); + } + return ptOnMyCurve; +} + + + + + + + +void SMESH_HexaBlocks::_nodeInterpolationUV(double u, double v, + SMDS_MeshNode* Pg, SMDS_MeshNode* Pd, SMDS_MeshNode* Ph, SMDS_MeshNode* Pb, + SMDS_MeshNode* S1, SMDS_MeshNode* S2, SMDS_MeshNode* S3, SMDS_MeshNode* S4, + double& xOut, double& yOut, double& zOut ) +{ + if (MYDEBUG){ + MESSAGE("_nodeInterpolationUV() IN:"); + MESSAGE("u ( "<< u <<" )"); + MESSAGE("v ( "<< v <<" )"); + + MESSAGE("S1 (" << S1->X() << "," << S1->Y() << "," << S1->Z() << ")"); + MESSAGE("S2 (" << S2->X() << "," << S2->Y() << "," << S2->Z() << ")"); + MESSAGE("S4 (" << S4->X() << "," << S4->Y() << "," << S4->Z() << ")"); + MESSAGE("S3 (" << S3->X() << "," << S3->Y() << "," << S3->Z() << ")"); + + MESSAGE("Pg (" << Pg->X() << "," << Pg->Y() << "," << Pg->Z() << ")"); + MESSAGE("Pd (" << Pd->X() << "," << Pd->Y() << "," << Pd->Z() << ")"); + MESSAGE("Ph (" << Ph->X() << "," << Ph->Y() << "," << Ph->Z() << ")"); + MESSAGE("Pb (" << Pb->X() << "," << Pb->Y() << "," << Pb->Z() << ")"); + } + + xOut = ((1.-u)*Pg->X() + v*Ph->X() + u*Pd->X() + (1.-v)*Pb->X()) - (1.-u)*(1.-v)*S1->X() - u*(1.-v)*S2->X() - u*v*S3->X() - (1.-u)*v*S4->X(); + yOut = ((1.-u)*Pg->Y() + v*Ph->Y() + u*Pd->Y() + (1.-v)*Pb->Y()) - (1.-u)*(1.-v)*S1->Y() - u*(1.-v)*S2->Y() - u*v*S3->Y() - (1.-u)*v*S4->Y(); + zOut = ((1.-u)*Pg->Z() + v*Ph->Z() + u*Pd->Z() + (1.-v)*Pb->Z()) - (1.-u)*(1.-v)*S1->Z() - u*(1.-v)*S2->Z() - u*v*S3->Z() - (1.-u)*v*S4->Z(); + + if (MYDEBUG){ + MESSAGE("_nodeInterpolationUV() OUT("<& shapesIn) +{ + ASSERT( shapesIn.size()!=0 ); + + if (shapesIn.size() == 1) { + HEXA_NS::Shape* assoc = shapesIn.front(); + string strBrep = assoc->getBrep(); + return string2shape( strBrep ); + } else { + TopoDS_Compound aCompound; + BRep_Builder aBuilder; + aBuilder.MakeCompound( aCompound ); + + for ( std::vector ::const_iterator assoc = shapesIn.begin(); + assoc != shapesIn.end(); + ++assoc ){ + string strBrep = (*assoc)->getBrep(); + TopoDS_Shape shape = string2shape( strBrep ); + aBuilder.Add( aCompound, shape ); + } + return aCompound; + } +} + + +// ================================================== carre +inline double carre (double val) +{ + return val*val; +} +// ================================================== dist2 +inline double dist2 (const gp_Pnt& pt1, const gp_Pnt& pt2) +{ + double dist = carre (pt2.X()-pt1.X()) + carre (pt2.Y()-pt1.Y()) + + carre (pt2.Z()-pt1.Z()); + return dist; +} +// ================================================== _intersect +gp_Pnt SMESH_HexaBlocks::_intersect( const gp_Pnt& Pt, + const gp_Vec& u, const gp_Vec& v, + const TopoDS_Shape& shape, + Standard_Real tol ) +{ + gp_Pnt result; + + gp_Vec normale = u^v; + gp_Dir dir(normale); + gp_Lin li( Pt, dir ); + + Standard_Real s = -Precision::Infinite(); + Standard_Real e = +Precision::Infinite(); + + IntCurvesFace_ShapeIntersector inter; + inter.Load(shape, tol); +// inter.Load(S, tol); + inter.Perform(li, s, e);//inter.PerformNearest(li, s, e); + +/************************************************************** Abu 2011-11-04 */ + /// if ( inter.IsDone() && (inter.NbPnt()==1) ) { + if ( inter.IsDone() ) + { + result = inter.Pnt(1);//first + int nbrpts = inter.NbPnt(); + if (nbrpts>1) + { + double d0 = dist2 (result, Pt); + for (int i=2; i <= inter.NbPnt(); ++i ) + { + double d1 = dist2 (Pt, inter.Pnt(i)); + if (d1getNbrParents() != 1 ) return; // q must be a skin quad + + HEXA_NS::Vertex* qA = q->getVertex(0); + HEXA_NS::Vertex* qB = q->getVertex(1); + HEXA_NS::Vertex* qC = q->getVertex(2); + HEXA_NS::Vertex* qD = q->getVertex(3); + + // searching for vertex on opposed quad + HEXA_NS::Vertex *qAA = NULL, *qBB = NULL, *qCC = NULL, *qDD = NULL; + HEXA_NS::Hexa* h = q->getParent(0); + for( int i=0; i < h->countEdge(); ++i ){ + HEXA_NS::Edge* e = h->getEdge(i); + HEXA_NS::Vertex* e0 = e->getVertex(0); + HEXA_NS::Vertex* e1 = e->getVertex(1); + + if ( e0 == qA and e1 != qB and e1 != qC and e1 != qD ){ + qAA = e1; + } else if ( e1 == qA and e0 != qB and e0 != qC and e0 != qD ){ + qAA = e0; + } else if ( e0 == qB and e1 != qA and e1 != qC and e1 != qD ){ + qBB = e1; + } else if ( e1 == qB and e0 != qA and e0 != qC and e0 != qD ){ + qBB = e0; + } else if ( e0 == qC and e1 != qA and e1 != qB and e1 != qD ){ + qCC = e1; + } else if ( e1 == qC and e0 != qA and e0 != qB and e0 != qD ){ + qCC = e0; + } else if ( e0 == qD and e1 != qA and e1 != qB and e1 != qC ){ + qDD = e1; + } else if ( e1 == qD and e0 != qA and e0 != qB and e0 != qC ){ + qDD = e0; + } + } + + // working on final value ( point on CAO ), not on model + SMDS_MeshNode *nA = _node[qA], *nAA = _node[qAA]; + SMDS_MeshNode *nB = _node[qB], *nBB = _node[qBB]; + SMDS_MeshNode *nC = _node[qC], *nCC = _node[qCC]; + SMDS_MeshNode *nD = _node[qD], *nDD = _node[qDD]; + + gp_Pnt pA( nA->X(), nA->Y(), nA->Z() ); + gp_Pnt pB( nB->X(), nB->Y(), nB->Z() ); + gp_Pnt pC( nC->X(), nC->Y(), nC->Z() ); + gp_Pnt pD( nD->X(), nD->Y(), nD->Z() ); + + gp_Pnt pAA( nAA->X(), nAA->Y(), nAA->Z() ); + gp_Pnt pBB( nBB->X(), nBB->Y(), nBB->Z() ); + gp_Pnt pCC( nCC->X(), nCC->Y(), nCC->Z() ); + gp_Pnt pDD( nDD->X(), nDD->Y(), nDD->Z() ); + + gp_Vec AB( pA, pB ); + gp_Vec AC( pA, pC ); + gp_Vec normP = AB^AC; + gp_Dir dirP( normP ); + + // building plane for point projection + gp_Pln plnP( gp_Pnt(nA->X(), nA->Y(), nA->Z()), dirP); + TopoDS_Shape sPlnP = BRepBuilderAPI_MakeFace(plnP).Face(); + + // PAAA is the result of PAA projection + gp_Pnt pAAA = _intersect( pAA, AB, AC, sPlnP ); + gp_Pnt pBBB = _intersect( pBB, AB, AC, sPlnP ); + gp_Pnt pCCC = _intersect( pCC, AB, AC, sPlnP ); + gp_Pnt pDDD = _intersect( pDD, AB, AC, sPlnP ); + + gp_Dir AA( gp_Vec(pAA, pAAA) ); + gp_Dir BB( gp_Vec(pBB, pBBB) ); + gp_Dir CC( gp_Vec(pCC, pCCC) ); + gp_Dir DD( gp_Vec(pDD, pDDD) ); + + // eventually, we are able to know if the input quad is a good client! + // exit the fonction otherwise + if ( AA.IsOpposite(BB, HEXA_QUAD_WAY) ) return; + if ( BB.IsOpposite(CC, HEXA_QUAD_WAY) ) return; + if ( CC.IsOpposite(DD, HEXA_QUAD_WAY) ) return; + + // ok, give the input quad the good orientation by + // setting 2 vertex + if ( !dirP.IsOpposite(AA, HEXA_QUAD_WAY) ) { //OK + v0 = qA; v1 = qB; + } else { + v0 = qB; v1 = qA; + } + + if(MYDEBUG) MESSAGE("_searchInitialQuadWay() : end"); +} + +SMESH_Group* SMESH_HexaBlocks::_createGroup(HEXA_NS::Group& grHex) +{ + if(MYDEBUG) MESSAGE("_createGroup() : : begin <<<<<<"); + + std::string aGrName = grHex.getName(); + HEXA_NS::EnumGroup grHexKind = grHex.getKind(); + + if(MYDEBUG) MESSAGE("aGrName"<AddGroup(aGrType, aGrName.c_str(), aId); + + if(MYDEBUG) MESSAGE("_createGroup() : end >>>>>>>>"); + return aGr; +} + +void SMESH_HexaBlocks::_fillGroup(HEXA_NS::Group* grHex ) +{ + if(MYDEBUG) MESSAGE("_fillGroup() : : begin <<<<<<"); + + SMESH_Group* aGr = _createGroup( *grHex ); + HEXA_NS::EltBase* grHexElt = NULL; + HEXA_NS::EnumGroup grHexKind = grHex->getKind(); + int grHexNbElt = grHex->countElement(); + + if(MYDEBUG) MESSAGE("_fillGroup() : kind = " << grHexKind); + if(MYDEBUG) MESSAGE("_fillGroup() : count= " << grHexNbElt); + + // A)Looking for elements ID + std::vector aGrEltIDs; + + for ( int n=0; ngetElement(n); + + switch ( grHexKind ){ + case HEXA_NS::HexaCell: + { + HEXA_NS::Hexa* h = reinterpret_cast(grHexElt); +// HEXA_NS::Hexa* h = dynamic_cast(grHexElt); +// ASSERT(h); + if ( _volumesOnHexa.count(h)>0 ){ + SMESHVolumes volumes = _volumesOnHexa[h]; + for ( SMESHVolumes::iterator aVolume = volumes.begin(); aVolume != volumes.end(); ++aVolume ){ + aGrEltIDs.push_back(*aVolume); + } + } else { + if(MYDEBUG) MESSAGE("GROUP OF VOLUME: volume for hexa (id = "<getId()<<") not found"); + } + } + break; + case HEXA_NS::QuadCell: + { + HEXA_NS::Quad* q = reinterpret_cast(grHexElt); +// HEXA_NS::Quad* q = dynamic_cast(grHexElt); +// ASSERT(q); + if ( _facesOnQuad.count(q)>0 ){ + SMESHFaces faces = _facesOnQuad[q]; + for ( SMESHFaces::iterator aFace = faces.begin(); aFace != faces.end(); ++aFace ){ + aGrEltIDs.push_back(*aFace); + } + } else { + if(MYDEBUG) MESSAGE("GROUP OF FACE: face for quad (id = "<getId()<<") not found"); + } + } + break; + case HEXA_NS::EdgeCell: + { + HEXA_NS::Edge* e = reinterpret_cast(grHexElt); +// HEXA_NS::Edge* e = dynamic_cast(grHexElt); +// ASSERT(e); + if ( _edgesOnEdge.count(e)>0 ){ + SMESHEdges edges = _edgesOnEdge[e]; + for ( SMESHEdges::iterator anEdge = edges.begin(); anEdge != edges.end(); ++anEdge ){ + aGrEltIDs.push_back(*anEdge); + } + } else { + if(MYDEBUG) MESSAGE("GROUP OF Edge: edge for edge (id = "<getId()<<") not found"); + } + } + break; + case HEXA_NS::HexaNode: + { + HEXA_NS::Hexa* h = reinterpret_cast(grHexElt); +// HEXA_NS::Hexa* h = dynamic_cast(grHexElt); +// ASSERT(h); + if ( _volumesOnHexa.count(h)>0 ){ + SMESHVolumes volumes = _volumesOnHexa[h]; + for ( SMESHVolumes::iterator aVolume = volumes.begin(); aVolume != volumes.end(); ++aVolume ){ + SMDS_ElemIteratorPtr aNodeIter = (*aVolume)->nodesIterator(); + while( aNodeIter->more() ){ + const SMDS_MeshNode* aNode = + dynamic_cast( aNodeIter->next() ); + if ( aNode ){ + aGrEltIDs.push_back(aNode); + } + } + } + } else { + if(MYDEBUG) MESSAGE("GROUP OF HEXA NODES: nodes on hexa (id = "<getId()<<") not found"); + } + } + break; + case HEXA_NS::QuadNode: + { + HEXA_NS::Quad* q = reinterpret_cast(grHexElt); +// HEXA_NS::Quad* q = dynamic_cast(grHexElt); +// ASSERT(q); + if ( _quadNodes.count(q)>0 ){ + ArrayOfSMESHNodes nodesOnQuad = _quadNodes[q]; + for ( ArrayOfSMESHNodes::iterator nodes = nodesOnQuad.begin(); nodes != nodesOnQuad.end(); ++nodes){ + for ( SMESHNodes::iterator aNode = nodes->begin(); aNode != nodes->end(); ++aNode){ + aGrEltIDs.push_back(*aNode); + } + } + } else { + if(MYDEBUG) MESSAGE("GROUP OF QUAD NODES: nodes on quad (id = "<getId()<<") not found"); + } + } + break; + case HEXA_NS::EdgeNode: + { + HEXA_NS::Edge* e = reinterpret_cast(grHexElt); +// HEXA_NS::Edge* e = dynamic_cast(grHexElt); +// ASSERT(e); + if ( _nodesOnEdge.count(e)>0 ){ + SMESHNodes nodes = _nodesOnEdge[e]; + for ( SMESHNodes::iterator aNode = nodes.begin(); aNode != nodes.end(); ++aNode){ + aGrEltIDs.push_back(*aNode); + } + } else { + if(MYDEBUG) MESSAGE("GROUP OF EDGE NODES: nodes on edge (id = "<getId()<<") not found"); + } + } + break; + case HEXA_NS::VertexNode: + { + HEXA_NS::Vertex* v = reinterpret_cast(grHexElt); +// HEXA_NS::Vertex* v = dynamic_cast(grHexElt); +// ASSERT(v); + if ( _node.count(v)>0 ){ + aGrEltIDs.push_back(_node[v]); + } else { + if(MYDEBUG) MESSAGE("GROUP OF VERTEX NODES: nodes for vertex (id = "<getId()<<") not found"); + } + } + break; + default : ASSERT(false); + } + } + + // B)Filling the group on SMESH + SMESHDS_Group* aGroupDS = dynamic_cast( aGr->GetGroupDS() ); + + for ( int i=0; i < aGrEltIDs.size(); i++ ) { + aGroupDS->SMDSGroup().Add( aGrEltIDs[i] ); + }; + + if(MYDEBUG) MESSAGE("_fillGroup() : end >>>>>>>>"); +} + + + + + +// not used, for backup purpose only: +void SMESH_HexaBlocks::_getCurve( const std::vector& shapesIn, + Handle_Geom_Curve& curveOut, double& curveFirstOut, double& curveLastOut ) +{ +// std::cout<<"------------------- _getCurve ------------ "<debut; + double curvesLast = shapesIn.back()->fin; + + for ( std::vector ::const_iterator assoc = shapesIn.begin(); + assoc != shapesIn.end(); + ++assoc ){ + string strBrep = (*assoc)->getBrep(); + TopoDS_Shape shape = string2shape( strBrep ); + TopoDS_Edge Edge = TopoDS::Edge(shape); + double f, l; + Handle(Geom_Curve) curve = BRep_Tool::Curve(Edge, f, l); + curvesLenght += l-f; + Handle(Geom_BoundedCurve) bCurve = Handle(Geom_BoundedCurve)::DownCast(curve); + if ( gen == NULL ){ + gen = new GeomConvert_CompCurveToBSplineCurve(bCurve); + } else { + bool bb=gen->Add(bCurve, Precision::Confusion(), Standard_True, Standard_False, 1); + ASSERT(bb); + } + } + curveFirstOut = curvesFirst/curvesLenght; + curveLastOut = curvesLenght - (1.-curvesLast)/curvesLenght; + curveOut = gen->BSplineCurve(); + + std::cout<<"curvesFirst -> "< "< "< "< "<X(), n->Y(), n->Z() ); +// gp_Pnt ptOnPlane; +// gp_Pnt ptOnSurface; +// gp_Pnt ptOnPlaneOrSurface; +// // gp_Vec norm2(p1, p); +// TopoDS_Shape planeOrSurface; +// +// +// gp_Pln pln(p1, dir1); +// TopoDS_Shape shapePln = BRepBuilderAPI_MakeFace(pln).Face(); +// ptOnPlane = _intersect( p, a1, b1, shapePln ); +// ptOnPlaneOrSurface = ptOnPlane; +// +// +// // if ( assoc != NULL ){ +// // MESSAGE("_computeQuadWay with assoc"); +// for( int i=0; i < h->countEdge(); ++i ){ +// HEXA_NS::Edge* e = h->getUsedEdge(i); +// if ( e->definedBy(v1,v2) ){ +// const std::vector assocs = e->getAssociations(); +// if ( assocs.size() != 0 ){ +// HEXA_NS::Shape* assoc = assocs[0]; //CS_TODO +// string theBrep = assoc->getBrep(); +// TopoDS_Shape theShape = string2shape( theBrep ); +// ptOnSurface = _intersect( p, a1, b1, theShape ); +// if ( !ptOnSurface.IsEqual(p, HEXA_EPSILON) ){ +// ptOnPlaneOrSurface = ptOnSurface; +// } +// } +// } +// } +// diff --git a/src/HEXABLOCKPlugin/HEXABLOCKPlugin_mesh.hxx b/src/HEXABLOCKPlugin/HEXABLOCKPlugin_mesh.hxx new file mode 100755 index 0000000..d187069 --- /dev/null +++ b/src/HEXABLOCKPlugin/HEXABLOCKPlugin_mesh.hxx @@ -0,0 +1,217 @@ +// Copyright (C) 2009-2012 CEA/DEN, EDF R&D +// +// 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. +// +// 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 +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File : SMESH_HexaBlocks.hxx +// Author : +// Module : SMESH +// +#ifndef _SMESH_HexaBlocks_HeaderFile +#define _SMESH_HexaBlocks_HeaderFile + +#include + +#ifdef WNT +# if defined HEXABLOCKS_EXPORTS || defined HexaBlocks_EXPORTS +# define HEXABLOCKS_EXPORT __declspec( dllexport ) +# else +# define HEXABLOCKS_EXPORT __declspec( dllimport ) +# endif +#else +# define HEXABLOCKS_EXPORT +#endif + +#include "SMESH_Mesh.hxx" +#include "SMESH_Group.hxx" +#include "hexa_base.hxx" // from HexaBlocks + +#ifndef _Standard_Real_HeaderFile +#include +#endif + +#include +#include +#include +#include "Handle_Geom_Curve.hxx" +#include + +//===================================================================== +// SMESH_HexaBlocks : class definition +//===================================================================== +class HEXABLOCKS_EXPORT SMESH_HexaBlocks +{ +public: + +// typedef std::vector Xx; + typedef std::vector SMESHVolumes; + typedef std::vector SMESHNodes; + typedef std::vector SMESHFaces; + typedef std::vector SMESHEdges; + + typedef std::vector< SMESHNodes > ArrayOfSMESHNodes; + + struct Coord{ + double x; + double y; + double z; + }; + + + SMESH_HexaBlocks(SMESH_Mesh& theMesh); + ~SMESH_HexaBlocks(); + + // -------------------------------------------------------------- + // Vertex computing + // -------------------------------------------------------------- + bool computeVertex( HEXA_NS::Vertex& vertex ); + // Association solving + bool computeVertexByAssoc( HEXA_NS::Vertex& vertex ); + // Automatic solving + bool computeVertexByModel( HEXA_NS::Vertex& vertex ); + + + // -------------------------------------------------------------- + // Edge computing + // -------------------------------------------------------------- + bool computeEdge( HEXA_NS::Edge& edge, HEXA_NS::Law& law); + // Association solving + bool computeEdgeByAssoc( HEXA_NS::Edge& edge, HEXA_NS::Law& law); + + // Automatic solving + bool computeEdgeByShortestWire( HEXA_NS::Edge& edge, HEXA_NS::Law& law); + bool computeEdgeByPlanWire( HEXA_NS::Edge& edge, HEXA_NS::Law& law); + bool computeEdgeByIsoWire( HEXA_NS::Edge& edge, HEXA_NS::Law& law); + bool computeEdgeBySegment( HEXA_NS::Edge& edge, HEXA_NS::Law& law); + + // -------------------------------------------------------------- + // Quad computing + // -------------------------------------------------------------- + std::map computeQuadWays( HEXA_NS::Document* doc ); + bool computeQuad( HEXA_NS::Quad& quad, bool way ); + // Association solving + bool computeQuadByAssoc( HEXA_NS::Quad& quad, bool way ); + // Automatic solving + bool computeQuadByFindingGeom( HEXA_NS::Quad& quad, bool way ); + bool computeQuadByLinearApproximation( HEXA_NS::Quad& quad, bool way ); + + // -------------------------------------------------------------- + // Hexa computing + // -------------------------------------------------------------- + bool computeHexa( HEXA_NS::Document* doc ); + + // -------------------------------------------------------------- + // Document computing: Vertex, Edge, Quad and Hexa computing + // -------------------------------------------------------------- + bool computeDoc( HEXA_NS::Document* doc ); + + + // -------------------------------------------------------------- + // Build groups + // -------------------------------------------------------------- + void buildGroups(HEXA_NS::Document* doc); + + +private: + // ******** METHOD FOR MESH COMPUTATION ******** + // EDGE + double _Xx( double i, HEXA_NS::Law law, double nbNodes ); + + double _edgeLength(const TopoDS_Edge & E); + + void _buildMyCurve( + const std::vector & associations, //IN + const gp_Pnt& myCurve_start, //IN + const gp_Pnt& myCurve_end, //IN + std::list< BRepAdaptor_Curve* >& myCurve, //INOUT + double& myCurve_length, //INOUT + std::map< BRepAdaptor_Curve*, double>& myCurve_lengths,//INOUT + std::map< BRepAdaptor_Curve*, bool>& myCurve_ways, //INOUT + std::map< BRepAdaptor_Curve*, double>& myCurve_starts, //INOUT + HEXA_NS::Edge& edge); // For diagnostic + + gp_Pnt _getPtOnMyCurve( + const double& myCurve_u, //IN + std::map< BRepAdaptor_Curve*, bool>& myCurve_ways, //IN + std::map< BRepAdaptor_Curve*, double>& myCurve_lengths,//IN + std::map< BRepAdaptor_Curve*, double>& myCurve_starts, //IN + std::list< BRepAdaptor_Curve* >& myCurve, //INOUT + double& myCurve_start); //INOUT + + // QUAD + void _nodeInterpolationUV( double u, double v, + SMDS_MeshNode* Pg, SMDS_MeshNode* Pd, SMDS_MeshNode* Ph, SMDS_MeshNode* Pb, + SMDS_MeshNode* S0, SMDS_MeshNode* S1, SMDS_MeshNode* S2, SMDS_MeshNode* S3, + double& xOut, double& yOut, double& zOut ); + + TopoDS_Shape _getShapeOrCompound( const std::vector& shapesIn ); + + gp_Pnt _intersect( const gp_Pnt& Pt, + const gp_Vec& u, const gp_Vec& v, + const TopoDS_Shape& s, + Standard_Real tol = 0.0001 ); + + bool _computeQuadInit( + HEXA_NS::Quad& quad, + ArrayOfSMESHNodes& nodesOnQuad, + std::vector& xx, std::vector& yy); + + void _searchInitialQuadWay( HEXA_NS::Quad* quad, //IN + HEXA_NS::Vertex*& v0, //INOUT + HEXA_NS::Vertex*& v1 ); //INOUT + + + // ******** DATA FOR MESH COMPUTATION ******** + // NODES + std::map _node; //_vertexNode; + std::map _vertex; //_nodeVertex; + + // EDGES + std::map _nodesOnEdge; //_edgeNodes; +// std::map _edgeXx; + std::map _nodeXx; //_edgeNodes; + std::map _quadNodes; + + bool _computeVertexOK; + bool _computeEdgeOK; + bool _computeQuadOK; + + SMESHDS_Mesh* _theMeshDS; + SMESH_Mesh* _theMesh; + + // ******** METHOD FOR GROUPS COMPUTATION ******** + SMESH_Group* _createGroup(HEXA_NS::Group& grHex); + void _fillGroup(HEXA_NS::Group* grHex); + + // ******** DATA FOR GROUPS COMPUTATION ******** + std::map _volumesOnHexa; + std::map _facesOnQuad; + std::map _edgesOnEdge; + + + // for DEBUG purpose only: + int _total; + int _found; + int _notFound; + + // not used, for backup purpose only: + void _getCurve( const std::vector& shapesIn, + Handle_Geom_Curve& curveOut, double& curveFirstOut, double& curveLastOut ); +// bool computeEdgeByAssoc2( HEXA_NS::Edge& edge, HEXA_NS::Law& law); // alternative method +}; + + +#endif diff --git a/src/HEXABLOCKPlugin/Makefile.am b/src/HEXABLOCKPlugin/Makefile.am new file mode 100755 index 0000000..0b27622 --- /dev/null +++ b/src/HEXABLOCKPlugin/Makefile.am @@ -0,0 +1,69 @@ +# Copyright (C) 2009-2012 CEA/DEN, EDF R&D +# +# 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. +# +# 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 +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +# -* Makefile *- +# Author : Lioka RAZAFINDRAZAKA (CEA) +# Modified by : Alexander BORODIN (OCN) - autotools usage +# Module : HEXABLOCKPLUGIN +# Date : 2010/11/08 +# +include $(top_srcdir)/adm_local/unix/make_common_starter.am + +# header files +salomeinclude_HEADERS = \ + HEXABLOCKPlugin_Defs.hxx \ + HEXABLOCKPlugin_HEXABLOCK.hxx \ + HEXABLOCKPlugin_HEXABLOCK_i.hxx \ + HEXABLOCKPlugin_Hypothesis.hxx \ + HEXABLOCKPlugin_Hypothesis_i.hxx \ + HEXABLOCKPlugin_mesh.hxx \ + HEXABLOCKPlugin_FromSkin_3D.hxx + +# Libraries targets +lib_LTLIBRARIES = libHexaBlockEngine.la + +dist_libHexaBlockEngine_la_SOURCES = \ + HEXABLOCKPlugin_HEXABLOCK.cxx \ + HEXABLOCKPlugin_HEXABLOCK_i.cxx \ + HEXABLOCKPlugin_i.cxx \ + HEXABLOCKPlugin_Hypothesis.cxx \ + HEXABLOCKPlugin_Hypothesis_i.cxx \ + HEXABLOCKPlugin_mesh.cxx \ + HEXABLOCKPlugin_FromSkin_3D.cxx + +libHexaBlockEngine_la_CPPFLAGS = \ + $(KERNEL_CXXFLAGS) \ + $(CAS_CPPFLAGS) \ + $(VTK_INCLUDES) \ + $(GEOM_CXXFLAGS) \ + $(HEXABLOCK_CXXFLAGS) \ + $(MED_CXXFLAGS) \ + $(SMESH_CXXFLAGS) \ + $(BOOST_CPPFLAGS) \ + $(CORBA_CXXFLAGS) \ + $(CORBA_INCLUDES) \ + -I$(top_builddir)/idl + +libHexaBlockEngine_la_LDFLAGS = \ + ../../idl/libSalomeIDLHEXABLOCKPLUGIN.la \ + $(CAS_KERNEL) -lTKBRep -lTKG2d -lTKG3d -lTKTopAlgo -lTKGeomBase -lTKGeomAlgo \ + $(HEXABLOCK_LDFLAGS) -lHEXABLOCKEngine \ + $(MED_LDFLAGS) -lSalomeIDLMED \ + $(SMESH_LDFLAGS) -lSMESHimpl -lSMESHEngine -lSMESHDS -lSMDS \ + $(KERNEL_LDFLAGS) -lSalomeGenericObj -lSALOMELocalTrace -lSALOMEBasics diff --git a/src/Makefile.am b/src/Makefile.am new file mode 100755 index 0000000..65fa269 --- /dev/null +++ b/src/Makefile.am @@ -0,0 +1,34 @@ +# Copyright (C) 2009-2012 CEA/DEN, EDF R&D +# +# 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. +# +# 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 +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +# -* Makefile *- +# Author : Lioka RAZAFINDRAZAKA (CEA) +# Modified by : Alexander BORODIN (OCN) - autotools usage +# Module : HEXABLOCKPLUGIN +# Date : 2010/11/08 +# +include $(top_srcdir)/adm_local/unix/make_common_starter.am + +SUBDIRS = HEXABLOCKPlugin + +if HEXABLOCKPLUGIN_ENABLE_GUI + SUBDIRS += GUI +endif + +DIST_SUBDIRS = HEXABLOCKPlugin GUI -- 2.39.2