From: vsr Date: Mon, 8 Oct 2012 13:10:21 +0000 (+0000) Subject: Merge from V6_main (04/10/2012) X-Git-Tag: V7_0_0 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=49fb797789d9300b06ac40ba8bd7f91b0e5c61e4;p=plugins%2Fghs3dplugin.git Merge from V6_main (04/10/2012) --- diff --git a/doc/salome/gui/GHS3DPLUGIN/Makefile.am b/doc/salome/gui/GHS3DPLUGIN/Makefile.am index dfe458e..8d25b01 100755 --- a/doc/salome/gui/GHS3DPLUGIN/Makefile.am +++ b/doc/salome/gui/GHS3DPLUGIN/Makefile.am @@ -23,16 +23,15 @@ EXTRA_DIST += images input static/footer.html static/doxygen.css 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 @@ -55,7 +54,7 @@ install-data-local: 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 diff --git a/doc/salome/gui/GHS3DPLUGIN/doxyfile_py.in b/doc/salome/gui/GHS3DPLUGIN/doxyfile_py.in index 47082b5..84c92fa 100755 --- a/doc/salome/gui/GHS3DPLUGIN/doxyfile_py.in +++ b/doc/salome/gui/GHS3DPLUGIN/doxyfile_py.in @@ -96,7 +96,9 @@ EXAMPLE_RECURSIVE = NO #--------------------------------------------------------------------------- #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 @@ -129,24 +131,24 @@ GENERATE_RTF = 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 @@ -156,4 +158,4 @@ DOT_CLEANUP = YES #External reference options #--------------------------------------------------------------------------- GENERATE_TAGFILE = ghs3dpluginpy_doc.tag -SEARCHENGINE = YES \ No newline at end of file +SEARCHENGINE = YES diff --git a/doc/salome/gui/GHS3DPLUGIN/images/ghs3d_enforced_meshes.png b/doc/salome/gui/GHS3DPLUGIN/images/ghs3d_enforced_meshes.png index 9ddc012..df87f77 100644 Binary files a/doc/salome/gui/GHS3DPLUGIN/images/ghs3d_enforced_meshes.png and b/doc/salome/gui/GHS3DPLUGIN/images/ghs3d_enforced_meshes.png differ diff --git a/doc/salome/gui/GHS3DPLUGIN/images/ghs3d_enforced_vertices.png b/doc/salome/gui/GHS3DPLUGIN/images/ghs3d_enforced_vertices.png index d3a4bbc..27768e4 100644 Binary files a/doc/salome/gui/GHS3DPLUGIN/images/ghs3d_enforced_vertices.png and b/doc/salome/gui/GHS3DPLUGIN/images/ghs3d_enforced_vertices.png differ diff --git a/doc/salome/gui/GHS3DPLUGIN/images/ghs3d_parameters_advanced.png b/doc/salome/gui/GHS3DPLUGIN/images/ghs3d_parameters_advanced.png index c254112..e99409e 100644 Binary files a/doc/salome/gui/GHS3DPLUGIN/images/ghs3d_parameters_advanced.png and b/doc/salome/gui/GHS3DPLUGIN/images/ghs3d_parameters_advanced.png differ diff --git a/doc/salome/gui/GHS3DPLUGIN/images/ghs3d_parameters_basic.png b/doc/salome/gui/GHS3DPLUGIN/images/ghs3d_parameters_basic.png index 9519c14..e272cef 100644 Binary files a/doc/salome/gui/GHS3DPLUGIN/images/ghs3d_parameters_basic.png and b/doc/salome/gui/GHS3DPLUGIN/images/ghs3d_parameters_basic.png differ diff --git a/doc/salome/gui/GHS3DPLUGIN/input/ghs3d_hypo.doc b/doc/salome/gui/GHS3DPLUGIN/input/ghs3d_hypo.doc index 4c4ce5f..9cececf 100644 --- a/doc/salome/gui/GHS3DPLUGIN/input/ghs3d_hypo.doc +++ b/doc/salome/gui/GHS3DPLUGIN/input/ghs3d_hypo.doc @@ -3,41 +3,38 @@ \page ghs3d_hypo_page GHS3D Parameters hypothesis \anchor ghs3d_top -\n GHS3D Parameters hypothesis works only with Tetrahedron (GHS3D) +GHS3D Parameters hypothesis works only with Tetrahedron (GHS3D) 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 - +to the solid. + +- Optimization level - 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" @@ -45,36 +42,38 @@ optimisation provides better mesh, but can be time-consuming. \image html ghs3d_parameters_advanced.png -
  • Maximum memory size - launches ghs3d software with +- Maximum memory size - 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.
  • +checked off, the software will be launched with 7O% of the total RAM space. -
  • Initial memory size - starts ghs3d software with +- Initial memory size - 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.
  • +software will be started with 100 Megabytes of working space. -
  • Working directory - allows defining the folder for input and output -files of ghs3d software, which are the files starting with "GHS3D_" prefix.
  • +- Working directory - allows defining the folder for input and output +files of ghs3d software, which are the files starting with "GHS3D_" prefix. -
  • Keep working files - allows checking input and output files +- Keep working files - allows checking input and output files of ghs3d software, while usually these files are removed after the -launch of the mesher.
  • +launch of the mesher. -
  • Verbose level - to choose verbosity level in the range from +- Verbose level - to choose verbosity level in the range from 0 to 10. -
  • - -
  • To create new nodes - if this option is checked off, ghs3d -tries to create tetrahedrons using only the nodes of the 2D mesh.
  • - -
  • To remove the initial central point 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. + +- To create new nodes - if this option is checked off, ghs3d +tries to create tetrahedrons using only the nodes of the 2D mesh. + +- To remove the initial central point 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 @@ -86,18 +85,18 @@ Use this option if the boundary regeneration has failed with the standard parame 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.
  • +Note: the boundary regeneration may fail with this option, in some rare cases. -
  • To use boundary recovery version - enables using a +- To use boundary recovery version - 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).
  • +positive volume). -
  • To use FEM correction - Applies finite-element correction by +- To use FEM correction - 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 @@ -106,24 +105,25 @@ and final overconstrained edges and facets. It also gives the facets 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.
  • +By default, the FEM correction is not used. -
  • Option as text - allows to input in the command line any text -for ghs3d, for example, advanced options.
  • +- Volumic gradation - 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. - +- Option as text - 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 - +- 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 @@ -132,49 +132,38 @@ define enforced vertices in the volume where the mesh will be detailed. A node will be created at the enforced vertex coordinates. An enforced vertex is defined by: - +- 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 - +- 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. - +- 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.
    See Also 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" - */ diff --git a/doc/salome/gui/GHS3DPLUGIN/input/ghs3dplugin_python_interface.doc b/doc/salome/gui/GHS3DPLUGIN/input/ghs3dplugin_python_interface.doc index 09825c1..220bd07 100644 --- a/doc/salome/gui/GHS3DPLUGIN/input/ghs3dplugin_python_interface.doc +++ b/doc/salome/gui/GHS3DPLUGIN/input/ghs3dplugin_python_interface.doc @@ -2,22 +2,19 @@ \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 -
      -
    1. \ref tui_ghs3d_basic "Construction of Mesh using Ghs3D algorithm"
    2. -
    3. \ref tui_ghs3d_enforced_vertices "Adding enforced vertices"
    4. -
    5. \ref tui_ghs3d_enforced_meshes "Adding enforced mesh"
    6. -
    +-# \ref tui_ghs3d_basic +-# \ref tui_ghs3d_enforced_vertices +-# \ref tui_ghs3d_enforced_meshes -\anchor tui_ghs3d_basic -

    Construction of Mesh using Ghs3D algorithm

    +\section tui_ghs3d_basic Construction of Mesh using Ghs3D algorithm \code import geompy @@ -42,12 +39,11 @@ ghs3dMesh.Compute() # 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 -

    Adding enforced vertices

    +\section tui_ghs3d_enforced_vertices Adding enforced vertices \code @@ -121,8 +117,7 @@ GHS3D_Parameters.ClearEnforcedVertices() \ref tui_ghs3d "Back to top" -\anchor tui_ghs3d_enforced_meshes -

    Adding enforced mesh

    +\section tui_ghs3d_enforced_meshes Adding enforced mesh \code diff --git a/doc/salome/gui/GHS3DPLUGIN/input/index.doc b/doc/salome/gui/GHS3DPLUGIN/input/index.doc index e39ba6d..354df11 100644 --- a/doc/salome/gui/GHS3DPLUGIN/input/index.doc +++ b/doc/salome/gui/GHS3DPLUGIN/input/index.doc @@ -2,17 +2,13 @@ \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: - - - To manage parameters of the GHS3DPLUGIN use \subpage ghs3d_hypo_page and \subpage additional_hypo_page Also all GHS3DPLUGIN functionalities are accessible via diff --git a/idl/GHS3DPlugin_Algorithm.idl b/idl/GHS3DPlugin_Algorithm.idl index 8af4f1e..6bb10d8 100644 --- a/idl/GHS3DPlugin_Algorithm.idl +++ b/idl/GHS3DPlugin_Algorithm.idl @@ -50,7 +50,6 @@ module GHS3DPlugin string entry; SMESH::ElementType elementType; string groupName; - double size; }; typedef sequence GHS3DEnforcedMeshList; @@ -142,6 +141,11 @@ module GHS3DPlugin */ void SetTextOption(in string option); string GetTextOption(); + /*! + * To define the volumic gradation + */ + void SetGradation(in double gradation); + double GetGradation(); /*! * To set an enforced vertex */ @@ -166,15 +170,18 @@ module GHS3DPlugin 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); }; }; diff --git a/resources/GHS3DPlugin.xml b/resources/GHS3DPlugin.xml index 2c1ece4..b0cebaa 100644 --- a/resources/GHS3DPlugin.xml +++ b/resources/GHS3DPlugin.xml @@ -33,8 +33,25 @@ + dim="3"> + + + SetEnforcedVertex, + SetEnforcedVertexNamed, + SetEnforcedVertexWithGroup, + SetEnforcedVertexNamedWithGroup, + SetEnforcedVertexGeom, + SetEnforcedVertexGeomWithGroup, + RemoveEnforcedVertex, + RemoveEnforcedVertexGeom, + SetEnforcedMeshWithGroup, + SetEnforcedMeshSize, + SetEnforcedMeshSizeWithGroup + + + + - #
  • 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. + 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 @@ -133,11 +178,14 @@ class GHS3D_Algorithm(Mesh_Algorithm): 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. @@ -149,6 +197,7 @@ class GHS3D_Algorithm(Mesh_Algorithm): return self.Parameters().SetEnforcedVertexGeom(theVertex, size) else: return self.Parameters().SetEnforcedVertexGeomWithGroup(theVertex, size, groupName) + pass ## To remove an enforced vertex. # @param x : x coordinate @@ -174,13 +223,19 @@ class GHS3D_Algorithm(Mesh_Algorithm): 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 diff --git a/src/GHS3DPlugin/GHS3DPlugin_GHS3D.cxx b/src/GHS3DPlugin/GHS3DPlugin_GHS3D.cxx index 6da9eec..68d805e 100644 --- a/src/GHS3DPlugin/GHS3DPlugin_GHS3D.cxx +++ b/src/GHS3DPlugin/GHS3DPlugin_GHS3D.cxx @@ -1001,11 +1001,13 @@ static int findShapeID(SMESH_Mesh& mesh, //purpose : Update or create groups in mesh //======================================================================= -static void addElemInMeshGroup(SMESH_Mesh* theMesh, - const SMDS_MeshElement* anElem, - std::string groupName, - std::set groupsToRemove) +static void addElemInMeshGroup(SMESH_Mesh* theMesh, + const SMDS_MeshElement* anElem, + std::string& groupName, + std::set& groupsToRemove) { + if ( !anElem ) return; // issue 0021776 + bool groupDone = false; SMESH_Mesh::GroupIteratorPtr grIt = theMesh->GetGroups(); while (grIt->more()) { @@ -1033,7 +1035,7 @@ static void addElemInMeshGroup(SMESH_Mesh* theMesh, 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")); } @@ -1331,6 +1333,7 @@ static bool readGMFFile(const char* theFile, // 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 @@ -1779,8 +1782,8 @@ static bool writeGMFFile(const char* theMesh 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; @@ -1821,13 +1824,14 @@ static bool writeGMFFile(const char* theMesh 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; @@ -2745,7 +2749,7 @@ static bool writePoints (ofstream & theFile, 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 @@ -2753,7 +2757,7 @@ static bool writePoints (ofstream & theFile, << x << space << y << space << z << space - << size << space + << -1 << space << dummyint << space; theFile << std::endl; theEnforcedNodeIdToGhs3dIdMap.insert( make_pair( nodeIt->first->GetID(), aGhs3dID )); diff --git a/src/GHS3DPlugin/GHS3DPlugin_GHS3D.hxx b/src/GHS3DPlugin/GHS3DPlugin_GHS3D.hxx index 7b9b02e..7be3a9f 100644 --- a/src/GHS3DPlugin/GHS3DPlugin_GHS3D.hxx +++ b/src/GHS3DPlugin/GHS3DPlugin_GHS3D.hxx @@ -26,7 +26,7 @@ #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" diff --git a/src/GHS3DPlugin/GHS3DPlugin_Hypothesis.cxx b/src/GHS3DPlugin/GHS3DPlugin_Hypothesis.cxx index 7aa5341..4deccaa 100644 --- a/src/GHS3DPlugin/GHS3DPlugin_Hypothesis.cxx +++ b/src/GHS3DPlugin/GHS3DPlugin_Hypothesis.cxx @@ -52,6 +52,7 @@ GHS3DPlugin_Hypothesis::GHS3DPlugin_Hypothesis(int hypId, int studyId, SMESH_Gen myToUseBoundaryRecoveryVersion(DefaultToUseBoundaryRecoveryVersion()), myToUseFemCorrection(DefaultToUseFEMCorrection()), myToRemoveCentralPoint(DefaultToRemoveCentralPoint()), + myGradation(DefaultGradation()), _enfVertexList(DefaultGHS3DEnforcedVertexList()), _enfVertexCoordsSizeList(DefaultGHS3DEnforcedVertexCoordsValues()), _enfVertexEntrySizeList(DefaultGHS3DEnforcedVertexEntryValues()), @@ -63,7 +64,6 @@ GHS3DPlugin_Hypothesis::GHS3DPlugin_Hypothesis(int hypId, int studyId, SMESH_Gen _enfEdges(TIDSortedElemGroupMap()), _enfTriangles(TIDSortedElemGroupMap()), _nodeIDToSizeMap(DefaultID2SizeMap()), - _elementIDToSizeMap(DefaultID2SizeMap()), _groupsToRemove(DefaultGroupsToRemove()) { _name = "GHS3D_Parameters"; @@ -329,6 +329,27 @@ std::string GHS3DPlugin_Hypothesis::GetTextOption() const 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 //======================================================================= @@ -419,20 +440,19 @@ bool GHS3DPlugin_Hypothesis::SetEnforcedVertex(std::string theName, std::string //======================================================================= //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 "<name = name; newEnfMesh->entry = entry; newEnfMesh->elementType = elementType; - newEnfMesh->size = size; newEnfMesh->groupName = groupName; TGHS3DEnforcedMeshList::iterator it = _enfMeshList.find(newEnfMesh); @@ -447,7 +467,7 @@ bool GHS3DPlugin_Hypothesis::SetEnforcedMesh(SMESH_Mesh& theMesh, SMESH::Element //======================================================================= //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; @@ -473,13 +493,12 @@ bool GHS3DPlugin_Hypothesis::SetEnforcedGroup(const SMESHDS_Mesh* theMeshDS, SME // theElemSet.insert( it->next() ); MESSAGE("Add "<name = name; newEnfMesh->entry = entry; newEnfMesh->elementType = elementType; - newEnfMesh->size = size; newEnfMesh->groupName = groupName; TGHS3DEnforcedMeshList::iterator it = _enfMeshList.find(newEnfMesh); @@ -494,13 +513,16 @@ bool GHS3DPlugin_Hypothesis::SetEnforcedGroup(const SMESHDS_Mesh* theMeshDS, SME //======================================================================= //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 nodeRet; + pair elemRet; + for (;it != theElemSet.end();++it) { elem = (*it); @@ -508,43 +530,41 @@ bool GHS3DPlugin_Hypothesis::SetEnforcedElements(TIDSortedElemSet theElemSet, SM case SMESH::NODE: node = dynamic_cast(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 (" <X()<<","<Y()<<","<Z()<< ") with ID " << node->GetID() <<" added ? " << msg); } else { SMDS_ElemIteratorPtr nodeIt = elem->nodesIterator(); for (;nodeIt->more();) { node = dynamic_cast(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 @@ -552,9 +572,8 @@ bool GHS3DPlugin_Hypothesis::SetEnforcedElements(TIDSortedElemSet theElemSet, SM 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; } } } @@ -688,7 +707,6 @@ void GHS3DPlugin_Hypothesis::ClearEnforcedMeshes() _enfEdges.clear(); _enfTriangles.clear(); _nodeIDToSizeMap.clear(); - _elementIDToSizeMap.clear(); _enfMeshList.clear(); _entryEnfMeshMap.clear(); NotifySubMeshesHypothesisModification(); @@ -843,6 +861,15 @@ bool GHS3DPlugin_Hypothesis::DefaultToRemoveCentralPoint() return false; } +//======================================================================= +//function : DefaultGradation +//======================================================================= + +double GHS3DPlugin_Hypothesis::DefaultGradation() +{ + return 1.05; +} + // //======================================================================= // //function : DefaultID2SizeMap // //======================================================================= @@ -870,6 +897,7 @@ std::ostream & GHS3DPlugin_Hypothesis::SaveTo(std::ostream & save) save << (int)myToUseBoundaryRecoveryVersion << " "; save << (int)myToUseFemCorrection << " "; save << (int)myToRemoveCentralPoint << " "; + save << myGradation << " "; if (!myTextOption.empty()) { save << "__OPTIONS_BEGIN__ "; save << myTextOption << " "; @@ -879,7 +907,7 @@ std::ostream & GHS3DPlugin_Hypothesis::SaveTo(std::ostream & save) 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__"; @@ -910,9 +938,38 @@ std::ostream & GHS3DPlugin_Hypothesis::SaveTo(std::ostream & save) 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; } @@ -922,214 +979,305 @@ std::ostream & GHS3DPlugin_Hypothesis::SaveTo(std::ostream & 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: " <> 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: " <> 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 " <> txt); + if (txt != "__END_NAME__") { + if (!name.empty()) + name += " "; + name += txt; + } + } + MESSAGE("name: " <> 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; } @@ -1162,7 +1310,7 @@ bool GHS3DPlugin_Hypothesis::SetParametersByDefaults(const TDefaults& /*dflts*/ //================================================================================ std::string GHS3DPlugin_Hypothesis::CommandToRun(const GHS3DPlugin_Hypothesis* hyp, - const bool hasShapeToMesh) + const bool hasShapeToMesh) { TCollection_AsciiString cmd; if (hasShapeToMesh) @@ -1179,6 +1327,7 @@ std::string GHS3DPlugin_Hypothesis::CommandToRun(const GHS3DPlugin_Hypothesis* h 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; @@ -1261,6 +1410,12 @@ std::string GHS3DPlugin_Hypothesis::CommandToRun(const GHS3DPlugin_Hypothesis* h cmd += (char*) hyp->myTextOption.c_str(); } + // to define volumic gradation. + if ( gra && hyp) { + cmd += " -Dcpropa="; + cmd += hyp->myGradation; + } + #ifdef WNT cmd += " < NUL"; #endif @@ -1345,11 +1500,6 @@ GHS3DPlugin_Hypothesis::TID2SizeMap GHS3DPlugin_Hypothesis::GetNodeIDToSizeMap(c 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(); diff --git a/src/GHS3DPlugin/GHS3DPlugin_Hypothesis.hxx b/src/GHS3DPlugin/GHS3DPlugin_Hypothesis.hxx index 93723bb..2e1acc5 100644 --- a/src/GHS3DPlugin/GHS3DPlugin_Hypothesis.hxx +++ b/src/GHS3DPlugin/GHS3DPlugin_Hypothesis.hxx @@ -84,9 +84,8 @@ public: struct TGHS3DEnforcedMesh { std::string name; std::string entry; - SMESH::ElementType elementType; std::string groupName; - double size; + SMESH::ElementType elementType; }; struct CompareGHS3DEnforcedMesh { @@ -103,14 +102,19 @@ public: }; 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 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 TIDSortedElemGroupMap; - typedef std::map TIDSortedNodeGroupMap; + typedef std::map TIDSortedElemGroupMap; + typedef std::map TIDSortedNodeGroupMap; typedef std::set TSetStrings; static const char* GetHypType() { return "GHS3D_Parameters"; } @@ -187,6 +191,11 @@ public: */ void SetTextOption(const std::string& option); std::string GetTextOption() const; + /*! + * To define the volumic gradation + */ + void SetGradation(double gradation); + double GetGradation() const ; // struct TEnforcedEdge { @@ -225,9 +234,9 @@ public: /*! * 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(); @@ -235,7 +244,6 @@ public: 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 @@ -252,7 +260,6 @@ public: 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(); @@ -267,6 +274,7 @@ public: static bool DefaultToUseBoundaryRecoveryVersion(); static bool DefaultToUseFEMCorrection(); static bool DefaultToRemoveCentralPoint(); + static double DefaultGradation(); static TGHS3DEnforcedVertex DefaultGHS3DEnforcedVertex() {return TGHS3DEnforcedVertex();} static TGHS3DEnforcedVertexList DefaultGHS3DEnforcedVertexList() {return TGHS3DEnforcedVertexList();} @@ -314,6 +322,7 @@ private: bool myToUseFemCorrection; bool myToRemoveCentralPoint; std::string myTextOption; + double myGradation; TGHS3DEnforcedVertexList _enfVertexList; TGHS3DEnforcedVertexCoordsValues _enfVertexCoordsSizeList; @@ -331,7 +340,6 @@ private: TIDSortedElemGroupMap _enfEdges; TIDSortedElemGroupMap _enfTriangles; TID2SizeMap _nodeIDToSizeMap; - TID2SizeMap _elementIDToSizeMap; std::map _entryToElemsMap; TSetStrings _groupsToRemove; diff --git a/src/GHS3DPlugin/GHS3DPlugin_Hypothesis_i.cxx b/src/GHS3DPlugin/GHS3DPlugin_Hypothesis_i.cxx index 5b8466b..9129727 100644 --- a/src/GHS3DPlugin/GHS3DPlugin_Hypothesis_i.cxx +++ b/src/GHS3DPlugin/GHS3DPlugin_Hypothesis_i.cxx @@ -354,6 +354,31 @@ char* GHS3DPlugin_Hypothesis_i::GetTextOption() 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 //======================================================================= @@ -799,8 +824,6 @@ GHS3DPlugin::GHS3DEnforcedMeshList* GHS3DPlugin_Hypothesis_i::GetEnforcedMeshes( enfMesh->elementType = currentMesh->elementType; // Group Name enfMesh->groupName = CORBA::string_dup(currentMesh->groupName.c_str()); - // Size - enfMesh->size = currentMesh->size; result[i]=enfMesh; } @@ -817,22 +840,7 @@ bool GHS3DPlugin_Hypothesis_i::SetEnforcedMeshWithGroup(SMESH::SMESH_IDSource_pt 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( theSource); -// SMESH_Group_i* theGroup_i = SMESH::DownCast( theSource); -// SMESH_GroupOnGeom_i* theGroupOnGeom_i = SMESH::DownCast( 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."; @@ -852,21 +860,6 @@ bool GHS3DPlugin_Hypothesis_i::SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theSour // 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( theSource); -// SMESH_Group_i* theGroup_i = SMESH::DownCast( theSource); -// SMESH_GroupOnGeom_i* theGroupOnGeom_i = SMESH::DownCast( 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."; @@ -878,37 +871,13 @@ bool GHS3DPlugin_Hypothesis_i::SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theSour } /*! - * \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( theSource); -// SMESH_Group_i* theGroup_i = SMESH::DownCast( theSource); -// SMESH_GroupOnGeom_i* theGroupOnGeom_i = SMESH::DownCast( 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."; @@ -920,36 +889,13 @@ bool GHS3DPlugin_Hypothesis_i::SetEnforcedMeshSizeWithGroup(SMESH::SMESH_IDSourc } /*! - * \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( theSource); -// SMESH_Group_i* theGroup_i = SMESH::DownCast( theSource); -// SMESH_GroupOnGeom_i* theGroupOnGeom_i = SMESH::DownCast( 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."; @@ -960,7 +906,7 @@ bool GHS3DPlugin_Hypothesis_i::SetEnforcedMeshSize(SMESH::SMESH_IDSource_ptr the #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"); @@ -976,18 +922,6 @@ bool GHS3DPlugin_Hypothesis_i::p_SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theSo 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"); @@ -999,13 +933,16 @@ bool GHS3DPlugin_Hypothesis_i::p_SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theSo MESSAGE("Required type is FACE"); break; default: - break; + MESSAGE("Incompatible required type: " << theType); + return false; } // MESSAGE("Required type is "<GetTypes(); MESSAGE("Available types:"); for (int i=0;ilength();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"; @@ -1015,36 +952,31 @@ bool GHS3DPlugin_Hypothesis_i::p_SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theSo // 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( theSource); SMESH_Group_i* theGroup_i = SMESH::DownCast( theSource); SMESH_GroupOnGeom_i* theGroupOnGeom_i = SMESH::DownCast( 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) { @@ -1059,22 +991,11 @@ bool GHS3DPlugin_Hypothesis_i::p_SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theSo 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 << "\" )"; @@ -1083,7 +1004,6 @@ bool GHS3DPlugin_Hypothesis_i::p_SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theSo SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMesh( " << theSource << ", " << theType << " )"; } - } return res; } catch (const std::invalid_argument& ex) { @@ -1098,22 +1018,11 @@ bool GHS3DPlugin_Hypothesis_i::p_SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theSo 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 << "\" )"; @@ -1122,7 +1031,6 @@ bool GHS3DPlugin_Hypothesis_i::p_SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theSo SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMesh( " << theSource << ", " << theType << " )"; } - } return res; } catch (const std::invalid_argument& ex) { diff --git a/src/GHS3DPlugin/GHS3DPlugin_Hypothesis_i.hxx b/src/GHS3DPlugin/GHS3DPlugin_Hypothesis_i.hxx index 7ca3cac..6b1539c 100644 --- a/src/GHS3DPlugin/GHS3DPlugin_Hypothesis_i.hxx +++ b/src/GHS3DPlugin/GHS3DPlugin_Hypothesis_i.hxx @@ -122,6 +122,11 @@ class GHS3DPLUGIN_EXPORT GHS3DPlugin_Hypothesis_i: */ 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 */ @@ -144,11 +149,15 @@ class GHS3DPLUGIN_EXPORT GHS3DPlugin_Hypothesis_i: /*! * 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(); diff --git a/src/GHS3DPlugin/Makefile.am b/src/GHS3DPlugin/Makefile.am index a761826..1d7fc51 100644 --- a/src/GHS3DPlugin/Makefile.am +++ b/src/GHS3DPlugin/Makefile.am @@ -27,7 +27,6 @@ include $(top_srcdir)/adm_local/unix/make_common_starter.am # header files salomeinclude_HEADERS = \ - libmesh5.h \ GHS3DPlugin_Defs.hxx \ GHS3DPlugin_GHS3D.hxx \ GHS3DPlugin_GHS3D_i.hxx \ @@ -38,7 +37,6 @@ salomeinclude_HEADERS = \ lib_LTLIBRARIES = libGHS3DEngine.la dist_libGHS3DEngine_la_SOURCES = \ - libmesh5.c \ GHS3DPlugin_GHS3D.cxx \ GHS3DPlugin_GHS3D_i.cxx \ GHS3DPlugin_i.cxx \ @@ -61,7 +59,7 @@ libGHS3DEngine_la_LDFLAGS = \ ../../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. diff --git a/src/GHS3DPlugin/libmesh5.c b/src/GHS3DPlugin/libmesh5.c deleted file mode 100644 index 4277b97..0000000 --- a/src/GHS3DPlugin/libmesh5.c +++ /dev/null @@ -1,1192 +0,0 @@ - - -/*----------------------------------------------------------*/ -/* */ -/* 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 -#include -#include -#include -#include -#include -#include -#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;iNmbTyp;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;iNmbTyp;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;iNmbTyp;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;iNmbTyp;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;iSolSiz;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;iSolSiz;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;iSolSiz;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;iSolSiz;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;jSolSiz;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;jSolSiz;j++) - fscanf(msh->hdl, "%lf", &DblSolTab[j]); - else - for(j=0;jSolSiz;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;iSolSiz;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;iSolSiz;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;iSolSiz;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;iSolSiz;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;jSolSiz;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;jSolSiz;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;iSolSiz;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;iNmbTyp;i++) - fscanf(msh->hdl, "%d", &kwd->TypTab[i]); - } - else - { - ScaWrd(msh, (unsigned char *)&kwd->NmbTyp); - - for(i=0;iNmbTyp;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;iNmbTyp;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;jdim;j++) - kwd->fmt[ kwd->SolSiz++ ] = chr; - } - else if(chr == 's') - { - chr = InpFmt[i++]; - - for(j=0;jfmt[ kwd->SolSiz++ ] = chr; - } - else - kwd->fmt[ kwd->SolSiz++ ] = chr; - } - - for(i=0;iSolSiz;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;iver >= 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); - } -} diff --git a/src/GHS3DPlugin/libmesh5.h b/src/GHS3DPlugin/libmesh5.h deleted file mode 100755 index cfaf9fb..0000000 --- a/src/GHS3DPlugin/libmesh5.h +++ /dev/null @@ -1,152 +0,0 @@ - - -/*----------------------------------------------------------*/ -/* */ -/* 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 diff --git a/src/GUI/GHS3DPluginGUI_Enums.h b/src/GUI/GHS3DPluginGUI_Enums.h index 8516565..87c2563 100644 --- a/src/GUI/GHS3DPluginGUI_Enums.h +++ b/src/GUI/GHS3DPluginGUI_Enums.h @@ -51,7 +51,6 @@ enum { 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 }; @@ -59,7 +58,7 @@ enum { // 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, @@ -74,7 +73,6 @@ enum { ENF_MESH_WARNING = 0, ENF_MESH_MESH /*= 0*/, ENF_MESH_CONSTRAINT, - ENF_MESH_SIZE, ENF_MESH_GROUP, ENF_MESH_BTN, ENF_MESH_NB_LINES diff --git a/src/GUI/GHS3DPluginGUI_HypothesisCreator.cxx b/src/GUI/GHS3DPluginGUI_HypothesisCreator.cxx index 6c097cc..4f32cba 100644 --- a/src/GUI/GHS3DPluginGUI_HypothesisCreator.cxx +++ b/src/GUI/GHS3DPluginGUI_HypothesisCreator.cxx @@ -287,38 +287,20 @@ EnforcedMeshTableWidgetDelegate::EnforcedMeshTableWidgetDelegate(QObject *parent 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(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(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); } @@ -463,28 +445,35 @@ QFrame* GHS3DPluginGUI_HypothesisCreator::buildFrame() 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(); @@ -496,10 +485,10 @@ QFrame* GHS3DPluginGUI_HypothesisCreator::buildFrame() 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); @@ -590,7 +579,6 @@ QFrame* GHS3DPluginGUI_HypothesisCreator::buildFrame() 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); @@ -616,10 +604,6 @@ QFrame* GHS3DPluginGUI_HypothesisCreator::buildFrame() 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); @@ -644,8 +628,6 @@ QFrame* GHS3DPluginGUI_HypothesisCreator::buildFrame() 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); @@ -688,7 +670,6 @@ QFrame* GHS3DPluginGUI_HypothesisCreator::buildFrame() 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; @@ -729,7 +710,7 @@ void GHS3DPluginGUI_HypothesisCreator::checkVertexIsDefined() **/ void GHS3DPluginGUI_HypothesisCreator::checkEnfMeshIsDefined() { - emit enfMeshDefined((!myMeshSizeValue->GetString().isEmpty() && !myEnfVertexWdg->NbObjects() == 0)); + emit enfMeshDefined( myEnfVertexWdg->NbObjects() != 0); } /** @@ -924,9 +905,9 @@ void GHS3DPluginGUI_HypothesisCreator::synchronizeCoords() { /** 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; @@ -960,11 +941,6 @@ void GHS3DPluginGUI_HypothesisCreator::addEnforcedMesh(std::string name, std::st 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 << "\""); @@ -1013,11 +989,6 @@ void GHS3DPluginGUI_HypothesisCreator::addEnforcedMesh(std::string name, std::st 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()); @@ -1233,12 +1204,6 @@ void GHS3DPluginGUI_HypothesisCreator::onAddEnforcedMesh() groupName = ""; - double size = -1; - if (!myMeshSizeValue->GetString().isEmpty()) - size = myMeshSizeValue->GetValue(); -// if (size < 0) -// return; - int elementType = myEnfMeshConstraint->currentIndex(); @@ -1256,7 +1221,7 @@ void GHS3DPluginGUI_HypothesisCreator::onAddEnforcedMesh() CORBA::Object_var anObj = SMESH::SObjectToObject(aSObj,aStudy); if (!CORBA::is_nil(anObj)) { // SMESH::SMESH_IDSource_var theSource = SMESH::SObjectToInterface( aSObj ); - addEnforcedMesh( aSObj->GetName(), aSObj->GetID(), elementType, size, groupName); + addEnforcedMesh( aSObj->GetName(), aSObj->GetID(), elementType, groupName); } } else @@ -1269,7 +1234,7 @@ void GHS3DPluginGUI_HypothesisCreator::onAddEnforcedMesh() CORBA::Object_var anObj = SMESH::SObjectToObject(aSObj,aStudy); if (!CORBA::is_nil(anObj)) { // SMESH::SMESH_IDSource_var theSource = SMESH::SObjectToInterface( aSObj ); - addEnforcedMesh( aSObj->GetName(), aSObj->GetID(), elementType, size, groupName); + addEnforcedMesh( aSObj->GetName(), aSObj->GetID(), elementType, groupName); } } } @@ -1473,10 +1438,12 @@ void GHS3DPluginGUI_HypothesisCreator::retrieveParams() const 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++ ) @@ -1556,6 +1523,7 @@ void GHS3DPluginGUI_HypothesisCreator::retrieveParams() const // 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++ ) @@ -1592,11 +1560,6 @@ void GHS3DPluginGUI_HypothesisCreator::retrieveParams() const 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()); @@ -1664,6 +1627,11 @@ QString GHS3DPluginGUI_HypothesisCreator::storeParams() const if ( data.myFEMCorrection ) valStr += " -FEM"; + if ( data.myGradation != 1.05 ) { + valStr += " -Dcpropa="; + valStr += QString::number( data.myGradation ); + } + valStr += " "; valStr += data.myTextOption; @@ -1711,6 +1679,7 @@ bool GHS3DPluginGUI_HypothesisCreator::readParamsFromHypo( GHS3DHypothesisData& 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(); @@ -1739,7 +1708,6 @@ bool GHS3DPluginGUI_HypothesisCreator::readParamsFromHypo( GHS3DHypothesisData& 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; @@ -1795,6 +1763,8 @@ bool GHS3DPluginGUI_HypothesisCreator::storeParamsToHypo( const GHS3DHypothesisD 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() ); @@ -1838,14 +1808,17 @@ bool GHS3DPluginGUI_HypothesisCreator::storeParamsToHypo( const GHS3DHypothesisD 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( aSObj ); - SMESH::ElementType elementType; + MESSAGE("enfMesh->elementType: " << enfMesh->elementType); + SMESH::ElementType elementType; switch(enfMesh->elementType) { case 0: elementType = SMESH::NODE; @@ -1860,7 +1833,8 @@ bool GHS3DPluginGUI_HypothesisCreator::storeParamsToHypo( const GHS3DHypothesisD 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() <<"\")"<p_SetEnforcedMesh(theSource, elementType, enfMesh->name.c_str(), enfMesh->groupName.c_str()); } // for } // try // catch(const std::exception& ex) { @@ -1890,6 +1864,7 @@ bool GHS3DPluginGUI_HypothesisCreator::readParamsFromWidgets( GHS3DHypothesisDat 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 @@ -1936,12 +1911,11 @@ bool GHS3DPluginGUI_HypothesisCreator::readParamsFromWidgets( GHS3DHypothesisDat 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(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; diff --git a/src/GUI/GHS3DPluginGUI_HypothesisCreator.h b/src/GUI/GHS3DPluginGUI_HypothesisCreator.h index 693f9ce..5e311ec 100644 --- a/src/GUI/GHS3DPluginGUI_HypothesisCreator.h +++ b/src/GUI/GHS3DPluginGUI_HypothesisCreator.h @@ -120,7 +120,6 @@ struct TEnfMesh{ std::string entry; int elementType; std::string groupName; - double size; }; struct CompareEnfMeshes @@ -144,6 +143,7 @@ typedef struct bool myToMeshHoles,myKeepFiles,myToCreateNewNodes,myBoundaryRecovery,myFEMCorrection,myRemoveInitialCentralPoint; int myMaximumMemory,myInitialMemory,myOptimizationLevel; QString myName,myWorkingDir,myTextOption; + double myGradation; short myVerboseLevel; TEnfVertexList myEnforcedVertices; TEnfMeshList myEnforcedMeshes; @@ -188,7 +188,7 @@ protected slots: 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(); @@ -223,6 +223,7 @@ private: QCheckBox* myRemoveInitialCentralPointCheck; QCheckBox* myBoundaryRecoveryCheck; QCheckBox* myFEMCorrectionCheck; + SMESHGUI_SpinBox* myGradation; QLineEdit* myTextOption; QWidget* myEnfGroup; @@ -247,7 +248,6 @@ private: QStringList myEnfMeshConstraintLabels; // SMESH::mesh_array_var myEnfMeshArray; QTableWidget* myEnforcedMeshTableWidget; - SMESHGUI_SpinBox* myMeshSizeValue; QLineEdit* myMeshGroupName; QPushButton* addEnfMeshButton; QPushButton* removeEnfMeshButton; diff --git a/src/GUI/GHS3DPlugin_msg_en.ts b/src/GUI/GHS3DPlugin_msg_en.ts index 65569d8..9c8884b 100644 --- a/src/GUI/GHS3DPlugin_msg_en.ts +++ b/src/GUI/GHS3DPlugin_msg_en.ts @@ -79,6 +79,10 @@ FEM_CORRECTION To use FEM correction + + GHS3D_GRADATION + Volumic gradation + SELECT_DIR ... diff --git a/src/GUI/GHS3DPlugin_msg_fr.ts b/src/GUI/GHS3DPlugin_msg_fr.ts index 86452f3..922e2cc 100755 --- a/src/GUI/GHS3DPlugin_msg_fr.ts +++ b/src/GUI/GHS3DPlugin_msg_fr.ts @@ -79,6 +79,10 @@ FEM_CORRECTION Utiliser correction FEM + + GHS3D_GRADATION + Gradation volumique + SELECT_DIR ...