Compare commits

..

No commits in common. "master" and "cbr/crowdin_V7_6_BR" have entirely different histories.

130 changed files with 5801 additions and 14548 deletions

0
AUTHORS Normal file
View File

58
CMakeLists.txt Normal file → Executable file
View File

@ -1,4 +1,4 @@
# Copyright (C) 2012-2024 CEA, EDF, OPEN CASCADE
# Copyright (C) 2012-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@ -17,35 +17,31 @@
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8 FATAL_ERROR)
# Project name
# ============
# original
PROJECT(SalomeNETGENPLUGIN C CXX)
# upper case
STRING(TOUPPER ${PROJECT_NAME} PROJECT_NAME_UC)
# Common CMake macros
# ===================
SET(CONFIGURATION_ROOT_DIR $ENV{CONFIGURATION_ROOT_DIR} CACHE PATH "Path to the Salome CMake configuration files")
IF(EXISTS ${CONFIGURATION_ROOT_DIR})
LIST(APPEND CMAKE_MODULE_PATH "${CONFIGURATION_ROOT_DIR}/cmake")
INCLUDE(SalomeMacros NO_POLICY_SCOPE)
ELSE()
MESSAGE(FATAL_ERROR "We absolutely need the Salome CMake configuration files, please define CONFIGURATION_ROOT_DIR !")
ENDIF()
# Ensure a proper linker behavior:
CMAKE_POLICY(SET CMP0003 NEW)
# Versioning
# ===========
SALOME_SETUP_VERSION(9.12.0)
MESSAGE(STATUS "Building ${PROJECT_NAME_UC} ${${PROJECT_NAME_UC}_VERSION} from \"${${PROJECT_NAME_UC}_GIT_SHA1}\"")
# Project name, upper case
STRING(TOUPPER ${PROJECT_NAME} PROJECT_NAME_UC)
SET(${PROJECT_NAME_UC}_MAJOR_VERSION 7)
SET(${PROJECT_NAME_UC}_MINOR_VERSION 6)
SET(${PROJECT_NAME_UC}_PATCH_VERSION 0)
SET(${PROJECT_NAME_UC}_VERSION
${${PROJECT_NAME_UC}_MAJOR_VERSION}.${${PROJECT_NAME_UC}_MINOR_VERSION}.${${PROJECT_NAME_UC}_PATCH_VERSION})
SET(${PROJECT_NAME_UC}_VERSION_DEV 0)
# Find KERNEL
# ===========
SET(KERNEL_ROOT_DIR $ENV{KERNEL_ROOT_DIR} CACHE PATH "Path to the Salome KERNEL")
IF(EXISTS ${KERNEL_ROOT_DIR})
LIST(APPEND CMAKE_MODULE_PATH "${KERNEL_ROOT_DIR}/salome_adm/cmake_files")
INCLUDE(SalomeMacros)
FIND_PACKAGE(SalomeKERNEL REQUIRED)
KERNEL_WITH_CORBA() # check whether KERNEL built with CORBA
KERNEL_WITH_CORBA() # check whether KERNEL builded with CORBA
ELSE(EXISTS ${KERNEL_ROOT_DIR})
MESSAGE(FATAL_ERROR "We absolutely need a Salome KERNEL, please define KERNEL_ROOT_DIR")
ENDIF(EXISTS ${KERNEL_ROOT_DIR})
@ -55,6 +51,8 @@ ENDIF(EXISTS ${KERNEL_ROOT_DIR})
INCLUDE(SalomeSetupPlatform) # From KERNEL
# Always build libraries as shared objects:
SET(BUILD_SHARED_LIBS TRUE)
# Local macros:
LIST(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/adm_local/cmake_files")
# User options
# ============
@ -73,8 +71,7 @@ OPTION(SALOME_BUILD_GUI "Enable GUI" ON)
##
# Python
FIND_PACKAGE(SalomePythonInterp REQUIRED)
FIND_PACKAGE(SalomePythonLibs REQUIRED)
FIND_PACKAGE(SalomePython REQUIRED)
# Boost
FIND_PACKAGE(SalomeBoost REQUIRED)
# CORBA
@ -92,9 +89,9 @@ ENDIF()
IF(SALOME_BUILD_GUI)
SET(GUI_ROOT_DIR $ENV{GUI_ROOT_DIR} CACHE PATH "Path to the Salome GUI")
IF(EXISTS ${GUI_ROOT_DIR})
LIST(APPEND CMAKE_MODULE_PATH "${GUI_ROOT_DIR}/adm_local/cmake_files")
FIND_PACKAGE(SalomeGUI)
SALOME_GUI_WITH_CORBA() # check whether GUI built with CORBA
SALOME_GUI_MODE(SALOME_USE_SALOMEOBJECT)
FULL_GUI(TRUE) # check whether GUI builded in full mode and with CORBA
ELSE(EXISTS ${GUI_ROOT_DIR})
MESSAGE(FATAL_ERROR "We absolutely need a Salome GUI, please define GUI_ROOT_DIR")
ENDIF(EXISTS ${GUI_ROOT_DIR})
@ -106,12 +103,12 @@ ENDIF(SALOME_BUILD_GUI)
##
IF(SALOME_BUILD_GUI)
# Qt
FIND_PACKAGE(SalomeQt5 REQUIRED)
# Qt4
FIND_PACKAGE(SalomeQt4 REQUIRED COMPONENTS QtCore QtGui)
ENDIF(SALOME_BUILD_GUI)
# OCCT
FIND_PACKAGE(SalomeOpenCASCADE REQUIRED)
FIND_PACKAGE(SalomeCAS REQUIRED)
# VTK
FIND_PACKAGE(SalomeVTK REQUIRED)
@ -121,6 +118,7 @@ FIND_PACKAGE(SalomeVTK REQUIRED)
SET(GEOM_ROOT_DIR $ENV{GEOM_ROOT_DIR} CACHE PATH "Path to the Salome GEOM")
IF(EXISTS ${GEOM_ROOT_DIR})
LIST(APPEND CMAKE_MODULE_PATH "${GEOM_ROOT_DIR}/adm_local/cmake_files")
FIND_PACKAGE(SalomeGEOM REQUIRED)
ELSE(EXISTS ${GEOM_ROOT_DIR})
MESSAGE(FATAL_ERROR "We absolutely need a Salome GEOM, please define GEOM_ROOT_DIR")
@ -130,6 +128,7 @@ ENDIF(EXISTS ${GEOM_ROOT_DIR})
# ===========
SET(SMESH_ROOT_DIR $ENV{SMESH_ROOT_DIR} CACHE PATH "Path to the Salome SMESH")
IF(EXISTS ${SMESH_ROOT_DIR})
LIST(APPEND CMAKE_MODULE_PATH "${SMESH_ROOT_DIR}/adm_local/cmake_files")
FIND_PACKAGE(SalomeSMESH REQUIRED)
ADD_DEFINITIONS(${SMESH_DEFINITIONS})
INCLUDE_DIRECTORIES(${SMESH_INCLUDE_DIRS})
@ -155,12 +154,6 @@ ENDIF(EXISTS ${SMESH_ROOT_DIR})
FIND_PACKAGE(SalomeNetgen REQUIRED)
ADD_DEFINITIONS(${NETGEN_DEFINITIONS})
IF (NETGEN_V6)
SET(NETGEN_VERSION_MAJOR 6)
ELSE()
SET(NETGEN_VERSION_MAJOR 5)
ENDIF()
# Detection summary:
SALOME_PACKAGE_REPORT_AND_CHECK()
@ -221,6 +214,7 @@ ENDIF(SALOME_BUILD_DOC)
# Header configuration
# ====================
SALOME_XVERSION(${PROJECT_NAME})
SALOME_CONFIGURE_FILE(NETGENPLUGIN_version.h.in NETGENPLUGIN_version.h INSTALL ${SALOME_INSTALL_HEADERS})
# Configuration export

340
COPYING Normal file
View File

@ -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.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
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.
<signature of Ty Coon>, 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.

0
ChangeLog Normal file
View File

1
INSTALL Normal file
View File

@ -0,0 +1 @@
SALOME2 : NETGENPLUGIN module (SMESH plugin)

504
LICENSE
View File

@ -1,504 +0,0 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
[This is the first released version of the Lesser GPL. It also counts
as the successor of the GNU Library Public License, version 2, hence
the version number 2.1.]
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.
This license, the Lesser General Public License, applies to some
specially designated software packages--typically libraries--of the
Free Software Foundation and other authors who decide to use it. You
can use it too, but we suggest you first think carefully about whether
this license or the ordinary General Public License is the better
strategy to use in any particular case, based on the explanations below.
When we speak of free software, we are referring to freedom of use,
not price. Our General Public Licenses are designed to make sure that
you have the freedom to distribute copies of free software (and charge
for this service if you wish); that you receive source code or can get
it if you want it; that you can change the software and use pieces of
it in new free programs; and that you are informed that you can do
these things.
To protect your rights, we need to make restrictions that forbid
distributors to deny you these rights or to ask you to surrender these
rights. These restrictions translate to certain responsibilities for
you if you distribute copies of the library or if you modify it.
For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
code. If you link other code with the library, you must provide
complete object files to the recipients, so that they can relink them
with the library after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
We protect your rights with a two-step method: (1) we copyright the
library, and (2) we offer you this license, which gives you legal
permission to copy, distribute and/or modify the library.
To protect each distributor, we want to make it very clear that
there is no warranty for the free library. Also, if the library is
modified by someone else and passed on, the recipients should know
that what they have is not the original version, so that the original
author's reputation will not be affected by problems that might be
introduced by others.
Finally, software patents pose a constant threat to the existence of
any free program. We wish to make sure that a company cannot
effectively restrict the users of a free program by obtaining a
restrictive license from a patent holder. Therefore, we insist that
any patent license obtained for a version of the library must be
consistent with the full freedom of use specified in this license.
Most GNU software, including some libraries, is covered by the
ordinary GNU General Public License. This license, the GNU Lesser
General Public License, applies to certain designated libraries, and
is quite different from the ordinary General Public License. We use
this license for certain libraries in order to permit linking those
libraries into non-free programs.
When a program is linked with a library, whether statically or using
a shared library, the combination of the two is legally speaking a
combined work, a derivative of the original library. The ordinary
General Public License therefore permits such linking only if the
entire combination fits its criteria of freedom. The Lesser General
Public License permits more lax criteria for linking other code with
the library.
We call this license the "Lesser" General Public License because it
does Less to protect the user's freedom than the ordinary General
Public License. It also provides other free software developers Less
of an advantage over competing non-free programs. These disadvantages
are the reason we use the ordinary General Public License for many
libraries. However, the Lesser license provides advantages in certain
special circumstances.
For example, on rare occasions, there may be a special need to
encourage the widest possible use of a certain library, so that it becomes
a de-facto standard. To achieve this, non-free programs must be
allowed to use the library. A more frequent case is that a free
library does the same job as widely used non-free libraries. In this
case, there is little to gain by limiting the free library to free
software only, so we use the Lesser General Public License.
In other cases, permission to use a particular library in non-free
programs enables a greater number of people to use a large body of
free software. For example, permission to use the GNU C Library in
non-free programs enables many more people to use the whole GNU
operating system, as well as its variant, the GNU/Linux operating
system.
Although the Lesser General Public License is Less protective of the
users' freedom, it does ensure that the user of a program that is
linked with the Library has the freedom and the wherewithal to run
that program using a modified version of the Library.
The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, whereas the latter must
be combined with the library in order to run.
GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library or other
program which contains a notice placed by the copyright holder or
other authorized party saying it may be distributed under the terms of
this Lesser General Public License (also called "this License").
Each licensee is addressed as "you".
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.
The "Library", below, refers to any such software library or work
which has been distributed under these terms. A "work based on the
Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language. (Hereinafter, translation is
included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for
making modifications to it. For a library, complete source code means
all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control compilation
and installation of the library.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep intact
all the notices that refer to this License and to the absence of any
warranty; and distribute a copy of this License along with the
Library.
You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.
2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a
table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility
is invoked, then you must make a good faith effort to ensure that,
in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of
its purpose remains meaningful.
(For example, a function in a library to compute square roots has
a purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must
be optional: if the application does not supply it, the square
root function must still compute square roots.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Library,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Library, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote
it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Library.
In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library. To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.
4. You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you accompany
it with the complete corresponding machine-readable source code, which
must be distributed under the terms of Sections 1 and 2 above on a
medium customarily used for software interchange.
If distribution of object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the
source code from the same place satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.
5. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a "work that uses the Library". Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.
However, linking a "work that uses the Library" with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a "work that uses the
library". The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.
When a "work that uses the Library" uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.
If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work. (Executables containing this object code plus portions of the
Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also combine or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License. Also, you must do one
of these things:
a) Accompany the work with the complete corresponding
machine-readable source code for the Library including whatever
changes were used in the work (which must be distributed under
Sections 1 and 2 above); and, if the work is an executable linked
with the Library, with the complete machine-readable "work that
uses the Library", as object code and/or source code, so that the
user can modify the Library and then relink to produce a modified
executable containing the modified Library. (It is understood
that the user who changes the contents of definitions files in the
Library will not necessarily be able to recompile the application
to use the modified definitions.)
b) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (1) uses at run time a
copy of the library already present on the user's computer system,
rather than copying library functions into the executable, and (2)
will operate properly with a modified version of the library, if
the user installs one, as long as the modified version is
interface-compatible with the version that the work was made with.
c) Accompany the work with a written offer, valid for at
least three years, to give the same user the materials
specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.
d) If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
e) Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
the materials to be distributed need not include anything that is
normally distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies
the executable.
It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:
a) Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities. This must be distributed under the terms of the
Sections above.
b) Give prominent notice with the combined library of the fact
that part of it is a work based on the Library, and explaining
where to find the accompanying uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License. Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library is void, and will automatically terminate your
rights under this License. However, parties who have received copies,
or rights, from you under this License will not have their licenses
terminated so long as such parties remain in full compliance.
9. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Library or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
10. Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties with
this License.
11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Library at all. For example, if a patent
license would not permit royalty-free redistribution of the Library by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Library.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library under this License may add
an explicit geographical distribution limitation excluding those countries,
so that distribution is permitted only in or among countries not thus
excluded. In such case, this License incorporates the limitation as if
written in the body of this License.
13. The Free Software Foundation may publish revised and/or new
versions of the Lesser General Public License from time to time.
Such new versions will be similar in spirit to the present version,
but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Library
specifies a version number of this License which applies to it and
"any later version", you have the option of following the terms and
conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
copyrighted by the Free Software Foundation, write to the Free
Software Foundation; we sometimes make exceptions for this. Our
decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
everyone can redistribute and change. You can do so by permitting
redistribution under these terms (or, alternatively, under the terms of the
ordinary General Public License).
To apply these terms, attach the following notices to the library. It is
safest to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.
<one line to give the library's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
USA
Also add information on how to contact you by electronic and paper mail.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the library, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the
library `Frob' (a library for tweaking knobs) written by James Random
Hacker.
<signature of Ty Coon>, 1 April 1990
Ty Coon, President of Vice
That's all there is to it!

View File

@ -1,4 +1,4 @@
// Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE
// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS

0
NEWS Normal file
View File

105
README
View File

@ -1,105 +0,0 @@
***************************
About SALOME Netgen plug-in
***************************
SALOME Netgen plug-in is destined for:
- Meshing 1D, 2D and 3D geometric entities.
- Splitting faces into triangular elements (quad-dominant mesh is also possible).
- Splitting solids into tetrahedral elements (pyramids are constructed as a
transition from quadrangles to tetrahedra).
- Generating 3D meshes from 2D meshes, working without geometrical objects.
SALOME Netgen plug-in is integrated into SALOME platform via the SALOME Mesh
module.
For more information please visit the SALOME platform web site:
<https://www.salome-platform.org/>
=======
License
=======
SALOME platform is distributed under the GNU Lesser General Public License.
See COPYING file for more details.
============
Installation
============
--------------
Pre-requisites
--------------
SALOME platform relies on a set of third-party software; some of them are needed
at build time only, while other ones are needed at runtime as well.
For more information about the pre-requisites please visit SALOME platform web
site:
* Check Release Notes and Software Requirements of the latest SALOME release at
<https://www.salome-platform.org/?page_id=15/>
Note: SALOME Netgen plug-in needs SALOME KERNEL, SALOME GUI, SALOME Geometry and
SALOME Mesh as pre-requisites.
------------------
Basic Installation
------------------
The build procedure of the SALOME platform is implemented with CMake.
In order to build the plug-in you have to do the following actions:
1. Set up environment for pre-requisites (see "Pre-requisites" section above).
2. Create a build directory:
% mkdir NETGENPLUGIN_BUILD
3. Configure the build procedure:
% cd NETGENPLUGIN_BUILD
% cmake -DCMAKE_BUILD_TYPE=<mode> -DCMAKE_INSTALL_PREFIX=<installation_directory> <path_to_src_dir>
where
- <mode> is either Release or Debug (default: Release);
- <installation_directory> is a destination folder to install SALOME Netgen
plug-in (default: /usr);
- <path_to_src_dir> is a path to the SALOME Netgen plug-in sources directory.
Note: by default (if CMAKE_INSTALL_PREFIX option is not given), SALOME Netgen
plug-in will be configured for installation to the /usr directory that requires
root permissions to complete the installation.
4. Build and install:
% make
% make install
This will install SALOME Netgen plug-in to the <installation_directory>
specified to cmake command on the previous step.
-------------------
Custom installation
-------------------
SALOME Netgen plug-in supports a set of advanced configuration options;
for more details learn CMakeLists.txt file in the root source directory.
You can also use other options of cmake command to customize your installation.
Learn more about available options by typing
% cmake --help
=============
Documentation
=============
The directory doc contains additional documentation file of SALOME Netgen plug-in.
===============
Troubleshooting
===============
Please, send a mail to webmaster.salome@opencascade.com.

View File

@ -1,11 +1,11 @@
# - Config file for the @PROJECT_NAME@ package
# It defines the following variables.
# Specific to the package @PROJECT_NAME@ itself:
# Specific to the pacakge @PROJECT_NAME@ itself:
# @PROJECT_NAME_UC@_ROOT_DIR_EXP - the root path of the installation providing this CMake file
#
###############################################################
# Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE
# Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@ -65,34 +65,32 @@ IF(SALOME_NETGENPLUGIN_USE_NETGEN)
SET_AND_CHECK(NETGEN_ROOT_DIR_EXP "@PACKAGE_NETGEN_ROOT_DIR@")
ENDIF()
# For all prerequisites, load the corresponding targets if the package was used
# For all prerequisites, load the corresponding targets if the package was used
# in CONFIG mode. This ensures dependent projects link correctly
# without having to set LD_LIBRARY_PATH:
SET(_PREREQ_@PROJECT_NAME@ @_PREREQ_LIST@)
SET(_PREREQ_@PROJECT_NAME@_CONFIG_DIR @_PREREQ_DIR_LIST@)
SET(_PREREQ_@PROJECT_NAME@_COMPONENTS "@_PREREQ_COMPO_LIST@")
LIST(LENGTH _PREREQ_@PROJECT_NAME@_CONFIG_DIR _list_len_@PROJECT_NAME@)
IF(NOT _list_len_@PROJECT_NAME@ EQUAL 0)
SET(_PREREQ @_PREREQ_LIST@)
SET(_PREREQ_CONFIG_DIR @_PREREQ_DIR_LIST@)
SET(_PREREQ_COMPONENTS "@_PREREQ_COMPO_LIST@")
LIST(LENGTH _PREREQ_CONFIG_DIR _list_len)
IF(NOT _list_len EQUAL 0)
# Another CMake stupidity - FOREACH(... RANGE r) generates r+1 numbers ...
MATH(EXPR _range_@PROJECT_NAME@ "${_list_len_@PROJECT_NAME@}-1")
FOREACH(_p_@PROJECT_NAME@ RANGE ${_range_@PROJECT_NAME@})
LIST(GET _PREREQ_@PROJECT_NAME@ ${_p_@PROJECT_NAME@} _pkg_@PROJECT_NAME@ )
LIST(GET _PREREQ_@PROJECT_NAME@_CONFIG_DIR ${_p_@PROJECT_NAME@} _pkg_dir_@PROJECT_NAME@)
LIST(GET _PREREQ_@PROJECT_NAME@_COMPONENTS ${_p_@PROJECT_NAME@} _pkg_compo_@PROJECT_NAME@)
IF(NOT OMIT_DETECT_PACKAGE_${_pkg_@PROJECT_NAME@})
MESSAGE(STATUS "===> Reloading targets from ${_pkg_@PROJECT_NAME@} ...")
IF(NOT _pkg_compo_@PROJECT_NAME@)
FIND_PACKAGE(${_pkg_@PROJECT_NAME@} REQUIRED NO_MODULE
PATHS "${_pkg_dir_@PROJECT_NAME@}"
NO_DEFAULT_PATH)
ELSE()
STRING(REPLACE "," ";" _compo_lst_@PROJECT_NAME@ "${_pkg_compo_@PROJECT_NAME@}")
MESSAGE(STATUS "===> (components: ${_pkg_compo_@PROJECT_NAME@})")
FIND_PACKAGE(${_pkg_@PROJECT_NAME@} REQUIRED NO_MODULE
COMPONENTS ${_compo_lst_@PROJECT_NAME@}
PATHS "${_pkg_dir_@PROJECT_NAME@}"
NO_DEFAULT_PATH)
ENDIF()
MATH(EXPR _range "${_list_len}-1")
FOREACH(_p RANGE ${_range})
LIST(GET _PREREQ ${_p} _pkg )
LIST(GET _PREREQ_CONFIG_DIR ${_p} _pkg_dir)
LIST(GET _PREREQ_COMPONENTS ${_p} _pkg_compo)
MESSAGE(STATUS "===> Reloading targets from ${_pkg} ...")
IF(NOT _pkg_compo)
FIND_PACKAGE(${_pkg} REQUIRED NO_MODULE
PATHS "${_pkg_dir}"
NO_DEFAULT_PATH)
ELSE()
STRING(REPLACE "," ";" _compo_lst "${_pkg_compo}")
MESSAGE(STATUS "===> (components: ${_pkg_compo})")
FIND_PACKAGE(${_pkg} REQUIRED NO_MODULE
COMPONENTS ${_compo_lst}
PATHS "${_pkg_dir}"
NO_DEFAULT_PATH)
ENDIF()
ENDFOREACH()
ENDIF()

3
adm_local/CMakeLists.txt Normal file → Executable file
View File

@ -1,4 +1,4 @@
# Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE
# Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@ -21,3 +21,4 @@
#
ADD_SUBDIRECTORY(unix)
ADD_SUBDIRECTORY(cmake_files)

View File

@ -0,0 +1,30 @@
# Copyright (C) 2012-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
# ===============================================================
# Files to be installed
# ===============================================================
# These files are data, module or lib files
SET(_adm_data
FindSalomeNETGENPLUGIN.cmake
FindNetgen.cmake
FindSalomeNetgen.cmake
)
INSTALL(FILES ${_adm_data} DESTINATION ${SALOME_INSTALL_CMAKE_LOCAL})

View File

@ -0,0 +1,114 @@
# - Find NETGEN
# Sets the following variables:
# NETGEN_INCLUDE_DIRS - path to the NETGEN include directories
# NETGEN_LIBRARIES - path to the NETGEN libraries to be linked against
#
#########################################################################
# Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
# ------
IF(NOT Netgen_FIND_QUIETLY)
MESSAGE(STATUS "Check for Netgen ...")
ENDIF()
# ------
SET(NETGEN_ROOT_DIR $ENV{NETGEN_ROOT_DIR})
IF(NETGEN_ROOT_DIR)
LIST(APPEND CMAKE_PREFIX_PATH "${NETGEN_ROOT_DIR}")
ENDIF(NETGEN_ROOT_DIR)
FIND_PATH(_netgen_base_inc_dir nglib.h)
SET(NETGEN_INCLUDE_DIRS ${_netgen_base_inc_dir})
FIND_PATH(_netgen_add_inc_dir occgeom.hpp HINTS ${_netgen_base_inc_dir} PATH_SUFFIXES share/netgen/include)
LIST(APPEND NETGEN_INCLUDE_DIRS ${_netgen_add_inc_dir})
LIST(REMOVE_DUPLICATES NETGEN_INCLUDE_DIRS)
FIND_LIBRARY(NETGEN_nglib NAMES nglib)
IF(WIN32)
FIND_LIBRARY(NETGEN_csg NAMES csg)
FIND_LIBRARY(NETGEN_gen NAMES gen)
FIND_LIBRARY(NETGEN_geom2d NAMES geom2d)
FIND_LIBRARY(NETGEN_gprim NAMES gprim)
FIND_LIBRARY(NETGEN_interface NAMES interface)
FIND_LIBRARY(NETGEN_la NAMES la)
FIND_LIBRARY(NETGEN_mesh NAMES mesh)
FIND_LIBRARY(NETGEN_occ NAMES occ)
FIND_LIBRARY(NETGEN_stl NAMES stl)
ENDIF(WIN32)
SET(NETGEN_LIBRARIES ${NETGEN_nglib})
IF(WIN32)
SET(NETGEN_LIBRARIES ${NETGEN_LIBRARIES}
${NETGEN_csg}
${NETGEN_gen}
${NETGEN_geom2d}
${NETGEN_gprim}
${NETGEN_interface}
${NETGEN_la}
${NETGEN_mesh}
${NETGEN_occ}
${NETGEN_stl}
)
ENDIF(WIN32)
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(NETGEN REQUIRED_VARS NETGEN_INCLUDE_DIRS NETGEN_LIBRARIES)
INCLUDE(CheckCXXSourceCompiles)
IF(NETGEN_FOUND)
SET(CMAKE_REQUIRED_INCLUDES "${CMAKE_REQUIRED_INCLUDES} ${NETGEN_INCLUDE_DIRS}")
SET(CMAKE_REQUIRED_LIBRARIES "${NETGEN_LIBRARIES}")
CHECK_CXX_SOURCE_COMPILES("
#include <meshing.hpp>
int main()
{
netgen::Mesh* ngMesh;
ngMesh->CalcLocalH(1.0);
}
" NETGEN_V5
)
IF(NOT Netgen_FIND_QUIETLY)
MESSAGE(STATUS "Netgen library: ${NETGEN_LIBRARIES}")
ENDIF()
SET(NETGEN_DEFINITIONS "-DOCCGEOMETRY")
IF(NETGEN_V5)
MESSAGE(STATUS "NETGEN V5 or later found")
SET(NETGEN_DEFINITIONS "${NETGEN_DEFINITIONS} -DNETGEN_V5")
ENDIF(NETGEN_V5)
#RNV: currently on windows use netgen without thread support.
#TODO: check support of the multithreading on windows
IF(WIN32)
SET(NETGEN_DEFINITIONS "${NETGEN_DEFINITIONS} -DNO_PARALLEL_THREADS")
ENDIF(WIN32)
ENDIF()

View File

@ -0,0 +1,34 @@
# Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
IF(NOT SalomeNETGENPLUGIN_FIND_QUIETLY)
MESSAGE(STATUS "Looking for Salome NETGENPLUGIN ...")
ENDIF()
SET(CMAKE_PREFIX_PATH "${NETGENPLUGIN_ROOT_DIR}")
SALOME_FIND_PACKAGE(SalomeNETGENPLUGIN SalomeNETGENPLUGIN CONFIG)
IF(NOT SalomeNETGENPLUGIN_FIND_QUIETLY)
MESSAGE(STATUS "Found Salome NETGENPLUGIN: ${NETGENPLUGIN_ROOT_DIR}")
ENDIF()
FOREACH(_res ${SalomeNETGENPLUGIN_EXTRA_ENV})
SALOME_ACCUMULATE_ENVIRONMENT(${_res} "${SalomeNETGENPLUGIN_EXTRA_ENV_${_res}}")
ENDFOREACH()

View File

@ -0,0 +1,26 @@
# Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS(Netgen NETGEN_INCLUDE_DIRS 1)
MARK_AS_ADVANCED(NETGEN_INCLUDE_DIRS NETGEN_LIBRARIES)
IF(NETGEN_FOUND)
SALOME_ACCUMULATE_HEADERS(NETGEN_INCLUDE_DIRS)
SALOME_ACCUMULATE_ENVIRONMENT(LD_LIBRARY_PATH ${NETGEN_LIBRARIES})
ENDIF()

2
adm_local/unix/CMakeLists.txt Normal file → Executable file
View File

@ -1,4 +1,4 @@
# Copyright (C) 2012-2024 CEA, EDF, OPEN CASCADE
# Copyright (C) 2012-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public

2
adm_local/unix/config_files/CMakeLists.txt Normal file → Executable file
View File

@ -1,4 +1,4 @@
# Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE
# Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS

View File

@ -1,4 +1,4 @@
dnl Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE
dnl Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
dnl
dnl Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
dnl CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS

View File

@ -1,4 +1,4 @@
dnl Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE
dnl Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
dnl
dnl Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
dnl CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS

2
bin/CMakeLists.txt Normal file → Executable file
View File

@ -1,4 +1,4 @@
# Copyright (C) 2012-2024 CEA, EDF, OPEN CASCADE
# Copyright (C) 2012-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public

1
bin/VERSION.in Normal file → Executable file
View File

@ -1,4 +1,3 @@
[SALOME NETGENPLUGIN] : @SALOMENETGENPLUGIN_VERSION@
[DEVELOPMENT] : @SALOMENETGENPLUGIN_VERSION_DEV@
[SHA1] : @SALOMENETGENPLUGIN_GIT_SHA1@
[DESCRIPTION] : Netgen meshing plug-in for SALOME Mesh module

2
doc/CMakeLists.txt Normal file → Executable file
View File

@ -1,4 +1,4 @@
# Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE
# Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS

2
doc/salome/CMakeLists.txt Normal file → Executable file
View File

@ -1,4 +1,4 @@
# Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE
# Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS

View File

@ -1,4 +1,4 @@
# Copyright (C) 2013-2024 CEA, EDF, OPEN CASCADE
# Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public

View File

@ -4,11 +4,11 @@ import salome
salome.salome_init()
import GEOM
from salome.geom import geomBuilder
geompy = geomBuilder.New()
geompy = geomBuilder.New(salome.myStudy)
import SMESH, SALOMEDS
from salome.smesh import smeshBuilder
smesh = smeshBuilder.New()
smesh = smeshBuilder.New(salome.myStudy)
# create a box
box = geompy.MakeBoxDXDYDZ(10., 10., 10.)
@ -18,7 +18,7 @@ geompy.addToStudy(box, "Box")
# 1. Create a triangular 2D mesh on the box with NETGEN_1D2D algorithm
triaN = smesh.Mesh(box, "Box : triangular mesh by NETGEN_1D2D")
# create a NETGEN_1D2D algorithm for solids
# create a Netgen_1D2D algorithm for solids
algo2D = triaN.Triangle(smeshBuilder.NETGEN_1D2D)
# define hypotheses
@ -33,7 +33,7 @@ n12_params.SetMaxSize(300)
# 2. Create a tetrahedral mesh on the box with NETGEN_1D2D3D algorithm (full netgen)
tetraN = smesh.Mesh(box, "Box : tetrahedrical mesh by NETGEN_1D2D3D")
# create a NETGEN_1D2D3D algorithm for solids
# create a Netgen_1D2D3D algorithm for solids
algo3D = tetraN.Tetrahedron(smeshBuilder.FULL_NETGEN)
# define hypotheses

2
doc/salome/gui/CMakeLists.txt Normal file → Executable file
View File

@ -1,4 +1,4 @@
# Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE
# Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS

11
doc/salome/gui/NETGENPLUGIN/CMakeLists.txt Normal file → Executable file
View File

@ -1,4 +1,4 @@
# Copyright (C) 2012-2024 CEA, EDF, OPEN CASCADE
# Copyright (C) 2012-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@ -22,15 +22,14 @@ SALOME_CONFIGURE_FILE(doxyfile_py.in doxyfile_py)
SALOME_CONFIGURE_FILE(static/header.html.in ${CMAKE_CURRENT_BINARY_DIR}/static/header.html)
SALOME_CONFIGURE_FILE(static/header_py.html.in ${CMAKE_CURRENT_BINARY_DIR}/static/header_py.html)
SET(DOC_SMESH_MeshersList NETGENPlugin)
SET(smesh_file "$(SMESH_ROOT_DIR)/bin/salome/collect_mesh_methods.py")
SET(kernel_file "$ENV{KERNEL_ROOT_DIR}/bin/salome/prepare_generating_doc.py")
# Define requared environment variables
SET(ADD_VAR)
LIST(APPEND ADD_VAR SMESH_MeshersList=NETGENPlugin)
SALOME_ACCUMULATE_ENVIRONMENT(SMESH_MeshersList NOCHECK ${DOC_SMESH_MeshersList})
SET(_cmd_options ${smesh_file} -d -o tmp/smeshBuilder.py NETGENPlugin)
SALOME_GENERATE_ENVIRONMENT_SCRIPT(_cmd env_script "${PYTHON_EXECUTABLE}" "${_cmd_options}" CONTEXT "NETGENPLUGIN_DOC" ADDITIONAL_VARIABLES ${ADD_VAR})
SALOME_GENERATE_ENVIRONMENT_SCRIPT(_cmd env_script "${PYTHON_EXECUTABLE}" "${_cmd_options}")
ADD_CUSTOM_TARGET(usr_docs ${CMAKE_COMMAND} -E make_directory tmp
COMMAND ${PYTHON_EXECUTABLE} ${kernel_file} -o tmp/NETGENPluginBuilder.py ${CMAKE_SOURCE_DIR}/src/NETGENPlugin/NETGENPluginBuilder.py
@ -45,6 +44,8 @@ ADD_CUSTOM_TARGET(usr_docs ${CMAKE_COMMAND} -E make_directory tmp
INSTALL(CODE "EXECUTE_PROCESS(COMMAND \"${CMAKE_COMMAND}\" --build ${PROJECT_BINARY_DIR} --target usr_docs)")
INSTALL(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/NETGENPLUGIN DESTINATION ${SALOME_INSTALL_DOC}/gui)
INSTALL(FILES images/head.png DESTINATION ${SALOME_INSTALL_DOC}/gui/NETGENPLUGIN)
INSTALL(FILES images/head.png DESTINATION ${SALOME_INSTALL_DOC}/gui/NETGENPLUGIN/netgenpluginpy_doc)
SET(make_clean_files NETGENPLUGIN netgenpluginpy_doc.tag)
SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${make_clean_files}")

25
doc/salome/gui/NETGENPLUGIN/doxyfile.in Normal file → Executable file
View File

@ -1,3 +1,25 @@
# Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
#---------------------------------------------------------------------------
# Project related configuration options
#---------------------------------------------------------------------------
@ -29,8 +51,7 @@ GENERATE_HTML = YES
HTML_OUTPUT = .
HTML_HEADER = @CMAKE_CURRENT_BINARY_DIR@/static/header.html
HTML_FOOTER = @CMAKE_CURRENT_SOURCE_DIR@/static/footer.html
HTML_EXTRA_STYLESHEET = @CMAKE_CURRENT_SOURCE_DIR@/static/salome_extra.css
HTML_EXTRA_FILES = @CMAKE_CURRENT_SOURCE_DIR@/images/head.png
HTML_EXTRA_STYLESHEET = @CMAKE_CURRENT_SOURCE_DIR@/static/salome_extra.css
TOC_EXPAND = YES
DISABLE_INDEX = NO
GENERATE_TREEVIEW = YES

25
doc/salome/gui/NETGENPLUGIN/doxyfile_py.in Normal file → Executable file
View File

@ -1,3 +1,25 @@
# Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
#---------------------------------------------------------------------------
# Project related configuration options
#---------------------------------------------------------------------------
@ -92,8 +114,7 @@ GENERATE_HTML = YES
HTML_OUTPUT = netgenpluginpy_doc
HTML_HEADER = @CMAKE_CURRENT_BINARY_DIR@/static/header_py.html
HTML_FOOTER = @CMAKE_CURRENT_SOURCE_DIR@/static/footer.html
HTML_EXTRA_STYLESHEET = @CMAKE_CURRENT_SOURCE_DIR@/static/salome_extra.css
HTML_EXTRA_FILES = @CMAKE_CURRENT_SOURCE_DIR@/images/head.png
HTML_EXTRA_STYLESHEET = @CMAKE_CURRENT_SOURCE_DIR@/static/salome_extra.css
TOC_EXPAND = YES
DISABLE_INDEX = NO
GENERATE_TREEVIEW = YES

0
doc/salome/gui/NETGENPLUGIN/images/head.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 77 KiB

After

Width:  |  Height:  |  Size: 77 KiB

0
doc/salome/gui/NETGENPLUGIN/images/image1.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

0
doc/salome/gui/NETGENPLUGIN/images/image2.gif Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

View File

@ -5,20 +5,19 @@
\n <b>Additional Hypotheses</b> can be applied as a supplement to
introducing additional concepts to mesh creation.
Following additional hypotheses can be used together with NETGEN algorithm:
Following additional hypotheses can be used together with NETGEN algoritm:
<ul>
<li><b>Viscous Layers</b> additional hypothesis can be used together
with NETGEN 3D and NETGEN 1D-2D-3D algorithms.
<li><b>Viscous Layers</b> additional hypothesis can be used together with NETGEN 3D.
This hypothesis allows creation of layers of highly stretched prisms near
mesh boundary, which is beneficial for high quality viscous
computations. The prisms constructed on the quadrangular mesh faces are
actually the hexahedrons.</li>
</ul>
<li><b>Quadrangle Preference</b> - This additional hypothesis can be
used together with NETGEN 2D algorithm.
It allows NETGEN 2D to build quad-dominant meshes.</li>
</ul>
used together with Netgen 2D algorithm.
It allows Netgen 2D to build quad-dominant meshes.</li>
<br>
For more detailed description of the described above hypothesis please refer SALOME Mesh User's Guide.

View File

@ -9,13 +9,9 @@
- Solids are split into tetrahedral elements. Pyramids are
constructed as a transition from quadrangles to tetrahedra.
- Generating 3D meshes from 2D meshes, working without geometrical objects.
- Generating 2D meshes from 2D meshes, working without geometrical objects.
When working without geometrical objects, Negten requires that the
input mesh to be a manifold shell.
To manage parameters of the NETGENPLUGIN use
\subpage netgen_2d_3d_hypo_page and \subpage additional_hypo_page.
To manage parameters of the NETGENPLUGIN use \subpage
netgen_2d_3d_hypo_page and \subpage additional_hypo_page.
Native Netgen mesher usually prints a lot of trace output to the terminal
window. This output is redirected to some log file by the Plugin. It

View File

@ -1,197 +1,77 @@
/*!
\page netgen_2d_3d_hypo_page NETGEN 2D and 3D hypotheses
\page netgen_2d_3d_hypo_page Netgen 2D and 3D hypotheses
<b>NETGEN 2D Parameters</b> and <b>NETGEN 3D Parameters</b>
hypotheses work only with NETGEN algorithm in it's different forms:
- <b>NETGEN 1D-2D</b>
- <b>NETGEN 2D</b>
- <b>NETGEN 1D-2D-3D</b>
- <b>NETGEN 3D</b>.
<b>NETGEN 1D-2D</b> and <b>NETGEN 1D-2D-3D</b> algorithms do not
require definition of lower-level hypotheses and algorithms (2D and
1D for meshing 3D objects and 1D for meshing 2D objects).
<b>NETGEN 1D-2D-3D</b> algorithm has maximal number of options. The
rest forms have less options as they construct elements of less number
of dimensions. All options are distributed among following tabs:
- \ref arguments_anchor "Arguments" - basic options.
- \ref local_sizes_anchor "Local Sizes" - local element size.
- \ref advanced_anchor "Advanced" - advanced options.
- \ref stl_anchor "STL" - specific Remesher options.
\ref simple_anchor "NETGEN 2D/3D simple parameters" hypotheses allow
defining the size of elements for each dimension separately.
\anchor arguments_anchor
<h2> Arguments tab</h2>
<b>Arguments</b> tab defines basic mesh parameters.
<b>Netgen 2D Parameters</b> and <b>Netgen 3D Parameters</b> hypotheses work only with
<b>Netgen 1D-2D</b>, <b>Netgen 2D</b>, <b>Netgen 1D-2D-3D</b> and
<b>Netgen 3D</b> algorithms. <b>Netgen 1D-2D</b> and <b>Netgen
1D-2D-3D</b> algorithms do not require definition of lower-level
hypotheses and algorithms (2D and 1D for meshing 3D objects and 1D for
meshing 2D objects).
\image html netgen2d3d.png
<center><em>Main tab of hypothesis dialog box <b>NETGEN 1D-2D-3D</b> algorithm</em></center>
<center><em>Hypothesis dialog boxes of <b>Netgen 1D-2D</b> and <b>Netgen
1D-2D-3D</b> algorithms are same</em></center>
<br>
- <b>Name</b> - allows to define the name for the algorithm (NETGEN
\image html netgen2d3d_only.png
<center><em>Dialog boxes of <b>Netgen 2D</b> and <b>Netgen 3D</b>
algorithms </em></center>
- <b>Name</b> - allows to define the name for the algorithm (Netgen
2D (or 3D) Parameters by default).
- <b>Max Size</b> - maximum linear dimensions for mesh cells.
- <b>Min Size</b> - minimum linear dimensions for mesh cells. It is
ignored if it is more than <b>Max Size</b>.
- <b>Second Order</b> - if this box is checked in, the algorithm will
create second order mesh.
- <b>Fineness</b> - ranging from <em>Very Coarse</em> to <em>Very Fine</em>
allows to set the level of meshing detalization using the three
parameters below. You can select \a Custom to define them manually.
- <b>Growth rate</b> - allows to define how much the linear dimensions of
two adjacent cells can differ (e.g. 0.3 means 30%).
- <b>Nb. Segs per Edge</b> - allows to define the minimum number of
mesh segments in which edges will be split. Size of elements computed using
this value is trimmed between <b>Min Size</b> and <b>Max Size</b>
bounds. This parameter is used only if <b>Limit Size by Surface
Curvature</b> is checked.
mesh segments in which edges will be split. This parameter is used
only if <b>Limit Size by Surface Curvature</b> is checked.
- <b>Nb Segs per Radius</b> - allows to define the size of
mesh segments and mesh faces in which curved edges and surfaces will
be split. A radius of local curvature divided by this value gives an element
size at a given point. Element size computed this way is then trimmed
between <b>Min Size</b> and <b>Max Size</b> bounds. This parameter is
used only if <b>Limit Size by Surface Curvature</b> is checked.
- <b>Chordal Error</b> - allows to define the maximum distance between
the generated 2D element and the surface. Size of elements computed using
this criterion is trimmed between <b>Min Size</b> and <b>Max Size</b> bounds.
be split. This value divided by a radius of curvature gives an element
size at a given point. This parameter is used only if <b>Limit Size by
Surface Curvature</b> is checked.
- <b>Limit Size by Surface Curvature</b> - if this box is checked in,
then size of mesh segments and mesh faces on curved edges and surfaces
is defined using value of <b>Nb Segs per Radius</b> parameter, and
number of segments on straight edges is defined by values of
<b>Nb. Segs per Edge</b> parameter. (<b>Growth rate</b> is also taken
into account.) If this box is not checked in, then size of elements is
defined by three parameters only:
<b>Nb. Segs per Edge</b> parameter. If this box is not checked in,
then size of elements is defined by three parameters only:
<b>Max Size</b>, <b>Min Size</b> and <b>Growth rate</b>.
- <b>Quad-dominated</b> - if this box is checked in, the mesher
- <b>Allow Quadrangles</b> - if this box is checked in, the mesher
tries to generate quadrangle 2D mesh. Triangle elements are created
where quadrangles are not possible.
- <b>Second Order</b> - if this box is checked in, the algorithm will
create second order mesh.
- <b>Optimize</b> - if this box is checked in, the algorithm will modify
initially created mesh in order to improve quality of elements. Optimization
process is rather time consuming comparing to creation of initial
mesh.
Remesher has two additional basic options:
- <b>Keep existing edges</b> - if activated, all edges present in the
initial mesh are kept and used to separate STL surfaces.
- <b>Create groups of surfaces </b> if activated, all new surface
elements are distributed among groups corresponding to STL surfaces
the Remesher detects.
\anchor local_sizes_anchor
<h2> Local sizes tab</h2>
<b>Local sizes</b> tab allows to define size of elements on and
around specified geometrical objects.
\image html netgen3d_local_size.png
- To define the local
size it is necessary to select a geometrical objects in the
object browser or in the viewer, and to click a button corresponding
to the type of the geometrical objects: <b>On Vertex</b>, <b>On
Edge</b> etc. <b>Name</b> of the geometrical object and a
default <b>Value</b> will be added in the table where the <b>Value</b>
can be changed.
- <b>Remove</b> - deletes a selected row from the table.
- <b>Mesh-size File</b> - opens a dialog to select a file defining
size of elements. The file includes two obligatory sections. The first
section defines the size at points. The second section defines the
size along lines. Sizes defined in the file are trimmed between <b>Min
Size</b> and <b>Max Size</b> bounds. Let's consider the following
sample size file.
\code
2
92.5 92.5 92.5 0.05
42.5 42.5 42.5 0.04
1
25 25 0 25 25 200 0.3
\endcode
"2" at the first line means that there are two points in the first
section.<br>
"92.5 92.5 92.5 0.05" at the second line means that at the point with
coordinates (92.5, 92.5, 92.5) size of elements should be 0.05.<br>
"1" at the fourth line means that there is one line in the second
section.<br>
"25 25 0 25 25 200 0.3" means that along the line between points (25,
25, 0) and (25, 25, 200) size of elements should be 0.3.
\anchor advanced_anchor
<h2> Advanced tab</h2>
<b>Advanced</b> tab allows advance controlling meshing algorithm.
\image html netgen_advanced.png
- <b>Element size weight</b> - weight of triangle size badness with respect to
triangle shape badness. Total triangle badness is evaluated as <em>
shape_badness + size_weight * size_mismatch</em>.
- <b>Nb. surface optimization steps</b> - number of loops when optimizing surface mesh.
- <b>Nb. volume optimization steps</b> - number of loops when optimizing volume mesh.
- <b>Worst element measure</b> - power of error, used to approximate max error optimization.
- <b>Use Delaunay</b> - if activated, use Delaunay approach to
construct volume elements, otherwise use Advancing front method.
- <b>Check overlapping</b> - check overlapping surfaces during surface meshing.
- <b>Check chart boundary</b> - to check chart boundary.
process is rather time consuming comparing to creation of initial mesh.
- <b>Fuse Coincident Nodes on Edges and Vertices</b> - allows merging
mesh nodes on vertices and edges which are geometrically coincident
but are topologically different.
\image html netgen3d_local_size.png
\anchor stl_anchor
<h2> STL tab</h2>
<b> STL </b> tab holds option of Remesher (NETGEN 2D working w/o geometry).
\image html netgen2d_remesher.png
<center><em>Options specific to <b>NETGEN 2D</b> remesher algorithms</em></center>
- <b>Ridge angle</b> - defines minimum angle in degrees between
normals of adjacent triangles at which the remesher considers the edge
between these triangles as a feature edge. Feature edges bound charts
of triangles that are re-meshed as separate surfaces.
- <b> Edge corner angle </b> - defines minimum angle in degrees
between adjacent edges of chart boundary, above which a point shared
by the edges is considered as an end point of chart boundary curve.
- <b> Chart angle </b> - angle between normals of adjacent triangles
under which a shared sharp edge is <em>not</em> considered as chart boundary,
provided that this edge is not classified as chart boundary due
to <b>Ridge angle</b> and <b>Keep existing edges</b> options.
- <b> Outer chart angle </b> - angle for overlapping parts of chart.
- <b> Chart distance </b> - defines a factor used to limit element
size by distance to neighbor chart.
- <b> Line length </b> - defines a factor used to limit size
of elements located near ends of chart boundary curves by length of a
chart boundary curve.
- <b> Close edges </b> - defines a factor used to limit size
of elements located near chart boundary curves by distance to other
chart boundary curves.
- <b> Surface curvature </b> - defines a factor used to limit size
of elements by surface curvature.
- <b> Edge angle </b> - defines a factor used to limit size
of elements by chart boundary curve curvature.
- <b> Surface mesh curvature</b> - defines a number of elements per
curvature radius.
\anchor simple_anchor
<h2> NETGEN 2D/3D simple parameters</h2>
<b>NETGEN 2D simple parameters</b> and <b>NETGEN 3D simple
parameters</b> hypotheses allow defining the size of elements for each
dimension.
- <b>Local sizes</b> - allows to define size of elements on and
around specified geometrical edges and vertices. To define the local
size it is necessary to select a geometrical edge or vertex in the
object browser or in the viewer, and to click <b>On Edge</b> or <b>On
Vertex</b> correspondingly. <b>Name</b> of the geometrical object and
a default <b>Value</b> will be added in the table where the
<b>Value</b> can be changed.
- <b>Remove</b> - deletes a selected row from the table.
\image html netgen2d3d_simple.png
<b>Netgen 2D simple parameters</b> and <b>Netgen 3D simple
parameters</b> allow defining the size of elements for each
dimension.
\b 1D group allows defining the size of 1D elements in either of two ways:
- <b>Number of Segments</b> allows specifying number of segments, that
will split each edge, with equidistant distribution.
@ -212,7 +92,7 @@ volumic elements will be equal to an average area of 2D elements, else
- <b>Max. Element Volume</b> specifies expected maximum element volume
of 3d elements.
\note NETGEN algorithm does not strictly follow the input
\note Netgen algorithm does not strictly follow the input
parameters. The actual mesh can be more or less dense than
required. There are several factors in it:
- NETGEN does not actually use <b>Number of Segments</b> parameter for
@ -223,7 +103,6 @@ close edges influence each other.
- The local size of segments influences the size of close triangles.
- The order of elements and their size in the 1D mesh generated by
NETGEN differ from those in the 1D mesh generated by Regular_1D
algorithm, which results in different 2D and 3D meshes at the same 1D
input parameters.
algorithm, resulting in different 2D and 3D meshes.
*/

2
doc/salome/gui/NETGENPLUGIN/static/footer.html Normal file → Executable file
View File

@ -4,7 +4,7 @@
<ul>
$navpath
<li class="footer">
Copyright &copy; 2007-2024 CEA, EDF, OPEN CASCADE<br>
Copyright &copy; 2007-2015 CEA/DEN, EDF R&amp;D, OPEN CASCADE<br>
Copyright &copy; 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&amp;D, LEG, PRINCIPIA R&amp;D, BUREAU VERITAS<br>
</li>
</ul>

0
doc/salome/gui/NETGENPLUGIN/static/header.html.in Normal file → Executable file
View File

7
idl/CMakeLists.txt Normal file → Executable file
View File

@ -1,4 +1,4 @@
# Copyright (C) 2012-2024 CEA, EDF, OPEN CASCADE
# Copyright (C) 2012-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@ -25,13 +25,10 @@ INCLUDE_DIRECTORIES(
${GEOM_INCLUDE_DIRS}
${SMESH_INCLUDE_DIRS}
${PROJECT_BINARY_DIR}/idl
)
SALOME_CONFIGURE_FILE(NETGENPlugin_NETGEN_VERSION.idl.in NETGENPlugin_NETGEN_VERSION.idl)
)
SET(SalomeIDLNETGENPLUGIN_IDLSOURCES
NETGENPlugin_Algorithm.idl
NETGENPlugin_NETGEN_VERSION.idl
)
SET(_idl_include_dirs

View File

@ -1,4 +1,4 @@
// Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE
// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@ -28,7 +28,6 @@
#include "SALOME_Exception.idl"
#include "SMESH_Hypothesis.idl"
#include "SMESH_Group.idl"
#include "GEOM_Gen.idl"
/*!
@ -44,13 +43,6 @@ module NETGENPlugin
{
};
/*!
* NETGENPlugin_NETGEN_3D: interface of "Remote Tetrahedron (Netgen)" algorithm
*/
interface NETGENPlugin_NETGEN_3D_Remote : NETGENPlugin::NETGENPlugin_NETGEN_3D
{
};
/*!
* NETGENPlugin_NETGEN_2D: interface of "Netgen 1D-2D" algorithm
*/
@ -74,97 +66,50 @@ module NETGENPlugin
{
};
/*!
* NETGENPlugin_NETGEN_2D: interface of "Remote Triangle (Netgen)" algorithm
*/
interface NETGENPlugin_NETGEN_2D_Remote : NETGENPlugin::NETGENPlugin_NETGEN_2D_ONLY
{
};
/*!
* NETGENPlugin_Remesher_2D: interface of "NETGEN Remesher" algorithm,
* generating 2D elements basing on an existing 2D mesh
*/
interface NETGENPlugin_Remesher_2D : SMESH::SMESH_2D_Algo
{
};
/*!
* NETGENPlugin_Hypothesis: interface of "NETGEN parameters" hypothesis
*/
interface NETGENPlugin_Hypothesis : SMESH::SMESH_Hypothesis
{
void SetMaxSize(in double value);
double GetMaxSize();
void SetMaxSize(in double value);
double GetMaxSize();
void SetMinSize(in double value);
double GetMinSize();
void SetMinSize(in double value);
double GetMinSize();
void SetSecondOrder(in boolean value);
void SetSecondOrder(in boolean value);
boolean GetSecondOrder();
void SetOptimize(in boolean value);
void SetOptimize(in boolean value);
boolean GetOptimize();
void SetFineness(in long value);
long GetFineness();
void SetFineness(in long value);
long GetFineness();
void SetGrowthRate(in double value);
double GetGrowthRate();
void SetGrowthRate(in double value);
double GetGrowthRate();
void SetNbSegPerEdge(in double value);
double GetNbSegPerEdge();
void SetNbSegPerEdge(in double value);
double GetNbSegPerEdge();
void SetChordalErrorEnabled(in boolean value);
boolean GetChordalErrorEnabled();
void SetChordalError(in double value);
double GetChordalError();
void SetNbSegPerRadius(in double value);
double GetNbSegPerRadius();
void SetNbSegPerRadius(in double value);
double GetNbSegPerRadius();
void SetQuadAllowed(in boolean value);
void SetQuadAllowed(in boolean value);
boolean GetQuadAllowed();
void SetUseSurfaceCurvature(in boolean value);
void SetUseSurfaceCurvature(in boolean value);
boolean GetUseSurfaceCurvature();
void SetFuseEdges(in boolean value);
void SetFuseEdges(in boolean value);
boolean GetFuseEdges();
void SetLocalSizeOnShape(in GEOM::GEOM_Object GeomObj, in double localSize)
void SetLocalSizeOnShape(in GEOM::GEOM_Object GeomObj, in double localSize)
raises (SALOME::SALOME_Exception);
void SetLocalSizeOnEntry(in string entry, in double localSize);
double GetLocalSizeOnEntry(in string entry);
void SetLocalSizeOnEntry(in string entry, in double localSize);
double GetLocalSizeOnEntry(in string entry);
string_array GetLocalSizeEntries();
void UnsetLocalSizeOnEntry(in string entry);
void SetMeshSizeFile(in string fileName);
string GetMeshSizeFile();
void SetNbSurfOptSteps(in short nb );
short GetNbSurfOptSteps();
void SetNbVolOptSteps(in short nb );
short GetNbVolOptSteps();
void SetElemSizeWeight(in double size );
double GetElemSizeWeight();
void SetWorstElemMeasure(in short val );
short GetWorstElemMeasure();
void SetNbThreads(in short val );
short GetNbThreads();
void SetUseDelauney(in boolean toUse);
boolean GetUseDelauney();
void SetCheckOverlapping(in boolean toCheck );
boolean GetCheckOverlapping();
void SetCheckChartBoundary(in boolean toCheck );
boolean GetCheckChartBoundary();
void UnsetLocalSizeOnEntry(in string entry);
};
/*!
@ -175,7 +120,7 @@ module NETGENPlugin
};
/*!
* interface of "NETGEN 2D parameters" hypothesis used by NETGENPlugin_NETGEN_2D_ONLY algorithm
* interface of "NETGEN 2D parameters" hypothesis used by NETGENPlugin_NETGEN_2D_ONLY algoritm
*/
interface NETGENPlugin_Hypothesis_2D_ONLY : NETGENPlugin_Hypothesis_2D
{
@ -188,75 +133,6 @@ module NETGENPlugin
{
};
/*!
* interface of "NETGEN Remesher parameters" hypothesis used by NETGENPlugin_Remesher_2D algorithm
*/
interface NETGENPlugin_RemesherHypothesis_2D : NETGENPlugin_Hypothesis_2D
{
/*!
* \brief Set/get ridge angle
*/
void SetRidgeAngle(in double angle );
double GetRidgeAngle();
void SetEdgeCornerAngle(in double angle );
double GetEdgeCornerAngle();
void SetChartAngle(in double angle );
double GetChartAngle();
void SetOuterChartAngle(in double angle );
double GetOuterChartAngle();
void SetRestHChartDistFactor(in double f );
double GetRestHChartDistFactor();
void SetRestHChartDistEnable(in boolean enable );
boolean GetRestHChartDistEnable();
void SetRestHLineLengthFactor(in double f );
double GetRestHLineLengthFactor();
void SetRestHLineLengthEnable(in boolean enable );
boolean GetRestHLineLengthEnable();
void SetRestHCloseEdgeFactor(in double f );
double GetRestHCloseEdgeFactor();
void SetRestHCloseEdgeEnable(in boolean enable );
boolean GetRestHCloseEdgeEnable();
void SetRestHSurfCurvFactor(in double f );
double GetRestHSurfCurvFactor();
void SetRestHSurfCurvEnable(in boolean enable );
boolean GetRestHSurfCurvEnable();
void SetRestHEdgeAngleFactor(in double f );
double GetRestHEdgeAngleFactor();
void SetRestHEdgeAngleEnable(in boolean enable );
boolean GetRestHEdgeAngleEnable();
void SetRestHSurfMeshCurvFactor(in double f );
double GetRestHSurfMeshCurvFactor();
void SetRestHSurfMeshCurvEnable(in boolean enable );
boolean GetRestHSurfMeshCurvEnable();
void SetKeepExistingEdges(in boolean toKeep );
boolean GetKeepExistingEdges();
void SetMakeGroupsOfSurfaces(in boolean toMake );
boolean GetMakeGroupsOfSurfaces();
void SetLoadMeshOnCancel(in boolean toLoad );
boolean GetLoadMeshOnCancel();
void SetFixedEdgeGroup( in SMESH::SMESH_GroupBase edgeGroup );
SMESH::SMESH_GroupBase GetFixedEdgeGroup( in SMESH::SMESH_Mesh mesh );
};
/*!
* NETGENPlugin_Hypothesis: interface of "NETGEN 2D simple parameters" hypothesis
*/
@ -265,12 +141,12 @@ module NETGENPlugin
/*!
* Sets <number of segments> value
*/
void SetNumberOfSegments(in long nb) raises (SALOME::SALOME_Exception);
void SetNumberOfSegments(in short nb) raises (SALOME::SALOME_Exception);
/*!
* Returns <number of segments> value.
* Can be zero in case if LocalLength() has been set
*/
long GetNumberOfSegments();
short GetNumberOfSegments();
/*!
* Sets <segment length> value

View File

@ -1,26 +0,0 @@
// Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
module NETGENPlugin
{
const short NETGEN_VERSION_MAJOR = @NETGEN_VERSION_MAJOR@ ;
};

3
resources/CMakeLists.txt Normal file → Executable file
View File

@ -1,4 +1,4 @@
# Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE
# Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@ -41,4 +41,3 @@ SET(NETGENPLUGIN_RESOURCES_FILES
)
INSTALL(FILES ${NETGENPLUGIN_RESOURCES_FILES} DESTINATION ${SALOME_NETGENPLUGIN_INSTALL_RES_DATA})
INSTALL(FILES SalomeApp.xml RENAME SalomeAppSL.xml DESTINATION ${SALOME_NETGENPLUGIN_INSTALL_RES_DATA})

View File

@ -1,167 +1,167 @@
<?xml version='1.0' encoding='us-ascii'?>
<!DOCTYPE meshers PUBLIC "" "desktop.dtd">
<!--
Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-->
<!-- GUI customization for MESH component -->
<meshers>
<meshers-group name ="NETGEN"
resources ="NETGENPlugin"
<meshers-group name="NETGEN"
resources="NETGENPlugin"
idl-module="NETGENPlugin"
server-lib="NETGENEngine"
gui-lib ="NETGENPluginGUI">
gui-lib="NETGENPluginGUI">
<hypotheses>
<hypothesis type ="NETGEN_Parameters"
<hypothesis type="NETGEN_Parameters"
label-id="NETGEN 3D Parameters"
icon-id ="mesh_hypo_netgen.png"
dim ="3">
icon-id="mesh_hypo_netgen.png"
dim="3">
<python-wrap>
<accumulative-methods>
SetLocalSizeOnShape,
UnsetLocalSizeOnEntry
SetLocalSizeOnShape
</accumulative-methods>
</python-wrap>
</hypothesis>
<hypothesis type ="NETGEN_Parameters_2D"
<hypothesis type="NETGEN_Parameters_2D"
label-id="NETGEN 2D Parameters"
icon-id ="mesh_hypo_netgen_2d.png"
dim ="2">
icon-id="mesh_hypo_netgen_2d.png"
dim="2">
<python-wrap>
<accumulative-methods>
SetLocalSizeOnShape,
UnsetLocalSizeOnEntry
SetLocalSizeOnShape
</accumulative-methods>
</python-wrap>
</hypothesis>
<hypothesis type ="NETGEN_Parameters_3D"
<hypothesis type="NETGEN_Parameters_3D"
label-id="NETGEN 3D Parameters"
icon-id ="mesh_hypo_netgen.png"
dim ="3">
icon-id="mesh_hypo_netgen.png"
dim="3">
<python-wrap>
<accumulative-methods>
SetLocalSizeOnShape,
UnsetLocalSizeOnEntry
SetLocalSizeOnShape
</accumulative-methods>
</python-wrap>
</hypothesis>
<hypothesis type ="NETGEN_Parameters_2D_ONLY"
<hypothesis type="NETGEN_Parameters_2D_ONLY"
label-id="NETGEN 2D Parameters"
icon-id ="mesh_hypo_netgen_2d.png"
dim ="2">
icon-id="mesh_hypo_netgen_2d.png"
dim="2">
<python-wrap>
<accumulative-methods>
SetLocalSizeOnShape,
UnsetLocalSizeOnEntry
SetLocalSizeOnShape
</accumulative-methods>
</python-wrap>
</hypothesis>
<hypothesis type ="NETGEN_RemesherParameters_2D"
label-id="NETGEN 2D Parameters"
icon-id ="mesh_hypo_netgen_2d.png"
dim ="2"/>
<hypothesis type ="NETGEN_SimpleParameters_2D"
<hypothesis type="NETGEN_SimpleParameters_2D"
label-id="NETGEN 2D Simple Parameters"
icon-id ="mesh_hypo_netgen_2d.png"
dim ="2"/>
<hypothesis type ="NETGEN_SimpleParameters_3D"
icon-id="mesh_hypo_netgen_2d.png"
dim="2"/>
<hypothesis type="NETGEN_SimpleParameters_3D"
label-id="NETGEN 3D Simple Parameters"
icon-id ="mesh_hypo_netgen.png"
dim ="3"/>
icon-id="mesh_hypo_netgen.png"
dim="3"/>
</hypotheses>
<algorithms>
<algorithm type ="NETGEN_3D"
label-id ="NETGEN 3D"
icon-id ="mesh_algo_tetra.png"
group-id ="1"
priority ="20"
hypos ="MaxElementVolume,NETGEN_Parameters_3D"
<algorithm type="NETGEN_3D"
label-id="Tetrahedron (Netgen)"
icon-id="mesh_algo_tetra.png"
hypos="MaxElementVolume,NETGEN_Parameters_3D"
opt-hypos="ViscousLayers"
need-geom="false"
input ="TRIA,QUAD"
output ="TETRA,PYRAMID"
dim ="3">
input="TRIA,QUAD"
output="TETRA,PYRAMID"
dim="3">
<python-wrap>
<algo>NETGEN_3D=Tetrahedron()</algo>
<hypo>MaxElementVolume=MaxElementVolume(SetMaxElementVolume())</hypo>
<hypo>NETGEN_Parameters_3D=Parameters()</hypo>
<hypo>ViscousLayers=ViscousLayers(SetTotalThickness(),SetNumberLayers(),SetStretchFactor(),SetFaces(1),SetFaces(2),SetMethod(),SetGroupName())</hypo>
<hypo>ViscousLayers=ViscousLayers(SetTotalThickness(),SetNumberLayers(),SetStretchFactor(),SetFaces(1),SetFaces(2),SetMethod())</hypo>
</python-wrap>
</algorithm>
<algorithm type ="NETGEN_2D_ONLY"
label-id ="NETGEN 2D"
icon-id ="mesh_algo_netgen_2d.png"
group-id ="1"
priority ="20"
hypos ="LengthFromEdges,MaxElementArea,NETGEN_Parameters_2D_ONLY"
<algorithm type="NETGEN_2D_ONLY"
label-id="Netgen 2D"
icon-id="mesh_algo_netgen_2d.png"
hypos="LengthFromEdges,MaxElementArea,NETGEN_Parameters_2D_ONLY"
opt-hypos="QuadranglePreference,ViscousLayers2D"
input ="EDGE"
output ="TRIA,QUAD"
dim ="2">
input="EDGE"
output="TRIA,QUAD"
dim="2">
<python-wrap>
<algo>NETGEN_2D_ONLY=Triangle(algo=smeshBuilder.NETGEN_2D)</algo>
<hypo>LengthFromEdges=LengthFromEdges()</hypo>
<hypo>MaxElementArea=MaxElementArea(SetMaxElementArea())</hypo>
<hypo>NETGEN_Parameters_2D_ONLY=Parameters()</hypo>
<hypo>QuadranglePreference=SetQuadAllowed()</hypo>
<hypo>ViscousLayers2D=ViscousLayers2D(SetTotalThickness(),SetNumberLayers(),SetStretchFactor(),SetEdges(1),SetEdges(2),SetGroupName())</hypo>
<hypo>ViscousLayers2D=ViscousLayers2D(SetTotalThickness(),SetNumberLayers(),SetStretchFactor(),SetIgnoreEdges())</hypo>
</python-wrap>
</algorithm>
<algorithm type ="NETGEN_2D"
label-id ="NETGEN 1D-2D"
icon-id ="mesh_algo_netgen_2d.png"
group-id ="1"
priority ="10"
hypos ="NETGEN_Parameters_2D, NETGEN_SimpleParameters_2D"
opt-hypos ="ViscousLayers2D"
output ="TRIA,QUAD"
dim ="2"
<algorithm type="NETGEN_2D"
label-id="Netgen 1D-2D"
icon-id="mesh_algo_netgen_2d.png"
hypos="NETGEN_Parameters_2D, NETGEN_SimpleParameters_2D"
opt-hypos="ViscousLayers2D"
output="TRIA,QUAD"
dim="2"
support-submeshes="true">
<python-wrap>
<algo>NETGEN_2D=Triangle(algo=smeshBuilder.NETGEN_1D2D)</algo>
<hypo>NETGEN_Parameters_2D=Parameters()</hypo>
<hypo>NETGEN_SimpleParameters_2D=Parameters(smeshBuilder.SIMPLE)</hypo>
<hypo>ViscousLayers2D=ViscousLayers2D(SetTotalThickness(),SetNumberLayers(),SetStretchFactor(),SetEdges(1),SetEdges(2),SetGroupName())</hypo>
<hypo>ViscousLayers2D=ViscousLayers2D(SetTotalThickness(),SetNumberLayers(),SetStretchFactor(),SetIgnoreEdges())</hypo>
</python-wrap>
</algorithm>
<algorithm type ="NETGEN_2D3D"
label-id ="NETGEN 1D-2D-3D"
icon-id ="mesh_algo_netgen_2d3d.png"
group-id ="1"
priority ="10"
hypos ="NETGEN_Parameters, NETGEN_SimpleParameters_3D"
opt-hypos ="ViscousLayers"
output ="TETRA,PYRAMID"
dim ="3"
<algorithm type="NETGEN_2D3D"
label-id="Netgen 1D-2D-3D"
icon-id="mesh_algo_netgen_2d3d.png"
hypos="NETGEN_Parameters, NETGEN_SimpleParameters_3D"
output="TETRA,PYRAMID"
dim="3"
support-submeshes="true">
<python-wrap>
<algo>NETGEN_2D3D=Tetrahedron(algo=smeshBuilder.NETGEN_1D2D3D)</algo>
<hypo>NETGEN_Parameters=Parameters()</hypo>
<hypo>NETGEN_SimpleParameters_3D=Parameters(smeshBuilder.SIMPLE)</hypo>
<hypo>ViscousLayers=ViscousLayers(SetTotalThickness(),SetNumberLayers(),SetStretchFactor(),SetFaces(1),SetFaces(2),SetMethod(),SetGroupName())</hypo>
</python-wrap>
</algorithm>
<algorithm type ="NETGEN_Remesher_2D"
label-id ="NETGEN 2D"
icon-id ="mesh_algo_netgen_2d.png"
opt-hypos ="NETGEN_RemesherParameters_2D"
output ="TRIA,QUAD"
need-geom ="never"
dim ="2">
<python-wrap>
<algo>NETGEN_Remesher_2D=Triangle(algo=smeshBuilder.NETGEN)</algo>
<hypo>NETGEN_RemesherParameters_2D=Parameters()</hypo>
</python-wrap>
</algorithm>
</algorithms>
</meshers-group>
<hypotheses-set-group>
<hypotheses-set name="Automatic Tetrahedralization"
hypos="NETGEN_Parameters"
algos="NETGEN_2D3D"/>
<hypotheses-set name="Automatic Triangulation"
hypos="NETGEN_Parameters_2D"
algos="NETGEN_2D"/>
</hypotheses-set-group>
</meshers>

View File

@ -1,8 +1,35 @@
<!--
Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-->
<document>
<section name="resources">
<parameter name="NETGENPlugin" value="${NETGENPLUGIN_ROOT_DIR}/share/salome/resources/netgenplugin"/>
</section>
<section name="SMESH">
<!-- Default SMESH module plugins -->
<parameter name="plugins" value="NETGENPlugin,GHS3DPlugin"/>
</section>
<section name="smesh_help">
<parameter name="User's Guide/Mesh module/Plug-ins/NETGEN plugin" value="${NETGENPLUGIN_ROOT_DIR}/share/doc/salome/gui/NETGENPLUGIN/index.html;;http://docs.salome-platform.org/latest/gui/NETGENPLUGIN/index.html"/>
<parameter name="Plug-ins/NETGEN plugin User's Guide" value="${NETGENPLUGIN_ROOT_DIR}/share/doc/salome/gui/NETGENPLUGIN/index.html"/>
</section>
</document>

0
resources/mesh_tree_algo_netgen_2d.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 225 B

After

Width:  |  Height:  |  Size: 225 B

2
src/CMakeLists.txt Normal file → Executable file
View File

@ -1,4 +1,4 @@
# Copyright (C) 2012-2024 CEA, EDF, OPEN CASCADE
# Copyright (C) 2012-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public

View File

@ -1,4 +1,4 @@
# Copyright (C) 2012-2024 CEA, EDF, OPEN CASCADE
# Copyright (C) 2012-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@ -17,12 +17,12 @@
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
INCLUDE(UseQtExt)
INCLUDE(UseQt4Ext)
# --- options ---
# additional include directories
INCLUDE_DIRECTORIES(
${OpenCASCADE_INCLUDE_DIR}
${CAS_INCLUDE_DIRS}
${NETGEN_INCLUDE_DIRS}
${QT_INCLUDES}
${PYTHON_INCLUDES}
@ -40,7 +40,7 @@ INCLUDE_DIRECTORIES(
ADD_DEFINITIONS(
${QT_DEFINITIONS}
${OMNIORB_DEFINITIONS}
${OpenCASCADE_DEFINITIONS}
${CAS_DEFINITIONS}
${BOOST_DEFINITIONS}
)
@ -53,8 +53,8 @@ SET(_link_LIBRARIES
${GUI_SalomeObject}
${GUI_LightApp}
${SMESH_SMESH}
${SMESH_PluginUtils}
${OpenCASCADE_FoundationClasses_LIBRARIES}
${SMESH_GeomSelectionTools}
${CAS_KERNEL}
SalomeIDLNETGENPLUGIN
NETGENEngine
)
@ -77,7 +77,7 @@ SET(NETGENPluginGUI_HEADERS ${_moc_HEADERS} ${_other_HEADERS})
# --- sources ---
# sources / moc wrappings
QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS})
QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS})
# sources / static
SET(_other_SOURCES
@ -107,4 +107,4 @@ INSTALL(TARGETS NETGENPluginGUI EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${
INSTALL(FILES ${NETGENPluginGUI_HEADERS} DESTINATION ${SALOME_INSTALL_HEADERS})
QT_INSTALL_TS_RESOURCES("${_ts_RESOURCES}" "${SALOME_NETGENPLUGIN_INSTALL_RES_DATA}")
QT4_INSTALL_TS_RESOURCES("${_ts_RESOURCES}" "${SALOME_NETGENPLUGIN_INSTALL_RES_DATA}")

11
src/GUI/NETGENPluginGUI.cxx Normal file → Executable file
View File

@ -1,4 +1,4 @@
// Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE
// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@ -41,11 +41,10 @@ extern "C"
SMESHGUI_GenericHypothesisCreator* GetHypothesisCreator( const QString& aHypType )
{
SMESHGUI_GenericHypothesisCreator* aCreator = NULL;
if( aHypType=="NETGEN_Parameters_2D" || // 1D-2D
aHypType=="NETGEN_Parameters" || // 1D-2D-3D
aHypType=="NETGEN_Parameters_2D_ONLY" || // 2D
aHypType=="NETGEN_Parameters_3D" || // 3D
aHypType=="NETGEN_RemesherParameters_2D" ) // 2D
if( aHypType=="NETGEN_Parameters_2D" || // 1D-2D
aHypType=="NETGEN_Parameters" || // 1D-2D-3D
aHypType=="NETGEN_Parameters_2D_ONLY" || // 2D
aHypType=="NETGEN_Parameters_3D" ) // 3D
{
aCreator = new NETGENPluginGUI_HypothesisCreator( aHypType );
}

2
src/GUI/NETGENPluginGUI.h Normal file → Executable file
View File

@ -1,4 +1,4 @@
// Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE
// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
// Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE
// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@ -35,21 +35,20 @@
#include <TopAbs_ShapeEnum.hxx>
class SMESHGUI_SpinBox;
class GeomSelectionTools;
class QCheckBox;
class QComboBox;
class QCheckBox;
class QLineEdit;
class QTableWidget;
class SMESHGUI_SpinBox;
class SalomeApp_IntSpinBox;
typedef struct
{
double myMaxSize, myMinSize, myGrowthRate, myNbSegPerEdge, myNbSegPerRadius, myRidgeAngle, myChordalError, myElemSizeWeight, myEdgeCornerAngle, myChartAngle, myOuterChartAngle, myRestHChartDistFactor, myRestHLineLengthFactor, myRestHCloseEdgeFactor, myRestHSurfCurvFactor, myRestHEdgeAngleFactor, myRestHSurfMeshCurvFactor;
int myFineness, myNbSurfOptSteps, myNbVolOptSteps, myWorstElemMeasure;
bool mySecondOrder, myAllowQuadrangles, myOptimize, mySurfaceCurvature, myFuseEdges, myChordalErrorEnabled, myUseDelauney, myCheckOverlapping, myCheckChartBoundary, myRestHChartDistEnable, myRestHLineLengthEnable, myRestHCloseEdgeEnable, myRestHSurfCurvEnable, myRestHEdgeAngleEnable, myRestHSurfMeshCurvEnable, myKeepExistingEdges, myMakeGroupsOfSurfaces;
QString myName, myMeshSizeFile;
QString myMaxSizeVar, myMinSizeVar, myGrowthRateVar, myNbSegPerEdgeVar, myNbSegPerRadiusVar, myRidgeAngleVar, myChordalErrorVar, myNbSurfOptStepsVar, myNbVolOptStepsVar, myElemSizeWeightVar, myWorstElemMeasureVar, myEdgeCornerAngleVar, myChartAngleVar, myOuterChartAngleVar, myRestHChartDistFactorVar, myRestHLineLengthFactorVar, myRestHCloseEdgeFactorVar, myRestHSurfCurvFactorVar, myRestHEdgeAngleFactorVar, myRestHSurfMeshCurvFactorVar;
double myMaxSize, myMinSize, myGrowthRate, myNbSegPerEdge, myNbSegPerRadius;
int myFineness;
bool mySecondOrder, myAllowQuadrangles, myOptimize, mySurfaceCurvature, myFuseEdges;
QString myName;
QString myMaxSizeVar, myMinSizeVar, myGrowthRateVar, myNbSegPerEdgeVar, myNbSegPerRadiusVar;
} NetgenHypothesisData;
/*!
@ -63,7 +62,7 @@ public:
NETGENPluginGUI_HypothesisCreator( const QString& );
virtual ~NETGENPluginGUI_HypothesisCreator();
virtual bool checkParams(QString&) const;
virtual bool checkParams(QString& msg) const;
virtual QString helpPage() const;
protected:
@ -77,16 +76,12 @@ protected:
protected slots:
virtual void onFinenessChanged();
virtual void onChordalErrorEnabled();
virtual void onSurfaceCurvatureChanged();
virtual void onAddLocalSizeOnVertex();
virtual void onAddLocalSizeOnEdge();
virtual void onAddLocalSizeOnFace();
virtual void onAddLocalSizeOnSolid();
virtual void onRemoveLocalSizeOnShape();
virtual void onSetLocalSize(int,int);
virtual void onSetSizeFile();
virtual void onSTLEnable();
private:
bool readParamsFromHypo( NetgenHypothesisData& ) const;
@ -96,57 +91,24 @@ private:
void addLocalSizeOnShape(TopAbs_ShapeEnum);
private:
QLineEdit* myName;
SMESHGUI_SpinBox* myMaxSize;
SMESHGUI_SpinBox* myMinSize;
QCheckBox* mySecondOrder;
QCheckBox* myOptimize;
QComboBox* myFineness;
SMESHGUI_SpinBox* myGrowthRate;
SMESHGUI_SpinBox* myNbSegPerEdge;
SMESHGUI_SpinBox* myNbSegPerRadius;
QCheckBox* myChordalErrorEnabled;
SMESHGUI_SpinBox* myChordalError;
QCheckBox* myAllowQuadrangles;
QCheckBox* mySurfaceCurvature;
// optimizer
SMESHGUI_SpinBox* myElemSizeWeight;
SalomeApp_IntSpinBox* myNbSurfOptSteps;
SalomeApp_IntSpinBox* myNbVolOptSteps;
// insider
QCheckBox* myFuseEdges;
SalomeApp_IntSpinBox* myWorstElemMeasure;
QCheckBox* myUseDelauney;
QCheckBox* myCheckOverlapping;
QCheckBox* myCheckChartBoundary;
// stl options
QCheckBox* myKeepExistingEdges;
QCheckBox* myMakeGroupsOfSurfaces;
// stl charts
SMESHGUI_SpinBox* myRidgeAngle;
SMESHGUI_SpinBox* myEdgeCornerAngle;
SMESHGUI_SpinBox* myChartAngle;
SMESHGUI_SpinBox* myOuterChartAngle;
// stl size
SMESHGUI_SpinBox* myRestHChartDistFactor;
SMESHGUI_SpinBox* myRestHLineLengthFactor;
SMESHGUI_SpinBox* myRestHCloseEdgeFactor;
SMESHGUI_SpinBox* myRestHSurfCurvFactor;
SMESHGUI_SpinBox* myRestHEdgeAngleFactor;
SMESHGUI_SpinBox* myRestHSurfMeshCurvFactor;
QCheckBox* myRestHChartDistEnable;
QCheckBox* myRestHLineLengthEnable;
QCheckBox* myRestHCloseEdgeEnable;
QCheckBox* myRestHSurfCurvEnable;
QCheckBox* myRestHEdgeAngleEnable;
QCheckBox* myRestHSurfMeshCurvEnable;
QLineEdit* myName;
SMESHGUI_SpinBox* myMaxSize;
SMESHGUI_SpinBox* myMinSize;
QCheckBox* mySecondOrder;
QCheckBox* myOptimize;
QComboBox* myFineness;
SMESHGUI_SpinBox* myGrowthRate;
SMESHGUI_SpinBox* myNbSegPerEdge;
SMESHGUI_SpinBox* myNbSegPerRadius;
QCheckBox* myAllowQuadrangles;
QCheckBox* mySurfaceCurvature;
QCheckBox* myFuseEdges;
bool myIs2D; // 2D or 3D
bool myIsONLY; // one dim or several
bool myIs2D;
bool myIsONLY;
QLineEdit* myMeshSizeFile;
QTableWidget* myLocalSizeTable;
GeomSelectionTools* myGeomSelectionTools;
QTableWidget* myLocalSizeTable;
GeomSelectionTools* myGeomSelectionTools;
QMap<QString, QString> myLocalSizeMap;
};

View File

@ -1,4 +1,4 @@
// Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE
// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public

View File

@ -1,4 +1,4 @@
// Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE
// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public

View File

@ -47,10 +47,6 @@
<source>ICON_SMESH_TREE_HYPO_NETGEN_Parameters_2D</source>
<translation>mesh_tree_hypo_netgen_2d.png</translation>
</message>
<message>
<source>ICON_SMESH_TREE_HYPO_NETGEN_RemesherParameters_2D</source>
<translation>mesh_tree_hypo_netgen_2d.png</translation>
</message>
<message>
<source>ICON_SMESH_TREE_HYPO_NETGEN_Parameters_2D_ONLY</source>
<translation>mesh_tree_hypo_netgen_2d.png</translation>

View File

@ -5,7 +5,7 @@
<name>@default</name>
<message>
<source>NETGEN_2D_HYPOTHESIS</source>
<translation>NETGEN 2D</translation>
<translation>Netgen 2D</translation>
</message>
<message>
<source>NETGEN_2D_TITLE</source>
@ -13,7 +13,7 @@
</message>
<message>
<source>NETGEN_3D_HYPOTHESIS</source>
<translation>NETGEN 3D</translation>
<translation>Netgen 3D</translation>
</message>
<message>
<source>NETGEN_3D_TITLE</source>
@ -21,7 +21,7 @@
</message>
<message>
<source>NETGEN_SimpleParameters_3D_HYPOTHESIS</source>
<translation>NETGEN 3D simple parameters</translation>
<translation>Netgen 3D simple parameters</translation>
</message>
<message>
<source>NETGEN_SimpleParameters_3D_TITLE</source>
@ -29,7 +29,7 @@
</message>
<message>
<source>NETGEN_SimpleParameters_2D_HYPOTHESIS</source>
<translation>NETGEN 2D simple parameters</translation>
<translation>Netgen 2D simple parameters</translation>
</message>
<message>
<source>NETGEN_SimpleParameters_2D_TITLE</source>
@ -37,7 +37,7 @@
</message>
<message>
<source>NETGEN_ALLOW_QUADRANGLES</source>
<translation>Quad-dominated</translation>
<translation>Allow Quadrangles</translation>
</message>
<message>
<source>NETGEN_COARSE</source>
@ -57,19 +57,19 @@
</message>
<message>
<source>NETGEN_FUSE_EDGES</source>
<translation>Fuse coincident nodes on edges and vertices</translation>
<translation>Fuse Coincident Nodes on Edges and Vertices</translation>
</message>
<message>
<source>NETGEN_GROWTH_RATE</source>
<translation>Growth rate</translation>
<translation>Growth Rate</translation>
</message>
<message>
<source>NETGEN_MAX_SIZE</source>
<translation>Max. size</translation>
<translation>Max. Size</translation>
</message>
<message>
<source>NETGEN_MIN_SIZE</source>
<translation>Min. size</translation>
<translation>Min. Size</translation>
</message>
<message>
<source>NETGEN_MODERATE</source>
@ -79,49 +79,29 @@
<source>NETGEN_OPTIMIZE</source>
<translation>Optimize</translation>
</message>
<message>
<source>NETGEN_OPTIMIZER</source>
<translation>Optimizer</translation>
</message>
<message>
<source>NETGEN_SECOND_ORDER</source>
<translation>Second order</translation>
<translation>Second Order</translation>
</message>
<message>
<source>NETGEN_SEG_PER_EDGE</source>
<translation>Nb. segs per edge</translation>
<translation>Nb. Segs per Edge</translation>
</message>
<message>
<source>NETGEN_SEG_PER_RADIUS</source>
<translation>Nb. segs per radius</translation>
</message>
<message>
<source>NETGEN_CHORDAL_ERROR</source>
<translation>Chordal error</translation>
</message>
<message>
<source>NETGEN_RIDGE_ANGLE</source>
<translation>Ridge angle</translation>
</message>
<message>
<source>NETGEN_KEEP_EXISTING_EDGES</source>
<translation>Keep existing edges</translation>
</message>
<message>
<source>NETGEN_MAKE_SURFACE_GROUPS</source>
<translation>Create groups of surfaces</translation>
<translation>Nb. Segs per Radius</translation>
</message>
<message>
<source>NETGEN_SURFACE_CURVATURE</source>
<translation>Limit size by surface curvature</translation>
<translation>Limit Size by Surface Curvature</translation>
</message>
<message>
<source>NETGEN_VERYCOARSE</source>
<translation>Very coarse</translation>
<translation>Very Coarse</translation>
</message>
<message>
<source>NETGEN_VERYFINE</source>
<translation>Very fine</translation>
<translation>Very Fine</translation>
</message>
<message>
<source>NG_1D</source>
@ -149,19 +129,15 @@
</message>
<message>
<source>NETGEN_LSZ_VERTEX</source>
<translation>On vertex</translation>
<translation>On Vertex</translation>
</message>
<message>
<source>NETGEN_LSZ_EDGE</source>
<translation>On edge</translation>
<translation>On Edge</translation>
</message>
<message>
<source>NETGEN_LSZ_FACE</source>
<translation>On face</translation>
</message>
<message>
<source>NETGEN_LSZ_SOLID</source>
<translation>On solid</translation>
<translation>On Sub-Face</translation>
</message>
<message>
<source>NETGEN_LSZ_REMOVE</source>
@ -179,93 +155,5 @@
<source>LSZ_LOCALSIZE_COLUMN</source>
<translation>Value</translation>
</message>
<message>
<source>NETGEN_LSZ_FILE</source>
<translation>Mesh-size file</translation>
</message>
<message>
<source>NETGEN_MESH_SIZE</source>
<translation>Mesh size</translation>
</message>
<message>
<source>NETGEN_INSIDER</source>
<translation>Insider</translation>
</message>
<message>
<source>NETGEN_WORST_ELEM_MEASURE</source>
<translation>Worst element measure</translation>
</message>
<message>
<source>NETGEN_USE_DELAUNEY</source>
<translation>Use Delaunay</translation>
</message>
<message>
<source>NETGEN_CHECK_OVERLAPPING</source>
<translation>Check overlapping</translation>
</message>
<message>
<source>NETGEN_CHECK_CHART_BOUNDARY</source>
<translation>Check chart boundary</translation>
</message>
<message>
<source>NETGEN_ELEM_SIZE_WEIGHT</source>
<translation>Element size weight</translation>
</message>
<message>
<source>NETGEN_NB_SURF_OPT_STEPS</source>
<translation>Nb. surface optimization steps</translation>
</message>
<message>
<source>NETGEN_NB_VOL_OPT_STEPS</source>
<translation>Nb. volume optimization steps</translation>
</message>
<message>
<source>NETGEN_STL</source>
<translation>STL</translation>
</message>
<message>
<source>NETGEN_STL_CHARTS</source>
<translation>Charts</translation>
</message>
<message>
<source>NETGEN_STL_SIZE</source>
<translation>Mesh size depends on... (enable and factor)</translation>
</message>
<message>
<source>NETGEN_EDGE_CORNER_ANGLE</source>
<translation>Edge corner angle</translation>
</message>
<message>
<source>NETGEN_CHART_ANGLE</source>
<translation>Chart angle</translation>
</message>
<message>
<source>NETGEN_OUTER_CHART_ANGLE</source>
<translation>Outer chart angle</translation>
</message>
<message>
<source>NETGEN_RESTH_CHART_DIST</source>
<translation>Chart distance</translation>
</message>
<message>
<source>NETGEN_RESTH_LINE_LENGTH</source>
<translation>Line length</translation>
</message>
<message>
<source>NETGEN_RESTH_CLOSE_EDGE</source>
<translation>Close edges</translation>
</message>
<message>
<source>NETGEN_RESTH_SURF_CURV</source>
<translation>Surface curvature</translation>
</message>
<message>
<source>NETGEN_RESTH_EDGE_ANGLE</source>
<translation>Edge angle</translation>
</message>
<message>
<source>NETGEN_RESTH_SURF_MESH_CURV</source>
<translation>Surface mesh curvature</translation>
</message>
</context>
</TS>

122
src/GUI/NETGENPlugin_msg_fr.ts Normal file → Executable file
View File

@ -5,7 +5,7 @@
<name>@default</name>
<message>
<source>NETGEN_2D_HYPOTHESIS</source>
<translation>NETGEN 2D</translation>
<translation>Netgen 2D</translation>
</message>
<message>
<source>NETGEN_2D_TITLE</source>
@ -13,7 +13,7 @@
</message>
<message>
<source>NETGEN_3D_HYPOTHESIS</source>
<translation>NETGEN 3D</translation>
<translation>Netgen 3D</translation>
</message>
<message>
<source>NETGEN_3D_TITLE</source>
@ -21,7 +21,7 @@
</message>
<message>
<source>NETGEN_SimpleParameters_3D_HYPOTHESIS</source>
<translation>NETGEN 3D paramètres simplifiés</translation>
<translation>Netgen 3D paramètres simplifiés</translation>
</message>
<message>
<source>NETGEN_SimpleParameters_3D_TITLE</source>
@ -29,7 +29,7 @@
</message>
<message>
<source>NETGEN_SimpleParameters_2D_HYPOTHESIS</source>
<translation>NETGEN 2D paramètres simplifiés</translation>
<translation>Netgen 2D paramètres simplifiés</translation>
</message>
<message>
<source>NETGEN_SimpleParameters_2D_TITLE</source>
@ -79,10 +79,6 @@
<source>NETGEN_OPTIMIZE</source>
<translation>Optimiser</translation>
</message>
<message>
<source>NETGEN_OPTIMIZER</source>
<translation>Optimiseur</translation>
</message>
<message>
<source>NETGEN_SECOND_ORDER</source>
<translation>Second ordre</translation>
@ -95,22 +91,6 @@
<source>NETGEN_SEG_PER_RADIUS</source>
<translation>Nb. segments par rayon</translation>
</message>
<message>
<source>NETGEN_CHORDAL_ERROR</source>
<translation>Erreur de corde</translation>
</message>
<message>
<source>NETGEN_RIDGE_ANGLE</source>
<translation>Angle de rive</translation>
</message>
<message>
<source>NETGEN_KEEP_EXISTING_EDGES</source>
<translation>Garder les arêtes existantes</translation>
</message>
<message>
<source>NETGEN_MAKE_SURFACE_GROUPS</source>
<translation>Create groups of surfaces</translation>
</message>
<message>
<source>NETGEN_SURFACE_CURVATURE</source>
<translation>Adapter la taille à la courbure de la surface</translation>
@ -157,11 +137,7 @@
</message>
<message>
<source>NETGEN_LSZ_FACE</source>
<translation>Sur une face</translation>
</message>
<message>
<source>NETGEN_LSZ_SOLID</source>
<translation>Sur un solide</translation>
<translation>Sur une sous-face</translation>
</message>
<message>
<source>NETGEN_LSZ_REMOVE</source>
@ -179,93 +155,5 @@
<source>LSZ_LOCALSIZE_COLUMN</source>
<translation>Valeur</translation>
</message>
<message>
<source>NETGEN_LSZ_FILE</source>
<translation>Fichier des tailles locales</translation>
</message>
<message>
<source>NETGEN_MESH_SIZE</source>
<translation>Taille de maille</translation>
</message>
<message>
<source>NETGEN_INSIDER</source>
<translation>Insider</translation>
</message>
<message>
<source>NETGEN_WORST_ELEM_MEASURE</source>
<translation>Mesure du pire élément</translation>
</message>
<message>
<source>NETGEN_USE_DELAUNEY</source>
<translation>Utiliser Delaunay</translation>
</message>
<message>
<source>NETGEN_CHECK_OVERLAPPING</source>
<translation>Contrôle de la superposition</translation>
</message>
<message>
<source>NETGEN_CHECK_CHART_BOUNDARY</source>
<translation>Contrôle de la frontière</translation>
</message>
<message>
<source>NETGEN_ELEM_SIZE_WEIGHT</source>
<translation>Poids de la taille de maille</translation>
</message>
<message>
<source>NETGEN_NB_SURF_OPT_STEPS</source>
<translation>Nb. de pas d'optimisation de la surface</translation>
</message>
<message>
<source>NETGEN_NB_VOL_OPT_STEPS</source>
<translation>Nb. de pas d'optimisation du volume</translation>
</message>
<message>
<source>NETGEN_STL</source>
<translation>STL</translation>
</message>
<message>
<source>NETGEN_STL_CHARTS</source>
<translation>Charts</translation>
</message>
<message>
<source>NETGEN_STL_SIZE</source>
<translation>Taille de maille dépend de... (activation et valeur)</translation>
</message>
<message>
<source>NETGEN_EDGE_CORNER_ANGLE</source>
<translation>Angle du coin d'arêtes</translation>
</message>
<message>
<source>NETGEN_CHART_ANGLE</source>
<translation>Chart angle</translation>
</message>
<message>
<source>NETGEN_OUTER_CHART_ANGLE</source>
<translation>Outer chart angle</translation>
</message>
<message>
<source>NETGEN_RESTH_CHART_DIST</source>
<translation>Chart distance</translation>
</message>
<message>
<source>NETGEN_RESTH_LINE_LENGTH</source>
<translation>Longuer de la ligne</translation>
</message>
<message>
<source>NETGEN_RESTH_CLOSE_EDGE</source>
<translation>Fermer les arêtes</translation>
</message>
<message>
<source>NETGEN_RESTH_SURF_CURV</source>
<translation>Courbure de la surface</translation>
</message>
<message>
<source>NETGEN_RESTH_EDGE_ANGLE</source>
<translation>Angle d'arête</translation>
</message>
<message>
<source>NETGEN_RESTH_SURF_MESH_CURV</source>
<translation>Courbure du maillage de la surface</translation>
</message>
</context>
</TS>

View File

@ -139,10 +139,6 @@
<source>NETGEN_LSZ_FACE</source>
<translation></translation>
</message>
<message>
<source>NETGEN_LSZ_SOLID</source>
<translation></translation>
</message>
<message>
<source>NETGEN_LSZ_REMOVE</source>
<translation></translation>
@ -159,9 +155,5 @@
<source>LSZ_LOCALSIZE_COLUMN</source>
<translation></translation>
</message>
<message>
<source>NETGEN_LSZ_FILE</source>
<translation></translation>
</message>
</context>
</TS>

View File

@ -1,63 +1,48 @@
# ------------------------------------------------------------------
# Notes about usage of Netgen with SALOME
# ------------------------------------------------------------------
# Notes for Netgen >= 4.9.13
# ------------------------------------------------------------------
# ------------------------------------------------------------------
-------------------
1. Netgen home page
-------------------
Netgen home page: http://sourceforge.net/apps/mediawiki/netgen-mesher.
Netgen mesher's home page is: https://sourceforge.net/projects/netgen-mesher/.
1. Minimal requirements
-----------------------
2. Minimal requirements
-----------------------
Minimal version of Netgen required for SALOME is 4.9.13.
Minimal version of Netgen required for SALOME is 5.3.1.
2. How to build Netgen for SALOME NETGEN Plugin
-----------------------------------------
----------------------------------------
3. Build Netgen for SALOME NETGEN Plugin
----------------------------------------
2.1. Download Netgen archive (here netgen-4.9.13.tar.gz) and unpack it
3.1. Download Netgen archive (here netgen-5.3.1.tar.gz) from the project's site:
2.2. Patch the Netgen distribution for SALOME
$ wget https://vorboss.dl.sourceforge.net/project/netgen-mesher/netgen-mesher/5.3/netgen-5.3.1.tar.gz
$ cd netgen45
$ patch -p1 < patch_directory/netgen49ForSalome.patch
3.2. Unpack an archive:
Note that patch corresponds to the version of Netgen you use.
For example, netgen49ForSalome.patch mentioned above is a patch
file for Netgen 4.9.13. The patch for Netgen can be found in
NETGENPLUGIN_SRC/src/NETGEN directory.
$ tar xfz netgen-5.3.1.tar.gz
2.3. Configure the netgen compilation. For example
3.3. Patch the Netgen distribution for SALOME
$ cd netgen-5.3.1
$ patch -p1 < /path/to/netgenplugin_src_dir/src/NETGEN/netgen53ForSalome.patch
Here, "/path/to/netgenplugin_src_dir" is a path to NETGENPLUGIN source directory.
This is the same directory where this Readme file is located.
Netgen plugin sources can be retrieved from the Git repository:
$ git clone http://git.salome-platform.org/gitpub/plugins/netgenplugin.git
3.4. Configure the netgen compilation:
$ cd netgen-5.3.1
$ ./configure --prefix=/path/to/the/installation/directory \
--with-occ=${CAS_ROOT_DIR} \
$ cd netgen-4.9.13
$ ./configure --prefix=THE_INSTALLATION_PATH \
--with-occ=${CASROOT} \
--with-tcl=${TCLHOME}/lib --with-tk=${TCLHOME}/lib \
--with-tclinclude=${TCLHOME}/include
Note: Netgen depends on some products like Open CASCADE Technology and Tcl/Tk.
These products should be specified to the configure script via options.
Note that Netgen depends on some products like Open CASCADE
Technology and Tcl/Tk. These products should be specified
to the configure script via options.
3.5. Compile and install netgen mesher:
2.4. Compile the netgen product
$ make
$ make install
$ make install
3.6. Patch the installation directory by copying header files
needed by NETGEN Plugin. For this purpose you can use the script
/path/to/netgenplugin_src_dir/src/NETGEN/netgen_copy_include_for_salome.
$ /path/to/netgenplugin_src_dir/src/NETGEN/netgen_copy_include_for_salome \
. /path/to/the/installation/directory
The first argument is the directory containing the Netgen sources.
The second argument is the installation directory of Netgen mesher.
2.5. Patch the installation directory by copying include files
needed by NETGEN Plugin. Use the script
NETGENPLUGIN_SRC/src/NETGEN/netgen_copy_include_for_salome
to achieve that. The first argument is the directory containing
the Netgen sources. The second argument is THE_INSTALLATION_PATH

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,897 @@
diff -Naur --exclude=CVS netgen-5.0.0.orig/libsrc/meshing/meshtype.cpp netgen-5.0.0.patched/libsrc/meshing/meshtype.cpp
--- netgen-5.0.0.orig/libsrc/meshing/meshtype.cpp 2012-11-09 19:15:04.000000000 +0400
+++ netgen-5.0.0.patched/libsrc/meshing/meshtype.cpp 2013-02-21 17:46:13.000000000 +0400
@@ -1,4 +1,5 @@
#include <mystdlib.h>
+#include <float.h> // to get DBL_MIN defined
#include "meshing.hpp"
@@ -666,7 +667,8 @@
double det = trans.Det();
- if (det <= 0)
+ // if (det <= 0)
+ if (det <= DBL_MIN) // avoid FPE
err += 1e12;
else
err += frob * frob / det;
@@ -722,7 +724,8 @@
double det = trans(0,0)*trans(1,1)-trans(1,0)*trans(0,1);
- if (det <= 0)
+ // if (det <= 0)
+ if (det <= DBL_MIN) // avoid FPE
{
dd = 0;
return 1e12;
@@ -806,7 +809,8 @@
= dtrans(0,0) * trans(1,1) - trans(0,1) * dtrans(1,0)
+ trans(0,0) * dtrans(1,1) - dtrans(0,1) * trans(1,0);
- if (det <= 0)
+ // if (det <= 0)
+ if (det <= DBL_MIN) // avoid FPE
err += 1e12;
else
{
@@ -856,7 +860,8 @@
frob /= 2;
double det = trans.Det();
- if (det <= 0)
+ //if (det <= 0)
+ if (det <= DBL_MIN) // avoid FPE
err += 1e12;
else
err += frob * frob / det;
@@ -1864,7 +1869,8 @@
case PYRAMID:
{
double noz = 1-p(2);
- if (noz == 0.0) noz = 1e-10;
+ //if (noz == 0.0) noz = 1e-10;
+ if (noz <= DBL_MIN) noz = 1e-10; // avoid FPE
double xi = p(0) / noz;
double eta = p(1) / noz;
@@ -2030,7 +2036,8 @@
double det = -trans.Det();
- if (det <= 0)
+ //if (det <= 0)
+ if (det <= DBL_MIN) // avoid FPE
err += 1e12;
else
err += frob * frob * frob / det;
@@ -2102,7 +2109,8 @@
ddet *= -1;
- if (det <= 0)
+ //if (det <= 0)
+ if (det <= DBL_MIN) // avoid FPE
err += 1e12;
else
{
@@ -2184,7 +2192,7 @@
det *= -1;
- if (det <= 0)
+ if (det <= DBL_MIN)
err += 1e12;
else
{
@@ -2513,10 +2521,10 @@
MeshingParameters :: MeshingParameters ()
{
- optimize3d = "cmdmustm";
+ optimize3d = (char*)"cmdmustm"; // optimize3d = "cmdmustm";
//optimize3d = "cmdmstm";
optsteps3d = 3;
- optimize2d = "smsmsmSmSmSm";
+ optimize2d = (char*)"smsmsmSmSmSm"; // optimize2d = "smsmsmSmSmSm";
optsteps2d = 3;
opterrpow = 2;
blockfill = 1;
diff -Naur --exclude=CVS netgen-5.0.0.orig/libsrc/meshing/meshtype.hpp netgen-5.0.0.patched/libsrc/meshing/meshtype.hpp
--- netgen-5.0.0.orig/libsrc/meshing/meshtype.hpp 2012-11-09 19:15:04.000000000 +0400
+++ netgen-5.0.0.patched/libsrc/meshing/meshtype.hpp 2013-02-21 17:46:13.000000000 +0400
@@ -15,6 +15,7 @@
Classes for NETGEN
*/
+class Mesh; // added due to compilation errors on some platforms
enum ELEMENT_TYPE {
diff -Naur --exclude=CVS netgen-5.0.0.orig/libsrc/meshing/smoothing2.cpp netgen-5.0.0.patched/libsrc/meshing/smoothing2.cpp
--- netgen-5.0.0.orig/libsrc/meshing/smoothing2.cpp 2012-11-09 19:15:04.000000000 +0400
+++ netgen-5.0.0.patched/libsrc/meshing/smoothing2.cpp 2013-02-25 11:20:05.000000000 +0400
@@ -200,7 +200,8 @@
vgrad = 0;
badness = 0;
- ld.meshthis -> GetNormalVector (ld.surfi, ld.sp1, ld.gi1, n);
+ //normal already computed: ld.meshthis -> GetNormalVector (ld.surfi, ld.sp1, ld.gi1, n);
+ n = ld.normal;
pp1 = ld.sp1 + x(0) * ld.t1 + x(1) * ld.t2;
// meshthis -> ProjectPoint (surfi, pp1);
@@ -258,7 +259,8 @@
vgrad = 0;
badness = 0;
- ld.meshthis -> GetNormalVector (ld.surfi, ld.sp1, ld.gi1, n);
+ //normal already computed: ld.meshthis -> GetNormalVector (ld.surfi, ld.sp1, ld.gi1, n);
+ n = ld.normal;
pp1 = ld.sp1 + x(0) * ld.t1 + x(1) * ld.t2;
@@ -417,7 +419,8 @@
vgrad = 0;
badness = 0;
- ld.meshthis -> GetNormalVector (ld.surfi, ld.sp1, ld.gi1, n);
+ //normal already computed: ld.meshthis -> GetNormalVector (ld.surfi, ld.sp1, ld.gi1, n);
+ n = ld.normal;
pp1 = ld.sp1 + x(0) * ld.t1 + x(1) * ld.t2;
@@ -489,7 +492,8 @@
vgrad = 0;
badness = 0;
- ld.meshthis -> GetNormalVector (ld.surfi, ld.sp1, ld.gi1, n);
+ //normal already computed: ld.meshthis -> GetNormalVector (ld.surfi, ld.sp1, ld.gi1, n);
+ n = ld.normal;
// pp1 = sp1;
// pp1.Add2 (x.Get(1), t1, x.Get(2), t2);
@@ -916,7 +920,7 @@
{
mesh[pi] = Point<3> (origp);
}
-
+ break; // exit as <fact> is not used anymore
}
}
}
diff -Naur --exclude=CVS netgen-5.0.0.orig/libsrc/occ/Partition_Inter3d.cxx netgen-5.0.0.patched/libsrc/occ/Partition_Inter3d.cxx
--- netgen-5.0.0.orig/libsrc/occ/Partition_Inter3d.cxx 2012-11-09 19:15:02.000000000 +0400
+++ netgen-5.0.0.patched/libsrc/occ/Partition_Inter3d.cxx 2013-02-25 13:51:48.000000000 +0400
@@ -243,9 +243,11 @@
Standard_Integer i, nbExt = anExtPS.NbExt();
Extrema_POnSurf aPOnSurf;
for (i = 1; i <= nbExt; ++i )
- if (anExtPS.Value( i ) <= TolE) // V6.3
- // if (anExtPS.SquareDistance( i ) <= TolE) // V6.5
- {
+ // porting to OCCT6.5.1
+ //if (anExtPS.Value( i ) <= TolE) // V6.3
+ // if (anExtPS.SquareDistance( i ) <= TolE) // V6.5
+ if (anExtPS.SquareDistance( i ) <= TolE * TolE)
+ {
aPOnSurf = anExtPS.Point( i );
break;
}
diff -Naur --exclude=CVS netgen-5.0.0.orig/libsrc/occ/Partition_Loop2d.cxx netgen-5.0.0.patched/libsrc/occ/Partition_Loop2d.cxx
--- netgen-5.0.0.orig/libsrc/occ/Partition_Loop2d.cxx 2012-11-09 19:15:02.000000000 +0400
+++ netgen-5.0.0.patched/libsrc/occ/Partition_Loop2d.cxx 2013-02-25 13:48:15.000000000 +0400
@@ -210,7 +210,7 @@
Cc->D1(uc, PC, CTg1);
if (!isForward) CTg1.Reverse();
- Standard_Real anglemin = 3 * PI, tolAng = 1.e-8;
+ Standard_Real anglemin = 3 * M_PI, tolAng = 1.e-8;
// select an edge whose first derivative is most left of CTg1
// ie an angle between Tg1 and CTg1 is least
@@ -234,7 +234,7 @@
// -PI < angle < PI
Standard_Real angle = Tg1.Angle(CTg1);
- if (PI - Abs(angle) <= tolAng)
+ if (M_PI - Abs(angle) <= tolAng)
{
// an angle is too close to PI; assure that an angle sign really
// reflects an edge position: +PI - an edge is worst,
diff -Naur --exclude=CVS netgen-5.0.0.orig/libsrc/occ/Partition_Spliter.cxx netgen-5.0.0.patched/libsrc/occ/Partition_Spliter.cxx
--- netgen-5.0.0.orig/libsrc/occ/Partition_Spliter.cxx 2012-11-09 19:15:02.000000000 +0400
+++ netgen-5.0.0.patched/libsrc/occ/Partition_Spliter.cxx 2013-02-25 13:55:10.000000000 +0400
@@ -1169,8 +1169,10 @@
for (; j<=nbj && ok; ++j) {
if (Extrema.IsMin(j)) {
hasMin = Standard_True;
- ok = Extrema.Value(j) <= tol; // V6.3
+ // porting to OCCT6.5.1
+ //ok = Extrema.Value(j) <= tol; // V6.3
// ok = Extrema.SquareDistance(j) <= tol; // V6.5
+ ok = Extrema.SquareDistance(j) <= tol * tol;
}
}
}
diff -Naur --exclude=CVS netgen-5.0.0.orig/libsrc/occ/occconstruction.cpp netgen-5.0.0.patched/libsrc/occ/occconstruction.cpp
--- netgen-5.0.0.orig/libsrc/occ/occconstruction.cpp 2012-11-09 19:15:02.000000000 +0400
+++ netgen-5.0.0.patched/libsrc/occ/occconstruction.cpp 2013-02-21 17:46:13.000000000 +0400
@@ -28,7 +28,7 @@
#include <BRepAlgoAPI_Common.hxx>
#include <BRepAlgoAPI_Fuse.hxx>
#include <BRepAlgoAPI_Section.hxx>
-#include <BRepOffsetAPI_Sewing.hxx>
+//#include <BRepOffsetAPI_Sewing.hxx>
//#include <BRepAlgo_Sewing.hxx>
#include <BRepOffsetAPI_MakeOffsetShape.hxx>
#include <ShapeFix_Shape.hxx>
diff -Naur --exclude=CVS netgen-5.0.0.orig/libsrc/occ/occgenmesh.cpp netgen-5.0.0.patched/libsrc/occ/occgenmesh.cpp
--- netgen-5.0.0.orig/libsrc/occ/occgenmesh.cpp 2012-11-09 19:15:02.000000000 +0400
+++ netgen-5.0.0.patched/libsrc/occ/occgenmesh.cpp 2013-02-21 17:46:13.000000000 +0400
@@ -57,6 +57,8 @@
+
+ static // useless out of this file
double ComputeH (double kappa)
{
double hret;
@@ -74,8 +76,7 @@
}
-
-
+ static // useless out of this file
void RestrictHTriangle (gp_Pnt2d & par0, gp_Pnt2d & par1, gp_Pnt2d & par2,
BRepLProp_SLProps * prop, Mesh & mesh, int depth, double h = 0)
{
@@ -171,8 +172,8 @@
if(h < 1e-4*maxside)
return;
-
- if (h > 30) return;
+ // commented to restrict H on a large sphere for example
+ //if (h > 30) return;
}
if (h < maxside && depth < 10)
@@ -231,6 +232,7 @@
+ static // useless out of this file
void DivideEdge (TopoDS_Edge & edge, Array<MeshPoint> & ps,
Array<double> & params, Mesh & mesh)
{
@@ -250,8 +252,8 @@
hvalue[0] = 0;
pnt = c->Value(s0);
- double olddist = 0;
- double dist = 0;
+ //double olddist = 0; -- useless variables
+ //double dist = 0;
int tmpVal = (int)(DIVIDEEDGESECTIONS);
@@ -259,15 +261,19 @@
{
oldpnt = pnt;
pnt = c->Value(s0+(i/double(DIVIDEEDGESECTIONS))*(s1-s0));
+ // -- no more than 1 segment per <edge length>/DIVIDEEDGESECTIONS
hvalue[i] = hvalue[i-1] +
- 1.0/mesh.GetH(Point3d(pnt.X(), pnt.Y(), pnt.Z()))*
- pnt.Distance(oldpnt);
+ // 1.0/mesh.GetH(Point3d(pnt.X(), pnt.Y(), pnt.Z()))*
+ // pnt.Distance(oldpnt);
+ min( 1.0,
+ 1.0/mesh.GetH(Point3d(pnt.X(), pnt.Y(), pnt.Z()))*
+ pnt.Distance(oldpnt));
//(*testout) << "mesh.GetH(Point3d(pnt.X(), pnt.Y(), pnt.Z())) " << mesh.GetH(Point3d(pnt.X(), pnt.Y(), pnt.Z()))
// << " pnt.Distance(oldpnt) " << pnt.Distance(oldpnt) << endl;
- olddist = dist;
- dist = pnt.Distance(oldpnt);
+ //olddist = dist; -- useless variables
+ //dist = pnt.Distance(oldpnt);
}
// nsubedges = int(ceil(hvalue[DIVIDEEDGESECTIONS]));
@@ -282,7 +288,10 @@
{
if (hvalue[i1]/hvalue[DIVIDEEDGESECTIONS]*nsubedges >= i)
{
- params[i] = s0+(i1/double(DIVIDEEDGESECTIONS))*(s1-s0);
+ // -- for nsubedges comparable to DIVIDEEDGESECTIONS
+ //params[i] = s0+(i1/double(DIVIDEEDGESECTIONS))*(s1-s0);
+ double d1 = i1 - (hvalue[i1] - i*hvalue[DIVIDEEDGESECTIONS]/nsubedges)/(hvalue[i1]-hvalue[i1-1]);
+ params[i] = s0+(d1/double(DIVIDEEDGESECTIONS))*(s1-s0);
pnt = c->Value(params[i]);
ps[i-1] = MeshPoint (Point3d(pnt.X(), pnt.Y(), pnt.Z()));
i++;
@@ -326,6 +335,7 @@
(*testout) << "nedges = " << nedges << endl;
double eps = 1e-6 * geom.GetBoundingBox().Diam();
+ const double eps2 = eps * eps; // -- small optimization
for (int i = 1; i <= nvertices; i++)
{
@@ -335,7 +345,8 @@
bool exists = 0;
if (merge_solids)
for (PointIndex pi = 1; pi <= mesh.GetNP(); pi++)
- if ( Dist2 (mesh[pi], Point<3>(mp)) < eps*eps)
+ //if ( Dist2 (mesh[pi], Point<3>(mp)) < eps*eps)
+ if ( Dist2 (mesh[pi], Point<3>(mp)) < eps2 ) // -- small optimization
{
exists = 1;
break;
@@ -365,6 +376,7 @@
{
TopoDS_Face face = TopoDS::Face(exp1.Current());
int facenr = geom.fmap.FindIndex(face);
+ if ( facenr < 1 ) continue; // -- to support SALOME sub-meshes
if (face2solid[0][facenr-1] == 0)
face2solid[0][facenr-1] = solidnr;
@@ -384,6 +396,7 @@
int facenr = 0;
int edgenr = 0;
+ edgenr = mesh.GetNSeg(); // to support SALOME sub-meshes
(*testout) << "faces = " << geom.fmap.Extent() << endl;
int curr = 0;
@@ -445,6 +458,7 @@
//(*testout) << "ignoring degenerated edge" << endl;
continue;
}
+ if ( geom.emap.FindIndex(edge) < 1 ) continue; // to support SALOME sub-meshes
if (geom.vmap.FindIndex(TopExp::FirstVertex (edge)) ==
geom.vmap.FindIndex(TopExp::LastVertex (edge)))
@@ -482,15 +496,64 @@
}
else
{
- Point<3> fp = occ2ng (BRep_Tool::Pnt (TopExp::FirstVertex (edge)));
- Point<3> lp = occ2ng (BRep_Tool::Pnt (TopExp::LastVertex (edge)));
+ TopoDS_Iterator vIt( edge, false );
+ TopoDS_Vertex v1 = TopoDS::Vertex( vIt.Value() ); vIt.Next();
+ TopoDS_Vertex v2 = TopoDS::Vertex( vIt.Value() );
+ if ( v1.Orientation() == TopAbs_REVERSED )
+ std::swap( v1, v2 );
+ const bool isClosedEdge = v1.IsSame( v2 );
+
+ Point<3> fp = occ2ng (BRep_Tool::Pnt (v1));
+ Point<3> lp = occ2ng (BRep_Tool::Pnt (v2));
+ double tol2 = std::min( eps*eps, 1e-6 * Dist2( fp, lp ));
+ if ( isClosedEdge )
+ tol2 = BRep_Tool::Tolerance( v1 ) * BRep_Tool::Tolerance( v1 );
pnums[0] = -1;
pnums.Last() = -1;
for (PointIndex pi = 1; pi < first_ep; pi++)
{
- if (Dist2 (mesh[pi], fp) < eps*eps) pnums[0] = pi;
- if (Dist2 (mesh[pi], lp) < eps*eps) pnums.Last() = pi;
+ if (Dist2 (mesh[pi], fp) < tol2) pnums[0] = pi;
+ if (Dist2 (mesh[pi], lp) < tol2) pnums.Last() = pi;
+ }
+ if (( isClosedEdge && pnums[0] != pnums.Last() ) ||
+ ( !isClosedEdge && pnums[0] == pnums.Last() ))
+ pnums[0] = pnums.Last() = -1;
+ if ( pnums[0] == -1 || pnums.Last() == -1 )
+ {
+ // take into account a possible large gap between a vertex and an edge curve
+ // end and a large vertex tolerance covering the whole edge
+ if ( pnums[0] == -1 )
+ {
+ double tol = BRep_Tool::Tolerance( v1 );
+ for (PointIndex pi = 1; pi < first_ep; pi++)
+ if (pi != pnums.Last() && Dist2 (mesh[pi], fp) < 2*tol*tol)
+ pnums[0] = pi;
+
+ if ( pnums[0] == -1 )
+ pnums[0] = first_ep-1- nvertices + geom.vmap.FindIndex ( v1 );
+ }
+ if ( isClosedEdge )
+ {
+ pnums.Last() = pnums[0];
+ }
+ else
+ {
+ if ( pnums.Last() == -1 )
+ {
+ double tol = BRep_Tool::Tolerance( v2 );
+ for (PointIndex pi = 1; pi < first_ep; pi++)
+ if (pi != pnums[0] && Dist2 (mesh[pi], lp) < 2*tol*tol)
+ pnums.Last() = pi;
+
+ if ( pnums.Last() == -1 )
+ pnums.Last() = first_ep-1-nvertices + geom.vmap.FindIndex ( v2 );
+ }
+
+ if ( Dist2( fp, mesh[PointIndex(pnums[0])]) >
+ Dist2( lp, mesh[PointIndex(pnums.Last())]))
+ std::swap( pnums[0], pnums.Last() );
+ }
}
}
@@ -1458,3 +1521,4 @@
}
#endif
+
diff -Naur --exclude=CVS netgen-5.0.0.orig/libsrc/occ/occgeom.cpp netgen-5.0.0.patched/libsrc/occ/occgeom.cpp
--- netgen-5.0.0.orig/libsrc/occ/occgeom.cpp 2012-11-09 19:15:02.000000000 +0400
+++ netgen-5.0.0.patched/libsrc/occ/occgeom.cpp 2013-02-21 17:46:13.000000000 +0400
@@ -8,6 +8,8 @@
#include "ShapeAnalysis_CheckSmallFace.hxx"
#include "ShapeAnalysis_DataMapOfShapeListOfReal.hxx"
#include "ShapeAnalysis_Surface.hxx"
+#include <BRepTopAdaptor_FClass2d.hxx> // -- to optimize Project() and FastProject()
+#include <TopAbs_State.hxx>
#include "BRepAlgoAPI_Fuse.hxx"
#include "BRepCheck_Analyzer.hxx"
#include "BRepLib.hxx"
@@ -16,10 +18,17 @@
#include "ShapeFix_FixSmallFace.hxx"
#include "Partition_Spliter.hxx"
-
namespace netgen
{
- void OCCGeometry :: PrintNrShapes ()
+ // free data used to optimize Project() and FastProject()
+ OCCGeometry::~OCCGeometry()
+ {
+ NCollection_DataMap<int,BRepTopAdaptor_FClass2d*>::Iterator it(fclsmap);
+ for (; it.More(); it.Next())
+ delete it.Value();
+ }
+
+ void OCCGeometry :: PrintNrShapes ()
{
TopExp_Explorer e;
int count = 0;
@@ -951,25 +960,58 @@
}
+ // returns a projector and a classifier for the given surface
+ void OCCGeometry::GetFaceTools(int surfi, Handle(ShapeAnalysis_Surface)& proj,
+ BRepTopAdaptor_FClass2d*& cls) const
+ {
+ //MSV: organize caching projector in the map
+ if (fprjmap.IsBound(surfi))
+ {
+ proj = fprjmap.Find(surfi);
+ cls = fclsmap.Find(surfi);
+ }
+ else
+ {
+ const TopoDS_Face& aFace = TopoDS::Face(fmap(surfi));
+ Handle(Geom_Surface) aSurf = BRep_Tool::Surface(aFace);
+ proj = new ShapeAnalysis_Surface(aSurf);
+ fprjmap.Bind(surfi, proj);
+ cls = new BRepTopAdaptor_FClass2d(aFace,Precision::Confusion());
+ fclsmap.Bind(surfi, cls);
+ }
+ }
-
- void OCCGeometry :: Project (int surfi, Point<3> & p) const
+ // void OCCGeometry :: Project (int surfi, Point<3> & p) const
+ bool OCCGeometry :: Project (int surfi, Point<3> & p, double& u, double& v) const
{
static int cnt = 0;
if (++cnt % 1000 == 0) cout << "Project cnt = " << cnt << endl;
gp_Pnt pnt(p(0), p(1), p(2));
- double u,v;
- Handle( Geom_Surface ) thesurf = BRep_Tool::Surface(TopoDS::Face(fmap(surfi)));
- Handle( ShapeAnalysis_Surface ) su = new ShapeAnalysis_Surface( thesurf );
- gp_Pnt2d suval = su->ValueOfUV ( pnt, BRep_Tool::Tolerance( TopoDS::Face(fmap(surfi)) ) );
- suval.Coord( u, v);
- pnt = thesurf->Value( u, v );
-
-
+ // -- Optimization: use cached projector and classifier
+ // double u,v;
+ // Handle( Geom_Surface ) thesurf = BRep_Tool::Surface(TopoDS::Face(fmap(surfi)));
+ // Handle( ShapeAnalysis_Surface ) su = new ShapeAnalysis_Surface( thesurf );
+ // gp_Pnt2d suval = su->ValueOfUV ( pnt, BRep_Tool::Tolerance( TopoDS::Face(fmap(surfi)) ) );
+ // suval.Coord( u, v);
+ // pnt = thesurf->Value( u, v );
+
+ Handle(ShapeAnalysis_Surface) proj;
+ BRepTopAdaptor_FClass2d *cls;
+ GetFaceTools(surfi, proj, cls);
+
+ gp_Pnt2d p2d = proj->ValueOfUV(pnt, Precision::Confusion());
+ if (cls->Perform(p2d) == TopAbs_OUT)
+ {
+ return false;
+ }
+ pnt = proj->Value(p2d);
+ p2d.Coord(u, v);
+
p = Point<3> (pnt.X(), pnt.Y(), pnt.Z());
+ return true;
}
@@ -979,54 +1021,69 @@
{
gp_Pnt p(ap(0), ap(1), ap(2));
- Handle(Geom_Surface) surface = BRep_Tool::Surface(TopoDS::Face(fmap(surfi)));
-
- gp_Pnt x = surface->Value (u,v);
-
- if (p.SquareDistance(x) <= sqr(PROJECTION_TOLERANCE)) return true;
-
- gp_Vec du, dv;
-
- surface->D1(u,v,x,du,dv);
-
- int count = 0;
-
- gp_Pnt xold;
- gp_Vec n;
- double det, lambda, mu;
-
- do {
- count++;
-
- n = du^dv;
-
- det = Det3 (n.X(), du.X(), dv.X(),
- n.Y(), du.Y(), dv.Y(),
- n.Z(), du.Z(), dv.Z());
-
- if (det < 1e-15) return false;
-
- lambda = Det3 (n.X(), p.X()-x.X(), dv.X(),
- n.Y(), p.Y()-x.Y(), dv.Y(),
- n.Z(), p.Z()-x.Z(), dv.Z())/det;
-
- mu = Det3 (n.X(), du.X(), p.X()-x.X(),
- n.Y(), du.Y(), p.Y()-x.Y(),
- n.Z(), du.Z(), p.Z()-x.Z())/det;
-
- u += lambda;
- v += mu;
-
- xold = x;
- surface->D1(u,v,x,du,dv);
-
- } while (xold.SquareDistance(x) > sqr(PROJECTION_TOLERANCE) && count < 50);
-
- // (*testout) << "FastProject count: " << count << endl;
-
- if (count == 50) return false;
-
- ap = Point<3> (x.X(), x.Y(), x.Z());
+ // -- Optimization: use cached projector and classifier
+ // Handle(Geom_Surface) surface = BRep_Tool::Surface(TopoDS::Face(fmap(surfi)));
+ //
+ // gp_Pnt x = surface->Value (u,v);
+ //
+ // if (p.SquareDistance(x) <= sqr(PROJECTION_TOLERANCE)) return true;
+ //
+ // gp_Vec du, dv;
+ //
+ // surface->D1(u,v,x,du,dv);
+ //
+ // int count = 0;
+ //
+ // gp_Pnt xold;
+ // gp_Vec n;
+ // double det, lambda, mu;
+ //
+ // do {
+ // count++;
+ //
+ // n = du^dv;
+ //
+ // det = Det3 (n.X(), du.X(), dv.X(),
+ // n.Y(), du.Y(), dv.Y(),
+ // n.Z(), du.Z(), dv.Z());
+ //
+ // if (det < 1e-15) return false;
+ //
+ // lambda = Det3 (n.X(), p.X()-x.X(), dv.X(),
+ // n.Y(), p.Y()-x.Y(), dv.Y(),
+ // n.Z(), p.Z()-x.Z(), dv.Z())/det;
+ //
+ // mu = Det3 (n.X(), du.X(), p.X()-x.X(),
+ // n.Y(), du.Y(), p.Y()-x.Y(),
+ // n.Z(), du.Z(), p.Z()-x.Z())/det;
+ //
+ // u += lambda;
+ // v += mu;
+ //
+ // xold = x;
+ // surface->D1(u,v,x,du,dv);
+ //
+ // } while (xold.SquareDistance(x) > sqr(PROJECTION_TOLERANCE) && count < 50);
+ //
+ // // (*testout) << "FastProject count: " << count << endl;
+ //
+ // if (count == 50) return false;
+ //
+ // ap = Point<3> (x.X(), x.Y(), x.Z());
+ Handle(ShapeAnalysis_Surface) proj;
+ BRepTopAdaptor_FClass2d *cls;
+ GetFaceTools(surfi, proj, cls);
+
+ gp_Pnt2d p2d = proj->NextValueOfUV(gp_Pnt2d(u,v), p, Precision::Confusion());
+ if (cls->Perform(p2d) == TopAbs_OUT)
+ {
+ //cout << "Projection fails" << endl;
+ return false;
+ }
+
+ p = proj->Value(p2d);
+ p2d.Coord(u, v);
+ ap = Point<3> (p.X(), p.Y(), p.Z());
return true;
}
diff -Naur --exclude=CVS netgen-5.0.0.orig/libsrc/occ/occgeom.hpp netgen-5.0.0.patched/libsrc/occ/occgeom.hpp
--- netgen-5.0.0.orig/libsrc/occ/occgeom.hpp 2012-11-09 19:15:02.000000000 +0400
+++ netgen-5.0.0.patched/libsrc/occ/occgeom.hpp 2013-02-21 17:46:13.000000000 +0400
@@ -15,8 +15,8 @@
#include "Geom_Curve.hxx"
#include "Geom2d_Curve.hxx"
#include "Geom_Surface.hxx"
-#include "GeomAPI_ProjectPointOnSurf.hxx"
-#include "GeomAPI_ProjectPointOnCurve.hxx"
+// #include "GeomAPI_ProjectPointOnSurf.hxx"
+// #include "GeomAPI_ProjectPointOnCurve.hxx"
#include "BRepTools.hxx"
#include "TopExp.hxx"
#include "BRepBuilderAPI_MakeVertex.hxx"
@@ -42,8 +42,8 @@
#include "Geom_Curve.hxx"
#include "Geom2d_Curve.hxx"
#include "Geom_Surface.hxx"
-#include "GeomAPI_ProjectPointOnSurf.hxx"
-#include "GeomAPI_ProjectPointOnCurve.hxx"
+// #include "GeomAPI_ProjectPointOnSurf.hxx"
+// #include "GeomAPI_ProjectPointOnCurve.hxx"
#include "TopoDS_Wire.hxx"
#include "BRepTools_WireExplorer.hxx"
#include "BRepTools.hxx"
@@ -68,7 +68,7 @@
#include "IGESToBRep_Reader.hxx"
#include "Interface_Static.hxx"
#include "GeomAPI_ExtremaCurveCurve.hxx"
-#include "Standard_ErrorHandler.hxx"
+//#include "Standard_ErrorHandler.hxx"
#include "Standard_Failure.hxx"
#include "ShapeUpgrade_ShellSewing.hxx"
#include "ShapeFix_Shape.hxx"
@@ -80,6 +80,10 @@
#include "ShapeAnalysis.hxx"
#include "ShapeBuild_ReShape.hxx"
+// -- Optimization: to use cached projector and classifier
+#include <NCollection_DataMap.hxx>
+class Handle_ShapeAnalysis_Surface;
+class BRepTopAdaptor_FClass2d;
// Philippose - 29/01/2009
// OpenCascade XDE Support
@@ -192,6 +196,9 @@
class OCCGeometry : public NetgenGeometry
{
Point<3> center;
+ // -- Optimization: to use cached projector and classifier
+ mutable NCollection_DataMap<int,Handle_ShapeAnalysis_Surface> fprjmap;
+ mutable NCollection_DataMap<int,BRepTopAdaptor_FClass2d*> fclsmap;
public:
TopoDS_Shape shape;
@@ -247,6 +254,8 @@
virtual void Save (string filename) const;
+ ~OCCGeometry(); // -- to free cached projector and classifier
+
void BuildFMap();
Box<3> GetBoundingBox()
@@ -266,9 +275,14 @@
Point<3> Center()
{ return center;}
- void Project (int surfi, Point<3> & p) const;
+ // void Project (int surfi, Point<3> & p) const; -- optimization
+ bool Project (int surfi, Point<3> & p, double& u, double& v) const;
bool FastProject (int surfi, Point<3> & ap, double& u, double& v) const;
+ // -- Optimization: to use cached projector and classifier
+ void GetFaceTools(int surfi, Handle(ShapeAnalysis_Surface)& proj,
+ BRepTopAdaptor_FClass2d*& cls) const;
+
OCCSurface GetSurface (int surfi)
{
cout << "OCCGeometry::GetSurface using PLANESPACE" << endl;
diff -Naur --exclude=CVS netgen-5.0.0.orig/libsrc/occ/occmeshsurf.cpp netgen-5.0.0.patched/libsrc/occ/occmeshsurf.cpp
--- netgen-5.0.0.orig/libsrc/occ/occmeshsurf.cpp 2012-11-09 19:15:02.000000000 +0400
+++ netgen-5.0.0.patched/libsrc/occ/occmeshsurf.cpp 2013-02-25 13:27:49.000000000 +0400
@@ -6,6 +6,7 @@
#include <meshing.hpp>
#include <GeomLProp_SLProps.hxx>
#include <ShapeAnalysis_Surface.hxx>
+#include <GeomAPI_ProjectPointOnCurve.hxx> // -- moved here from occgeom.hpp
namespace netgen
@@ -434,23 +435,33 @@
void MeshOptimize2dOCCSurfaces :: ProjectPoint (INDEX surfind, Point<3> & p) const
{
- geometry.Project (surfind, p);
+ // geometry.Project (surfind, p); -- signature of Project() changed for optimization
+ double u, v;
+ geometry.Project (surfind, p, u, v);
}
int MeshOptimize2dOCCSurfaces :: ProjectPointGI (INDEX surfind, Point<3> & p, PointGeomInfo & gi) const
{
- double u = gi.u;
- double v = gi.v;
+ //double u = gi.u;
+ //double v = gi.v;
Point<3> hp = p;
- if (geometry.FastProject (surfind, hp, u, v))
- {
- p = hp;
- return 1;
- }
- ProjectPoint (surfind, p);
- return CalcPointGeomInfo (surfind, gi, p);
+ // -- u and v are computed by FastProject() and Project(), no need to call CalcPointGeomInfo()
+ // if (geometry.FastProject (surfind, hp, u, v))
+ // {
+ // p = hp;
+ // return 1;
+ // }
+ // ProjectPoint (surfind, p);
+ // return CalcPointGeomInfo (surfind, gi, p);
+ bool ok;
+ if (gi.trignum > 0)
+ ok = geometry.FastProject (surfind, hp, gi.u, gi.v);
+ else
+ ok = geometry.Project (surfind, hp, gi.u, gi.v);
+ p = hp;
+ return ok;
}
@@ -680,7 +691,8 @@
if (!geometry.FastProject (surfi, hnewp, u, v))
{
// cout << "Fast projection to surface fails! Using OCC projection" << endl;
- geometry.Project (surfi, hnewp);
+ // geometry.Project (surfi, hnewp); -- Project() changed for optimization
+ geometry.Project (surfi, hnewp, u, v);
}
newgi.trignum = 1;
@@ -689,7 +701,7 @@
}
newp = hnewp;
- }
+ }//; -- to compile with -Wall -pedantic
void OCCRefinementSurfaces ::
@@ -708,14 +720,18 @@
hnewp = Point<3> (pnt.X(), pnt.Y(), pnt.Z());
newp = hnewp;
newgi = ap1;
- };
+ }
void OCCRefinementSurfaces :: ProjectToSurface (Point<3> & p, int surfi) const
{
if (surfi > 0)
- geometry.Project (surfi, p);
- };
+ // geometry.Project (surfi, p); -- Project() changed for optimization
+ {
+ double u, v;
+ geometry.Project (surfi, p, u, v);
+ }
+ }//; -- to compile with -Wall -pedantic
void OCCRefinementSurfaces :: ProjectToSurface (Point<3> & p, int surfi, PointGeomInfo & gi) const
{
@@ -723,9 +739,10 @@
if (!geometry.FastProject (surfi, p, gi.u, gi.v))
{
cout << "Fast projection to surface fails! Using OCC projection" << endl;
- geometry.Project (surfi, p);
+ double u, v;
+ geometry.Project (surfi, p, u, v);
}
- };
+ }
diff -Naur --exclude=CVS netgen-5.0.0.orig/libsrc/occ/utilities.h netgen-5.0.0.patched/libsrc/occ/utilities.h
--- netgen-5.0.0.orig/libsrc/occ/utilities.h 2012-11-09 19:15:02.000000000 +0400
+++ netgen-5.0.0.patched/libsrc/occ/utilities.h 2013-02-21 17:47:08.000000000 +0400
@@ -33,6 +33,7 @@
#include <string>
#include <iostream>
+#include <iomanip>
#include <cstdlib>
// #include "SALOME_Log.hxx"
diff -Naur --exclude=CVS netgen-5.0.0.orig/libsrc/stlgeom/stlgeommesh.cpp netgen-5.0.0.patched/libsrc/stlgeom/stlgeommesh.cpp
--- netgen-5.0.0.orig/libsrc/stlgeom/stlgeommesh.cpp 2012-11-09 19:15:04.000000000 +0400
+++ netgen-5.0.0.patched/libsrc/stlgeom/stlgeommesh.cpp 2013-02-21 17:52:07.000000000 +0400
@@ -1435,7 +1435,8 @@
/*
if (!optstring || strlen(optstring) == 0)
{
- mparam.optimize2d = "smcm";
+ //mparam.optimize2d = (char*)"smcm";
+ mparam.optimize2d = (char*)"smcm";
}
else
{
@@ -1453,7 +1454,7 @@
mesh -> LoadLocalMeshSize (mparam.meshsizefilename);
mesh -> CalcLocalHFromSurfaceCurvature (mparam.grading,
stlparam.resthsurfmeshcurvfac);
- mparam.optimize2d = "cmsmSm";
+ mparam.optimize2d = "(char*)cmsmSm";
STLSurfaceOptimization (*stlgeometry, *mesh, mparam);
#ifdef STAT_STREAM
(*statout) << GetTime() << " & ";
@@ -1560,7 +1561,8 @@
/*
if (!optstring || strlen(optstring) == 0)
{
- mparam.optimize3d = "cmdmstm";
+ //mparam.optimize3d = "cmdmstm";
+ mparam.optimize3d = (char*)"cmdmstm";
}
else
{
diff -Naur --exclude=CVS netgen-5.0.0.orig/nglib/nglib.h netgen-5.0.0.patched/nglib/nglib.h
--- netgen-5.0.0.orig/nglib/nglib.h 2012-11-09 19:15:00.000000000 +0400
+++ netgen-5.0.0.patched/nglib/nglib.h 2013-02-21 17:47:08.000000000 +0400
@@ -24,7 +24,7 @@
// Philippose - 14.02.2009
// Modifications for creating a DLL in Windows
#ifdef WIN32
- #ifdef NGLIB_EXPORTS || nglib_EXPORTS
+ #if defined NGLIB_EXPORTS || defined nglib_EXPORTS
#define DLL_HEADER __declspec(dllexport)
#else
#define DLL_HEADER __declspec(dllimport)

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,293 +0,0 @@
diff --git a/libsrc/occ/occgenmesh.cpp b/libsrc/occ/occgenmesh.cpp
index 314d405a..7c912bcc 100644
--- a/libsrc/occ/occgenmesh.cpp
+++ b/libsrc/occ/occgenmesh.cpp
@@ -49,7 +49,7 @@ namespace netgen
double ComputeH (double kappa, const MeshingParameters & mparam)
{
kappa *= mparam.curvaturesafety;
- /*
+ /**/
double hret;
if (mparam.maxh * kappa < 1)
@@ -61,7 +61,7 @@ namespace netgen
hret = mparam.maxh;
return hret;
- */
+ /**/
// return min(mparam.maxh, 1/kappa);
return (mparam.maxh*kappa < 1) ? mparam.maxh : 1/kappa;
}
@@ -253,10 +253,12 @@ namespace netgen
{
oldpnt = pnt;
pnt = c->Value(s0+(i/double(DIVIDEEDGESECTIONS))*(s1-s0));
+ // !!! no more than 1 segment per <edge length>/DIVIDEEDGESECTIONS
hvalue[i] = hvalue[i-1] +
- 1.0/mesh.GetH(Point3d(pnt.X(), pnt.Y(), pnt.Z()))*
- pnt.Distance(oldpnt);
+ min( 1.0,
+ 1.0/mesh.GetH(Point3d(pnt.X(), pnt.Y(), pnt.Z()))*
+ pnt.Distance(oldpnt));
//(*testout) << "mesh.GetH(Point3d(pnt.X(), pnt.Y(), pnt.Z())) " << mesh.GetH(Point3d(pnt.X(), pnt.Y(), pnt.Z()))
// << " pnt.Distance(oldpnt) " << pnt.Distance(oldpnt) << endl;
@@ -299,7 +301,7 @@ namespace netgen
cout << "CORRECTED" << endl;
ps.SetSize (nsubedges-2);
params.SetSize (nsubedges);
- params[nsubedges] = s1;
+ params[nsubedges-1] = s1;
}
}
@@ -323,6 +325,8 @@ namespace netgen
double eps = 1e-6 * geom.GetBoundingBox().Diam();
+ int first_vp = mesh.GetNP()+1;
+
tsearch.Start();
for (int i = 1; i <= nvertices; i++)
{
@@ -481,22 +485,107 @@ namespace netgen
if (!merge_solids)
{
- pnums[0] = geom.vmap.FindIndex (TopExp::FirstVertex (edge)) + PointIndex::BASE-1;
- pnums.Last() = geom.vmap.FindIndex (TopExp::LastVertex (edge)) + PointIndex::BASE-1;
+ //pnums[0] = geom.vmap.FindIndex (TopExp::FirstVertex (edge)) + PointIndex::BASE-1;
+ //pnums.Last() = geom.vmap.FindIndex (TopExp::LastVertex (edge)) + PointIndex::BASE-1;
+ const int dpi = PointIndex::BASE-1;
+ MeshPoint dfltP ( Point<3> ( 0, 0, 0 ) );
+ PointIndex *ipp[] = { &pnums[0], &pnums.Last() };
+ TopoDS_Iterator vIt( edge, false );
+ TopoDS_Vertex v[2];
+ v[0] = TopoDS::Vertex( vIt.Value() ); vIt.Next();
+ v[1] = TopoDS::Vertex( vIt.Value() );
+ if ( v[0].Orientation() == TopAbs_REVERSED )
+ std::swap( v[0], v[1] );
+ for ( int i = 0; i < 2; ++i)
+ {
+ PointIndex &ip = *ipp[i];
+ ip = geom.vmap.FindIndex ( v[i] ) + dpi;
+ if ( ip == dpi || ip > nvertices + dpi )
+ {
+ PointIndex iv = ip;
+ if ( ip == dpi )
+ ip = iv = const_cast<OCCGeometry&>(geom).vmap.Add( v[i] );
+ gp_Pnt pnt = BRep_Tool::Pnt( v[i] );
+ MeshPoint mp( Point<3>(pnt.X(), pnt.Y(), pnt.Z()) );
+ for (PointIndex pi = 1; pi < first_vp; pi++)
+ if ( Dist2 (mesh.Point(pi), Point<3>(mp)) < 1e-100 )
+ {
+ ip = pi;
+ if ( mesh.Point(ip).GetLayer() != dfltP.GetLayer() && mesh.Point(ip).GetLayer() != iv )
+ continue;
+ if ( mesh.Point(ip).GetLayer() == dfltP.GetLayer())
+ mesh.Point(ip) = MeshPoint( mesh.Point(ip), iv );
+ break;
+ }
+ }
+ else
+ {
+ ip += first_vp - 1;
+ }
+ }
}
else
{
- Point<3> fp = occ2ng (BRep_Tool::Pnt (TopExp::FirstVertex (edge)));
- Point<3> lp = occ2ng (BRep_Tool::Pnt (TopExp::LastVertex (edge)));
+ TopoDS_Iterator vIt( edge, false );
+ TopoDS_Vertex v1 = TopoDS::Vertex( vIt.Value() ); vIt.Next();
+ TopoDS_Vertex v2 = TopoDS::Vertex( vIt.Value() );
+ if ( v1.Orientation() == TopAbs_REVERSED )
+ std::swap( v1, v2 );
+ const bool isClosedEdge = v1.IsSame( v2 );
+
+ Point<3> fp = occ2ng (BRep_Tool::Pnt (v1));
+ Point<3> lp = occ2ng (BRep_Tool::Pnt (v2));
+ double tol2 = std::min( eps*eps, 1e-6 * Dist2( fp, lp ));
+ if ( isClosedEdge )
+ tol2 = BRep_Tool::Tolerance( v1 ) * BRep_Tool::Tolerance( v1 );
pnums[0] = PointIndex::INVALID;
pnums.Last() = PointIndex::INVALID;
for (PointIndex pi : vertexrange)
{
- if (Dist2 (mesh[pi], fp) < eps*eps) pnums[0] = pi;
- if (Dist2 (mesh[pi], lp) < eps*eps) pnums.Last() = pi;
+ if (Dist2 (mesh[pi], fp) < tol2) pnums[0] = pi;
+ if (Dist2 (mesh[pi], lp) < tol2) pnums.Last() = pi;
}
- }
+ if (( isClosedEdge && pnums[0] != pnums.Last() ) ||
+ ( !isClosedEdge && pnums[0] == pnums.Last() ))
+ pnums[0] = pnums.Last() = PointIndex::INVALID;
+ if ( pnums[0] < PointIndex::BASE || pnums.Last() < PointIndex::BASE )
+ {
+ // take into account a possible large gap between a vertex and an edge curve
+ // end and a large vertex tolerance covering the whole edge
+ if ( pnums[0] < PointIndex::BASE )
+ {
+ double tol = BRep_Tool::Tolerance( v1 );
+ for (PointIndex pi = 1; pi < first_ep; pi++)
+ if (pi != pnums.Last() && Dist2 (mesh[pi], fp) < 2*tol*tol)
+ pnums[0] = pi;
+
+ if ( pnums[0] < PointIndex::BASE )
+ pnums[0] = first_ep-1 - nvertices + geom.vmap.FindIndex ( v1 );
+ }
+ if ( isClosedEdge )
+ {
+ pnums.Last() = pnums[0];
+ }
+ else
+ {
+ if ( pnums.Last() < PointIndex::BASE )
+ {
+ double tol = BRep_Tool::Tolerance( v2 );
+ for (PointIndex pi = 1; pi < first_ep; pi++)
+ if (pi != pnums[0] && Dist2 (mesh[pi], lp) < 2*tol*tol)
+ pnums.Last() = pi;
+
+ if ( pnums.Last() < PointIndex::BASE )
+ pnums.Last() = first_ep-1-nvertices + geom.vmap.FindIndex ( v2 );
+ }
+
+ if ( Dist2( fp, mesh[PointIndex(pnums[0])]) >
+ Dist2( lp, mesh[PointIndex(pnums.Last())]))
+ std::swap( pnums[0], pnums.Last() );
+ }
+ }
+ }
for (size_t i = 1; i <= mp.Size(); i++)
{
@@ -505,17 +594,19 @@ namespace netgen
// for (PointIndex j = first_ep; j < mesh.Points().End(); j++)
for (PointIndex j = first_ep; j < *mesh.Points().Range().end(); j++)
+ {
+ if (!merge_solids && mesh.Point(j).GetLayer() != geomedgenr ) continue;
if ((mesh.Point(j)-Point<3>(mp[i-1])).Length() < eps)
{
exists = true;
pnums[i] = j;
break;
}
-
+ }
tsearch.Stop();
if (!exists)
- pnums[i] = mesh.AddPoint (mp[i-1]);
+ pnums[i] = mesh.AddPoint (mp[i-1], geomedgenr);
}
if(geom.enames.Size() && geom.enames[curr-1] != "")
mesh.SetCD2Name(geomedgenr, geom.enames[curr-1]);
@@ -599,6 +690,9 @@ namespace netgen
// << " p1 " << mesh.LineSegment(i)[0] << " p2 " << mesh.LineSegment(i)[1] << endl;
// exit(10);
+ for (int j = 1; j <= mesh.GetNP(); j++) // support SALOME fuse edges: set level to zero
+ mesh.Point(j) = MeshPoint( (Point<3>&) mesh.Point(j) );
+
mesh.CalcSurfacesOfNode();
multithread.task = savetask;
}
@@ -652,7 +746,7 @@ namespace netgen
Box<3> bb = geom.GetBoundingBox();
- int projecttype = PLANESPACE;
+ //int projecttype = PLANESPACE;
static Timer tinit("init");
tinit.Start();
diff --git a/libsrc/occ/occmeshsurf.cpp b/libsrc/occ/occmeshsurf.cpp
index 7fa5d237..9e05fd95 100644
--- a/libsrc/occ/occmeshsurf.cpp
+++ b/libsrc/occ/occmeshsurf.cpp
@@ -173,50 +173,6 @@ namespace netgen
gp_Vec du, dv;
occface->D1 (geominfo1.u, geominfo1.v, pnt, du, dv);
- // static Timer t("occ-defintangplane calculations");
- // RegionTimer reg(t);
-
- Mat<3,2> D1_;
- D1_(0,0) = du.X(); D1_(1,0) = du.Y(); D1_(2,0) = du.Z();
- D1_(0,1) = dv.X(); D1_(1,1) = dv.Y(); D1_(2,1) = dv.Z();
- auto D1T_ = Trans(D1_);
- auto D1TD1_ = D1T_*D1_;
- if (Det (D1TD1_) == 0) throw SingularMatrixException();
- Mat<2,2> DDTinv_;
- CalcInverse (D1TD1_, DDTinv_);
-
- Mat<3,2> Y_;
- Vec<3> y1_ = (ap2-ap1).Normalize();
- Vec<3> y2_ = Cross(n, y1_).Normalize();
- for (int i = 0; i < 3; i++)
- {
- Y_(i,0) = y1_(i);
- Y_(i,1) = y2_(i);
- }
-
- auto A_ = DDTinv_ * D1T_ * Y_;
- Mat<2,2> Ainv_;
- if (Det(A_) == 0) throw SingularMatrixException();
- CalcInverse (A_, Ainv_);
-
- Vec<2> temp_ = Ainv_ * (psp2-psp1);
- double r_ = temp_.Length();
- Mat<2,2> R_;
- R_(0,0) = temp_(0)/r_;
- R_(1,0) = temp_(1)/r_;
- R_(0,1) = -R_(1,0);
- R_(1,1) = R_(0,0);
-
- A_ = A_ * R_;
- Ainv_ = Trans(R_) * Ainv_;
-
- Amat = A_;
- Amatinv = Ainv_;
-
- // temp = Amatinv * (psp2-psp1);
-
-
-#ifdef OLD
DenseMatrix D1(3,2), D1T(2,3), DDTinv(2,2);
D1(0,0) = du.X(); D1(1,0) = du.Y(); D1(2,0) = du.Z();
D1(0,1) = dv.X(); D1(1,1) = dv.Y(); D1(2,1) = dv.Z();
@@ -289,8 +245,7 @@ namespace netgen
}
// cout << "=?= Ainv = " << endl << Ainv << endl;
temp = Amatinv * (psp2-psp1);
- cout << " =?= Amatinv = " << Amatinv << endl;
-#endif
+ // cout << " =?= Amatinv = " << Amatinv << endl;
};
}
@@ -380,6 +335,7 @@ namespace netgen
double u = gi.u;
double v = gi.v;
+ if ( 0 ) { // exclude Newton's method
gp_Pnt x = occface->Value (u,v);
if (p.SquareDistance(x) <= sqr(PROJECTION_TOLERANCE)) return;
@@ -429,7 +385,7 @@ namespace netgen
}
}
while (count < 20);
-
+ }
// Newton did not converge, use OCC projection

View File

@ -1,27 +1,39 @@
#!/bin/sh
src_dir=${1}
install_dir=${2}
src_dir=$1
install_dir=$2
if ! test -d ${src_dir}/libsrc ; then
echo "No dir ${src_dir}/libsrc ... Bye"
if ! test -d $src_dir/libsrc ; then
echo "No dir $src_dir/libsrc ... Bye"
exit 1
fi
if ! test -d ${install_dir} ; then
echo "No dir ${install_dir} ... Bye"
if ! test -d $install_dir/share/netgen ; then
echo "No dir $install_dir/share/netgen ... Bye"
exit 1
fi
dest_dir=${install_dir}/include
mkdir -p ${dest_dir} > /dev/null 2>&1
dest_dir=$install_dir/share/netgen/include
mkdir -p $dest_dir > /dev/null 2>&1
cp -af $src_dir/libsrc/csg/*.hpp $dest_dir
cp -af $src_dir/libsrc/general/*.hpp $dest_dir
cp -af $src_dir/libsrc/geom2d/*.hpp $dest_dir
cp -af $src_dir/libsrc/gprim/*.hpp $dest_dir
cp -af $src_dir/libsrc/interface/*.hpp $dest_dir
cp -af $src_dir/libsrc/linalg/*.hpp $dest_dir
cp -af $src_dir/libsrc/meshing/*.hpp $dest_dir
cp -af $src_dir/libsrc/stlgeom/*.hpp $dest_dir
cp -af $src_dir/libsrc/visualization/*.hpp $dest_dir
for directory in csg general geom2d gprim interface linalg meshing stlgeom visualization
do
cp -af ${src_dir}/libsrc/${directory}/*.hpp ${dest_dir}
done
cp -af ${src_dir}/libsrc/include/mystdlib.h ${dest_dir}
cp -af ${src_dir}/libsrc/include/mydefs.hpp ${dest_dir}
cp -af ${src_dir}/libsrc/occ/occgeom.hpp ${dest_dir}
cp -af ${src_dir}/libsrc/occ/occmeshsurf.hpp ${dest_dir}
cp -af ${src_dir}/libsrc/general/gzstream.h ${dest_dir}
test -f ${src_dir}/config.h && cp -af ${src_dir}/config.h ${dest_dir}
cp -af $src_dir/libsrc/occ/*.hpp $dest_dir
cp -af $src_dir/libsrc/occ/*.hxx $dest_dir
cp -af $src_dir/libsrc/occ/*.ixx $dest_dir
cp -af $src_dir/libsrc/occ/*.jxx $dest_dir
cp -af $src_dir/libsrc/occ/*.h $dest_dir
cp -af $src_dir/libsrc/include/mystdlib.h $dest_dir
cp -af $src_dir/libsrc/include/mydefs.hpp $dest_dir
# cp -af $src_dir/libsrc/include/parallel.hpp $dest_dir
rm -f $dest_dir/ngexception.hpp
rm -f $dest_dir/paralleltop.hpp
rm -f $dest_dir/soldata.hpp

View File

@ -1,4 +1,4 @@
# Copyright (C) 2012-2024 CEA, EDF, OPEN CASCADE
# Copyright (C) 2012-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@ -17,31 +17,25 @@
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
INCLUDE(UseQtExt)
# --- options ---
# additional include directories
INCLUDE_DIRECTORIES(
${QT_INCLUDES}
${KERNEL_INCLUDE_DIRS}
${GUI_INCLUDE_DIRS}
${GEOM_INCLUDE_DIRS}
${OpenCASCADE_INCLUDE_DIR}
${CAS_INCLUDE_DIRS}
${VTK_INCLUDE_DIRS}
${NETGEN_INCLUDE_DIRS}
${SMESH_INCLUDE_DIRS}
${MEDCOUPLING_INCLUDE_DIRS}
${Boost_INCLUDE_DIRS}
${OMNIORB_INCLUDE_DIR}
${PROJECT_BINARY_DIR}/idl
)
#Avoid compilation warnings from netgen headers
INCLUDE_DIRECTORIES( SYSTEM ${NETGEN_INCLUDE_DIRS} ${NETGEN_ZLIB_INCLUDE_DIRS} )
# additional preprocessor / compiler flags
ADD_DEFINITIONS(
${QT_DEFINITIONS}
ADD_DEFINITIONS(
${OMNIORB_DEFINITIONS}
${OpenCASCADE_DEFINITIONS}
${CAS_DEFINITIONS}
${BOOST_DEFINITIONS}
${NETGEN_DEFINITIONS}
)
@ -49,12 +43,34 @@ ADD_DEFINITIONS(
# libraries to link to
SET(_link_LIBRARIES
${NETGEN_LIBRARIES}
${OpenCASCADE_FoundationClasses_LIBRARIES}
${OpenCASCADE_ModelingData_LIBRARIES}
${OpenCASCADE_ModelingAlgorithms_LIBRARIES}
${OpenCASCADE_DataExchange_LIBRARIES}
${OpenCASCADE_Visualization_LIBRARIES}
${OpenCASCADE_ApplicationFramework_LIBRARIES}
${CAS_TKernel}
${CAS_TKBRep}
${CAS_TKShHealing}
${CAS_TKSTEP}
${CAS_TKXSBase}
${CAS_TKIGES}
${CAS_TKMesh}
${CAS_TKSTL}
${CAS_TKG3d}
${CAS_TKTopAlgo}
${CAS_TKG2d}
${CAS_TKBool}
${CAS_TKGeomAlgo}
${CAS_TKOffset}
${CAS_TKGeomBase}
${CAS_TKBO}
${CAS_TKMath}
${CAS_TKFillet}
${CAS_TKMeshVS}
${CAS_TKPrim}
${CAS_TKSTEPBase}
${CAS_TKSTEPAttr}
${CAS_TKSTEP209}
${CAS_TKXDESTEP}
${CAS_TKXDEIGES}
${CAS_TKXCAF}
${CAS_TKLCAF}
${CAS_FWOSPlugin}
${GEOM_GEOMbasic}
${SMESH_SMESHimpl}
${SMESH_SMESHEngine}
@ -68,45 +84,33 @@ SET(_link_LIBRARIES
${KERNEL_SalomeNS}
${KERNEL_SALOMELocalTrace}
${KERNEL_OpUtil}
VTK::CommonCore
VTK::CommonDataModel
SalomeIDLNETGENPLUGIN
Qt5::Core
)
# --- headers ---
# header files
SET(NETGENEngine_HEADERS
NETGENPlugin_NETGEN_3D.hxx
NETGENPlugin_NETGEN_3D_i.hxx
NETGENPlugin_NETGEN_2D.hxx
NETGENPlugin_NETGEN_2D_i.hxx
NETGENPlugin_NETGEN_2D3D.hxx
NETGENPlugin_NETGEN_2D3D_i.hxx
NETGENPlugin_NETGEN_2D_ONLY.hxx
NETGENPlugin_NETGEN_2D_ONLY_i.hxx
NETGENPlugin_Hypothesis.hxx
NETGENPlugin_Hypothesis_i.hxx
NETGENPlugin_Hypothesis_2D.hxx
NETGENPlugin_Hypothesis_2D_i.hxx
NETGENPlugin_Hypothesis_3D_i.hxx
NETGENPlugin_Hypothesis_2D_ONLY_i.hxx
NETGENPlugin_SimpleHypothesis_2D.hxx
NETGENPlugin_SimpleHypothesis_3D.hxx
NETGENPlugin_SimpleHypothesis_2D_i.hxx
NETGENPlugin_SimpleHypothesis_3D_i.hxx
NETGENPlugin_Mesher.hxx
NETGENPlugin_Remesher_2D.hxx
NETGENPlugin_NETGEN_3D.hxx
NETGENPlugin_NETGEN_3D_i.hxx
NETGENPlugin_NETGEN_2D.hxx
NETGENPlugin_NETGEN_2D_i.hxx
NETGENPlugin_NETGEN_2D3D.hxx
NETGENPlugin_NETGEN_2D3D_i.hxx
NETGENPlugin_NETGEN_2D_ONLY.hxx
NETGENPlugin_NETGEN_2D_ONLY_i.hxx
NETGENPlugin_Hypothesis.hxx
NETGENPlugin_Hypothesis_i.hxx
NETGENPlugin_Hypothesis_2D.hxx
NETGENPlugin_Hypothesis_2D_i.hxx
NETGENPlugin_Hypothesis_3D_i.hxx
NETGENPlugin_Hypothesis_2D_ONLY_i.hxx
NETGENPlugin_SimpleHypothesis_2D.hxx
NETGENPlugin_SimpleHypothesis_3D.hxx
NETGENPlugin_SimpleHypothesis_2D_i.hxx
NETGENPlugin_SimpleHypothesis_3D_i.hxx
NETGENPlugin_Mesher.hxx
NETGENPlugin_Defs.hxx
NETGENPlugin_DriverParam.hxx
NETGENPlugin_NETGEN_3D_SA.hxx
NETGENPlugin_NETGEN_2D_SA.hxx
NETGENPlugin_NETGEN_1D2D3D_SA.hxx
NETGENPlugin_NETGEN_3D_Remote.hxx
NETGENPlugin_NETGEN_3D_Remote_i.hxx
NETGENPlugin_NETGEN_2D_Remote.hxx
NETGENPlugin_NETGEN_2D_Remote_i.hxx
)
# --- sources ---
@ -132,20 +136,7 @@ SET(NETGENEngine_SOURCES
NETGENPlugin_SimpleHypothesis_3D.cxx
NETGENPlugin_SimpleHypothesis_2D_i.cxx
NETGENPlugin_SimpleHypothesis_3D_i.cxx
NETGENPlugin_Remesher_2D.cxx
NETGENPlugin_i.cxx
NETGENPlugin_DriverParam.cxx
NETGENPlugin_NETGEN_3D_SA.cxx
NETGENPlugin_NETGEN_2D_SA.cxx
NETGENPlugin_NETGEN_1D2D3D_SA.cxx
NETGENPlugin_NETGEN_3D_Remote.cxx
NETGENPlugin_NETGEN_3D_Remote_i.cxx
NETGENPlugin_NETGEN_2D_Remote.cxx
NETGENPlugin_NETGEN_2D_Remote_i.cxx
)
SET(NetgenRunner_SOURCES
NETGENPlugin_Runner_main.cxx
)
# --- scripts ---
@ -162,10 +153,6 @@ ADD_LIBRARY(NETGENEngine ${NETGENEngine_SOURCES})
TARGET_LINK_LIBRARIES(NETGENEngine ${_link_LIBRARIES} )
INSTALL(TARGETS NETGENEngine EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS})
ADD_EXECUTABLE(NETGENPlugin_Runner ${NetgenRunner_SOURCES})
TARGET_LINK_LIBRARIES(NETGENPlugin_Runner ${_link_LIBRARIES} NETGENEngine )
INSTALL(TARGETS NETGENPlugin_Runner EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_BINS})
INSTALL(FILES ${NETGENEngine_HEADERS} DESTINATION ${SALOME_INSTALL_HEADERS})
SALOME_INSTALL_SCRIPTS("${_bin_SCRIPTS}" ${SALOME_INSTALL_PYTHON}/salome/NETGENPlugin)

View File

@ -1,4 +1,4 @@
# Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE
# Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@ -32,29 +32,23 @@ except ImportError:
noNETGENPlugin = 1
pass
LIBRARY = "libNETGENEngine.so"
NETGEN_VERSION_MAJOR = NETGENPlugin.NETGEN_VERSION_MAJOR
#----------------------------
# Mesh algo type identifiers
#----------------------------
## Algorithm type: Netgen tetrahedron 3D algorithm, see NETGEN_3D_Algorithm
## Algorithm type: Netgen tetrahedron 3D algorithm, see NETGEN_3D_Algorithm
NETGEN_3D = "NETGEN_3D"
NETGEN_3D_Remote = "NETGEN_3D_Remote"
## Algorithm type: Netgen tetrahedron 1D-2D-3D algorithm, see NETGEN_1D2D3D_Algorithm
## Algorithm type: Netgen tetrahedron 1D-2D-3D algorithm, see NETGEN_1D2D3D_Algorithm
NETGEN_1D2D3D = "NETGEN_2D3D"
## Algorithm type: Netgen triangle 1D-2D algorithm, see NETGEN_1D2D_Algorithm
## Algorithm type: Netgen triangle 1D-2D algorithm, see NETGEN_1D2D_Algorithm
NETGEN_1D2D = "NETGEN_2D"
## Algorithm type: Netgen triangle 2D algorithm, see NETGEN_2D_Only_Algorithm
NETGEN_2D = "NETGEN_2D_ONLY"
NETGEN_2D_Remote = "NETGEN_2D_Remote"
## Algorithm type: Synonim of NETGEN_1D2D3D, see NETGEN_1D2D3D_Algorithm
## Algorithm type: Synonim of NETGEN_1D2D3D, see NETGEN_1D2D3D_Algorithm
NETGEN_FULL = NETGEN_1D2D3D
## Algorithm type: Synonim of NETGEN_3D, see NETGEN_3D_Algorithm
## Algorithm type: Synonim of NETGEN_3D, see NETGEN_3D_Algorithm
NETGEN = NETGEN_3D
## Algorithm type: Synonim of NETGEN_1D2D3D, see NETGEN_1D2D3D_Algorithm
## Algorithm type: Synonim of NETGEN_1D2D3D, see NETGEN_1D2D3D_Algorithm
FULL_NETGEN = NETGEN_FULL
#----------------------------
@ -109,12 +103,8 @@ class NETGEN_Algorithm(Mesh_Algorithm):
# if it is @c 0 (default), the algorithm is assigned to the main shape
def __init__(self, mesh, geom=0):
Mesh_Algorithm.__init__(self)
if noNETGENPlugin: print("Warning: NETGENPlugin module unavailable")
if not mesh.GetMesh().HasShapeToMesh() and \
self.meshMethod == "Triangle": # create a 2D remesher
self.Create(mesh, geom, "NETGEN_Remesher_2D", LIBRARY)
else:
self.Create(mesh, geom, self.algoType, LIBRARY)
if noNETGENPlugin: print "Warning: NETGENPlugin module unavailable"
self.Create(mesh, geom, self.algoType, "libNETGENEngine.so")
self.params = None
pass
@ -149,12 +139,6 @@ class NETGEN_Algorithm(Mesh_Algorithm):
if self.Parameters(): self.params.SetGrowthRate(theRate)
pass
## Sets @c NbThreads parameter
# @param theRate new value of the @c NbThreads parameter
def SetNbThreads(self, theNumber):
if self.Parameters(): self.params.SetNbThreads(theNumber)
pass
## Creates meshing hypothesis according to the chosen algorithm type
# and initializes it with default parameters
# @param which hypothesis type; can be either @ref SOLE (default) or @ref SIMPLE
@ -170,36 +154,19 @@ class NETGEN_Algorithm(Mesh_Algorithm):
hypType = "NETGEN_SimpleParameters_3D"
else:
hypType = "NETGEN_Parameters"
elif self.algoType in [NETGEN_2D, NETGEN_2D_Remote]:
elif self.algoType == NETGEN_2D:
hypType = "NETGEN_Parameters_2D_ONLY"
else:
hypType = "NETGEN_Parameters_3D"
if self.algo.GetName() == "NETGEN_Remesher_2D":
hypType = "NETGEN_RemesherParameters_2D"
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, [], LIBRARY, UseExisting=0)
self.params = self.Hypothesis(hypType, [],"libNETGENEngine.so",UseExisting=0)
return self.params
## Defines a file specifying size of elements at points and lines
# @param file name of the file
def SetMeshSizeFile(self, file):
self.Parameters().SetMeshSizeFile(file)
pass
## Set size of elements on a shape
# @param shape - geometry
# @param size - element size
def SetLocalSizeOnShape(self, shape, size ):
self.Parameters().SetLocalSizeOnShape(shape, size)
pass
pass # end of NETGEN_Algorithm class
@ -246,21 +213,6 @@ class NETGEN_1D2D3D_Algorithm(NETGEN_Algorithm):
if self.Parameters(): self.params.SetNbSegPerRadius(theVal)
pass
## Sets @c ChordalError parameter
# @param theVal new value of the @c ChordalError parameter
def SetChordalError(self, theVal):
if self.Parameters():
self.params.SetChordalError(theVal)
self.params.SetChordalErrorEnabled( theVal > 0 )
pass
## Sets @c RidgeAngle parameter
# @param theVal new value of the @c RidgeAngle parameter
def SetRidgeAngle(self, theVal):
if self.Parameters():
self.params.SetRidgeAngle(theVal)
pass
## Sets @c QuadAllowed flag
# @param toAllow new value of the @c QuadAllowed parameter (@c True by default)
def SetQuadAllowed(self, toAllow=True):
@ -318,7 +270,7 @@ class NETGEN_1D2D3D_Algorithm(NETGEN_Algorithm):
pass # end of NETGEN_1D2D3D_Algorithm class
## Triangle NETGEN 1D-2D algorithm.
## Triangle NETGEN 1D-2D algorithm.
#
# It can be created by calling smeshBuilder.Mesh.Triangle( smeshBuilder.NETGEN_1D2D, geom=0 )
#
@ -336,7 +288,6 @@ class NETGEN_1D2D_Algorithm(NETGEN_1D2D3D_Algorithm):
# @internal
docHelper = "Creates triangle 2D algorithm for faces"
## Private constructor.
# @param mesh parent mesh object algorithm is assigned to
# @param geom geometry (shape/sub-shape) algorithm is assigned to;
@ -363,15 +314,10 @@ class NETGEN_2D_Only_Algorithm(NETGEN_Algorithm):
## type of algorithm used with helper function in smeshBuilder.Mesh class
# @internal
algoType = NETGEN_2D
## flag pointing whether this algorithm should be used by default in dynamic method
# of smeshBuilder.Mesh class
isDefault = True
## doc string of the method
# @internal
docHelper = "Creates triangle 2D algorithm for faces"
isDefault = True
## Private constructor.
# @param mesh parent mesh object algorithm is assigned to
# @param geom geometry (shape/sub-shape) algorithm is assigned to;
@ -399,7 +345,7 @@ class NETGEN_2D_Only_Algorithm(NETGEN_Algorithm):
def LengthFromEdges(self):
hyp = self.Hypothesis("LengthFromEdges", UseExisting=1, CompareMethod=self.CompareEqualHyp)
return hyp
## Sets @c UseSurfaceCurvature flag
# @param toUse new value of the @c UseSurfaceCurvature parameter (@c True by default)
def SetUseSurfaceCurvature(self, toUse=True):
@ -481,64 +427,6 @@ class NETGEN_3D_Algorithm(NETGEN_Algorithm):
pass # end of NETGEN_3D_Algorithm class
## Tetrahedron 3D algorithm
#
# It can be created by calling smeshBuilder.Mesh.Tetrahedron() or smeshBuilder.Mesh.Tetrahedron( smeshBuilder.NETGEN, geom=0 )
#
# This algorithm generates only 3D (volumes) elements for given geometrical shape
# and, in contrast to NETGEN_1D2D3D_Algorithm class, should be used in conjunction
# with other 1D and 2D meshing algorithms.
class NETGEN_3D_Remote_Algorithm(NETGEN_3D_Algorithm):
## type of algorithm used with helper function in smeshBuilder.Mesh class
# @internal
algoType = NETGEN_3D_Remote
## flag pointing either this algorithm should be used by default in dynamic method
# of smeshBuilder.Mesh class
# @internal
isDefault = False
## doc string of the method
# @internal
docHelper = "Remotely Creates tetrahedron 3D algorithm for solids"
## Private constructor.
# @param mesh parent mesh object algorithm is assigned to
# @param geom geometry (shape/sub-shape) algorithm is assigned to;
# if it is @c 0 (default), the algorithm is assigned to the main shape
def __init__(self, mesh, geom=0):
NETGEN_3D_Algorithm.__init__(self, mesh, geom)
pass
pass # end of NETGEN_3D_Remote_Algorithm class
## Tetrahedron 2D algorithm
#
# It can be created by calling smeshBuilder.Mesh.Triangle() or smeshBuilder.Mesh.Triangle( smeshBuilder.NETGEN, geom=0 )
#
class NETGEN_2D_Remote_Algorithm(NETGEN_2D_Only_Algorithm):
## type of algorithm used with helper function in smeshBuilder.Mesh class
# @internal
algoType = NETGEN_2D_Remote
## flag pointing either this algorithm should be used by default in dynamic method
# of smeshBuilder.Mesh class
# @internal
isDefault = False
## doc string of the method
# @internal
docHelper = "Remotely Creates triangles in face of solids"
## Private constructor.
# @param mesh parent mesh object algorithm is assigned to
# @param geom geometry (shape/sub-shape) algorithm is assigned to;
# if it is @c 0 (default), the algorithm is assigned to the main shape
def __init__(self, mesh, geom=0):
self.algoType = NETGEN_2D_Remote
NETGEN_2D_Only_Algorithm.__init__(self, mesh, geom)
pass
pass # end of NETGEN_2D_Remote_Algorithm class
## Triangle (helper) 1D-2D algorithm
#

13
src/NETGENPlugin/NETGENPlugin_Defs.hxx Normal file → Executable file
View File

@ -1,4 +1,4 @@
// Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE
// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@ -28,24 +28,13 @@
#define _NETGENPlugin_DEFS_HXX_
#ifdef WIN32
#if defined NETGENPLUGIN_EXPORTS || defined NETGENEngine_EXPORTS
#define NETGENPLUGIN_EXPORT __declspec( dllexport )
#else
#define NETGENPLUGIN_EXPORT __declspec( dllimport )
#endif
#if defined(NETGEN_V5) || defined(NETGEN_V6)
#define NETGENPLUGIN_DLL_HEADER DLL_HEADER
#else
#define NETGENPLUGIN_DLL_HEADER
#endif
#else
#define NETGENPLUGIN_EXPORT
#define NETGENPLUGIN_DLL_HEADER
#endif
#endif

View File

@ -1,225 +0,0 @@
// Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File : NETGENPlugin_DriverParam.hxx
// Author : Yoann AUDOUIN, EDF
// Module : NETGEN
//
#include "NETGENPlugin_DriverParam.hxx"
#include <iostream>
#include <fstream>
#include <string>
#include <cassert>
/**
* @brief Print content of a netgen_params
*
* @param aParams The object to display
*/
void printNetgenParams(netgen_params& aParams){
if ( aParams.myType == Hypo )
{
std::cout << "has_netgen_param: " << aParams.has_netgen_param << std::endl;
std::cout << "maxh: " << aParams.maxh << std::endl;
std::cout << "minh: " << aParams.minh << std::endl;
std::cout << "segmentsperedge: " << aParams.segmentsperedge << std::endl;
std::cout << "grading: " << aParams.grading << std::endl;
std::cout << "curvaturesafety: " << aParams.curvaturesafety << std::endl;
std::cout << "secondorder: " << aParams.secondorder << std::endl;
std::cout << "quad: " << aParams.quad << std::endl;
std::cout << "optimize: " << aParams.optimize << std::endl;
std::cout << "fineness: " << aParams.fineness << std::endl;
std::cout << "uselocalh: " << aParams.uselocalh << std::endl;
std::cout << "merge_solids: " << aParams.merge_solids << std::endl;
std::cout << "chordalError: " << aParams.chordalError << std::endl;
std::cout << "optsteps2d: " << aParams.optsteps2d << std::endl;
std::cout << "optsteps3d: " << aParams.optsteps3d << std::endl;
std::cout << "elsizeweight: " << aParams.elsizeweight << std::endl;
std::cout << "opterrpow: " << aParams.opterrpow << std::endl;
std::cout << "delaunay: " << aParams.delaunay << std::endl;
std::cout << "checkoverlap: " << aParams.checkoverlap << std::endl;
std::cout << "checkchartboundary: " << aParams.checkchartboundary << std::endl;
std::cout << "closeedgefac: " << aParams.closeedgefac << std::endl;
std::cout << "nbThreadMesher: " << aParams.nbThreads << std::endl;
std::cout << "has_local_size: " << aParams.has_local_size << std::endl;
std::cout << "meshsizefilename: " << aParams.meshsizefilename << std::endl;
std::cout << "has_maxelementvolume_hyp: " << aParams.has_maxelementvolume_hyp << std::endl;
std::cout << "maxElementVolume: " << aParams.maxElementVolume << std::endl;
std::cout << "has_LengthFromEdges_hyp: " << aParams.has_LengthFromEdges_hyp << std::endl;
}
}
void importDefaultNetgenParams(const std::string param_file, netgen_params& aParams)
{
std::ifstream myfile(param_file);
std::string line;
// set the default type!
aParams.myType = Hypo;
std::getline(myfile, line);
aParams.has_netgen_param = std::stoi(line);
std::getline(myfile, line);
aParams.maxh = std::stod(line);
std::getline(myfile, line);
aParams.minh = std::stod(line);
std::getline(myfile, line);
aParams.segmentsperedge = std::stod(line);
std::getline(myfile, line);
aParams.grading = std::stod(line);
std::getline(myfile, line);
aParams.curvaturesafety = std::stod(line);
std::getline(myfile, line);
aParams.secondorder = std::stoi(line);
std::getline(myfile, line);
aParams.quad = std::stoi(line);
std::getline(myfile, line);
aParams.optimize = std::stoi(line);
std::getline(myfile, line);
aParams.fineness = std::stoi(line);
std::getline(myfile, line);
aParams.uselocalh = std::stoi(line);
std::getline(myfile, line);
aParams.merge_solids = std::stoi(line);
std::getline(myfile, line);
aParams.chordalError = std::stod(line);
std::getline(myfile, line);
aParams.optsteps2d = std::stoi(line);
std::getline(myfile, line);
aParams.optsteps3d = std::stoi(line);
std::getline(myfile, line);
aParams.elsizeweight = std::stod(line);
std::getline(myfile, line);
aParams.opterrpow = std::stoi(line);
std::getline(myfile, line);
aParams.delaunay = std::stoi(line);
std::getline(myfile, line);
aParams.checkoverlap = std::stoi(line);
std::getline(myfile, line);
aParams.checkchartboundary = std::stoi(line);
std::getline(myfile, line);
aParams.closeedgefac = std::stoi(line);
std::getline(myfile, line);
aParams.nbThreads = std::stoi(line);
std::getline(myfile, line);
aParams.has_local_size = std::stoi(line);
std::getline(myfile, line);
aParams.meshsizefilename = line;
std::getline(myfile, line);
aParams.has_maxelementvolume_hyp = std::stoi(line);
std::getline(myfile, line);
aParams.maxElementVolume = std::stod(line);
std::getline(myfile, line);
aParams.maxElementVolume = std::stoi(line);
myfile.close();
}
void importSimple2D3DNetgenParams(const std::string param_file, netgen_params& aParams, bool is3D )
{
std::ifstream myfile(param_file);
std::string line;
aParams.myType = !is3D ? Simple2D : Simple3D;
std::getline(myfile, line);
aParams.has_netgen_param = std::stoi(line); // 1
std::getline(myfile, line);
aParams.numberOfSegments = std::stoi(line); // segments (int)
std::getline(myfile, line);
aParams.localLength = std::stod(line); // localLenght (double)
std::getline(myfile, line);
aParams.maxElementArea = std::stod(line); // max area (double)
if ( is3D )
{
std::getline(myfile, line);
aParams.maxElementVol = std::stod(line); // max volume (double)
}
std::getline(myfile, line);
aParams.allowQuadrangles = std::stoi(line); // int
myfile.close();
};
/**
* @brief Import a param_file into a netgen_params structure
*
* @param param_file Name of the file
* @param aParams Structure to fill
*/
void importNetgenParams(const std::string param_file, netgen_params& aParams){
if ( param_file.find("simple2D") != std::string::npos || param_file.find("simple3D") != std::string::npos /*support simple 2D && 3D*/ )
{
importSimple2D3DNetgenParams( param_file, aParams, bool(param_file.find("simple3D") != std::string::npos) );
}
else if ( param_file.find("maxarea") == std::string::npos && param_file.find("lenghtfromedge") == std::string::npos /*hypo file for 2D SA*/)
{
importDefaultNetgenParams( param_file, aParams );
}
else
{
aParams.has_netgen_param = false;
}
};
/**
* @brief Writes the content of a netgen_param into a file
*
* @param param_file the file
* @param aParams the object
*/
void exportNetgenParams(const std::string param_file, netgen_params& aParams){
if ( aParams.myType == Hypo ){
std::ofstream myfile(param_file);
myfile << aParams.has_netgen_param << std::endl;
myfile << aParams.maxh << std::endl;
myfile << aParams.minh << std::endl;
myfile << aParams.segmentsperedge << std::endl;
myfile << aParams.grading << std::endl;
myfile << aParams.curvaturesafety << std::endl;
myfile << aParams.secondorder << std::endl;
myfile << aParams.quad << std::endl;
myfile << aParams.optimize << std::endl;
myfile << aParams.fineness << std::endl;
myfile << aParams.uselocalh << std::endl;
myfile << aParams.merge_solids << std::endl;
myfile << aParams.chordalError << std::endl;
myfile << aParams.optsteps2d << std::endl;
myfile << aParams.optsteps3d << std::endl;
myfile << aParams.elsizeweight << std::endl;
myfile << aParams.opterrpow << std::endl;
myfile << aParams.delaunay << std::endl;
myfile << aParams.checkoverlap << std::endl;
myfile << aParams.checkchartboundary << std::endl;
myfile << aParams.closeedgefac << std::endl;
myfile << aParams.nbThreads << std::endl;
myfile << aParams.has_local_size << std::endl;
myfile << aParams.meshsizefilename << std::endl;
myfile << aParams.has_maxelementvolume_hyp << std::endl;
myfile << aParams.maxElementVolume << std::endl;
myfile << aParams.has_LengthFromEdges_hyp << std::endl;
}
else if ( aParams.myType == Simple2D )
{
// TODO: Export the 2D && 3D simple versions
}
};

View File

@ -1,99 +0,0 @@
// Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File : NETGENPlugin_DriverParam.hxx
// Author : Yoann AUDOUIN, EDF
// Module : NETGEN
//
#ifndef _NETGENPLUGIN_DRIVERPARAM_HXX_
#define _NETGENPLUGIN_DRIVERPARAM_HXX_
#include <string>
enum hypoType{
Hypo = 1, /*the default hypo common for 1D2D,1D2D3D && 3D*/
Simple2D,
Simple3D
};
struct netgen_params{
// Params from NETGENPlugin_Mesher
// True if _hypParameters is not null
bool has_netgen_param=true;
hypoType myType;
double maxh;
double minh;
double segmentsperedge;
double grading;
double curvaturesafety;
int secondorder;
int quad;
bool optimize;
int fineness;
bool uselocalh;
bool merge_solids;
double chordalError;
int optsteps2d;
int optsteps3d;
double elsizeweight;
int opterrpow;
bool delaunay;
bool checkoverlap;
bool checkchartboundary;
int closeedgefac;
// Number of threads for the mesher
int nbThreads;
// True if we have a mesh size file or local size info
bool has_local_size = false;
std::string meshsizefilename;
// Params from NETGEN3D
// True if _hypMaxElementVolume is not null
bool has_maxelementvolume_hyp=false;
double maxElementVolume=0.0;
// Params from NETGEN2D
bool has_LengthFromEdges_hyp=false;
/////////////////////////////////////
// Quantities proper of Simple2D
int numberOfSegments; // maybe reuse segmentsperedge (?)
double localLength;
double maxElementArea;
bool allowQuadrangles;
//// Quantities proper of Simple3D
double maxElementVol;
};
void printNetgenParams(netgen_params& aParams);
void importNetgenParams(const std::string param_file, netgen_params& aParams);
void importDefaultNetgenParams(const std::string param_file, netgen_params& aParams);
void importSimple2D3DNetgenParams(const std::string param_file, netgen_params& aParams, bool is3D );
void exportNetgenParams(const std::string param_file, netgen_params& aParams);
// TODO symple param to be used with netgen1d2d
#endif

View File

@ -1,4 +1,4 @@
// Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE
// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@ -37,41 +37,33 @@ using namespace std;
//=============================================================================
/*!
*
*
*/
//=============================================================================
NETGENPlugin_Hypothesis::NETGENPlugin_Hypothesis (int hypId, SMESH_Gen * gen)
: SMESH_Hypothesis(hypId, gen),
_fineness (GetDefaultFineness()),
_secondOrder (GetDefaultSecondOrder()),
_quadAllowed (GetDefaultQuadAllowed()),
_maxSize (GetDefaultMaxSize()),
_minSize (0),
_growthRate (GetDefaultGrowthRate()),
_nbSegPerRadius (GetDefaultNbSegPerRadius()),
_nbSegPerEdge (GetDefaultNbSegPerEdge()),
_chordalErrorEnabled(GetDefaultChordalError() > 0),
_chordalError (GetDefaultChordalError() ),
_optimize (GetDefaultOptimize()),
_nbSurfOptSteps (GetDefaultNbSurfOptSteps()),
_nbVolOptSteps (GetDefaultNbVolOptSteps()),
_elemSizeWeight (GetDefaultElemSizeWeight()),
_worstElemMeasure (GetDefaultWorstElemMeasure()),
_nbThreads (GetDefaultNbThreads()),
_surfaceCurvature (GetDefaultSurfaceCurvature()),
_useDelauney (GetDefaultUseDelauney()),
_checkOverlapping (GetDefaultCheckOverlapping()),
_checkChartBoundary (GetDefaultCheckChartBoundary()),
_fuseEdges (GetDefaultFuseEdges())
NETGENPlugin_Hypothesis::NETGENPlugin_Hypothesis (int hypId, int studyId,
SMESH_Gen * gen)
: SMESH_Hypothesis(hypId, studyId, gen),
_maxSize (GetDefaultMaxSize()),
_minSize (0),
_growthRate (GetDefaultGrowthRate()),
_nbSegPerEdge (GetDefaultNbSegPerEdge()),
_nbSegPerRadius (GetDefaultNbSegPerRadius()),
_fineness (GetDefaultFineness()),
_secondOrder (GetDefaultSecondOrder()),
_optimize (GetDefaultOptimize()),
_localSize (GetDefaultLocalSize()),
_quadAllowed (GetDefaultQuadAllowed()),
_surfaceCurvature(GetDefaultSurfaceCurvature()),
_fuseEdges (GetDefaultFuseEdges())
{
_name = "NETGEN_Parameters";
_param_algo_dim = 3;
_localSize.clear();
}
//=============================================================================
/*!
*
*
*/
//=============================================================================
void NETGENPlugin_Hypothesis::SetMaxSize(double theSize)
@ -85,7 +77,7 @@ void NETGENPlugin_Hypothesis::SetMaxSize(double theSize)
//=============================================================================
/*!
*
*
*/
//=============================================================================
void NETGENPlugin_Hypothesis::SetMinSize(double theSize)
@ -99,7 +91,7 @@ void NETGENPlugin_Hypothesis::SetMinSize(double theSize)
//=============================================================================
/*!
*
*
*/
//=============================================================================
void NETGENPlugin_Hypothesis::SetSecondOrder(bool theVal)
@ -113,7 +105,7 @@ void NETGENPlugin_Hypothesis::SetSecondOrder(bool theVal)
//=============================================================================
/*!
*
*
*/
//=============================================================================
void NETGENPlugin_Hypothesis::SetOptimize(bool theVal)
@ -127,7 +119,7 @@ void NETGENPlugin_Hypothesis::SetOptimize(bool theVal)
//=============================================================================
/*!
*
*
*/
//=============================================================================
void NETGENPlugin_Hypothesis::SetFineness(Fineness theFineness)
@ -173,7 +165,7 @@ void NETGENPlugin_Hypothesis::SetFineness(Fineness theFineness)
//=============================================================================
/*!
*
*
*/
//=============================================================================
void NETGENPlugin_Hypothesis::SetGrowthRate(double theRate)
@ -188,7 +180,7 @@ void NETGENPlugin_Hypothesis::SetGrowthRate(double theRate)
//=============================================================================
/*!
*
*
*/
//=============================================================================
void NETGENPlugin_Hypothesis::SetNbSegPerEdge(double theVal)
@ -203,7 +195,7 @@ void NETGENPlugin_Hypothesis::SetNbSegPerEdge(double theVal)
//=============================================================================
/*!
*
*
*/
//=============================================================================
void NETGENPlugin_Hypothesis::SetNbSegPerRadius(double theVal)
@ -218,49 +210,21 @@ void NETGENPlugin_Hypothesis::SetNbSegPerRadius(double theVal)
//=============================================================================
/*!
*
*/
//=============================================================================
void NETGENPlugin_Hypothesis::SetChordalErrorEnabled(bool theVal)
{
if (theVal != _chordalErrorEnabled)
{
_chordalErrorEnabled = theVal;
NotifySubMeshesHypothesisModification();
}
}
//=============================================================================
/*!
*
*/
//=============================================================================
void NETGENPlugin_Hypothesis::SetChordalError(double theVal)
{
if (theVal != _chordalError)
{
_chordalError = theVal;
NotifySubMeshesHypothesisModification();
}
}
//=============================================================================
/*!
*
*
*/
//=============================================================================
void NETGENPlugin_Hypothesis::SetLocalSizeOnEntry(const std::string& entry, double localSize)
{
if(_localSize[entry] != localSize)
{
_localSize[entry] = localSize;
NotifySubMeshesHypothesisModification();
}
{
_localSize[entry] = localSize;
NotifySubMeshesHypothesisModification();
}
}
//=============================================================================
/*!
*
*
*/
//=============================================================================
double NETGENPlugin_Hypothesis::GetLocalSizeOnEntry(const std::string& entry)
@ -274,7 +238,7 @@ double NETGENPlugin_Hypothesis::GetLocalSizeOnEntry(const std::string& entry)
//=============================================================================
/*!
*
*
*/
//=============================================================================
void NETGENPlugin_Hypothesis::UnsetLocalSizeOnEntry(const std::string& entry)
@ -285,21 +249,7 @@ void NETGENPlugin_Hypothesis::UnsetLocalSizeOnEntry(const std::string& entry)
//=============================================================================
/*!
*
*/
//=============================================================================
void NETGENPlugin_Hypothesis::SetMeshSizeFile(const std::string& fileName)
{
if ( fileName != _meshSizeFile )
{
_meshSizeFile = fileName;
NotifySubMeshesHypothesisModification();
}
}
//=============================================================================
/*!
*
*
*/
//=============================================================================
void NETGENPlugin_Hypothesis::SetQuadAllowed(bool theVal)
@ -313,7 +263,17 @@ void NETGENPlugin_Hypothesis::SetQuadAllowed(bool theVal)
//=============================================================================
/*!
*
*
*/
//=============================================================================
bool NETGENPlugin_Hypothesis::GetDefaultQuadAllowed()
{
return false;
}
//=============================================================================
/*!
*
*/
//=============================================================================
void NETGENPlugin_Hypothesis::SetSurfaceCurvature(bool theVal)
@ -325,6 +285,16 @@ void NETGENPlugin_Hypothesis::SetSurfaceCurvature(bool theVal)
}
}
//=============================================================================
/*!
*
*/
//=============================================================================
bool NETGENPlugin_Hypothesis::GetDefaultSurfaceCurvature()
{
return true;
}
//=============================================================================
/*!
*
@ -339,116 +309,14 @@ void NETGENPlugin_Hypothesis::SetFuseEdges(bool theVal)
}
}
//=======================================================================
//function : SetNbSurfOptSteps
//purpose :
//=======================================================================
void NETGENPlugin_Hypothesis::SetNbSurfOptSteps( int theVal )
//=============================================================================
/*!
*
*/
//=============================================================================
bool NETGENPlugin_Hypothesis::GetDefaultFuseEdges()
{
if (theVal != _nbSurfOptSteps)
{
_nbSurfOptSteps = theVal;
NotifySubMeshesHypothesisModification();
}
}
//=======================================================================
//function : SetNbVolOptSteps
//purpose :
//=======================================================================
void NETGENPlugin_Hypothesis::SetNbVolOptSteps( int theVal )
{
if (theVal != _nbVolOptSteps)
{
_nbVolOptSteps = theVal;
NotifySubMeshesHypothesisModification();
}
}
//=======================================================================
//function : SetElemSizeWeight
//purpose :
//=======================================================================
void NETGENPlugin_Hypothesis::SetElemSizeWeight( double theVal )
{
if (theVal != _elemSizeWeight)
{
_elemSizeWeight = theVal;
NotifySubMeshesHypothesisModification();
}
}
//=======================================================================
//function : SetWorstElemMeasure
//purpose :
//=======================================================================
void NETGENPlugin_Hypothesis::SetWorstElemMeasure( int theVal )
{
if (theVal != _worstElemMeasure)
{
_worstElemMeasure = theVal;
NotifySubMeshesHypothesisModification();
}
}
//=======================================================================
//function : SetUseDelauney
//purpose :
//=======================================================================
void NETGENPlugin_Hypothesis::SetUseDelauney( bool theVal )
{
if (theVal != _useDelauney )
{
_useDelauney = theVal;
NotifySubMeshesHypothesisModification();
}
}
//=======================================================================
//function : SetCheckOverlapping
//purpose :
//=======================================================================
void NETGENPlugin_Hypothesis::SetCheckOverlapping( bool theVal )
{
if (theVal != _checkOverlapping )
{
_checkOverlapping = theVal;
NotifySubMeshesHypothesisModification();
}
}
//=======================================================================
//function : SetCheckChartBoundary
//purpose :
//=======================================================================
void NETGENPlugin_Hypothesis::SetCheckChartBoundary( bool theVal )
{
if (theVal != _checkChartBoundary)
{
_checkChartBoundary = theVal;
NotifySubMeshesHypothesisModification();
}
}
//=======================================================================
//function : SetNbThreads
//purpose :
//=======================================================================
void NETGENPlugin_Hypothesis::SetNbThreads( int theVal )
{
if (theVal != _nbThreads)
{
_nbThreads = theVal;
NotifySubMeshesHypothesisModification();
}
return true; // false; -- for SALOME_TESTS/Grids/smesh/3D_mesh_NETGEN_05/F6
}
//=============================================================================
@ -469,8 +337,8 @@ ostream & NETGENPlugin_Hypothesis::SaveTo(ostream & save)
if (it_sm != _localSize.end()) {
save << " " << "__LOCALSIZE_BEGIN__";
for ( ; it_sm != _localSize.end(); ++it_sm ) {
save << " " << it_sm->first
<< " " << it_sm->second << "%#"; // "%#" is a mark of value end
save << " " << it_sm->first
<< " " << it_sm->second << "%#"; // "%#" is a mark of value end
}
save << " " << "__LOCALSIZE_END__";
}
@ -479,28 +347,12 @@ ostream & NETGENPlugin_Hypothesis::SaveTo(ostream & save)
save << " " << _surfaceCurvature;
save << " " << _fuseEdges;
save << " " << _meshSizeFile.size() << " " << _meshSizeFile;
save << " " << ( _chordalErrorEnabled ? _chordalError : 0. );
// added for option set completion
save << " " << _nbSurfOptSteps;
save << " " << _nbVolOptSteps;
save << " " << _elemSizeWeight;
save << " " << _worstElemMeasure;
save << " " << _useDelauney;
save << " " << _checkOverlapping;
save << " " << _checkChartBoundary;
return save;
}
//=============================================================================
/*!
*
*
*/
//=============================================================================
istream & NETGENPlugin_Hypothesis::LoadFrom(istream & load)
@ -509,13 +361,13 @@ istream & NETGENPlugin_Hypothesis::LoadFrom(istream & load)
int is;
double val;
isOK = static_cast<bool>(load >> val);
isOK = (load >> val);
if (isOK)
_maxSize = val;
else
load.clear(ios::badbit | load.rdstate());
isOK = static_cast<bool>(load >> is);
isOK = (load >> is);
if (isOK)
SetFineness((Fineness) is);
else
@ -523,32 +375,32 @@ istream & NETGENPlugin_Hypothesis::LoadFrom(istream & load)
if (_fineness == UserDefined)
{
isOK = static_cast<bool>(load >> val);
isOK = (load >> val);
if (isOK)
_growthRate = val;
else
load.clear(ios::badbit | load.rdstate());
isOK = static_cast<bool>(load >> val);
isOK = (load >> val);
if (isOK)
_nbSegPerEdge = val;
else
load.clear(ios::badbit | load.rdstate());
isOK = static_cast<bool>(load >> val);
isOK = (load >> val);
if (isOK)
_nbSegPerRadius = val;
else
load.clear(ios::badbit | load.rdstate());
}
isOK = static_cast<bool>(load >> is);
isOK = (load >> is);
if (isOK)
_secondOrder = (bool) is;
else
load.clear(ios::badbit | load.rdstate());
isOK = static_cast<bool>(load >> is);
isOK = (load >> is);
if (isOK)
_optimize = (bool) is;
else
@ -557,18 +409,18 @@ istream & NETGENPlugin_Hypothesis::LoadFrom(istream & load)
std::string option_or_sm;
bool hasLocalSize = false;
isOK = static_cast<bool>(load >> option_or_sm);
isOK = (load >> option_or_sm);
if (isOK)
if (option_or_sm == "__LOCALSIZE_BEGIN__")
hasLocalSize = true;
std::string smEntry, smValue;
while (isOK && hasLocalSize) {
isOK = static_cast<bool>(load >> smEntry);
isOK = (load >> smEntry);
if (isOK) {
if (smEntry == "__LOCALSIZE_END__")
break;
isOK = static_cast<bool>(load >> smValue);
isOK = (load >> smValue);
}
if (isOK) {
std::istringstream tmp(smValue);
@ -580,75 +432,43 @@ istream & NETGENPlugin_Hypothesis::LoadFrom(istream & load)
if ( !hasLocalSize && !option_or_sm.empty() )
_minSize = atof( option_or_sm.c_str() );
else
load >> _minSize;
isOK = static_cast<bool>( load >> is );
if ( isOK )
_quadAllowed = (bool) is;
else
isOK = ( load >> _quadAllowed );
if ( !isOK )
_quadAllowed = GetDefaultQuadAllowed();
isOK = static_cast<bool>( load >> is );
if ( isOK )
_surfaceCurvature = (bool) is;
else
isOK = ( load >> _surfaceCurvature );
if ( !isOK )
_surfaceCurvature = GetDefaultSurfaceCurvature();
isOK = static_cast<bool>( load >> is );
if ( isOK )
_fuseEdges = (bool) is;
else
isOK = ( load >> _fuseEdges );
if ( !isOK )
_fuseEdges = GetDefaultFuseEdges();
isOK = static_cast<bool>( load >> is >> std::ws ); // size of meshSizeFile
if ( isOK && is > 0 )
{
_meshSizeFile.resize( is );
load.get( &_meshSizeFile[0], is+1 );
}
isOK = static_cast<bool>(load >> val);
if (isOK)
_chordalError = val;
else
load.clear(ios::badbit | load.rdstate());
_chordalErrorEnabled = ( _chordalError > 0 );
// added for option set completion
isOK = static_cast<bool>( load >> is );
if ( isOK )
_nbSurfOptSteps = is;
isOK = static_cast<bool>( load >> is );
if ( isOK )
_nbVolOptSteps = is;
isOK = static_cast<bool>( load >> val );
if ( isOK )
_elemSizeWeight = val;
isOK = static_cast<bool>( load >> is );
if ( isOK )
_worstElemMeasure = is;
isOK = static_cast<bool>( load >> is );
if ( isOK )
_useDelauney = (bool) is;
isOK = static_cast<bool>( load >> is );
if ( isOK )
_checkOverlapping = (bool) is;
isOK = static_cast<bool>( load >> is );
if ( isOK )
_checkChartBoundary = (bool) is;
return load;
}
//=============================================================================
/*!
*
*/
//=============================================================================
ostream & operator <<(ostream & save, NETGENPlugin_Hypothesis & hyp)
{
return hyp.SaveTo( save );
}
//=============================================================================
/*!
*
*/
//=============================================================================
istream & operator >>(istream & load, NETGENPlugin_Hypothesis & hyp)
{
return hyp.LoadFrom( load );
}
//================================================================================
/*!
* \brief Does nothing
@ -657,8 +477,8 @@ istream & NETGENPlugin_Hypothesis::LoadFrom(istream & load)
* \retval bool - always false
*/
//================================================================================
bool NETGENPlugin_Hypothesis::SetParametersByMesh(const SMESH_Mesh* /*theMesh*/,
const TopoDS_Shape& /*theShape*/)
bool NETGENPlugin_Hypothesis::SetParametersByMesh(const SMESH_Mesh* theMesh,
const TopoDS_Shape& theShape)
{
return false;
}
@ -681,14 +501,75 @@ bool NETGENPlugin_Hypothesis::SetParametersByDefaults(const TDefaults& dflts,
else if ( theMesh && theMesh->HasShapeToMesh() )
_minSize = NETGENPlugin_Mesher::GetDefaultMinSize( theMesh->GetShapeToMesh(), _maxSize );
if ( dflts._way == SMESH_Hypothesis::BY_AVERAGE_LENGTH )
{
_minSize = dflts._elemLength / 100.;
_nbSegPerEdge = 1;
_chordalError = dflts._elemLength / 2.;
_chordalErrorEnabled = true;
_quadAllowed = dflts._quadDominated;
}
return _nbSegPerEdge && _maxSize > 0;
}
//=============================================================================
/*!
*
*/
//=============================================================================
double NETGENPlugin_Hypothesis::GetDefaultMaxSize()
{
return 1000;
}
//=============================================================================
/*!
*
*/
//=============================================================================
NETGENPlugin_Hypothesis::Fineness NETGENPlugin_Hypothesis::GetDefaultFineness()
{
return Moderate;
}
//=============================================================================
/*!
*
*/
//=============================================================================
double NETGENPlugin_Hypothesis::GetDefaultGrowthRate()
{
return 0.3;
}
//=============================================================================
/*!
*
*/
//=============================================================================
double NETGENPlugin_Hypothesis::GetDefaultNbSegPerEdge()
{
return 1;
}
//=============================================================================
/*!
*
*/
//=============================================================================
double NETGENPlugin_Hypothesis::GetDefaultNbSegPerRadius()
{
return 2;
}
//=============================================================================
/*!
*
*/
//=============================================================================
bool NETGENPlugin_Hypothesis::GetDefaultSecondOrder()
{
return false;
}
//=============================================================================
/*!
*
*/
//=============================================================================
bool NETGENPlugin_Hypothesis::GetDefaultOptimize()
{
return true;
}

View File

@ -1,4 +1,4 @@
// Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE
// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@ -35,28 +35,29 @@
#include "Utils_SALOME_Exception.hxx"
#include <map>
#include <thread>
// Parameters for work of NETGEN
//
using namespace std;
class NETGENPLUGIN_EXPORT NETGENPlugin_Hypothesis: public SMESH_Hypothesis
{
public:
NETGENPlugin_Hypothesis(int hypId, SMESH_Gen * gen);
NETGENPlugin_Hypothesis(int hypId, int studyId, SMESH_Gen * gen);
void SetMaxSize(double theSize);
void SetMaxSize(double theSize);
double GetMaxSize() const { return _maxSize; }
void SetMinSize(double theSize);
void SetMinSize(double theSize);
double GetMinSize() const { return _minSize; }
void SetSecondOrder(bool theVal);
bool GetSecondOrder() const { return _secondOrder; }
void SetSecondOrder(bool theVal);
bool GetSecondOrder() const { return _secondOrder; }
void SetOptimize(bool theVal);
bool GetOptimize() const { return _optimize; }
void SetOptimize(bool theVal);
bool GetOptimize() const { return _optimize; }
enum Fineness
{
@ -68,92 +69,54 @@ public:
UserDefined
};
void SetFineness(Fineness theFineness);
void SetFineness(Fineness theFineness);
Fineness GetFineness() const { return _fineness; }
// the following 3 parameters are controlled by Fineness
// the following parameters are controlled by Fineness
void SetGrowthRate(double theRate);
void SetGrowthRate(double theRate);
double GetGrowthRate() const { return _growthRate; }
void SetNbSegPerEdge(double theVal);
void SetNbSegPerEdge(double theVal);
double GetNbSegPerEdge() const { return _nbSegPerEdge; }
void SetNbSegPerRadius(double theVal);
void SetNbSegPerRadius(double theVal);
double GetNbSegPerRadius() const { return _nbSegPerRadius; }
void SetChordalErrorEnabled(bool value);
double GetChordalErrorEnabled() const { return _chordalErrorEnabled; }
void SetChordalError(double value);
double GetChordalError() const { return _chordalError; }
typedef std::map<std::string, double> TLocalSize;
void SetLocalSizeOnEntry(const std::string& entry, double localSize);
static TLocalSize GetDefaultLocalSize() { return TLocalSize(); }
void SetLocalSizeOnEntry(const std::string& entry, double localSize);
double GetLocalSizeOnEntry(const std::string& entry);
const TLocalSize& GetLocalSizesAndEntries() const { return _localSize; }
void UnsetLocalSizeOnEntry(const std::string& entry);
void UnsetLocalSizeOnEntry(const std::string& entry);
void SetMeshSizeFile(const std::string& fileName);
const std::string& GetMeshSizeFile() const { return _meshSizeFile; }
void SetQuadAllowed(bool theVal);
bool GetQuadAllowed() const { return _quadAllowed; }
void SetQuadAllowed(bool theVal);
bool GetQuadAllowed() const { return _quadAllowed; }
void SetSurfaceCurvature(bool theVal);
bool GetSurfaceCurvature() const { return _surfaceCurvature; }
void SetSurfaceCurvature(bool theVal);
bool GetSurfaceCurvature() const { return _surfaceCurvature; }
void SetFuseEdges(bool theVal);
bool GetFuseEdges() const { return _fuseEdges; }
void SetNbSurfOptSteps( int nb );
int GetNbSurfOptSteps() const { return _nbSurfOptSteps; }
void SetNbVolOptSteps( int nb );
int GetNbVolOptSteps() const { return _nbVolOptSteps; }
void SetElemSizeWeight( double size );
double GetElemSizeWeight() const { return _elemSizeWeight; }
void SetWorstElemMeasure( int val );
int GetWorstElemMeasure() const { return _worstElemMeasure; }
void SetUseDelauney( bool toUse);
bool GetUseDelauney() const { return _useDelauney; }
void SetCheckOverlapping( bool toCheck );
bool GetCheckOverlapping() const { return _checkOverlapping; }
void SetCheckChartBoundary( bool toCheck );
bool GetCheckChartBoundary() const { return _checkChartBoundary; }
void SetNbThreads( int val );
int GetNbThreads() const { return _nbThreads; }
void SetFuseEdges(bool theVal);
bool GetFuseEdges() const { return _fuseEdges; }
// the default values (taken from NETGEN 4.5 sources)
static Fineness GetDefaultFineness() { return Moderate; }
static bool GetDefaultSecondOrder() { return false; }
static bool GetDefaultQuadAllowed() { return false; }
static double GetDefaultMaxSize() { return 1000; }
static double GetDefaultGrowthRate() { return 0.3; }
static double GetDefaultNbSegPerRadius() { return 2; }
static double GetDefaultNbSegPerEdge() { return 1; }
static double GetDefaultChordalError() { return -1; } // disabled by default
static bool GetDefaultOptimize() { return true; }
static int GetDefaultNbSurfOptSteps() { return 3; }
static int GetDefaultNbVolOptSteps() { return 3; }
static double GetDefaultElemSizeWeight() { return 0.2; }
static int GetDefaultWorstElemMeasure() { return 2; }
static bool GetDefaultSurfaceCurvature() { return true; }
static bool GetDefaultUseDelauney() { return true; }
static bool GetDefaultCheckOverlapping() { return true; }
static bool GetDefaultCheckChartBoundary(){ return true; }
static bool GetDefaultFuseEdges() { return true; }
static int GetDefaultNbThreads() { return std::thread::hardware_concurrency(); }
static double GetDefaultMaxSize();
static Fineness GetDefaultFineness();
static double GetDefaultGrowthRate();
static double GetDefaultNbSegPerEdge();
static double GetDefaultNbSegPerRadius();
static bool GetDefaultSecondOrder();
static bool GetDefaultOptimize();
static bool GetDefaultQuadAllowed();
static bool GetDefaultSurfaceCurvature();
static bool GetDefaultFuseEdges();
// Persistence
virtual std::ostream & SaveTo (std::ostream & save);
virtual std::istream & LoadFrom(std::istream & load);
virtual ostream & SaveTo(ostream & save);
virtual istream & LoadFrom(istream & load);
friend NETGENPLUGIN_EXPORT ostream & operator <<(ostream & save, NETGENPlugin_Hypothesis & hyp);
friend NETGENPLUGIN_EXPORT istream & operator >>(istream & load, NETGENPlugin_Hypothesis & hyp);
/*!
* \brief Does nothing
@ -170,41 +133,17 @@ public:
virtual bool SetParametersByDefaults(const TDefaults& dflts, const SMESH_Mesh* theMesh=0);
private:
// General
Fineness _fineness;
bool _secondOrder;
bool _quadAllowed;
// Mesh size
double _maxSize, _minSize;
double _growthRate;
std::string _meshSizeFile;
double _nbSegPerRadius;
double _nbSegPerEdge;
// (SALOME additions)
TLocalSize _localSize;
bool _chordalErrorEnabled;
double _chordalError;
// Optimizer
double _nbSegPerRadius;
Fineness _fineness;
bool _secondOrder;
bool _optimize;
int _nbSurfOptSteps;
int _nbVolOptSteps;
double _elemSizeWeight;
int _worstElemMeasure;
// Insider
TLocalSize _localSize;
bool _quadAllowed;
bool _surfaceCurvature;
bool _useDelauney;
bool _checkOverlapping;
bool _checkChartBoundary;
//bool _blockFilling; -- not used by netgen
// (SALOME additions)
bool _fuseEdges;
// Parallelism parameters
int _nbThreads;
};
#endif

View File

@ -1,4 +1,4 @@
// Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE
// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@ -28,10 +28,7 @@
//=============================================================================
//
#include "NETGENPlugin_Hypothesis_2D.hxx"
#include <SMESH_Mesh.hxx>
#include <SMESH_Group.hxx>
#include <SMESHDS_GroupBase.hxx>
#include <utilities.h>
using namespace std;
@ -40,9 +37,9 @@ using namespace std;
*
*/
//=============================================================================
NETGENPlugin_Hypothesis_2D::NETGENPlugin_Hypothesis_2D (int hypId,
NETGENPlugin_Hypothesis_2D::NETGENPlugin_Hypothesis_2D (int hypId, int studyId,
SMESH_Gen * gen)
: NETGENPlugin_Hypothesis(hypId, gen)/*,
: NETGENPlugin_Hypothesis(hypId, studyId, gen)/*,
_quadAllowed (GetDefaultQuadAllowed())*/
{
_name = "NETGEN_Parameters_2D";
@ -51,460 +48,59 @@ NETGENPlugin_Hypothesis_2D::NETGENPlugin_Hypothesis_2D (int hypId,
//=============================================================================
/*!
*
*
*/
//=============================================================================
NETGENPlugin_RemesherHypothesis_2D::
NETGENPlugin_RemesherHypothesis_2D (int hypId, SMESH_Gen * gen)
: NETGENPlugin_Hypothesis(hypId, gen),
_ridgeAngle ( DefaultRidgeAngle() ),
_edgeCornerAngle ( DefaultEdgeCornerAngle() ),
_chartAngle ( DefaultChartAngle() ),
_outerChartAngle ( DefaultOuterChartAngle() ),
_restHChartDistFactor ( DefaultRestHChartDistFactor() ),
_restHChartDistEnable ( DefaultRestHChartDistEnable() ),
_restHLineLengthFactor ( DefaultRestHLineLengthFactor() ),
_restHLineLengthEnable ( DefaultRestHLineLengthEnable() ),
_restHCloseEdgeFactor ( DefaultRestHCloseEdgeFactor() ),
_restHCloseEdgeEnable ( DefaultRestHCloseEdgeEnable() ),
_restHSurfCurvFactor ( DefaultRestHSurfCurvFactor() ),
_restHSurfCurvEnable ( DefaultRestHSurfCurvEnable() ),
_restHEdgeAngleFactor ( DefaultRestHEdgeAngleFactor() ),
_restHEdgeAngleEnable ( DefaultRestHEdgeAngleEnable() ),
_restHSurfMeshCurvFactor( DefaultRestHSurfMeshCurvFactor()),
_restHSurfMeshCurvEnable( DefaultRestHSurfMeshCurvEnable()),
_keepExistingEdges ( DefaultKeepExistingEdges() ),
_makeGroupsOfSurfaces ( DefaultMakeGroupsOfSurfaces() ),
_fixedEdgeGroupID ( -1 ),
_loadOnCancel ( false )
{
_name = "NETGEN_RemesherParameters_2D";
_param_algo_dim = 2;
}
//=============================================================================
/*!
*
*/
//=============================================================================
void NETGENPlugin_RemesherHypothesis_2D::SetRidgeAngle( double angle )
{
if ( _ridgeAngle != angle )
{
_ridgeAngle = angle;
NotifySubMeshesHypothesisModification();
}
}
//=======================================================================
//function : SetEdgeCornerAngle
//purpose :
//=======================================================================
void NETGENPlugin_RemesherHypothesis_2D::SetEdgeCornerAngle( double angle )
{
if ( _edgeCornerAngle != angle )
{
_edgeCornerAngle = angle;
NotifySubMeshesHypothesisModification();
}
}
//=======================================================================
//function : SetChartAngle
//purpose :
//=======================================================================
void NETGENPlugin_RemesherHypothesis_2D::SetChartAngle( double angle )
{
if ( _chartAngle != angle )
{
_chartAngle = angle;
NotifySubMeshesHypothesisModification();
}
}
//=======================================================================
//function : SetOuterChartAngle
//purpose :
//=======================================================================
void NETGENPlugin_RemesherHypothesis_2D::SetOuterChartAngle( double angle )
{
if ( _outerChartAngle != angle )
{
_outerChartAngle = angle;
NotifySubMeshesHypothesisModification();
}
}
//=======================================================================
//function : SetRestHChartDistFactor
//purpose :
//=======================================================================
void NETGENPlugin_RemesherHypothesis_2D::SetRestHChartDistFactor( double f )
{
if ( _restHChartDistFactor != f )
{
_restHChartDistFactor = f;
NotifySubMeshesHypothesisModification();
}
}
//=======================================================================
//function : SetRestHChartDistEnable
//purpose :
//=======================================================================
void NETGENPlugin_RemesherHypothesis_2D::SetRestHChartDistEnable( bool enable )
{
if ( _restHChartDistEnable != enable )
{
_restHChartDistEnable = enable;
NotifySubMeshesHypothesisModification();
}
}
//=======================================================================
//function : SetRestHLineLengthFactor
//purpose :
//=======================================================================
void NETGENPlugin_RemesherHypothesis_2D::SetRestHLineLengthFactor( double f )
{
if ( _restHLineLengthFactor != f )
{
_restHLineLengthFactor = f;
NotifySubMeshesHypothesisModification();
}
}
//=======================================================================
//function : SetRestHLineLengthEnable
//purpose :
//=======================================================================
void NETGENPlugin_RemesherHypothesis_2D::SetRestHLineLengthEnable( bool enable )
{
if ( _restHLineLengthEnable != enable )
{
_restHLineLengthEnable = enable;
NotifySubMeshesHypothesisModification();
}
}
//=======================================================================
//function : SetRestHCloseEdgeFactor
//purpose :
//=======================================================================
void NETGENPlugin_RemesherHypothesis_2D::SetRestHCloseEdgeFactor( double f )
{
if ( _restHCloseEdgeFactor != f )
{
_restHCloseEdgeFactor = f;
NotifySubMeshesHypothesisModification();
}
}
//=======================================================================
//function : SetRestHCloseEdgeEnable
//purpose :
//=======================================================================
void NETGENPlugin_RemesherHypothesis_2D::SetRestHCloseEdgeEnable( bool enable )
{
if ( _restHCloseEdgeEnable != enable )
{
_restHCloseEdgeEnable = enable;
NotifySubMeshesHypothesisModification();
}
}
//=======================================================================
//function : SetRestHSurfCurvFactor
//purpose :
//=======================================================================
void NETGENPlugin_RemesherHypothesis_2D::SetRestHSurfCurvFactor( double f )
{
if ( _restHSurfCurvFactor != f )
{
_restHSurfCurvFactor = f;
NotifySubMeshesHypothesisModification();
}
}
//=======================================================================
//function : SetRestHSurfCurvEnable
//purpose :
//=======================================================================
void NETGENPlugin_RemesherHypothesis_2D::SetRestHSurfCurvEnable( bool enable )
{
if ( _restHSurfCurvEnable != enable )
{
_restHSurfCurvEnable = enable;
NotifySubMeshesHypothesisModification();
}
}
//=======================================================================
//function : SetRestHEdgeAngleFactor
//purpose :
//=======================================================================
void NETGENPlugin_RemesherHypothesis_2D::SetRestHEdgeAngleFactor( double f )
{
if ( _restHEdgeAngleFactor != f )
{
_restHEdgeAngleFactor = f;
NotifySubMeshesHypothesisModification();
}
}
//=======================================================================
//function : SetRestHEdgeAngleEnable
//purpose :
//=======================================================================
void NETGENPlugin_RemesherHypothesis_2D::SetRestHEdgeAngleEnable( bool enable )
{
if ( _restHEdgeAngleEnable != enable )
{
_restHEdgeAngleEnable = enable;
NotifySubMeshesHypothesisModification();
}
}
//=======================================================================
//function : SetRestHSurfMeshCurvFactor
//purpose :
//=======================================================================
void NETGENPlugin_RemesherHypothesis_2D::SetRestHSurfMeshCurvFactor( double f )
{
if ( _restHSurfMeshCurvFactor != f )
{
_restHSurfMeshCurvFactor = f;
NotifySubMeshesHypothesisModification();
}
}
//=======================================================================
//function : SetRestHSurfMeshCurvEnable
//purpose :
//=======================================================================
void NETGENPlugin_RemesherHypothesis_2D::SetRestHSurfMeshCurvEnable( bool enable )
{
if ( _restHSurfMeshCurvEnable != enable )
{
_restHSurfMeshCurvEnable = enable;
NotifySubMeshesHypothesisModification();
}
}
//=======================================================================
//function : SetKeepExistingEdges
//purpose :
//=======================================================================
void NETGENPlugin_RemesherHypothesis_2D::SetKeepExistingEdges( bool toKeep )
{
if ( _keepExistingEdges != toKeep )
{
_keepExistingEdges = toKeep;
NotifySubMeshesHypothesisModification();
}
}
//=======================================================================
//function : SetMakeGroupsOfSurfaces
//purpose :
//=======================================================================
void NETGENPlugin_RemesherHypothesis_2D::SetMakeGroupsOfSurfaces( bool toMake )
{
if ( _makeGroupsOfSurfaces != toMake )
{
_makeGroupsOfSurfaces = toMake;
NotifySubMeshesHypothesisModification();
}
}
//=======================================================================
//function : SetFixedEdgeGroup
//purpose : Set a group of edges whose nodes must not be moved
//=======================================================================
void NETGENPlugin_RemesherHypothesis_2D::SetFixedEdgeGroup( const SMESH_Group* edgeGroup )
{
int id = edgeGroup ? edgeGroup->GetID() : -1;
if ( id != _fixedEdgeGroupID )
{
_fixedEdgeGroupID = id;
NotifySubMeshesHypothesisModification();
}
}
//=======================================================================
//function : SetLoadMeshOnCancel
//purpose : allow getting a current mesh existing upon CancelCompute()
//=======================================================================
void NETGENPlugin_RemesherHypothesis_2D::SetLoadMeshOnCancel( bool toLoad )
{
if ( toLoad != _loadOnCancel )
{
_loadOnCancel = toLoad;
NotifySubMeshesHypothesisModification();
}
}
//=======================================================================
//function : GetFixedEdgeGroup
//purpose : Return a group of edges whose nodes must not be moved
//=======================================================================
SMESH_Group*
NETGENPlugin_RemesherHypothesis_2D::GetFixedEdgeGroup( const SMESH_Mesh& mesh ) const
{
SMESH_Group* group = mesh.GetGroup( _fixedEdgeGroupID );
if ( group && group->GetGroupDS()->GetType() != SMDSAbs_Edge )
group = NULL;
return group;
}
//=============================================================================
/*!
*
*/
//=============================================================================
std::ostream & NETGENPlugin_RemesherHypothesis_2D::SaveTo(std::ostream & save)
{
NETGENPlugin_Hypothesis::SaveTo( save );
save << " " << _ridgeAngle;
save << " " << _edgeCornerAngle ;
save << " " << _chartAngle ;
save << " " << _outerChartAngle ;
save << " " << _restHChartDistFactor ;
save << " " << _restHChartDistEnable ;
save << " " << _restHLineLengthFactor ;
save << " " << _restHLineLengthEnable ;
save << " " << _restHCloseEdgeFactor ;
save << " " << _restHCloseEdgeEnable ;
save << " " << _restHSurfCurvFactor ;
save << " " << _restHSurfCurvEnable ;
save << " " << _restHEdgeAngleFactor ;
save << " " << _restHEdgeAngleEnable ;
save << " " << _restHSurfMeshCurvFactor;
save << " " << _restHSurfMeshCurvEnable;
save << " " << _keepExistingEdges ;
save << " " << _makeGroupsOfSurfaces ;
save << " " << _fixedEdgeGroupID ;
save << " " << _loadOnCancel ;
return save;
}
//=============================================================================
/*!
*
*/
//=============================================================================
std::istream & NETGENPlugin_RemesherHypothesis_2D::LoadFrom(std::istream & load)
{
NETGENPlugin_Hypothesis::LoadFrom( load );
if ( !load )
load.clear(ios::badbit | load.rdstate());
load >> _ridgeAngle;
if ( !load )
_ridgeAngle = DefaultRidgeAngle();
load >> _edgeCornerAngle;
if ( !load )
_edgeCornerAngle = DefaultEdgeCornerAngle();
load >> _chartAngle;
if ( !load )
_chartAngle = DefaultChartAngle();
load >> _outerChartAngle;
if ( !load )
_outerChartAngle = DefaultOuterChartAngle();
load >> _restHChartDistFactor;
if ( !load )
_restHChartDistFactor = DefaultRestHChartDistFactor();
load >> _restHChartDistEnable;
if ( !load )
_restHChartDistEnable = DefaultRestHChartDistEnable();
load >> _restHLineLengthFactor;
if ( !load )
_restHLineLengthFactor = DefaultRestHLineLengthFactor();
load >> _restHLineLengthEnable;
if ( !load )
_restHLineLengthEnable = DefaultRestHLineLengthEnable();
load >> _restHCloseEdgeFactor;
if ( !load )
_restHCloseEdgeFactor = DefaultRestHCloseEdgeFactor();
load >> _restHCloseEdgeEnable;
if ( !load )
_restHCloseEdgeEnable = DefaultRestHCloseEdgeEnable();
load >> _restHSurfCurvFactor;
if ( !load )
_restHSurfCurvFactor = DefaultRestHSurfCurvFactor();
load >> _restHSurfCurvEnable;
if ( !load )
_restHSurfCurvEnable = DefaultRestHSurfCurvEnable();
load >> _restHEdgeAngleFactor;
if ( !load )
_restHEdgeAngleFactor = DefaultRestHEdgeAngleFactor();
load >> _restHEdgeAngleEnable;
if ( !load )
_restHEdgeAngleEnable = DefaultRestHEdgeAngleEnable();
load >> _restHSurfMeshCurvFactor;
if ( !load )
_restHSurfMeshCurvFactor = DefaultRestHSurfMeshCurvFactor();
load >> _restHSurfMeshCurvEnable;
if ( !load )
_restHSurfMeshCurvEnable = DefaultRestHSurfMeshCurvEnable();
load >> _keepExistingEdges;
if ( !load )
_keepExistingEdges = DefaultKeepExistingEdges();
load >> _makeGroupsOfSurfaces;
if ( !load )
_makeGroupsOfSurfaces = DefaultMakeGroupsOfSurfaces();
load >> _fixedEdgeGroupID;
if ( !load )
_fixedEdgeGroupID = -1;
load >> _loadOnCancel;
if ( !load )
_loadOnCancel = false;
return load;
}
// void NETGENPlugin_Hypothesis_2D::SetQuadAllowed(bool theVal)
// {
// if (theVal != _quadAllowed)
// {
// _quadAllowed = theVal;
// NotifySubMeshesHypothesisModification();
// }
// }
// //=============================================================================
// /*!
// *
// */
// //=============================================================================
// bool NETGENPlugin_Hypothesis_2D::GetDefaultQuadAllowed()
// {
// return false;
// }
// //=============================================================================
// /*!
// *
// */
// //=============================================================================
// ostream & NETGENPlugin_Hypothesis_2D::SaveTo(ostream & save)
// {
// NETGENPlugin_Hypothesis::SaveTo(save);
// save << " " << (int)_quadAllowed;
// return save;
// }
// //=============================================================================
// /*!
// *
// */
// //=============================================================================
// istream & NETGENPlugin_Hypothesis_2D::LoadFrom(istream & load)
// {
// NETGENPlugin_Hypothesis::LoadFrom(load);
// bool isOK = true;
// int is;
// isOK = (load >> is);
// if (isOK)
// _quadAllowed = (bool) is;
// else
// load.clear(ios::badbit | load.rdstate());
// return load;
// }

View File

@ -1,4 +1,4 @@
// Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE
// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@ -35,9 +35,7 @@
#include "NETGENPlugin_Hypothesis.hxx"
#include "Utils_SALOME_Exception.hxx"
class SMESH_Group;
// Parameters of NETGEN.
// Parameters for work of NETGEN.
// This class is just to give 2D dimension, actually
// it inherits all behaviour of the parent
@ -45,133 +43,18 @@ class NETGENPLUGIN_EXPORT NETGENPlugin_Hypothesis_2D: public NETGENPlugin_Hypot
{
public:
NETGENPlugin_Hypothesis_2D(int hypId, SMESH_Gen * gen);
NETGENPlugin_Hypothesis_2D(int hypId, int studyId, SMESH_Gen * gen);
// void SetQuadAllowed(bool theVal);
// bool GetQuadAllowed() const { return _quadAllowed; }
// static bool GetDefaultQuadAllowed();
// Persistence
// virtual ostream & SaveTo(ostream & save);
// virtual istream & LoadFrom(istream & load);
// private:
// bool _quadAllowed;
};
// Parameters of NETGEN remesher
//
class NETGENPLUGIN_EXPORT NETGENPlugin_RemesherHypothesis_2D: public NETGENPlugin_Hypothesis
{
public:
NETGENPlugin_RemesherHypothesis_2D(int hypId, SMESH_Gen * gen);
void SetRidgeAngle( double angle );
double GetRidgeAngle() const{ return _ridgeAngle; }
void SetEdgeCornerAngle( double angle );
double GetEdgeCornerAngle() const { return _edgeCornerAngle; }
void SetChartAngle( double angle );
double GetChartAngle() const { return _chartAngle; }
void SetOuterChartAngle( double angle );
double GetOuterChartAngle() const { return _outerChartAngle; }
void SetRestHChartDistFactor( double f );
double GetRestHChartDistFactor() const { return _restHChartDistFactor; }
void SetRestHChartDistEnable( bool enable );
bool GetRestHChartDistEnable() const { return _restHChartDistEnable; }
void SetRestHLineLengthFactor( double f );
double GetRestHLineLengthFactor() const { return _restHLineLengthFactor; }
void SetRestHLineLengthEnable( bool enable );
bool GetRestHLineLengthEnable() const { return _restHLineLengthEnable; }
void SetRestHCloseEdgeFactor( double f );
double GetRestHCloseEdgeFactor() const { return _restHCloseEdgeFactor; }
void SetRestHCloseEdgeEnable( bool enable );
bool GetRestHCloseEdgeEnable() const { return _restHCloseEdgeEnable; }
void SetRestHSurfCurvFactor( double f );
double GetRestHSurfCurvFactor() const { return _restHSurfCurvFactor; }
void SetRestHSurfCurvEnable( bool enable );
bool GetRestHSurfCurvEnable() const { return _restHSurfCurvEnable; }
void SetRestHEdgeAngleFactor( double f );
double GetRestHEdgeAngleFactor() const { return _restHEdgeAngleFactor; }
void SetRestHEdgeAngleEnable( bool enable );
bool GetRestHEdgeAngleEnable() const { return _restHEdgeAngleEnable; }
void SetRestHSurfMeshCurvFactor( double f );
double GetRestHSurfMeshCurvFactor() const { return _restHSurfMeshCurvFactor; }
void SetRestHSurfMeshCurvEnable( bool enable );
bool GetRestHSurfMeshCurvEnable() const { return _restHSurfMeshCurvEnable; }
void SetKeepExistingEdges( bool toKeep );
bool GetKeepExistingEdges() const { return _keepExistingEdges; }
void SetMakeGroupsOfSurfaces( bool toMake );
bool GetMakeGroupsOfSurfaces() const { return _makeGroupsOfSurfaces; }
void SetFixedEdgeGroup( const SMESH_Group* edgeGroup );
int GetFixedEdgeGroupID() const { return _fixedEdgeGroupID; }
SMESH_Group* GetFixedEdgeGroup( const SMESH_Mesh& mesh ) const;
void SetLoadMeshOnCancel( bool toLoad );
bool GetLoadMeshOnCancel() const { return _loadOnCancel; }
static double DefaultRidgeAngle() { return 30.; }
static double DefaultEdgeCornerAngle() { return 60.; }
static double DefaultChartAngle() { return 15.; }
static double DefaultOuterChartAngle() { return 70.; }
static double DefaultRestHChartDistFactor() { return 1.2; }
static bool DefaultRestHChartDistEnable() { return true; }
static double DefaultRestHLineLengthFactor() { return 0.5; }
static bool DefaultRestHLineLengthEnable() { return true; }
static double DefaultRestHCloseEdgeFactor() { return 1.; }
static bool DefaultRestHCloseEdgeEnable() { return true; }
static double DefaultRestHSurfCurvFactor() { return 1.; }
static bool DefaultRestHSurfCurvEnable() { return false; }
static double DefaultRestHEdgeAngleFactor() { return 1.; }
static bool DefaultRestHEdgeAngleEnable() { return false; }
static double DefaultRestHSurfMeshCurvFactor() { return 1.; }
static bool DefaultRestHSurfMeshCurvEnable() { return false; }
static bool DefaultKeepExistingEdges() { return false; }
static bool DefaultMakeGroupsOfSurfaces() { return false; }
virtual std::ostream & SaveTo(std::ostream & save);
virtual std::istream & LoadFrom(std::istream & load);
private:
// STL charts
double _ridgeAngle; // yellow edges angle (in degrees)
double _edgeCornerAngle;
double _chartAngle;
double _outerChartAngle;
// Mesh size: restrict h due to ...
double _restHChartDistFactor; // chart distance
bool _restHChartDistEnable;
double _restHLineLengthFactor; // line length
bool _restHLineLengthEnable;
double _restHCloseEdgeFactor; // close edges
bool _restHCloseEdgeEnable;
double _restHSurfCurvFactor; // surface curvature
bool _restHSurfCurvEnable;
double _restHEdgeAngleFactor; // edge angle
bool _restHEdgeAngleEnable;
double _restHSurfMeshCurvFactor; // surface mesh curv
bool _restHSurfMeshCurvEnable;
// SALOME features
bool _keepExistingEdges;
bool _makeGroupsOfSurfaces;
int _fixedEdgeGroupID;
bool _loadOnCancel;
};
#endif

View File

@ -1,4 +1,4 @@
// Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE
// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@ -38,12 +38,15 @@
//=============================================================================
NETGENPlugin_Hypothesis_2D_ONLY_i::
NETGENPlugin_Hypothesis_2D_ONLY_i (PortableServer::POA_ptr thePOA,
int theStudyId,
::SMESH_Gen* theGenImpl)
: SALOME::GenericObj_i( thePOA ),
SMESH_Hypothesis_i( thePOA ),
NETGENPlugin_Hypothesis_2D_i( thePOA, theGenImpl )
NETGENPlugin_Hypothesis_2D_i( thePOA, theStudyId, theGenImpl )
{
MESSAGE( "NETGENPlugin_Hypothesis_2D_ONLY_i::NETGENPlugin_Hypothesis_2D_ONLY_i" );
myBaseImpl = new ::NETGENPlugin_Hypothesis_2D (theGenImpl->GetANewId(),
theStudyId,
theGenImpl);
}
@ -55,6 +58,7 @@ NETGENPlugin_Hypothesis_2D_ONLY_i (PortableServer::POA_ptr thePOA,
NETGENPlugin_Hypothesis_2D_ONLY_i::~NETGENPlugin_Hypothesis_2D_ONLY_i()
{
MESSAGE( "NETGENPlugin_Hypothesis_2D_ONLY_i::~NETGENPlugin_Hypothesis_2D_ONLY_i" );
}
//================================================================================
/*!

View File

@ -1,4 +1,4 @@
// Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE
// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@ -46,6 +46,7 @@ class NETGENPLUGIN_EXPORT NETGENPlugin_Hypothesis_2D_ONLY_i:
public:
// Constructor
NETGENPlugin_Hypothesis_2D_ONLY_i (PortableServer::POA_ptr thePOA,
int theStudyId,
::SMESH_Gen* theGenImpl);
// Destructor
virtual ~NETGENPlugin_Hypothesis_2D_ONLY_i();

View File

@ -1,4 +1,4 @@
// Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE
// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@ -28,12 +28,13 @@
//=============================================================================
//
#include "NETGENPlugin_Hypothesis_2D_i.hxx"
#include "SMESH_Gen.hxx"
#include "SMESH_PythonDump.hxx"
#include <SMESH_Gen.hxx>
#include <SMESH_Gen_i.hxx>
#include <SMESH_Group_i.hxx>
#include <SMESH_Group.hxx>
#include <SMESH_PythonDump.hxx>
#include "Utils_CorbaException.hxx"
#include "utilities.h"
using namespace std;
//=============================================================================
/*!
@ -44,14 +45,17 @@
//=============================================================================
NETGENPlugin_Hypothesis_2D_i::
NETGENPlugin_Hypothesis_2D_i (PortableServer::POA_ptr thePOA,
int theStudyId,
::SMESH_Gen* theGenImpl)
: SALOME::GenericObj_i( thePOA ),
SMESH_Hypothesis_i( thePOA ),
NETGENPlugin_Hypothesis_i( thePOA, theGenImpl )
NETGENPlugin_Hypothesis_i( thePOA, theStudyId, theGenImpl )
{
MESSAGE( "NETGENPlugin_Hypothesis_2D_i::NETGENPlugin_Hypothesis_2D_i" );
if (myBaseImpl)
delete (::NETGENPlugin_Hypothesis*)myBaseImpl;
myBaseImpl = new ::NETGENPlugin_Hypothesis_2D (theGenImpl->GetANewId(),
theStudyId,
theGenImpl);
}
@ -64,8 +68,39 @@ NETGENPlugin_Hypothesis_2D_i (PortableServer::POA_ptr thePOA,
//=============================================================================
NETGENPlugin_Hypothesis_2D_i::~NETGENPlugin_Hypothesis_2D_i()
{
MESSAGE( "NETGENPlugin_Hypothesis_2D_i::~NETGENPlugin_Hypothesis_2D_i" );
}
//=============================================================================
/*!
* NETGENPlugin_Hypothesis_2D_i::SetQuadAllowed
*
* Set QuadAllowed flag
*/
//=============================================================================
// void NETGENPlugin_Hypothesis_2D_i::SetQuadAllowed (CORBA::Boolean theValue)
// {
// if ( NETGENPlugin_Hypothesis_i::isToSetParameter( GetQuadAllowed(),
// theValue,
// METH_SetQuadAllowed ))
// {
// this->GetImpl()->SetQuadAllowed(theValue);
// SMESH::TPythonDump() << _this() << ".SetQuadAllowed( " << theValue << " )";
// }
// }
//=============================================================================
/*!
* NETGENPlugin_Hypothesis_2D_i::GetQuadAllowed
*
* Get QuadAllowed flag
*/
//=============================================================================
// CORBA::Boolean NETGENPlugin_Hypothesis_2D_i::GetQuadAllowed()
// {
// return this->GetImpl()->GetQuadAllowed();
// }
//=============================================================================
/*!
* NETGENPlugin_Hypothesis_2D_i::GetImpl
@ -91,378 +126,3 @@ CORBA::Boolean NETGENPlugin_Hypothesis_2D_i::IsDimSupported( SMESH::Dimension ty
{
return type == SMESH::DIM_2D;
}
//=============================================================================
/*!
* NETGENPlugin_RemesherHypothesis_2D_i::NETGENPlugin_RemesherHypothesis_2D_i
*
* Constructor
*/
//=============================================================================
NETGENPlugin_RemesherHypothesis_2D_i::
NETGENPlugin_RemesherHypothesis_2D_i (PortableServer::POA_ptr thePOA,
::SMESH_Gen* theGenImpl)
: SALOME::GenericObj_i( thePOA ),
SMESH_Hypothesis_i( thePOA ),
NETGENPlugin_Hypothesis_2D_i( thePOA, theGenImpl )
{
myBaseImpl = new ::NETGENPlugin_RemesherHypothesis_2D (theGenImpl->GetANewId(),
theGenImpl);
}
//================================================================================
/*!
* \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 NETGENPlugin_RemesherHypothesis_2D_i::IsDimSupported( SMESH::Dimension type )
{
return type == SMESH::DIM_2D;
}
//=============================================================================
/*!
* NETGENPlugin_RemesherHypothesis_2D_i::GetImpl
*
* Get implementation
*/
//=============================================================================
::NETGENPlugin_RemesherHypothesis_2D* NETGENPlugin_RemesherHypothesis_2D_i::GetImpl()
{
return (::NETGENPlugin_RemesherHypothesis_2D*)myBaseImpl;
}
//================================================================================
/*!
* \brief Set ridge angle
*/
//================================================================================
void NETGENPlugin_RemesherHypothesis_2D_i::SetRidgeAngle( CORBA::Double angle )
{
if ( GetRidgeAngle() != angle )
{
GetImpl()->SetRidgeAngle( angle );
SMESH::TPythonDump() << _this() << ".SetRidgeAngle( " << SMESH::TVar(angle) << " )";
}
}
//================================================================================
/*!
* \brief Return ridge angle
*/
//================================================================================
CORBA::Double NETGENPlugin_RemesherHypothesis_2D_i::GetRidgeAngle()
{
return GetImpl()->GetRidgeAngle();
}
void NETGENPlugin_RemesherHypothesis_2D_i::SetEdgeCornerAngle(CORBA::Double angle )
{
if ( GetEdgeCornerAngle() != angle )
{
GetImpl()->SetEdgeCornerAngle( angle );
SMESH::TPythonDump() << _this() << ".SetEdgeCornerAngle( " << SMESH::TVar(angle) << " )";
}
}
CORBA::Double NETGENPlugin_RemesherHypothesis_2D_i::GetEdgeCornerAngle()
{
return GetImpl()->GetEdgeCornerAngle();
}
void NETGENPlugin_RemesherHypothesis_2D_i::SetChartAngle(CORBA::Double angle )
{
if ( GetChartAngle() != angle )
{
GetImpl()->SetChartAngle( angle );
SMESH::TPythonDump() << _this() << ".SetChartAngle( " << SMESH::TVar(angle) << " )";
}
}
CORBA::Double NETGENPlugin_RemesherHypothesis_2D_i::GetChartAngle()
{
return GetImpl()->GetChartAngle();
}
void NETGENPlugin_RemesherHypothesis_2D_i::SetOuterChartAngle(CORBA::Double angle )
{
if ( GetOuterChartAngle() != angle )
{
GetImpl()->SetOuterChartAngle( angle );
SMESH::TPythonDump() << _this() << ".SetOuterChartAngle( " << SMESH::TVar(angle) << " )";
}
}
CORBA::Double NETGENPlugin_RemesherHypothesis_2D_i::GetOuterChartAngle()
{
return GetImpl()->GetOuterChartAngle();
}
void NETGENPlugin_RemesherHypothesis_2D_i::SetRestHChartDistFactor(CORBA::Double f )
{
if ( GetRestHChartDistFactor() != f )
{
GetImpl()->SetRestHChartDistFactor( f );
SMESH::TPythonDump() << _this() << ".SetRestHChartDistFactor( " << SMESH::TVar(f) << " )";
}
}
CORBA::Double NETGENPlugin_RemesherHypothesis_2D_i::GetRestHChartDistFactor()
{
return GetImpl()->GetRestHChartDistFactor();
}
void NETGENPlugin_RemesherHypothesis_2D_i::SetRestHChartDistEnable(CORBA::Boolean enable )
{
if ( GetRestHChartDistEnable() != enable )
{
GetImpl()->SetRestHChartDistEnable( enable );
SMESH::TPythonDump() << _this() << ".SetRestHChartDistEnable( " << enable << " )";
}
}
CORBA::Boolean NETGENPlugin_RemesherHypothesis_2D_i::GetRestHChartDistEnable()
{
return GetImpl()->GetRestHChartDistEnable();
}
void NETGENPlugin_RemesherHypothesis_2D_i::SetRestHLineLengthFactor(CORBA::Double f )
{
if ( GetRestHLineLengthFactor() != f )
{
GetImpl()->SetRestHLineLengthFactor( f );
SMESH::TPythonDump() << _this() << ".SetRestHLineLengthFactor( " << SMESH::TVar(f) << " )";
}
}
CORBA::Double NETGENPlugin_RemesherHypothesis_2D_i::GetRestHLineLengthFactor()
{
return GetImpl()->GetRestHLineLengthFactor();
}
void NETGENPlugin_RemesherHypothesis_2D_i::SetRestHLineLengthEnable(CORBA::Boolean enable )
{
if ( GetRestHLineLengthEnable() != enable )
{
GetImpl()->SetRestHLineLengthEnable( enable );
SMESH::TPythonDump() << _this() << ".SetRestHLineLengthEnable( " << enable << " )";
}
}
CORBA::Boolean NETGENPlugin_RemesherHypothesis_2D_i::GetRestHLineLengthEnable()
{
return GetImpl()->GetRestHLineLengthEnable();
}
void NETGENPlugin_RemesherHypothesis_2D_i::SetRestHCloseEdgeFactor(CORBA::Double f )
{
if ( GetRestHCloseEdgeFactor() != f )
{
GetImpl()->SetRestHCloseEdgeFactor( f );
SMESH::TPythonDump() << _this() << ".SetRestHCloseEdgeFactor( " << SMESH::TVar(f) << " )";
}
}
CORBA::Double NETGENPlugin_RemesherHypothesis_2D_i::GetRestHCloseEdgeFactor()
{
return GetImpl()->GetRestHCloseEdgeFactor();
}
void NETGENPlugin_RemesherHypothesis_2D_i::SetRestHCloseEdgeEnable(CORBA::Boolean enable )
{
if ( GetRestHCloseEdgeEnable() != enable )
{
GetImpl()->SetRestHCloseEdgeEnable( enable );
SMESH::TPythonDump() << _this() << ".SetRestHCloseEdgeEnable( " << enable << " )";
}
}
CORBA::Boolean NETGENPlugin_RemesherHypothesis_2D_i::GetRestHCloseEdgeEnable()
{
return GetImpl()->GetRestHCloseEdgeEnable();
}
void NETGENPlugin_RemesherHypothesis_2D_i::SetRestHSurfCurvFactor(CORBA::Double f )
{
if ( GetRestHSurfCurvFactor() != f )
{
GetImpl()->SetRestHSurfCurvFactor( f );
SMESH::TPythonDump() << _this() << ".SetRestHSurfCurvFactor( " << SMESH::TVar(f) << " )";
}
}
CORBA::Double NETGENPlugin_RemesherHypothesis_2D_i::GetRestHSurfCurvFactor()
{
return GetImpl()->GetRestHSurfCurvFactor();
}
void NETGENPlugin_RemesherHypothesis_2D_i::SetRestHSurfCurvEnable(CORBA::Boolean enable )
{
if ( GetRestHSurfCurvEnable() != enable )
{
GetImpl()->SetRestHSurfCurvEnable( enable );
SMESH::TPythonDump() << _this() << ".SetRestHSurfCurvEnable( " << enable << " )";
}
}
CORBA::Boolean NETGENPlugin_RemesherHypothesis_2D_i::GetRestHSurfCurvEnable()
{
return GetImpl()->GetRestHSurfCurvEnable();
}
void NETGENPlugin_RemesherHypothesis_2D_i::SetRestHEdgeAngleFactor(CORBA::Double f )
{
if ( GetRestHEdgeAngleFactor() != f )
{
GetImpl()->SetRestHEdgeAngleFactor( f );
SMESH::TPythonDump() << _this() << ".SetRestHEdgeAngleFactor( " << SMESH::TVar(f) << " )";
}
}
CORBA::Double NETGENPlugin_RemesherHypothesis_2D_i::GetRestHEdgeAngleFactor()
{
return GetImpl()->GetRestHEdgeAngleFactor();
}
void NETGENPlugin_RemesherHypothesis_2D_i::SetRestHEdgeAngleEnable(CORBA::Boolean enable )
{
if ( GetRestHEdgeAngleEnable() != enable )
{
GetImpl()->SetRestHEdgeAngleEnable( enable );
SMESH::TPythonDump() << _this() << ".SetRestHEdgeAngleEnable( " << enable << " )";
}
}
CORBA::Boolean NETGENPlugin_RemesherHypothesis_2D_i::GetRestHEdgeAngleEnable()
{
return GetImpl()->GetRestHEdgeAngleEnable();
}
void NETGENPlugin_RemesherHypothesis_2D_i::SetRestHSurfMeshCurvFactor(CORBA::Double f )
{
if ( GetRestHSurfMeshCurvFactor() != f )
{
GetImpl()->SetRestHSurfMeshCurvFactor( f );
SMESH::TPythonDump() << _this() << ".SetRestHSurfMeshCurvFactor( " << SMESH::TVar(f) << " )";
}
}
CORBA::Double NETGENPlugin_RemesherHypothesis_2D_i::GetRestHSurfMeshCurvFactor()
{
return GetImpl()->GetRestHSurfMeshCurvFactor();
}
void NETGENPlugin_RemesherHypothesis_2D_i::SetRestHSurfMeshCurvEnable(CORBA::Boolean enable )
{
if ( GetRestHSurfMeshCurvEnable() != enable )
{
GetImpl()->SetRestHSurfMeshCurvEnable( enable );
SMESH::TPythonDump() << _this() << ".SetRestHSurfMeshCurvEnable( " << enable << " )";
}
}
CORBA::Boolean NETGENPlugin_RemesherHypothesis_2D_i::GetRestHSurfMeshCurvEnable()
{
return GetImpl()->GetRestHSurfMeshCurvEnable();
}
void NETGENPlugin_RemesherHypothesis_2D_i::SetKeepExistingEdges( CORBA::Boolean toKeep )
{
if ( GetKeepExistingEdges() != toKeep )
{
GetImpl()->SetKeepExistingEdges( toKeep );
SMESH::TPythonDump() << _this() << ".SetKeepExistingEdges( " << toKeep << " )";
}
}
CORBA::Boolean NETGENPlugin_RemesherHypothesis_2D_i::GetKeepExistingEdges()
{
return GetImpl()->GetKeepExistingEdges();
}
void NETGENPlugin_RemesherHypothesis_2D_i::SetMakeGroupsOfSurfaces( CORBA::Boolean toMake )
{
if ( GetMakeGroupsOfSurfaces() != toMake )
{
GetImpl()->SetMakeGroupsOfSurfaces( toMake );
SMESH::TPythonDump() << _this() << ".SetMakeGroupsOfSurfaces( " << toMake << " )";
}
}
CORBA::Boolean NETGENPlugin_RemesherHypothesis_2D_i::GetMakeGroupsOfSurfaces()
{
return GetImpl()->GetMakeGroupsOfSurfaces();
}
void
NETGENPlugin_RemesherHypothesis_2D_i::SetFixedEdgeGroup( SMESH::SMESH_GroupBase_ptr edgeGroup )
{
const SMESH_Group * group = 0;
if ( SMESH_GroupBase_i* group_i = SMESH::DownCast< SMESH_GroupBase_i* >( edgeGroup ))
{
if ( group_i->GetType() == SMESH::EDGE )
group = group_i->GetSmeshGroup();
}
int id = group ? group->GetID() : -1;
if ( id != GetImpl()->GetFixedEdgeGroupID() )
{
GetImpl()->SetFixedEdgeGroup( group );
SMESH::TPythonDump() << _this() << ".SetFixedEdgeGroup( " << edgeGroup << " )";
}
}
SMESH::SMESH_GroupBase_ptr
NETGENPlugin_RemesherHypothesis_2D_i::GetFixedEdgeGroup( SMESH::SMESH_Mesh_ptr mesh )
{
SMESH::SMESH_GroupBase_var resGroup;
if ( SMESH_Mesh_i* mesh_i = SMESH::DownCast< SMESH_Mesh_i* >( mesh ))
{
const std::map<int, SMESH::SMESH_GroupBase_ptr>& groups = mesh_i->getGroups();
std::map<int, SMESH::SMESH_GroupBase_ptr>::const_iterator i_gr =
groups.find( GetImpl()->GetFixedEdgeGroupID() );
if ( i_gr != groups.end() && i_gr->second->GetType() == SMESH::EDGE )
resGroup = SMESH::SMESH_GroupBase::_duplicate( i_gr->second );
}
return resGroup._retn();
}
void NETGENPlugin_RemesherHypothesis_2D_i::SetLoadMeshOnCancel( CORBA::Boolean toMake )
{
if ( GetLoadMeshOnCancel() != toMake )
{
GetImpl()->SetLoadMeshOnCancel( toMake );
SMESH::TPythonDump() << _this() << ".SetLoadMeshOnCancel( " << toMake << " )";
}
}
CORBA::Boolean NETGENPlugin_RemesherHypothesis_2D_i::GetLoadMeshOnCancel()
{
return GetImpl()->GetLoadMeshOnCancel();
}

View File

@ -1,4 +1,4 @@
// Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE
// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@ -49,6 +49,7 @@ class NETGENPLUGIN_EXPORT NETGENPlugin_Hypothesis_2D_i:
public:
// Constructor
NETGENPlugin_Hypothesis_2D_i (PortableServer::POA_ptr thePOA,
int theStudyId,
::SMESH_Gen* theGenImpl);
// Destructor
virtual ~NETGENPlugin_Hypothesis_2D_i();
@ -69,83 +70,4 @@ class NETGENPLUGIN_EXPORT NETGENPlugin_Hypothesis_2D_i:
// };
};
// NETGENPlugin_Remesher_2D parameters hypothesis
class NETGENPLUGIN_EXPORT NETGENPlugin_RemesherHypothesis_2D_i:
public virtual POA_NETGENPlugin::NETGENPlugin_RemesherHypothesis_2D,
public NETGENPlugin_Hypothesis_2D_i
{
public:
// Constructor
NETGENPlugin_RemesherHypothesis_2D_i( PortableServer::POA_ptr thePOA,
::SMESH_Gen* theGenImpl);
void SetRidgeAngle( CORBA::Double angle );
CORBA::Double GetRidgeAngle();
void SetEdgeCornerAngle( CORBA::Double angle );
CORBA::Double GetEdgeCornerAngle();
void SetChartAngle( CORBA::Double angle );
CORBA::Double GetChartAngle();
void SetOuterChartAngle( CORBA::Double angle );
CORBA::Double GetOuterChartAngle();
void SetRestHChartDistFactor( CORBA::Double f );
CORBA::Double GetRestHChartDistFactor();
void SetRestHChartDistEnable( CORBA::Boolean enable );
CORBA::Boolean GetRestHChartDistEnable();
void SetRestHLineLengthFactor( CORBA::Double f );
CORBA::Double GetRestHLineLengthFactor();
void SetRestHLineLengthEnable( CORBA::Boolean enable );
CORBA::Boolean GetRestHLineLengthEnable();
void SetRestHCloseEdgeFactor( CORBA::Double f );
CORBA::Double GetRestHCloseEdgeFactor();
void SetRestHCloseEdgeEnable( CORBA::Boolean enable );
CORBA::Boolean GetRestHCloseEdgeEnable();
void SetRestHSurfCurvFactor( CORBA::Double f );
CORBA::Double GetRestHSurfCurvFactor();
void SetRestHSurfCurvEnable( CORBA::Boolean enable );
CORBA::Boolean GetRestHSurfCurvEnable();
void SetRestHEdgeAngleFactor( CORBA::Double f );
CORBA::Double GetRestHEdgeAngleFactor();
void SetRestHEdgeAngleEnable( CORBA::Boolean enable );
CORBA::Boolean GetRestHEdgeAngleEnable();
void SetRestHSurfMeshCurvFactor( CORBA::Double f );
CORBA::Double GetRestHSurfMeshCurvFactor();
void SetRestHSurfMeshCurvEnable( CORBA::Boolean enable );
CORBA::Boolean GetRestHSurfMeshCurvEnable();
void SetKeepExistingEdges( CORBA::Boolean toKeep );
CORBA::Boolean GetKeepExistingEdges();
void SetMakeGroupsOfSurfaces( CORBA::Boolean toMake );
CORBA::Boolean GetMakeGroupsOfSurfaces();
void SetFixedEdgeGroup( SMESH::SMESH_GroupBase_ptr edgeGroup );
SMESH::SMESH_GroupBase_ptr GetFixedEdgeGroup( SMESH::SMESH_Mesh_ptr mesh );
void SetLoadMeshOnCancel( CORBA::Boolean toLoad );
CORBA::Boolean GetLoadMeshOnCancel();
// Get implementation
::NETGENPlugin_RemesherHypothesis_2D* GetImpl();
// Verify whether hypothesis supports given entity type
CORBA::Boolean IsDimSupported( SMESH::Dimension type );
};
#endif

View File

@ -1,4 +1,4 @@
// Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE
// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@ -40,12 +40,13 @@ using namespace std;
//=============================================================================
NETGENPlugin_Hypothesis_3D_i::
NETGENPlugin_Hypothesis_3D_i (PortableServer::POA_ptr thePOA,
int theStudyId,
::SMESH_Gen* theGenImpl)
: SALOME::GenericObj_i( thePOA ),
SMESH_Hypothesis_i( thePOA ),
NETGENPlugin_Hypothesis_i( thePOA, theGenImpl )
NETGENPlugin_Hypothesis_i( thePOA, theStudyId, theGenImpl )
{
//MESSAGE( "NETGENPlugin_Hypothesis_3D_i::NETGENPlugin_Hypothesis_3D_i" );
MESSAGE( "NETGENPlugin_Hypothesis_3D_i::NETGENPlugin_Hypothesis_3D_i" );
}
//=============================================================================
@ -55,7 +56,7 @@ NETGENPlugin_Hypothesis_3D_i (PortableServer::POA_ptr thePOA,
//=============================================================================
NETGENPlugin_Hypothesis_3D_i::~NETGENPlugin_Hypothesis_3D_i()
{
//MESSAGE( "NETGENPlugin_Hypothesis_3D_i::~NETGENPlugin_Hypothesis_3D_i" );
MESSAGE( "NETGENPlugin_Hypothesis_3D_i::~NETGENPlugin_Hypothesis_3D_i" );
}
//================================================================================

View File

@ -1,4 +1,4 @@
// Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE
// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@ -46,6 +46,7 @@ class NETGENPLUGIN_EXPORT NETGENPlugin_Hypothesis_3D_i:
public:
// Constructor
NETGENPlugin_Hypothesis_3D_i (PortableServer::POA_ptr thePOA,
int theStudyId,
::SMESH_Gen* theGenImpl);
// Get type name of hypothesis

View File

@ -1,4 +1,4 @@
// Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE
// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@ -59,12 +59,15 @@ bool NETGENPlugin_Hypothesis_i::isToSetParameter<double>(double curValue,
//=============================================================================
NETGENPlugin_Hypothesis_i::
NETGENPlugin_Hypothesis_i (PortableServer::POA_ptr thePOA,
int theStudyId,
::SMESH_Gen* theGenImpl)
: SALOME::GenericObj_i( thePOA ),
: SALOME::GenericObj_i( thePOA ),
SMESH_Hypothesis_i( thePOA ),
mySetMethodFlags(0)
{
MESSAGE( "NETGENPlugin_Hypothesis_i::NETGENPlugin_Hypothesis_i" );
myBaseImpl = new ::NETGENPlugin_Hypothesis (theGenImpl->GetANewId(),
theStudyId,
theGenImpl);
}
@ -77,6 +80,7 @@ NETGENPlugin_Hypothesis_i (PortableServer::POA_ptr thePOA,
//=============================================================================
NETGENPlugin_Hypothesis_i::~NETGENPlugin_Hypothesis_i()
{
MESSAGE( "NETGENPlugin_Hypothesis_i::~NETGENPlugin_Hypothesis_i" );
}
//=============================================================================
@ -305,38 +309,9 @@ CORBA::Double NETGENPlugin_Hypothesis_i::GetNbSegPerRadius()
//=============================================================================
void NETGENPlugin_Hypothesis_i::SetChordalErrorEnabled(CORBA::Boolean theValue)
{
if ( isToSetParameter( GetChordalErrorEnabled(), theValue, METH_SetChordalErrorEnabled ))
{
this->GetImpl()->SetChordalErrorEnabled(theValue);
SMESH::TPythonDump() << _this() << ".SetChordalErrorEnabled( " << theValue << " )";
}
}
CORBA::Boolean NETGENPlugin_Hypothesis_i::GetChordalErrorEnabled()
{
return GetImpl()->GetChordalErrorEnabled();
}
void NETGENPlugin_Hypothesis_i::SetChordalError(CORBA::Double theValue)
{
if ( isToSetParameter( GetChordalError(), theValue, METH_SetChordalError ))
{
this->GetImpl()->SetChordalError(theValue);
SMESH::TPythonDump() << _this() << ".SetChordalError( " << SMESH::TVar(theValue) << " )";
}
}
CORBA::Double NETGENPlugin_Hypothesis_i::GetChordalError()
{
return GetImpl()->GetChordalError();
}
//=============================================================================
void NETGENPlugin_Hypothesis_i::SetLocalSizeOnShape(GEOM::GEOM_Object_ptr GeomObj,
CORBA::Double localSize)
throw (SALOME::SALOME_Exception)
{
string entry;
entry = GeomObj->GetStudyEntry();
@ -373,7 +348,7 @@ NETGENPlugin::string_array* NETGENPlugin_Hypothesis_i::GetLocalSizeEntries()
NETGENPlugin::string_array_var result = new NETGENPlugin::string_array();
const ::NETGENPlugin_Hypothesis::TLocalSize localSizes =
this->GetImpl()->GetLocalSizesAndEntries();
result->length((CORBA::ULong) localSizes.size());
result->length(localSizes.size());
::NETGENPlugin_Hypothesis::TLocalSize::const_iterator it = localSizes.begin();
for (int i=0 ; it != localSizes.end() ; i++, it++)
{
@ -388,25 +363,7 @@ NETGENPlugin::string_array* NETGENPlugin_Hypothesis_i::GetLocalSizeEntries()
void NETGENPlugin_Hypothesis_i::UnsetLocalSizeOnEntry(const char* entry)
{
this->GetImpl()->UnsetLocalSizeOnEntry(entry);
SMESH::TPythonDump() << _this() << ".UnsetLocalSizeOnEntry(\"" << entry << "\")";
}
//=============================================================================
void NETGENPlugin_Hypothesis_i::SetMeshSizeFile(const char* fileName)
{
if ( GetImpl()->GetMeshSizeFile() != fileName )
{
GetImpl()->SetMeshSizeFile( fileName );
SMESH::TPythonDump() << _this() << ".SetMeshSizeFile( '" << fileName << "' )";
}
}
//=============================================================================
char* NETGENPlugin_Hypothesis_i::GetMeshSizeFile()
{
return CORBA::string_dup( GetImpl()->GetMeshSizeFile().c_str() );
SMESH::TPythonDump() << _this() << ".UnsetLocalSizeOnEntry(" << entry << ")";
}
//=============================================================================
@ -469,199 +426,6 @@ CORBA::Boolean NETGENPlugin_Hypothesis_i::GetFuseEdges()
return this->GetImpl()->GetFuseEdges();
}
//=======================================================================
//function : SetNbSurfOptSteps
//purpose :
//=======================================================================
void NETGENPlugin_Hypothesis_i::SetNbSurfOptSteps(CORBA::Short nb )
{
if ( GetNbSurfOptSteps() != nb )
{
this->GetImpl()->SetNbSurfOptSteps( nb );
SMESH::TPythonDump() << _this() << ".SetNbSurfOptSteps( " << SMESH::TVar(nb) << " )";
}
}
//=======================================================================
//function : GetNbSurfOptSteps
//purpose :
//=======================================================================
CORBA::Short NETGENPlugin_Hypothesis_i::GetNbSurfOptSteps()
{
return (CORBA::Short) GetImpl()->GetNbSurfOptSteps();
}
//=======================================================================
//function : SetNbVolOptSteps
//purpose :
//=======================================================================
void NETGENPlugin_Hypothesis_i::SetNbVolOptSteps(CORBA::Short nb )
{
if ( GetNbVolOptSteps() != nb )
{
this->GetImpl()->SetNbVolOptSteps( nb );
SMESH::TPythonDump() << _this() << ".SetNbVolOptSteps( " << SMESH::TVar(nb) << " )";
}
}
//=======================================================================
//function : GetNbVolOptSteps
//purpose :
//=======================================================================
CORBA::Short NETGENPlugin_Hypothesis_i::GetNbVolOptSteps()
{
return (CORBA::Short) GetImpl()->GetNbVolOptSteps();
}
//=======================================================================
//function : SetElemSizeWeight
//purpose :
//=======================================================================
void NETGENPlugin_Hypothesis_i::SetElemSizeWeight(CORBA::Double size )
{
if ( GetElemSizeWeight() != size )
{
this->GetImpl()->SetElemSizeWeight( size );
SMESH::TPythonDump() << _this() << ".SetElemSizeWeight( " << SMESH::TVar(size) << " )";
}
}
//=======================================================================
//function : GetElemSizeWeight
//purpose :
//=======================================================================
CORBA::Double NETGENPlugin_Hypothesis_i::GetElemSizeWeight()
{
return GetImpl()->GetElemSizeWeight();
}
//=======================================================================
//function : SetWorstElemMeasure
//purpose :
//=======================================================================
void NETGENPlugin_Hypothesis_i::SetWorstElemMeasure(CORBA::Short val )
{
if ( GetWorstElemMeasure() != val )
{
this->GetImpl()->SetWorstElemMeasure( val );
SMESH::TPythonDump() << _this() << ".SetWorstElemMeasure( " << SMESH::TVar(val) << " )";
}
}
//=======================================================================
//function : GetWorstElemMeasure
//purpose :
//=======================================================================
CORBA::Short NETGENPlugin_Hypothesis_i::GetWorstElemMeasure()
{
return (CORBA::Short) GetImpl()->GetWorstElemMeasure();
}
//=======================================================================
//function : SetNbThreads
//purpose :
//=======================================================================
void NETGENPlugin_Hypothesis_i::SetNbThreads(CORBA::Short val )
{
if ( GetNbThreads() != val )
{
this->GetImpl()->SetNbThreads( val );
SMESH::TPythonDump() << _this() << ".SetNbThreads( " << SMESH::TVar(val) << " )";
}
}
//=======================================================================
//function : GetNbThreads
//purpose :
//=======================================================================
CORBA::Short NETGENPlugin_Hypothesis_i::GetNbThreads()
{
return (CORBA::Short) GetImpl()->GetNbThreads();
}
//=======================================================================
//function : SetUseDelauney
//purpose :
//=======================================================================
void NETGENPlugin_Hypothesis_i::SetUseDelauney(CORBA::Boolean toUse)
{
if ( GetUseDelauney() != toUse )
{
this->GetImpl()->SetUseDelauney( toUse );
SMESH::TPythonDump() << _this() << ".SetUseDelauney( " << toUse << " )";
}
}
//=======================================================================
//function : GetUseDelauney
//purpose :
//=======================================================================
CORBA::Boolean NETGENPlugin_Hypothesis_i::GetUseDelauney()
{
return GetImpl()->GetUseDelauney();
}
//=======================================================================
//function : SetCheckOverlapping
//purpose :
//=======================================================================
void NETGENPlugin_Hypothesis_i::SetCheckOverlapping(CORBA::Boolean toCheck )
{
if ( GetCheckOverlapping() != toCheck )
{
this->GetImpl()->SetCheckOverlapping( toCheck );
SMESH::TPythonDump() << _this() << ".SetCheckOverlapping( " << toCheck << " )";
}
}
//=======================================================================
//function : GetCheckOverlapping
//purpose :
//=======================================================================
CORBA::Boolean NETGENPlugin_Hypothesis_i::GetCheckOverlapping()
{
return GetImpl()->GetCheckOverlapping();
}
//=======================================================================
//function : SetCheckChartBoundary
//purpose :
//=======================================================================
void NETGENPlugin_Hypothesis_i::SetCheckChartBoundary(CORBA::Boolean toCheck )
{
if ( GetCheckChartBoundary() != toCheck )
{
this->GetImpl()->SetCheckChartBoundary( toCheck );
SMESH::TPythonDump() << _this() << ".SetCheckChartBoundary( " << toCheck << " )";
}
}
//=======================================================================
//function : GetCheckChartBoundary
//purpose : Get implementation
//=======================================================================
CORBA::Boolean NETGENPlugin_Hypothesis_i::GetCheckChartBoundary()
{
return GetImpl()->GetCheckChartBoundary();
}
//=============================================================================
/*!
* NETGENPlugin_Hypothesis_i::GetImpl
@ -676,13 +440,13 @@ CORBA::Boolean NETGENPlugin_Hypothesis_i::GetCheckChartBoundary()
//================================================================================
/*!
* \brief Verify whether hypothesis supports given entity type
* \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 NETGENPlugin_Hypothesis_i::IsDimSupported( SMESH::Dimension type )
{
return type == SMESH::DIM_3D;
@ -726,51 +490,3 @@ std::string NETGENPlugin_Hypothesis_i::getMethodOfParameter(const int paramIndex
}
return "";
}
//================================================================================
/*!
* \brief Return geometry this hypothesis depends on. Return false if there is no geometry parameter
*/
//================================================================================
bool
NETGENPlugin_Hypothesis_i::getObjectsDependOn( std::vector< std::string > & entryArray,
std::vector< int > & /*subIDArray*/ ) const
{
typedef ::NETGENPlugin_Hypothesis THyp;
const THyp* h = static_cast< ::NETGENPlugin_Hypothesis* >( myBaseImpl );
const THyp::TLocalSize& ls = h->GetLocalSizesAndEntries();
THyp::TLocalSize::const_iterator entry2size = ls.cbegin();
for ( ; entry2size != ls.cend(); ++entry2size )
entryArray.push_back( entry2size->first );
return true;
}
//================================================================================
/*!
* \brief Set new geometry instead of that returned by getObjectsDependOn()
*/
//================================================================================
bool
NETGENPlugin_Hypothesis_i::setObjectsDependOn( std::vector< std::string > & entryArray,
std::vector< int > & /*subIDArray*/ )
{
typedef ::NETGENPlugin_Hypothesis THyp;
const THyp* h = static_cast< ::NETGENPlugin_Hypothesis* >( myBaseImpl );
THyp::TLocalSize& lsNew = const_cast< THyp::TLocalSize& >( h->GetLocalSizesAndEntries() );
THyp::TLocalSize ls;
lsNew.swap( ls );
THyp::TLocalSize::const_iterator entry2size = ls.cbegin();
for ( int i = 0; entry2size != ls.cend(); ++entry2size, ++i )
if ( !entryArray[ i ].empty() )
lsNew[ entryArray[ i ]] = entry2size->second;
return true;
}

View File

@ -1,4 +1,4 @@
// Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE
// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@ -50,6 +50,7 @@ class NETGENPLUGIN_EXPORT NETGENPlugin_Hypothesis_i:
public:
// Constructor
NETGENPlugin_Hypothesis_i (PortableServer::POA_ptr thePOA,
int theStudyId,
::SMESH_Gen* theGenImpl);
// Destructor
virtual ~NETGENPlugin_Hypothesis_i();
@ -78,20 +79,13 @@ class NETGENPLUGIN_EXPORT NETGENPlugin_Hypothesis_i:
void SetNbSegPerRadius(CORBA::Double theVal);
CORBA::Double GetNbSegPerRadius();
void SetChordalErrorEnabled(CORBA::Boolean value);
CORBA::Boolean GetChordalErrorEnabled();
void SetChordalError(CORBA::Double value);
CORBA::Double GetChordalError();
void SetLocalSizeOnShape(GEOM::GEOM_Object_ptr GeomObj, CORBA::Double localSize);
void SetLocalSizeOnShape(GEOM::GEOM_Object_ptr GeomObj, CORBA::Double localSize)
throw (SALOME::SALOME_Exception);
void SetLocalSizeOnEntry(const char* entry, CORBA::Double localSize);
CORBA::Double GetLocalSizeOnEntry(const char* entry);
NETGENPlugin::string_array* GetLocalSizeEntries();
void UnsetLocalSizeOnEntry(const char* entry);
void SetMeshSizeFile(const char* fileName);
char* GetMeshSizeFile();
void SetQuadAllowed(CORBA::Boolean theVal);
CORBA::Boolean GetQuadAllowed();
@ -101,67 +95,30 @@ class NETGENPLUGIN_EXPORT NETGENPlugin_Hypothesis_i:
void SetFuseEdges(CORBA::Boolean theVal);
CORBA::Boolean GetFuseEdges();
void SetNbSurfOptSteps(CORBA::Short nb );
CORBA::Short GetNbSurfOptSteps();
void SetNbVolOptSteps(CORBA::Short nb );
CORBA::Short GetNbVolOptSteps();
void SetElemSizeWeight(CORBA::Double size );
CORBA::Double GetElemSizeWeight();
void SetWorstElemMeasure(CORBA::Short val );
CORBA::Short GetWorstElemMeasure();
void SetNbThreads(CORBA::Short val );
CORBA::Short GetNbThreads();
void SetUseDelauney(CORBA::Boolean toUse);
CORBA::Boolean GetUseDelauney();
void SetCheckOverlapping(CORBA::Boolean toCheck );
CORBA::Boolean GetCheckOverlapping();
void SetCheckChartBoundary(CORBA::Boolean toCheck );
CORBA::Boolean GetCheckChartBoundary();
// Get implementation
::NETGENPlugin_Hypothesis* GetImpl();
// Verify whether hypothesis supports given entity type
// Verify whether hypothesis supports given entity type
CORBA::Boolean IsDimSupported( SMESH::Dimension type );
// Methods for copying mesh definition to other geometry
// Return geometry this hypothesis depends on. Return false if there is no geometry parameter
virtual bool getObjectsDependOn( std::vector< std::string > & entryArray,
std::vector< int > & subIDArray ) const;
// Set new geometry instead of that returned by getObjectsDependOn()
virtual bool setObjectsDependOn( std::vector< std::string > & entryArray,
std::vector< int > & subIDArray );
protected:
// to remember whether a parameter is already set (issue 0021364)
enum SettingMethod
{
METH_SetMaxSize = 1,
METH_SetMinSize = 2,
METH_SetSecondOrder = 4,
METH_SetOptimize = 8,
METH_SetFineness = 16,
METH_SetGrowthRate = 32,
METH_SetNbSegPerEdge = 64,
METH_SetNbSegPerRadius = 128,
METH_SetLocalSizeOnEntry = 256,
METH_SetQuadAllowed = METH_SetLocalSizeOnEntry * 2,
METH_SetSurfaceCurvature = METH_SetQuadAllowed * 2,
METH_SetFuseEdges = METH_SetSurfaceCurvature * 2,
METH_SetChordalErrorEnabled = METH_SetFuseEdges * 2,
METH_SetChordalError = METH_SetChordalErrorEnabled * 2,
METH_LAST = METH_SetChordalError
METH_SetMaxSize = 1,
METH_SetMinSize = 2,
METH_SetSecondOrder = 4,
METH_SetOptimize = 8,
METH_SetFineness = 16,
METH_SetGrowthRate = 32,
METH_SetNbSegPerEdge = 64,
METH_SetNbSegPerRadius = 128,
METH_SetLocalSizeOnEntry = 256,
METH_SetQuadAllowed = METH_SetLocalSizeOnEntry * 2,
METH_SetSurfaceCurvature = METH_SetQuadAllowed * 2,
METH_SetFuseEdges = METH_SetSurfaceCurvature * 2,
METH_LAST = METH_SetFuseEdges
};
int mySetMethodFlags;

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
// Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE
// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@ -35,17 +35,6 @@
#include <SMDS_MeshElement.hxx>
#include <SMESH_Algo.hxx>
#include <SMESH_ProxyMesh.hxx>
#include <SALOMEDS_Tool.hxx>
#include "Basics_Utils.hxx"
#include "SALOME_Basics.hxx"
#include <TopTools_IndexedMapOfShape.hxx>
// Netgen include files
#ifndef OCCGEOMETRY
#define OCCGEOMETRY
#endif
#include <occgeom.hpp>
#include <meshing.hpp>
namespace nglib {
#include <nglib.h>
@ -55,47 +44,19 @@ namespace nglib {
#include <vector>
#include <set>
class NETGENPlugin_Hypothesis;
class NETGENPlugin_Internals;
class NETGENPlugin_SimpleHypothesis_2D;
class SMESHDS_Mesh;
class SMESH_Comment;
class SMESH_Mesh;
class SMESH_MesherHelper;
class StdMeshers_ViscousLayers;
class TopoDS_Shape;
class TopTools_IndexedMapOfShape;
class NETGENPlugin_Hypothesis;
class NETGENPlugin_SimpleHypothesis_2D;
class NETGENPlugin_Internals;
namespace netgen {
class OCCGeometry;
class Mesh;
NETGENPLUGIN_DLL_HEADER
extern MeshingParameters mparam;
}
// Class for temporary folder switching
class ChdirRAII
{
public:
#ifndef WIN32
ChdirRAII(const std::string& wd):_wd(wd) { if(_wd.empty()) return ; char *pwd(get_current_dir_name()); _od = pwd; free(pwd); chdir(_wd.c_str()); }
~ChdirRAII() { if(_od.empty()) return ; chdir(_od.c_str()); }
#else
ChdirRAII(const std::string& wd) : _wd(wd) {
if (_wd.empty())
return;
TCHAR pwd[MAX_PATH];
GetCurrentDirectory(sizeof(pwd), pwd);
_od = Kernel_Utils::utf8_encode_s(pwd);
SetCurrentDirectory(Kernel_Utils::utf8_decode_s(_wd).c_str());
}
~ChdirRAII() {
if (_od.empty()) return;
SetCurrentDirectory(Kernel_Utils::utf8_decode_s(_od).c_str());
}
#endif
private:
std::string _wd;
std::string _od;
};
//=============================================================================
/*!
* \brief Struct storing nb of entities in netgen mesh
@ -104,10 +65,9 @@ class ChdirRAII
struct NETGENPlugin_ngMeshInfo
{
int _nbNodes, _nbSegments, _nbFaces, _nbVolumes;
bool _elementsRemoved; // case where netgen can remove free nodes
int _nbNodes, _nbSegments, _nbFaces, _nbVolumes;
char* _copyOfLocalH;
NETGENPlugin_ngMeshInfo( netgen::Mesh* ngMesh=0, bool checkRemovedElems=false );
NETGENPlugin_ngMeshInfo( netgen::Mesh* ngMesh=0);
void transferLocalH( netgen::Mesh* fromMesh, netgen::Mesh* toMesh );
void restoreLocalH ( netgen::Mesh* ngMesh);
};
@ -121,39 +81,18 @@ struct NETGENPlugin_ngMeshInfo
struct NETGENPLUGIN_EXPORT NETGENPlugin_NetgenLibWrapper
{
bool _isComputeOk;
netgen::Mesh * _ngMesh;
bool _isComputeOk;
nglib::Ng_Mesh * _ngMesh;
NETGENPlugin_NetgenLibWrapper();
~NETGENPlugin_NetgenLibWrapper();
void setMesh( nglib::Ng_Mesh* mesh );
nglib::Ng_Mesh* ngMesh() { return (nglib::Ng_Mesh*)(void*)_ngMesh; }
static int GenerateMesh(netgen::OCCGeometry& occgeo, int startWith, int endWith,
netgen::Mesh* & ngMesh);
int GenerateMesh(netgen::OCCGeometry& occgeo, int startWith, int endWith )
{
return GenerateMesh( occgeo, startWith, endWith, _ngMesh );
}
static void CalcLocalH( netgen::Mesh * ngMesh );
static void RemoveTmpFiles();
static int& instanceCounter();
void setOutputFile(std::string);
private:
std::string getOutputFileName();
void removeOutputFile();
std::string _outputFileName;
// This will change current directory when the class is instanciated and switch
ChdirRAII _tmpDir;
ostream * _ngcout;
ostream * _ngcerr;
std::streambuf* _coutBuffer; // to re-/store cout.rdbuf()
};
@ -163,7 +102,7 @@ struct NETGENPLUGIN_EXPORT NETGENPlugin_NetgenLibWrapper
*/
//=============================================================================
class NETGENPLUGIN_EXPORT NETGENPlugin_Mesher
class NETGENPLUGIN_EXPORT NETGENPlugin_Mesher
{
public:
// ---------- PUBLIC METHODS ----------
@ -175,62 +114,9 @@ class NETGENPLUGIN_EXPORT NETGENPlugin_Mesher
void SetParameters(const NETGENPlugin_Hypothesis* hyp);
void SetParameters(const NETGENPlugin_SimpleHypothesis_2D* hyp);
void SetParameters(const StdMeshers_ViscousLayers* hyp );
void SetViscousLayers2DAssigned(bool isAssigned) { _isViscousLayers2D = isAssigned; }
void SetLocalSizeForChordalError( netgen::OCCGeometry& occgeo, netgen::Mesh& ngMesh );
static void SetLocalSize( netgen::OCCGeometry& occgeo, netgen::Mesh& ngMesh );
/**
* @brief InitialSetup. Fill occgeo map with geometrical objects not meshed. Fill meshdSM with the already computed
* submeshes, and mesh the internal edges so faces with internal are eventurally properly meshed.
* Define the class members _ngMesh and _occgeom
*/
void InitialSetup( NETGENPlugin_NetgenLibWrapper& ngLib, netgen::OCCGeometry& occgeo,
list< SMESH_subMesh* >* meshedSM, NETGENPlugin_Internals* internals,
SMESH_MesherHelper &quadHelper, NETGENPlugin_ngMeshInfo& initState, netgen::MeshingParameters &mparams );
void InitialSetupSA( NETGENPlugin_NetgenLibWrapper& ngLib, netgen::OCCGeometry& occgeo,
list< SMESH_subMesh* >* meshedSM, NETGENPlugin_Internals* internals,
SMESH_MesherHelper &quadHelper, NETGENPlugin_ngMeshInfo& initState,
netgen::MeshingParameters &mparams, bool useFMapFunction = false );
void SetBasicMeshParameters( NETGENPlugin_NetgenLibWrapper& ngLib, netgen::MeshingParameters &mparams, netgen::OCCGeometry& occgeo );
void SetBasicMeshParametersFor2D( netgen::OCCGeometry& occgeo, vector< const SMDS_MeshNode* >& nodeVec,
netgen::MeshingParameters &mparams, NETGENPlugin_Internals* internals,
NETGENPlugin_ngMeshInfo& initState );
void SetBasicMeshParametersFor3D( NETGENPlugin_NetgenLibWrapper& ngLib, netgen::OCCGeometry& occgeo,
vector< const SMDS_MeshNode* >& nodeVec, netgen::MeshingParameters &mparams,
NETGENPlugin_Internals* internals, NETGENPlugin_ngMeshInfo& initState, SMESH_MesherHelper &quadHelper,
SMESH_Comment& comment );
void CallNetgenConstAnalysis( NETGENPlugin_NetgenLibWrapper& ngLib, netgen::MeshingParameters &mparams, netgen::OCCGeometry& occgeo );
int CallNetgenMeshEdges( NETGENPlugin_NetgenLibWrapper& ngLib, netgen::OCCGeometry& occgeo );
int CallNetgenMeshFaces( NETGENPlugin_NetgenLibWrapper& ngLib, netgen::OCCGeometry& occgeo, SMESH_Comment& comment );
int CallNetgenMeshVolumens( NETGENPlugin_NetgenLibWrapper& ngLib, netgen::OCCGeometry& occgeo, SMESH_Comment& comment );
void MakeSecondOrder( netgen::MeshingParameters &mparams, netgen::OCCGeometry& occgeo,
list< SMESH_subMesh* >* meshedSM, NETGENPlugin_ngMeshInfo& initState, SMESH_Comment& comment );
int FillInternalElements( NETGENPlugin_NetgenLibWrapper& ngLib, NETGENPlugin_Internals& internals, netgen::OCCGeometry& occgeo,
NETGENPlugin_ngMeshInfo& initState, SMESH_MesherHelper &quadHelper, list< SMESH_subMesh* >* meshedSM );
bool Fill2DViscousLayer( netgen::OCCGeometry& occgeo, vector< const SMDS_MeshNode* >& nodeVec,
NETGENPlugin_Internals* internals, NETGENPlugin_ngMeshInfo& initState );
bool Fill3DViscousLayerAndQuadAdaptor( netgen::OCCGeometry& occgeo, vector< const SMDS_MeshNode* >& nodeVec,
netgen::MeshingParameters &mparams, NETGENPlugin_ngMeshInfo& initState,
list< SMESH_subMesh* >* meshedSM, SMESH_MesherHelper &quadHelper, int & err );
int Fill0D1DElements( netgen::OCCGeometry& occgeo, vector< const SMDS_MeshNode* >& nodeVec, list< SMESH_subMesh* >* meshedSM, SMESH_MesherHelper &quadHelper );
void FillSMESH( netgen::OCCGeometry& occgeo, NETGENPlugin_ngMeshInfo& initState, vector< const SMDS_MeshNode* >& nodeVec, SMESH_MesherHelper &quadHelper, SMESH_Comment& comment );
///// End definition methods to rewrite function
enum DIM {
D1 = 1,
D2,
D3
};
bool Compute();
bool Compute( NETGENPlugin_NetgenLibWrapper& ngLib, vector< const SMDS_MeshNode* >& nodeVec, bool write2SMESH, DIM dim );
bool Evaluate(MapShapeNbElems& aResMap);
@ -249,7 +135,7 @@ class NETGENPLUGIN_EXPORT NETGENPlugin_Mesher
static void RestrictLocalSize(netgen::Mesh& ngMesh,
const gp_XYZ& p,
double size,
const double size,
const bool overrideMinH=true);
static int FillSMesh(const netgen::OCCGeometry& occgeom,
@ -271,10 +157,6 @@ class NETGENPLUGIN_EXPORT NETGENPlugin_Mesher
netgen::Mesh& ngMesh,
NETGENPlugin_Internals& internalShapes);
static bool FixFaceMesh(const netgen::OCCGeometry& occgeom,
netgen::Mesh& ngMesh,
const int faceID);
static void AddIntVerticesInFaces(const netgen::OCCGeometry& occgeom,
netgen::Mesh& ngMesh,
std::vector<const SMDS_MeshNode*>& nodeVec,
@ -295,33 +177,22 @@ class NETGENPLUGIN_EXPORT NETGENPlugin_Mesher
void SetDefaultParameters();
static void RemoveTmpFiles();
static SMESH_ComputeErrorPtr ReadErrors(const std::vector< const SMDS_MeshNode* >& nodeVec);
static void toPython( const netgen::Mesh* ngMesh ); // debug
static void toPython( const netgen::Mesh* ngMesh,
const std::string& pyFile); // debug
private:
bool Compute1D( NETGENPlugin_NetgenLibWrapper& ngLib, netgen::OCCGeometry& occgeo );
bool Compute2D( NETGENPlugin_NetgenLibWrapper& ngLib, netgen::OCCGeometry& occgeo,
netgen::MeshingParameters &mparams, list< SMESH_subMesh* >* meshedSM,
NETGENPlugin_ngMeshInfo& initState, NETGENPlugin_Internals* internals,
vector< const SMDS_MeshNode* >& nodeVec, SMESH_Comment& comment, DIM dim );
bool Compute3D( NETGENPlugin_NetgenLibWrapper& ngLib, netgen::OCCGeometry& occgeo,
netgen::MeshingParameters &mparams, list< SMESH_subMesh* >* meshedSM,
NETGENPlugin_ngMeshInfo& initState, NETGENPlugin_Internals* internals,
vector< const SMDS_MeshNode* >& nodeVec, SMESH_MesherHelper &quadHelper,
SMESH_Comment& comment);
SMESH_Mesh* _mesh;
const TopoDS_Shape& _shape;
bool _isVolume;
bool _optimize;
int _fineness;
bool _isViscousLayers2D;
double _chordalError;
netgen::Mesh* _ngMesh;
netgen::OCCGeometry* _occgeom;
@ -331,11 +202,10 @@ class NETGENPLUGIN_EXPORT NETGENPlugin_Mesher
volatile double _totalTime;
const NETGENPlugin_SimpleHypothesis_2D * _simpleHyp;
const StdMeshers_ViscousLayers* _viscousLayersHyp;
// a pointer to NETGENPlugin_Mesher* field of the holder, that will be
// nullified at destruction of this
NETGENPlugin_Mesher ** _ptrToMe;
NETGENPlugin_Mesher ** _ptrToMe;
};
//=============================================================================
@ -378,7 +248,7 @@ public:
bool isShapeToPrecompute(const TopoDS_Shape& s);
// 2D meshing
// edges
// edges
bool hasInternalEdges() const { return !_e2face.empty(); }
bool isInternalEdge( int id ) const { return _e2face.count( id ); }
const std::map<int,int>& getEdgesAndVerticesWithFaces() const { return _e2face; }

View File

@ -1,386 +0,0 @@
// Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// NETGENPlugin : C++ implementation
// File : NETGENPlugin_NETGEN_2D3D_SA.cxx
// Author : Cesar Conopoima (OCC)
// Date : 01/11/2023
// Project : SALOME
//=============================================================================
//
#include "NETGENPlugin_DriverParam.hxx"
#include "NETGENPlugin_Hypothesis.hxx"
#include "NETGENPlugin_SimpleHypothesis_3D.hxx"
#include "NETGENPlugin_NETGEN_2D.hxx"
#include "NETGENPlugin_NETGEN_1D2D3D_SA.hxx"
#include <SMESHDS_Mesh.hxx>
#include <SMESH_ControlsDef.hxx>
#include <SMESH_Gen.hxx>
#include <SMESH_Mesh.hxx>
#include <SMESH_MesherHelper.hxx>
#include <SMESH_DriverShape.hxx>
#include <SMESH_DriverMesh.hxx>
#include <utilities.h>
#include <list>
namespace nglib {
#include <nglib.h>
}
#include <meshing.hpp>
using namespace nglib;
//=============================================================================
/*!
*
*/
//=============================================================================
NETGENPlugin_NETGEN_1D2D3D_SA::NETGENPlugin_NETGEN_1D2D3D_SA()
: NETGENPlugin_NETGEN_2D3D(0, new SMESH_Gen())
{
_name = "NETGEN_1D2D3D_SA";
}
//=============================================================================
/*!
*
*/
//=============================================================================
NETGENPlugin_NETGEN_1D2D3D_SA::~NETGENPlugin_NETGEN_1D2D3D_SA()
{
}
/**
* @brief Check presence and content of orientation file. Implemented for completness and future reference.
*
* @param element_orientation_file Binary file containing the orientation of surface elemnts
* @return true, false
*/
bool NETGENPlugin_NETGEN_1D2D3D_SA::checkOrientationFile( const std::string element_orientation_file )
{
if(element_orientation_file.empty()){
MESSAGE("No element orientation file");
return true;
} else {
MESSAGE("Reading from elements from file: " << element_orientation_file);
// By construction the orientation file written by Remote version has a zero written to mark no need of orientation in 2D meshing
int nbElement;
std::ifstream df(element_orientation_file, ios::binary|ios::in);
df.read((char*)&nbElement, sizeof(int));
df.close();
return (nbElement == 0);
}
}
/**
* @brief fill plugin hypothesis from the netgen_params structure
*
* @param aParams the structure
*/
void NETGENPlugin_NETGEN_1D2D3D_SA::fillHyp(netgen_params aParams)
{
if( aParams.myType == hypoType::Hypo )
{
NETGENPlugin_Hypothesis * hypParameters = new NETGENPlugin_Hypothesis(0, GetGen());
hypParameters->SetMaxSize(aParams.maxh);
hypParameters->SetMinSize(aParams.minh);
hypParameters->SetNbSegPerEdge(aParams.segmentsperedge);
hypParameters->SetGrowthRate(aParams.grading);
hypParameters->SetNbSegPerRadius(aParams.curvaturesafety);
hypParameters->SetSecondOrder(aParams.secondorder);
hypParameters->SetQuadAllowed(aParams.quad);
hypParameters->SetOptimize(aParams.optimize);
hypParameters->SetFineness((NETGENPlugin_Hypothesis::Fineness)aParams.fineness);
hypParameters->SetSurfaceCurvature(aParams.uselocalh);
hypParameters->SetFuseEdges(aParams.merge_solids);
hypParameters->SetChordalErrorEnabled(aParams.chordalError);
if(aParams.optimize){
hypParameters->SetNbSurfOptSteps(aParams.optsteps2d);
hypParameters->SetNbVolOptSteps(aParams.optsteps3d);
}
hypParameters->SetElemSizeWeight(aParams.elsizeweight);
hypParameters->SetWorstElemMeasure(aParams.opterrpow);
hypParameters->SetUseDelauney(aParams.delaunay);
hypParameters->SetCheckOverlapping(aParams.checkoverlap);
hypParameters->SetCheckChartBoundary(aParams.checkchartboundary);
hypParameters->SetMeshSizeFile(aParams.meshsizefilename);
_hypothesis = dynamic_cast< const NETGENPlugin_Hypothesis *> (hypParameters);
}
else if ( aParams.myType == hypoType::Simple2D )
{
NETGENPlugin_SimpleHypothesis_2D * hypParameters = new NETGENPlugin_SimpleHypothesis_2D(0, GetGen());
// mandatory to fill in this branch case!
// Number of segments (int)
// localLenght (double)
// maxElement area (double)
// GetAllowQuadrangles (bool)
hypParameters->SetNumberOfSegments( aParams.numberOfSegments );
if ( !aParams.numberOfSegments )
hypParameters->SetLocalLength( aParams.localLength );
hypParameters->SetMaxElementArea( aParams.maxElementArea );
hypParameters->SetAllowQuadrangles( aParams.allowQuadrangles );
_hypothesis = dynamic_cast< const NETGENPlugin_SimpleHypothesis_2D *> (hypParameters);
}
else if ( aParams.myType == hypoType::Simple3D )
{
NETGENPlugin_SimpleHypothesis_3D * hypParameters = new NETGENPlugin_SimpleHypothesis_3D(0, GetGen());
// mandatory to fill in this branch case!
// Number of segments (int)
// localLenght (double)
// maxElement area (double)
// maxElement volume (double)
// GetAllowQuadrangles (bool)
hypParameters->SetNumberOfSegments( aParams.numberOfSegments );
if ( !aParams.numberOfSegments )
hypParameters->SetLocalLength( aParams.localLength );
hypParameters->SetMaxElementArea( aParams.maxElementArea );
hypParameters->SetMaxElementVolume( aParams.maxElementVol );
hypParameters->SetAllowQuadrangles( aParams.allowQuadrangles );
_hypothesis = dynamic_cast< const NETGENPlugin_SimpleHypothesis_3D *> (hypParameters);
}
}
/**
* @brief Write a binary file containing information on the elements/nodes
* created by the netgen mesher
*
* @param nodeVec mapping between the mesh id and the netgen structure id
* @param ngLib Wrapper on netgen library
* @param new_element_file Name of the output file
* @param NumOfPremeshedNodes Number of nodes in the netgen structure
* @return true if there are some error
*/
bool NETGENPlugin_NETGEN_1D2D3D_SA::FillNewElementFile( std::vector< const SMDS_MeshNode* > &nodeVec, NETGENPlugin_NetgenLibWrapper &ngLib,
std::string new_element_file, const NETGENPlugin_Mesher::DIM dim )
{
// Particularities: As submeshing is not supported nodeVect is empty and NumberOfPremeshedNodes is also zero
Ng_Mesh* NetgenMesh = ngLib.ngMesh();
int NetgenNodes = Ng_GetNP(NetgenMesh);
int NetgenSeg2D = Ng_GetNSeg_2D( NetgenMesh );
int NetgenFaces = Ng_GetNSE(NetgenMesh);
int NetgenVols = Ng_GetNE(NetgenMesh);
int segmentId;
bool isOK = ( NetgenNodes > 0 && NetgenSeg2D > 0 );
if ( isOK && !new_element_file.empty() )
{
MESSAGE("Writting new elements")
std::ofstream df(new_element_file, ios::out|ios::binary);
double NetgenPoint[3];
int NetgenSegment[2];
int NetgenSurface[8];
int NetgenVolumens[10];
// Writing nodevec (correspondence netgen numbering mesh numbering)
// Number of nodes
const int NumOfPremeshedNodes = nodeVec.size();
df.write((char*) &NumOfPremeshedNodes, sizeof(int));
df.write((char*) &NetgenNodes, sizeof(int));
for (int nodeIndex = 1 ; nodeIndex <= NumOfPremeshedNodes; ++nodeIndex )
{
//Id of the point
int id = nodeVec.at(nodeIndex)->GetID();
df.write((char*) &id, sizeof(int));
}
// Writing all new points
for (int nodeIndex = NumOfPremeshedNodes + 1; nodeIndex <= NetgenNodes; ++nodeIndex )
{
Ng_GetPoint( NetgenMesh, nodeIndex, NetgenPoint );
// Coordinates of the point
df.write((char *) &NetgenPoint, sizeof(double)*3);
}
if ( dim >= NETGENPlugin_Mesher::D1 )
{
// create segments at boundaries.
df.write((char*) &NetgenSeg2D, sizeof(int));
for ( int elemIndex = 1; elemIndex <= NetgenSeg2D; ++elemIndex )
{
Ng_GetSegment_2D( NetgenMesh, elemIndex, NetgenSegment, &segmentId );
df.write((char*) &NetgenSegment, sizeof(int) * 2 );
}
}
if ( dim >= NETGENPlugin_Mesher::D2 )
{
// create surface elements.
df.write((char*) &NetgenFaces, sizeof(int));
for ( int elemIndex = 1; elemIndex <= NetgenFaces; ++elemIndex )
{
nglib::Ng_Surface_Element_Type elemType = Ng_GetSurfaceElement( NetgenMesh, elemIndex, NetgenSurface );
switch (elemType)
{
case nglib::NG_TRIG:
{
df.write((char*) &NetgenSurface, sizeof(int) * 3 );
break;
}
case nglib::NG_QUAD:
{
df.write((char*) &NetgenSurface, sizeof(int) * 4 );
break;
}
case nglib::NG_TRIG6:
{
df.write((char*) &NetgenSurface, sizeof(int) * 6 );
break;
}
case nglib::NG_QUAD8:
{
df.write((char*) &NetgenSurface, sizeof(int) * 8 );
break;
}
default:
{ break; }
}
}
}
if ( dim >= NETGENPlugin_Mesher::D3 )
{
// create volume elements.
df.write((char*) &NetgenVols, sizeof(int));
for ( int elemIndex = 1; elemIndex <= NetgenVols; ++elemIndex )
{
nglib::Ng_Volume_Element_Type elemType = Ng_GetVolumeElement( NetgenMesh, elemIndex, NetgenVolumens );
switch (elemType)
{
case nglib::NG_TET:
{
df.write((char*) &NetgenVolumens, sizeof(int) * 4 );
break;
}
case nglib::NG_PYRAMID:
{
df.write((char*) &NetgenVolumens, sizeof(int) * 5 );
break;
}
case nglib::NG_PRISM:
{
df.write((char*) &NetgenVolumens, sizeof(int) * 6 );
break;
}
case nglib::NG_TET10:
{
df.write((char*) &NetgenVolumens, sizeof(int) * 10 );
break;
}
default:
{ break; }
}
}
}
df.close();
}
return false;
}
/**
* @brief Compute the mesh based on the
*
* @param aMesh the read Mesh
* @param aShape the loaded shape
* @param new_element_file output file containing info the elements created by the mesher
* @param output_mesh whether or not write the created elements into the mesh
* @param dim the dimension to be meshed.
* @return negation of mesh fail: true, false
*/
bool NETGENPlugin_NETGEN_1D2D3D_SA::Compute(SMESH_Mesh& aMesh, TopoDS_Shape &aShape, std::string new_element_file, bool output_mesh, NETGENPlugin_Mesher::DIM dim )
{
//
netgen::multithread.terminate = 0;
NETGENPlugin_Mesher mesher(&aMesh, aShape, /*is3D = */ false );
mesher.SetParameters(dynamic_cast<const NETGENPlugin_Hypothesis*>(_hypothesis));
if ( dim == NETGENPlugin_Mesher::D3 )
mesher.SetParameters(dynamic_cast<const NETGENPlugin_SimpleHypothesis_3D*>(_hypothesis));
else
mesher.SetParameters(dynamic_cast<const NETGENPlugin_SimpleHypothesis_2D*>(_hypothesis));
NETGENPlugin_NetgenLibWrapper ngLib;
vector< const SMDS_MeshNode* > nodeVec;
bool err = mesher.Compute( ngLib, nodeVec, output_mesh, dim );
FillNewElementFile( nodeVec, ngLib, new_element_file, dim );
return err;
}
/**
* @brief Running the mesher on the given files
*
* @param input_mesh_file Mesh file (containing 2D elements)
* @param shape_file Shape file (BREP or STEP format)
* @param hypo_file Ascii file containing the netgen parameters
* @param element_orientation_file Binary file containing the orientation of surface elemnts
* @param new_element_file output file containing info the elements created by the mesher
* @param output_mesh_file output mesh file (if empty it will not be created)
* @return negation of mesh fail: true, false
*/
int NETGENPlugin_NETGEN_1D2D3D_SA::run(const std::string input_mesh_file,
const std::string shape_file,
const std::string hypo_file,
const std::string element_orientation_file,
const std::string new_element_file,
const std::string output_mesh_file,
const NETGENPlugin_Mesher::DIM dim )
{
// _element_orientation_file = element_orientation_file;
std::unique_ptr<SMESH_Mesh> myMesh(_gen->CreateMesh(false));
// Importing mesh
SMESH_DriverMesh::importMesh(input_mesh_file, *myMesh);
// Importing shape
TopoDS_Shape myShape;
SMESH_DriverShape::importShape(shape_file, myShape);
// Importing hypothesis
netgen_params myParams;
importNetgenParams(hypo_file, myParams);
fillHyp(myParams);
int ret = 1;
if ( checkOrientationFile(element_orientation_file) )
{
ret = Compute( *myMesh, myShape, new_element_file, !output_mesh_file.empty(), dim );
if(ret){
std::cerr << "Meshing failed" << std::endl;
return ret;
}
if(!output_mesh_file.empty()){
std::string meshName = "MESH";
SMESH_DriverMesh::exportMesh(output_mesh_file, *myMesh, meshName);
}
}
else
std::cerr << "For NETGENPlugin_NETGEN_1D2D3D_SA, orientation file should be market with 0 or be empty!" << std::endl;
return ret;
}

View File

@ -1,63 +0,0 @@
// Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// NETGENPlugin : C++ implementation
// File : NETGENPlugin_NETGEN_2D_SA.hxx
// Author : Cesar Conopoima (OCC)
// Date : 23/10/2023
// Project : SALOME
//=============================================================================
//
#ifndef _NETGENPlugin_NETGEN_1D2D3D_SA_HXX_
#define _NETGENPlugin_NETGEN_1D2D3D_SA_HXX_
#include "NETGENPlugin_Defs.hxx"
#include "NETGENPlugin_Mesher.hxx"
#include "NETGENPlugin_NETGEN_2D3D.hxx"
#include "SMESH_Algo.hxx"
#include "SMESH_Mesh.hxx"
class NETGENPlugin_Mesher;
class NETGENPLUGIN_EXPORT NETGENPlugin_NETGEN_1D2D3D_SA: public NETGENPlugin_NETGEN_2D3D
{
public:
NETGENPlugin_NETGEN_1D2D3D_SA();
virtual ~NETGENPlugin_NETGEN_1D2D3D_SA();
bool Compute(SMESH_Mesh& aMesh, TopoDS_Shape &aShape, std::string new_element_file, bool output_mesh, NETGENPlugin_Mesher::DIM dim );
int run(const std::string input_mesh_file,
const std::string shape_file,
const std::string hypo_file,
const std::string element_orientation_file,
const std::string new_element_file,
const std::string output_mesh_file,
const NETGENPlugin_Mesher::DIM dim );
private:
bool checkOrientationFile( const std::string element_orientation_file );
void fillHyp(netgen_params aParams);
bool FillNewElementFile( std::vector< const SMDS_MeshNode* > &nodeVec, NETGENPlugin_NetgenLibWrapper &ngLib,
std::string new_element_file, const NETGENPlugin_Mesher::DIM dim );
};
#endif

View File

@ -1,4 +1,4 @@
// Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE
// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@ -54,10 +54,11 @@ using namespace std;
*/
//=============================================================================
NETGENPlugin_NETGEN_2D::NETGENPlugin_NETGEN_2D(int hypId,
NETGENPlugin_NETGEN_2D::NETGENPlugin_NETGEN_2D(int hypId, int studyId,
SMESH_Gen* gen)
: SMESH_2D_Algo(hypId, gen)
: SMESH_2D_Algo(hypId, studyId, gen)
{
MESSAGE("NETGENPlugin_NETGEN_2D::NETGENPlugin_NETGEN_2D");
_name = "NETGEN_2D";
_shapeType = (1 << TopAbs_FACE); // 1 bit /shape type
_compatibleHypothesis.push_back("NETGEN_Parameters_2D");
@ -77,6 +78,7 @@ NETGENPlugin_NETGEN_2D::NETGENPlugin_NETGEN_2D(int hypId,
NETGENPlugin_NETGEN_2D::~NETGENPlugin_NETGEN_2D()
{
MESSAGE("NETGENPlugin_NETGEN_2D::~NETGENPlugin_NETGEN_2D");
}
//=============================================================================

View File

@ -1,4 +1,4 @@
// Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE
// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@ -40,7 +40,7 @@ class NETGENPlugin_Mesher;
class NETGENPLUGIN_EXPORT NETGENPlugin_NETGEN_2D: public SMESH_2D_Algo
{
public:
NETGENPlugin_NETGEN_2D(int hypId, SMESH_Gen* gen);
NETGENPlugin_NETGEN_2D(int hypId, int studyId, SMESH_Gen* gen);
virtual ~NETGENPlugin_NETGEN_2D();
virtual bool CheckHypothesis(SMESH_Mesh& aMesh,

View File

@ -1,4 +1,4 @@
// Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE
// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@ -32,12 +32,10 @@
#include "NETGENPlugin_SimpleHypothesis_3D.hxx"
#include "NETGENPlugin_Mesher.hxx"
#include <SMESHDS_Mesh.hxx>
#include <SMESH_ControlsDef.hxx>
#include <SMESH_Gen.hxx>
#include <SMESH_Mesh.hxx>
#include <StdMeshers_ViscousLayers.hxx>
#include <SMESH_ControlsDef.hxx>
#include <SMESHDS_Mesh.hxx>
#include <utilities.h>
#include <list>
@ -55,16 +53,15 @@ using namespace std;
*/
//=============================================================================
NETGENPlugin_NETGEN_2D3D::NETGENPlugin_NETGEN_2D3D(int hypId,
NETGENPlugin_NETGEN_2D3D::NETGENPlugin_NETGEN_2D3D(int hypId, int studyId,
SMESH_Gen* gen)
: SMESH_3D_Algo(hypId, gen)
: SMESH_3D_Algo(hypId, studyId, gen)
{
//MESSAGE("NETGENPlugin_NETGEN_2D3D::NETGENPlugin_NETGEN_2D3D");
MESSAGE("NETGENPlugin_NETGEN_2D3D::NETGENPlugin_NETGEN_2D3D");
_name = "NETGEN_2D3D";
_shapeType = (1 << TopAbs_SHELL) | (1 << TopAbs_SOLID);// 1 bit /shape type
_compatibleHypothesis.push_back("NETGEN_Parameters");
_compatibleHypothesis.push_back("NETGEN_SimpleParameters_3D");
_compatibleHypothesis.push_back( StdMeshers_ViscousLayers::GetHypType() );
_requireDiscreteBoundary = false;
_onlyUnaryInput = false;
_hypothesis = NULL;
@ -73,56 +70,52 @@ NETGENPlugin_NETGEN_2D3D::NETGENPlugin_NETGEN_2D3D(int hypId,
//=============================================================================
/*!
*
*
*/
//=============================================================================
NETGENPlugin_NETGEN_2D3D::~NETGENPlugin_NETGEN_2D3D()
{
//MESSAGE("NETGENPlugin_NETGEN_2D3D::~NETGENPlugin_NETGEN_2D3D");
MESSAGE("NETGENPlugin_NETGEN_2D3D::~NETGENPlugin_NETGEN_2D3D");
}
//=============================================================================
/*!
*
*
*/
//=============================================================================
bool NETGENPlugin_NETGEN_2D3D::CheckHypothesis (SMESH_Mesh& aMesh,
const TopoDS_Shape& aShape,
Hypothesis_Status& aStatus)
bool NETGENPlugin_NETGEN_2D3D::CheckHypothesis
(SMESH_Mesh& aMesh,
const TopoDS_Shape& aShape,
SMESH_Hypothesis::Hypothesis_Status& aStatus)
{
_hypothesis = NULL;
_viscousLayersHyp = NULL;
_mesher = NULL;
MESSAGE("NETGENPlugin_NETGEN_2D3D::CheckHypothesis");
const list<const SMESHDS_Hypothesis*>& hyps = GetUsedHypothesis(aMesh, aShape, /*noAux=*/false);
if ( hyps.empty() )
_hypothesis = NULL;
_mesher = NULL;
const list<const SMESHDS_Hypothesis*>& hyps = GetUsedHypothesis(aMesh, aShape);
int nbHyp = hyps.size();
if (!nbHyp)
{
aStatus = SMESH_Hypothesis::HYP_OK;
return true; // can work with no hypothesis
}
list<const SMESHDS_Hypothesis*>::const_iterator h = hyps.begin();
for ( ; h != hyps.end(); ++h )
{
const SMESHDS_Hypothesis* aHyp = *h;
std::string hypName = aHyp->GetName();
const SMESHDS_Hypothesis* theHyp = hyps.front(); // use only the first hypothesis
if ( std::find( _compatibleHypothesis.begin(), _compatibleHypothesis.end(),
hypName ) != _compatibleHypothesis.end() )
{
if ( hypName == StdMeshers_ViscousLayers::GetHypType() )
_viscousLayersHyp = dynamic_cast<const StdMeshers_ViscousLayers*>( aHyp );
else
_hypothesis = aHyp;
aStatus = SMESH_Hypothesis::HYP_OK;
}
else
{
aStatus = SMESH_Hypothesis::HYP_INCOMPATIBLE;
break;
}
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;
@ -142,7 +135,6 @@ bool NETGENPlugin_NETGEN_2D3D::Compute(SMESH_Mesh& aMesh,
NETGENPlugin_Mesher mesher(&aMesh, aShape, true);
mesher.SetParameters(dynamic_cast<const NETGENPlugin_Hypothesis*>(_hypothesis));
mesher.SetParameters(dynamic_cast<const NETGENPlugin_SimpleHypothesis_3D*>(_hypothesis));
mesher.SetParameters(_viscousLayersHyp);
mesher.SetSelfPointer( &_mesher );
return mesher.Compute();
}

View File

@ -1,4 +1,4 @@
// Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE
// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@ -35,19 +35,18 @@
#include <SMESH_Algo.hxx>
class NETGENPlugin_Mesher;
class StdMeshers_ViscousLayers;
class NETGENPLUGIN_EXPORT NETGENPlugin_NETGEN_2D3D: public SMESH_3D_Algo
{
public:
NETGENPlugin_NETGEN_2D3D(int hypId, SMESH_Gen* gen);
NETGENPlugin_NETGEN_2D3D(int hypId, int studyId, SMESH_Gen* gen);
virtual ~NETGENPlugin_NETGEN_2D3D();
virtual bool CheckHypothesis(SMESH_Mesh& aMesh,
virtual bool CheckHypothesis(SMESH_Mesh& aMesh,
const TopoDS_Shape& aShape,
Hypothesis_Status& aStatus);
SMESH_Hypothesis::Hypothesis_Status& aStatus);
virtual bool Compute(SMESH_Mesh& aMesh,
virtual bool Compute(SMESH_Mesh& aMesh,
const TopoDS_Shape& aShape);
virtual void CancelCompute();
@ -55,14 +54,13 @@ public:
virtual double GetProgress() const;
virtual bool Evaluate(SMESH_Mesh& aMesh,
virtual bool Evaluate(SMESH_Mesh& aMesh,
const TopoDS_Shape& aShape,
MapShapeNbElems& aResMap);
MapShapeNbElems& aResMap);
protected:
const SMESHDS_Hypothesis* _hypothesis;
const StdMeshers_ViscousLayers* _viscousLayersHyp;
NETGENPlugin_Mesher * _mesher;
const SMESHDS_Hypothesis* _hypothesis;
NETGENPlugin_Mesher * _mesher;
};
#endif

View File

@ -1,4 +1,4 @@
// Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE
// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@ -43,14 +43,16 @@ using namespace std;
//=============================================================================
NETGENPlugin_NETGEN_2D3D_i::NETGENPlugin_NETGEN_2D3D_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( "NETGENPlugin_NETGEN_2D3D_i::NETGENPlugin_NETGEN_2D3D_i" );
MESSAGE( "NETGENPlugin_NETGEN_2D3D_i::NETGENPlugin_NETGEN_2D3D_i" );
myBaseImpl = new ::NETGENPlugin_NETGEN_2D3D( theGenImpl->GetANewId(),
theStudyId,
theGenImpl );
}
@ -64,7 +66,7 @@ NETGENPlugin_NETGEN_2D3D_i::NETGENPlugin_NETGEN_2D3D_i( PortableServer::POA_ptr
NETGENPlugin_NETGEN_2D3D_i::~NETGENPlugin_NETGEN_2D3D_i()
{
//MESSAGE( "NETGENPlugin_NETGEN_2D3D_i::~NETGENPlugin_NETGEN_2D3D_i" );
MESSAGE( "NETGENPlugin_NETGEN_2D3D_i::~NETGENPlugin_NETGEN_2D3D_i" );
}
//=============================================================================
@ -77,5 +79,6 @@ NETGENPlugin_NETGEN_2D3D_i::~NETGENPlugin_NETGEN_2D3D_i()
::NETGENPlugin_NETGEN_2D3D* NETGENPlugin_NETGEN_2D3D_i::GetImpl()
{
MESSAGE( "NETGENPlugin_NETGEN_2D3D_i::GetImpl" );
return ( ::NETGENPlugin_NETGEN_2D3D* )myBaseImpl;
}

View File

@ -1,4 +1,4 @@
// Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE
// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@ -47,6 +47,7 @@ class NETGENPLUGIN_EXPORT NETGENPlugin_NETGEN_2D3D_i:
public:
// Constructor
NETGENPlugin_NETGEN_2D3D_i( PortableServer::POA_ptr thePOA,
int theStudyId,
::SMESH_Gen* theGenImpl );
// Destructor
virtual ~NETGENPlugin_NETGEN_2D3D_i();

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
// Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE
// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@ -26,10 +26,6 @@
#include <SMESH_Algo.hxx>
#include <SMESH_Mesh.hxx>
#include <SMESH_Group.hxx>
#include <SMESHDS_GroupBase.hxx>
#include "NETGENPlugin_Mesher.hxx"
class StdMeshers_MaxElementArea;
class StdMeshers_LengthFromEdges;
@ -46,7 +42,7 @@ class NETGENPlugin_Hypothesis_2D;
class NETGENPlugin_NETGEN_2D_ONLY: public SMESH_2D_Algo
{
public:
NETGENPlugin_NETGEN_2D_ONLY(int hypId, SMESH_Gen* gen);
NETGENPlugin_NETGEN_2D_ONLY(int hypId, int studyId, SMESH_Gen* gen);
virtual ~NETGENPlugin_NETGEN_2D_ONLY();
virtual bool CheckHypothesis(SMESH_Mesh& aMesh,
@ -54,7 +50,7 @@ public:
Hypothesis_Status& aStatus);
virtual bool Compute(SMESH_Mesh& aMesh,
const TopoDS_Shape& aShape);
const TopoDS_Shape& aShape);
virtual void CancelCompute();
@ -63,29 +59,6 @@ public:
virtual bool Evaluate(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape,
MapShapeNbElems& aResMap);
bool MapSegmentsToEdges(SMESH_Mesh& aMesh,
const TopoDS_Shape& aShape,
NETGENPlugin_NetgenLibWrapper &ngLib,
vector< const SMDS_MeshNode* >& nodeVec,
std::map<int,const SMDS_MeshNode*>& premeshedNodes,
std::map<int,std::vector<double>>& newNetgenCoordinates,
std::map<int,std::vector<smIdType>>& newNetgenElements );
std::tuple<bool,bool> SetParameteres( SMESH_Mesh& aMesh, const TopoDS_Shape& aShape,
NETGENPlugin_Mesher& aMesher, netgen::Mesh * ngMeshes,
netgen::OCCGeometry& occgeoComm, bool isSubMeshSupported = true );
bool ComputeMaxhOfFace( TopoDS_Face& Face, NETGENPlugin_Mesher& aMesher, TSideVector& wires,
netgen::OCCGeometry& occgeoComm, bool isDefaultHyp, bool isCommonLocalSize );
void FillNodesAndElements( SMESH_Mesh& aMesh, SMESH_MesherHelper& helper, netgen::Mesh * ngMesh, vector< const SMDS_MeshNode* >& nodeVec, int faceId );
/*!
* \brief FillNodesAndElements, fill created triangular elements by netgen to the smesh data structure
*/
void FillNodesAndElements( SMESH_Mesh& aMesh, SMESH_MesherHelper& helper, netgen::Mesh * ngMesh, vector< const SMDS_MeshNode* >& nodeVec, map<int, const SMDS_MeshNode* >& ng2smesh,
std::map<int,std::vector<double>>& newNetgenCoordinates, std::map<int,std::vector<smIdType>>& newNetgenElements, const int numberOfPremeshedNodes );
protected:
const StdMeshers_MaxElementArea* _hypMaxElementArea;
const StdMeshers_LengthFromEdges* _hypLengthFromEdges;

View File

@ -1,4 +1,4 @@
// Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE
// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@ -17,7 +17,7 @@
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// SMESH SMESH_I : idl implementation based on 'SMESH' unit's classes
// SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
// File : NETGENPlugin_NETGEN_2D_ONLY_i.cxx
// Author : Edward AGAPOV (OCC)
// Module : SMESH
@ -36,13 +36,16 @@
//=============================================================================
NETGENPlugin_NETGEN_2D_ONLY_i::NETGENPlugin_NETGEN_2D_ONLY_i( PortableServer::POA_ptr thePOA,
::SMESH_Gen* theGenImpl )
int theStudyId,
::SMESH_Gen* theGenImpl )
: SALOME::GenericObj_i( thePOA ),
SMESH_Hypothesis_i( thePOA ),
SMESH_Algo_i( thePOA ),
SMESH_2D_Algo_i( thePOA )
{
MESSAGE( "NETGENPlugin_NETGEN_2D_ONLY_i::NETGENPlugin_NETGEN_2D_ONLY_i" );
myBaseImpl = new ::NETGENPlugin_NETGEN_2D_ONLY( theGenImpl->GetANewId(),
theStudyId,
theGenImpl );
}
@ -56,6 +59,7 @@ NETGENPlugin_NETGEN_2D_ONLY_i::NETGENPlugin_NETGEN_2D_ONLY_i( PortableServer::PO
NETGENPlugin_NETGEN_2D_ONLY_i::~NETGENPlugin_NETGEN_2D_ONLY_i()
{
MESSAGE( "NETGENPlugin_NETGEN_2D_ONLY_i::~NETGENPlugin_NETGEN_2D_ONLY_i" );
}
//=============================================================================
@ -68,6 +72,7 @@ NETGENPlugin_NETGEN_2D_ONLY_i::~NETGENPlugin_NETGEN_2D_ONLY_i()
::NETGENPlugin_NETGEN_2D_ONLY* NETGENPlugin_NETGEN_2D_ONLY_i::GetImpl()
{
MESSAGE( "NETGENPlugin_NETGEN_2D_ONLY_i::GetImpl" );
return ( ::NETGENPlugin_NETGEN_2D_ONLY* )myBaseImpl;
}

View File

@ -1,4 +1,4 @@
// Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE
// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@ -17,7 +17,7 @@
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// SMESH SMESH_I : idl implementation based on 'SMESH' unit's classes
// SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
// File : NETGENPlugin_NETGEN_2D_ONLY_i.cxx
// Author : Edward AGAPOV (OCC)
// Module : SMESH
@ -41,6 +41,7 @@ class NETGENPlugin_NETGEN_2D_ONLY_i:
public:
// Constructor
NETGENPlugin_NETGEN_2D_ONLY_i( PortableServer::POA_ptr thePOA,
int theStudyId,
::SMESH_Gen* theGenImpl );
// Destructor
virtual ~NETGENPlugin_NETGEN_2D_ONLY_i();

View File

@ -1,350 +0,0 @@
// Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//=============================================================================
// File : NETGENPlugin_NETGEN_2D_Remote.cxx
// Created : mardi 12 Decembre 2023
// Author : Cesar Conopoima (OCC)
// Project : SALOME
//=============================================================================
//
//
#include "NETGENPlugin_NETGEN_2D_Remote.hxx"
#include "NETGENPlugin_DriverParam.hxx"
#include "NETGENPlugin_Hypothesis.hxx"
#include "Utils_SALOME_Exception.hxx"
#include <SMESH_Gen.hxx>
#include <SMESH_Mesh.hxx>
#include <SMESH_ParallelMesh.hxx>
#include <SMESH_MesherHelper.hxx>
#include <SMESH_DriverShape.hxx>
#include <SMESH_DriverMesh.hxx>
#include <SMESHDS_Mesh.hxx>
#include <SMESH_MeshLocker.hxx>
#include <QString>
#include <QProcess>
#include <boost/filesystem.hpp>
namespace fs = boost::filesystem;
/*
Netgen include files
*/
#ifndef OCCGEOMETRY
#define OCCGEOMETRY
#endif
#include <occgeom.hpp>
#ifdef NETGEN_V5
#include <ngexception.hpp>
#endif
#ifdef NETGEN_V6
#include <core/exception.hpp>
#endif
namespace nglib {
#include <nglib.h>
}
namespace netgen {
NETGENPLUGIN_DLL_HEADER
extern MeshingParameters mparam;
NETGENPLUGIN_DLL_HEADER
extern volatile multithreadt multithread;
}
using namespace nglib;
//=============================================================================
/*!
* Constructor
*/
//=============================================================================
NETGENPlugin_NETGEN_2D_Remote::NETGENPlugin_NETGEN_2D_Remote(int hypId, SMESH_Gen * gen)
: NETGENPlugin_NETGEN_2D_ONLY(hypId, gen)
{
_name = "NETGEN_2D_Remote";
}
//=============================================================================
/*!
* Destructor
*/
//=============================================================================
NETGENPlugin_NETGEN_2D_Remote::~NETGENPlugin_NETGEN_2D_Remote()
{
}
/**
* @brief Fill the structure netgen_param with the information from the hypothesis
*
* @param hyp the hypothesis
* @param aParams the netgen_param structure
*/
void NETGENPlugin_NETGEN_2D_Remote::fillParameters(const NETGENPlugin_Hypothesis* hyp, netgen_params &aParams)
{
aParams.myType = hypoType::Hypo;
aParams.maxh = hyp->GetMaxSize();
aParams.minh = hyp->GetMinSize();
aParams.segmentsperedge = hyp->GetNbSegPerEdge();
aParams.grading = hyp->GetGrowthRate();
aParams.curvaturesafety = hyp->GetNbSegPerRadius();
aParams.secondorder = hyp->GetSecondOrder() ? 1 : 0;
aParams.quad = hyp->GetQuadAllowed() ? 1 : 0;
aParams.optimize = hyp->GetOptimize();
aParams.fineness = hyp->GetFineness();
aParams.uselocalh = hyp->GetSurfaceCurvature();
aParams.merge_solids = hyp->GetFuseEdges();
aParams.chordalError = hyp->GetChordalErrorEnabled() ? hyp->GetChordalError() : -1.;
aParams.optsteps2d = aParams.optimize ? hyp->GetNbSurfOptSteps() : 0;
aParams.optsteps3d = aParams.optimize ? hyp->GetNbVolOptSteps() : 0;
aParams.elsizeweight = hyp->GetElemSizeWeight();
aParams.opterrpow = hyp->GetWorstElemMeasure();
aParams.delaunay = hyp->GetUseDelauney();
aParams.checkoverlap = hyp->GetCheckOverlapping();
aParams.checkchartboundary = hyp->GetCheckChartBoundary();
#ifdef NETGEN_V6
// std::string
aParams.meshsizefilename = hyp->GetMeshSizeFile();
aParams.closeedgefac = 2;
aParams.nbThreads = hyp->GetNbThreads();
#else
// const char*
aParams.meshsizefilename = hyp->GetMeshSizeFile();
aParams.closeedgefac = 0;
aParams.nbThreads = 0;
#endif
}
/**
* @brief write in a binary file the orientation for each surface element of the mesh
*
* @param aMesh The mesh
* @param aShape the shape associated to the mesh
* @param output_file name of the binary file
*/
void NETGENPlugin_NETGEN_2D_Remote::exportElementOrientation(const std::string output_file)
{
std::ofstream df(output_file, ios::out|ios::binary);
int size=0;
df.write((char*)&size, sizeof(int));
df.close();
}
/**
* @brief Compute mesh associate to shape
*
* @param aMesh The mesh
* @param aShape The shape
* @return true fi there are some error
*/
bool NETGENPlugin_NETGEN_2D_Remote::Compute(SMESH_Mesh& aMesh,
const TopoDS_Shape& aShape)
{
{
SMESH_MeshLocker myLocker(&aMesh);
SMESH_Hypothesis::Hypothesis_Status hypStatus;
NETGENPlugin_NETGEN_2D_ONLY::CheckHypothesis(aMesh, aShape, hypStatus);
}
SMESH_ParallelMesh& aParMesh = dynamic_cast<SMESH_ParallelMesh&>(aMesh);
// Temporary folder for run
#ifdef WIN32
fs::path tmp_folder = aParMesh.GetTmpFolder() / fs::path("Volume-%%%%-%%%%");
#else
fs::path tmp_folder = aParMesh.GetTmpFolder() / fs::unique_path(fs::path("Volume-%%%%-%%%%"));
#endif
fs::create_directories(tmp_folder);
// Using MESH2D generated after all triangles where created.
fs::path mesh_file=aParMesh.GetTmpFolder() / fs::path("Mesh1D.med"); // read the premeshed elements from 2D version
fs::path element_orientation_file=tmp_folder / fs::path("element_orientation.dat");
fs::path new_element_file=tmp_folder / fs::path("new_elements.dat");
// Not used kept for debug
//fs::path output_mesh_file=tmp_folder / fs::path("output_mesh.med");
fs::path shape_file=tmp_folder / fs::path("shape.brep");
fs::path param_file=tmp_folder / fs::path("netgen_lenghtfromedge.txt"); /*becuase name contain 'lenghtfromedge' set length of 2D from premeshed 1D elements*/
fs::path log_file=tmp_folder / fs::path("run.log");
fs::path cmd_file=tmp_folder / fs::path("cmd.txt");
std::string mesh_name = "MESH";
{
SMESH_MeshLocker myLocker(&aMesh);
//Writing Shape
SMESH_DriverShape::exportShape(shape_file.string(), aShape);
//Writing hypo
// netgen_params aParams;
// fillParameters(_hypParameters, aParams);
// exportNetgenParams(param_file.string(), aParams);
{
// Simply write the file with the proper name
std::ofstream myfile(param_file.string());
myfile << 1 << std::endl;
myfile.close();
}
// Exporting element orientation
exportElementOrientation(element_orientation_file.string());
}
// Calling run_mesher
// Path to mesher script
fs::path mesher_launcher = fs::path(std::getenv("SMESH_ROOT_DIR"))/
fs::path("bin")/
fs::path("salome")/
fs::path("mesher_launcher.py");
std::string s_program="python3";
std::list<std::string> params;
params.push_back(mesher_launcher.string());
params.push_back("NETGEN2D");
params.push_back(mesh_file.string());
params.push_back(shape_file.string());
params.push_back(param_file.string());
params.push_back("--elem-orient-file=" + element_orientation_file.string());
params.push_back("--new-element-file=" + new_element_file.string());
// params.push_back("--output-mesh-file=" + output_mesh_file.string());
// Parallelism method parameters
int method = aParMesh.GetParallelismMethod();
if(method == ParallelismMethod::MultiThread){
params.push_back("--method=local");
} else if (method == ParallelismMethod::MultiNode){
params.push_back("--method=cluster");
params.push_back("--resource="+aParMesh.GetResource());
params.push_back("--wc-key="+aParMesh.GetWcKey());
params.push_back("--nb-proc=1");
params.push_back("--nb-proc-per-node="+to_string(aParMesh.GetNbProcPerNode()));
params.push_back("--nb-node="+to_string(aParMesh.GetNbNode()));
params.push_back("--walltime="+aParMesh.GetWalltime());
} else {
throw SALOME_Exception("Unknown parallelism method "+method);
}
std::string cmd = "";
cmd += s_program;
for(auto arg: params){
cmd += " " + arg;
}
MESSAGE("Running command: ");
MESSAGE(cmd);
// Writing command in cmd.log
{
std::ofstream flog(cmd_file.string());
flog << cmd << endl;
}
// Building arguments for QProcess
QString program = QString::fromStdString(s_program);
QStringList arguments;
for(auto arg : params){
arguments << arg.c_str();
}
QString out_file = log_file.string().c_str();
QProcess myProcess;
// myProcess.setProcessChannelMode(QProcess::MergedChannels);
myProcess.setProcessChannelMode(QProcess::ForwardedChannels);
myProcess.setStandardOutputFile(out_file);
myProcess.start(program, arguments);
// Waiting for process to finish (argument -1 make it wait until the end of
// the process otherwise it just waits 30 seconds)
bool finished = myProcess.waitForFinished(-1);
int ret = myProcess.exitCode();
if(ret != 0 || !finished){
// Run crahed
std::string msg = "Issue with mesh_launcher: \n";
msg += "See log for more details: " + log_file.string() + "\n";
msg += cmd + "\n";
throw SALOME_Exception(msg);
}
{
SMESH_MeshLocker myLocker(&aMesh);
std::ifstream df(new_element_file.string(), ios::binary);
int totalPremeshedNodes;
int NetgenNbOfNodes;
int NetgenNbOfNodesNew;
int NetgenNbOfTriangles;
double NetgenPoint[3];
int NetgenTriangle[3];
int nodeID;
SMESH_MesherHelper helper(aMesh);
// This function is mandatory for setElementsOnShape to work
helper.IsQuadraticSubMesh(aShape);
helper.SetElementsOnShape( true );
df.read((char*) &totalPremeshedNodes, sizeof(int));
// Number of nodes in intial mesh
df.read((char*) &NetgenNbOfNodes, sizeof(int));
// Number of nodes added by netgen
df.read((char*) &NetgenNbOfNodesNew, sizeof(int));
// Filling nodevec (correspondence netgen numbering mesh numbering)
vector< const SMDS_MeshNode* > nodeVec ( NetgenNbOfNodesNew + 2 );
SMESHDS_Mesh * meshDS = helper.GetMeshDS();
for (int nodeIndex = 1; nodeIndex <= NetgenNbOfNodes; ++nodeIndex )
{
//Id of the point
df.read((char*) &nodeID, sizeof(int));
nodeVec.at(nodeID) = meshDS->FindNode(nodeID);
}
// Add new points and update nodeVec
for (int nodeIndex = totalPremeshedNodes + 1; nodeIndex <= NetgenNbOfNodesNew; ++nodeIndex )
{
df.read((char *) &NetgenPoint, sizeof(double)*3);
nodeVec.at(nodeIndex) = helper.AddNode(NetgenPoint[0], NetgenPoint[1], NetgenPoint[2]);
}
// Add triangles
df.read((char*) &NetgenNbOfTriangles, sizeof(int));
for ( int elemIndex = 1; elemIndex <= NetgenNbOfTriangles; ++elemIndex )
{
df.read((char*) &NetgenTriangle, sizeof(int)*3);
if ( nodeVec.at( NetgenTriangle[0] ) && nodeVec.at( NetgenTriangle[1] ) && nodeVec.at( NetgenTriangle[2] ) )
helper.AddFace(nodeVec.at( NetgenTriangle[0] ), nodeVec.at( NetgenTriangle[1] ), nodeVec.at( NetgenTriangle[2] ) );
}
}
return true;
}
/**
* @brief Assign submeshes to compute
*
* @param aSubMesh submesh to add
*/
void NETGENPlugin_NETGEN_2D_Remote::setSubMeshesToCompute(SMESH_subMesh * aSubMesh)
{
SMESH_MeshLocker myLocker(aSubMesh->GetFather());
SMESH_Algo::setSubMeshesToCompute(aSubMesh);
}

Some files were not shown because too many files have changed in this diff Show More