guidocdir = $(docdir)/gui/GHS3DPLUGIN
guidoc_DATA = images/head.png
+DOC_PYTHONPATH=$(prefix)/bin/salome:$(SMESH_ROOT_DIR)/bin/salome:$(SMESH_ROOT_DIR)/lib/python$(PYTHON_VERSION)/site-packages/salome:$(MED_ROOT_DIR)/lib/python$(PYTHON_VERSION)/site-packages/salome:$(GEOM_ROOT_DIR)/bin/salome:$(GEOM_ROOT_DIR)/lib/python$(PYTHON_VERSION)/site-packages/salome:$(KERNEL_ROOT_DIR)/bin/salome:$(KERNEL_ROOT_DIR)/lib/python$(PYTHON_VERSION)/site-packages/salome:$(OMNIORB_ROOT)/lib/python$(PYTHON_VERSION)/site-packages:$(OMNIORB_ROOT)/lib64/python$(PYTHON_VERSION)/site-packages
+DOC_SMESH_MeshersList=GHS3DPlugin
-usr_docs: doxyfile
- echo "===========================================" ; \
- echo "Generating Python interface documentation"; \
- echo "===========================================" ; \
- $(DOXYGEN) doxyfile_py \
- echo "===========================================" ; \
- echo "Generating GUI documentation" ; \
- echo "===========================================" ; \
- $(DOXYGEN) doxyfile ;
+smesh.py: $(top_srcdir)/src/GHS3DPlugin/GHS3DPluginDC.py
+ @PYTHONPATH=$(DOC_PYTHONPATH):${PYTHONPATH} SMESH_MeshersList=$(DOC_SMESH_MeshersList) $(PYTHON) $(SMESH_ROOT_DIR)/bin/salome/collect_mesh_methods.py -d -o $@ GHS3DPlugin
+
+usr_docs: doxyfile_py doxyfile smesh.py
+ @$(DOXYGEN) doxyfile_py ; \
+ $(DOXYGEN) doxyfile
docs: usr_docs
*) echo "Installing $${filen}" ; cp -rp $${filen} $(DESTDIR)$(docdir)/gui/GHS3DPLUGIN ;; \
esac ; \
done ;
- cp -rp $(srcdir)/images/head.png $(DESTDIR)$(docdir)/gui/GHS3DPLUGIN/ghs3dpluginpy_doc/ ;
+ cp -rfp $(srcdir)/images/head.png $(DESTDIR)$(docdir)/gui/GHS3DPLUGIN/ghs3dpluginpy_doc/ ;
uninstall-local:
rm -rf $(DESTDIR)$(docdir)/gui/GHS3DPLUGIN
#---------------------------------------------------------------------------
#Input related options
#---------------------------------------------------------------------------
-INPUT = @top_srcdir@/src/GHS3DPlugin/GHS3DPluginDC.py
+INPUT = @top_srcdir@/src/GHS3DPlugin/GHS3DPluginDC.py \
+ smesh.py \
+ @SMESH_ROOT_DIR@/bin/salome/smesh_algorithm.py
FILE_PATTERNS =
IMAGE_PATH = @srcdir@/images
RECURSIVE = NO
#---------------------------------------------------------------------------
CLASS_DIAGRAMS = NO
HIDE_UNDOC_RELATIONS = NO
-HAVE_DOT = NO
-CLASS_GRAPH = NO
+HAVE_DOT = YES
+CLASS_GRAPH = YES
COLLABORATION_GRAPH = NO
GROUP_GRAPHS = NO
UML_LOOK = NO
-TEMPLATE_RELATIONS = NO
-INCLUDE_GRAPH = NO
-INCLUDED_BY_GRAPH = NO
+TEMPLATE_RELATIONS = YES
+INCLUDE_GRAPH = YES
+INCLUDED_BY_GRAPH = YES
CALL_GRAPH = NO
-GRAPHICAL_HIERARCHY = NO
-DIRECTORY_GRAPH = NO
-DOT_IMAGE_FORMAT = jpg
+GRAPHICAL_HIERARCHY = YES
+DIRECTORY_GRAPH = YES
+DOT_IMAGE_FORMAT = png
DOT_FONTNAME = Arial
DOT_PATH =
DOTFILE_DIRS =
MAX_DOT_GRAPH_WIDTH = 1024
-MAX_DOT_GRAPH_HEIGHT = 1200
-MAX_DOT_GRAPH_DEPTH = 0
+MAX_DOT_GRAPH_HEIGHT = 1024
+MAX_DOT_GRAPH_DEPTH = 1000
DOT_TRANSPARENT = NO
DOT_MULTI_TARGETS = NO
GENERATE_LEGEND = NO
#External reference options
#---------------------------------------------------------------------------
GENERATE_TAGFILE = ghs3dpluginpy_doc.tag
-SEARCHENGINE = YES
\ No newline at end of file
+SEARCHENGINE = YES
\page ghs3d_hypo_page GHS3D Parameters hypothesis
\anchor ghs3d_top
-\n GHS3D Parameters hypothesis works only with <b>Tetrahedron (GHS3D)</b>
+GHS3D Parameters hypothesis works only with <b>Tetrahedron (GHS3D)</b>
algorithm. This algorithm is a commercial software.
-\n To get a licence, visit http://www.distene.com/corp/eval-distene.html
--# \ref ghs3d_general_parameters
--# \ref ghs3d_advanced_parameters
--# \ref ghs3d_enforced_vertices
--# \ref ghs3d_enforced_meshes
+To get a licence, visit http://www.distene.com/en/corp/eval-distene.html
+
+\tableofcontents
\section ghs3d_general_parameters General parameters
\image html ghs3d_parameters_basic.png
-<ul>
-<li><b>Name</b> - allows to define the name of the hypothesis (GHS3D
-Parameters by default).</li>
+- <b>Name</b> - allows to define the name of the hypothesis (GHS3D
+Parameters by default).
-<li><b>To mesh holes</b> - if checked, the algorithm will
+- <b>To mesh holes</b> - if checked, the algorithm will
create mesh in the holes inside a solid shape, else only the outermost
shape will be meshed. Volumic elements created within holes are bound
-to the solid.</li>
-
-<li><b>Optimization level</b> - allows choosing the required
-optimization level:
-<ul>
-<li>none,</li>
-<li>light,</li>
-<li>medium (standard),</li>
-<li>standard+,</li>
-<li>strong.</li>
-</ul>
-Higher level of
-optimisation provides better mesh, but can be time-consuming.
-</li>
-</ul>
+to the solid.
+
+- <b>Optimization level</b> - allows choosing the required
+optimization level (higher level of optimisation provides better mesh,
+but can be time-consuming):
+
+ - none
+
+ - light
+
+ - medium (standard)
+
+ - standard+
+
+ - strong
\ref ghs3d_top "Back to top"
\image html ghs3d_parameters_advanced.png
-<li><b>Maximum memory size</b> - launches ghs3d software with
+- <b>Maximum memory size</b> - launches ghs3d software with
work space limited to the specified amount of RAM, in Mbytes. If this option is
-checked off, the software will be launched with 7O% of the total RAM space. </li>
+checked off, the software will be launched with 7O% of the total RAM space.
-<li><b>Initial memory size</b> - starts ghs3d software with
+- <b>Initial memory size</b> - starts ghs3d software with
the specified amount of work space, in Mbytes. If this option is checked off, the
-software will be started with 100 Megabytes of working space. </li>
+software will be started with 100 Megabytes of working space.
-<li><b>Working directory</b> - allows defining the folder for input and output
-files of ghs3d software, which are the files starting with "GHS3D_" prefix. </li>
+- <b>Working directory</b> - allows defining the folder for input and output
+files of ghs3d software, which are the files starting with "GHS3D_" prefix.
-<li><b>Keep working files</b> - allows checking input and output files
+- <b>Keep working files</b> - allows checking input and output files
of ghs3d software, while usually these files are removed after the
-launch of the mesher.</li>
+launch of the mesher.
-<li><b>Verbose level</b> - to choose verbosity level in the range from
+- <b>Verbose level</b> - to choose verbosity level in the range from
0 to 10.
-<ul> <li>0, no standard output,
-</li><li>2, prints the data, quality statistics of the skin and final
-meshes and indicates when the final mesh is being saved. In addition
-the software gives indication regarding the CPU time.
-</li><li>10, same as 2 plus the main steps in the computation, quality
-statistics histogram of the skin mesh, quality statistics histogram
-together with the characteristics of the final mesh.
-</li></ul></li>
-
-<li><b>To create new nodes</b> - if this option is checked off, ghs3d
-tries to create tetrahedrons using only the nodes of the 2D mesh.</li>
-
-<li><b>To remove the initial central point</b> TetMesh-GHS3D adds an internal point
+
+ - 0, no standard output,
+
+ - 2, prints the data, quality statistics of the skin and final
+ meshes and indicates when the final mesh is being saved. In addition
+ the software gives indication regarding the CPU time.
+
+ - 10, same as 2 plus the main steps in the computation, quality
+ statistics histogram of the skin mesh, quality statistics histogram
+ together with the characteristics of the final mesh.
+
+- <b>To create new nodes</b> - if this option is checked off, ghs3d
+tries to create tetrahedrons using only the nodes of the 2D mesh.
+
+- <b>To remove the initial central point</b> TetMesh-GHS3D adds an internal point
at the gravity centre of the bounding box to speed up and to simplify
the meshing process. However, it is possible to refrain from creating
this point by using the command line option -no initial central point. This can be
the recovery version (command line option -C).
Note: when using this option, the speed of the meshing process may
decrease, and the quality may change.
-Note: the boundary regeneration may fail with this option, in some rare cases.</li>
+Note: the boundary regeneration may fail with this option, in some rare cases.
-<li><b>To use boundary recovery version</b> - enables using a
+- <b>To use boundary recovery version</b> - enables using a
boundary recovery module which tries to
create volume meshes starting from very poor quality surface meshes
(almost flat triangles on the surface, high density propagation,
extreme aspect ratios, etc.) which fails with the standard version. The
resulting volume mesh will however most likely have a very poor
quality (poor aspect ratio of elements, tetrahedra with a very small
-positive volume).</li>
+positive volume).
-<li><b>To use FEM correction</b> - Applies finite-element correction by
+- <b>To use FEM correction</b> - Applies finite-element correction by
replacing overconstrained elements where it is possible. At first the process
slices the overconstrained edges and at second the overconstrained
facets. This ensures that there are no edges with two boundary
which have three edges on the boundary.
Note: when using this option, the speed of the meshing process may
decrease, quality may change, and the smallest volume may be smaller.
-By default, the FEM correction is not used.</li>
+By default, the FEM correction is not used.
-<li><b>Option as text</b> - allows to input in the command line any text
-for ghs3d, for example, advanced options. </li>
+- <b>Volumic gradation</b> - Defines the volumic ratio between 2 consecutive elements.
+WARNING: Changing the default value of this parameter may dramatically decrease the quality of the resulting mesh.
-</ul>
+- <b>Option as text</b> - allows to input in the command line any text
+for ghs3d, for example, advanced options.
\ref ghs3d_top "Back to top"
\section ghs3d_enforced_vertices Enforced vertices
-\note This feature is currently available only on meshes with no
+\note This feature is currently partially available only on meshes with no
geometry attached. Such meshes can be obtained by
-<ul>
-<li>Copying an existing mesh</li>
-<li>Importing a mesh from file</li>
-<li>Applying a transformation to a mesh a get result in a new mesh</li>
-</ul>
+- Copying an existing mesh
+- Importing a mesh from file
+- Applying a transformation to a mesh a get result in a new mesh
+.
+See below for more details.
\image html ghs3d_enforced_vertices.png
A node will be created at the enforced vertex coordinates.
An enforced vertex is defined by:
-<ul>
-<li>A vertex</li>
-<ul>
-<li>from GEOM (Vertex, Compound)</li>
-<li>or from (x,y,z) cartesian coordinates</li>
-</ul>
-<li>A constant physical size</li>
-<li>If a group name is given, the created node will be added to the
-group. If the group does not exist, it is created.</li>
-</ul>
+- A vertex
+ - from GEOM (Vertex, Compound) - only avaible on meshes with no
+ geometry attached
+ - or from (x,y,z) cartesian coordinates
+- A constant physical size
+- If a group name is given, the created node will be added to the
+group. If the group does not exist, it is created.
+
\ref ghs3d_top "Back to top"
\section ghs3d_enforced_meshes Enforced Meshes
\note This feature is currently only available on 2D meshes with no
geometry attached. Such meshes can be obtained by
-<ul>
-<li>Copying an existing 2D mesh</li>
-<li>Importing a 2D mesh from file</li>
-<li>Applying a transformation to a 2D mesh a get result in a new mesh</li>
-</ul>
+- Copying an existing 2D mesh
+- Importing a 2D mesh from file
+- Applying a transformation to a 2D mesh a get result in a new mesh
\image html ghs3d_enforced_meshes.png
GHS3D algorithm can be forced by other meshes, sub-meshes or
groups. The constraint elements should be contained
entirely into the solid mesh.
-<ul>
-<li>The constraint element types are:
-<ul>
-<li>NODE</li>
-<li>EDGE</li>
-<li>FACE</li>
-</ul></li>
-<li>If a size is given, the mesh will be refined around the enforced
-elements given the size (not available yet)</li>
-<li>If a group name is given, the enforced elements will be added to
-the group. If the group does not exist, it is created.</li>
-</ul>
+- The constraint element types are:
+ - NODE
+ - EDGE
+ - FACE
+- If a group name is given, the enforced elements will be added to
+the group. If the group does not exist, it is created.
<br><b>See Also</b> a sample TUI Script of the \ref tui_ghs3d "creation of a Ghs3D hypothesis", including enforced vertices and meshes.
\ref ghs3d_top "Back to top"
-
*/
\page ghs3dplugin_python_interface_page Python Interface
-Python package \ref GHS3DPluginDC "GHS3DPlugin" defines several classes, destined for creation of the 3D meshes.
+Python package GHS3DPluginDC defines several classes, destined for creation of the 3D meshes.
-Documentation for GHS3DPlugin package is available in linear form grouped by classes, declared in the GHS3DPluginDC.py file.
+GHS3D meshing plugin dynamically adds several methods to the smesh.Mesh class to create meshing algorithms.
-Below you can see an example of usage of the GHS3DPlugin package for mesh generation:
+Below you can see an example of usage of the GHS3DPlugin Python API for mesh generation:
\anchor tui_ghs3d
-<ol>
-<li>\ref tui_ghs3d_basic "Construction of Mesh using Ghs3D algorithm"</li>
-<li>\ref tui_ghs3d_enforced_vertices "Adding enforced vertices"</li>
-<li>\ref tui_ghs3d_enforced_meshes "Adding enforced mesh"</li>
-</ol>
+-# \ref tui_ghs3d_basic
+-# \ref tui_ghs3d_enforced_vertices
+-# \ref tui_ghs3d_enforced_meshes
-\anchor tui_ghs3d_basic
-<h2>Construction of Mesh using Ghs3D algorithm</h2>
+\section tui_ghs3d_basic Construction of Mesh using Ghs3D algorithm
\code
import geompy
# End of script
\endcode
-\image html ghs3d_screenshot.png Ghs3d mesh withtout hypothesis
+\image html ghs3d_screenshot.png Ghs3d mesh without hypothesis
\ref tui_ghs3d "Back to top"
-\anchor tui_ghs3d_enforced_vertices
-<h2>Adding enforced vertices</h2>
+\section tui_ghs3d_enforced_vertices Adding enforced vertices
\code
\ref tui_ghs3d "Back to top"
-\anchor tui_ghs3d_enforced_meshes
-<h2>Adding enforced mesh</h2>
+\section tui_ghs3d_enforced_meshes Adding enforced mesh
\code
\mainpage Introduction to GHS3DPLUGIN
+\b GHS3DPLUGIN plugin is destined for:
+- Meshing 3D geometric entities: volumes are split into tetrahedral (pyramidal) elements.
+- Generating 3D meshes from 2D meshes (triangles and quadrangles), working without geometrical objects.
+
\note GHS3DPLUGIN plugin used GHS3D commercial mesher and require a
license to be used within the Mesh module.
-\n \b GHS3DPLUGIN plugin is destined for:
-
-<ul>
-<li>Meshing 3D geometric entities.</li>
- - Volumes are split into tetrahedral (pyramidal) elements.
-<li>Generating 3D meshes from 2D meshes, working without geometrical objects.</li>
-</ul>
-
To manage parameters of the GHS3DPLUGIN use \subpage ghs3d_hypo_page and \subpage additional_hypo_page
Also all GHS3DPLUGIN functionalities are accessible via
string entry;
SMESH::ElementType elementType;
string groupName;
- double size;
};
typedef sequence<GHS3DEnforcedMesh> GHS3DEnforcedMeshList;
*/
void SetTextOption(in string option);
string GetTextOption();
+ /*!
+ * To define the volumic gradation
+ */
+ void SetGradation(in double gradation);
+ double GetGradation();
/*!
* To set an enforced vertex
*/
boolean SetEnforcedMesh(in SMESH::SMESH_IDSource theSource, in SMESH::ElementType elementType) raises (SALOME::SALOME_Exception);
boolean SetEnforcedMeshWithGroup(in SMESH::SMESH_IDSource theSource, in SMESH::ElementType elementType, in string groupName) raises (SALOME::SALOME_Exception);
+
+ /* OBSOLETE FUNCTIONS */
boolean SetEnforcedMeshSize(in SMESH::SMESH_IDSource theSource, in SMESH::ElementType elementType, in double size) raises (SALOME::SALOME_Exception);
boolean SetEnforcedMeshSizeWithGroup(in SMESH::SMESH_IDSource theSource, in SMESH::ElementType elementType, in double size, in string groupName) raises (SALOME::SALOME_Exception);
+ /* OBSOLETE FUNCTIONS */
+
GHS3DEnforcedMeshList GetEnforcedMeshes();
void ClearEnforcedMeshes();
/*!
* Set/get/unset an enforced vertex (private method for GUI)
*/
- boolean p_SetEnforcedMesh(in SMESH::SMESH_IDSource theSource, in SMESH::ElementType elementType,
- in double size, in string groupName) raises (SALOME::SALOME_Exception);
+ boolean p_SetEnforcedMesh(in SMESH::SMESH_IDSource theSource, in SMESH::ElementType elementType, in string name, in string groupName) raises (SALOME::SALOME_Exception);
};
};
<hypothesis type="GHS3D_Parameters"
label-id="GHS3D Parameters"
icon-id="mesh_hypo_ghs3d.png"
- dim="3"/>
+ dim="3">
+ <python-wrap>
+ <accumulative-methods>
+ SetEnforcedVertex,
+ SetEnforcedVertexNamed,
+ SetEnforcedVertexWithGroup,
+ SetEnforcedVertexNamedWithGroup,
+ SetEnforcedVertexGeom,
+ SetEnforcedVertexGeomWithGroup,
+ RemoveEnforcedVertex,
+ RemoveEnforcedVertexGeom,
+ SetEnforcedMeshWithGroup,
+ SetEnforcedMeshSize,
+ SetEnforcedMeshSizeWithGroup
+ </accumulative-methods>
+ </python-wrap>
+ </hypothesis>
</hypotheses>
+
<algorithms>
<algorithm type="GHS3D_3D"
label-id="Tetrahedron (GHS3D)"
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-from smesh import Mesh_Algorithm, AssureGeomPublished
+##
+# @package GHS3DPluginDC
+# Python API for the GHS3D meshing plug-in module.
+
+from smesh_algorithm import Mesh_Algorithm
+from smesh import AssureGeomPublished
# import GHS3DPlugin module if possible
noGHS3DPlugin = 0
# V4.1 (partialy redefines V3.1). Issue 0020574
None_Optimization, Light_Optimization, Standard_Optimization, StandardPlus_Optimization, Strong_Optimization = 0,1,2,3,4
+#----------------------------
+# Mesh algo type identifiers
+#----------------------------
+
+## Algorithm type: GHS3D tetrahedron 3D algorithm, see GHS3D_Algorithm
GHS3D = "GHS3D_3D"
## Tetrahedron GHS3D 3D algorithm
-# It is created by calling Mesh.Tetrahedron( GHS3D, geom=0 )
-#
+#
+# It can be created by calling smesh.Mesh.Tetrahedron( smesh.GHS3D, geom=0 )
class GHS3D_Algorithm(Mesh_Algorithm):
+ ## name of the dynamic method in smesh.Mesh class
+ # @internal
meshMethod = "Tetrahedron"
+ ## type of algorithm used with helper function in smesh.Mesh class
+ # @internal
algoType = GHS3D
+ ## doc string of the method in smesh.Mesh class
+ # @internal
+ docHelper = "Creates tetrahedron 3D algorithm for volumes"
## 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):
Mesh_Algorithm.__init__(self)
if noGHS3DPlugin: print "Warning: GHS3DPlugin module unavailable"
self.Create(mesh, geom, self.algoType, "libGHS3DEngine.so")
self.params = None
+ pass
## Defines hypothesis having several parameters
- #
+ # @return hypothesis object
def Parameters(self):
if not self.params:
self.params = self.Hypothesis("GHS3D_Parameters", [],
"libGHS3DEngine.so", UseExisting=0)
+ pass
return self.params
## To mesh "holes" in a solid or not. Default is to mesh.
- #
+ # @param toMesh "mesh holes" flag value
def SetToMeshHoles(self, toMesh):
self.Parameters().SetToMeshHoles(toMesh)
+ pass
## Set Optimization level:
- # None_Optimization, Light_Optimization, Standard_Optimization, StandardPlus_Optimization,
- # Strong_Optimization.
- # Default is Standard_Optimization
+ # @param level optimization level, one of the following values
+ # - None_Optimization
+ # - Light_Optimization
+ # - Standard_Optimization
+ # - StandardPlus_Optimization
+ # - Strong_Optimization.
+ # .
+ # Default is Standard_Optimization
def SetOptimizationLevel(self, level):
self.Parameters().SetOptimizationLevel(level)
+ pass
- ## Maximal size of memory to be used by the algorithm (in Megabytes).
- #
+ ## Set maximal size of memory to be used by the algorithm (in Megabytes).
+ # @param MB maximal size of memory
def SetMaximumMemory(self, MB):
self.Parameters().SetMaximumMemory(MB)
+ pass
- ## Initial size of memory to be used by the algorithm (in Megabytes) in
+ ## Set initial size of memory to be used by the algorithm (in Megabytes) in
# automatic memory adjustment mode.
+ # @param MB initial size of memory
def SetInitialMemory(self, MB):
self.Parameters().SetInitialMemory(MB)
+ pass
- ## Path to working directory.
- #
+ ## Set path to working directory.
+ # @param path working directory
def SetWorkingDirectory(self, path):
self.Parameters().SetWorkingDirectory(path)
+ pass
## To keep working files or remove them. Log file remains in case of errors anyway.
+ # @param toKeep "keep working files" flag value
def SetKeepFiles(self, toKeep):
self.Parameters().SetKeepFiles(toKeep)
-
- ## To set verbose level [0-10]. <ul>
- #<li> 0 - no standard output,
- #<li> 2 - prints the data, quality statistics of the skin and final meshes and
- # indicates when the final mesh is being saved. In addition the software
- # gives indication regarding the CPU time.
- #<li>10 - same as 2 plus the main steps in the computation, quality statistics
- # histogram of the skin mesh, quality statistics histogram together with
- # the characteristics of the final mesh.</ul>
+ pass
+
+ ## Set verbosity level [0-10].
+ # @param level verbosity level
+ # - 0 - no standard output,
+ # - 2 - prints the data, quality statistics of the skin and final meshes and
+ # indicates when the final mesh is being saved. In addition the software
+ # gives indication regarding the CPU time.
+ # - 10 - same as 2 plus the main steps in the computation, quality statistics
+ # histogram of the skin mesh, quality statistics histogram together with
+ # the characteristics of the final mesh.
def SetVerboseLevel(self, level):
self.Parameters().SetVerboseLevel(level)
+ pass
## To create new nodes.
+ # @param toCreate "create new nodes" flag value
def SetToCreateNewNodes(self, toCreate):
self.Parameters().SetToCreateNewNodes(toCreate)
+ pass
## To use boundary recovery version which tries to create mesh on a very poor
# quality surface mesh.
+ # @param toUse "use boundary recovery version" flag value
def SetToUseBoundaryRecoveryVersion(self, toUse):
self.Parameters().SetToUseBoundaryRecoveryVersion(toUse)
+ pass
## Applies finite-element correction by replacing overconstrained elements where
# it is possible. The process is cutting first the overconstrained edges and
# second the overconstrained facets. This insure that no edges have two boundary
# vertices and that no facets have three boundary vertices.
+ # @param toUseFem "apply finite-element correction" flag value
def SetFEMCorrection(self, toUseFem):
self.Parameters().SetFEMCorrection(toUseFem)
+ pass
- ## To removes initial central point.
+ ## To remove initial central point.
+ # @param toRemove "remove initial central point" flag value
def SetToRemoveCentralPoint(self, toRemove):
self.Parameters().SetToRemoveCentralPoint(toRemove)
+ pass
## To set an enforced vertex.
# @param x : x coordinate
return self.Parameters().SetEnforcedVertex(x, y, z, size)
else:
return self.Parameters().SetEnforcedVertexWithGroup(x, y, z, size, groupName)
+ pass
else:
if groupName == "":
return self.Parameters().SetEnforcedVertexNamed(x, y, z, size, vertexName)
else:
return self.Parameters().SetEnforcedVertexNamedWithGroup(x, y, z, size, vertexName, groupName)
+ pass
+ pass
## To set an enforced vertex given a GEOM vertex, group or compound.
# @param theVertex : GEOM vertex (or group, compound) to be projected on theFace.
return self.Parameters().SetEnforcedVertexGeom(theVertex, size)
else:
return self.Parameters().SetEnforcedVertexGeomWithGroup(theVertex, size, groupName)
+ pass
## To remove an enforced vertex.
# @param x : x coordinate
return self.Parameters().SetEnforcedMesh(theSource, elementType)
else:
return self.Parameters().SetEnforcedMeshWithGroup(theSource, elementType, groupName)
+ pass
else:
if groupName == "":
return self.Parameters().SetEnforcedMeshSize(theSource, elementType, size)
else:
return self.Parameters().SetEnforcedMeshSizeWithGroup(theSource, elementType, size, groupName)
+ pass
+ pass
## Sets command line option as text.
+ # @param option command line option
def SetTextOption(self, option):
self.Parameters().SetTextOption(option)
+ pass
+ pass # end of GHS3D_Algorithm class
//purpose : Update or create groups in mesh
//=======================================================================
-static void addElemInMeshGroup(SMESH_Mesh* theMesh,
- const SMDS_MeshElement* anElem,
- std::string groupName,
- std::set<std::string> groupsToRemove)
+static void addElemInMeshGroup(SMESH_Mesh* theMesh,
+ const SMDS_MeshElement* anElem,
+ std::string& groupName,
+ std::set<std::string>& groupsToRemove)
{
+ if ( !anElem ) return; // issue 0021776
+
bool groupDone = false;
SMESH_Mesh::GroupIteratorPtr grIt = theMesh->GetGroups();
while (grIt->more()) {
groupDone = true;
}
if (!groupDone)
- throw SALOME_Exception(LOCALIZED("A enforced vertex node was not added to a group"));
+ throw SALOME_Exception(LOCALIZED("A given element was not added to a group"));
}
// for ( int iRef = 0; iRef < nbRef; iRef++ )
// nodeAssigne[ nodeID[ iRef ]] = 1;
}
+ break;
case GmfTetrahedra:
if ( elemSearcher ) {
// Issue 0020682. Avoid creating nodes and tetras at place where
TopAbs_State result = pntCls->GetPointState( myPoint );
if ( result == TopAbs_OUT )
continue;
- if (pntCls->FindElementsByPoint(myPoint, SMDSAbs_Node, foundElems) == 0)
- continue;
+ //if (pntCls->FindElementsByPoint(myPoint, SMDSAbs_Node, foundElems) == 0)
+ //continue;
// if ( result != TopAbs_IN )
// continue;
return false;
}
int TypTab[] = {GmfSca};
+ double ValTab[] = {0.0};
GmfSetKwd(idxRequired, GmfVertices, requiredNodes + solSize);
GmfSetKwd(idxSol, GmfSolAtVertices, requiredNodes + solSize, 1, TypTab);
// int usedEnforcedNodes = 0;
// std::string gn = "";
for (ghs3dNodeIt = theRequiredNodes.begin();ghs3dNodeIt != theRequiredNodes.end();++ghs3dNodeIt) {
GmfSetLin(idxRequired, GmfVertices, (*ghs3dNodeIt)->X(), (*ghs3dNodeIt)->Y(), (*ghs3dNodeIt)->Z(), dummyint);
- GmfSetLin(idxSol, GmfSolAtVertices, 0.0);
+ GmfSetLin(idxSol, GmfSolAtVertices, ValTab);
if (theEnforcedNodes.find((*ghs3dNodeIt)) != theEnforcedNodes.end())
gn = theEnforcedNodes.find((*ghs3dNodeIt))->second;
aNodeGroupByGhs3dId[usedEnforcedNodes] = gn;
if (theEnforcedVertices.find(coords) != theEnforcedVertices.end())
continue;
- double size = theNodeIDToSizeMap.find(nodeIt->first->GetID())->second;
+// double size = theNodeIDToSizeMap.find(nodeIt->first->GetID())->second;
// theGhs3dIdToNodeMap.insert( make_pair( nbNodes + i, (*nodeIt) ));
// MESSAGE("Adding enforced node (" << x << "," << y <<"," << z << ")");
// X Y Z PHY_SIZE DUMMY_INT
<< x << space
<< y << space
<< z << space
- << size << space
+ << -1 << space
<< dummyint << space;
theFile << std::endl;
theEnforcedNodeIdToGhs3dIdMap.insert( make_pair( nodeIt->first->GetID(), aGhs3dID ));
#ifndef _GHS3DPlugin_GHS3D_HXX_
#define _GHS3DPlugin_GHS3D_HXX_
-#include "SMESH_3D_Algo.hxx"
+#include "SMESH_Algo.hxx"
#include "SMESH_Gen.hxx"
#include "SMESH_Gen_i.hxx"
myToUseBoundaryRecoveryVersion(DefaultToUseBoundaryRecoveryVersion()),
myToUseFemCorrection(DefaultToUseFEMCorrection()),
myToRemoveCentralPoint(DefaultToRemoveCentralPoint()),
+ myGradation(DefaultGradation()),
_enfVertexList(DefaultGHS3DEnforcedVertexList()),
_enfVertexCoordsSizeList(DefaultGHS3DEnforcedVertexCoordsValues()),
_enfVertexEntrySizeList(DefaultGHS3DEnforcedVertexEntryValues()),
_enfEdges(TIDSortedElemGroupMap()),
_enfTriangles(TIDSortedElemGroupMap()),
_nodeIDToSizeMap(DefaultID2SizeMap()),
- _elementIDToSizeMap(DefaultID2SizeMap()),
_groupsToRemove(DefaultGroupsToRemove())
{
_name = "GHS3D_Parameters";
return myTextOption;
}
+//=======================================================================
+//function : SetGradation
+//=======================================================================
+
+void GHS3DPlugin_Hypothesis::SetGradation(double gradation)
+{
+ if ( myGradation != gradation ) {
+ myGradation = gradation;
+ NotifySubMeshesHypothesisModification();
+ }
+}
+
+//=======================================================================
+//function : GetGradation
+//=======================================================================
+
+double GHS3DPlugin_Hypothesis::GetGradation() const
+{
+ return myGradation;
+}
+
//=======================================================================
//function : SetEnforcedVertex
//=======================================================================
//=======================================================================
//function : SetEnforcedMesh
//=======================================================================
-bool GHS3DPlugin_Hypothesis::SetEnforcedMesh(SMESH_Mesh& theMesh, SMESH::ElementType elementType, std::string name, std::string entry, double size, std::string groupName)
+bool GHS3DPlugin_Hypothesis::SetEnforcedMesh(SMESH_Mesh& theMesh, SMESH::ElementType elementType, std::string name, std::string entry, std::string groupName)
{
TIDSortedElemSet theElemSet;
SMDS_ElemIteratorPtr eIt = theMesh.GetMeshDS()->elementsIterator(SMDSAbs_ElementType(elementType));
while ( eIt->more() )
theElemSet.insert( eIt->next() );
MESSAGE("Add "<<theElemSet.size()<<" types["<<elementType<<"] from source mesh");
- bool added = SetEnforcedElements( theElemSet, elementType, size, groupName);
+ bool added = SetEnforcedElements( theElemSet, elementType, groupName);
if (added) {
TGHS3DEnforcedMesh* newEnfMesh = new TGHS3DEnforcedMesh();
newEnfMesh->name = name;
newEnfMesh->entry = entry;
newEnfMesh->elementType = elementType;
- newEnfMesh->size = size;
newEnfMesh->groupName = groupName;
TGHS3DEnforcedMeshList::iterator it = _enfMeshList.find(newEnfMesh);
//=======================================================================
//function : SetEnforcedGroup
//=======================================================================
-bool GHS3DPlugin_Hypothesis::SetEnforcedGroup(const SMESHDS_Mesh* theMeshDS, SMESH::long_array_var theIDs, SMESH::ElementType elementType, std::string name, std::string entry, double size, std::string groupName)
+bool GHS3DPlugin_Hypothesis::SetEnforcedGroup(const SMESHDS_Mesh* theMeshDS, SMESH::long_array_var theIDs, SMESH::ElementType elementType, std::string name, std::string entry, std::string groupName)
{
MESSAGE("GHS3DPlugin_Hypothesis::SetEnforcedGroup");
TIDSortedElemSet theElemSet;
// theElemSet.insert( it->next() );
MESSAGE("Add "<<theElemSet.size()<<" types["<<elementType<<"] from source group ");
- bool added = SetEnforcedElements( theElemSet, elementType, size, groupName);
+ bool added = SetEnforcedElements( theElemSet, elementType, groupName);
if (added) {
TGHS3DEnforcedMesh* newEnfMesh = new TGHS3DEnforcedMesh();
newEnfMesh->name = name;
newEnfMesh->entry = entry;
newEnfMesh->elementType = elementType;
- newEnfMesh->size = size;
newEnfMesh->groupName = groupName;
TGHS3DEnforcedMeshList::iterator it = _enfMeshList.find(newEnfMesh);
//=======================================================================
//function : SetEnforcedElements
//=======================================================================
-bool GHS3DPlugin_Hypothesis::SetEnforcedElements(TIDSortedElemSet theElemSet, SMESH::ElementType elementType, double size, std::string groupName)
+bool GHS3DPlugin_Hypothesis::SetEnforcedElements(TIDSortedElemSet theElemSet, SMESH::ElementType elementType, std::string groupName)
{
MESSAGE("GHS3DPlugin_Hypothesis::SetEnforcedElements");
TIDSortedElemSet::const_iterator it = theElemSet.begin();
const SMDS_MeshElement* elem;
const SMDS_MeshNode* node;
- bool added = false;
+ bool added = true;
+ pair<TIDSortedNodeGroupMap::iterator,bool> nodeRet;
+ pair<TIDSortedElemGroupMap::iterator,bool> elemRet;
+
for (;it != theElemSet.end();++it)
{
elem = (*it);
case SMESH::NODE:
node = dynamic_cast<const SMDS_MeshNode*>(elem);
if (node) {
- _enfNodes.insert(make_pair(node,groupName));
- _nodeIDToSizeMap.insert(make_pair(node->GetID(), size));
- added = true;
+ nodeRet = _enfNodes.insert(make_pair(node,groupName));
+ added = added && nodeRet.second;
+ string msg = added ? "yes":"no";
+ MESSAGE( "Node (" <<node->X()<<","<<node->Y()<<","<<node->Z()<< ") with ID " << node->GetID() <<" added ? " << msg);
}
else {
SMDS_ElemIteratorPtr nodeIt = elem->nodesIterator();
for (;nodeIt->more();) {
node = dynamic_cast<const SMDS_MeshNode*>(nodeIt->next());
- _enfNodes.insert(make_pair(node,groupName));
- _nodeIDToSizeMap.insert(make_pair(node->GetID(), size));
+ nodeRet = _enfNodes.insert(make_pair(node,groupName));
+ added = added && nodeRet.second;
}
- added = true;
+// added = true;s
}
break;
case SMESH::EDGE:
if (elem->GetType() == SMDSAbs_Edge) {
- _enfEdges.insert(make_pair(elem,groupName));
- _elementIDToSizeMap.insert(make_pair(elem->GetID(), size));
- added = true;
+ elemRet = _enfEdges.insert(make_pair(elem,groupName));
+ added = added && elemRet.second;
}
else if (elem->GetType() > SMDSAbs_Edge) {
SMDS_ElemIteratorPtr it = elem->edgesIterator();
for (;it->more();) {
const SMDS_MeshElement* anEdge = it->next();
- _enfEdges.insert(make_pair(anEdge,groupName));
- _elementIDToSizeMap.insert(make_pair(anEdge->GetID(), size));
+ elemRet = _enfEdges.insert(make_pair(anEdge,groupName));
+ added = added && elemRet.second;
}
- added = true;
}
break;
case SMESH::FACE:
if (elem->GetType() == SMDSAbs_Face)
{
if (elem->NbCornerNodes() == 3) {
- _enfTriangles.insert(make_pair(elem,groupName));
- _elementIDToSizeMap.insert(make_pair(elem->GetID(), size));
- added = true;
+ elemRet = _enfTriangles.insert(make_pair(elem,groupName));
+ added = added && elemRet.second;
}
}
else if (elem->GetType() > SMDSAbs_Face) { // Group of faces
for (;it->more();) {
const SMDS_MeshElement* aFace = it->next();
if (aFace->NbCornerNodes() == 3) {
- _enfTriangles.insert(make_pair(aFace,groupName));
- _elementIDToSizeMap.insert(make_pair(aFace->GetID(), size));
- added = true;
+ elemRet = _enfTriangles.insert(make_pair(aFace,groupName));
+ added = added && elemRet.second;
}
}
}
_enfEdges.clear();
_enfTriangles.clear();
_nodeIDToSizeMap.clear();
- _elementIDToSizeMap.clear();
_enfMeshList.clear();
_entryEnfMeshMap.clear();
NotifySubMeshesHypothesisModification();
return false;
}
+//=======================================================================
+//function : DefaultGradation
+//=======================================================================
+
+double GHS3DPlugin_Hypothesis::DefaultGradation()
+{
+ return 1.05;
+}
+
// //=======================================================================
// //function : DefaultID2SizeMap
// //=======================================================================
save << (int)myToUseBoundaryRecoveryVersion << " ";
save << (int)myToUseFemCorrection << " ";
save << (int)myToRemoveCentralPoint << " ";
+ save << myGradation << " ";
if (!myTextOption.empty()) {
save << "__OPTIONS_BEGIN__ ";
save << myTextOption << " ";
TGHS3DEnforcedVertexList::iterator it = _enfVertexList.begin();
if (it != _enfVertexList.end()) {
- save << "__ENFORCED_VERTICES_BEGIN__ ";
+ save << " " << "__ENFORCED_VERTICES_BEGIN__ ";
for ( ; it != _enfVertexList.end(); ++it ) {
TGHS3DEnforcedVertex *enfVertex = (*it);
save << " " << "__BEGIN_VERTEX__";
save << " " << "__END_SIZE__";
save << " " << "__END_VERTEX__";
}
- save << "__ENFORCED_VERTICES_END__ ";
+ save << " " << "__ENFORCED_VERTICES_END__ ";
}
+ TGHS3DEnforcedMeshList::iterator it_mesh = _enfMeshList.begin();
+ if (it_mesh != _enfMeshList.end()) {
+ save << " " << "__ENFORCED_MESHES_BEGIN__ ";
+ for ( ; it_mesh != _enfMeshList.end(); ++it_mesh ) {
+ TGHS3DEnforcedMesh *enfMesh = (*it_mesh);
+ save << " " << "__BEGIN_ENF_MESH__";
+
+ save << " " << "__BEGIN_NAME__";
+ save << " " << enfMesh->name;
+ save << " " << "__END_NAME__";
+
+ save << " " << "__BEGIN_ENTRY__";
+ save << " " << enfMesh->entry;
+ save << " " << "__END_ENTRY__";
+
+ save << " " << "__BEGIN_ELEM_TYPE__";
+ save << " " << (int)enfMesh->elementType;
+ save << " " << "__END_ELEM_TYPE__";
+
+ if (!enfMesh->groupName.empty()) {
+ save << " " << "__BEGIN_GROUP__";
+ save << " " << enfMesh->groupName;
+ save << " " << "__END_GROUP__";
+ }
+ save << " " << "__END_ENF_MESH__";
+ std::cout << "Saving of enforced mesh " << enfMesh->name.c_str() << " done" << std::endl;
+ }
+ save << " " << "__ENFORCED_MESHES_END__ ";
+ }
return save;
}
std::istream & GHS3DPlugin_Hypothesis::LoadFrom(std::istream & load)
{
- bool isOK = true;
- int i;
-
- isOK = (load >> i);
- if (isOK)
- myToMeshHoles = i;
- else
- load.clear(ios::badbit | load.rdstate());
-
- isOK = (load >> i);
- if (isOK)
- myMaximumMemory = i;
- else
- load.clear(ios::badbit | load.rdstate());
-
- isOK = (load >> i);
- if (isOK)
- myInitialMemory = i;
- else
- load.clear(ios::badbit | load.rdstate());
-
- isOK = (load >> i);
- if (isOK)
- myOptimizationLevel = i;
- else
- load.clear(ios::badbit | load.rdstate());
-
- isOK = (load >> myWorkingDirectory);
- if (isOK) {
- if ( myWorkingDirectory == "0") { // myWorkingDirectory was empty
- myKeepFiles = false;
- myWorkingDirectory.clear();
- }
- else if ( myWorkingDirectory == "1" ) {
- myKeepFiles = true;
- myWorkingDirectory.clear();
- }
- }
- else
- load.clear(ios::badbit | load.rdstate());
-
- if ( !myWorkingDirectory.empty() ) {
- isOK = (load >> i);
+ bool isOK = true;
+ int i;
+ double d;
+
+ isOK = (load >> i);
+ if (isOK)
+ myToMeshHoles = i;
+ else
+ load.clear(ios::badbit | load.rdstate());
+
+ isOK = (load >> i);
+ if (isOK)
+ myMaximumMemory = i;
+ else
+ load.clear(ios::badbit | load.rdstate());
+
+ isOK = (load >> i);
+ if (isOK)
+ myInitialMemory = i;
+ else
+ load.clear(ios::badbit | load.rdstate());
+
+ isOK = (load >> i);
+ if (isOK)
+ myOptimizationLevel = i;
+ else
+ load.clear(ios::badbit | load.rdstate());
+
+ isOK = (load >> myWorkingDirectory);
+ if (isOK) {
+ if ( myWorkingDirectory == "0") { // myWorkingDirectory was empty
+ myKeepFiles = false;
+ myWorkingDirectory.clear();
+ }
+ else if ( myWorkingDirectory == "1" ) {
+ myKeepFiles = true;
+ myWorkingDirectory.clear();
+ }
+ }
+ else
+ load.clear(ios::badbit | load.rdstate());
+
+ if ( !myWorkingDirectory.empty() ) {
+ isOK = (load >> i);
+ if (isOK)
+ myKeepFiles = i;
+ else
+ load.clear(ios::badbit | load.rdstate());
+ }
+
+ isOK = (load >> i);
+ if (isOK)
+ myVerboseLevel = (short) i;
+ else
+ load.clear(ios::badbit | load.rdstate());
+
+ isOK = (load >> i);
+ if (isOK)
+ myToCreateNewNodes = (bool) i;
+ else
+ load.clear(ios::badbit | load.rdstate());
+
+ isOK = (load >> i);
+ if (isOK)
+ myToUseBoundaryRecoveryVersion = (bool) i;
+ else
+ load.clear(ios::badbit | load.rdstate());
+
+ isOK = (load >> i);
+ if (isOK)
+ myToUseFemCorrection = (bool) i;
+ else
+ load.clear(ios::badbit | load.rdstate());
+
+ isOK = (load >> i);
+ if (isOK)
+ myToRemoveCentralPoint = (bool) i;
+ else
+ load.clear(ios::badbit | load.rdstate());
+
+ isOK = (load >> d);
if (isOK)
- myKeepFiles = i;
+ myGradation = d;
else
- load.clear(ios::badbit | load.rdstate());
- }
-
- isOK = (load >> i);
- if (isOK)
- myVerboseLevel = (short) i;
- else
- load.clear(ios::badbit | load.rdstate());
-
- isOK = (load >> i);
- if (isOK)
- myToCreateNewNodes = (bool) i;
- else
- load.clear(ios::badbit | load.rdstate());
-
- isOK = (load >> i);
- if (isOK)
- myToUseBoundaryRecoveryVersion = (bool) i;
- else
- load.clear(ios::badbit | load.rdstate());
-
- isOK = (load >> i);
- if (isOK)
- myToUseFemCorrection = (bool) i;
- else
- load.clear(ios::badbit | load.rdstate());
-
- isOK = (load >> i);
- if (isOK)
- myToRemoveCentralPoint = (bool) i;
- else
- load.clear(ios::badbit | load.rdstate());
-
- std::string separator;
- bool hasOptions = false;
- bool hasEnforcedVertices = false;
- isOK = (load >> separator);
-
- if (isOK) {
- if (separator == "__OPTIONS_BEGIN__")
- hasOptions = true;
- else if (separator == "__ENFORCED_VERTICES_BEGIN__")
- hasEnforcedVertices = true;
- }
-
- if (hasOptions) {
- std::string txt;
- while (isOK) {
- isOK = (load >> txt);
- if (isOK) {
- if (txt == "__OPTIONS_END__") {
- if (!myTextOption.empty()) {
- // Remove last space
- myTextOption.erase(myTextOption.end()-1);
- }
- isOK = false;
- break;
- }
- myTextOption += txt;
- myTextOption += " ";
- }
- }
- }
+ load.clear(ios::badbit | load.rdstate());
+
+ std::string separator;
+ bool hasOptions = false;
+ bool hasEnforcedVertices = false;
+ bool hasEnforcedMeshes = false;
+ isOK = (load >> separator);
+
+ if (isOK) {
+ if (separator == "__OPTIONS_BEGIN__")
+ hasOptions = true;
+ else if (separator == "__ENFORCED_VERTICES_BEGIN__")
+ hasEnforcedVertices = true;
+ else if (separator == "__ENFORCED_MESHES_BEGIN__")
+ hasEnforcedMeshes = true;
+ }
+
+ if (hasOptions) {
+ std::string txt;
+ while (isOK) {
+ isOK = (load >> txt);
+ if (isOK) {
+ if (txt == "__OPTIONS_END__") {
+ if (!myTextOption.empty()) {
+ // Remove last space
+ myTextOption.erase(myTextOption.end()-1);
+ }
+ isOK = false;
+ break;
+ }
+ myTextOption += txt;
+ myTextOption += " ";
+ }
+ }
+ }
+
+ if (hasOptions) {
+ isOK = (load >> separator);
+ if (isOK && separator == "__ENFORCED_VERTICES_BEGIN__")
+ hasEnforcedVertices = true;
+ if (isOK && separator == "__ENFORCED_MESHES_BEGIN__")
+ hasEnforcedMeshes = true;
+ }
- if (hasOptions) {
- isOK = (load >> separator);
- if (isOK && separator == "__ENFORCED_VERTICES_BEGIN__")
- hasEnforcedVertices = true;
+ if (hasEnforcedVertices) {
+ std::string txt, name, entry, groupName;
+ double size, coords[3];
+ bool isCompound;
+ bool hasCoords = false;
+ isOK = (load >> txt); // __BEGIN_VERTEX__
+ while (isOK) {
+ if (txt == "__ENFORCED_VERTICES_END__")
+ isOK = false;
+
+ TGHS3DEnforcedVertex *enfVertex = new TGHS3DEnforcedVertex();
+ while (isOK) {
+ isOK = (load >> txt);
+ if (txt == "__END_VERTEX__") {
+ enfVertex->name = name;
+ enfVertex->geomEntry = entry;
+ enfVertex->isCompound = isCompound;
+ enfVertex->groupName = groupName;
+ enfVertex->coords.clear();
+ if (hasCoords)
+ enfVertex->coords.assign(coords,coords+3);
+
+ _enfVertexList.insert(enfVertex);
+
+ if (enfVertex->coords.size())
+ _coordsEnfVertexMap[enfVertex->coords] = enfVertex;
+ if (!enfVertex->geomEntry.empty())
+ _geomEntryEnfVertexMap[enfVertex->geomEntry] = enfVertex;
+
+ name.clear();
+ entry.clear();
+ groupName.clear();
+ hasCoords = false;
+ isOK = false;
+ }
+
+ if (txt == "__BEGIN_NAME__") { // __BEGIN_NAME__
+ while (isOK && (txt != "__END_NAME__")) {
+ isOK = (load >> txt);
+ if (txt != "__END_NAME__") {
+ if (!name.empty())
+ name += " ";
+ name += txt;
+ }
+ }
+ MESSAGE("name: " <<name);
+ }
+
+ if (txt == "__BEGIN_ENTRY__") { // __BEGIN_ENTRY__
+ isOK = (load >> entry);
+ isOK = (load >> isCompound);
+ isOK = (load >> txt); // __END_ENTRY__
+ if (txt != "__END_ENTRY__")
+ throw std::exception();
+ MESSAGE("entry: " << entry);
+ }
+
+ if (txt == "__BEGIN_GROUP__") { // __BEGIN_GROUP__
+ while (isOK && (txt != "__END_GROUP__")) {
+ isOK = (load >> txt);
+ if (txt != "__END_GROUP__") {
+ if (!groupName.empty())
+ groupName += " ";
+ groupName += txt;
+ }
+ }
+ MESSAGE("groupName: " << groupName);
+ }
+
+ if (txt == "__BEGIN_COORDS__") { // __BEGIN_COORDS__
+ hasCoords = true;
+ isOK = (load >> coords[0] >> coords[1] >> coords[2]);
+ isOK = (load >> txt); // __END_COORDS__
+ if (txt != "__END_COORDS__")
+ throw std::exception();
+ MESSAGE("coords: " << coords[0] <<","<< coords[1] <<","<< coords[2]);
+ }
+
+ if (txt == "__BEGIN_SIZE__") { // __BEGIN_ENTRY__
+ isOK = (load >> size);
+ isOK = (load >> txt); // __END_ENTRY__
+ if (txt != "__END_SIZE__") {
+ throw std::exception();
+ }
+ MESSAGE("size: " << size);
+ }
+ }
+ isOK = (load >> txt); // __BEGIN_VERTEX__
+ }
}
if (hasEnforcedVertices) {
- std::string txt, name, entry, groupName;
- double size, coords[3];
- bool isCompound;
- bool hasCoords = false;
- while (isOK) {
- isOK = (load >> txt); // __BEGIN_VERTEX__
- if (isOK) {
- if (txt == "__ENFORCED_VERTICES_END__")
- isOK = false;
-
- TGHS3DEnforcedVertex *enfVertex = new TGHS3DEnforcedVertex();
- while (isOK) {
- isOK = (load >> txt);
- if (txt == "__END_VERTEX__") {
- enfVertex->name = name;
- enfVertex->geomEntry = entry;
- enfVertex->isCompound = isCompound;
- enfVertex->groupName = groupName;
- enfVertex->coords.clear();
- if (hasCoords)
- enfVertex->coords.assign(coords,coords+3);
-
- _enfVertexList.insert(enfVertex);
-
- if (enfVertex->coords.size())
- _coordsEnfVertexMap[enfVertex->coords] = enfVertex;
- if (!enfVertex->geomEntry.empty())
- _geomEntryEnfVertexMap[enfVertex->geomEntry] = enfVertex;
-
- name.clear();
- entry.clear();
- groupName.clear();
- hasCoords = false;
- isOK = false;
- }
-
- if (txt == "__BEGIN_NAME__") { // __BEGIN_NAME__
- while (isOK && (txt != "__END_NAME__")) {
- isOK = (load >> txt);
- if (txt != "__END_NAME__") {
- if (!name.empty())
- name += " ";
- name += txt;
- }
- }
- MESSAGE("name: " <<name);
- }
-
- if (txt == "__BEGIN_ENTRY__") { // __BEGIN_ENTRY__
- isOK = (load >> entry);
- isOK = (load >> isCompound);
- isOK = (load >> txt); // __END_ENTRY__
- if (txt != "__END_ENTRY__")
- throw std::exception();
- MESSAGE("entry: " << entry);
- }
-
- if (txt == "__BEGIN_GROUP__") { // __BEGIN_GROUP__
- while (isOK && (txt != "__END_GROUP__")) {
- isOK = (load >> txt);
- if (txt != "__END_GROUP__") {
- if (!groupName.empty())
- groupName += " ";
- groupName += txt;
- }
- }
- MESSAGE("groupName: " << groupName);
- }
-
- if (txt == "__BEGIN_COORDS__") { // __BEGIN_COORDS__
- hasCoords = true;
- isOK = (load >> coords[0] >> coords[1] >> coords[2]);
- isOK = (load >> txt); // __END_COORDS__
- if (txt != "__END_COORDS__")
- throw std::exception();
- MESSAGE("coords: " << coords[0] <<","<< coords[1] <<","<< coords[2]);
- }
-
- if (txt == "__BEGIN_SIZE__") { // __BEGIN_ENTRY__
- isOK = (load >> size);
- isOK = (load >> txt); // __END_ENTRY__
- if (txt != "__END_SIZE__") {
- throw std::exception();
- }
- MESSAGE("size: " << size);
- }
- }
- }
- }
+ isOK = (load >> separator);
+ if (isOK && separator == "__ENFORCED_MESHES_BEGIN__")
+ hasEnforcedMeshes = true;
}
+ if (hasEnforcedMeshes) {
+ std::string txt, name, entry, groupName;
+ int elementType = -1;
+ isOK = (load >> txt); // __BEGIN_ENF_MESH__
+ while (isOK) {
+// if (isOK) {
+ if (txt == "__ENFORCED_MESHES_END__")
+ isOK = false;
+
+ TGHS3DEnforcedMesh *enfMesh = new TGHS3DEnforcedMesh();
+ while (isOK) {
+ isOK = (load >> txt);
+ if (txt == "__END_ENF_MESH__") {
+ enfMesh->name = name;
+ enfMesh->entry = entry;
+ enfMesh->elementType = (SMESH::ElementType)elementType;
+ enfMesh->groupName = groupName;
+
+ _enfMeshList.insert(enfMesh);
+ std::cout << "Restoring of enforced mesh " <<name << " done" << std::endl;
+
+ name.clear();
+ entry.clear();
+ elementType = -1;
+ groupName.clear();
+ isOK = false;
+ }
+
+ if (txt == "__BEGIN_NAME__") { // __BEGIN_NAME__
+ while (isOK && (txt != "__END_NAME__")) {
+ isOK = (load >> txt);
+ if (txt != "__END_NAME__") {
+ if (!name.empty())
+ name += " ";
+ name += txt;
+ }
+ }
+ MESSAGE("name: " <<name);
+ }
+
+ if (txt == "__BEGIN_ENTRY__") { // __BEGIN_ENTRY__
+ isOK = (load >> entry);
+ isOK = (load >> txt); // __END_ENTRY__
+ if (txt != "__END_ENTRY__")
+ throw std::exception();
+ MESSAGE("entry: " << entry);
+ }
+
+ if (txt == "__BEGIN_ELEM_TYPE__") { // __BEGIN_ELEM_TYPE__
+ isOK = (load >> elementType);
+ isOK = (load >> txt); // __END_ELEM_TYPE__
+ if (txt != "__END_ELEM_TYPE__")
+ throw std::exception();
+ MESSAGE("elementType: " << elementType);
+ }
+
+ if (txt == "__BEGIN_GROUP__") { // __BEGIN_GROUP__
+ while (isOK && (txt != "__END_GROUP__")) {
+ isOK = (load >> txt);
+ if (txt != "__END_GROUP__") {
+ if (!groupName.empty())
+ groupName += " ";
+ groupName += txt;
+ }
+ } // while
+ MESSAGE("groupName: " << groupName);
+ } // if
+ std::cout << "isOK: " << isOK << std::endl;
+ } // while
+// } // if
+ isOK = (load >> txt); // __BEGIN_ENF_MESH__
+ } // while
+ } // if
+
return load;
}
//================================================================================
std::string GHS3DPlugin_Hypothesis::CommandToRun(const GHS3DPlugin_Hypothesis* hyp,
- const bool hasShapeToMesh)
+ const bool hasShapeToMesh)
{
TCollection_AsciiString cmd;
if (hasShapeToMesh)
bool v = hyp ? ( hyp->myTextOption.find("-v") == std::string::npos ) : true;
bool fem = hyp ? ( hyp->myTextOption.find("-FEM")== std::string::npos ) : true;
bool rem = hyp ? ( hyp->myTextOption.find("-no_initial_central_point")== std::string::npos ) : true;
+ bool gra = hyp ? ( hyp->myTextOption.find("-Dcpropa")== std::string::npos ) : true;
// if use boundary recovery version, few options are allowed
bool useBndRecovery = !C;
cmd += (char*) hyp->myTextOption.c_str();
}
+ // to define volumic gradation.
+ if ( gra && hyp) {
+ cmd += " -Dcpropa=";
+ cmd += hyp->myGradation;
+ }
+
#ifdef WNT
cmd += " < NUL";
#endif
return hyp ? hyp->_GetNodeIDToSizeMap(): DefaultID2SizeMap();
}
-GHS3DPlugin_Hypothesis::TID2SizeMap GHS3DPlugin_Hypothesis::GetElementIDToSizeMap(const GHS3DPlugin_Hypothesis* hyp)
-{
- return hyp ? hyp->_GetElementIDToSizeMap(): DefaultID2SizeMap();
-}
-
GHS3DPlugin_Hypothesis::TSetStrings GHS3DPlugin_Hypothesis::GetGroupsToRemove(const GHS3DPlugin_Hypothesis* hyp)
{
return hyp ? hyp->_GetGroupsToRemove(): DefaultGroupsToRemove();
struct TGHS3DEnforcedMesh {
std::string name;
std::string entry;
- SMESH::ElementType elementType;
std::string groupName;
- double size;
+ SMESH::ElementType elementType;
};
struct CompareGHS3DEnforcedMesh {
};
typedef std::set< TGHS3DEnforcedMesh*, CompareGHS3DEnforcedMesh > TGHS3DEnforcedMeshList;
// Map mesh entry / Enforced mesh list
- // ex: 0:1:2:1 -> [ ("Mesh_1", "0:1:2:1", TopAbs_NODE, "", -1),
- // ("Mesh_1", "0:1:2:1", TopAbs_EDGE, "edge group", 5)]
+ // ex: 0:1:2:1 -> [ ("Mesh_1", "0:1:2:1", TopAbs_NODE, ""),
+ // ("Mesh_1", "0:1:2:1", TopAbs_EDGE, "edge group")]
typedef std::map< std::string, TGHS3DEnforcedMeshList > TEntryGHS3DEnforcedMeshListMap;
typedef std::map<int,double> TID2SizeMap;
+
+ struct TIDMeshIDCompare {
+ bool operator () (const SMDS_MeshElement* e1, const SMDS_MeshElement* e2) const
+ { return e1->getMeshId() == e2->getMeshId() ? e1->GetID() < e2->GetID() : e1->getMeshId() < e2->getMeshId() ; }
+ };
- typedef std::map<const SMDS_MeshElement*, std::string, TIDCompare > TIDSortedElemGroupMap;
- typedef std::map<const SMDS_MeshNode*, std::string, TIDCompare > TIDSortedNodeGroupMap;
+ typedef std::map<const SMDS_MeshElement*, std::string, TIDMeshIDCompare > TIDSortedElemGroupMap;
+ typedef std::map<const SMDS_MeshNode*, std::string, TIDMeshIDCompare > TIDSortedNodeGroupMap;
typedef std::set<std::string> TSetStrings;
static const char* GetHypType() { return "GHS3D_Parameters"; }
*/
void SetTextOption(const std::string& option);
std::string GetTextOption() const;
+ /*!
+ * To define the volumic gradation
+ */
+ void SetGradation(double gradation);
+ double GetGradation() const ;
// struct TEnforcedEdge {
/*!
* To set enforced elements
*/
- bool SetEnforcedMesh(SMESH_Mesh& theMesh, SMESH::ElementType elementType, std::string name, std::string entry, double size, std::string groupName = "");
- bool SetEnforcedGroup(const SMESHDS_Mesh* theMeshDS, SMESH::long_array_var theIDs, SMESH::ElementType elementType, std::string name, std::string entry, double size, std::string groupName = "");
- bool SetEnforcedElements(TIDSortedElemSet theElemSet, SMESH::ElementType elementType, double size, std::string groupName = "");
+ bool SetEnforcedMesh(SMESH_Mesh& theMesh, SMESH::ElementType elementType, std::string name, std::string entry, std::string groupName = "");
+ bool SetEnforcedGroup(const SMESHDS_Mesh* theMeshDS, SMESH::long_array_var theIDs, SMESH::ElementType elementType, std::string name, std::string entry, std::string groupName = "");
+ bool SetEnforcedElements(TIDSortedElemSet theElemSet, SMESH::ElementType elementType, std::string groupName = "");
const TGHS3DEnforcedMeshList _GetEnforcedMeshes() const { return _enfMeshList; }
const TEntryGHS3DEnforcedMeshListMap _GetEnforcedMeshesByEntry() const { return _entryEnfMeshMap; }
void ClearEnforcedMeshes();
const TIDSortedElemGroupMap _GetEnforcedEdges() const { return _enfEdges; }
const TIDSortedElemGroupMap _GetEnforcedTriangles() const { return _enfTriangles; }
const TID2SizeMap _GetNodeIDToSizeMap() const {return _nodeIDToSizeMap; }
- const TID2SizeMap _GetElementIDToSizeMap() const {return _elementIDToSizeMap; }
const TSetStrings _GetGroupsToRemove() const {return _groupsToRemove; }
/*!
* \brief Return the enforced vertices
static TIDSortedElemGroupMap GetEnforcedEdges(const GHS3DPlugin_Hypothesis* hyp);
static TIDSortedElemGroupMap GetEnforcedTriangles(const GHS3DPlugin_Hypothesis* hyp);
static TID2SizeMap GetNodeIDToSizeMap(const GHS3DPlugin_Hypothesis* hyp);
- static TID2SizeMap GetElementIDToSizeMap(const GHS3DPlugin_Hypothesis* hyp);
static TSetStrings GetGroupsToRemove(const GHS3DPlugin_Hypothesis* hyp);
void ClearGroupsToRemove();
static bool DefaultToUseBoundaryRecoveryVersion();
static bool DefaultToUseFEMCorrection();
static bool DefaultToRemoveCentralPoint();
+ static double DefaultGradation();
static TGHS3DEnforcedVertex DefaultGHS3DEnforcedVertex() {return TGHS3DEnforcedVertex();}
static TGHS3DEnforcedVertexList DefaultGHS3DEnforcedVertexList() {return TGHS3DEnforcedVertexList();}
bool myToUseFemCorrection;
bool myToRemoveCentralPoint;
std::string myTextOption;
+ double myGradation;
TGHS3DEnforcedVertexList _enfVertexList;
TGHS3DEnforcedVertexCoordsValues _enfVertexCoordsSizeList;
TIDSortedElemGroupMap _enfEdges;
TIDSortedElemGroupMap _enfTriangles;
TID2SizeMap _nodeIDToSizeMap;
- TID2SizeMap _elementIDToSizeMap;
std::map<std::string, TIDSortedElemSet > _entryToElemsMap;
TSetStrings _groupsToRemove;
return CORBA::string_dup( this->GetImpl()->GetTextOption().c_str() );
}
+//=======================================================================
+//function : SetToRemoveCentralPoint
+//=======================================================================
+
+void GHS3DPlugin_Hypothesis_i::SetGradation(CORBA::Double gradation)
+{
+ if (gradation <= 1)
+ THROW_SALOME_CORBA_EXCEPTION( "The volumic gradation must be > 1",SALOME::BAD_PARAM );
+ ASSERT(myBaseImpl);
+ if (gradation != GetGradation()) {
+ this->GetImpl()->SetGradation(gradation);
+ SMESH::TPythonDump() << _this() << ".SetGradation( " << gradation << " )";
+ }
+}
+
+//=======================================================================
+//function : GetToRemoveCentralPoint
+//=======================================================================
+
+CORBA::Double GHS3DPlugin_Hypothesis_i::GetGradation()
+{
+ ASSERT(myBaseImpl);
+ return this->GetImpl()->GetGradation();
+}
+
//=======================================================================
//function : SetEnforcedVertex
//=======================================================================
enfMesh->elementType = currentMesh->elementType;
// Group Name
enfMesh->groupName = CORBA::string_dup(currentMesh->groupName.c_str());
- // Size
- enfMesh->size = currentMesh->size;
result[i]=enfMesh;
}
throw (SALOME::SALOME_Exception)
{
#if GHS3D_VERSION >= 42
- return p_SetEnforcedMesh(theSource, theType, -1.0, theGroupName);
-// bool res = p_SetEnforcedMesh(theSource, theType, -1.0, theGroupName);
-// SMESH_Mesh_i* theMesh_i = SMESH::DownCast<SMESH_Mesh_i*>( theSource);
-// SMESH_Group_i* theGroup_i = SMESH::DownCast<SMESH_Group_i*>( theSource);
-// SMESH_GroupOnGeom_i* theGroupOnGeom_i = SMESH::DownCast<SMESH_GroupOnGeom_i*>( theSource);
-// if (theGroup_i || theGroupOnGeom_i)
-// {
-// SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMeshWithGroup( "
-// << theSource << ", " << theType << ", \"" << theGroupName << "\" )";
-// }
-// else if (theMesh_i)
-// {
-// SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMeshWithGroup( "
-// << theSource << ".GetMesh(), " << theType << ", \"" << theGroupName << "\" )";
-// }
-// return res;
+ return p_SetEnforcedMesh(theSource, theType, "", theGroupName);
#else
SALOME::ExceptionStruct ExDescription;
ExDescription.text = "Bad version of GHS3D. It must >= 4.2.";
// MESSAGE("GHS3DPlugin_Hypothesis_i::SetEnforcedMesh");
#if GHS3D_VERSION >= 42
return p_SetEnforcedMesh(theSource, theType);
-// bool res = p_SetEnforcedMesh(theSource, theType);
-// SMESH_Mesh_i* theMesh_i = SMESH::DownCast<SMESH_Mesh_i*>( theSource);
-// SMESH_Group_i* theGroup_i = SMESH::DownCast<SMESH_Group_i*>( theSource);
-// SMESH_GroupOnGeom_i* theGroupOnGeom_i = SMESH::DownCast<SMESH_GroupOnGeom_i*>( theSource);
-// if (theGroup_i || theGroupOnGeom_i)
-// {
-// SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMesh( "
-// << theSource << ", " << theType << " )";
-// }
-// else if (theMesh_i)
-// {
-// SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMesh( "
-// << theSource << ".GetMesh(), " << theType << " )";
-// }
-// return res;
#else
SALOME::ExceptionStruct ExDescription;
ExDescription.text = "Bad version of GHS3D. It must >= 4.2.";
}
/*!
- * \brief Adds enforced elements of type elementType using another mesh/sub-mesh/mesh group theSource and a size. The elements will be grouped in theGroupName.
+ * \brief OBSOLETE FUNCTION - Adds enforced elements of type elementType using another mesh/sub-mesh/mesh group theSource and a size. The elements will be grouped in theGroupName.
*/
bool GHS3DPlugin_Hypothesis_i::SetEnforcedMeshSizeWithGroup(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType theType, double theSize, const char* theGroupName)
throw (SALOME::SALOME_Exception)
{
#if GHS3D_VERSION >= 42
- if (theSize < 0) {
- SALOME::ExceptionStruct ExDescription;
- ExDescription.text = "Size cannot be negative";
- ExDescription.type = SALOME::BAD_PARAM;
- ExDescription.sourceFile = "GHS3DPlugin_Hypothesis_i.cxx";
- ExDescription.lineNumber = 781;
- throw SALOME::SALOME_Exception(ExDescription);
- }
-
- return p_SetEnforcedMesh(theSource, theType, theSize, theGroupName);
-// bool res = p_SetEnforcedMesh(theSource, theType, theSize, theGroupName);
-// SMESH_Mesh_i* theMesh_i = SMESH::DownCast<SMESH_Mesh_i*>( theSource);
-// SMESH_Group_i* theGroup_i = SMESH::DownCast<SMESH_Group_i*>( theSource);
-// SMESH_GroupOnGeom_i* theGroupOnGeom_i = SMESH::DownCast<SMESH_GroupOnGeom_i*>( theSource);
-// if (theGroup_i || theGroupOnGeom_i)
-// {
-// SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMeshSizeWithGroup( "
-// << theSource << ", " << theType << ", " << theSize << ", \"" << theGroupName << "\" )";
-// }
-// else if (theMesh_i)
-// {
-// SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMeshSizeWithGroup( "
-// << theSource << ".GetMesh(), " << theType << ", " << theSize << ", \"" << theGroupName << "\" )";
-// }
-// return res;
+ return p_SetEnforcedMesh(theSource, theType, "", theGroupName);
#else
SALOME::ExceptionStruct ExDescription;
ExDescription.text = "Bad version of GHS3D. It must >= 4.2.";
}
/*!
- * \brief Adds enforced elements of type elementType using another mesh/sub-mesh/mesh group theSource and a size.
+ * \brief OBSOLETE FUNCTION - Adds enforced elements of type elementType using another mesh/sub-mesh/mesh group theSource and a size.
*/
bool GHS3DPlugin_Hypothesis_i::SetEnforcedMeshSize(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType theType, double theSize)
throw (SALOME::SALOME_Exception)
{
#if GHS3D_VERSION >= 42
- if (theSize < 0) {
- SALOME::ExceptionStruct ExDescription;
- ExDescription.text = "Size cannot be negative";
- ExDescription.type = SALOME::BAD_PARAM;
- ExDescription.sourceFile = "GHS3DPlugin_Hypothesis_i.cxx";
- ExDescription.lineNumber = 781;
- throw SALOME::SALOME_Exception(ExDescription);
- }
- return p_SetEnforcedMesh(theSource, theType, theSize);
-// bool res = p_SetEnforcedMesh(theSource, theType, theSize);
-// SMESH_Mesh_i* theMesh_i = SMESH::DownCast<SMESH_Mesh_i*>( theSource);
-// SMESH_Group_i* theGroup_i = SMESH::DownCast<SMESH_Group_i*>( theSource);
-// SMESH_GroupOnGeom_i* theGroupOnGeom_i = SMESH::DownCast<SMESH_GroupOnGeom_i*>( theSource);
-// if (theGroup_i || theGroupOnGeom_i)
-// {
-// SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMeshSize( "
-// << theSource << ", " << theType << ", " << theSize << " )";
-// }
-// else if (theMesh_i)
-// {
-// SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMeshSize( "
-// << theSource << ".GetMesh(), " << theType << ", " << theSize << " )";
-// }
-// return res;
+ return p_SetEnforcedMesh(theSource, theType);
#else
SALOME::ExceptionStruct ExDescription;
ExDescription.text = "Bad version of GHS3D. It must >= 4.2.";
#endif
}
-bool GHS3DPlugin_Hypothesis_i::p_SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType theType, double theSize, const char* theGroupName)
+bool GHS3DPlugin_Hypothesis_i::p_SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType theType, const char* theName, const char* theGroupName)
throw (SALOME::SALOME_Exception)
{
MESSAGE("GHS3DPlugin_Hypothesis_i::p_SetEnforcedMesh");
throw SALOME::SALOME_Exception(ExDescription);
}
- if ((theType != SMESH::NODE) && (theType != SMESH::EDGE) && (theType != SMESH::FACE))
- {
- return false;
-// SALOME::ExceptionStruct ExDescription;
-// ExDescription.text = "Bad elementType";
-// ExDescription.type = SALOME::BAD_PARAM;
-// ExDescription.sourceFile = "GHS3DPlugin_Hypothesis_i.cxx";
-// ExDescription.lineNumber = 840;
-// throw SALOME::SALOME_Exception(ExDescription);
- }
-
- SMESH::array_of_ElementType_var types = theSource->GetTypes();
switch (theType) {
case SMESH::NODE:
MESSAGE("Required type is NODE");
MESSAGE("Required type is FACE");
break;
default:
- break;
+ MESSAGE("Incompatible required type: " << theType);
+ return false;
}
// MESSAGE("Required type is "<<theType);
+ SMESH::array_of_ElementType_var types = theSource->GetTypes();
MESSAGE("Available types:");
for (int i=0;i<types->length();i++){MESSAGE(types[i]);}
if ( types->length() >= 1 && types[types->length()-1] < theType)
{
+ MESSAGE("Required type not available");
return false;
// SALOME::ExceptionStruct ExDescription;
// ExDescription.text = "The source mesh has bad type";
// throw SALOME::SALOME_Exception(ExDescription);
}
+
+ SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
+ SALOMEDS::SObject_ptr SObj = smeshGen->ObjectToSObject(smeshGen->GetCurrentStudy(),theSource);
+
SMESH_Mesh_i* theMesh_i = SMESH::DownCast<SMESH_Mesh_i*>( theSource);
SMESH_Group_i* theGroup_i = SMESH::DownCast<SMESH_Group_i*>( theSource);
SMESH_GroupOnGeom_i* theGroupOnGeom_i = SMESH::DownCast<SMESH_GroupOnGeom_i*>( theSource);
- TIDSortedElemSet theElemSet;
- SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
- SALOMEDS::SObject_ptr SObj = smeshGen->ObjectToSObject(smeshGen->GetCurrentStudy(),theSource);
+
+ string enfMeshName = theName;
+ if (enfMeshName.empty())
+ enfMeshName = SObj->GetName();
+
if (theMesh_i)
{
try {
- bool res = this->GetImpl()->SetEnforcedMesh(theMesh_i->GetImpl(), theType, SObj->GetName() , SObj->GetID(), theSize, theGroupName);
- if (theSize > 0) {
- if (theGroupName != "") {
- SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMeshSizeWithGroup( "
- << theSource << ".GetMesh(), " << theType << ", " << theSize << ", \"" << theGroupName << "\" )";
- }
- else {
- SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMeshSize( "
- << theSource << ".GetMesh(), " << theType << ", " << theSize << ", \"" << theGroupName << "\" )";
- }
- }
- else {
- if (theGroupName != "") {
- SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMeshWithGroup( "
- << theSource << ".GetMesh(), " << theType << ", \"" << theGroupName << "\" )";
- }
- else {
- SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMesh( "
- << theSource << ".GetMesh(), " << theType << " )";
- }
- }
+ bool res = this->GetImpl()->SetEnforcedMesh(theMesh_i->GetImpl(), theType, enfMeshName , SObj->GetID(), theGroupName);
+ if (theGroupName != "") {
+ SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMeshWithGroup( "
+ << theSource << ".GetMesh(), " << theType << ", \"" << theGroupName << "\" )";
+ }
+ else {
+ SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMesh( "
+ << theSource << ".GetMesh(), " << theType << " )";
+ }
+
return res;
}
catch (const std::invalid_argument& ex) {
THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
}
}
- else if (theGroup_i && types->length() == 1 && types[0] == theType)
+ else if (theGroup_i)// && types->length() == 1 && types[0] == theType)
{
MESSAGE("The source is a group")
try {
- bool res = this->GetImpl()->SetEnforcedGroup(theGroup_i->GetGroupDS()->GetMesh(), theGroup_i->GetListOfID(), theType, SObj->GetName() , SObj->GetID(), theSize, theGroupName);
- if (theSize > 0) {
- if (theGroupName != "") {
- SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMeshSizeWithGroup( "
- << theSource << ", " << theType << ", " << theSize << ", \"" << theGroupName << "\" )";
- }
- else {
- SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMeshSize( "
- << theSource << ", " << theType << ", " << theSize << ", \"" << theGroupName << "\" )";
- }
- }
- else {
+ bool res = this->GetImpl()->SetEnforcedGroup(theGroup_i->GetGroupDS()->GetMesh(), theGroup_i->GetListOfID(), theType, enfMeshName , SObj->GetID(), theGroupName);
if (theGroupName != "") {
SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMeshWithGroup( "
<< theSource << ", " << theType << ", \"" << theGroupName << "\" )";
SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMesh( "
<< theSource << ", " << theType << " )";
}
- }
return res;
}
catch (const std::invalid_argument& ex) {
THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
}
}
- else if (theGroupOnGeom_i && types->length() == 1 && types[0] == theType)
+ else if (theGroupOnGeom_i)// && types->length() == 1 && types[0] == theType)
{
MESSAGE("The source is a group on geom")
try {
- bool res = this->GetImpl()->SetEnforcedGroup(theGroupOnGeom_i->GetGroupDS()->GetMesh(),theGroupOnGeom_i->GetListOfID(), theType, SObj->GetName() , SObj->GetID(), theSize, theGroupName);
- if (theSize > 0) {
- if (theGroupName != "") {
- SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMeshSizeWithGroup( "
- << theSource << ", " << theType << ", " << theSize << ", \"" << theGroupName << "\" )";
- }
- else {
- SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMeshSize( "
- << theSource << ", " << theType << ", " << theSize << ", \"" << theGroupName << "\" )";
- }
- }
- else {
+ bool res = this->GetImpl()->SetEnforcedGroup(theGroupOnGeom_i->GetGroupDS()->GetMesh(),theGroupOnGeom_i->GetListOfID(), theType, enfMeshName , SObj->GetID(), theGroupName);
if (theGroupName != "") {
SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMeshWithGroup( "
<< theSource << ", " << theType << ", \"" << theGroupName << "\" )";
SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMesh( "
<< theSource << ", " << theType << " )";
}
- }
return res;
}
catch (const std::invalid_argument& ex) {
*/
void SetTextOption(const char* option);
char* GetTextOption();
+ /*!
+ * To define the volumic gradation
+ */
+ void SetGradation(CORBA::Double gradation);
+ CORBA::Double GetGradation();
/*!
* To set an enforced vertex
*/
/*!
* To set an enforced mesh
*/
- bool p_SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType elementType, double size = -1, const char* theGroupName="") throw (SALOME::SALOME_Exception);
+ bool p_SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType elementType, const char* theName="", const char* theGroupName="") throw (SALOME::SALOME_Exception);
bool SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType elementType) throw (SALOME::SALOME_Exception);
bool SetEnforcedMeshWithGroup(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType elementType, const char* theGroupName) throw (SALOME::SALOME_Exception);
+
+ /* OBSOLETE FUNCTIONS */
bool SetEnforcedMeshSize(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType elementType, double size) throw (SALOME::SALOME_Exception);
bool SetEnforcedMeshSizeWithGroup(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType elementType, double size, const char* theGroupName) throw (SALOME::SALOME_Exception);
+ /* OBSOLETE FUNCTIONS */
+
GHS3DPlugin::GHS3DEnforcedMeshList* GetEnforcedMeshes();
void ClearEnforcedMeshes();
# header files
salomeinclude_HEADERS = \
- libmesh5.h \
GHS3DPlugin_Defs.hxx \
GHS3DPlugin_GHS3D.hxx \
GHS3DPlugin_GHS3D_i.hxx \
lib_LTLIBRARIES = libGHS3DEngine.la
dist_libGHS3DEngine_la_SOURCES = \
- libmesh5.c \
GHS3DPlugin_GHS3D.cxx \
GHS3DPlugin_GHS3D_i.cxx \
GHS3DPlugin_i.cxx \
../../idl/libSalomeIDLGHS3DPLUGIN.la \
$(CAS_KERNEL) -lTKBRep -lTKG2d -lTKG3d -lTKTopAlgo -lTKGeomBase -lTKGeomAlgo -lTKCDF \
$(MED_LDFLAGS) -lSalomeIDLMED \
- $(SMESH_LDFLAGS) -lSMESHimpl -lSMESHEngine -lSMESHDS -lSMDS -lStdMeshers \
+ $(SMESH_LDFLAGS) -lSMESHimpl -lSMESHEngine -lSMESHDS -lSMDS -lStdMeshers -lMeshDriverGMF \
$(KERNEL_LDFLAGS) -lSalomeGenericObj -lSALOMELocalTrace -lSALOMEBasics -lSalomeNS -lOpUtil
# Scripts to be installed.
+++ /dev/null
-
-
-/*----------------------------------------------------------*/
-/* */
-/* LIBMESH V 5.45 */
-/* */
-/*----------------------------------------------------------*/
-/* */
-/* Description: handle .meshb file format I/O */
-/* Author: Loic MARECHAL */
-/* Creation date: feb 16 2007 */
-/* Last modification: feb 08 2011 */
-/* */
-/*----------------------------------------------------------*/
-
-
-/*----------------------------------------------------------*/
-/* Includes */
-/*----------------------------------------------------------*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <float.h>
-#include <math.h>
-#include <ctype.h>
-#include "libmesh5.h"
-
-
-/*----------------------------------------------------------*/
-/* Defines */
-/*----------------------------------------------------------*/
-
-#define Asc 1
-#define Bin 2
-#define MshFil 4
-#define SolFil 8
-#define MaxMsh 100
-#define InfKwd 1
-#define RegKwd 2
-#define SolKwd 3
-#define WrdSiz 4
-#define BufSiz 10000
-
-
-/*----------------------------------------------------------*/
-/* Structures */
-/*----------------------------------------------------------*/
-
-typedef struct
-{
- int typ, SolSiz, NmbWrd, NmbLin, NmbTyp, TypTab[ GmfMaxTyp ];
- long pos;
- char fmt[ GmfMaxTyp*9 ];
-}KwdSct;
-
-typedef struct
-{
- int dim, ver, mod, typ, cod, pos;
- long NexKwdPos;
- KwdSct KwdTab[ GmfMaxKwd + 1 ];
- FILE *hdl;
- int *IntBuf;
- float *FltBuf;
- unsigned char *buf;
- char FilNam[ GmfStrSiz ];
- double DblBuf[1000/8];
- unsigned char blk[ BufSiz + 1000 ];
-}GmfMshSct;
-
-
-/*----------------------------------------------------------*/
-/* Global variables */
-/*----------------------------------------------------------*/
-
-int GmfIniFlg=0;
-GmfMshSct *GmfMshTab[ MaxMsh + 1 ];
-char *GmfKwdFmt[ GmfMaxKwd + 1 ][4] =
-{ {"Reserved", "", "", ""},
- {"MeshVersionFormatted", "", "", "i"},
- {"Reserved", "", "", ""},
- {"Dimension", "", "", "i"},
- {"Vertices", "Vertex", "i", "dri"},
- {"Edges", "Edge", "i", "iii"},
- {"Triangles", "Triangle", "i", "iiii"},
- {"Quadrilaterals", "Quadrilateral", "i", "iiiii"},
- {"Tetrahedra", "Tetrahedron", "i", "iiiii"},
- {"Prisms", "Prism", "i", "iiiiiii"},
- {"Hexahedra", "Hexahedron", "i", "iiiiiiiii"},
- {"IterationsAll", "IterationAll","","i"},
- {"TimesAll", "TimeAll","","r"},
- {"Corners", "Corner", "i", "i"},
- {"Ridges", "Ridge", "i", "i"},
- {"RequiredVertices", "RequiredVertex", "i", "i"},
- {"RequiredEdges", "RequiredEdge", "i", "i"},
- {"RequiredTriangles", "RequiredTriangle", "i", "i"},
- {"RequiredQuadrilaterals", "RequiredQuadrilateral", "i", "i"},
- {"TangentAtEdgeVertices", "TangentAtEdgeVertex", "i", "iii"},
- {"NormalAtVertices", "NormalAtVertex", "i", "ii"},
- {"NormalAtTriangleVertices", "NormalAtTriangleVertex", "i", "iii"},
- {"NormalAtQuadrilateralVertices", "NormalAtQuadrilateralVertex", "i", "iiii"},
- {"AngleOfCornerBound", "", "", "r"},
- {"TrianglesP2", "TriangleP2", "i", "iiiiiii"},
- {"EdgesP2", "EdgeP2", "i", "iiii"},
- {"SolAtPyramids", "SolAtPyramid", "i", "sr"},
- {"QuadrilateralsQ2", "QuadrilateralQ2", "i", "iiiiiiiiii"},
- {"ISolAtPyramids", "ISolAtPyramid", "i", "iiiii"},
- {"Reserved", "", "", ""},
- {"TetrahedraP2", "TetrahedronP2", "i", "iiiiiiiiiii"},
- {"Reserved", "", "", ""},
- {"Reserved", "", "", ""},
- {"HexahedraQ2", "HexahedronQ2", "i", "iiiiiiiiiiiiiiiiiiiiiiiiiiii"},
- {"Reserved", "", "", ""},
- {"Reserved", "", "", ""},
- {"Reserved", "", "", ""},
- {"Reserved", "", "", ""},
- {"Reserved", "", "", ""},
- {"Reserved", "", "", ""},
- {"Reserved", "", "", ""},
- {"Reserved", "", "", ""},
- {"Reserved", "", "", ""},
- {"Reserved", "", "", ""},
- {"Reserved", "", "", ""},
- {"Reserved", "", "", ""},
- {"Polyhedra", "Polyhedron", "i", "iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii"},
- {"Polygons", "Polygon", "", "iiiiiiiii"},
- {"Reserved", "", "", ""},
- {"Pyramids", "Pyramid", "i", "iiiiii"},
- {"BoundingBox", "", "", "drdr"},
- {"Body","i", "drdrdrdr"},
- {"PrivateTable", "PrivateTable", "i", "i"},
- {"Reserved", "", "", ""},
- {"End", "", "", ""},
- {"Reserved", "", "", ""},
- {"Reserved", "", "", ""},
- {"Reserved", "", "", ""},
- {"Reserved", "", "", ""},
- {"Tangents", "Tangent", "i", "dr"},
- {"Normals", "Normal", "i", "dr"},
- {"TangentAtVertices", "TangentAtVertex", "i", "ii"},
- {"SolAtVertices", "SolAtVertex", "i", "sr"},
- {"SolAtEdges", "SolAtEdge", "i", "sr"},
- {"SolAtTriangles", "SolAtTriangle", "i", "sr"},
- {"SolAtQuadrilaterals", "SolAtQuadrilateral", "i", "sr"},
- {"SolAtTetrahedra", "SolAtTetrahedron", "i", "sr"},
- {"SolAtPrisms", "SolAtPrism", "i", "sr"},
- {"SolAtHexahedra", "SolAtHexahedron", "i", "sr"},
- {"DSolAtVertices", "DSolAtVertex", "i", "sr"},
- {"ISolAtVertices", "ISolAtVertex", "i", "i"},
- {"ISolAtEdges", "ISolAtEdge", "i", "ii"},
- {"ISolAtTriangles", "ISolAtTriangle", "i", "iii"},
- {"ISolAtQuadrilaterals", "ISolAtQuadrilateral", "i", "iiii"},
- {"ISolAtTetrahedra", "ISolAtTetrahedron", "i", "iiii"},
- {"ISolAtPrisms", "ISolAtPrism", "i", "iiiiii"},
- {"ISolAtHexahedra", "ISolAtHexahedron", "i", "iiiiiiii"},
- {"Iterations", "","","i"},
- {"Time", "","","r"},
- {"Reserved", "","",""}
- };
-
-
-/*----------------------------------------------------------*/
-/* Prototypes of local procedures */
-/*----------------------------------------------------------*/
-
-static void ScaWrd(GmfMshSct *, unsigned char *);
-static void ScaDblWrd(GmfMshSct *, unsigned char *);
-static void ScaBlk(GmfMshSct *, unsigned char *, int);
-static long GetPos(GmfMshSct *);
-static void RecWrd(GmfMshSct *, unsigned char *);
-static void RecDblWrd(GmfMshSct *, unsigned char *);
-static void RecBlk(GmfMshSct *, unsigned char *, int);
-static void SetPos(GmfMshSct *, long);
-static int ScaKwdTab(GmfMshSct *);
-static void ExpFmt(GmfMshSct *, int);
-static void ScaKwdHdr(GmfMshSct *, int);
-
-
-/*----------------------------------------------------------*/
-/* Open a mesh file in read or write mod */
-/*----------------------------------------------------------*/
-
-int GmfOpenMesh(const char *FilNam, int mod, ...)
-{
- int i, KwdCod, res, *PtrVer, *PtrDim, MshIdx=0;
- char str[ GmfStrSiz ];
- va_list VarArg;
- GmfMshSct *msh;
-
- if(!GmfIniFlg)
- {
- for(i=0;i<=MaxMsh;i++)
- GmfMshTab[i] = NULL;
-
- GmfIniFlg = 1;
- }
-
- /*---------------------*/
- /* MESH STRUCTURE INIT */
- /*---------------------*/
-
- for(i=1;i<=MaxMsh;i++)
- if(!GmfMshTab[i])
- {
- MshIdx = i;
- break;
- }
-
- if( !MshIdx || !(msh = calloc(1, sizeof(GmfMshSct))) )
- return(0);
-
- /* Copy the FilNam into the structure */
-
- if(strlen(FilNam) + 7 >= GmfStrSiz)
- return(0);
-
- strcpy(msh->FilNam, FilNam);
-
- /* Store the opening mod (read or write) and guess the filetype (binary or ascii) depending on the extension */
-
- msh->mod = mod;
- msh->buf = (void *)msh->DblBuf;
- msh->FltBuf = (void *)msh->DblBuf;
- msh->IntBuf = (void *)msh->DblBuf;
-
- if(strstr(msh->FilNam, ".meshb"))
- msh->typ |= (Bin | MshFil);
- else if(strstr(msh->FilNam, ".mesh"))
- msh->typ |= (Asc | MshFil);
- else if(strstr(msh->FilNam, ".solb"))
- msh->typ |= (Bin | SolFil);
- else if(strstr(msh->FilNam, ".sol"))
- msh->typ |= (Asc | SolFil);
- else
- return(0);
-
- /* Open the file in the required mod and initialyse the mesh structure */
-
- if(msh->mod == GmfRead)
- {
-
- /*-----------------------*/
- /* OPEN FILE FOR READING */
- /*-----------------------*/
-
- va_start(VarArg, mod);
- PtrVer = va_arg(VarArg, int *);
- PtrDim = va_arg(VarArg, int *);
- va_end(VarArg);
-
- /* Create the name string and open the file */
-
- if(!(msh->hdl = fopen(msh->FilNam, "rb")))
- return(0);
-
- /* Read the endian coding tag, the mesh version and the mesh dimension (mandatory kwd) */
-
- if(msh->typ & Bin)
- {
- fread((unsigned char *)&msh->cod, WrdSiz, 1, msh->hdl);
-
- if( (msh->cod != 1) && (msh->cod != 16777216) )
- return(0);
-
- ScaWrd(msh, (unsigned char *)&msh->ver);
-
- if( (msh->ver < 1) || (msh->ver > 3) )
- return(0);
-
- if( (msh->ver == 3) && (sizeof(long) == 4) )
- return(0);
-
- ScaWrd(msh, (unsigned char *)&KwdCod);
-
- if(KwdCod != GmfDimension)
- return(0);
-
- GetPos(msh);
- ScaWrd(msh, (unsigned char *)&msh->dim);
- }
- else
- {
- do
- {
- res = fscanf(msh->hdl, "%s", str);
- }while( (res != EOF) && strcmp(str, "MeshVersionFormatted") );
-
- if(res == EOF)
- return(0);
-
- fscanf(msh->hdl, "%d", &msh->ver);
-
- if( (msh->ver < 1) || (msh->ver > 3) )
- return(0);
-
- do
- {
- res = fscanf(msh->hdl, "%s", str);
- }while( (res != EOF) && strcmp(str, "Dimension") );
-
- if(res == EOF)
- return(0);
-
- fscanf(msh->hdl, "%d", &msh->dim);
- }
-
- if( (msh->dim != 2) && (msh->dim != 3) )
- return(0);
-
- (*PtrVer) = msh->ver;
- (*PtrDim) = msh->dim;
-
- /*------------*/
- /* KW READING */
- /*------------*/
-
- /* Read the list of kw present in the file */
-
- if(!ScaKwdTab(msh))
- return(0);
-
- GmfMshTab[ MshIdx ] = msh;
-
- return(MshIdx);
- }
- else if(msh->mod == GmfWrite)
- {
-
- /*-----------------------*/
- /* OPEN FILE FOR WRITING */
- /*-----------------------*/
-
- msh->cod = 1;
-
- /* Check if the user provided a valid version number and dimension */
-
- va_start(VarArg, mod);
- msh->ver = va_arg(VarArg, int);
- msh->dim = va_arg(VarArg, int);
- va_end(VarArg);
-
- if( (msh->ver < 1) || (msh->ver > 3) )
- return(0);
-
- if( (msh->ver == 3) && (sizeof(long) == 4) )
- return(0);
-
- if( (msh->dim != 2) && (msh->dim != 3) )
- return(0);
-
- /* Create the mesh file */
-
- if(!(msh->hdl = fopen(msh->FilNam, "wb")))
- return(0);
-
- GmfMshTab[ MshIdx ] = msh;
-
-
- /*------------*/
- /* KW WRITING */
- /*------------*/
-
- /* Write the mesh version and dimension */
-
- if(msh->typ & Asc)
- {
- fprintf(msh->hdl, "%s %d\n\n", GmfKwdFmt[ GmfVersionFormatted ][0], msh->ver);
- fprintf(msh->hdl, "%s %d\n", GmfKwdFmt[ GmfDimension ][0], msh->dim);
- }
- else
- {
- RecWrd(msh, (unsigned char *)&msh->cod);
- RecWrd(msh, (unsigned char *)&msh->ver);
- GmfSetKwd(MshIdx, GmfDimension, 0);
- RecWrd(msh, (unsigned char *)&msh->dim);
- }
-
- return(MshIdx);
- }
- else
- return(0);
-}
-
-
-/*----------------------------------------------------------*/
-/* Close a meshfile in the right way */
-/*----------------------------------------------------------*/
-
-int GmfCloseMesh(int MshIdx)
-{
- int res = 1;
- GmfMshSct *msh;
-
- if( (MshIdx < 1) || (MshIdx > MaxMsh) )
- return(0);
-
- msh = GmfMshTab[ MshIdx ];
- RecBlk(msh, msh->buf, 0);
-
- /* In write down the "End" kw in write mode */
-
- if(msh->mod == GmfWrite) {
- if(msh->typ & Asc)
- fprintf(msh->hdl, "\n%s\n", GmfKwdFmt[ GmfEnd ][0]);
- else
- GmfSetKwd(MshIdx, GmfEnd, 0);
- }
-
- /* Close the file and free the mesh structure */
-
- if(fclose(msh->hdl))
- res = 0;
-
- free(msh);
- GmfMshTab[ MshIdx ] = NULL;
-
- return(res);
-}
-
-
-/*----------------------------------------------------------*/
-/* Read the number of lines and set the position to this kwd*/
-/*----------------------------------------------------------*/
-
-int GmfStatKwd(int MshIdx, int KwdCod, ...)
-{
- int i, *PtrNmbTyp, *PtrSolSiz, *TypTab;
- GmfMshSct *msh;
- KwdSct *kwd;
- va_list VarArg;
-
- if( (MshIdx < 1) || (MshIdx > MaxMsh) )
- return(0);
-
- msh = GmfMshTab[ MshIdx ];
-
- if( (KwdCod < 1) || (KwdCod > GmfMaxKwd) )
- return(0);
-
- kwd = &msh->KwdTab[ KwdCod ];
-
- if(!kwd->NmbLin)
- return(0);
-
- /* Read further arguments if this kw is a sol */
-
- if(kwd->typ == SolKwd)
- {
- va_start(VarArg, KwdCod);
-
- PtrNmbTyp = va_arg(VarArg, int *);
- *PtrNmbTyp = kwd->NmbTyp;
-
- PtrSolSiz = va_arg(VarArg, int *);
- *PtrSolSiz = kwd->SolSiz;
-
- TypTab = va_arg(VarArg, int *);
-
- for(i=0;i<kwd->NmbTyp;i++)
- TypTab[i] = kwd->TypTab[i];
-
- va_end(VarArg);
- }
-
- return(kwd->NmbLin);
-}
-
-
-/*----------------------------------------------------------*/
-/* Set the current file position to a given kwd */
-/*----------------------------------------------------------*/
-
-int GmfGotoKwd(int MshIdx, int KwdCod)
-{
- GmfMshSct *msh;
- KwdSct *kwd;
-
- if( (MshIdx < 1) || (MshIdx > MaxMsh) )
- return(0);
-
- msh = GmfMshTab[ MshIdx ];
-
- if( (KwdCod < 1) || (KwdCod > GmfMaxKwd) )
- return(0);
-
- kwd = &msh->KwdTab[ KwdCod ];
-
- if(!kwd->NmbLin)
- return(0);
-
- return(fseek(msh->hdl, kwd->pos, SEEK_SET));
-}
-
-
-/*----------------------------------------------------------*/
-/* Write the kwd and set the number of lines */
-/*----------------------------------------------------------*/
-
-int GmfSetKwd(int MshIdx, int KwdCod, ...)
-{
- int i, NmbLin=0, *TypTab;
- long CurPos;
- va_list VarArg;
- GmfMshSct *msh;
- KwdSct *kwd;
-
- if( (MshIdx < 1) || (MshIdx > MaxMsh) )
- return(0);
-
- msh = GmfMshTab[ MshIdx ];
- RecBlk(msh, msh->buf, 0);
-
- if( (KwdCod < 1) || (KwdCod > GmfMaxKwd) )
- return(0);
-
- kwd = &msh->KwdTab[ KwdCod ];
-
- /* Read further arguments if this kw has a header */
-
- if(strlen(GmfKwdFmt[ KwdCod ][2]))
- {
- va_start(VarArg, KwdCod);
- NmbLin = va_arg(VarArg, int);
-
- if(!strcmp(GmfKwdFmt[ KwdCod ][3], "sr"))
- {
- kwd->NmbTyp = va_arg(VarArg, int);
- TypTab = va_arg(VarArg, int *);
-
- for(i=0;i<kwd->NmbTyp;i++)
- kwd->TypTab[i] = TypTab[i];
- }
-
- va_end(VarArg);
- }
-
- /* Setup the kwd info */
-
- ExpFmt(msh, KwdCod);
-
- if(!kwd->typ)
- return(0);
- else if(kwd->typ == InfKwd)
- kwd->NmbLin = 1;
- else
- kwd->NmbLin = NmbLin;
-
- /* Store the next kwd position in binary file */
-
- if( (msh->typ & Bin) && msh->NexKwdPos )
- {
- CurPos = ftell(msh->hdl);
- fseek(msh->hdl, msh->NexKwdPos, SEEK_SET);
- SetPos(msh, CurPos);
- fseek(msh->hdl, CurPos, SEEK_SET);
- }
-
- /* Write the header */
-
- if(msh->typ & Asc)
- {
- fprintf(msh->hdl, "\n%s\n", GmfKwdFmt[ KwdCod ][0]);
-
- if(kwd->typ != InfKwd)
- fprintf(msh->hdl, "%d\n", kwd->NmbLin);
-
- /* In case of solution field, write the extended header */
-
- if(kwd->typ == SolKwd)
- {
- fprintf(msh->hdl, "%d ", kwd->NmbTyp);
-
- for(i=0;i<kwd->NmbTyp;i++)
- fprintf(msh->hdl, "%d ", kwd->TypTab[i]);
-
- fprintf(msh->hdl, "\n\n");
- }
- }
- else
- {
- RecWrd(msh, (unsigned char *)&KwdCod);
- msh->NexKwdPos = ftell(msh->hdl);
- SetPos(msh, 0);
-
- if(kwd->typ != InfKwd)
- RecWrd(msh, (unsigned char *)&kwd->NmbLin);
-
- /* In case of solution field, write the extended header at once */
-
- if(kwd->typ == SolKwd)
- {
- RecWrd(msh, (unsigned char *)&kwd->NmbTyp);
-
- for(i=0;i<kwd->NmbTyp;i++)
- RecWrd(msh, (unsigned char *)&kwd->TypTab[i]);
- }
- }
- msh->pos = 0;
- return(kwd->NmbLin);
-}
-
-
-/*----------------------------------------------------------*/
-/* Read a full line from the current kwd */
-/*----------------------------------------------------------*/
-
-void GmfGetLin(int MshIdx, int KwdCod, ...)
-{
- int i, j;
- float *FltSolTab;
- double *DblSolTab;
- va_list VarArg;
- GmfMshSct *msh = GmfMshTab[ MshIdx ];
- KwdSct *kwd = &msh->KwdTab[ KwdCod ];
-
- /* Start decoding the arguments */
-
- va_start(VarArg, KwdCod);
-
- if(kwd->typ != SolKwd)
- {
- if(msh->ver == 1)
- {
- if(msh->typ & Asc)
- {
- for(i=0;i<kwd->SolSiz;i++)
- if(kwd->fmt[i] == 'r')
- fscanf(msh->hdl, "%f", va_arg(VarArg, float *));
- else
- fscanf(msh->hdl, "%d", va_arg(VarArg, int *));
- }
- else
- {
- ScaBlk(msh, msh->buf, kwd->SolSiz);
-
- for(i=0;i<kwd->SolSiz;i++)
- if(kwd->fmt[i] == 'r')
- *(va_arg(VarArg, float *)) = msh->FltBuf[i];
- else
- *(va_arg(VarArg, int *)) = msh->IntBuf[i];
- }
- }
- else
- {
- if(msh->typ & Asc)
- {
- for(i=0;i<kwd->SolSiz;i++)
- if(kwd->fmt[i] == 'r')
- fscanf(msh->hdl, "%lf", va_arg(VarArg, double *));
- else
- fscanf(msh->hdl, "%d", va_arg(VarArg, int *));
- }
- else
- for(i=0;i<kwd->SolSiz;i++)
- if(kwd->fmt[i] == 'r')
- ScaDblWrd(msh, (unsigned char *)va_arg(VarArg, double *));
- else
- ScaWrd(msh, (unsigned char *)va_arg(VarArg, int *));
- }
- }
- else
- {
- if(msh->ver == 1)
- {
- FltSolTab = va_arg(VarArg, float *);
-
- if(msh->typ & Asc)
- for(j=0;j<kwd->SolSiz;j++)
- fscanf(msh->hdl, "%f", &FltSolTab[j]);
- else
- ScaBlk(msh, (unsigned char *)FltSolTab, kwd->NmbWrd);
- }
- else
- {
- DblSolTab = va_arg(VarArg, double *);
-
- if(msh->typ & Asc)
- for(j=0;j<kwd->SolSiz;j++)
- fscanf(msh->hdl, "%lf", &DblSolTab[j]);
- else
- for(j=0;j<kwd->SolSiz;j++)
- ScaDblWrd(msh, (unsigned char *)&DblSolTab[j]);
- }
- }
-
- va_end(VarArg);
-}
-
-
-/*----------------------------------------------------------*/
-/* Write a full line from the current kwd */
-/*----------------------------------------------------------*/
-
-void GmfSetLin(int MshIdx, int KwdCod, ...)
-{
- int i, j, pos, *IntBuf;
- float *FltSolTab;
- double *DblSolTab, *DblBuf;
- va_list VarArg;
- GmfMshSct *msh = GmfMshTab[ MshIdx ];
- KwdSct *kwd = &msh->KwdTab[ KwdCod ];
-
- /* Start decoding the arguments */
-
- va_start(VarArg, KwdCod);
-
- if(kwd->typ != SolKwd)
- {
- if(msh->ver == 1)
- {
- if(msh->typ & Asc)
- {
- for(i=0;i<kwd->SolSiz;i++)
- if(kwd->fmt[i] == 'r')
- fprintf(msh->hdl, "%g ", (float)va_arg(VarArg, double));
- else
- fprintf(msh->hdl, "%d ", va_arg(VarArg, int));
- }
- else
- {
- for(i=0;i<kwd->SolSiz;i++)
- if(kwd->fmt[i] == 'r')
- msh->FltBuf[i] = va_arg(VarArg, double);
- else
- msh->IntBuf[i] = va_arg(VarArg, int);
-
- RecBlk(msh, msh->buf, kwd->SolSiz);
- }
- }
- else
- {
- if(msh->typ & Asc)
- {
- for(i=0;i<kwd->SolSiz;i++)
- if(kwd->fmt[i] == 'r')
- fprintf(msh->hdl, "%.15lg ", va_arg(VarArg, double));
- else
- fprintf(msh->hdl, "%d ", va_arg(VarArg, int));
- }
- else
- {
- pos = 0;
-
- for(i=0;i<kwd->SolSiz;i++)
- if(kwd->fmt[i] == 'r')
- {
- DblBuf = (void *)&msh->buf[ pos ];
- *DblBuf = va_arg(VarArg, double);
- pos += 8;
- }
- else
- {
- IntBuf = (void *)&msh->buf[ pos ];
- *IntBuf = va_arg(VarArg, int);
- pos += 4;
- }
- RecBlk(msh, msh->buf, kwd->NmbWrd);
- }
- }
- }
- else
- {
- if(msh->ver == 1)
- {
- FltSolTab = va_arg(VarArg, float *);
-
- if(msh->typ & Asc)
- for(j=0;j<kwd->SolSiz;j++)
- fprintf(msh->hdl, "%g ", FltSolTab[j]);
- else
- RecBlk(msh, (unsigned char *)FltSolTab, kwd->NmbWrd);
- }
- else
- {
- DblSolTab = va_arg(VarArg, double *);
-
- if(msh->typ & Asc)
- for(j=0;j<kwd->SolSiz;j++)
- fprintf(msh->hdl, "%.15lg ", DblSolTab[j]);
- else
- RecBlk(msh, (unsigned char *)DblSolTab, kwd->NmbWrd);
- }
- }
-
- va_end(VarArg);
-
- if(msh->typ & Asc)
- fprintf(msh->hdl, "\n");
-}
-
-
-/*----------------------------------------------------------*/
-/* Private procedure for transmesh : copy a whole line */
-/*----------------------------------------------------------*/
-
-void GmfCpyLin(int InpIdx, int OutIdx, int KwdCod)
-{
- double d;
- float f;
- int i, a;
- GmfMshSct *InpMsh = GmfMshTab[ InpIdx ], *OutMsh = GmfMshTab[ OutIdx ];
- KwdSct *kwd = &InpMsh->KwdTab[ KwdCod ];
-
- for(i=0;i<kwd->SolSiz;i++)
- {
- if(kwd->fmt[i] == 'r')
- {
- if(InpMsh->ver == 1)
- {
- if(InpMsh->typ & Asc)
- fscanf(InpMsh->hdl, "%f", &f);
- else
- ScaWrd(InpMsh, (unsigned char *)&f);
-
- d = f;
- }
- else
- {
- if(InpMsh->typ & Asc)
- fscanf(InpMsh->hdl, "%lf", &d);
- else
- ScaDblWrd(InpMsh, (unsigned char *)&d);
-
- f = (float)d;
- }
-
- if(OutMsh->ver == 1)
- if(OutMsh->typ & Asc)
- fprintf(OutMsh->hdl, "%g ", f);
- else
- RecWrd(OutMsh, (unsigned char *)&f);
- else
- if(OutMsh->typ & Asc)
- fprintf(OutMsh->hdl, "%.15g ", d);
- else
- RecDblWrd(OutMsh, (unsigned char *)&d);
- }
- else
- {
- if(InpMsh->typ & Asc)
- fscanf(InpMsh->hdl, "%d", &a);
- else
- ScaWrd(InpMsh, (unsigned char *)&a);
-
- if(OutMsh->typ & Asc)
- fprintf(OutMsh->hdl, "%d ", a);
- else
- RecWrd(OutMsh, (unsigned char *)&a);
- }
- }
-
- if(OutMsh->typ & Asc)
- fprintf(OutMsh->hdl, "\n");
-}
-
-
-/*----------------------------------------------------------*/
-/* Find every kw present in a meshfile */
-/*----------------------------------------------------------*/
-
-static int ScaKwdTab(GmfMshSct *msh)
-{
- int KwdCod;
- long NexPos, CurPos, EndPos;
- char str[ GmfStrSiz ];
-
- if(msh->typ & Asc)
- {
- /* Scan each string in the file until the end */
-
- while(fscanf(msh->hdl, "%s", str) != EOF)
- {
- /* Fast test in order to reject quickly the numeric values */
-
- if(isalpha(str[0]))
- {
- /* Search which kwd code this string is associated with,
- then get its header and save the curent position in file (just before the data) */
-
- for(KwdCod=1; KwdCod<= GmfMaxKwd; KwdCod++)
- if(!strcmp(str, GmfKwdFmt[ KwdCod ][0]))
- {
- ScaKwdHdr(msh, KwdCod);
- break;
- }
- }
- else if(str[0] == '#')
- while(fgetc(msh->hdl) != '\n');
- }
- }
- else
- {
- /* Get file size */
-
- CurPos = ftell(msh->hdl);
- fseek(msh->hdl, 0, SEEK_END);
- EndPos = ftell(msh->hdl);
- fseek(msh->hdl, CurPos, SEEK_SET);
-
- /* Jump through kwd positions in the file */
-
- do
- {
- /* Get the kwd code and the next kwd position */
-
- ScaWrd(msh, (unsigned char *)&KwdCod);
- NexPos = GetPos(msh);
-
- if(NexPos > EndPos)
- return(0);
-
- /* Check if this kwd belongs to this mesh version */
-
- if( (KwdCod >= 1) && (KwdCod <= GmfMaxKwd) )
- ScaKwdHdr(msh, KwdCod);
-
- /* Go to the next kwd */
-
- if(NexPos)
- fseek(msh->hdl, NexPos, SEEK_SET);
- }while(NexPos && (KwdCod != GmfEnd));
- }
-
- return(1);
-}
-
-
-/*----------------------------------------------------------*/
-/* Read and setup the keyword's header */
-/*----------------------------------------------------------*/
-
-static void ScaKwdHdr(GmfMshSct *msh, int KwdCod)
-{
- int i;
- KwdSct *kwd = &msh->KwdTab[ KwdCod ];
-
- if(!strcmp("i", GmfKwdFmt[ KwdCod ][2]))
- {
- if(msh->typ & Asc)
- fscanf(msh->hdl, "%d", &kwd->NmbLin);
- else
- ScaWrd(msh, (unsigned char *)&kwd->NmbLin);
- }
- else
- kwd->NmbLin = 1;
-
- if(!strcmp("sr", GmfKwdFmt[ KwdCod ][3]))
- {
- if(msh->typ & Asc)
- {
- fscanf(msh->hdl, "%d", &kwd->NmbTyp);
-
- for(i=0;i<kwd->NmbTyp;i++)
- fscanf(msh->hdl, "%d", &kwd->TypTab[i]);
- }
- else
- {
- ScaWrd(msh, (unsigned char *)&kwd->NmbTyp);
-
- for(i=0;i<kwd->NmbTyp;i++)
- ScaWrd(msh, (unsigned char *)&kwd->TypTab[i]);
- }
- }
-
- ExpFmt(msh, KwdCod);
- kwd->pos = ftell(msh->hdl);
-}
-
-
-/*----------------------------------------------------------*/
-/* Expand the compacted format and compute the line size */
-/*----------------------------------------------------------*/
-
-static void ExpFmt(GmfMshSct *msh, int KwdCod)
-{
- int i, j, TmpSiz=0;
- char chr, *InpFmt = GmfKwdFmt[ KwdCod ][3];
- KwdSct *kwd = &msh->KwdTab[ KwdCod ];
-
- /* Set the kwd's type */
-
- if(!strlen(GmfKwdFmt[ KwdCod ][2]))
- kwd->typ = InfKwd;
- else if(!strcmp(InpFmt, "sr"))
- kwd->typ = SolKwd;
- else
- kwd->typ = RegKwd;
-
- /* Get the solution-field's size */
-
- if(kwd->typ == SolKwd)
- for(i=0;i<kwd->NmbTyp;i++)
- switch(kwd->TypTab[i])
- {
- case GmfSca : TmpSiz += 1; break;
- case GmfVec : TmpSiz += msh->dim; break;
- case GmfSymMat : TmpSiz += (msh->dim * (msh->dim+1)) / 2; break;
- case GmfMat : TmpSiz += msh->dim * msh->dim; break;
- }
-
- /* Scan each character from the format string */
-
- i = kwd->SolSiz = kwd->NmbWrd = 0;
-
- while(i < strlen(InpFmt))
- {
- chr = InpFmt[ i++ ];
-
- if(chr == 'd')
- {
- chr = InpFmt[i++];
-
- for(j=0;j<msh->dim;j++)
- kwd->fmt[ kwd->SolSiz++ ] = chr;
- }
- else if(chr == 's')
- {
- chr = InpFmt[i++];
-
- for(j=0;j<TmpSiz;j++)
- kwd->fmt[ kwd->SolSiz++ ] = chr;
- }
- else
- kwd->fmt[ kwd->SolSiz++ ] = chr;
- }
-
- for(i=0;i<kwd->SolSiz;i++)
- if(kwd->fmt[i] == 'i')
- kwd->NmbWrd++;
- else if(msh->ver >= 2)
- kwd->NmbWrd += 2;
- else
- kwd->NmbWrd++;
-}
-
-
-/*----------------------------------------------------------*/
-/* Read a four bytes word from a mesh file */
-/*----------------------------------------------------------*/
-
-static void ScaWrd(GmfMshSct *msh, unsigned char *wrd)
-{
- unsigned char swp;
-
- fread(wrd, WrdSiz, 1, msh->hdl);
-
- if(msh->cod == 1)
- return;
-
- swp = wrd[3];
- wrd[3] = wrd[0];
- wrd[0] = swp;
-
- swp = wrd[2];
- wrd[2] = wrd[1];
- wrd[1] = swp;
-}
-
-
-/*----------------------------------------------------------*/
-/* Read an eight bytes word from a mesh file */
-/*----------------------------------------------------------*/
-
-static void ScaDblWrd(GmfMshSct *msh, unsigned char *wrd)
-{
- int i;
- unsigned char swp;
-
- fread(wrd, WrdSiz, 2, msh->hdl);
-
- if(msh->cod == 1)
- return;
-
- for(i=0;i<4;i++)
- {
- swp = wrd[7-i];
- wrd[7-i] = wrd[i];
- wrd[i] = swp;
- }
-}
-
-
-/*----------------------------------------------------------*/
-/* Read ablock of four bytes word from a mesh file */
-/*----------------------------------------------------------*/
-
-static void ScaBlk(GmfMshSct *msh, unsigned char *blk, int siz)
-{
- int i, j;
- unsigned char swp, *wrd;
-
- fread(blk, WrdSiz, siz, msh->hdl);
-
- if(msh->cod == 1)
- return;
-
- for(i=0;i<siz;i++)
- {
- wrd = &blk[ i * 4 ];
-
- for(j=0;j<2;j++)
- {
- swp = wrd[ 3-j ];
- wrd[ 3-j ] = wrd[j];
- wrd[j] = swp;
- }
- }
-}
-
-
-/*----------------------------------------------------------*/
-/* Read a 4 or 8 bytes position in mesh file */
-/*----------------------------------------------------------*/
-
-static long GetPos(GmfMshSct *msh)
-{
- int IntVal;
- long pos;
-
- if(msh->ver >= 3)
- ScaDblWrd(msh, (unsigned char*)&pos);
- else
- {
- ScaWrd(msh, (unsigned char*)&IntVal);
- pos = IntVal;
- }
-
- return(pos);
-}
-
-
-/*----------------------------------------------------------*/
-/* Write a four bytes word to a mesh file */
-/*----------------------------------------------------------*/
-
-static void RecWrd(GmfMshSct *msh, unsigned char *wrd)
-{
- fwrite(wrd, WrdSiz, 1, msh->hdl);
-}
-
-
-/*----------------------------------------------------------*/
-/* Write an eight bytes word to a mesh file */
-/*----------------------------------------------------------*/
-
-static void RecDblWrd(GmfMshSct *msh, unsigned char *wrd)
-{
- fwrite(wrd, WrdSiz, 2, msh->hdl);
-}
-
-
-/*----------------------------------------------------------*/
-/* Write a block of four bytes word to a mesh file */
-/*----------------------------------------------------------*/
-
-static void RecBlk(GmfMshSct *msh, unsigned char *blk, int siz)
-{
- /* Copy this line-block into the main mesh buffer */
-
- if(siz)
- {
- memcpy(&msh->blk[ msh->pos ], blk, siz * WrdSiz);
- msh->pos += siz * WrdSiz;
- }
-
- /* When the buffer is full or this procedure is called with a 0 size, flush the cache on disk */
-
- if( (msh->pos > BufSiz) || (!siz && msh->pos) )
- {
- fwrite(msh->blk, 1, msh->pos, msh->hdl);
- msh->pos = 0;
- }
-}
-
-
-/*----------------------------------------------------------*/
-/* Read a 4 or 8 bytes position in mesh file */
-/*----------------------------------------------------------*/
-
-static void SetPos(GmfMshSct *msh, long pos)
-{
- int IntVal;
-
- if(msh->ver >= 3)
- RecDblWrd(msh, (unsigned char*)&pos);
- else
- {
- IntVal = pos;
- RecWrd(msh, (unsigned char*)&IntVal);
- }
-}
+++ /dev/null
-
-
-/*----------------------------------------------------------*/
-/* */
-/* LIBMESH V 5.45 */
-/* */
-/*----------------------------------------------------------*/
-/* */
-/* Description: handle .meshb file format I/O */
-/* Author: Loic MARECHAL */
-/* Creation date: feb 16 2007 */
-/* Last modification: sep 27 2010 */
-/* */
-/*----------------------------------------------------------*/
-
-
-/*----------------------------------------------------------*/
-/* Defines */
-/*----------------------------------------------------------*/
-
-#define GmfStrSiz 1024
-#define GmfMaxTyp 1000
-#define GmfMaxKwd 79
-#define GmfMshVer 1
-#define GmfRead 1
-#define GmfWrite 2
-#define GmfSca 1
-#define GmfVec 2
-#define GmfSymMat 3
-#define GmfMat 4
-#define GmfFloat 1
-#define GmfDouble 2
-
-enum GmfKwdCod
-{
- GmfReserved1, \
- GmfVersionFormatted, \
- GmfReserved2, \
- GmfDimension, \
- GmfVertices, \
- GmfEdges, \
- GmfTriangles, \
- GmfQuadrilaterals, \
- GmfTetrahedra, \
- GmfPrisms, \
- GmfHexahedra, \
- GmfIterationsAll, \
- GmfTimesAll, \
- GmfCorners, \
- GmfRidges, \
- GmfRequiredVertices, \
- GmfRequiredEdges, \
- GmfRequiredTriangles, \
- GmfRequiredQuadrilaterals, \
- GmfTangentAtEdgeVertices, \
- GmfNormalAtVertices, \
- GmfNormalAtTriangleVertices, \
- GmfNormalAtQuadrilateralVertices, \
- GmfAngleOfCornerBound, \
- GmfTrianglesP2, \
- GmfEdgesP2, \
- GmfSolAtPyramids, \
- GmfQuadrilateralsQ2, \
- GmfISolAtPyramids, \
- GmfReserved6, \
- GmfTetrahedraP2, \
- GmfReserved7, \
- GmfReserved8, \
- GmfHexahedraQ2, \
- GmfReserved9, \
- GmfReserved10, \
- GmfReserved17, \
- GmfReserved18, \
- GmfReserved19, \
- GmfReserved20, \
- GmfReserved21, \
- GmfReserved22, \
- GmfReserved23, \
- GmfReserved24, \
- GmfReserved25, \
- GmfReserved26, \
- GmfPolyhedra, \
- GmfPolygons, \
- GmfReserved29, \
- GmfPyramids, \
- GmfBoundingBox, \
- GmfBody, \
- GmfPrivateTable, \
- GmfReserved33, \
- GmfEnd, \
- GmfReserved34, \
- GmfReserved35, \
- GmfReserved36, \
- GmfReserved37, \
- GmfTangents, \
- GmfNormals, \
- GmfTangentAtVertices, \
- GmfSolAtVertices, \
- GmfSolAtEdges, \
- GmfSolAtTriangles, \
- GmfSolAtQuadrilaterals, \
- GmfSolAtTetrahedra, \
- GmfSolAtPrisms, \
- GmfSolAtHexahedra, \
- GmfDSolAtVertices, \
- GmfISolAtVertices, \
- GmfISolAtEdges, \
- GmfISolAtTriangles, \
- GmfISolAtQuadrilaterals, \
- GmfISolAtTetrahedra, \
- GmfISolAtPrisms, \
- GmfISolAtHexahedra, \
- GmfIterations, \
- GmfTime, \
- GmfReserved38
-};
-
-
-/*----------------------------------------------------------*/
-/* External procedures */
-/*----------------------------------------------------------*/
-
-extern int GmfOpenMesh(const char *, int, ...);
-extern int GmfCloseMesh(int);
-extern int GmfStatKwd(int, int, ...);
-extern int GmfGotoKwd(int, int);
-extern int GmfSetKwd(int, int, ...);
-extern void GmfGetLin(int, int, ...);
-extern void GmfSetLin(int, int, ...);
-
-
-/*----------------------------------------------------------*/
-/* Fortran 77 API */
-/*----------------------------------------------------------*/
-
-#if defined(F77_NO_UNDER_SCORE)
-#define call(x) x
-#else
-#define call(x) x ## _
-#endif
-
-
-/*----------------------------------------------------------*/
-/* Transmesh private API */
-/*----------------------------------------------------------*/
-
-#ifdef TRANSMESH
-
-extern char *GmfKwdFmt[ GmfMaxKwd + 1 ][4];
-extern int GmfCpyLin(int, int, int);
-
-#endif
ENF_MESH_NAME_COLUMN = 0,
ENF_MESH_ENTRY_COLUMN,
ENF_MESH_CONSTRAINT_COLUMN,
- ENF_MESH_SIZE_COLUMN,
ENF_MESH_GROUP_COLUMN,
ENF_MESH_NB_COLUMNS
};
// Enforced vertices widget inputs
enum {
ENF_VER_WARNING = 0,
- ENF_VER_VERTEX /*= 0*/,
+ ENF_VER_VERTEX,// = 0,
ENF_VER_X_COORD,
ENF_VER_Y_COORD,
ENF_VER_Z_COORD,
ENF_MESH_WARNING = 0,
ENF_MESH_MESH /*= 0*/,
ENF_MESH_CONSTRAINT,
- ENF_MESH_SIZE,
ENF_MESH_GROUP,
ENF_MESH_BTN,
ENF_MESH_NB_LINES
QWidget *EnforcedMeshTableWidgetDelegate::createEditor(QWidget *parent,
const QStyleOptionViewItem & option ,
const QModelIndex & index ) const
-{
- if (index.column() == ENF_MESH_SIZE_COLUMN) {
- SMESHGUI_SpinBox *editor = new SMESHGUI_SpinBox(parent);
- editor->RangeStepAndValidator(0, COORD_MAX, 10.0, "length_precision");
- return editor;
- }
+{
return QItemDelegate::createEditor(parent, option, index);
}
void EnforcedMeshTableWidgetDelegate::setEditorData(QWidget *editor,
const QModelIndex &index) const
{
- if (index.column() == ENF_MESH_SIZE_COLUMN) {
- SMESHGUI_SpinBox *spinBox = qobject_cast<SMESHGUI_SpinBox*>(editor);
- spinBox->SetValue(index.data().toDouble());
- }
- else
- QItemDelegate::setEditorData(editor, index);
+ QItemDelegate::setEditorData(editor, index);
}
void EnforcedMeshTableWidgetDelegate::setModelData(QWidget *editor, QAbstractItemModel *model,
const QModelIndex &index) const
{
- if (index.column() == ENF_MESH_SIZE_COLUMN)
- {
- SMESHGUI_SpinBox *spinBox = qobject_cast<SMESHGUI_SpinBox*>(editor);
- const double newsize = spinBox->GetValue();
- if (newsize > 0)
- model->setData(index, newsize, Qt::EditRole);
- }
- else
- QItemDelegate::setModelData(editor, model, index);
+ QItemDelegate::setModelData(editor, model, index);
}
myBoundaryRecoveryCheck = new QCheckBox( tr( "RECOVERY_VERSION" ), myAdvGroup );
myFEMCorrectionCheck = new QCheckBox( tr( "FEM_CORRECTION" ), myAdvGroup );
+
+ QLabel* myGradationLabel = new QLabel( tr( "GHS3D_GRADATION" ), myAdvGroup );
+ myGradation = new SMESHGUI_SpinBox(myAdvGroup);
+ myGradation->RangeStepAndValidator(1.05, 5.0, 0.05, "length_precision");
QLabel* aTextOptionLabel = new QLabel( tr( "TEXT_OPTION" ), myAdvGroup );
myTextOption = new QLineEdit( myAdvGroup );
- anAdvLayout->addWidget( myMaximumMemoryCheck, 0, 0, 1, 1 );
- anAdvLayout->addWidget( myMaximumMemorySpin, 0, 1, 1, 1 );
- anAdvLayout->addWidget( aMegabyteLabel, 0, 2, 1, 1 );
- anAdvLayout->addWidget( myInitialMemoryCheck, 1, 0, 1, 1 );
- anAdvLayout->addWidget( myInitialMemorySpin, 1, 1, 1, 1 );
- anAdvLayout->addWidget( aMegabyteLabel2, 1, 2, 1, 1 );
- anAdvLayout->addWidget( aWorkinDirLabel, 2, 0, 1, 1 );
- anAdvLayout->addWidget( myWorkingDir, 2, 1, 1, 2 );
- anAdvLayout->addWidget( dirBtn, 2, 3, 1, 1 );
- anAdvLayout->addWidget( myKeepFiles, 3, 0, 1, 4 );
- anAdvLayout->addWidget( aVerboseLevelLabel, 4, 0, 1, 1 );
- anAdvLayout->addWidget( myVerboseLevelSpin, 4, 1, 1, 1 );
- anAdvLayout->addWidget( myToCreateNewNodesCheck, 5, 0, 1, 4 );
- anAdvLayout->addWidget( myRemoveInitialCentralPointCheck, 6, 0, 1, 4 );
- anAdvLayout->addWidget( myBoundaryRecoveryCheck, 7, 0, 1, 4 );
- anAdvLayout->addWidget( myFEMCorrectionCheck, 8, 0, 1, 4 );
- anAdvLayout->addWidget( aTextOptionLabel, 9, 0, 1, 1 );
- anAdvLayout->addWidget( myTextOption, 9, 1, 1, 2 );
+ row = 0;
+ anAdvLayout->addWidget( myMaximumMemoryCheck, row, 0, 1, 1 );
+ anAdvLayout->addWidget( myMaximumMemorySpin, row, 1, 1, 1 );
+ anAdvLayout->addWidget( aMegabyteLabel, row++, 2, 1, 1 );
+ anAdvLayout->addWidget( myInitialMemoryCheck, row, 0, 1, 1 );
+ anAdvLayout->addWidget( myInitialMemorySpin, row, 1, 1, 1 );
+ anAdvLayout->addWidget( aMegabyteLabel2, row++, 2, 1, 1 );
+ anAdvLayout->addWidget( aWorkinDirLabel, row, 0, 1, 1 );
+ anAdvLayout->addWidget( myWorkingDir, row, 1, 1, 2 );
+ anAdvLayout->addWidget( dirBtn, row++, 3, 1, 1 );
+ anAdvLayout->addWidget( myKeepFiles, row++, 0, 1, 4 );
+ anAdvLayout->addWidget( aVerboseLevelLabel, row, 0, 1, 1 );
+ anAdvLayout->addWidget( myVerboseLevelSpin, row++, 1, 1, 2 );
+ anAdvLayout->addWidget( myToCreateNewNodesCheck, row++, 0, 1, 4 );
+ anAdvLayout->addWidget( myRemoveInitialCentralPointCheck, row++, 0, 1, 4 );
+ anAdvLayout->addWidget( myBoundaryRecoveryCheck, row++, 0, 1, 4 );
+ anAdvLayout->addWidget( myFEMCorrectionCheck, row++, 0, 1, 4 );
+ anAdvLayout->addWidget( myGradationLabel, row, 0, 1, 1 );
+ anAdvLayout->addWidget( myGradation, row++, 1, 1, 2 );
+ anAdvLayout->addWidget( aTextOptionLabel, row, 0, 1, 1 );
+ anAdvLayout->addWidget( myTextOption, row++, 1, 1, 2 );
// Enforced vertices parameters
myEnfGroup = new QWidget();
myEnforcedTableWidget->setColumnCount( ENF_VER_NB_COLUMNS );
myEnforcedTableWidget->setSortingEnabled(true);
QStringList enforcedHeaders;
- enforcedHeaders << tr( "GHS3D_ENF_NAME_COLUMN" )
- << tr( "GHS3D_ENF_VER_X_COLUMN" )<< tr( "GHS3D_ENF_VER_Y_COLUMN" ) << tr( "GHS3D_ENF_VER_Z_COLUMN" )
+ enforcedHeaders << tr( "GHS3D_ENF_NAME_COLUMN" )
+ << tr( "GHS3D_ENF_VER_X_COLUMN" )<< tr( "GHS3D_ENF_VER_Y_COLUMN" ) << tr( "GHS3D_ENF_VER_Z_COLUMN" )
<< tr( "GHS3D_ENF_SIZE_COLUMN" ) << tr("GHS3D_ENF_ENTRY_COLUMN") << tr("GHS3D_ENF_VER_COMPOUND_COLUMN") << tr( "GHS3D_ENF_GROUP_COLUMN" );
-
+
myEnforcedTableWidget->setHorizontalHeaderLabels(enforcedHeaders);
myEnforcedTableWidget->verticalHeader()->hide();
myEnforcedTableWidget->horizontalHeader()->setStretchLastSection(true);
enforcedMeshHeaders << tr( "GHS3D_ENF_NAME_COLUMN" )
<< tr( "GHS3D_ENF_ENTRY_COLUMN" )
<< tr( "GHS3D_ENF_MESH_CONSTRAINT_COLUMN" )
- << tr( "GHS3D_ENF_SIZE_COLUMN" )
<< tr( "GHS3D_ENF_GROUP_COLUMN" );
myEnforcedMeshTableWidget->setHorizontalHeaderLabels(enforcedMeshHeaders);
myEnforcedMeshTableWidget->horizontalHeader()->setStretchLastSection(true);
myEnfMeshConstraint->insertItems(0,myEnfMeshConstraintLabels);
myEnfMeshConstraint->setEditable(false);
myEnfMeshConstraint->setCurrentIndex(0);
-
- QLabel* myMeshSizeLabel = new QLabel( tr( "GHS3D_ENF_SIZE_LABEL" ), myEnfMeshGroup );
- myMeshSizeValue = new SMESHGUI_SpinBox(myEnfMeshGroup);
- myMeshSizeValue->RangeStepAndValidator(0, COORD_MAX, 10.0, "length_precision");
QLabel* myMeshGroupNameLabel = new QLabel( tr( "GHS3D_ENF_GROUP_LABEL" ), myEnfMeshGroup );
myMeshGroupName = new QLineEdit(myEnfMeshGroup);
anEnfMeshLayout2->addWidget(myEnfMeshWdg, ENF_MESH_MESH, 0, 1, 2);
anEnfMeshLayout2->addWidget(myMeshConstraintLabel, ENF_MESH_CONSTRAINT, 0, 1, 1);
anEnfMeshLayout2->addWidget(myEnfMeshConstraint, ENF_MESH_CONSTRAINT, 1, 1, 1);
- anEnfMeshLayout2->addWidget(myMeshSizeLabel, ENF_MESH_SIZE, 0, 1, 1);
- anEnfMeshLayout2->addWidget(myMeshSizeValue, ENF_MESH_SIZE, 1, 1, 1);
anEnfMeshLayout2->addWidget(myMeshGroupNameLabel, ENF_MESH_GROUP, 0, 1, 1);
anEnfMeshLayout2->addWidget(myMeshGroupName, ENF_MESH_GROUP, 1, 1, 1);
anEnfMeshLayout2->addWidget(addEnfMeshButton, ENF_MESH_BTN, 0, 1, 1);
connect( removeEnfMeshButton, SIGNAL( clicked()), this, SLOT( onRemoveEnforcedMesh() ) );
// connect( myEnfMeshWdg, SIGNAL( contentModified()), this, SLOT( checkEnfMeshIsDefined() ) );
// connect( myEnfMeshConstraint, SIGNAL( currentIndexChanged(int) ), this, SLOT( checkEnfMeshIsDefined() ) );
-// connect( myMeshSizeValue, SIGNAL( textChanged(const QString&) ), this, SLOT( checkEnfMeshIsDefined() ) );
// connect( this, SIGNAL( enfMeshDefined(bool) ), addEnfMeshButton, SLOT( setEnabled(bool) ) );
return fr;
**/
void GHS3DPluginGUI_HypothesisCreator::checkEnfMeshIsDefined()
{
- emit enfMeshDefined((!myMeshSizeValue->GetString().isEmpty() && !myEnfVertexWdg->NbObjects() == 0));
+ emit enfMeshDefined( myEnfVertexWdg->NbObjects() != 0);
}
/**
/** GHS3DPluginGUI_HypothesisCreator::addEnforcedMesh( meshName, geomEntry, elemType, size, groupName)
This method adds in the tree widget an enforced mesh from mesh, submesh or group with optionally size and and groupName.
*/
-void GHS3DPluginGUI_HypothesisCreator::addEnforcedMesh(std::string name, std::string entry, int elementType, double size, std::string groupName)
+void GHS3DPluginGUI_HypothesisCreator::addEnforcedMesh(std::string name, std::string entry, int elementType, std::string groupName)
{
- MESSAGE("addEnforcedMesh(\"" << name << ", \"" << entry << "\", " << elementType << ", " << size << ", \"" << groupName << "\")");
+ MESSAGE("addEnforcedMesh(\"" << name << ", \"" << entry << "\", " << elementType << ", \"" << groupName << "\")");
bool okToCreate = true;
QString itemEntry = "";
int itemElementType = 0;
break;
if (itemEntry == QString(entry.c_str()) && itemElementType == elementType) {
-// // update size
-// if (itemSize != size) {
-// MESSAGE("Size is updated from \"" << itemSize << "\" to \"" << size << "\"");
-// myEnforcedMeshTableWidget->item(row, ENF_MESH_SIZE_COLUMN)->setData( Qt::EditRole, QVariant(size));
-// }
// // update group name
// if (itemGroupName.toStdString() != groupName) {
// MESSAGE("Group is updated from \"" << itemGroupName.toStdString() << "\" to \"" << groupName << "\"");
MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
myEnforcedMeshTableWidget->setItem(rowCount,col,item);
break;
- case ENF_MESH_SIZE_COLUMN:
- item->setData( 0, size );
- MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
- myEnforcedMeshTableWidget->setItem(rowCount,col,item);
- break;
case ENF_MESH_GROUP_COLUMN:
item->setData( 0, groupName.c_str() );
MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
groupName = "";
- double size = -1;
- if (!myMeshSizeValue->GetString().isEmpty())
- size = myMeshSizeValue->GetValue();
-// if (size < 0)
-// return;
-
int elementType = myEnfMeshConstraint->currentIndex();
CORBA::Object_var anObj = SMESH::SObjectToObject(aSObj,aStudy);
if (!CORBA::is_nil(anObj)) {
// SMESH::SMESH_IDSource_var theSource = SMESH::SObjectToInterface<SMESH::SMESH_IDSource>( aSObj );
- addEnforcedMesh( aSObj->GetName(), aSObj->GetID(), elementType, size, groupName);
+ addEnforcedMesh( aSObj->GetName(), aSObj->GetID(), elementType, groupName);
}
}
else
CORBA::Object_var anObj = SMESH::SObjectToObject(aSObj,aStudy);
if (!CORBA::is_nil(anObj)) {
// SMESH::SMESH_IDSource_var theSource = SMESH::SObjectToInterface<SMESH::SMESH_IDSource>( aSObj );
- addEnforcedMesh( aSObj->GetName(), aSObj->GetID(), elementType, size, groupName);
+ addEnforcedMesh( aSObj->GetName(), aSObj->GetID(), elementType, groupName);
}
}
}
myRemoveInitialCentralPointCheck ->setChecked ( data.myRemoveInitialCentralPoint );
myBoundaryRecoveryCheck ->setChecked ( data.myBoundaryRecovery );
myFEMCorrectionCheck ->setChecked ( data.myFEMCorrection );
+ myGradation ->setValue ( data.myGradation );
myTextOption ->setText ( data.myTextOption );
TEnfVertexList::const_iterator it;
int rowCount = 0;
+ myEnforcedTableWidget->clearContents();
myEnforcedTableWidget->setSortingEnabled(false);
myEnforcedTableWidget->disconnect(SIGNAL( itemChanged(QTableWidgetItem *)));
for(it = data.myEnforcedVertices.begin() ; it != data.myEnforcedVertices.end(); it++ )
// Update Enforced meshes QTableWidget
TEnfMeshList::const_iterator itMesh;
rowCount = 0;
+ myEnforcedMeshTableWidget->clearContents();
myEnforcedMeshTableWidget->setSortingEnabled(false);
// myEnforcedMeshTableWidget->disconnect(SIGNAL( itemChanged(QTableWidgetItem *)));
for(itMesh = data.myEnforcedMeshes.begin() ; itMesh != data.myEnforcedMeshes.end(); itMesh++ )
MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
myEnforcedMeshTableWidget->setItem(rowCount,col,item);
break;
- case ENF_MESH_SIZE_COLUMN:
- item->setData( 0, enfMesh->size );
- MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
- myEnforcedMeshTableWidget->setItem(rowCount,col,item);
- break;
case ENF_MESH_GROUP_COLUMN:
item->setData( 0, enfMesh->groupName.c_str() );
MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
if ( data.myFEMCorrection )
valStr += " -FEM";
+ if ( data.myGradation != 1.05 ) {
+ valStr += " -Dcpropa=";
+ valStr += QString::number( data.myGradation );
+ }
+
valStr += " ";
valStr += data.myTextOption;
h_data.myRemoveInitialCentralPoint = h->GetToRemoveCentralPoint();
h_data.myBoundaryRecovery = h->GetToUseBoundaryRecoveryVersion();
h_data.myFEMCorrection = h->GetFEMCorrection();
+ h_data.myGradation = h->GetGradation();
h_data.myTextOption = h->GetTextOption();
GHS3DPlugin::GHS3DEnforcedVertexList_var vertices = h->GetEnforcedVertices();
myEnfMesh->name = CORBA::string_dup(enfMeshes[i].name.in());
myEnfMesh->entry = CORBA::string_dup(enfMeshes[i].entry.in());
myEnfMesh->groupName = CORBA::string_dup(enfMeshes[i].groupName.in());
- myEnfMesh->size = enfMeshes[i].size;
switch (enfMeshes[i].elementType) {
case SMESH::NODE:
myEnfMesh->elementType = 0;
h->SetToUseBoundaryRecoveryVersion( h_data.myBoundaryRecovery );
if ( h->GetFEMCorrection() != h_data.myFEMCorrection )
h->SetFEMCorrection( h_data.myFEMCorrection );
+ if ( h->GetGradation() != h_data.myGradation )
+ h->SetGradation ( h_data.myGradation );
if ( h->GetTextOption() != h_data.myTextOption )
h->SetTextOption ( h_data.myTextOption.toLatin1().constData() );
h->ClearEnforcedMeshes();
TEnfMeshList::const_iterator itEnfMesh;
+
_PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
+
for(itEnfMesh = h_data.myEnforcedMeshes.begin() ; itEnfMesh != h_data.myEnforcedMeshes.end(); itEnfMesh++ ) {
TEnfMesh* enfMesh = (*itEnfMesh);
-
+
_PTR(SObject) aSObj = aStudy->FindObjectID(enfMesh->entry.c_str());
SMESH::SMESH_IDSource_var theSource = SMESH::SObjectToInterface<SMESH::SMESH_IDSource>( aSObj );
- SMESH::ElementType elementType;
+
MESSAGE("enfMesh->elementType: " << enfMesh->elementType);
+ SMESH::ElementType elementType;
switch(enfMesh->elementType) {
case 0:
elementType = SMESH::NODE;
break;
}
- ok = h->p_SetEnforcedMesh(theSource, elementType, enfMesh->size, enfMesh->groupName.c_str());
+ std::cout << "h->p_SetEnforcedMesh(theSource, "<< elementType <<", \""<< enfMesh->name << "\", \"" << enfMesh->groupName.c_str() <<"\")"<<std::endl;
+ ok = h->p_SetEnforcedMesh(theSource, elementType, enfMesh->name.c_str(), enfMesh->groupName.c_str());
} // for
} // try
// catch(const std::exception& ex) {
h_data.myRemoveInitialCentralPoint = myRemoveInitialCentralPointCheck->isChecked();
h_data.myBoundaryRecovery = myBoundaryRecoveryCheck->isChecked();
h_data.myFEMCorrection = myFEMCorrectionCheck->isChecked();
+ h_data.myGradation = myGradation->value();
h_data.myTextOption = myTextOption->text();
// Enforced vertices
MESSAGE("Entry is \"" << myEnfMesh->entry << "\"" );
myEnfMesh->groupName = myEnforcedMeshTableWidget->item(row,ENF_MESH_GROUP_COLUMN)->data(Qt::EditRole).toString().toStdString();
MESSAGE("Group name is \"" << myEnfMesh->groupName << "\"" );
- myEnfMesh->size = myEnforcedMeshTableWidget->item(row,ENF_MESH_SIZE_COLUMN)->data(Qt::EditRole).toDouble();
- MESSAGE("Size is " << myEnfMesh->size);
QComboBox* combo = qobject_cast<QComboBox*>(myEnforcedMeshTableWidget->cellWidget(row,ENF_MESH_CONSTRAINT_COLUMN));
myEnfMesh->elementType = combo->currentIndex();
MESSAGE("Element type: " << myEnfMesh->elementType);
h_data.myEnforcedMeshes.insert(myEnfMesh);
+ std::cout << "h_data.myEnforcedMeshes.size(): " << h_data.myEnforcedMeshes.size() << std::endl;
}
return true;
std::string entry;
int elementType;
std::string groupName;
- double size;
};
struct CompareEnfMeshes
bool myToMeshHoles,myKeepFiles,myToCreateNewNodes,myBoundaryRecovery,myFEMCorrection,myRemoveInitialCentralPoint;
int myMaximumMemory,myInitialMemory,myOptimizationLevel;
QString myName,myWorkingDir,myTextOption;
+ double myGradation;
short myVerboseLevel;
TEnfVertexList myEnforcedVertices;
TEnfMeshList myEnforcedMeshes;
void checkVertexIsDefined();
void clearEnfVertexSelection();
- void addEnforcedMesh(std::string name, std::string entry, int elementType, double size = 0, std::string groupName = "");
+ void addEnforcedMesh(std::string name, std::string entry, int elementType, std::string groupName = "");
void onAddEnforcedMesh();
void onRemoveEnforcedMesh();
//void synchronizeEnforcedMesh();
QCheckBox* myRemoveInitialCentralPointCheck;
QCheckBox* myBoundaryRecoveryCheck;
QCheckBox* myFEMCorrectionCheck;
+ SMESHGUI_SpinBox* myGradation;
QLineEdit* myTextOption;
QWidget* myEnfGroup;
QStringList myEnfMeshConstraintLabels;
// SMESH::mesh_array_var myEnfMeshArray;
QTableWidget* myEnforcedMeshTableWidget;
- SMESHGUI_SpinBox* myMeshSizeValue;
QLineEdit* myMeshGroupName;
QPushButton* addEnfMeshButton;
QPushButton* removeEnfMeshButton;
<source>FEM_CORRECTION</source>
<translation>To use FEM correction</translation>
</message>
+ <message>
+ <source>GHS3D_GRADATION</source>
+ <translation>Volumic gradation</translation>
+ </message>
<message>
<source>SELECT_DIR</source>
<translation>...</translation>
<source>FEM_CORRECTION</source>
<translation>Utiliser correction FEM</translation>
</message>
+ <message>
+ <source>GHS3D_GRADATION</source>
+ <translation>Gradation volumique</translation>
+ </message>
<message>
<source>SELECT_DIR</source>
<translation>...</translation>