From: Paul RASCLE Date: Wed, 18 Nov 2015 13:42:03 +0000 (+0100) Subject: depot initial V7_2_0 X-Git-Tag: V7_8_0~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=58cf49f1e4f33236c8e80f8d86f5e73dedfdbdaa;p=plugins%2Fgmshplugin.git depot initial V7_2_0 --- 58cf49f1e4f33236c8e80f8d86f5e73dedfdbdaa 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..d60c31a --- /dev/null +++ b/COPYING @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 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. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +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 Program or any portion +of it, thus forming a work based on the Program, 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) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +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 Program, 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 Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) 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; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, 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 executable. However, as a +special exception, the source code 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. + +If distribution of executable or 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 counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program 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. + + 5. 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 Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program 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 to +this License. + + 7. 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 Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program 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 Program. + +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. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program 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. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies 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 Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, 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 + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. 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 PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +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 program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, 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. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/ChangeLog b/ChangeLog new file mode 100755 index 0000000..e69de29 diff --git a/GMSHPLUGIN_version.h.in b/GMSHPLUGIN_version.h.in new file mode 100755 index 0000000..9aec63b --- /dev/null +++ b/GMSHPLUGIN_version.h.in @@ -0,0 +1,30 @@ +// Copyright (C) 2012-2013 ALNEOS +// +// 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.alneos.com/ or email : contact@alneos.fr +// +#if !defined(__GMSHPLUGIN_VERSION_H__) +#define __GMSHPLUGIN_VERSION_H__ + +/* + GMSHPLUGIN_VERSION is (major << 16) + (minor << 8) + patch. +*/ + +#define GMSHPLUGIN_VERSION_STR "@VERSION@" +#define GMSHPLUGIN_VERSION @XVERSION@ +#define GMSHPLUGIN_DEVELOPMENT @VERSION_DEV@ + +#endif // __GMSHPLUGIN_VERSION_H__ diff --git a/INSTALL b/INSTALL new file mode 100755 index 0000000..1201ab6 --- /dev/null +++ b/INSTALL @@ -0,0 +1 @@ +SALOME2 : GMSHPLUGIN module (SMESH plugin) diff --git a/Makefile.am b/Makefile.am new file mode 100755 index 0000000..779a092 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,49 @@ +# Copyright (C) 2012-2013 ALNEOS +# +# 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.alneos.com/ or email : contact@alneos.fr +# +include $(top_srcdir)/adm_local/unix/make_common_starter.am + +if GMSHPLUGIN_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 ${SMESH_ROOT_DIR}/adm_local/unix/config_files +else !GMSHPLUGIN_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 ${SMESH_ROOT_DIR}/adm_local/unix/config_files +endif + +SUBDIRS = idl adm_local resources src bin doc + +DIST_SUBDIRS = idl adm_local resources src bin doc + +DISTCLEANFILES = a.out aclocal.m4 configure local-install.sh hack_libtool + +salomeinclude_DATA = GMSHPLUGIN_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..8d814b1 --- /dev/null +++ b/adm_local/Makefile.am @@ -0,0 +1,21 @@ +# Copyright (C) 2012-2013 ALNEOS +# +# 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.alneos.com/ or email : contact@alneos.fr +# +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..9c2af52 --- /dev/null +++ b/adm_local/unix/Makefile.am @@ -0,0 +1,21 @@ +# Copyright (C) 2012-2013 ALNEOS +# +# 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.alneos.com/ or email : contact@alneos.fr +# +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..fac60cb --- /dev/null +++ b/adm_local/unix/config_files/Makefile.am @@ -0,0 +1,22 @@ +# Copyright (C) 2012-2013 ALNEOS +# +# 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.alneos.com/ or email : contact@alneos.fr +# +include $(top_srcdir)/adm_local/unix/make_common_starter.am + +dist_admlocalm4_DATA = \ + check_GMSHPLUGIN.m4 diff --git a/adm_local/unix/config_files/check_GMSHPLUGIN.m4 b/adm_local/unix/config_files/check_GMSHPLUGIN.m4 new file mode 100755 index 0000000..6fdeb5b --- /dev/null +++ b/adm_local/unix/config_files/check_GMSHPLUGIN.m4 @@ -0,0 +1,72 @@ +dnl Copyright (C) 2012-2013 ALNEOS +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.alneos.com/ or email : contact@alneos.fr +dnl + +#------------------------------------------------------------ +# Check availability of Salome GMSH mesh plugin module +# distribution +#------------------------------------------------------------ + +AC_DEFUN([CHECK_GMSHPLUGIN],[ + +AC_CHECKING(for GMSH mesh plugin) + +NGplugin_ok=no + +GMSHPLUGIN_LDLAGS="" +GMSHPLUGIN_CXXFLAGS="" + +AC_ARG_WITH(gmshplugin, + [ --with-gmshplugin=DIR root directory path of GMSH mesh plugin installation ], + GMSHPLUGIN_DIR="$withval",GMSHPLUGIN_DIR="") + +if test "x$GMSHPLUGIN_DIR" == "x" ; then + +# no --with-gmshplugin-dir option used + + if test "x$GMSHPLUGIN_ROOT_DIR" != "x" ; then + + # GMSHPLUGIN_ROOT_DIR environment variable defined + GMSHPLUGIN_DIR=$GMSHPLUGIN_ROOT_DIR + + fi +# +fi + +if test -f ${GMSHPLUGIN_DIR}/lib${LIB_LOCATION_SUFFIX}/salome/libGMSHEngine.so ; then + NGplugin_ok=yes + AC_MSG_RESULT(Using GMSH mesh plugin distribution in ${GMSHPLUGIN_DIR}) + + if test "x$GMSHPLUGIN_ROOT_DIR" == "x" ; then + GMSHPLUGIN_ROOT_DIR=${GMSHPLUGIN_DIR} + fi + AC_SUBST(GMSHPLUGIN_ROOT_DIR) + + GMSHPLUGIN_LDFLAGS=-L${GMSHPLUGIN_DIR}/lib${LIB_LOCATION_SUFFIX}/salome + GMSHPLUGIN_CXXFLAGS=-I${GMSHPLUGIN_DIR}/include/salome + + AC_SUBST(GMSHPLUGIN_LDFLAGS) + AC_SUBST(GMSHPLUGIN_CXXFLAGS) + +else + AC_MSG_WARN("Cannot find compiled GMSH mesh plugin distribution") +fi + +AC_MSG_RESULT(for GMSH mesh plugin: $NGplugin_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..0116be7 --- /dev/null +++ b/adm_local/unix/make_common_starter.am @@ -0,0 +1,94 @@ +# Copyright (C) 2012-2013 ALNEOS +# +# 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.alneos.com/ or email : contact@alneos.fr +# + +# ============================================================ +# 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..cbba9f8 --- /dev/null +++ b/bin/Makefile.am @@ -0,0 +1,25 @@ +# Copyright (C) 2012-2013 ALNEOS +# +# 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.alneos.com/ or email : contact@alneos.fr +# +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..19d47fa --- /dev/null +++ b/bin/VERSION.in @@ -0,0 +1,3 @@ +[SALOME GMSHPLUGIN] : @VERSION@ +[DEVELOPMENT] : @VERSION_DEV@ +[DESCRIPTION] : Gmsh meshing plug-in for SALOME Mesh module diff --git a/build_configure b/build_configure new file mode 100755 index 0000000..3dfa46d --- /dev/null +++ b/build_configure @@ -0,0 +1,127 @@ +# Copyright (C) 2012-2013 ALNEOS +# +# 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.alneos.com/ or email : contact@alneos.fr +# +ORIG_DIR=`pwd` +CONF_DIR=`echo $0 | sed -e "s,[^/]*$,,;s,/$,,;s,^$,.,"` + +######################################################################## +# Test if the KERNEL_ROOT_DIR is set correctly + +if test ! -d "${KERNEL_ROOT_DIR}"; then + echo "failed : KERNEL_ROOT_DIR variable is not correct !" + exit +fi + +# Test if the KERNEL_SRC is set correctly + +#if test ! -d "${KERNEL_SRC}"; then +# echo "failed : KERNEL_SRC variable is not correct !" +# exit +#fi + +######################################################################## +# 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 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 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 ${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 ${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..27923cf --- /dev/null +++ b/clean_configure @@ -0,0 +1,28 @@ +#!/bin/sh +# Copyright (C) 2012-2013 ALNEOS +# +# 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.alneos.com/ or email : contact@alneos.fr +# + +rm -rf autom4te.cache aclocal.m4 configure make_config +find . -name "*~" -print -exec rm {} \; +find . -name "*.pyc" -print -exec rm {} \; +#exit +# ==================== ON SORT AVANT + +find . -name Makefile.in | xargs rm -f +( cd adm_local/unix/config_files && rm -f config.* depcomp install-sh ltmain.sh missing py-compile ) diff --git a/configure.ac b/configure.ac new file mode 100755 index 0000000..c97be48 --- /dev/null +++ b/configure.ac @@ -0,0 +1,437 @@ +# Copyright (C) 2012-2013 ALNEOS +# +# 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.alneos.com/ or email : contact@alneos.fr +# + +AC_INIT([Salome2 Project GMSHPLUGIN module], [7.2.0], [webmaster.salome@opencascade.com], [SalomeGMSHPLUGIN]) +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=gmshplugin +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 + +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 + ;; +esac + +echo +echo --------------------------------------------- +echo testing C/C++ +echo --------------------------------------------- +echo + +cc_ok=no +dnl inutil car libtool +dnl AC_PROG_CC +AC_PROG_CXX +AC_DEPEND_FLAG +# AC_CC_WARNINGS([ansi]) +cc_ok=yes + +echo +echo --------------------------------------------- +echo testing Fortran +echo --------------------------------------------- +echo + +fortran_ok=no +AC_PROG_F77 +AC_F77_LIBRARY_LDFLAGS +AC_PROG_FC +AC_FC_LIBRARY_LDFLAGS +if test "X$FC" != "X" ; then + fortran_ok=yes +fi + +dnl Library libdl : +AC_CHECK_LIB(dl,dlopen) + +dnl add library libm : +AC_CHECK_LIB(m,ceil) + +dnl +dnl Well we use sstream which is not in gcc pre-2.95.3 +dnl We must test if it exists. If not, add it in include ! +dnl + +AC_CXX_HAVE_SSTREAM + +echo +echo --------------------------------------------- +echo BOOST Library +echo --------------------------------------------- +echo + +CHECK_BOOST + +dnl +dnl --------------------------------------------- +dnl testing MPICH +dnl --------------------------------------------- +dnl + +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(GMSHPLUGIN_ENABLE_GUI, [test "${gui_ok}" = "yes"]) + +if test "${SalomeGUI_need}" == "yes"; then + if test "${FullGUI_ok}" != "yes"; then + AC_MSG_WARN(For configure GMSHPLUGIN 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 +fi + +echo +echo --------------------------------------------- +echo testing VTK +echo --------------------------------------------- +echo + +CHECK_VTK + +echo +echo --------------------------------------------- +echo testing HDF5 +echo --------------------------------------------- +echo + +CHECK_HDF5 + +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 Summary +echo --------------------------------------------- +echo + +AM_CONDITIONAL(CMAKE_BUILD, false) +#AM_CONDITIONAL( USE_GFORTRAN, [test "$F77" = "gfortran"]) + +echo Configure + +if test "${gui_ok}" = "yes"; then + variables="cc_ok boost_ok lex_yacc_ok python_ok swig_ok threads_ok OpenGL_ok qt_ok vtk_ok hdf5_ok omniORB_ok occ_ok doxygen_ok graphviz_ok Kernel_ok gui_ok Geom_ok SMesh_ok" +elif test "${SalomeGUI_need}" != "no"; then + variables="cc_ok boost_ok lex_yacc_ok python_ok swig_ok threads_ok vtk_ok hdf5_ok omniORB_ok occ_ok doxygen_ok graphviz_ok Kernel_ok gui_ok Geom_ok SMesh_ok" +else + variables="cc_ok boost_ok lex_yacc_ok python_ok swig_ok threads_ok vtk_ok hdf5_ok omniORB_ok occ_ok doxygen_ok graphviz_ok Kernel_ok Geom_ok SMesh_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 + +dnl Build with SMESH cancel compute feature +AC_DEFINE(WITH_SMESH_CANCEL_COMPUTE) + +dnl copy shells and utilities contained in the bin directory +dnl excluding .in files (treated in AC-OUTPUT below) and CVS +dnl directory + +echo +echo --------------------------------------------- +echo generating Makefiles and configure files +echo --------------------------------------------- +echo + +#AC_OUTPUT_COMMANDS([ \ +# chmod +x ./bin/*; \ +# chmod +x ./bin/salome/*; +#]) + +AC_HACK_LIBTOOL +AC_CONFIG_COMMANDS([hack_libtool],[ +sed -i "s%^CC=\"\(.*\)\"%hack_libtool (){ \n\ + $(pwd)/hack_libtool \1 \"\$[@]\" \n\ +}\n\ +CC=\"hack_libtool\"%g" libtool +sed -i "s%\(\s*\)for searchdir in \$newlib_search_path \$lib_search_path \$sys_lib_search_path \$shlib_search_path; do%\1searchdirs=\"\$newlib_search_path \$lib_search_path \$sys_lib_search_path \$shlib_search_path\"\n\1for searchdir in \$searchdirs; do%g" libtool +sed -i "s%\(\s*\)searchdirs=\"\$newlib_search_path \$lib_search_path \(.*\)\"%\1searchdirs=\"\$newlib_search_path \$lib_search_path\"\n\1sss_beg=\"\"\n\1sss_end=\"\2\"%g" libtool +sed -i "s%\(\s*\)\(for searchdir in \$searchdirs; do\)%\1for sss in \$searchdirs; do\n\1 if ! test -d \$sss; then continue; fi\n\1 ssss=\$(cd \$sss; pwd)\n\1 if test \"\$ssss\" != \"\" \&\& test -d \$ssss; then\n\1 case \$ssss in\n\1 /usr/lib | /usr/lib64 ) ;;\n\1 * ) sss_beg=\"\$sss_beg \$ssss\" ;;\n\1 esac\n\1 fi\n\1done\n\1searchdirs=\"\$sss_beg \$sss_end\"\n\1\2%g" libtool +],[]) + +# 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 \ + GMSHPLUGIN_version.h \ + doc/Makefile \ + doc/salome/Makefile \ + doc/salome/gui/Makefile \ + doc/salome/gui/GMSHPLUGIN/Makefile \ + doc/salome/gui/GMSHPLUGIN/doxyfile \ + doc/salome/gui/GMSHPLUGIN/doxyfile_py \ + doc/salome/gui/GMSHPLUGIN/static/header.html \ + doc/salome/gui/GMSHPLUGIN/static/header_py.html \ + src/Makefile \ + src/GUI/Makefile \ + src/GMSHPlugin/Makefile \ + resources/Makefile \ + idl/Makefile \ + Makefile \ +]) diff --git a/doc/Makefile.am b/doc/Makefile.am new file mode 100755 index 0000000..68203bf --- /dev/null +++ b/doc/Makefile.am @@ -0,0 +1,24 @@ +# Copyright (C) 2012-2013 ALNEOS +# +# 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.alneos.com/ or email : contact@alneos.fr +# +SUBDIRS = salome + +usr_docs: + (cd salome && $(MAKE) $(AM_MAKEFLAGS) usr_docs) + +docs: usr_docs \ No newline at end of file diff --git a/doc/salome/Makefile.am b/doc/salome/Makefile.am new file mode 100755 index 0000000..a27169b --- /dev/null +++ b/doc/salome/Makefile.am @@ -0,0 +1,27 @@ +# Copyright (C) 2012-2013 ALNEOS +# +# 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.alneos.com/ or email : contact@alneos.fr +# +SUBDIRS = gui +SUBDIRSGUI = gui + +usr_docs: + @@SETX@; for d in $(SUBDIRSGUI); do \ + (cd $$d && $(MAKE) $@) || exit 1; \ + done; + +docs: usr_docs \ No newline at end of file diff --git a/doc/salome/examples/CMakeLists.txt b/doc/salome/examples/CMakeLists.txt new file mode 100644 index 0000000..d18b559 --- /dev/null +++ b/doc/salome/examples/CMakeLists.txt @@ -0,0 +1,22 @@ +# Copyright (C) 2012-2013 ALNEOS +# +# 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.alneos.com/ or email : contact@alneos.fr +# + +SET(docdir ${CMAKE_INSTALL_PREFIX}/share/doc/salome) +FILE(GLOB files "${CMAKE_CURRENT_SOURCE_DIR}/*.py") +INSTALL(FILES ${files} DESTINATION ${docdir}/examples/GMSHPLUGIN) diff --git a/doc/salome/examples/Makefile.am b/doc/salome/examples/Makefile.am new file mode 100644 index 0000000..c0d5b80 --- /dev/null +++ b/doc/salome/examples/Makefile.am @@ -0,0 +1,26 @@ +# Copyright (C) 2012-2013 ALNEOS +# +# 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.alneos.com/ or email : contact@alneos.fr +# + +include $(top_srcdir)/adm_local/unix/make_common_starter.am + +pyexamplesdir = $(docdir)/examples/GMSHPLUGIN + +pyexamples_SCRIPTS = gmshdemo.py + +EXTRA_DIST += $(pyexamples_SCRIPTS) diff --git a/doc/salome/examples/gmshdemo.py b/doc/salome/examples/gmshdemo.py new file mode 100644 index 0000000..11474f5 --- /dev/null +++ b/doc/salome/examples/gmshdemo.py @@ -0,0 +1,54 @@ +# -*- coding: iso-8859-1 -*- + +import salome + +salome.salome_init() +theStudy = salome.myStudy + + +from salome.geom import geomBuilder +geompy = geomBuilder.New(theStudy) + +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(theStudy) + +from salome.GMSHPlugin import GMSHPluginBuilder + +# create a box +Box = geompy.MakeBoxDXDYDZ(10, 10, 10) +geompy.addToStudy( Box, 'Box' ) + +# 1. Create a 2D mesh on the box with GMSH_2D algorithm +Mesh_2D = smesh.Mesh(Box, "Box : 2D mesh by GMSH_2D") +# create a Gmsh 2D algorithm for solids +Algo_2D = Mesh_2D.Triangle(algo=smeshBuilder.GMSH_2D) +# define hypotheses +Param_2D = Algo_2D.Parameters() +# define algorithm +Param_2D.Set2DAlgo( 0 ) +# define min element +Param_2D.SetMinSize( 0 ) +# define max element +Param_2D.SetMaxSize( 2 ) + +# 2. Create a 3D mesh on the box with GMSH_3D algorithm +Mesh_3D = smesh.Mesh(Box, "Box : 3D mesh by GMSH_3D") +# create a Gmsh 3D algorithm for solids +Algo_3D = Mesh_3D.Tetrahedron(algo=smeshBuilder.GMSH) +# define hypotheses +Param_3D = Algo_3D.Parameters() +# define algorithms +Param_3D.Set2DAlgo( 0 ) +Param_3D.SetIs2d( 0 ) +Param_3D.Set3DAlgo( 0 ) +# define min element size +Param_3D.SetMinSize( 0 ) +# define max element size +Param_3D.SetMaxSize( 2 ) + +# compute the meshes +Mesh_2D.Compute() +Mesh_3D.Compute() + +if salome.sg.hasDesktop(): + salome.sg.updateObjBrowser(1) diff --git a/doc/salome/gui/GMSHPLUGIN/Makefile.am b/doc/salome/gui/GMSHPLUGIN/Makefile.am new file mode 100755 index 0000000..42eef1c --- /dev/null +++ b/doc/salome/gui/GMSHPLUGIN/Makefile.am @@ -0,0 +1,67 @@ +# Copyright (C) 2012-2013 ALNEOS +# +# 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.alneos.com/ or email : contact@alneos.fr +# +include $(top_srcdir)/adm_local/unix/make_common_starter.am + +EXTRA_DIST += images input static/footer.html static/salome_extra.css + +guidocdir = $(docdir)/gui/GMSHPLUGIN +guidoc_DATA = images/head.png + +DOC_PYTHONPATH=$(prefix)/bin/salome:$(prefix)/lib/python$(PYTHON_VERSION)/site-packages/salome:$(SMESH_ROOT_DIR)/bin/salome:$(SMESH_ROOT_DIR)/lib/python$(PYTHON_VERSION)/site-packages/salome:$(MED_ROOT_DIR)/lib/python$(PYTHON_VERSION)/site-packages/salome:$(GEOM_ROOT_DIR)/bin/salome:$(GEOM_ROOT_DIR)/lib/python$(PYTHON_VERSION)/site-packages/salome:$(KERNEL_ROOT_DIR)/bin/salome:$(KERNEL_ROOT_DIR)/lib/python$(PYTHON_VERSION)/site-packages/salome:$(OMNIORB_ROOT)/lib/python$(PYTHON_VERSION)/site-packages:$(OMNIORB_ROOT)/lib64/python$(PYTHON_VERSION)/site-packages +DOC_LD_LIBRARY_PATH=$(prefix)/lib/salome:$(SMESH_ROOT_DIR)/lib/salome:$(MED_ROOT_DIR)/lib/salome:$(GEOM_ROOT_DIR)/lib/salome:$(KERNEL_ROOT_DIR)/lib/salome +DOC_SMESH_MeshersList=GMSHPlugin + +tmp/smeshBuilder.py: $(top_srcdir)/src/GMSHPlugin/GMSHPluginBuilder.py + @mkdir -p tmp && PYTHONPATH=$(DOC_PYTHONPATH):${PYTHONPATH} LD_LIBRARY_PATH=$(DOC_LD_LIBRARY_PATH):${LD_LIBRARY_PATH} SMESH_MeshersList=$(DOC_SMESH_MeshersList) $(PYTHON) $(SMESH_ROOT_DIR)/bin/salome/collect_mesh_methods.py -d -o $@ GMSHPlugin + +tmp/GMSHPluginBuilder.py: $(top_srcdir)/src/GMSHPlugin/GMSHPluginBuilder.py + @mkdir -p tmp && $(KERNEL_ROOT_DIR)/bin/salome/prepare_generating_doc.py -o $@ $< + +tmp/smesh_algorithm.py : @SMESH_ROOT_DIR@/lib/python@PYTHON_VERSION@/site-packages/salome/salome/smesh/smesh_algorithm.py + @mkdir -p tmp && $(KERNEL_ROOT_DIR)/bin/salome/prepare_generating_doc.py -o $@ $< + +usr_docs: doxyfile_py doxyfile tmp/smeshBuilder.py tmp/GMSHPluginBuilder.py tmp/smesh_algorithm.py + @$(DOXYGEN) doxyfile_py ; \ + $(DOXYGEN) doxyfile + +docs: usr_docs + +clean-local: + @for filen in `find . -maxdepth 1` ; do \ + case $${filen} in \ + ./Makefile | ./doxyfile | ./doxyfile_py ) ;; \ + . | .. | ./static ) ;; \ + *) echo "Removing $${filen}" ; rm -rf $${filen} ;; \ + esac ; \ + done ; + +install-data-local: usr_docs + $(INSTALL) -d $(DESTDIR)$(docdir)/gui/GMSHPLUGIN + @for filen in `find . -maxdepth 1` ; do \ + case $${filen} in \ + ./Makefile | ./doxyfile | ./doxyfile_py ) ;; \ + ./doxyfile.bak | ./doxyfile_py.bak ) ;; \ + . | .. | ./static | ./tmp ) ;; \ + *) echo "Installing $${filen}" ; cp -rp $${filen} $(DESTDIR)$(docdir)/gui/GMSHPLUGIN ;; \ + esac ; \ + done ; + cp -rp $(srcdir)/images/head.png $(DESTDIR)$(docdir)/gui/GMSHPLUGIN/gmshpluginpy_doc ; + +uninstall-local: + rm -rf $(DESTDIR)$(docdir)/gui/GMSHPLUGIN \ No newline at end of file diff --git a/doc/salome/gui/GMSHPLUGIN/doxyfile.in b/doc/salome/gui/GMSHPLUGIN/doxyfile.in new file mode 100755 index 0000000..d5fec94 --- /dev/null +++ b/doc/salome/gui/GMSHPLUGIN/doxyfile.in @@ -0,0 +1,117 @@ +# Copyright (C) 2012-2013 ALNEOS +# +# 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.alneos.com/ or email : contact@alneos.fr +# + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = "SALOME GMSHPLUGIN User's Guide" +OUTPUT_DIRECTORY = . +CREATE_SUBDIRS = NO +OUTPUT_LANGUAGE = English +TAB_SIZE = 5 + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- +QUIET = NO +WARNINGS = YES + +#--------------------------------------------------------------------------- +#Input related options +#--------------------------------------------------------------------------- +INPUT = @srcdir@/input +FILE_PATTERNS = *.doc +EXCLUDE = +IMAGE_PATH = @srcdir@/images +EXAMPLE_PATH = @top_srcdir@/doc/salome/examples + +#--------------------------------------------------------------------------- +#HTML related options +#--------------------------------------------------------------------------- +GENERATE_HTML = YES +HTML_OUTPUT = . +HTML_HEADER = @builddir@/static/header.html +HTML_FOOTER = @srcdir@/static/footer.html +HTML_EXTRA_STYLESHEET = @srcdir@/static/salome_extra.css +TOC_EXPAND = YES +DISABLE_INDEX = NO +GENERATE_TREEVIEW = YES +TREEVIEW_WIDTH = 300 + + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool... +#--------------------------------------------------------------------------- +CLASS_DIAGRAMS = NO +HIDE_UNDOC_RELATIONS = NO +HAVE_DOT = NO +CLASS_GRAPH = NO +COLLABORATION_GRAPH = NO +GROUP_GRAPHS = NO +UML_LOOK = NO +TEMPLATE_RELATIONS = NO +INCLUDE_GRAPH = NO +INCLUDED_BY_GRAPH = NO +CALL_GRAPH = NO +GRAPHICAL_HIERARCHY = NO +DIRECTORY_GRAPH = NO +DOT_IMAGE_FORMAT = jpg +DOT_FONTNAME = Arial +DOT_PATH =. +DOTFILE_DIRS =. +MAX_DOT_GRAPH_WIDTH = 1024 +MAX_DOT_GRAPH_HEIGHT = 1200 +MAX_DOT_GRAPH_DEPTH = 0 +DOT_TRANSPARENT = NO +DOT_MULTI_TARGETS = NO + + +GENERATE_LEGEND = NO +DOT_CLEANUP = YES + +#--------------------------------------------------------------------------- +#SORT related options +#--------------------------------------------------------------------------- +SORT_GROUP_NAMES = NO + + +#--------------------------------------------------------------------------- +#LaTeX related option +#--------------------------------------------------------------------------- +GENERATE_LATEX = NO +EXTRA_PACKAGES = amsmath + +#--------------------------------------------------------------------------- +#RTF related options +#--------------------------------------------------------------------------- +GENERATE_RTF = NO + +#--------------------------------------------------------------------------- +#External reference options +#--------------------------------------------------------------------------- + +#rnv: 07.04.2011 Workaround for the doxygen 1.7.3: +#because it wrongly defines location of the html files for search. +TAGFILES = gmshpluginpy_doc.tag=../GMSHPLUGIN/gmshpluginpy_doc +SEARCHENGINE = YES + +#--------------------------------------------------------------------------- +#Custom commands +#--------------------------------------------------------------------------- +ALIASES += tui_script{1}="\include \1 Download this script" diff --git a/doc/salome/gui/GMSHPLUGIN/doxyfile_py.in b/doc/salome/gui/GMSHPLUGIN/doxyfile_py.in new file mode 100755 index 0000000..f0e6fdd --- /dev/null +++ b/doc/salome/gui/GMSHPLUGIN/doxyfile_py.in @@ -0,0 +1,162 @@ +# Copyright (C) 2012-2013 ALNEOS +# +# 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.alneos.com/ or email : contact@alneos.fr +# + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = "SALOME GMSHPLUGIN User's Guide" +OUTPUT_DIRECTORY = . +CREATE_SUBDIRS = NO +OUTPUT_LANGUAGE = English +USE_WINDOWS_ENCODING = NO +BRIEF_MEMBER_DESC = YES +REPEAT_BRIEF = YES +ALWAYS_DETAILED_SEC = YES +INLINE_INHERITED_MEMB = YES +FULL_PATH_NAMES = NO +SHORT_NAMES = NO +JAVADOC_AUTOBRIEF = YES +MULTILINE_CPP_IS_BRIEF = NO +DETAILS_AT_TOP = NO +INHERIT_DOCS = YES +SEPARATE_MEMBER_PAGES = NO +TAB_SIZE = 5 +OPTIMIZE_OUTPUT_FOR_C = YES +OPTIMIZE_OUTPUT_JAVA = YES +BUILTIN_STL_SUPPORT = NO +DISTRIBUTE_GROUP_DOC = NO +SUBGROUPING = YES + +#--------------------------------------------------------------------------- +# Build related options +#--------------------------------------------------------------------------- +EXTRACT_ALL = YES +EXTRACT_PRIVATE = YES +EXTRACT_STATIC = NO +EXTRACT_LOCAL_CLASSES = YES +EXTRACT_LOCAL_METHODS = NO +HIDE_UNDOC_MEMBERS = NO +HIDE_UNDOC_CLASSES = NO +HIDE_FRIEND_COMPOUNDS = NO +HIDE_IN_BODY_DOCS = NO +INTERNAL_DOCS = YES +CASE_SENSE_NAMES = YES +HIDE_SCOPE_NAMES = YES +SHOW_INCLUDE_FILES = YES +INLINE_INFO = YES +SORT_MEMBER_DOCS = NO +SORT_BRIEF_DOCS = NO +SORT_BY_SCOPE_NAME = NO +GENERATE_TODOLIST = YES +GENERATE_TESTLIST = YES +GENERATE_BUGLIST = YES +GENERATE_DEPRECATEDLIST= YES +MAX_INITIALIZER_LINES = 25 +SHOW_USED_FILES = NO +SHOW_DIRECTORIES = NO + +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- +SOURCE_BROWSER = NO +INLINE_SOURCES = NO +STRIP_CODE_COMMENTS = YES +REFERENCED_BY_RELATION = NO +REFERENCES_RELATION = YES +USE_HTAGS = NO +VERBATIM_HEADERS = YES + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- +QUIET = NO +WARNINGS = YES +WARN_IF_UNDOCUMENTED = YES +WARN_IF_DOC_ERROR = YES +WARN_NO_PARAMDOC = NO +EXCLUDE_SYMLINKS = NO +EXAMPLE_RECURSIVE = NO + +#--------------------------------------------------------------------------- +#Input related options +#--------------------------------------------------------------------------- +INPUT = tmp/GMSHPluginBuilder.py \ + tmp/smeshBuilder.py \ + tmp/smesh_algorithm.py +FILE_PATTERNS = +IMAGE_PATH = @srcdir@/images +RECURSIVE = NO +EXAMPLE_PATH = + +#--------------------------------------------------------------------------- +#HTML related options +#--------------------------------------------------------------------------- +GENERATE_HTML = YES +HTML_OUTPUT = gmshpluginpy_doc +HTML_HEADER = @builddir@/static/header_py.html +HTML_FOOTER = @srcdir@/static/footer.html +HTML_EXTRA_STYLESHEET = @srcdir@/static/salome_extra.css +TOC_EXPAND = YES +DISABLE_INDEX = NO +GENERATE_TREEVIEW = YES +TREEVIEW_WIDTH = 300 + +#--------------------------------------------------------------------------- +#LaTeX related option +#--------------------------------------------------------------------------- +GENERATE_LATEX = NO + +#--------------------------------------------------------------------------- +#RTF related options +#--------------------------------------------------------------------------- +GENERATE_RTF = NO + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- +CLASS_DIAGRAMS = NO +HIDE_UNDOC_RELATIONS = NO +HAVE_DOT = YES +CLASS_GRAPH = YES +COLLABORATION_GRAPH = NO +GROUP_GRAPHS = NO +UML_LOOK = NO +TEMPLATE_RELATIONS = YES +INCLUDE_GRAPH = YES +INCLUDED_BY_GRAPH = YES +CALL_GRAPH = NO +GRAPHICAL_HIERARCHY = YES +DIRECTORY_GRAPH = YES +DOT_IMAGE_FORMAT = png +DOT_FONTNAME = Arial +DOT_PATH = +DOTFILE_DIRS = +MAX_DOT_GRAPH_WIDTH = 1024 +MAX_DOT_GRAPH_HEIGHT = 1024 +MAX_DOT_GRAPH_DEPTH = 1000 +DOT_TRANSPARENT = NO +DOT_MULTI_TARGETS = NO +GENERATE_LEGEND = NO +DOT_CLEANUP = YES + +#--------------------------------------------------------------------------- +#External reference options +#--------------------------------------------------------------------------- +GENERATE_TAGFILE = gmshpluginpy_doc.tag +SEARCHENGINE = YES diff --git a/doc/salome/gui/GMSHPLUGIN/images/Arguments.png b/doc/salome/gui/GMSHPLUGIN/images/Arguments.png new file mode 100644 index 0000000..c5a836e Binary files /dev/null and b/doc/salome/gui/GMSHPLUGIN/images/Arguments.png differ diff --git a/doc/salome/gui/GMSHPLUGIN/images/Compounds.png b/doc/salome/gui/GMSHPLUGIN/images/Compounds.png new file mode 100644 index 0000000..6a28d13 Binary files /dev/null and b/doc/salome/gui/GMSHPLUGIN/images/Compounds.png differ diff --git a/doc/salome/gui/GMSHPLUGIN/images/compound.png b/doc/salome/gui/GMSHPLUGIN/images/compound.png new file mode 100644 index 0000000..adf6c88 Binary files /dev/null and b/doc/salome/gui/GMSHPLUGIN/images/compound.png differ diff --git a/doc/salome/gui/GMSHPLUGIN/images/cube.png b/doc/salome/gui/GMSHPLUGIN/images/cube.png new file mode 100644 index 0000000..d885743 Binary files /dev/null and b/doc/salome/gui/GMSHPLUGIN/images/cube.png differ diff --git a/doc/salome/gui/GMSHPLUGIN/images/head.png b/doc/salome/gui/GMSHPLUGIN/images/head.png new file mode 100755 index 0000000..307d9ef Binary files /dev/null and b/doc/salome/gui/GMSHPLUGIN/images/head.png differ diff --git a/doc/salome/gui/GMSHPLUGIN/input/gmsh_2d_3d_hypo.doc b/doc/salome/gui/GMSHPLUGIN/input/gmsh_2d_3d_hypo.doc new file mode 100755 index 0000000..b0e4120 --- /dev/null +++ b/doc/salome/gui/GMSHPLUGIN/input/gmsh_2d_3d_hypo.doc @@ -0,0 +1,61 @@ +/*! + +\page gmsh_2d_3d_hypo_page Gmsh 2D and 3D hypotheses + +Gmsh Parameters hypotheses work only with Gmsh 2D and Gmsh 3D algorithms. +Gmsh 2D and Gmsh 3D algorithms do not require definition of lower-level +hypotheses and algorithms (2D and 1D for meshing 3D objects and 1D for meshing 2D objects). +Gmsh 2D and Gmsh 3D algorithms do not support submeshes. + +
+\image html Arguments.png Dialog boxes of Gmsh 2D and Gmsh 3D algorithms. + +The Arguments tab of the dialog boxes is very similar to the original Gmsh +GUI general mesh option tab. +One familiar with the original interface can refer to the + Gmsh documentation for more informations. +We briefly describe each argument of the Arguments tab and give the original corresponding Gmsh keyword +(refering to Gmsh Mesh options list): +- Name - allows to define the name for the algorithm ("Gmsh Parameters" by default). +- 2D algorithm - allows to choose the Gmsh 2D algorithm for both 2D and 3D meshes. +Original corresponding Gmsh keyword is "Mesh.Algorithm". +- 3D algorithm - allows to choose the Gmsh 3D algorithm for 3D meshes. +Original corresponding Gmsh keyword is "Mesh.Algorithm3D". +- Recombine all triangular meshes - if this box is checked in, Gmsh will recombine triangles into quadrangles. +Original corresponding Gmsh keyword is "Mesh.RecombineAll" (set to 1 if the box is checked in, else 0). +- Subdivision algorithm - allows to choose the subdivision algorithm. +Original corresponding Gmsh keyword is "Mesh.SubdivisionAlgorithm". +- Remeshing algorithm - allows to choose the remeshing algorithm. +Original corresponding Gmsh keyword is "Mesh.RemeshAlgorithm". +- Remeshing parametrization - allows to choose the remeshing parametrization. +Original corresponding Gmsh keyword is "Mesh.RemeshParametrization". +- Smoothing steps - Number of steps to smooth the final mesh. +Original corresponding Gmsh keyword is "Mesh.Smoothing". +- Element size factor - factor used to linearly increase or decrease the default mesh size. +Original corresponding Gmsh keyword is "Mesh.CharacteristicLengthFactor". +- Max Size - maximum linear dimensions for mesh cells. +Original corresponding Gmsh keyword is "Mesh.CharacteristicLengthMax". +- Min Size - minimum linear dimensions for mesh cells. +Original corresponding Gmsh keyword is "Mesh.CharacteristicLengthMin". +- Second Order - if this box is checked in, the algorithm will create second order nodes on the mesh, +which actually will become quadratic. +Original corresponding Gmsh keyword is "Mesh.ElementOrder" (set to 2 if the box is checked in, else 1). +- Use incomplete elements - if this box is checked in (default), quadratic elements will be incomplete. +For example a quadrangle will have 8 nodes if incomplete, 9 nodes if complete. See + Node ordering for more informations. +Be carefull with the case of pyramides. Complete pyramides will have 14 nodes but there is no pyra14 available in smesh. +The last node created by Gmsh will then be ignored and using complete element can lead to orphelin nodes. +Original corresponding Gmsh keyword is "Mesh.SecondOrderIncomplete" (set to 1 if the box is checked in, else 0). + +
+\image html Compounds.png Coumpounds tab of the dialog boxe. + +In the Compounds tab of the dialog boxes, it is possible to choose the following arguments: +- Add - allows to add geometrical defined groups of edges or groups of faces as compounds. +Each group will be treated as a single entity during meshing. +When meshed, the single entity will be reparametrized as a single surface, whose mesh can thus cross internal boundaries. +- Remove - deletes selected rows from the table. + +*/ + + diff --git a/doc/salome/gui/GMSHPLUGIN/input/gmshplugin_python_interface.doc b/doc/salome/gui/GMSHPLUGIN/input/gmshplugin_python_interface.doc new file mode 100755 index 0000000..fd85720 --- /dev/null +++ b/doc/salome/gui/GMSHPLUGIN/input/gmshplugin_python_interface.doc @@ -0,0 +1,17 @@ +/*! + +\page gmshplugin_python_interface_page Python Interface + +Python package GMSHPluginBuilder defines several classes, destined for creation of the 2D and 3D meshes. + +Documentation for GMSHPlugin package is available in linear form grouped by classes, declared in the GMSHPluginBuilder.py file. + +Below you can see an example of usage of the GMSHPluginBuilder package for mesh generation: + +\anchor example_GMSHPlugin +

Example of 2d and 3d mesh generation with GMSH:

+\tui_script{gmshdemo.py} + +*/ + + diff --git a/doc/salome/gui/GMSHPLUGIN/input/index.doc b/doc/salome/gui/GMSHPLUGIN/input/index.doc new file mode 100755 index 0000000..5a69e32 --- /dev/null +++ b/doc/salome/gui/GMSHPLUGIN/input/index.doc @@ -0,0 +1,21 @@ +/*! + +\mainpage Introduction to GMSHPLUGIN + +\b GMSHPLUGIN plugin provide an integration of certain functionnalities of the well known + Gmsh three-dimensional finite element mesh generator. +It is possible to mesh 2D and 3D geometric entities. The plugin was especialy developped to +integrate the Gmsh coumpound functionnality. + +To manage parameters of the GMSHPLUGIN use \subpage gmsh_2d_3d_hypo_page. + +Also all GMSHPLUGIN functionalities are accessible via +\subpage gmshplugin_python_interface_page "GMSHPLUGIN Python interface". + +\image html compound.png "Example of a compound 2D mesh." +
+ +\image html cube.png "Example of a 3D cube mesh." +
+ +*/ diff --git a/doc/salome/gui/GMSHPLUGIN/static/footer.html b/doc/salome/gui/GMSHPLUGIN/static/footer.html new file mode 100755 index 0000000..4137de2 --- /dev/null +++ b/doc/salome/gui/GMSHPLUGIN/static/footer.html @@ -0,0 +1,14 @@ + + + + + + diff --git a/doc/salome/gui/GMSHPLUGIN/static/header.html.in b/doc/salome/gui/GMSHPLUGIN/static/header.html.in new file mode 100755 index 0000000..cd93290 --- /dev/null +++ b/doc/salome/gui/GMSHPLUGIN/static/header.html.in @@ -0,0 +1,23 @@ + + + + + + + +$projectname: $title +$title + + + +$treeview +$search +$mathjax + +$extrastylesheet + + +
+ +
Version: @VERSION@
+ diff --git a/doc/salome/gui/GMSHPLUGIN/static/header_py.html.in b/doc/salome/gui/GMSHPLUGIN/static/header_py.html.in new file mode 100755 index 0000000..7b68cef --- /dev/null +++ b/doc/salome/gui/GMSHPLUGIN/static/header_py.html.in @@ -0,0 +1,24 @@ + + + + + + + +$projectname: $title +$title + + + +$treeview +$search +$mathjax + +$extrastylesheet + + +
+ +
Version: @VERSION@
+ + diff --git a/doc/salome/gui/GMSHPLUGIN/static/salome_extra.css b/doc/salome/gui/GMSHPLUGIN/static/salome_extra.css new file mode 100755 index 0000000..3e8b838 --- /dev/null +++ b/doc/salome/gui/GMSHPLUGIN/static/salome_extra.css @@ -0,0 +1,29 @@ +/* The extra CSS for doxygen 1.8.3.1 */ + +#titlearea { + background-image:url('head.png'); + background-color: #175783; + border: 1px solid; + height: 80px; + background-repeat: no-repeat; + padding: 0px; + margin: 0px; + width: 99.9%; + border-bottom: 1px solid #5373B4; +} + +div.version { + border:1px solid #0000FF; + color: #CCCCCC; + font-family: Arial, Helvetica, sans-serif; + font-size: 9pt; + text-align: center; + width:100px; + -moz-border-radius: 8px; + margin: 5px; +} + +.navpath li.footer { + line-height:15px; + text-align: right; +} \ No newline at end of file diff --git a/doc/salome/gui/Makefile.am b/doc/salome/gui/Makefile.am new file mode 100755 index 0000000..46028f6 --- /dev/null +++ b/doc/salome/gui/Makefile.am @@ -0,0 +1,26 @@ +# Copyright (C) 2012-2013 ALNEOS +# +# 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.alneos.com/ or email : contact@alneos.fr +# +include $(top_srcdir)/adm_local/unix/make_common_starter.am + +SUBDIRS = GMSHPLUGIN + +usr_docs: + (cd GMSHPLUGIN && $(MAKE) $(AM_MAKEFLAGS) usr_docs) + +docs: usr_docs diff --git a/idl/GMSHPlugin_Algorithm.idl b/idl/GMSHPlugin_Algorithm.idl new file mode 100755 index 0000000..16f9155 --- /dev/null +++ b/idl/GMSHPlugin_Algorithm.idl @@ -0,0 +1,110 @@ +// Copyright (C) 2012-2013 ALNEOS +// +// 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.alneos.com/ or email : contact@alneos.fr +// +#ifndef _SMESH_GMSHALGORITHM_IDL_ +#define _SMESH_GMSHALGORITHM_IDL_ + +#include "SALOME_Exception.idl" +#include "SMESH_Hypothesis.idl" +#include "GEOM_Gen.idl" + +/*! + * GMSHPlugin: interfaces to GMSH related hypotheses and algorithms + */ +module GMSHPlugin +{ + typedef sequence string_array; + + /*! + * GMSHPlugin_GMSH: interface of "Gmsh" algorithm + */ + interface GMSHPlugin_GMSH : SMESH::SMESH_3D_Algo + { + }; + + /*! + * GMSHPlugin_GMSH_2D: interface of "Gmsh_2D" algorithm + */ + interface GMSHPlugin_GMSH_2D : SMESH::SMESH_2D_Algo + { + }; + + /*! + * GMSHPlugin_Hypothesis: interface of "GMSH parameters" hypothesis + */ + interface GMSHPlugin_Hypothesis : SMESH::SMESH_Hypothesis + { + void Set2DAlgo(in long value); + long Get2DAlgo(); + + void Set3DAlgo(in long value); + long Get3DAlgo(); + + void SetRecomb2DAlgo(in long value); + long GetRecomb2DAlgo(); + + void SetRecombineAll(in boolean value); + boolean GetRecombineAll(); + + void SetSubdivAlgo(in long value); + long GetSubdivAlgo(); + + void SetRemeshAlgo(in long value); + long GetRemeshAlgo(); + + void SetRemeshPara(in long value); + long GetRemeshPara(); + + void SetSmouthSteps(in double value); + double GetSmouthSteps(); + + void SetSizeFactor(in double value); + double GetSizeFactor(); + + void SetMaxSize(in double value); + double GetMaxSize(); + + void SetMinSize(in double value); + double GetMinSize(); + + void SetSecondOrder(in boolean value); + boolean GetSecondOrder(); + + void SetUseIncomplElem(in boolean value); + boolean GetUseIncomplElem(); + + void SetIs2d(in boolean value); + + void SetCompoundOnShape(in GEOM::GEOM_Object GeomObj); + void SetCompoundOnEntry(in string entry); + void UnsetCompoundOnShape(in GEOM::GEOM_Object GeomObj); + void UnsetCompoundOnEntry(in string entry); + string_array GetCompoundOnEntries(); + + }; + + /*! + * GMSHPlugin_Hypothesis_2D: interface of "GMSH 2D parameters" hypothesis + */ + interface GMSHPlugin_Hypothesis_2D : GMSHPlugin_Hypothesis + { + }; + +}; + +#endif diff --git a/idl/Makefile.am b/idl/Makefile.am new file mode 100755 index 0000000..a09c7ad --- /dev/null +++ b/idl/Makefile.am @@ -0,0 +1,114 @@ +# Copyright (C) 2012-2013 ALNEOS +# +# 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.alneos.com/ or email : contact@alneos.fr +# +include $(top_srcdir)/adm_local/unix/make_common_starter.am + +BASEIDL_FILES= GMSHPlugin_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 = libSalomeIDLGMSHPLUGIN.la + +# Sources built from idl files +nodist_libSalomeIDLGMSHPLUGIN_la_SOURCES = GMSHPlugin_AlgorithmSK.cc + +# header files must be exported: other modules have to use this library +nodist_salomeinclude_HEADERS = $(BASEIDL_FILES:%.idl=%.hh) + +libSalomeIDLGMSHPLUGIN_la_CPPFLAGS = \ + $(KERNEL_CXXFLAGS) \ + $(GEOM_CXXFLAGS) \ + $(SMESH_CXXFLAGS) \ + @CORBA_CXXFLAGS@ \ + @CORBA_INCLUDES@ \ + -I$(top_builddir)/idl + +libSalomeIDLGMSHPLUGIN_la_LDFLAGS = -no-undefined -version-info=0:0:0 +libSalomeIDLGMSHPLUGIN_la_LIBADD = \ + $(KERNEL_LDFLAGS) -lSalomeIDLKernel \ + $(SMESH_LDFLAGS) -lSalomeIDLSMESH \ + $(GEOM_LDFLAGS) -lSalomeIDLGEOM \ + @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$(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$(SMESH_ROOT_DIR)/idl/salome +IDLPYFLAGS = \ + @IDLPYFLAGS@ \ + -I$(KERNEL_ROOT_DIR)/idl/salome \ + -I$(GEOM_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 GMSHPlugin ; 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$(SMESH_ROOT_DIR)/idl/salome $$dep 2>/dev/null | \ + sed 's/\.o/\SK.cc/' >>$@; \ + fi; \ + done ; + +-include .depidl diff --git a/resources/GMSHPlugin.xml b/resources/GMSHPlugin.xml new file mode 100755 index 0000000..cbc4ff7 --- /dev/null +++ b/resources/GMSHPlugin.xml @@ -0,0 +1,74 @@ + + + + + + + + + + + + + + + + + + + + GMSH=Tetrahedron(algo=smeshBuilder.GMSH) + GMSH_Parameters=Parameters() + + + + + + GMSH_2D=Triangle(algo=smeshBuilder.GMSH_2D) + GMSH_Parameters_2D=Parameters() + + + + + + + diff --git a/resources/Makefile.am b/resources/Makefile.am new file mode 100755 index 0000000..5ad633d --- /dev/null +++ b/resources/Makefile.am @@ -0,0 +1,28 @@ +# Copyright (C) 2012-2013 ALNEOS +# +# 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.alneos.com/ or email : contact@alneos.fr +# +include $(top_srcdir)/adm_local/unix/make_common_starter.am + +dist_salomeres_DATA = \ + GMSHPlugin.xml \ + SalomeApp.xml + +if GMSHPLUGIN_ENABLE_GUI + dist_salomeres_DATA += \ + gmsh.png +endif diff --git a/resources/SalomeApp.xml b/resources/SalomeApp.xml new file mode 100755 index 0000000..a9d7997 --- /dev/null +++ b/resources/SalomeApp.xml @@ -0,0 +1,32 @@ + + +
+ +
+
+ + +
+
+ +
+
diff --git a/resources/gmsh.png b/resources/gmsh.png new file mode 100644 index 0000000..062b8fc Binary files /dev/null and b/resources/gmsh.png differ diff --git a/src/GMSHPlugin/GMSHPluginBuilder.py b/src/GMSHPlugin/GMSHPluginBuilder.py new file mode 100755 index 0000000..1d135f0 --- /dev/null +++ b/src/GMSHPlugin/GMSHPluginBuilder.py @@ -0,0 +1,73 @@ +# Copyright (C) 2012-2013 ALNEOS +# +# 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.alneos.com/ or email : contact@alneos.fr +# + +## +# @package GMSHPluginBuilder +# Python API for the GMSH meshing plug-in module. + +from salome.smesh.smesh_algorithm import Mesh_Algorithm + +# import GMSHPlugin module if possible +noGMSHPlugin = 0 +try: + import GMSHPlugin +except ImportError: + noGMSHPlugin = 1 + pass + +# Types of algorithms +GMSH = "GMSH" +GMSH_2D = "GMSH_2D" + +## Base of all GMSH algorithms. +# +class GMSH_Algorithm(Mesh_Algorithm): + + meshMethod = "Tetrahedron" + algoType = GMSH + + def __init__(self, mesh, geom=0): + Mesh_Algorithm.__init__(self) + if noGMSHPlugin: print "Warning: GMSHPlugin module unavailable" + self.Create(mesh, geom, self.algoType, "libGMSHEngine.so") + self.params = None + + ## Defines hypothesis having several parameters + # + def Parameters(self): + if self.algoType == GMSH_2D: + hypType = "GMSH_Parameters_2D" + elif self.algoType == GMSH: + hypType = "GMSH_Parameters" + + if self.params and self.params.GetName() != hypType: + self.mesh.RemoveHypothesis( self.params, self.geom ) + self.params = None + if not self.params: + self.params = self.Hypothesis(hypType, [],"libGMSHEngine.so",UseExisting=0) + return self.params + +class GMSH_2D_Algorithm(GMSH_Algorithm): + + meshMethod = "Triangle" + algoType = GMSH_2D + + ## Private constructor. + def __init__(self, mesh, geom=0): + GMSH_Algorithm.__init__(self, mesh, geom) diff --git a/src/GMSHPlugin/GMSHPlugin_Defs.hxx b/src/GMSHPlugin/GMSHPlugin_Defs.hxx new file mode 100755 index 0000000..1263da2 --- /dev/null +++ b/src/GMSHPlugin/GMSHPlugin_Defs.hxx @@ -0,0 +1,32 @@ +// Copyright (C) 2012-2013 ALNEOS +// +// 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.alneos.com/ or email : contact@alneos.fr +// +#ifndef _GMSHPlugin_DEFS_HXX_ +#define _GMSHPlugin_DEFS_HXX_ + +#ifdef WIN32 + #if defined GMSHPLUGIN_EXPORTS || defined GMSHEngine_EXPORTS + #define GMSHPLUGIN_EXPORT __declspec( dllexport ) + #else + #define GMSHPLUGIN_EXPORT __declspec( dllimport ) + #endif +#else + #define GMSHPLUGIN_EXPORT +#endif + +#endif diff --git a/src/GMSHPlugin/GMSHPlugin_GMSH.cxx b/src/GMSHPlugin/GMSHPlugin_GMSH.cxx new file mode 100755 index 0000000..70ee39c --- /dev/null +++ b/src/GMSHPlugin/GMSHPlugin_GMSH.cxx @@ -0,0 +1,141 @@ +// Copyright (C) 2012-2013 ALNEOS +// +// 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.alneos.com/ or email : contact@alneos.fr +// +#include "GMSHPlugin_GMSH.hxx" +#include "GMSHPlugin_Hypothesis.hxx" +#include "GMSHPlugin_Mesher.hxx" + +#include +#include +#include +#include +#include + +#include + +using namespace std; + +//============================================================================= +/*! + * + */ +//============================================================================= + +GMSHPlugin_GMSH::GMSHPlugin_GMSH(int hypId, int studyId, + SMESH_Gen* gen) + : SMESH_3D_Algo(hypId, studyId, gen) +{ + MESSAGE("GMSHPlugin_GMSH::GMSHPlugin_GMSH"); + _name = "GMSH"; + _shapeType = (1 << TopAbs_SHELL) | (1 << TopAbs_SOLID);// 1 bit /shape type + _compatibleHypothesis.push_back("GMSH_Parameters"); + _requireDiscreteBoundary = false; + _onlyUnaryInput = false; + _hypothesis = NULL; + _supportSubmeshes = true; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +GMSHPlugin_GMSH::~GMSHPlugin_GMSH() +{ + MESSAGE("GMSHPlugin_GMSH::~GMSHPlugin_GMSH"); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +bool GMSHPlugin_GMSH::CheckHypothesis + (SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape, + SMESH_Hypothesis::Hypothesis_Status& aStatus) +{ + MESSAGE("GMSHPlugin_GMSH::CheckHypothesis"); + + _hypothesis = NULL; + + const list& hyps = GetUsedHypothesis(aMesh, aShape); + int nbHyp = hyps.size(); + if (!nbHyp) + { + aStatus = SMESH_Hypothesis::HYP_OK; + return true; // can work with no hypothesis + } + // use only the first hypothesis + const SMESHDS_Hypothesis* theHyp = hyps.front(); + + string hypName = theHyp->GetName(); + if ( find( _compatibleHypothesis.begin(), _compatibleHypothesis.end(), + hypName ) != _compatibleHypothesis.end() ) + { + _hypothesis = theHyp; + aStatus = SMESH_Hypothesis::HYP_OK; + } + else + { + aStatus = SMESH_Hypothesis::HYP_INCOMPATIBLE; + } + + return aStatus == SMESH_Hypothesis::HYP_OK; +} + +//============================================================================= +/*! + *Here we are going to use the GMSH mesher + */ +//============================================================================= + +bool GMSHPlugin_GMSH::Compute(SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape) +{ + GMSHPlugin_Mesher mesher(&aMesh, aShape); + mesher.SetParameters(dynamic_cast(_hypothesis)); + return mesher.Compute(); +} + +#ifdef WITH_SMESH_CANCEL_COMPUTE +void GMSHPlugin_GMSH::CancelCompute() +{} +#endif + +//============================================================================= +/*! + * + */ +//============================================================================= + +bool GMSHPlugin_GMSH::Evaluate(SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape, + MapShapeNbElems& aResMap) +{ + std::vector aResVec(SMDSEntity_Last); + for(int i=SMDSEntity_Node; iGetComputeError(); + smError.reset( new SMESH_ComputeError(COMPERR_ALGO_FAILED,"Evaluation is not implemented",this)); + + return true; +} diff --git a/src/GMSHPlugin/GMSHPlugin_GMSH.hxx b/src/GMSHPlugin/GMSHPlugin_GMSH.hxx new file mode 100755 index 0000000..77f012d --- /dev/null +++ b/src/GMSHPlugin/GMSHPlugin_GMSH.hxx @@ -0,0 +1,57 @@ +// Copyright (C) 2012-2013 ALNEOS +// +// 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.alneos.com/ or email : contact@alneos.fr +// +#ifndef _GMSHPlugin_GMSH_HXX_ +#define _GMSHPlugin_GMSH_HXX_ + +#include "GMSHPlugin_Defs.hxx" + +#include "SMESH_Algo.hxx" +#include "SMESH_subMesh.hxx" +#include "SMESH_Mesh.hxx" +#include "StdMeshers_MaxElementVolume.hxx" +#include "Utils_SALOME_Exception.hxx" + +//class GMSHPlugin_Hypothesis; + +class GMSHPLUGIN_EXPORT GMSHPlugin_GMSH: public SMESH_3D_Algo +{ +public: + GMSHPlugin_GMSH(int hypId, int studyId, SMESH_Gen* gen); + virtual ~GMSHPlugin_GMSH(); + + virtual bool CheckHypothesis(SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape, + SMESH_Hypothesis::Hypothesis_Status& aStatus); + + virtual bool Compute(SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape); + +#ifdef WITH_SMESH_CANCEL_COMPUTE + virtual void CancelCompute(); +#endif + + virtual bool Evaluate(SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape, + MapShapeNbElems& aResMap); + +protected: + const SMESHDS_Hypothesis* _hypothesis; +}; + +#endif diff --git a/src/GMSHPlugin/GMSHPlugin_GMSH_2D.cxx b/src/GMSHPlugin/GMSHPlugin_GMSH_2D.cxx new file mode 100755 index 0000000..25fbd6a --- /dev/null +++ b/src/GMSHPlugin/GMSHPlugin_GMSH_2D.cxx @@ -0,0 +1,141 @@ +// Copyright (C) 2012-2013 ALNEOS +// +// 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.alneos.com/ or email : contact@alneos.fr +// +#include "GMSHPlugin_GMSH_2D.hxx" +#include "GMSHPlugin_Hypothesis_2D.hxx" +#include "GMSHPlugin_Mesher.hxx" + +#include +#include +#include +#include +#include + +#include + +using namespace std; + +//============================================================================= +/*! + * + */ +//============================================================================= + +GMSHPlugin_GMSH_2D::GMSHPlugin_GMSH_2D(int hypId, int studyId, + SMESH_Gen* gen) + : SMESH_2D_Algo(hypId, studyId, gen) +{ + MESSAGE("GMSHPlugin_GMSH_2D::GMSHPlugin_GMSH_2D"); + _name = "GMSH_2D"; + _shapeType = (1 << TopAbs_FACE); // 1 bit /shape type + _compatibleHypothesis.push_back("GMSH_Parameters_2D"); + _requireDiscreteBoundary = false; + _onlyUnaryInput = false; + _hypothesis = NULL; + _supportSubmeshes = true; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +GMSHPlugin_GMSH_2D::~GMSHPlugin_GMSH_2D() +{ + MESSAGE("GMSHPlugin_GMSH_2D::~GMSHPlugin_GMSH_2D"); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +bool GMSHPlugin_GMSH_2D::CheckHypothesis + (SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape, + SMESH_Hypothesis::Hypothesis_Status& aStatus) +{ + MESSAGE("GMSHPlugin_GMSH::CheckHypothesis"); + + _hypothesis = NULL; + + const list& hyps = GetUsedHypothesis(aMesh, aShape); + int nbHyp = hyps.size(); + if (!nbHyp) + { + aStatus = SMESH_Hypothesis::HYP_OK; + return true; // can work with no hypothesis + } + // use only the first hypothesis + const SMESHDS_Hypothesis* theHyp = hyps.front(); + + string hypName = theHyp->GetName(); + if ( find( _compatibleHypothesis.begin(), _compatibleHypothesis.end(), + hypName ) != _compatibleHypothesis.end() ) + { + _hypothesis = theHyp; + aStatus = SMESH_Hypothesis::HYP_OK; + } + else + { + aStatus = SMESH_Hypothesis::HYP_INCOMPATIBLE; + } + + return aStatus == SMESH_Hypothesis::HYP_OK; +} + +//============================================================================= +/*! + *Here we are going to use the GMSH mesher + */ +//============================================================================= + +bool GMSHPlugin_GMSH_2D::Compute(SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape) +{ + GMSHPlugin_Mesher mesher(&aMesh, aShape); + mesher.SetParameters(dynamic_cast(_hypothesis)); + return mesher.Compute(); +} + +#ifdef WITH_SMESH_CANCEL_COMPUTE +void GMSHPlugin_GMSH_2D::CancelCompute() +{} +#endif + +//============================================================================= +/*! + * + */ +//============================================================================= + +bool GMSHPlugin_GMSH_2D::Evaluate(SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape, + MapShapeNbElems& aResMap) +{ + std::vector aResVec(SMDSEntity_Last); + for(int i=SMDSEntity_Node; iGetComputeError(); + smError.reset( new SMESH_ComputeError(COMPERR_ALGO_FAILED,"Evaluation is not implemented",this)); + + return true; +} diff --git a/src/GMSHPlugin/GMSHPlugin_GMSH_2D.hxx b/src/GMSHPlugin/GMSHPlugin_GMSH_2D.hxx new file mode 100755 index 0000000..ed4f4ff --- /dev/null +++ b/src/GMSHPlugin/GMSHPlugin_GMSH_2D.hxx @@ -0,0 +1,57 @@ +// Copyright (C) 2012-2013 ALNEOS +// +// 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.alneos.com/ or email : contact@alneos.fr +// +#ifndef _GMSHPlugin_GMSH_2D_HXX_ +#define _GMSHPlugin_GMSH_2D_HXX_ + +#include "GMSHPlugin_Defs.hxx" + +#include "SMESH_Algo.hxx" +#include "SMESH_subMesh.hxx" +#include "SMESH_Mesh.hxx" +#include "StdMeshers_MaxElementVolume.hxx" +#include "Utils_SALOME_Exception.hxx" + +//class GMSHPlugin_Hypothesis_2D; + +class GMSHPLUGIN_EXPORT GMSHPlugin_GMSH_2D: public SMESH_2D_Algo +{ +public: + GMSHPlugin_GMSH_2D(int hypId, int studyId, SMESH_Gen* gen); + virtual ~GMSHPlugin_GMSH_2D(); + + virtual bool CheckHypothesis(SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape, + SMESH_Hypothesis::Hypothesis_Status& aStatus); + + virtual bool Compute(SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape); + +#ifdef WITH_SMESH_CANCEL_COMPUTE + virtual void CancelCompute(); +#endif + + virtual bool Evaluate(SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape, + MapShapeNbElems& aResMap); + +protected: + const SMESHDS_Hypothesis* _hypothesis; +}; + +#endif diff --git a/src/GMSHPlugin/GMSHPlugin_GMSH_2D_i.cxx b/src/GMSHPlugin/GMSHPlugin_GMSH_2D_i.cxx new file mode 100755 index 0000000..1edff55 --- /dev/null +++ b/src/GMSHPlugin/GMSHPlugin_GMSH_2D_i.cxx @@ -0,0 +1,74 @@ +// Copyright (C) 2012-2013 ALNEOS +// +// 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.alneos.com/ or email : contact@alneos.fr +// +#include "GMSHPlugin_GMSH_2D_i.hxx" +#include "SMESH_Gen.hxx" + +#include "Utils_CorbaException.hxx" +#include "utilities.h" + +using namespace std; + +//============================================================================= +/*! + * GMSHPlugin_GMSH_2D_i::GMSHPlugin_GMSH_2D_i + * + * Constructor + */ +//============================================================================= + +GMSHPlugin_GMSH_2D_i::GMSHPlugin_GMSH_2D_i( PortableServer::POA_ptr thePOA, + int theStudyId, + ::SMESH_Gen* theGenImpl ) + : SALOME::GenericObj_i( thePOA ), + SMESH_Hypothesis_i( thePOA ), + SMESH_Algo_i( thePOA ), + SMESH_2D_Algo_i( thePOA ) +{ + MESSAGE( "GMSHPlugin_GMSH_2D_i::GMSHPlugin_GMSH_2D_i" ); + myBaseImpl = new ::GMSHPlugin_GMSH_2D( theGenImpl->GetANewId(), + theStudyId, + theGenImpl ); +} + +//============================================================================= +/*! + * GMSHPlugin_GMSH_2D_i::~GMSHPlugin_GMSH_2D_i + * + * Destructor + */ +//============================================================================= + +GMSHPlugin_GMSH_2D_i::~GMSHPlugin_GMSH_2D_i() +{ + MESSAGE( "GMSHPlugin_GMSH_2D_i::~GMSHPlugin_GMSH_2D_i" ); +} + +//============================================================================= +/*! + * GMSHPlugin_GMSH_2D_i::GetImpl + * + * Get implementation + */ +//============================================================================= + +::GMSHPlugin_GMSH_2D* GMSHPlugin_GMSH_2D_i::GetImpl() +{ + MESSAGE( "GMSHPlugin_GMSH_2D_i::GetImpl" ); + return ( ::GMSHPlugin_GMSH_2D* )myBaseImpl; +} diff --git a/src/GMSHPlugin/GMSHPlugin_GMSH_2D_i.hxx b/src/GMSHPlugin/GMSHPlugin_GMSH_2D_i.hxx new file mode 100755 index 0000000..f7ac628 --- /dev/null +++ b/src/GMSHPlugin/GMSHPlugin_GMSH_2D_i.hxx @@ -0,0 +1,49 @@ +// Copyright (C) 2012-2013 ALNEOS +// +// 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.alneos.com/ or email : contact@alneos.fr +// +#ifndef _GMSHPlugin_GMSH_2D_I_HXX_ +#define _GMSHPlugin_GMSH_2D_I_HXX_ + +#include "GMSHPlugin_Defs.hxx" + +#include +#include CORBA_SERVER_HEADER(GMSHPlugin_Algorithm) + +#include "SMESH_2D_Algo_i.hxx" +#include "GMSHPlugin_GMSH_2D.hxx" + +// ====================================================== +// GMSH 3d algorithm +// ====================================================== +class GMSHPLUGIN_EXPORT GMSHPlugin_GMSH_2D_i: + public virtual POA_GMSHPlugin::GMSHPlugin_GMSH_2D, + public virtual SMESH_2D_Algo_i +{ +public: + // Constructor + GMSHPlugin_GMSH_2D_i( PortableServer::POA_ptr thePOA, + int theStudyId, + ::SMESH_Gen* theGenImpl ); + // Destructor + virtual ~GMSHPlugin_GMSH_2D_i(); + + // Get implementation + ::GMSHPlugin_GMSH_2D* GetImpl(); +}; + +#endif diff --git a/src/GMSHPlugin/GMSHPlugin_GMSH_i.cxx b/src/GMSHPlugin/GMSHPlugin_GMSH_i.cxx new file mode 100755 index 0000000..f872e79 --- /dev/null +++ b/src/GMSHPlugin/GMSHPlugin_GMSH_i.cxx @@ -0,0 +1,74 @@ +// Copyright (C) 2012-2013 ALNEOS +// +// 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.alneos.com/ or email : contact@alneos.fr +// +#include "GMSHPlugin_GMSH_i.hxx" +#include "SMESH_Gen.hxx" + +#include "Utils_CorbaException.hxx" +#include "utilities.h" + +using namespace std; + +//============================================================================= +/*! + * GMSHPlugin_GMSH_i::GMSHPlugin_GMSH_i + * + * Constructor + */ +//============================================================================= + +GMSHPlugin_GMSH_i::GMSHPlugin_GMSH_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 ) +{ + MESSAGE( "GMSHPlugin_GMSH_i::GMSHPlugin_GMSH_i" ); + myBaseImpl = new ::GMSHPlugin_GMSH( theGenImpl->GetANewId(), + theStudyId, + theGenImpl ); +} + +//============================================================================= +/*! + * GMSHPlugin_GMSH_i::~GMSHPlugin_GMSH_i + * + * Destructor + */ +//============================================================================= + +GMSHPlugin_GMSH_i::~GMSHPlugin_GMSH_i() +{ + MESSAGE( "GMSHPlugin_GMSH_i::~GMSHPlugin_GMSH_i" ); +} + +//============================================================================= +/*! + * GMSHPlugin_GMSH_i::GetImpl + * + * Get implementation + */ +//============================================================================= + +::GMSHPlugin_GMSH* GMSHPlugin_GMSH_i::GetImpl() +{ + MESSAGE( "GMSHPlugin_GMSH_i::GetImpl" ); + return ( ::GMSHPlugin_GMSH* )myBaseImpl; +} diff --git a/src/GMSHPlugin/GMSHPlugin_GMSH_i.hxx b/src/GMSHPlugin/GMSHPlugin_GMSH_i.hxx new file mode 100755 index 0000000..2ba81cf --- /dev/null +++ b/src/GMSHPlugin/GMSHPlugin_GMSH_i.hxx @@ -0,0 +1,49 @@ +// Copyright (C) 2012-2013 ALNEOS +// +// 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.alneos.com/ or email : contact@alneos.fr +// +#ifndef _GMSHPlugin_GMSH_I_HXX_ +#define _GMSHPlugin_GMSH_I_HXX_ + +#include "GMSHPlugin_Defs.hxx" + +#include +#include CORBA_SERVER_HEADER(GMSHPlugin_Algorithm) + +#include "SMESH_3D_Algo_i.hxx" +#include "GMSHPlugin_GMSH.hxx" + +// ====================================================== +// GMSH 3d algorithm +// ====================================================== +class GMSHPLUGIN_EXPORT GMSHPlugin_GMSH_i: + public virtual POA_GMSHPlugin::GMSHPlugin_GMSH, + public virtual SMESH_3D_Algo_i +{ +public: + // Constructor + GMSHPlugin_GMSH_i( PortableServer::POA_ptr thePOA, + int theStudyId, + ::SMESH_Gen* theGenImpl ); + // Destructor + virtual ~GMSHPlugin_GMSH_i(); + + // Get implementation + ::GMSHPlugin_GMSH* GetImpl(); +}; + +#endif diff --git a/src/GMSHPlugin/GMSHPlugin_Hypothesis.cxx b/src/GMSHPlugin/GMSHPlugin_Hypothesis.cxx new file mode 100755 index 0000000..102f07e --- /dev/null +++ b/src/GMSHPlugin/GMSHPlugin_Hypothesis.cxx @@ -0,0 +1,368 @@ +// Copyright (C) 2012-2013 ALNEOS +// +// 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.alneos.com/ or email : contact@alneos.fr +// +#include "GMSHPlugin_Hypothesis.hxx" + +#include "GMSHPlugin_Mesher.hxx" +#include "SMESH_Mesh.hxx" + +#include + +using namespace std; + + +GMSHPlugin_Hypothesis::GMSHPlugin_Hypothesis (int hypId, int studyId, + SMESH_Gen * gen) + : SMESH_Hypothesis(hypId, studyId, gen), + _algo2d (automatic), + _algo3d (frontal3), + _recomb2DAlgo (standard), + _recombineAll (false), + _subdivAlgo (none), + _remeshAlgo (nosplit), + _remeshPara (harmonic), + _smouthSteps (1), + _sizeFactor (1), + _maxSize (1e22), + _minSize (0), + _secondOrder (false), + _useIncomplElem (true) +{ + _name = "GMSH_Parameters"; + _param_algo_dim = 3; +} + +void GMSHPlugin_Hypothesis::Set2DAlgo(Algo2D the2DAlgo) +{ + if (the2DAlgo != _algo2d) + { + _algo2d = the2DAlgo; + NotifySubMeshesHypothesisModification(); + } +} + +void GMSHPlugin_Hypothesis::Set3DAlgo(Algo3D the3DAlgo) +{ + if (the3DAlgo != _algo3d) + { + _algo3d = the3DAlgo; + NotifySubMeshesHypothesisModification(); + } +} + +void GMSHPlugin_Hypothesis::SetRecomb2DAlgo(Recomb2DAlgo theRecomb2DAlgo) +{ + if (theRecomb2DAlgo != _recomb2DAlgo) + { + _recomb2DAlgo = theRecomb2DAlgo; + NotifySubMeshesHypothesisModification(); + } +} + +void GMSHPlugin_Hypothesis::SetRecombineAll(bool theRecombineAll) +{ + if (theRecombineAll != _recombineAll) + { + _recombineAll = theRecombineAll; + NotifySubMeshesHypothesisModification(); + } +} + +void GMSHPlugin_Hypothesis::SetSubdivAlgo(SubdivAlgo theSubdivAlgo) +{ + if (theSubdivAlgo != _subdivAlgo) + { + _subdivAlgo = theSubdivAlgo; + NotifySubMeshesHypothesisModification(); + } +} + +void GMSHPlugin_Hypothesis::SetRemeshAlgo(RemeshAlgo theRemeshAlgo) +{ + if (theRemeshAlgo != _remeshAlgo) + { + _remeshAlgo = theRemeshAlgo; + NotifySubMeshesHypothesisModification(); + } +} + +void GMSHPlugin_Hypothesis::SetRemeshPara(RemeshPara theRemeshPara) +{ + if (theRemeshPara != _remeshPara) + { + _remeshPara = theRemeshPara; + NotifySubMeshesHypothesisModification(); + } +} + +void GMSHPlugin_Hypothesis::SetSmouthSteps(double theSmouthSteps) +{ + if (theSmouthSteps != _smouthSteps) + { + _smouthSteps = theSmouthSteps; + NotifySubMeshesHypothesisModification(); + } +} + +void GMSHPlugin_Hypothesis::SetSizeFactor(double theSizeFactor) +{ + if (theSizeFactor != _sizeFactor) + { + _sizeFactor = theSizeFactor; + NotifySubMeshesHypothesisModification(); + } +} + +void GMSHPlugin_Hypothesis::SetUseIncomplElem(bool theUseIncomplElem) +{ + if (theUseIncomplElem != _useIncomplElem) + { + _useIncomplElem = theUseIncomplElem; + NotifySubMeshesHypothesisModification(); + } +} + +void GMSHPlugin_Hypothesis::SetMaxSize(double theSize) +{ + if (theSize != _maxSize) + { + _maxSize = theSize; + NotifySubMeshesHypothesisModification(); + } +} + +void GMSHPlugin_Hypothesis::SetMinSize(double theSize) +{ + if (theSize != _minSize) + { + _minSize = theSize; + NotifySubMeshesHypothesisModification(); + } +} + +void GMSHPlugin_Hypothesis::SetSecondOrder(bool theVal) +{ + if (theVal != _secondOrder) + { + _secondOrder = theVal; + NotifySubMeshesHypothesisModification(); + } +} + +void GMSHPlugin_Hypothesis::SetIs2d(bool theIs2d) +{ + _is2d = theIs2d; +} + + +void GMSHPlugin_Hypothesis::SetCompoundOnEntry(const std::string& entry) +{ + if (_compounds.find(entry) == _compounds.end()) + { + _compounds.insert(entry); + NotifySubMeshesHypothesisModification(); + } +} + +void GMSHPlugin_Hypothesis::UnsetCompoundOnEntry(const std::string& entry) +{ + if (_compounds.find(entry) != _compounds.end()) + { + _compounds.erase(entry); + NotifySubMeshesHypothesisModification(); + } +} + +ostream & GMSHPlugin_Hypothesis::SaveTo(ostream & save) +{ + save << (int)_is2d << " " << _algo2d; + if (!_is2d) + save << " " << _algo3d; + save << " " << _recomb2DAlgo << + " " << (int)_recombineAll << + " " << _subdivAlgo << + " " << _remeshAlgo << + " " << _remeshPara << + " " << _smouthSteps << + " " << _sizeFactor << + " " << _maxSize << + " " << _minSize << + " " << (int)_secondOrder << + " " << (int)_useIncomplElem ; + + save << " " << "__COMPOUNDS_BEGIN__"; + for (TCompound::const_iterator it = _compounds.begin(); it != _compounds.end(); ++it ) + save << " " << *it << " "; + save << " " << "__COMPOUNDS_END__"; + + return save; +} + +istream & GMSHPlugin_Hypothesis::LoadFrom(istream & load) +{ + bool isOK = true; + int is; + double val; + + isOK = (load >> is); + if (isOK) + _is2d = (bool)is; + else + load.clear(ios::badbit | load.rdstate()); + + isOK = (load >> is); + if (isOK) + _algo2d = (Algo2D)is; + else + load.clear(ios::badbit | load.rdstate()); + + if (!_is2d) + { + isOK = (load >> is); + if (isOK) + _algo3d = (Algo3D)is; + else + load.clear(ios::badbit | load.rdstate()); + } + + isOK = (load >> is); + if (isOK) + _recomb2DAlgo = (Recomb2DAlgo)is; + else + load.clear(ios::badbit | load.rdstate()); + + isOK = (load >> is); + if (isOK) + _recombineAll = (bool)is; + else + load.clear(ios::badbit | load.rdstate()); + + isOK = (load >> is); + if (isOK) + _subdivAlgo = (SubdivAlgo)is; + else + load.clear(ios::badbit | load.rdstate()); + + isOK = (load >> is); + if (isOK) + _remeshAlgo = (RemeshAlgo)is; + else + load.clear(ios::badbit | load.rdstate()); + + isOK = (load >> is); + if (isOK) + _remeshPara = (RemeshPara)is; + else + load.clear(ios::badbit | load.rdstate()); + + isOK = (load >> val); + if (isOK) + _smouthSteps = val; + else + load.clear(ios::badbit | load.rdstate()); + + isOK = (load >> val); + if (isOK) + _sizeFactor = val; + else + load.clear(ios::badbit | load.rdstate()); + + isOK = (load >> val); + if (isOK) + _maxSize = val; + else + load.clear(ios::badbit | load.rdstate()); + + isOK = (load >> val); + if (isOK) + _minSize = val; + else + load.clear(ios::badbit | load.rdstate()); + + isOK = (load >> is); + if (isOK) + _secondOrder = (bool)is; + else + load.clear(ios::badbit | load.rdstate()); + + isOK = (load >> is); + if (isOK) + _useIncomplElem = (bool)is; + else + load.clear(ios::badbit | load.rdstate()); + + + std::string entry; + isOK = (load >> entry); + if (isOK && entry == "__COMPOUNDS_BEGIN__") + { + while (isOK && entry != "__COMPOUNDS_END__") + { + isOK = (load >> entry); + if (isOK && entry != "__COMPOUNDS_END__") + _compounds.insert(entry); + } + } + return load; +} + +ostream & operator <<(ostream & save, GMSHPlugin_Hypothesis & hyp) +{ + return hyp.SaveTo( save ); +} + +istream & operator >>(istream & load, GMSHPlugin_Hypothesis & hyp) +{ + return hyp.LoadFrom( load ); +} + + +//================================================================================ +/*! + * \brief Does nothing + * \param theMesh - the built mesh + * \param theShape - the geometry of interest + * \retval bool - always false + */ +//================================================================================ +bool GMSHPlugin_Hypothesis::SetParametersByMesh(const SMESH_Mesh* theMesh, + const TopoDS_Shape& theShape) +{ + return false; +} + +//================================================================================ +/*! + * \brief Initialize my parameter values by default parameters. + * \retval bool - true if parameter values have been successfully defined + */ +//================================================================================ + +bool GMSHPlugin_Hypothesis::SetParametersByDefaults(const TDefaults& dflts, + const SMESH_Mesh* theMesh) +{ + //_nbSegPerEdge = dflts._nbSegments; + //_maxSize = dflts._elemLength; + + //if ( dflts._shape && !dflts._shape->IsNull() ) + // _minSize = GMSHPlugin_Mesher::GetDefaultMinSize( *dflts._shape, _maxSize ); + //else if ( theMesh && theMesh->HasShapeToMesh() ) + // _minSize = GMSHPlugin_Mesher::GetDefaultMinSize( theMesh->GetShapeToMesh(), _maxSize ); + + //return _nbSegPerEdge && _maxSize > 0; +} diff --git a/src/GMSHPlugin/GMSHPlugin_Hypothesis.hxx b/src/GMSHPlugin/GMSHPlugin_Hypothesis.hxx new file mode 100755 index 0000000..fd9cf9a --- /dev/null +++ b/src/GMSHPlugin/GMSHPlugin_Hypothesis.hxx @@ -0,0 +1,168 @@ +// Copyright (C) 2012-2013 ALNEOS +// +// 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.alneos.com/ or email : contact@alneos.fr +// +#ifndef _GMSHPlugin_Hypothesis_HXX_ +#define _GMSHPlugin_Hypothesis_HXX_ + +#include "GMSHPlugin_Defs.hxx" + +#include "SMESH_Hypothesis.hxx" +#include "Utils_SALOME_Exception.hxx" + +#include + +// Parameters for work of GMSH +// + +using namespace std; + +class GMSHPLUGIN_EXPORT GMSHPlugin_Hypothesis: public SMESH_Hypothesis +{ +public: + + GMSHPlugin_Hypothesis(int hypId, int studyId, SMESH_Gen * gen); + + enum Algo2D + { + automatic, + meshadapt, + delaunay, + frontal, + delaunayforquad + }; + + void Set2DAlgo(Algo2D the2DAlgo); + Algo2D Get2DAlgo() const { return _algo2d; } + + enum Algo3D + { + frontal3, + frontaldelaunay, + fontalhex, + mmg3d, + rtree + }; + + void Set3DAlgo(Algo3D the3DAlgo); + Algo3D Get3DAlgo() const { return _algo3d; } + + enum Recomb2DAlgo + { + standard, + blossom + }; + + void SetRecomb2DAlgo(Recomb2DAlgo theRecomb2DAlgo); + Recomb2DAlgo GetRecomb2DAlgo() const { return _recomb2DAlgo; } + + void SetRecombineAll(bool theRecombineAll); + bool GetRecombineAll() const { return _recombineAll; } + + enum SubdivAlgo + { + none, + allquads, + allhexas + }; + + void SetSubdivAlgo(SubdivAlgo theSubdivAlgo); + SubdivAlgo GetSubdivAlgo() const { return _subdivAlgo; } + + enum RemeshAlgo + { + nosplit, + automaticR, + automaticmetis + }; + + void SetRemeshAlgo(RemeshAlgo theRemeshAlgo); + RemeshAlgo GetRemeshAlgo() const { return _remeshAlgo; } + + enum RemeshPara + { + harmonic, + conformal, + rbfharmonic + }; + + void SetRemeshPara(RemeshPara theRemeshPara); + RemeshPara GetRemeshPara() const { return _remeshPara; } + + void SetSmouthSteps(double theSmouthSteps); + double GetSmouthSteps() const { return _smouthSteps; } + + void SetSizeFactor(double theSizeFactor); + double GetSizeFactor() const { return _sizeFactor; } + + void SetUseIncomplElem(bool theUseIncomplElem); + bool GetUseIncomplElem() const { return _useIncomplElem; } + + void SetMaxSize(double theSize); + double GetMaxSize() const { return _maxSize; } + + void SetMinSize(double theSize); + double GetMinSize() const { return _minSize; } + + void SetSecondOrder(bool theVal); + bool GetSecondOrder() const { return _secondOrder; } + + void SetIs2d(bool theIs2d); + bool GetIs2d() const { return _is2d; } + + typedef std::set TCompound; + void SetCompoundOnEntry(const std::string& entry); + const TCompound& GetCompoundOnEntries() const { return _compounds; } + void UnsetCompoundOnEntry(const std::string& entry); + + // Persistence + virtual ostream & SaveTo(ostream & save); + virtual istream & LoadFrom(istream & load); + friend GMSHPLUGIN_EXPORT ostream & operator <<(ostream & save, GMSHPlugin_Hypothesis & hyp); + friend GMSHPLUGIN_EXPORT istream & operator >>(istream & load, GMSHPlugin_Hypothesis & hyp); + + /*! + * \brief Does nothing + * \param theMesh - the built mesh + * \param theShape - the geometry of interest + * \retval bool - always false + */ + virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape); + + /*! + * \brief Initialize my parameter values by default parameters. + * \retval bool - true if parameter values have been successfully defined + */ + virtual bool SetParametersByDefaults(const TDefaults& dflts, const SMESH_Mesh* theMesh=0); + +private: + Algo2D _algo2d; + Algo3D _algo3d; + Recomb2DAlgo _recomb2DAlgo; + bool _recombineAll; + SubdivAlgo _subdivAlgo; + RemeshAlgo _remeshAlgo; + RemeshPara _remeshPara; + double _smouthSteps; + double _sizeFactor; + double _minSize, _maxSize; + bool _secondOrder, _useIncomplElem; + bool _is2d; + TCompound _compounds; +}; + +#endif diff --git a/src/GMSHPlugin/GMSHPlugin_Hypothesis_2D.cxx b/src/GMSHPlugin/GMSHPlugin_Hypothesis_2D.cxx new file mode 100755 index 0000000..749fc7f --- /dev/null +++ b/src/GMSHPlugin/GMSHPlugin_Hypothesis_2D.cxx @@ -0,0 +1,39 @@ +// Copyright (C) 2012-2013 ALNEOS +// +// 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.alneos.com/ or email : contact@alneos.fr +// +#include "GMSHPlugin_Hypothesis_2D.hxx" +#include + +//#include + +using namespace std; + +//============================================================================= +/*! + * + */ +//============================================================================= +GMSHPlugin_Hypothesis_2D::GMSHPlugin_Hypothesis_2D (int hypId, int studyId, + SMESH_Gen * gen) + : GMSHPlugin_Hypothesis(hypId, studyId, gen) + +{ + _name = "GMSH_Parameters_2D"; + _param_algo_dim = 2; +} + diff --git a/src/GMSHPlugin/GMSHPlugin_Hypothesis_2D.hxx b/src/GMSHPlugin/GMSHPlugin_Hypothesis_2D.hxx new file mode 100755 index 0000000..2189e10 --- /dev/null +++ b/src/GMSHPlugin/GMSHPlugin_Hypothesis_2D.hxx @@ -0,0 +1,39 @@ +// Copyright (C) 2012-2013 ALNEOS +// +// 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.alneos.com/ or email : contact@alneos.fr +// +#ifndef _GMSHPlugin_Hypothesis_2D_HXX_ +#define _GMSHPlugin_Hypothesis_2D_HXX_ + +#include "GMSHPlugin_Defs.hxx" + +#include "GMSHPlugin_Hypothesis.hxx" +#include "Utils_SALOME_Exception.hxx" + +// Parameters for work of GMSH. +// This class is just to give 2D dimension, actually +// it inherits all behaviour of the parent + +class GMSHPLUGIN_EXPORT GMSHPlugin_Hypothesis_2D: public GMSHPlugin_Hypothesis +{ +public: + + GMSHPlugin_Hypothesis_2D(int hypId, int studyId, SMESH_Gen * gen); + +}; + +#endif diff --git a/src/GMSHPlugin/GMSHPlugin_Hypothesis_2D_i.cxx b/src/GMSHPlugin/GMSHPlugin_Hypothesis_2D_i.cxx new file mode 100755 index 0000000..52e2e06 --- /dev/null +++ b/src/GMSHPlugin/GMSHPlugin_Hypothesis_2D_i.cxx @@ -0,0 +1,75 @@ +// Copyright (C) 2012-2013 ALNEOS +// +// 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.alneos.com/ or email : contact@alneos.fr +// +#include "GMSHPlugin_Hypothesis_2D_i.hxx" +#include "SMESH_Gen.hxx" +#include "SMESH_PythonDump.hxx" + +#include "Utils_CorbaException.hxx" +#include "utilities.h" + +using namespace std; + +//============================================================================= +/*! + * GMSHPlugin_Hypothesis_2D_i::GMSHPlugin_Hypothesis_2D_i + * + * Constructor + */ +//============================================================================= +GMSHPlugin_Hypothesis_2D_i:: +GMSHPlugin_Hypothesis_2D_i (PortableServer::POA_ptr thePOA, + int theStudyId, + ::SMESH_Gen* theGenImpl) + : SALOME::GenericObj_i( thePOA ), + SMESH_Hypothesis_i( thePOA ), + GMSHPlugin_Hypothesis_i( thePOA, theStudyId, theGenImpl ) +{ + MESSAGE( "GMSHPlugin_Hypothesis_2D_i::GMSHPlugin_Hypothesis_2D_i" ); + if (myBaseImpl) + delete (::GMSHPlugin_Hypothesis*)myBaseImpl; + myBaseImpl = new ::GMSHPlugin_Hypothesis_2D (theGenImpl->GetANewId(), + theStudyId, + theGenImpl); +} + +//============================================================================= +/*! + * GMSHPlugin_Hypothesis_2D_i::~GMSHPlugin_Hypothesis_2D_i + * + * Destructor + */ +//============================================================================= +GMSHPlugin_Hypothesis_2D_i::~GMSHPlugin_Hypothesis_2D_i() +{ + MESSAGE( "GMSHPlugin_Hypothesis_2D_i::~GMSHPlugin_Hypothesis_2D_i" ); +} + +//================================================================================ +/*! + * \brief Verify whether hypothesis supports given entity type + * \param type - dimension (see SMESH::Dimension enumeration) + * \retval CORBA::Boolean - TRUE if dimension is supported, FALSE otherwise + * + * Verify whether hypothesis supports given entity type (see SMESH::Dimension enumeration) + */ +//================================================================================ +CORBA::Boolean GMSHPlugin_Hypothesis_2D_i::IsDimSupported( SMESH::Dimension type ) +{ + return type == SMESH::DIM_2D; +} diff --git a/src/GMSHPlugin/GMSHPlugin_Hypothesis_2D_i.hxx b/src/GMSHPlugin/GMSHPlugin_Hypothesis_2D_i.hxx new file mode 100755 index 0000000..3c7dd49 --- /dev/null +++ b/src/GMSHPlugin/GMSHPlugin_Hypothesis_2D_i.hxx @@ -0,0 +1,50 @@ +// Copyright (C) 2012-2013 ALNEOS +// +// 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.alneos.com/ or email : contact@alneos.fr +// +#ifndef _GMSHPlugin_Hypothesis_2D_i_HXX_ +#define _GMSHPlugin_Hypothesis_2D_i_HXX_ + +#include "GMSHPlugin_Defs.hxx" + +#include +#include CORBA_SERVER_HEADER(GMSHPlugin_Algorithm) + +#include "GMSHPlugin_Hypothesis_i.hxx" +#include "GMSHPlugin_Hypothesis_2D.hxx" + +class SMESH_Gen; + +// GMSHPlugin parameters hypothesis (2D case) + +class GMSHPLUGIN_EXPORT GMSHPlugin_Hypothesis_2D_i: + public virtual POA_GMSHPlugin::GMSHPlugin_Hypothesis_2D, + public GMSHPlugin_Hypothesis_i +{ + public: + // Constructor + GMSHPlugin_Hypothesis_2D_i (PortableServer::POA_ptr thePOA, + int theStudyId, + ::SMESH_Gen* theGenImpl); + // Destructor + virtual ~GMSHPlugin_Hypothesis_2D_i(); + + // Verify whether hypothesis supports given entity type + CORBA::Boolean IsDimSupported( SMESH::Dimension type ); +}; + +#endif diff --git a/src/GMSHPlugin/GMSHPlugin_Hypothesis_i.cxx b/src/GMSHPlugin/GMSHPlugin_Hypothesis_i.cxx new file mode 100755 index 0000000..548629b --- /dev/null +++ b/src/GMSHPlugin/GMSHPlugin_Hypothesis_i.cxx @@ -0,0 +1,345 @@ +// Copyright (C) 2012-2013 ALNEOS +// +// 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.alneos.com/ or email : contact@alneos.fr +// +#include "GMSHPlugin_Hypothesis_i.hxx" +#include "SMESH_Gen.hxx" +#include "SMESH_PythonDump.hxx" +#include "GEOM_Object.hxx" + +#include "Utils_CorbaException.hxx" +#include "utilities.h" + +using namespace std; + +template<> +bool GMSHPlugin_Hypothesis_i::isToSetParameter(double curValue, + double newValue, + /*SettingMethod*/int meth) +{ + return isToSetParameter(true, (fabs(curValue - newValue) < 1e-20), meth); +} + +GMSHPlugin_Hypothesis_i:: +GMSHPlugin_Hypothesis_i (PortableServer::POA_ptr thePOA, + int theStudyId, + ::SMESH_Gen* theGenImpl) + : SALOME::GenericObj_i( thePOA ), + SMESH_Hypothesis_i( thePOA ), + mySetMethodFlags(0) +{ + MESSAGE( "GMSHPlugin_Hypothesis_i::GMSHPlugin_Hypothesis_i" ); + myBaseImpl = new ::GMSHPlugin_Hypothesis (theGenImpl->GetANewId(), + theStudyId, + theGenImpl); +} + +GMSHPlugin_Hypothesis_i::~GMSHPlugin_Hypothesis_i() +{ + MESSAGE( "GMSHPlugin_Hypothesis_i::~GMSHPlugin_Hypothesis_i" ); +} + +void GMSHPlugin_Hypothesis_i::SetMaxSize (CORBA::Double theValue) +{ + if ( isToSetParameter( GetMaxSize(), theValue, METH_SetMaxSize )) + { + this->GetImpl()->SetMaxSize(theValue); + SMESH::TPythonDump() << _this() << ".SetMaxSize( " << SMESH::TVar(theValue) << " )"; + } +} + +CORBA::Double GMSHPlugin_Hypothesis_i::GetMaxSize() +{ + return this->GetImpl()->GetMaxSize(); +} + +void GMSHPlugin_Hypothesis_i::SetMinSize (CORBA::Double theValue) +{ + if ( isToSetParameter( GetMinSize(), theValue, METH_SetMinSize )) + { + this->GetImpl()->SetMinSize(theValue); + SMESH::TPythonDump() << _this() << ".SetMinSize( " << SMESH::TVar(theValue) << " )"; + } +} + +CORBA::Double GMSHPlugin_Hypothesis_i::GetMinSize() +{ + return this->GetImpl()->GetMinSize(); +} + +void GMSHPlugin_Hypothesis_i::SetSecondOrder (CORBA::Boolean theValue) +{ + if ( isToSetParameter( GetSecondOrder(), theValue, METH_SetSecondOrder )) + { + this->GetImpl()->SetSecondOrder(theValue); + SMESH::TPythonDump() << _this() << ".SetSecondOrder( " << theValue << " )"; + } +} + +CORBA::Boolean GMSHPlugin_Hypothesis_i::GetSecondOrder() +{ + return this->GetImpl()->GetSecondOrder(); +} + +void GMSHPlugin_Hypothesis_i::Set2DAlgo (CORBA::Long theValue) +{ + if ( isToSetParameter( Get2DAlgo(), theValue, METH_Set2DAlgo )) + { + this->GetImpl()->Set2DAlgo((::GMSHPlugin_Hypothesis::Algo2D)theValue); + SMESH::TPythonDump() << _this() << ".Set2DAlgo( " << theValue << " )"; + } +} + +CORBA::Long GMSHPlugin_Hypothesis_i::Get2DAlgo() +{ + return this->GetImpl()->Get2DAlgo(); +} + +void GMSHPlugin_Hypothesis_i::Set3DAlgo (CORBA::Long theValue) +{ + if ( isToSetParameter( Get3DAlgo(), theValue, METH_Set3DAlgo )) + { + this->GetImpl()->Set3DAlgo((::GMSHPlugin_Hypothesis::Algo3D)theValue); + SMESH::TPythonDump() << _this() << ".Set3DAlgo( " << theValue << " )"; + } +} + +CORBA::Long GMSHPlugin_Hypothesis_i::Get3DAlgo() +{ + return this->GetImpl()->Get3DAlgo(); +} + +void GMSHPlugin_Hypothesis_i::SetRecomb2DAlgo (CORBA::Long theValue) +{ + if ( isToSetParameter( GetRecomb2DAlgo(), theValue, METH_SetRecomb2DAlgo )) + { + this->GetImpl()->SetRecomb2DAlgo((::GMSHPlugin_Hypothesis::Recomb2DAlgo)theValue); + SMESH::TPythonDump() << _this() << ".SetRecomb2DAlgo( " << theValue << " )"; + } +} + +CORBA::Long GMSHPlugin_Hypothesis_i::GetRecomb2DAlgo() +{ + return this->GetImpl()->GetRecomb2DAlgo(); +} + +void GMSHPlugin_Hypothesis_i::SetRecombineAll (CORBA::Boolean theValue) +{ + if ( isToSetParameter( GetRecombineAll(), theValue, METH_SetRecombineAll )) + { + this->GetImpl()->SetRecombineAll(theValue); + SMESH::TPythonDump() << _this() << ".SetRecombineAll( " << theValue << " )"; + } +} + +CORBA::Boolean GMSHPlugin_Hypothesis_i::GetRecombineAll() +{ + return this->GetImpl()->GetRecombineAll(); +} + +void GMSHPlugin_Hypothesis_i::SetSubdivAlgo (CORBA::Long theValue) +{ + if ( isToSetParameter( GetSubdivAlgo(), theValue, METH_SetSubdivAlgo )) + { + this->GetImpl()->SetSubdivAlgo((::GMSHPlugin_Hypothesis::SubdivAlgo)theValue); + SMESH::TPythonDump() << _this() << ".SetSubdivAlgo( " << theValue << " )"; + } +} + +CORBA::Long GMSHPlugin_Hypothesis_i::GetSubdivAlgo() +{ + return this->GetImpl()->GetSubdivAlgo(); +} + +void GMSHPlugin_Hypothesis_i::SetRemeshAlgo (CORBA::Long theValue) +{ + if ( isToSetParameter( GetRemeshAlgo(), theValue, METH_SetRemeshAlgo )) + { + this->GetImpl()->SetRemeshAlgo((::GMSHPlugin_Hypothesis::RemeshAlgo)theValue); + SMESH::TPythonDump() << _this() << ".SetRemeshAlgo( " << theValue << " )"; + } +} + +CORBA::Long GMSHPlugin_Hypothesis_i::GetRemeshAlgo() +{ + return this->GetImpl()->GetRemeshAlgo(); +} + +void GMSHPlugin_Hypothesis_i::SetRemeshPara (CORBA::Long theValue) +{ + if ( isToSetParameter( GetRemeshPara(), theValue, METH_SetRemeshPara )) + { + this->GetImpl()->SetRemeshPara((::GMSHPlugin_Hypothesis::RemeshPara)theValue); + SMESH::TPythonDump() << _this() << ".SetRemeshAlgo( " << theValue << " )"; + } +} + +CORBA::Long GMSHPlugin_Hypothesis_i::GetRemeshPara() +{ + return this->GetImpl()->GetRemeshPara(); +} + +void GMSHPlugin_Hypothesis_i::SetSmouthSteps (CORBA::Double theValue) +{ + if ( isToSetParameter( GetSmouthSteps(), theValue, METH_SetSmouthSteps )) + { + this->GetImpl()->SetSmouthSteps(theValue); + SMESH::TPythonDump() << _this() << ".SetSmouthSteps( " << theValue << " )"; + } +} + +CORBA::Double GMSHPlugin_Hypothesis_i::GetSmouthSteps() +{ + return this->GetImpl()->GetSmouthSteps(); +} + +void GMSHPlugin_Hypothesis_i::SetSizeFactor (CORBA::Double theValue) +{ + if ( isToSetParameter( GetSizeFactor(), theValue, METH_SetSizeFactor )) + { + this->GetImpl()->SetSizeFactor(theValue); + SMESH::TPythonDump() << _this() << ".SetSizeFactor( " << theValue << " )"; + } +} + +CORBA::Double GMSHPlugin_Hypothesis_i::GetSizeFactor() +{ + return this->GetImpl()->GetSizeFactor(); +} + +void GMSHPlugin_Hypothesis_i::SetUseIncomplElem (CORBA::Boolean theValue) +{ + if ( isToSetParameter( GetUseIncomplElem(), theValue, METH_SetUseIncomplElem )) + { + this->GetImpl()->SetUseIncomplElem(theValue); + SMESH::TPythonDump() << _this() << ".SetUseIncomplElem( " << theValue << " )"; + } +} + +CORBA::Boolean GMSHPlugin_Hypothesis_i::GetUseIncomplElem() +{ + return this->GetImpl()->GetUseIncomplElem(); +} + +void GMSHPlugin_Hypothesis_i::SetIs2d (CORBA::Boolean theValue) +{ + this->GetImpl()->SetIs2d(theValue); + SMESH::TPythonDump() << _this() << ".SetIs2d( " << theValue << " )"; +} + +void GMSHPlugin_Hypothesis_i::SetCompoundOnShape(GEOM::GEOM_Object_ptr GeomObj) +{ + string entry; + entry = GeomObj->GetStudyEntry(); + SetCompoundOnEntry(entry.c_str()); +} + +void GMSHPlugin_Hypothesis_i::SetCompoundOnEntry(const char* entry) +{ + //if ( isToSetParameter( GetCompoundOnEntry(entry), METH_SetCompoundOnEntry )) + { + this->GetImpl()->SetCompoundOnEntry(entry); + SMESH::TPythonDump() + << _this() << ".SetCompoundOnShape(" << entry << ")"; + } +} + +GMSHPlugin::string_array* GMSHPlugin_Hypothesis_i::GetCompoundOnEntries() +{ + GMSHPlugin::string_array_var result = new GMSHPlugin::string_array(); + const ::GMSHPlugin_Hypothesis::TCompound compounds = + this->GetImpl()->GetCompoundOnEntries(); + result->length(compounds.size()); + ::GMSHPlugin_Hypothesis::TCompound::const_iterator it = compounds.begin(); + for (int i=0 ; it != compounds.end() ; i++, it++) + { + string entry = *it; + result[i] = CORBA::string_dup(entry.c_str()); + } + return result._retn(); +} + +void GMSHPlugin_Hypothesis_i::UnsetCompoundOnShape(GEOM::GEOM_Object_ptr GeomObj) +{ + string entry; + entry = GeomObj->GetStudyEntry(); + UnsetCompoundOnEntry(entry.c_str()); +} + +void GMSHPlugin_Hypothesis_i::UnsetCompoundOnEntry(const char* entry) +{ + this->GetImpl()->UnsetCompoundOnEntry(entry); + SMESH::TPythonDump() << _this() << ".UnsetCompoundOnShape(" << entry << ")"; +} + +::GMSHPlugin_Hypothesis* GMSHPlugin_Hypothesis_i::GetImpl() +{ + return (::GMSHPlugin_Hypothesis*)myBaseImpl; +} + +//================================================================================ +/*! + * \brief Verify whether hypothesis supports given entity type + * \param type - dimension (see SMESH::Dimension enumeration) + * \retval CORBA::Boolean - TRUE if dimension is supported, FALSE otherwise + * + * Verify whether hypothesis supports given entity type (see SMESH::Dimension enumeration) + */ +//================================================================================ +CORBA::Boolean GMSHPlugin_Hypothesis_i::IsDimSupported( SMESH::Dimension type ) +{ + return type == SMESH::DIM_3D; +} + +//================================================================================ +/*! + * \brief method intended to remove explicit treatment of Netagen hypotheses from SMESH_NoteBook + */ +//================================================================================ + +int GMSHPlugin_Hypothesis_i::getParamIndex(const TCollection_AsciiString& method, + int nbVars) const +{ + if ( method == "SetMaxSize" ) return 0; + if ( method == "SetGrowthRate" ) return 1; + if ( method == "SetNbSegPerEdge" ) return 2; + if ( method == "SetNbSegPerRadius" ) return 3; + if ( method == "SetMinSize" ) return nbVars-1; + + return SMESH_Hypothesis_i::getParamIndex( method, nbVars ); // return default value +} + +//================================================================================ +/*! + * \brief Method used to convert variable parameters stored in an old study + * into myMethod2VarParams. It should return a method name for an index of + * variable parameters. Index is countered from zero + */ +//================================================================================ + +std::string GMSHPlugin_Hypothesis_i::getMethodOfParameter(const int paramIndex, + int nbVars) const +{ + switch ( paramIndex ) { + case 0: return "SetMaxSize"; + case 1: return nbVars == 2 ? "SetMinSize" : "SetGrowthRate"; + case 2: return "SetNbSegPerEdge"; + case 3: return "SetNbSegPerRadius"; + case 4: return "SetMinSize"; + } + return ""; +} diff --git a/src/GMSHPlugin/GMSHPlugin_Hypothesis_i.hxx b/src/GMSHPlugin/GMSHPlugin_Hypothesis_i.hxx new file mode 100755 index 0000000..68fc75f --- /dev/null +++ b/src/GMSHPlugin/GMSHPlugin_Hypothesis_i.hxx @@ -0,0 +1,168 @@ +// Copyright (C) 2012-2013 ALNEOS +// +// 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.alneos.com/ or email : contact@alneos.fr +// +#ifndef _GMSHPlugin_Hypothesis_i_HXX_ +#define _GMSHPlugin_Hypothesis_i_HXX_ + +#include "GMSHPlugin_Defs.hxx" + +#include +#include CORBA_SERVER_HEADER(GMSHPlugin_Algorithm) + +#include "SMESH_Hypothesis_i.hxx" +#include "GMSHPlugin_Hypothesis.hxx" + +class SMESH_Gen; +//class GEOM_Object; + +// GMSHPlugin parameters hypothesis + +class GMSHPLUGIN_EXPORT GMSHPlugin_Hypothesis_i: + public virtual POA_GMSHPlugin::GMSHPlugin_Hypothesis, + public virtual SMESH_Hypothesis_i +{ + public: + // Constructor + GMSHPlugin_Hypothesis_i (PortableServer::POA_ptr thePOA, + int theStudyId, + ::SMESH_Gen* theGenImpl); + // Destructor + virtual ~GMSHPlugin_Hypothesis_i(); + + // Ajout d'un truc + + void SetMaxSize(CORBA::Double theSize); + CORBA::Double GetMaxSize(); + + void SetMinSize(CORBA::Double theSize); + CORBA::Double GetMinSize(); + + void SetSecondOrder(CORBA::Boolean theVal); + CORBA::Boolean GetSecondOrder(); + + void Set2DAlgo(CORBA::Long the2DAlgo); + CORBA::Long Get2DAlgo(); + void Set3DAlgo(CORBA::Long the3DAlgo); + CORBA::Long Get3DAlgo(); + void SetRecomb2DAlgo(CORBA::Long theRecomb2DAlgo); + CORBA::Long GetRecomb2DAlgo(); + void SetRecombineAll(CORBA::Boolean theRecombineAll); + CORBA::Boolean GetRecombineAll(); + void SetSubdivAlgo(CORBA::Long theSubdivAlgo); + CORBA::Long GetSubdivAlgo(); + void SetRemeshAlgo(CORBA::Long theRemeshAlgo); + CORBA::Long GetRemeshAlgo(); + void SetRemeshPara(CORBA::Long theRemeshPara); + CORBA::Long GetRemeshPara(); + void SetSmouthSteps(CORBA::Double theSmouthSteps); + CORBA::Double GetSmouthSteps(); + void SetSizeFactor(CORBA::Double theSizeFactor); + CORBA::Double GetSizeFactor(); + void SetUseIncomplElem(CORBA::Boolean theUseIncomplElem); + CORBA::Boolean GetUseIncomplElem(); + void SetIs2d(CORBA::Boolean theIs2d); + + void SetCompoundOnShape(GEOM::GEOM_Object_ptr GeomObj); + void SetCompoundOnEntry(const char* entry); + void UnsetCompoundOnShape(GEOM::GEOM_Object_ptr GeomObj); + void UnsetCompoundOnEntry(const char* entry); + GMSHPlugin::string_array* GetCompoundOnEntries(); + + // fin d'ajout + + void SetGrowthRate(CORBA::Double theRate); + CORBA::Double GetGrowthRate(); + + void SetNbSegPerEdge(CORBA::Double theVal); + CORBA::Double GetNbSegPerEdge(); + + void SetNbSegPerRadius(CORBA::Double theVal); + CORBA::Double GetNbSegPerRadius(); + + void SetLocalSizeOnShape(GEOM::GEOM_Object_ptr GeomObj, CORBA::Double localSize); + void SetLocalSizeOnEntry(const char* entry, CORBA::Double localSize); + CORBA::Double GetLocalSizeOnEntry(const char* entry); + GMSHPlugin::string_array* GetLocalSizeEntries(); + + void UnsetLocalSizeOnEntry(const char* entry); + + // Get implementation + ::GMSHPlugin_Hypothesis* GetImpl(); + + // Verify whether hypothesis supports given entity type + CORBA::Boolean IsDimSupported( SMESH::Dimension type ); + + protected: + + // to remember whether a parameter is already set (issue 0021364) + enum SettingMethod + { + METH_SetMaxSize = 1, + METH_SetMinSize = 2, + METH_SetSecondOrder = 4, + + //METH_SetFineness = 16, + METH_SetGrowthRate = 32, + METH_SetNbSegPerEdge = 64, + METH_SetNbSegPerRadius = 128, + METH_SetLocalSizeOnEntry = 256, + // ajout ici + METH_SetCompoundOnEntry = 299, + METH_Set2DAlgo = 300, + METH_Set3DAlgo = 301, + METH_SetRecomb2DAlgo = 302, + METH_SetRecombineAll = 303, + METH_SetSubdivAlgo = 304, + METH_SetRemeshAlgo = 305, + METH_SetRemeshPara = 306, + METH_SetSmouthSteps = 307, + METH_SetSizeFactor = 308, + METH_SetUseIncomplElem = 309, + METH_SetIs2d = 310, + // fin d'ajout + METH_LAST = METH_SetLocalSizeOnEntry + }; + int mySetMethodFlags; + + // Return true if a parameter is not yet set, else return true if a parameter changes. + // PythonDumping depends on the result of this function. + // Checking only change of a parameter is not enough because then the default values are + // not dumped and if the defaults will change then the behaviour of scripts + // created without dump of the default parameters will also change what is not good. + template + bool isToSetParameter(T curValue, T newValue, /*SettingMethod*/int meth) + { + if ( mySetMethodFlags & meth ) // already set, check if a value is changing + return ( curValue != newValue ); + else + return ( mySetMethodFlags |= meth ); // == return true + } + + public: + // method intended to remove explicit treatment of Netagen hypotheses from + // SMESH_NoteBook to assure backward compatibility after implemeneting + // issue 0021308: Remove hard-coded dependency of the external mesh plugins + virtual int getParamIndex(const TCollection_AsciiString& method, int nbVars) const; + + // method used to convert variable parameters stored in an old study + // into myMethod2VarParams. It should return a method name for an index of + // variable parameters. Index is countered from zero + virtual std::string getMethodOfParameter(const int paramIndex, int nbVars) const; +}; + +#endif diff --git a/src/GMSHPlugin/GMSHPlugin_Mesher.cxx b/src/GMSHPlugin/GMSHPlugin_Mesher.cxx new file mode 100755 index 0000000..cf3481b --- /dev/null +++ b/src/GMSHPlugin/GMSHPlugin_Mesher.cxx @@ -0,0 +1,910 @@ +// Copyright (C) 2012-2013 ALNEOS +// +// 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.alneos.com/ or email : contact@alneos.fr +// +#include "GMSHPlugin_Mesher.hxx" +#include "GMSHPlugin_Hypothesis_2D.hxx" + +#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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace std; + +//============================================================================= +/*! + * + */ +//============================================================================= + +GMSHPlugin_Mesher::GMSHPlugin_Mesher (SMESH_Mesh* mesh, + const TopoDS_Shape& aShape) + : _mesh (mesh), + _shape (aShape) +{ + // il faudra peut être mettre un truc par defaut si l'utilisateur ne rentre rien en para + //defaultParameters(); +} + +//void GMSHPlugin_Mesher::defaultParameters(){} + +void GMSHPlugin_Mesher::SetParameters(const GMSHPlugin_Hypothesis* hyp) +{ + if (hyp != NULL) + { + _algo2d = hyp->Get2DAlgo(); + _algo3d = hyp->Get3DAlgo(); + _recomb2DAlgo = hyp->GetRecomb2DAlgo(); + _recombineAll = hyp->GetRecombineAll(); + _subdivAlgo = hyp->GetSubdivAlgo(); + _remeshAlgo = hyp->GetRemeshAlgo(); + _remeshPara = hyp->GetRemeshPara(); + _smouthSteps = hyp->GetSmouthSteps(); + _sizeFactor = hyp->GetSizeFactor(); + _minSize = hyp->GetMinSize(); + _maxSize = hyp->GetMaxSize(); + _secondOrder = hyp->GetSecondOrder(); + _useIncomplElem = hyp->GetUseIncomplElem(); + _is2d = hyp->GetIs2d(); + _studyId = hyp->GetStudyId(); + _compounds = hyp->GetCompoundOnEntries(); + } + else + { + _algo2d = 0; + _algo3d = 0; + _recomb2DAlgo = 0; + _recombineAll = false; + _subdivAlgo = 0; + _remeshAlgo = 0; + _remeshPara = 0; + _smouthSteps = 1; + _sizeFactor = 1; + _minSize = 0; + _maxSize = 1e22; + _secondOrder = false; + _useIncomplElem = true; + _is2d = false; + } +} + +//================================================================================ +/*! + * \brief Set Gmsh Options + */ +//================================================================================ + +void GMSHPlugin_Mesher::SetGmshOptions() +{ + MESSAGE("GMSHPlugin_Mesher::SetGmshOptions"); + /* + printf("We chose _algo2d %d \n", _algo2d ); + printf("We chose _algo3d %d \n", _algo3d ); + printf("We chose _recomb2DAlgo %d \n", _recomb2DAlgo ); + printf("We chose _recombineAll %d \n", (_recombineAll)?1:0); + printf("We chose _subdivAlgo %d \n", _subdivAlgo ); + printf("We chose _remeshAlgo %d \n", _remeshAlgo ); + printf("We chose _remeshPara %d \n", _remeshPara ); + printf("We chose _smouthSteps %e \n", _smouthSteps ); + printf("We chose _sizeFactor %e \n", _sizeFactor ); + printf("We chose _minSize %e \n", _minSize ); + printf("We chose _maxSize %e \n", _maxSize ); + printf("We chose _secondOrder %d \n", (_secondOrder)?1:0); + printf("We chose _useIncomplElem %d \n", (_useIncomplElem)?1:0); + printf("We are in dimension %d \n", (_is2d)?2:3); + //*/ + + std::map mapAlgo2d; + mapAlgo2d[0]=2; mapAlgo2d[1]=1; mapAlgo2d[2]=5; mapAlgo2d[3]=6; mapAlgo2d[4]=8; + std::map mapAlgo3d; + mapAlgo3d[0]=1; mapAlgo3d[1]=4; mapAlgo3d[2]=5; mapAlgo3d[3]=6; mapAlgo3d[4]=7; mapAlgo3d[4]=9; + + int ok; + ok = GmshSetOption("Mesh", "Algorithm" , mapAlgo2d[_algo2d]) ; + ASSERT(ok); + if ( !_is2d) + { + ok = GmshSetOption("Mesh", "Algorithm3D" , mapAlgo2d[_algo3d]) ; + ASSERT(ok); + } + ok = GmshSetOption("Mesh", "RecombinationAlgorithm" , (double)_recomb2DAlgo) ; + ASSERT(ok); + ok = GmshSetOption("Mesh", "RecombineAll" , (_recombineAll)?1.:0.) ; + ASSERT(ok); + ok = GmshSetOption("Mesh", "SubdivisionAlgorithm" , (double)_subdivAlgo) ; + ASSERT(ok); + ok = GmshSetOption("Mesh", "RemeshAlgorithm" , (double)_remeshAlgo) ; + ASSERT(ok); + ok = GmshSetOption("Mesh", "RemeshParametrization" , (double)_remeshPara) ; + ASSERT(ok); + ok = GmshSetOption("Mesh", "Smoothing" , (double)_smouthSteps) ; + ASSERT(ok); + ok = GmshSetOption("Mesh", "CharacteristicLengthFactor", _sizeFactor) ; + ASSERT(ok); + ok = GmshSetOption("Mesh", "CharacteristicLengthMin" , _minSize) ; + ASSERT(ok); + ok = GmshSetOption("Mesh", "CharacteristicLengthMax" , _maxSize) ; + ASSERT(ok); + ok = GmshSetOption("Mesh", "ElementOrder" , (_secondOrder)?2.:1.) ; + ASSERT(ok); + if (_secondOrder) + { + ok = GmshSetOption("Mesh", "SecondOrderIncomplete" ,(_useIncomplElem)?1.:0.); + ASSERT(ok); + } +} + +//================================================================================ +/*! + * \brief Create and add Compounds into GModel _gModel. + */ +//================================================================================ + +void GMSHPlugin_Mesher::CreateGmshCompounds() +{ + MESSAGE("GMSHPlugin_Mesher::CreateGmshCompounds"); + + SMESH_Gen_i* smeshGen_i = SMESH_Gen_i::GetSMESHGen(); + CORBA::Object_var anObject = smeshGen_i->GetNS()->Resolve("/myStudyManager"); + SALOMEDS::StudyManager_var aStudyMgr = SALOMEDS::StudyManager::_narrow(anObject); + SALOMEDS::Study_var myStudy = aStudyMgr->GetStudyByID(_studyId); + + OCC_Internals* occgeo = _gModel->getOCCInternals(); + + for(std::set::const_iterator its = _compounds.begin();its != _compounds.end(); ++its ) + { + GEOM::GEOM_Object_var aGeomObj; + TopoDS_Shape geomShape = TopoDS_Shape(); + SALOMEDS::SObject_var aSObj = myStudy->FindObjectID( (*its).c_str() ); + SALOMEDS::GenericAttribute_var anAttr; + if (!aSObj->_is_nil() && aSObj->FindAttribute(anAttr, "AttributeIOR")) + { + SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); + CORBA::String_var aVal = anIOR->Value(); + CORBA::Object_var obj = myStudy->ConvertIORToObject(aVal); + aGeomObj = GEOM::GEOM_Object::_narrow(obj); + } + if ( !aGeomObj->_is_nil() ) + geomShape = smeshGen_i->GeomObjectToShape( aGeomObj.in() ); + + TopAbs_ShapeEnum geomType = geomShape.ShapeType(); + if (geomShape.ShapeType() == TopAbs_COMPOUND)// voir s'il ne faut pas mettre une erreur dans le cas contraire + { + //printf("shapeType == TopAbs_COMPOUND\n"); + TopoDS_Iterator it(geomShape); + TopAbs_ShapeEnum shapeType = it.Value().ShapeType(); + // compound of edges + if (shapeType == TopAbs_EDGE) + { + //printf(" shapeType == TopAbs_EDGE :"); + int num = _gModel->getNumEdges()+1; + Curve *curve = Create_Curve(num, MSH_SEGM_COMPOUND, 1, NULL, NULL, -1, -1, 0., 1.); + for (it; it.More(); it.Next()) + { + TopoDS_Shape topoShape = it.Value(); + ASSERT(topoShape.ShapeType() == shapeType); + curve->compound.push_back(occgeo->getOCCEdgeByNativePtr(_gModel, (TopoDS_Edge&)topoShape)->tag()); + } + Tree_Add(_gModel->getGEOInternals()->Curves, &curve); + _gModel->importGEOInternals(); + } + // compound of faces + else if (shapeType == TopAbs_FACE) + { + //printf(" shapeType == TopAbs_FACE :"); + int num = _gModel->getNumFaces()+1; + Surface *surface = Create_Surface(num, MSH_SURF_COMPOUND); + for (it; it.More(); it.Next()) + { + TopoDS_Shape topoShape = it.Value(); + ASSERT(topoShape.ShapeType() == shapeType); + surface->compound.push_back(occgeo->getOCCFaceByNativePtr(_gModel, (TopoDS_Face&)topoShape)->tag()); + } + Tree_Add(_gModel->getGEOInternals()->Surfaces, &surface); + _gModel->importGEOInternals(); + } + } + } +} + +//================================================================================ +/*! + * \brief Write mesh from GModel instance to SMESH instance + */ +//================================================================================ + +void GMSHPlugin_Mesher::FillSMesh() +{ + MESSAGE("GMSHPlugin_Mesher::FillSMesh"); + // GET MESH FROM SMESH + SMESHDS_Mesh* meshDS = _mesh->GetMeshDS(); + + // ADD 0D ELEMENTS + for(GModel::viter it = _gModel->firstVertex(); it != _gModel->lastVertex(); ++it){ + GVertex *gVertex = *it; + + // GET topoVertex CORRESPONDING TO gVertex + TopoDS_Vertex topoVertex = *((TopoDS_Vertex*)gVertex->getNativePtr()); + + if (gVertex->getVisibility() == 0) // belongs to a compound + { + SMESH_subMesh* sm = _mesh->GetSubMesh(topoVertex); + sm->SetIsAlwaysComputed(true); // prevent from displaying errors + continue; + } + + // FILL SMESH FOR topoVertex + //nodes + for(unsigned int i = 0; i < gVertex->mesh_vertices.size(); i++) + { + MVertex *v = gVertex->mesh_vertices[i]; + if(v->getIndex() >= 0) + { + SMDS_MeshNode *node = meshDS->AddNodeWithID(v->x(),v->y(),v->z(),v->getNum()); + meshDS->SetNodeOnVertex( node, topoVertex ); + } + } + //elements + for(unsigned int i = 0; i < gVertex->getNumMeshElements(); i++) + { + MElement *e = gVertex->getMeshElement(i); + std::vector verts; + e->getVertices(verts); + ASSERT(verts.size()==1); + SMDS_Mesh0DElement* zeroDElement = 0; + // WE DONT ADD 0D ELEMENTS because it does not follow the salome meshers philosophy + //zeroDElement = meshDS->Add0DElementWithID(verts[0]->getNum(),e->getNum()); + //meshDS->SetMeshElementOnShape(zeroDElement, topoVertex); + } + } + + // ADD 1D ELEMENTS + for(GModel::eiter it = _gModel->firstEdge(); it != _gModel->lastEdge(); ++it){ + GEdge *gEdge = *it; + + // GET topoEdge CORRESPONDING TO gEdge (map if compound) + TopoDS_Edge topoEdge; + std::map topoEdges; + + if(gEdge->geomType() != GEntity::CompoundCurve) + { + topoEdge = *((TopoDS_Edge*)gEdge->getNativePtr()); + if (gEdge->getVisibility() == 0) // belongs to a compound + { + SMESH_subMesh* sm = _mesh->GetSubMesh(topoEdge); + sm->SetIsAlwaysComputed(true); // prevent from displaying errors + continue; + } + } + else + { + // compound case, map construction GEdge/TopoDS_Edge + std::vector gEdges = ((GEdgeCompound*)gEdge)->getCompounds(); + for(std::vector::const_iterator itv = gEdges.begin();itv != gEdges.end(); ++itv) + { + topoEdges.insert( pair(*itv,*((TopoDS_Edge*)(*itv)->getNativePtr())) ); + } + } + + // FILL SMESH FOR topoEdge + //nodes + for(unsigned int i = 0; i < gEdge->mesh_vertices.size(); i++) + { + MVertex *v = gEdge->mesh_vertices[i]; + if(v->getIndex() >= 0) + { + SMDS_MeshNode *node = meshDS->AddNodeWithID(v->x(),v->y(),v->z(),v->getNum()); + + if (topoEdges.size() != 0) + { + // get back corresponding topoEdge in compound case + topoEdge.Nullify(); + SPoint3 point = v->point(); + float distmin = std::numeric_limits::max(); + for(map::const_iterator itm=topoEdges.begin();itm != topoEdges.end(); itm++) + { + SBoundingBox3d bounds = (*itm).first->bounds(); + float dist = DistBoundingBox(bounds,point); + if (dist < distmin) + { + topoEdge = (*itm).second; + distmin = dist; + if (distmin == 0.) + break; + } + } + } + + meshDS->SetNodeOnEdge( node, topoEdge ); + } + } + //elements + for(unsigned int i = 0; i < gEdge->getNumMeshElements(); i++) + { + MElement *e = gEdge->getMeshElement(i); + std::vector verts; + e->getVertices(verts); + SMDS_MeshEdge* edge = 0; + + if (topoEdges.size() !=0) + { + // get back corresponding topoEdge in compound case + topoEdge.Nullify(); + SPoint3 point = e->barycenter(); + float distmin = std::numeric_limits::max(); + for(map::const_iterator itm=topoEdges.begin();itm != topoEdges.end(); itm++) + { + SBoundingBox3d bounds = (*itm).first->bounds(); + float dist = DistBoundingBox(bounds,point); + if (dist < distmin) + { + topoEdge = (*itm).second; + distmin = dist; + if (distmin == 0.) + break; + } + } + } + + // if a node wasn't set, it is assigned here + for (unsigned j = 0; j < verts.size(); j++) + { + if(verts[j]->onWhat()->getVisibility() == 0) + { + SMDS_MeshNode *node = meshDS->AddNodeWithID(verts[i]->x(),verts[j]->y(),verts[j]->z(),verts[j]->getNum()); + meshDS->SetNodeOnEdge( node, topoEdge ); + verts[j]->setEntity(gEdge); + } + } + + switch (verts.size()) + { + case 2: + edge = meshDS->AddEdgeWithID(verts[0]->getNum(), + verts[1]->getNum(),e->getNum()); + break; + case 3: + edge = meshDS->AddEdgeWithID(verts[0]->getNum(), + verts[1]->getNum(), + verts[2]->getNum(),e->getNum()); + break; + default: + ASSERT(false); + continue; + } + meshDS->SetMeshElementOnShape(edge, topoEdge); + } + } + + // ADD 2D ELEMENTS + for(GModel::fiter it = _gModel->firstFace(); it != _gModel->lastFace(); ++it){ + GFace *gFace = *it; + + // GET topoFace CORRESPONDING TO gFace (map if compound) + TopoDS_Face topoFace; + std::map topoFaces; + + if(gFace->geomType() != GEntity::CompoundSurface) + { + topoFace = *((TopoDS_Face*)gFace->getNativePtr()); + if (gFace->getVisibility() == 0) // belongs to a compound + { + SMESH_subMesh* sm = _mesh->GetSubMesh(topoFace); + sm->SetIsAlwaysComputed(true); // prevent from displaying errors + continue; + } + } + else + { + // compound case, map construction GFace/TopoDS_Face + std::list gFaces = ((GFaceCompound*)gFace)->getCompounds(); + for(std::list::const_iterator itl = gFaces.begin();itl != gFaces.end(); ++itl) + { + topoFaces.insert( pair(*itl,*((TopoDS_Face*)(*itl)->getNativePtr())) ); + } + } + + // FILL SMESH FOR topoFace + //nodes + for(unsigned int i = 0; i < gFace->mesh_vertices.size(); i++) + { + MVertex *v = gFace->mesh_vertices[i]; + if(v->getIndex() >= 0) + { + SMDS_MeshNode *node = meshDS->AddNodeWithID(v->x(),v->y(),v->z(),v->getNum()); + + if (topoFaces.size() != 0) + { + // get back corresponding topoFace in compound case + topoFace.Nullify(); + SPoint3 point = v->point(); + float distmin = std::numeric_limits::max(); + for(map::const_iterator itm=topoFaces.begin();itm != topoFaces.end(); itm++) + { + SBoundingBox3d bounds = (*itm).first->bounds(); + float dist = DistBoundingBox(bounds,point); + if (dist < distmin) + { + topoFace = (*itm).second; + distmin = dist; + if (distmin == 0.) + break; + } + } + } + + meshDS->SetNodeOnFace( node, topoFace ); + } + } + //elements + for(unsigned int i = 0; i < gFace->getNumMeshElements(); i++) + { + MElement *e = gFace->getMeshElement(i); + std::vector verts; + e->getVertices(verts); + SMDS_MeshFace* face = 0; + + if (topoFaces.size() !=0) + { + // get back corresponding topoFace in compound case + topoFace.Nullify(); + SPoint3 point = e->barycenter(); + float distmin = std::numeric_limits::max(); + for(map::const_iterator itm=topoFaces.begin();itm != topoFaces.end(); itm++) + { + SBoundingBox3d bounds = (*itm).first->bounds(); + float dist = DistBoundingBox(bounds,point); + if (dist < distmin) + { + topoFace = (*itm).second; + distmin = dist; + if (distmin == 0.) + break; + } + } + } + + // if a node wasn't set, it is assigned here + for (unsigned j = 0; j < verts.size(); j++) + { + if(verts[j]->onWhat()->getVisibility() == 0) + { + SMDS_MeshNode *node = meshDS->AddNodeWithID(verts[j]->x(),verts[j]->y(),verts[j]->z(),verts[j]->getNum()); + meshDS->SetNodeOnFace( node, topoFace ); + verts[i]->setEntity(gFace); + } + } + switch (verts.size()) + { + case 3: + face = meshDS->AddFaceWithID(verts[0]->getNum(), + verts[1]->getNum(), + verts[2]->getNum(),e->getNum()); + break; + case 4: + face = meshDS->AddFaceWithID(verts[0]->getNum(), + verts[1]->getNum(), + verts[2]->getNum(), + verts[3]->getNum(),e->getNum()); + break; + case 6: + face = meshDS->AddFaceWithID(verts[0]->getNum(), + verts[1]->getNum(), + verts[2]->getNum(), + verts[3]->getNum(), + verts[4]->getNum(), + verts[5]->getNum(),e->getNum()); + break; + case 8: + face = meshDS->AddFaceWithID(verts[0]->getNum(), + verts[1]->getNum(), + verts[2]->getNum(), + verts[3]->getNum(), + verts[4]->getNum(), + verts[5]->getNum(), + verts[6]->getNum(), + verts[7]->getNum(),e->getNum()); + break; + case 9: + face = meshDS->AddFaceWithID(verts[0]->getNum(), + verts[1]->getNum(), + verts[2]->getNum(), + verts[3]->getNum(), + verts[4]->getNum(), + verts[5]->getNum(), + verts[6]->getNum(), + verts[7]->getNum(), + verts[8]->getNum(),e->getNum()); + break; + default: + ASSERT(false); + continue; + } + meshDS->SetMeshElementOnShape(face, topoFace); + } + } + + // ADD 3D ELEMENTS + for(GModel::riter it = _gModel->firstRegion(); it != _gModel->lastRegion(); ++it){ + GRegion *gRegion = *it; + if (gRegion->getVisibility() == 0) + continue; + + // GET topoSolid CORRESPONDING TO gRegion + TopoDS_Solid topoSolid = *((TopoDS_Solid*)gRegion->getNativePtr()); + + //printf("volume %d (%d) contains %d elements\n", meshDS->ShapeToIndex(topoSolid), gRegion->tag(), gRegion->getNumMeshElements()); + // FILL SMESH FOR topoSolid + + //nodes + for(unsigned int i = 0; i < gRegion->mesh_vertices.size(); i++) + { + MVertex *v = gRegion->mesh_vertices[i]; + if(v->getIndex() >= 0) + { + SMDS_MeshNode *node = meshDS->AddNodeWithID(v->x(),v->y(),v->z(),v->getNum()); + meshDS->SetNodeInVolume( node, topoSolid ); + } + } + + //elements + for(unsigned int i = 0; i < gRegion->getNumMeshElements(); i++) + { + MElement *e = gRegion->getMeshElement(i); + std::vector verts; + e->getVertices(verts); + SMDS_MeshVolume* volume = 0; + switch (verts.size()){ + case 4: + volume = meshDS->AddVolumeWithID(verts[0]->getNum(), + verts[2]->getNum(), + verts[1]->getNum(), + verts[3]->getNum(),e->getNum()); + break; + case 5: + volume = meshDS->AddVolumeWithID(verts[0]->getNum(), + verts[3]->getNum(), + verts[2]->getNum(), + verts[1]->getNum(), + verts[4]->getNum(),e->getNum()); + break; + case 6: + volume = meshDS->AddVolumeWithID(verts[0]->getNum(), + verts[2]->getNum(), + verts[1]->getNum(), + verts[3]->getNum(), + verts[5]->getNum(), + verts[4]->getNum(),e->getNum()); + break; + case 8: + volume = meshDS->AddVolumeWithID(verts[0]->getNum(), + verts[3]->getNum(), + verts[2]->getNum(), + verts[1]->getNum(), + verts[4]->getNum(), + verts[7]->getNum(), + verts[6]->getNum(), + verts[5]->getNum(),e->getNum()); + break; + case 10: + volume = meshDS->AddVolumeWithID(verts[0]->getNum(), + verts[2]->getNum(), + verts[1]->getNum(), + verts[3]->getNum(), + verts[6]->getNum(), + verts[5]->getNum(), + verts[4]->getNum(), + verts[7]->getNum(), + verts[8]->getNum(), + verts[9]->getNum(),e->getNum()); + break; + case 13: + volume = meshDS->AddVolumeWithID(verts[0]->getNum(), + verts[3]->getNum(), + verts[2]->getNum(), + verts[1]->getNum(), + verts[4]->getNum(), + verts[6]->getNum(), + verts[10]->getNum(), + verts[8]->getNum(), + verts[5]->getNum(), + verts[7]->getNum(), + verts[12]->getNum(), + verts[11]->getNum(), + verts[9]->getNum(),e->getNum()); + break; + case 14: // same as case 13, because no pyra14 in smesh + volume = meshDS->AddVolumeWithID(verts[0]->getNum(), + verts[3]->getNum(), + verts[2]->getNum(), + verts[1]->getNum(), + verts[4]->getNum(), + verts[6]->getNum(), + verts[10]->getNum(), + verts[8]->getNum(), + verts[5]->getNum(), + verts[7]->getNum(), + verts[12]->getNum(), + verts[11]->getNum(), + verts[9]->getNum(),e->getNum()); + break; + case 15: + volume = meshDS->AddVolumeWithID(verts[0]->getNum(), + verts[2]->getNum(), + verts[1]->getNum(), + verts[3]->getNum(), + verts[5]->getNum(), + verts[4]->getNum(), + verts[7]->getNum(), + verts[9]->getNum(), + verts[6]->getNum(), + verts[13]->getNum(), + verts[14]->getNum(), + verts[12]->getNum(), + verts[8]->getNum(), + verts[11]->getNum(), + verts[10]->getNum(),e->getNum()); + break; + case 18: // same as case 15, because no penta18 in smesh + volume = meshDS->AddVolumeWithID(verts[0]->getNum(), + verts[2]->getNum(), + verts[1]->getNum(), + verts[3]->getNum(), + verts[5]->getNum(), + verts[4]->getNum(), + verts[7]->getNum(), + verts[9]->getNum(), + verts[6]->getNum(), + verts[13]->getNum(), + verts[14]->getNum(), + verts[12]->getNum(), + verts[8]->getNum(), + verts[11]->getNum(), + verts[10]->getNum(),e->getNum()); + break; + case 20: + volume = meshDS->AddVolumeWithID(verts[0]->getNum(), + verts[3]->getNum(), + verts[2]->getNum(), + verts[1]->getNum(), + verts[4]->getNum(), + verts[7]->getNum(), + verts[6]->getNum(), + verts[5]->getNum(), + verts[9]->getNum(), + verts[13]->getNum(), + verts[11]->getNum(), + verts[8]->getNum(), + verts[17]->getNum(), + verts[19]->getNum(), + verts[18]->getNum(), + verts[16]->getNum(), + verts[10]->getNum(), + verts[15]->getNum(), + verts[14]->getNum(), + verts[12]->getNum(),e->getNum()); + break; + case 27: + volume = meshDS->AddVolumeWithID(verts[0]->getNum(), + verts[3]->getNum(), + verts[2]->getNum(), + verts[1]->getNum(), + verts[4]->getNum(), + verts[7]->getNum(), + verts[6]->getNum(), + verts[5]->getNum(), + verts[9]->getNum(), + verts[13]->getNum(), + verts[11]->getNum(), + verts[8]->getNum(), + verts[17]->getNum(), + verts[19]->getNum(), + verts[18]->getNum(), + verts[16]->getNum(), + verts[10]->getNum(), + verts[15]->getNum(), + verts[14]->getNum(), + verts[12]->getNum(), + verts[20]->getNum(), + verts[22]->getNum(), + verts[24]->getNum(), + verts[23]->getNum(), + verts[21]->getNum(), + verts[25]->getNum(), + verts[26]->getNum(), + e->getNum()); + break; + default: + ASSERT(false); + continue; + } + meshDS->SetMeshElementOnShape(volume, topoSolid); + } + } + + //return 0; +} + +//================================================================================ +/*! + * \brief Find if SPoint point is in SBoundingBox3d bounds + */ +//================================================================================ + +float GMSHPlugin_Mesher::DistBoundingBox(SBoundingBox3d& bounds,SPoint3& point) +{ + SPoint3 min = bounds.min(); + SPoint3 max = bounds.max(); + + float x,y,z; + + if (point.x() < min.x()) + x = min.x()-point.x(); + else if (point.x() > max.x()) + x = point.x()-max.x(); + else + x = 0.; + + if (point.y() < min.y()) + y = min.y()-point.y(); + else if (point.y() > max.y()) + y = point.y()-max.y(); + else + y = 0.; + + if (point.z() < min.z()) + z = min.z()-point.z(); + else if (point.z() > max.z()) + z = point.z()-max.z(); + else + z = 0.; + + return sqrt(x*x+y*y+z*z); +} +//================================================================================ +/*! + * \brief Reimplemented GmshMessage call. Actions done if errors occurs + * during gmsh meshing. We define here what to display and what to do. + */ +//================================================================================ +void GMSHPlugin_Mesher::mymsg::operator()(std::string level, std::string msg) +{ + //MESSAGE("level="<< level.c_str() << ", msg=" << msg.c_str()<< "\n"); + printf("level=%s msg=%s\n", level.c_str(), msg.c_str()); + + if(level == "Fatal" || level == "Error") + { + std::ostringstream oss; + if (level == "Fatal") + oss << "Fatal error during Generation of Gmsh Mesh\n"; + else + oss << "Error during Generation of Gmsh Mesh\n"; + oss << " " << msg.c_str() << "\n"; + GEntity *e = _gModel->getCurrentMeshEntity(); + if(e) + { + oss << " error occurred while meshing entity:\n" << + " tag=" << e->tag() << "\n" << + " dimension=" << e->dim() << "\n" << + " native pointer=" << e->getNativePtr(); + //if(e->geomType() != GEntity::CompoundCurve and e->geomType() != GEntity::CompoundSurface) + //{ + //SMESH_subMesh *sm = _mesh->GetSubMesh(*((TopoDS_Shape*)e->getNativePtr())); + //SMESH_ComputeErrorPtr& smError = sm->GetComputeError(); + //SMESH_Comment comment; + //comment << SMESH_Comment(oss.str); + //std::string str = oss.str(); + //smError.reset( new SMESH_ComputeError( str )); + + // plutot que de faire de la merde ici, on pourait simplement + // remplir une liste pour dire sur quelles entités gmsh se plante + // (puis faire le fillsmesh) + // puis faire une nouvelle routine qui réécrit les messages d'erreur + // probleme : gmsh peut planté en Fatal, dans ce cas pas de fillsmesh + //} + } + if (level == "Fatal") + { + CTX::instance()->lock = 0; + throw oss.str(); + } + else + printf(oss.str().c_str()); + } +} + +//============================================================================= +/*! + * Here we are going to use the GMSH mesher + */ +//============================================================================= + +bool GMSHPlugin_Mesher::Compute() +{ + MESSAGE("GMSHPlugin_Mesher::Compute"); + + int err = 0; + + GmshInitialize(); + SetGmshOptions(); + _gModel = new GModel(); + mymsg msg(_gModel); + GmshSetMessageHandler(&msg); + _gModel->importOCCShape((void*)&_shape); + if (_compounds.size() > 0) CreateGmshCompounds(); + MESSAGE("GModel::Mesh"); + try + { + _gModel->mesh((_is2d)?2:3); +#ifdef WITH_SMESH_CANCEL_COMPUTE + +#endif + } + catch (std::string& str) + { + err = 1; + MESSAGE(str); + } + catch (...) + { + err = 1; + MESSAGE("Unrecoverable error during Generation of Gmsh Mesh"); + } + + if (!err) + { + if (_compounds.size() > 0) _gModel->setCompoundVisibility(); + FillSMesh(); + } + delete _gModel; + GmshFinalize(); + MESSAGE("GMSHPlugin_Mesher::Compute:End"); + return !err; +} diff --git a/src/GMSHPlugin/GMSHPlugin_Mesher.hxx b/src/GMSHPlugin/GMSHPlugin_Mesher.hxx new file mode 100755 index 0000000..352199a --- /dev/null +++ b/src/GMSHPlugin/GMSHPlugin_Mesher.hxx @@ -0,0 +1,103 @@ +// Copyright (C) 2012-2013 ALNEOS +// +// 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.alneos.com/ or email : contact@alneos.fr +// +#include +#include "Gmsh.h" +#include "GmshConfig.h" +#include "GModelIO_OCC.h" +#include "Geo.h" +#include "GEdgeCompound.h" +#include "GFaceCompound.h" +#include "MElement.h" + +#ifndef _GMSHPlugin_Mesher_HXX_ +#define _GMSHPlugin_Mesher_HXX_ + +#include "GMSHPlugin_Defs.hxx" +#include "StdMeshers_FaceSide.hxx" +#include "SMDS_MeshElement.hxx" +#include "SMESH_Algo.hxx" + +#include +#include +#include + +class SMESH_Mesh; +class SMESH_Comment; +class SMESHDS_Mesh; +class TopoDS_Shape; +class TopTools_DataMapOfShapeShape; +class TopTools_IndexedMapOfShape; +class GMSHPlugin_Hypothesis; + + +//============================================================================= +/*! + * \brief This class calls the GMSH mesher of OCC geometry + */ +//============================================================================= + +class GMSHPLUGIN_EXPORT GMSHPlugin_Mesher +{ + public: + // ---------- PUBLIC METHODS ---------- + + GMSHPlugin_Mesher (SMESH_Mesh* mesh, const TopoDS_Shape& aShape); + + void SetParameters(const GMSHPlugin_Hypothesis* hyp); + + bool Compute(); + + bool Evaluate(MapShapeNbElems& aResMap); + + private: + int _studyId; + SMESH_Mesh* _mesh; + const TopoDS_Shape& _shape; + int _algo2d; + int _algo3d; + int _recomb2DAlgo; + bool _recombineAll; + int _subdivAlgo; + int _remeshAlgo; + int _remeshPara; + double _smouthSteps; + double _sizeFactor; + double _minSize, _maxSize; + bool _secondOrder, _useIncomplElem; + bool _is2d; + GModel* _gModel; + + std::set _compounds; + + void SetGmshOptions(); + void CreateGmshCompounds(); + void FillSMesh(); + float DistBoundingBox(SBoundingBox3d& bounds,SPoint3& point); + + class mymsg : public GmshMessage + { + private: + GModel* _gModel; + public: + mymsg(GModel* _gModel) : _gModel(_gModel), GmshMessage() {} + void operator()(std::string level, std::string msg); + }; +}; + +#endif diff --git a/src/GMSHPlugin/GMSHPlugin_i.cxx b/src/GMSHPlugin/GMSHPlugin_i.cxx new file mode 100755 index 0000000..b02becd --- /dev/null +++ b/src/GMSHPlugin/GMSHPlugin_i.cxx @@ -0,0 +1,63 @@ +// Copyright (C) 2012-2013 ALNEOS +// +// 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.alneos.com/ or email : contact@alneos.fr +// +#include "utilities.h" + +#include "GMSHPlugin_Hypothesis_i.hxx" +#include "GMSHPlugin_Hypothesis_2D_i.hxx" +#include "GMSHPlugin_GMSH_i.hxx" +#include "GMSHPlugin_GMSH_2D_i.hxx" + +template class GMSHPlugin_Creator_i:public HypothesisCreator_i +{ + // as we have 'module GMSHPlugin' in GMSHPlugin_Algorithm.idl + virtual std::string GetModuleName() { return "GMSHPlugin"; } +}; + +//============================================================================= +/*! + * + */ +//============================================================================= + +extern "C" +{ + GMSHPLUGIN_EXPORT + GenericHypothesisCreator_i* GetHypothesisCreator (const char* aHypName) + { + MESSAGE("GetHypothesisCreator " << aHypName); + + GenericHypothesisCreator_i* aCreator = 0; + + // Hypotheses + + // Algorithms + if (strcmp(aHypName, "GMSH") == 0) + aCreator = new GMSHPlugin_Creator_i; + else if (strcmp(aHypName, "GMSH_2D") == 0) + aCreator = new GMSHPlugin_Creator_i; + // Hypotheses + else if (strcmp(aHypName, "GMSH_Parameters") == 0) + aCreator = new GMSHPlugin_Creator_i; + else if (strcmp(aHypName, "GMSH_Parameters_2D") == 0) + aCreator = new GMSHPlugin_Creator_i; + else ; + + return aCreator; + } +} diff --git a/src/GMSHPlugin/Makefile.am b/src/GMSHPlugin/Makefile.am new file mode 100755 index 0000000..86c276b --- /dev/null +++ b/src/GMSHPlugin/Makefile.am @@ -0,0 +1,79 @@ +# Copyright (C) 2012-2013 ALNEOS +# +# 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.alneos.com/ or email : contact@alneos.fr +# +include $(top_srcdir)/adm_local/unix/make_common_starter.am + +# header files +salomeinclude_HEADERS = \ + GMSHPlugin_GMSH_2D.hxx \ + GMSHPlugin_GMSH_2D_i.hxx \ + GMSHPlugin_GMSH.hxx \ + GMSHPlugin_GMSH_i.hxx \ + GMSHPlugin_Hypothesis.hxx \ + GMSHPlugin_Hypothesis_i.hxx \ + GMSHPlugin_Hypothesis_2D.hxx \ + GMSHPlugin_Hypothesis_2D_i.hxx \ + GMSHPlugin_Mesher.hxx \ + GMSHPlugin_Defs.hxx + +# Libraries targets +lib_LTLIBRARIES = libGMSHEngine.la + +dist_libGMSHEngine_la_SOURCES = \ + GMSHPlugin_GMSH_2D.cxx \ + GMSHPlugin_GMSH_2D_i.cxx \ + GMSHPlugin_GMSH.cxx \ + GMSHPlugin_GMSH_i.cxx \ + GMSHPlugin_Hypothesis.cxx \ + GMSHPlugin_Hypothesis_i.cxx \ + GMSHPlugin_Hypothesis_2D.cxx \ + GMSHPlugin_Hypothesis_2D_i.cxx \ + GMSHPlugin_Mesher.cxx \ + GMSHPlugin_i.cxx + +libGMSHEngine_la_CPPFLAGS = \ + $(KERNEL_CXXFLAGS) \ + $(GUI_CXXFLAGS) \ + $(MED_CXXFLAGS) \ + $(GEOM_CXXFLAGS) \ + $(CAS_CPPFLAGS) \ + $(VTK_INCLUDES) \ + -I$(GMSHHOME)/include \ + $(SMESH_CXXFLAGS) \ + $(CORBA_CXXFLAGS) \ + $(CORBA_INCLUDES) \ + $(BOOST_CPPFLAGS) \ + -I$(top_builddir)/idl + + +libGMSHEngine_la_LDFLAGS = -L$(GMSHHOME)/lib -lGmsh + +libGMSHEngine_la_LDFLAGS += \ + ../../idl/libSalomeIDLGMSHPLUGIN.la \ + $(CAS_LDPATH) -lTKernel -lTKBRep -lTKShHealing -lTKSTEP -lTKXSBase -lTKIGES -lTKMesh -lTKSTL -lTKG3d -lTKTopAlgo -lTKG2d -lTKBool -lTKGeomAlgo -lTKOffset -lTKGeomBase -lTKBO \ + -lTKMath -lTKFillet -lTKMeshVS -lTKPrim -lTKSTEPBase -lTKSTEPAttr -lTKSTEP209 -lTKXDESTEP -lTKXDEIGES -lTKXCAF -lTKLCAF -lFWOSPlugin \ + $(GEOM_LDFLAGS) -lGEOMbasic \ + $(MED_LDFLAGS) -lSalomeIDLMED \ + $(SMESH_LDFLAGS) -lSMESHimpl -lSMESHEngine -lSMESHUtils -lStdMeshersEngine -lStdMeshers -lSMESHDS -lSMDS -lSMESHControls \ + $(KERNEL_LDFLAGS) -lSalomeGenericObj -lSalomeNS -lSALOMELocalTrace -lOpUtil + +# Scripts to be installed. +mypkgpythondir = $(salomepythondir)/salome/GMSHPlugin +mypkgpython_PYTHON = \ + __init__.py \ + GMSHPluginBuilder.py diff --git a/src/GMSHPlugin/__init__.py b/src/GMSHPlugin/__init__.py new file mode 100644 index 0000000..98cec40 --- /dev/null +++ b/src/GMSHPlugin/__init__.py @@ -0,0 +1,22 @@ +# Copyright (C) 2012-2013 ALNEOS +# +# 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.alneos.com/ or email : contact@alneos.fr +# + +## +# @package GMSHPluginBuilder +# Python API for the GMSH meshing plug-in module. diff --git a/src/GUI/GMSHPluginGUI.cxx b/src/GUI/GMSHPluginGUI.cxx new file mode 100755 index 0000000..c0dc940 --- /dev/null +++ b/src/GUI/GMSHPluginGUI.cxx @@ -0,0 +1,35 @@ +// Copyright (C) 2012-2013 ALNEOS +// +// 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.alneos.com/ or email : contact@alneos.fr +// +#include "GMSHPluginGUI_HypothesisCreator.h" + +//============================================================================= +/*! GetHypothesisCreator + * + */ +//============================================================================= +extern "C" +{ + GMSHPLUGIN_GUI_EXPORT + SMESHGUI_GenericHypothesisCreator* GetHypothesisCreator( const QString& aHypType ) + { + SMESHGUI_GenericHypothesisCreator* aCreator = NULL; + aCreator = new GMSHPluginGUI_HypothesisCreator( aHypType ); + return aCreator; + } +} diff --git a/src/GUI/GMSHPluginGUI.h b/src/GUI/GMSHPluginGUI.h new file mode 100755 index 0000000..9c46917 --- /dev/null +++ b/src/GUI/GMSHPluginGUI.h @@ -0,0 +1,27 @@ +// Copyright (C) 2012-2013 ALNEOS +// +// 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.alneos.com/ or email : contact@alneos.fr +// +#ifdef WIN32 + #if defined GMSHPLUGIN_GUI_EXPORTS || defined GMSHPluginGUI_EXPORTS + #define GMSHPLUGIN_GUI_EXPORT __declspec( dllexport ) + #else + #define GMSHPLUGIN_GUI_EXPORT __declspec( dllimport ) + #endif +#else + #define GMSHPLUGIN_GUI_EXPORT +#endif diff --git a/src/GUI/GMSHPluginGUI_HypothesisCreator.cxx b/src/GUI/GMSHPluginGUI_HypothesisCreator.cxx new file mode 100755 index 0000000..4deb8e8 --- /dev/null +++ b/src/GUI/GMSHPluginGUI_HypothesisCreator.cxx @@ -0,0 +1,565 @@ +// Copyright (C) 2012-2013 ALNEOS +// +// 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.alneos.com/ or email : contact@alneos.fr +// +#include "GMSHPluginGUI_HypothesisCreator.h" + +#include +#include +#include +#include + +#include CORBA_SERVER_HEADER(GMSHPlugin_Algorithm) + +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +enum Algo2D + { + automatic, + meshadapt, + delaunay, + frontal, + delaunayforquad + }; + +enum Algo3D + { + frontal3, + frontaldelaunay, + fontalhex, + mmg3d, + rtree + }; + +enum Recomb2DAlgo + { + standard, + blossom + }; + +enum SubdivAlgo + { + none, + allquads, + allhexas + }; + +enum RemeshAlgo + { + nosplit, + automaticR, + automaticmetis + }; + +enum RemeshPara + { + harmonic, + conformal, + rbfharmonic + }; + + +GMSHPluginGUI_HypothesisCreator::GMSHPluginGUI_HypothesisCreator( const QString& theHypType ) + : SMESHGUI_GenericHypothesisCreator( theHypType ) +{ + myGeomSelectionTools = NULL; + myCompoundSet.clear(); + myIs2D = ( theHypType.endsWith("2D")); +} + +GMSHPluginGUI_HypothesisCreator::~GMSHPluginGUI_HypothesisCreator() +{ +} + +bool GMSHPluginGUI_HypothesisCreator::checkParams(QString& msg) const +{ + GmshHypothesisData data_old, data_new; + readParamsFromHypo( data_old ); + readParamsFromWidgets( data_new ); + bool res = storeParamsToHypo( data_new ); + storeParamsToHypo( data_old ); + return res; +} + +QFrame* GMSHPluginGUI_HypothesisCreator::buildFrame() +{ + QFrame* fr = new QFrame( 0 ); + fr->setObjectName( "myframe" ); + QVBoxLayout* lay = new QVBoxLayout( fr ); + lay->setMargin( 5 ); + lay->setSpacing( 0 ); + + QTabWidget* tab = new QTabWidget( fr ); + tab->setTabShape( QTabWidget::Rounded ); + tab->setTabPosition( QTabWidget::North ); + lay->addWidget( tab ); + QWidget* GroupC1 = new QWidget(); + tab->insertTab( 0, GroupC1, tr( "SMESH_ARGUMENTS" ) ); + + QGridLayout* aGroupLayout = new QGridLayout( GroupC1 ); + aGroupLayout->setSpacing( 6 ); + aGroupLayout->setMargin( 11 ); + + int row = 0; + myName = 0; + if( isCreation() ) + { + aGroupLayout->addWidget( new QLabel( tr( "SMESH_NAME" ), GroupC1 ), row, 0 ); + myName = new QLineEdit( GroupC1 ); + myName->setMinimumWidth(160); + aGroupLayout->addWidget( myName, row, 1 ); + row++; + } + + aGroupLayout->addWidget( new QLabel( tr( "GMSH_2D_ALGO" ), GroupC1 ), row, 0 ); + my2DAlgo = new QComboBox( GroupC1 ); + QStringList types2DAlgo; + types2DAlgo << tr( "GMSH_AUTOMATIC" ) << tr( "GMSH_MESH_ADAPT" ) << tr( "GMSH_DELAUNAY" ) << + tr( "GMSH_FRONTAL" ) << tr( "GMSH_DELAUNAY_FOR_QUAD" ); + my2DAlgo->addItems( types2DAlgo ); + aGroupLayout->addWidget( my2DAlgo, row, 1 ); + row++; + + my3DAlgo = 0; + if ( !myIs2D ) + { + aGroupLayout->addWidget( new QLabel( tr( "GMSH_3D_ALGO" ), GroupC1 ), row, 0 ); + my3DAlgo = new QComboBox( GroupC1 ); + QStringList types3DAlgo; + types3DAlgo << tr( "GMSH_FRONTAL_DELAUNAY" ) << tr( "GMSH_FRONTAL_HEX" ) << tr( "GMSH_MMG3D" ) << + tr( "GMSH_R_TREE" ); + my3DAlgo->addItems( types3DAlgo ); + aGroupLayout->addWidget( my3DAlgo, row, 1 ); + row++; + } + + aGroupLayout->addWidget( new QLabel( tr( "GMSH_2D_RECOMB_ALGO" ), GroupC1 ), row, 0 ); + myRecomb2DAlgo = new QComboBox( GroupC1 ); + QStringList typesRecomb2DAlgo; + typesRecomb2DAlgo << tr( "GMSH_STANDARD" ) << tr( "GMSH_BLOSSOM" ); + myRecomb2DAlgo->addItems( typesRecomb2DAlgo ); + aGroupLayout->addWidget( myRecomb2DAlgo, row, 1 ); + row++; + + myRecombineAll = new QCheckBox( tr( "GMSH_RECOMBINE_ALL" ), GroupC1 ); + aGroupLayout->addWidget( myRecombineAll, row, 0 ); + row++; + + aGroupLayout->addWidget( new QLabel( tr( "GMSH_SUBDIV_ALGO" ), GroupC1 ), row, 0 ); + mySubdivAlgo = new QComboBox( GroupC1 ); + QStringList typesSubdivAlgo; + typesSubdivAlgo << tr( "GMSH_NONE" ) << tr( "GMSH_ALL_QUADS" ) << tr( "GMSH_ALL_HEXAS" ); + mySubdivAlgo->addItems( typesSubdivAlgo ); + aGroupLayout->addWidget( mySubdivAlgo, row, 1 ); + row++; + + aGroupLayout->addWidget( new QLabel( tr( "GMSH_REMESH_ALGO" ), GroupC1 ), row, 0 ); + myRemeshAlgo = new QComboBox( GroupC1 ); + QStringList typesRemeshAlgo; + typesRemeshAlgo << tr( "GMSH_NO_SPLIT" ) << tr( "GMSH_AUTO" ) << tr( "GMSH_AUTO_ONLY_WITH_METIS" ); + myRemeshAlgo->addItems( typesRemeshAlgo ); + aGroupLayout->addWidget( myRemeshAlgo, row, 1 ); + row++; + + aGroupLayout->addWidget( new QLabel( tr( "GMSH_REMESH_PARA" ), GroupC1 ), row, 0 ); + myRemeshPara = new QComboBox( GroupC1 ); + QStringList typesRemeshPara; + typesRemeshPara << tr( "GMSH_HARMONIC" ) << tr( "GMSH_CONFORMAL" ) << tr( "GMSH_RBF_HARMONIC" ); + myRemeshPara->addItems( typesRemeshPara ); + aGroupLayout->addWidget( myRemeshPara, row, 1 ); + row++; + + aGroupLayout->addWidget( new QLabel( tr( "GMSH_SMOOTHING_STEPS" ), GroupC1 ), row, 0 ); + mySmouthSteps = new SMESHGUI_SpinBox( GroupC1 ); + mySmouthSteps->RangeStepAndValidator( 1, 1000, 1, "length_precision" ); + aGroupLayout->addWidget( mySmouthSteps, row, 1 ); + row++; + + aGroupLayout->addWidget( new QLabel( tr( "GMSH_SIZE_FACTOR" ), GroupC1 ), row, 0 ); + mySizeFactor = new SMESHGUI_SpinBox( GroupC1 ); + mySizeFactor->RangeStepAndValidator( 1e-06, 1e+06, 0.1, "length_precision" ); + aGroupLayout->addWidget( mySizeFactor, row, 1 ); + row++; + + aGroupLayout->addWidget( new QLabel( tr( "GMSH_MIN_SIZE" ), GroupC1 ), row, 0 ); + myMinSize = new SMESHGUI_SpinBox( GroupC1 ); + myMinSize->RangeStepAndValidator( 0.0, 1e+22, 1., "length_precision" ); + aGroupLayout->addWidget( myMinSize, row, 1 ); + row++; + + aGroupLayout->addWidget( new QLabel( tr( "GMSH_MAX_SIZE" ), GroupC1 ), row, 0 ); + myMaxSize = new SMESHGUI_SpinBox( GroupC1 ); + myMaxSize->RangeStepAndValidator( 0.0, 1e+22, 1e+21, "length_precision" ); + aGroupLayout->addWidget( myMaxSize, row, 1 ); + row++; + + mySecondOrder = new QCheckBox( tr( "GMSH_SECOND_ORDER" ), GroupC1 ); + aGroupLayout->addWidget( mySecondOrder, row, 0 ); + + myUseIncomplElem = new QCheckBox( tr( "GMSH_USE_INCOMPLETE_ELEMENT" ), GroupC1 ); + aGroupLayout->addWidget( myUseIncomplElem, row, 1 ); + row++; + + connect( mySecondOrder, SIGNAL( toggled( bool ) ), this, SLOT( updateWidgets() ) ); + + // Compounds + QWidget* compoundGroup = new QWidget(); + tab->insertTab(1, compoundGroup, tr("GMSH_COMPOUND")); + + myCompoundTable = new QTableWidget(0, 2, compoundGroup); + QGridLayout* compoundLayout = new QGridLayout(compoundGroup); + compoundLayout->addWidget(myCompoundTable, 1, 0, 8, 1); + + QStringList compoundHeaders; + compoundHeaders << tr( "GMSH_COMPOUND_ENTRY_COLUMN" ) << tr( "GMSH_COMPOUND_NAME_COLUMN" ); + myCompoundTable->setHorizontalHeaderLabels(compoundHeaders); + myCompoundTable->horizontalHeader()->hideSection(0); + myCompoundTable->horizontalHeader()->setResizeMode(QHeaderView::Interactive); + myCompoundTable->resizeColumnToContents(1); + myCompoundTable->setAlternatingRowColors(true); + myCompoundTable->verticalHeader()->hide(); + + QPushButton* addCompoundButton = new QPushButton(tr("GMSH_COMPOUND_ADD"), compoundGroup); + compoundLayout->addWidget(addCompoundButton, 1, 1, 1, 1); + QFrame *line2 = new QFrame(compoundGroup); + + line2->setFrameShape(QFrame::HLine); + line2->setFrameShadow(QFrame::Sunken); + compoundLayout->addWidget(line2, 2, 1, 1, 1); + + QPushButton* removeButton = new QPushButton(tr("GMSH_COMPOUND_REMOVE"), compoundGroup); + compoundLayout->addWidget(removeButton, 3, 1, 1, 1); + + connect( addCompoundButton, SIGNAL(clicked()), this, SLOT(onAddCompound())); + connect( removeButton, SIGNAL(clicked()), this, SLOT(onRemoveCompound())); + + return fr; +} + +void GMSHPluginGUI_HypothesisCreator::updateWidgets() +{ + myUseIncomplElem->setEnabled(mySecondOrder->isChecked()); +} + +void GMSHPluginGUI_HypothesisCreator::onAddCompound() +{ + GMSHPlugin::GMSHPlugin_Hypothesis_var h = GMSHPlugin::GMSHPlugin_Hypothesis::_narrow(initParamsHypothesis()); + GeomSelectionTools* geomSelectionTools = getGeomSelectionTools(); + LightApp_SelectionMgr* mySel = geomSelectionTools->selectionMgr(); + SALOME_ListIO ListSelectedObjects; + mySel->selectedObjects(ListSelectedObjects, NULL, false ); + SALOME_ListIteratorOfListIO Object_It(ListSelectedObjects); + for (Object_It ; Object_It.More() ; Object_It.Next()) + { + Handle(SALOME_InteractiveObject) anObject = Object_It.Value(); + std::string entry, shapeName; + entry = geomSelectionTools->getEntryOfObject(anObject); + shapeName = anObject->getName(); + TopAbs_ShapeEnum shapeType; + shapeType = geomSelectionTools->entryToShapeType(entry); + if ((shapeType == TopAbs_SHAPE) || (shapeType != TopAbs_EDGE && shapeType != TopAbs_FACE)) + continue; + myCompoundTable->setFocus(); + QString shapeEntry; + shapeEntry = QString::fromStdString(entry); + if (myCompoundSet.contains(shapeEntry)) + continue; + int row = myCompoundTable->rowCount() ; + myCompoundTable->setRowCount(row+1); + myCompoundTable->setItem(row, 0, new QTableWidgetItem(shapeEntry)); + myCompoundTable->item(row, 0 )->setFlags(0); + myCompoundTable->setItem(row, 1, new QTableWidgetItem(QString::fromStdString(shapeName))); + myCompoundTable->item(row, 1 )->setFlags(Qt::ItemIsSelectable|Qt::ItemIsEnabled); + myCompoundTable->resizeColumnToContents(1); + myCompoundTable->clearSelection(); + myCompoundTable->scrollToItem( myCompoundTable->item( row, 1 ) ); + myCompoundSet.insert(shapeEntry); + myCompoundToRemove.remove(shapeEntry); + } +} + +void GMSHPluginGUI_HypothesisCreator::onRemoveCompound() +{ + QList selectedRows; + QList selected = myCompoundTable->selectedItems(); + QTableWidgetItem* item; + int row; + foreach(item, selected) + { + row = item->row(); + if (!selectedRows.contains(row)) + selectedRows.append( row ); + } + qSort( selectedRows ); + QListIterator it( selectedRows ); + it.toBack(); + while (it.hasPrevious()) + { + row = it.previous(); + QString entry = myCompoundTable->item(row,0)->text(); + if (myCompoundSet.contains(entry)) + { + myCompoundSet.remove(entry); + myCompoundToRemove.insert(entry); + } + myCompoundTable->removeRow(row ); + } + myCompoundTable->resizeColumnToContents(1); +} + +void GMSHPluginGUI_HypothesisCreator::retrieveParams() const +{ + GmshHypothesisData data; + readParamsFromHypo( data ); + + if( myName ) + myName->setText( data.myName ); + my2DAlgo->setCurrentIndex( data.my2DAlgo ); + if ( !myIs2D ) + my3DAlgo->setCurrentIndex( data.my3DAlgo ); + myRecomb2DAlgo->setCurrentIndex( data.myRecomb2DAlgo ); + if ( myRecombineAll ) + myRecombineAll->setChecked( data.myRecombineAll ); + if ( mySubdivAlgo ) + mySubdivAlgo->setCurrentIndex( data.mySubdivAlgo ); + myRemeshAlgo->setCurrentIndex( data.myRemeshAlgo); + myRemeshPara->setCurrentIndex( data.myRemeshPara); + if(data.mySmouthStepsVar.isEmpty()) + mySmouthSteps->setValue( data.mySmouthSteps ); + else + mySmouthSteps->setText( data.mySmouthStepsVar ); + if(data.mySizeFactorVar.isEmpty()) + mySizeFactor->setValue( data.mySizeFactor ); + else + mySizeFactor->setText( data.mySizeFactorVar ); + if(data.myMaxSizeVar.isEmpty()) + myMaxSize->setValue( data.myMaxSize ); + else + myMaxSize->setText( data.myMaxSizeVar ); + if(data.myMinSizeVar.isEmpty()) + myMinSize->setValue( data.myMinSize ); + else + myMinSize->setText( data.myMinSizeVar ); + if ( mySecondOrder ) + mySecondOrder->setChecked( data.mySecondOrder ); + if ( myUseIncomplElem ) + myUseIncomplElem->setChecked( data.myUseIncomplElem ); + + GMSHPluginGUI_HypothesisCreator* that = (GMSHPluginGUI_HypothesisCreator*)this; + that->updateWidgets(); + + GeomSelectionTools* geomSelectionTools = that->getGeomSelectionTools(); + for (QSet::const_iterator i = myCompoundSet.begin(); i != myCompoundSet.end(); ++i) + { + const QString entry = *i; + std::string shapeName = geomSelectionTools->getNameFromEntry(entry.toStdString()); + int row = myCompoundTable->rowCount(); + myCompoundTable->setRowCount(row+1); + myCompoundTable->setItem(row, 0, new QTableWidgetItem(entry)); + myCompoundTable->item(row, 0)->setFlags(0); + myCompoundTable->setItem(row, 1, new QTableWidgetItem(QString::fromStdString(shapeName))); + myCompoundTable->item(row, 1)->setFlags(Qt::ItemIsSelectable|Qt::ItemIsEnabled); + } + myCompoundTable->resizeColumnToContents(1); +} + +QString GMSHPluginGUI_HypothesisCreator::storeParams() const +{ + GmshHypothesisData data; + readParamsFromWidgets( data ); + storeParamsToHypo( data ); + + QString valStr = tr("GMSH_MAX_SIZE") + " = " + QString::number( data.myMaxSize ) + "; "; + valStr += tr("GMSH_MIN_SIZE") + " = " + QString::number( data.myMinSize ) + "; "; + if ( data.mySecondOrder ) + valStr += tr("GMSH_SECOND_ORDER") + "; "; + + return valStr; +} + +bool GMSHPluginGUI_HypothesisCreator::readParamsFromHypo( GmshHypothesisData& h_data ) const +{ + GMSHPlugin::GMSHPlugin_Hypothesis_var h = + GMSHPlugin::GMSHPlugin_Hypothesis::_narrow( initParamsHypothesis() ); + + HypothesisData* data = SMESH::GetHypothesisData( hypType() ); + h_data.myName = isCreation() && data ? data->Label : ""; + + h_data.my2DAlgo = (int) h->Get2DAlgo(); + if ( !myIs2D ) + h_data.my3DAlgo = (int) h->Get3DAlgo(); + h_data.myRecomb2DAlgo = (int) h->GetRecomb2DAlgo(); + h_data.myRecombineAll = h->GetRecombineAll(); + h_data.mySubdivAlgo = (int) h->GetSubdivAlgo(); + h_data.myRemeshAlgo = (int) h->GetRemeshAlgo(); + h_data.myRemeshPara = (int) h->GetRemeshPara(); + h_data.mySmouthSteps = h->GetSmouthSteps(); + h_data.mySizeFactor = h->GetSizeFactor(); + h_data.myMinSize = h->GetMinSize(); + h_data.myMaxSize = h->GetMaxSize(); + h_data.mySmouthStepsVar = getVariableName("SmouthSteps"); + h_data.mySizeFactorVar = getVariableName("SizeFactor"); + h_data.myMinSizeVar = getVariableName("SetMinSize"); + h_data.myMaxSizeVar = getVariableName("SetMaxSize"); + h_data.mySecondOrder = h->GetSecondOrder(); + h_data.myUseIncomplElem = h->GetUseIncomplElem(); + + GMSHPluginGUI_HypothesisCreator* that = (GMSHPluginGUI_HypothesisCreator*)this; + GMSHPlugin::string_array_var myEntries = h->GetCompoundOnEntries(); + for ( int i=0 ; ilength() ; i++ ) + { + QString entry = myEntries[i].in(); + that->myCompoundSet.insert(entry); + } + + return true; +} + +bool GMSHPluginGUI_HypothesisCreator::storeParamsToHypo( const GmshHypothesisData& h_data ) const +{ + GMSHPlugin::GMSHPlugin_Hypothesis_var h = + GMSHPlugin::GMSHPlugin_Hypothesis::_narrow( hypothesis() ); + + bool ok = true; + try + { + if( isCreation() ) + SMESH::SetName( SMESH::FindSObject( h ), h_data.myName.toLatin1().data() ); + + h->Set2DAlgo( h_data.my2DAlgo ); + if ( !myIs2D ) + h->Set3DAlgo( h_data.my3DAlgo ); + h->SetRecomb2DAlgo( h_data.myRecomb2DAlgo ); + h->SetRecombineAll( h_data.myRecombineAll ); + h->SetSubdivAlgo( h_data.mySubdivAlgo ); + h->SetRemeshAlgo( h_data.myRemeshAlgo ); + h->SetRemeshPara( h_data.myRemeshPara ); + h->SetSmouthSteps( h_data.mySmouthSteps ); + h->SetSizeFactor( h_data.mySizeFactor ); + h->SetMinSize( h_data.myMinSize ); + h->SetMaxSize( h_data.myMaxSize ); + h->SetVarParameter( h_data.mySmouthStepsVar.toLatin1().constData(), "SmouthSteps"); + h->SetVarParameter( h_data.mySizeFactorVar.toLatin1().constData(), "SizeFactor"); + h->SetVarParameter( h_data.myMinSizeVar.toLatin1().constData(), "SetMinSize"); + h->SetVarParameter( h_data.myMaxSizeVar.toLatin1().constData(), "SetMaxSize"); + h->SetSecondOrder( h_data.mySecondOrder ); + h->SetUseIncomplElem( h_data.myUseIncomplElem ); + h->SetIs2d( myIs2D ); + + for (QSet::const_iterator i = myCompoundSet.begin(); i != myCompoundSet.end(); ++i) + { + const QString entry = *i; + h->SetCompoundOnEntry(entry.toLatin1().constData()); + } + for (QSet::const_iterator i = myCompoundToRemove.begin(); i != myCompoundToRemove.end(); ++i) + { + const QString entry = *i; + h->UnsetCompoundOnEntry(entry.toLatin1().constData()); + } + } + catch(const SALOME::SALOME_Exception& ex) + { + SalomeApp_Tools::QtCatchCorbaException(ex); + ok = false; + } + return ok; +} + +bool GMSHPluginGUI_HypothesisCreator::readParamsFromWidgets( GmshHypothesisData& h_data ) const +{ + h_data.myName = myName ? myName->text() : ""; + h_data.my2DAlgo = my2DAlgo->currentIndex(); + if (my3DAlgo) + h_data.my3DAlgo = my3DAlgo->currentIndex(); + h_data.myRecomb2DAlgo = myRecomb2DAlgo->currentIndex(); + h_data.myRecombineAll = myRecombineAll->isChecked(); + h_data.mySubdivAlgo = mySubdivAlgo->currentIndex(); + h_data.myRemeshAlgo = myRemeshAlgo->currentIndex(); + h_data.myRemeshPara = myRemeshPara->currentIndex(); + h_data.mySmouthSteps = mySmouthSteps->value(); + h_data.mySizeFactor = mySizeFactor->value(); + h_data.myMinSize = myMinSize->value(); + h_data.myMaxSize = myMaxSize->value(); + h_data.mySmouthStepsVar = mySmouthSteps->text(); + h_data.mySizeFactorVar = mySizeFactor->text(); + h_data.myMinSizeVar = myMinSize->text(); + h_data.myMaxSizeVar = myMaxSize->text(); + h_data.mySecondOrder = mySecondOrder->isChecked(); + h_data.myUseIncomplElem = myUseIncomplElem->isChecked(); + + // ne semble pas utile dans la mesure ou myCompoundSet n'a pas besoin d'etre modifier + /* + GMSHPluginGUI_HypothesisCreator* that = (GMSHPluginGUI_HypothesisCreator*)this; + int nbRows = myCompoundTable->rowCount(); + for(int row=0 ; row < nbRows ; row++) + { + QString entry = myLocalSizeTable->item(row, 1)->text(); + that->myCompoundSet.insert(entry); + } + */ + return true; +} + +// on ne modifie rien à partir de là + +GeomSelectionTools* GMSHPluginGUI_HypothesisCreator::getGeomSelectionTools() +{ + _PTR(Study) aStudy = SMESH::GetActiveStudyDocument(); + if (myGeomSelectionTools == NULL || myGeomSelectionTools->getMyStudy() != aStudy) { + delete myGeomSelectionTools; + myGeomSelectionTools = new GeomSelectionTools(aStudy); + } + return myGeomSelectionTools; +} + +QString GMSHPluginGUI_HypothesisCreator::caption() const +{ + return tr( QString( "GMSH_%1_TITLE" ).arg(myIs2D?QString("2D"):QString("3D")).toLatin1().data() ); +} + +QPixmap GMSHPluginGUI_HypothesisCreator::icon() const +{ + QString hypIconName = tr( QString("ICON_DLG_GMSH_PARAMETERS%1").arg(myIs2D?QString("_2D"):QString("")).toLatin1().data() ); + return SUIT_Session::session()->resourceMgr()->loadPixmap( "GMSHPlugin", hypIconName ); +} + +QString GMSHPluginGUI_HypothesisCreator::type() const +{ + return tr( QString( "GMSH_%1_HYPOTHESIS" ).arg(myIs2D?QString("2D"):QString("3D")).toLatin1().data() ); +} + +QString GMSHPluginGUI_HypothesisCreator::helpPage() const +{ + return "gmsh_2d_3d_hypo_page.html"; +} diff --git a/src/GUI/GMSHPluginGUI_HypothesisCreator.h b/src/GUI/GMSHPluginGUI_HypothesisCreator.h new file mode 100755 index 0000000..2659236 --- /dev/null +++ b/src/GUI/GMSHPluginGUI_HypothesisCreator.h @@ -0,0 +1,107 @@ +// Copyright (C) 2012-2013 ALNEOS +// +// 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.alneos.com/ or email : contact@alneos.fr +// +#ifndef GMSHPLUGINGUI_HypothesisCreator_HeaderFile +#define GMSHPLUGINGUI_HypothesisCreator_HeaderFile + +#include "GMSHPluginGUI.h" + +#include + +#include + +#include + +class SMESHGUI_SpinBox; +class GeomSelectionTools; +class QComboBox; +class QCheckBox; +class QLineEdit; +class QTableWidget; + +typedef struct +{ + QString myName; + int my2DAlgo,my3DAlgo,myRecomb2DAlgo; + bool myRecombineAll; + int mySubdivAlgo,myRemeshAlgo,myRemeshPara,mySmouthSteps; + bool myUseIncomplElem; + bool mySecondOrder; + double mySizeFactor,myMaxSize, myMinSize; + QString myMaxSizeVar, myMinSizeVar, mySmouthStepsVar, mySizeFactorVar; +} GmshHypothesisData; + +/*! + * \brief Class for creation of GMSH2D and GMSH3D hypotheses +*/ +class GMSHPLUGIN_GUI_EXPORT GMSHPluginGUI_HypothesisCreator : public SMESHGUI_GenericHypothesisCreator +{ + Q_OBJECT + +public: + GMSHPluginGUI_HypothesisCreator( const QString& ); + virtual ~GMSHPluginGUI_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 updateWidgets(); + virtual void onAddCompound(); + virtual void onRemoveCompound(); + +private: + bool readParamsFromHypo( GmshHypothesisData& ) const; + bool readParamsFromWidgets( GmshHypothesisData& ) const; + bool storeParamsToHypo( const GmshHypothesisData& ) const; + GeomSelectionTools* getGeomSelectionTools(); + +private: + QLineEdit* myName; + QComboBox* my2DAlgo; + QComboBox* my3DAlgo; + QComboBox* myRecomb2DAlgo; + QCheckBox* myRecombineAll; + QComboBox* mySubdivAlgo; + QComboBox* myRemeshAlgo; + QComboBox* myRemeshPara; + SMESHGUI_SpinBox* mySmouthSteps; + SMESHGUI_SpinBox* mySizeFactor; + SMESHGUI_SpinBox* myMaxSize; + SMESHGUI_SpinBox* myMinSize; + QCheckBox* myUseIncomplElem; + QCheckBox* mySecondOrder; + bool myIs2D; + + + QTableWidget* myCompoundTable; + GeomSelectionTools* myGeomSelectionTools; + QSet myCompoundSet; + QSet myCompoundToRemove; +}; + +#endif diff --git a/src/GUI/GMSHPlugin_images.ts b/src/GUI/GMSHPlugin_images.ts new file mode 100755 index 0000000..2d83112 --- /dev/null +++ b/src/GUI/GMSHPlugin_images.ts @@ -0,0 +1,15 @@ + + + + + @default + + ICON_DLG_GMSH_PARAMETERS + gmsh.png + + + ICON_DLG_GMSH_PARAMETERS_2D + gmsh.png + + + diff --git a/src/GUI/GMSHPlugin_msg_en.ts b/src/GUI/GMSHPlugin_msg_en.ts new file mode 100755 index 0000000..8e9e384 --- /dev/null +++ b/src/GUI/GMSHPlugin_msg_en.ts @@ -0,0 +1,175 @@ + + + + + @default + + GMSH_2D_HYPOTHESIS + Gmsh 2D + + + GMSH_2D_TITLE + Hypothesis Construction + + + GMSH_3D_HYPOTHESIS + Gmsh 3D + + + GMSH_3D_TITLE + Hypothesis Construction + + + GMSH_MAX_SIZE + Max. Size + + + GMSH_MIN_SIZE + Min. Size + + + GMSH_SECOND_ORDER + Second Order + + + GMSH_COMPOUND + Compounds + + + GMSH_COMPOUND_ENTRY_COLUMN + Entry + + + GMSH_COMPOUND_NAME_COLUMN + Name + + + GMSH_COMPOUND_ADD + Add + + + GMSH_COMPOUND_REMOVE + Remove + + + GMSH_2D_ALGO + 2D algorithm + + + GMSH_AUTOMATIC + Automatic + + + GMSH_MESH_ADAPT + Mesh adapt + + + GMSH_DELAUNAY + Delaunay + + + GMSH_FRONTAL + Frontal + + + GMSH_DELAUNAY_FOR_QUAD + Delaunay for quads + + + GMSH_3D_ALGO + 3D Algorithm + + + GMSH_FRONTAL_DELAUNAY + Frontal Delaunay + + + GMSH_FRONTAL_HEX + Frontal Hex + + + GMSH_MMG3D + MMG3D + + + GMSH_R_TREE + R-tree + + + GMSH_2D_RECOMB_ALGO + 2D recombination algorithm + + + GMSH_STANDARD + Standard + + + GMSH_BLOSSOM + Blossom + + + GMSH_RECOMBINE_ALL + Recombine all triangular meshes + + + GMSH_SUBDIV_ALGO + Subdivision algorithm + + + GMSH_NONE + None + + + GMSH_ALL_QUADS + All Quads + + + GMSH_ALL_HEXAS + All Hexas + + + GMSH_REMESH_ALGO + Remeshing algorithm + + + GMSH_NO_SPLIT + No split + + + GMSH_AUTO + Automatic + + + GMSH_AUTO_ONLY_WITH_METIS + Automatic only with Metis + + + GMSH_REMESH_PARA + Remeshing parametrization + + + GMSH_HARMONIC + Harmonic + + + GMSH_CONFORMAL + Conformal + + + GMSH_RBF_HARMONIC + Rbf Harmonic + + + GMSH_SMOOTHING_STEPS + Smoothing steps + + + GMSH_SIZE_FACTOR + Element size factor + + + GMSH_USE_INCOMPLETE_ELEMENT + Use incomplete elements + + + diff --git a/src/GUI/GMSHPlugin_msg_fr.ts b/src/GUI/GMSHPlugin_msg_fr.ts new file mode 100755 index 0000000..62900b3 --- /dev/null +++ b/src/GUI/GMSHPlugin_msg_fr.ts @@ -0,0 +1,179 @@ + + + + + @default + + GMSH_2D_HYPOTHESIS + Gmsh 2D + + + GMSH_2D_TITLE + Construction d'une hypothèse + + + GMSH_3D_HYPOTHESIS + Gmsh 3D + + + GMSH_3D_TITLE + Construction d'une hypothèse + + + GMSH_MAX_SIZE + Taille maximale + + + GMSH_MIN_SIZE + Taille minimale + + + GMSH_MODERATE + Moyen + + + GMSH_SECOND_ORDER + Second ordre + + + GMSH_COMPOUND + Compounds + + + GMSH_COMPOUND_ENTRY_COLUMN + Entrée + + + GMSH_COMPOUND_NAME_COLUMN + Nom + + + GMSH_COMPOUND_ADD + Ajouter + + + GMSH_COMPOUND_REMOVE + Supprimer + + + GMSH_2D_ALGO + Algorithme 2D + + + GMSH_AUTOMATIC + Automatique + + + GMSH_MESH_ADAPT + Adaptation de maillage + + + GMSH_DELAUNAY + Delaunay + + + GMSH_FRONTAL + Frontal + + + GMSH_DELAUNAY_FOR_QUAD + Delaunay pour quads + + + GMSH_3D_ALGO + Algorithme 3D + + + GMSH_FRONTAL_DELAUNAY + Frontal Delaunay + + + GMSH_FRONTAL_HEX + Frontal Hex + + + GMSH_MMG3D + MMG3D + + + GMSH_R_TREE + R-tree + + + GMSH_2D_RECOMB_ALGO + Algorithme de recombinaison 2D + + + GMSH_STANDARD + Standard + + + GMSH_BLOSSOM + Blossom + + + GMSH_RECOMBINE_ALL + Recombiner tous les triangles + + + GMSH_SUBDIV_ALGO + Algorithme de subdivision + + + GMSH_NONE + Aucun + + + GMSH_ALL_QUADS + Quads uniquement + + + GMSH_ALL_HEXAS + Hexas uniquement + + + GMSH_REMESH_ALGO + Algorithme de remaillage + + + GMSH_NO_SPLIT + Sans découpe + + + GMSH_AUTO + Automatique + + + GMSH_AUTO_ONLY_WITH_METIS + Automatique avec Metis uniquement + + + GMSH_REMESH_PARA + Parametrisation du remaillage + + + GMSH_HARMONIC + Harmonique + + + GMSH_CONFORMAL + Conforme + + + GMSH_RBF_HARMONIC + Rbf Harmonique + + + GMSH_SMOOTHING_STEPS + Etapes de régularisation + + + GMSH_SIZE_FACTOR + Facteur de taille d'élément + + + GMSH_USE_INCOMPLETE_ELEMENT + Utiliser des éléments incomplets + + + diff --git a/src/GUI/Makefile.am b/src/GUI/Makefile.am new file mode 100755 index 0000000..5afa8ab --- /dev/null +++ b/src/GUI/Makefile.am @@ -0,0 +1,70 @@ +# Copyright (C) 2012-2013 ALNEOS +# +# 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.alneos.com/ or email : contact@alneos.fr +# +include $(top_srcdir)/adm_local/unix/make_common_starter.am + +# header files +salomeinclude_HEADERS = + +# Libraries targets +lib_LTLIBRARIES = libGMSHPluginGUI.la + +dist_libGMSHPluginGUI_la_SOURCES = \ + GMSHPluginGUI.cxx \ + GMSHPluginGUI.h \ + GMSHPluginGUI_HypothesisCreator.h \ + GMSHPluginGUI_HypothesisCreator.cxx + +MOC_FILES = \ + GMSHPluginGUI_HypothesisCreator_moc.cxx + +nodist_libGMSHPluginGUI_la_SOURCES= \ + $(MOC_FILES) + +# additionnal information to compil and link file + +libGMSHPluginGUI_la_CPPFLAGS = \ + $(CAS_CPPFLAGS) \ + $(GMSH_INCLUDES) \ + $(QT_INCLUDES) \ + $(PYTHON_INCLUDES) \ + $(KERNEL_CXXFLAGS) \ + $(GUI_CXXFLAGS) \ + $(GEOM_CXXFLAGS) \ + $(MED_CXXFLAGS) \ + $(SMESH_CXXFLAGS) \ + $(BOOST_CPPFLAGS) \ + $(CORBA_CXXFLAGS) \ + $(CORBA_INCLUDES) \ + -I$(srcdir)/../GMSHPlugin \ + -I$(top_builddir)/idl + +libGMSHPluginGUI_la_LDFLAGS = \ + ../../idl/libSalomeIDLGMSHPLUGIN.la \ + ../GMSHPlugin/libGMSHEngine.la \ + ${QT_MT_LIBS} \ + ${GUI_LDFLAGS} -lSalomeApp -lqtx -lsuit -lSalomeObject -lLightApp \ + ${SMESH_LDFLAGS} -lSMESH -lGeomSelectionTools \ + $(CAS_KERNEL) + +# resources files +nodist_salomeres_DATA= \ + GMSHPlugin_images.qm \ + GMSHPlugin_msg_en.qm \ + GMSHPlugin_msg_fr.qm + diff --git a/src/Makefile.am b/src/Makefile.am new file mode 100755 index 0000000..122dcfb --- /dev/null +++ b/src/Makefile.am @@ -0,0 +1,27 @@ +# Copyright (C) 2012-2013 ALNEOS +# +# 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.alneos.com/ or email : contact@alneos.fr +# +include $(top_srcdir)/adm_local/unix/make_common_starter.am + +SUBDIRS = GMSHPlugin + +if GMSHPLUGIN_ENABLE_GUI + SUBDIRS += GUI +endif + +DIST_SUBDIRS = GMSHPlugin GUI