From: Christian Van Wambeke Date: Thu, 5 Jun 2014 14:04:10 +0000 (+0200) Subject: tetra_hpc in place of tepal X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=12c3d37b2d6ffdda7fc9714947ac07f0b8a9db80;p=plugins%2Fghs3dprlplugin.git tetra_hpc in place of tepal --- diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..36597d4 --- /dev/null +++ b/.gitignore @@ -0,0 +1,22 @@ +# Compiled source +################# +*.pyc +*.pyo + +# Edition bak +################# +*~ +*.old +*_old + +# CASTEM +################# +UTILNOTI +UTILPROC +fort.98 + +# AUTOTOOLS +################# +Makefile.in +Makefile + diff --git a/doc/file.mesh.pdf b/doc/file.mesh.pdf new file mode 100644 index 0000000..c0f071e Binary files /dev/null and b/doc/file.mesh.pdf differ diff --git a/doc/salome/gui/GHS3DPRLPLUGIN/images/ghs3dprl_parameters_basic.png b/doc/salome/gui/GHS3DPRLPLUGIN/images/ghs3dprl_parameters_basic.png index 0628058..cdf1c3d 100644 Binary files a/doc/salome/gui/GHS3DPRLPLUGIN/images/ghs3dprl_parameters_basic.png and b/doc/salome/gui/GHS3DPRLPLUGIN/images/ghs3dprl_parameters_basic.png differ diff --git a/doc/salome/gui/GHS3DPRLPLUGIN/input/ghs3dprl_hypo.doc b/doc/salome/gui/GHS3DPRLPLUGIN/input/ghs3dprl_hypo.doc index 83fe233..f70161d 100644 --- a/doc/salome/gui/GHS3DPRLPLUGIN/input/ghs3dprl_hypo.doc +++ b/doc/salome/gui/GHS3DPRLPLUGIN/input/ghs3dprl_hypo.doc @@ -2,18 +2,17 @@ \page ghs3dprl_hypo_page GHS3DPRL Parameters hypothesis -\n GHS3DPRL Parameters hypothesis works only with Tetrahedron (Tepal with TetMesh-GHS3D) algorithm. -This algorithm is a commercial software, its use requires a licence (http://www.distene.com/fr/build/offer.html). -\n Tepal_V1.4 gives the possibility to generate a partitioned -mesh with 200 million tetrahedrons on a computer with average memory size -(2Go RAM) in about 50 hours on one CPU (Xeon, 2008). -\n New Tepal_V2.0 gives the possibility to generate a partitioned mesh with (for the moment) no more than 100 million -tetrahedrons on computers using MPI, (Total 16 Go RAM) -in about 900 seconds (!yes! : !seconds!) on 2 octo processors (Xeon, 2009). -The launch of this beta-version is described below. +\n GHS3DPRL Parameters hypothesis works only with Tetrahedron and code tetra_hpc (formerly tepal) +which is the parallel implementation of MeshGems-Tetra (formerly TetMesh-GHS3D) algorithm. +This algorithm is a DISTENE commercial software, its use requires a licence. +\n +See http://www.distene.com and http://www.meshgems.com/volume-meshing-meshgems-tetra.html. +\n tetra_hpc (Tepal V3 in fact) gives the possibility to generate a partitioned +mesh with more than 200 million tetrahedrons on computers using MPI. +The launch of this version is described below. \n This is a serious alternative to GHS3D, which requires a much less common configuration with 64Go RAM to only try to make a partition of a mesh with -200 million tetrahedrons, no result guaranteed. +200 million tetrahedrons, no result guaranteed (2010). \n \note The Plugin doesn't load in the Memory the supposedly large resulting meshes. The meshes are saved in MED files and can be imported in the user-defined location via menu File-Import-MED Files. @@ -44,269 +43,174 @@ in Nb_Part by the elementary algorithm implemented in Tepal.
background mode was not used).
  • -Tepal_in_Background - if this box is checked, Tepal execution +Tetra_hpc in Background - if this box is checked, Tetra_hpc execution and MED file generation are launched in background mode and the user can even exit Salome. Pay attention that in this case Tepal algorithm works independently of "killSalome.py", and sometimes on another host.
  • -To_Mesh_Holes - if this box is checked, the parameter component -of tetmesh-ghs3d will mesh holes. +merge subdomains - if this box is checked, merge the subdomains +into one mesh and write the output .mesh(b). +
  • +
  • +tag subdomains - if this box is checked, use the parallel subdomain +index as tag into the merged output mesh or not (used in combination with the +merge_subdomains option). +
  • +
  • +output interfaces - if this box is checked, write the parallel subdomains interface +triangles into the merged output mesh (used in combination with the merge_subdomains option). +
  • +
  • +discard subdomains - if this box is checked, discard the parallel subdomains +(mesh, global numbering and interfaces).
  • Modifying GHS3DPRL Advanced Parameters


    -GHS3DPRL Plugin launches a standalone binary executable tepal2med.
    -tepal2med launches tepal, waits for the end of computation, and +GHS3DPRL Plugin launches a standalone binary executable tetrahpc2med.
    +tetrahpc2med launches tetra_hpc, waits for the end of computation, and converts the resulting output tepal files into MED files.
    -Some advanced optional parameters are accessible as arguments.
    -If keep_files option is checked, it is possible to re-launch tepal2med -or tepal in the Terminal as a command with custom parameters.
    +If keep_files option is checked, it is possible to re-launch tetrahpc2med +or tetra_hpcl in the Terminal as a command with custom parameters.
  • -Advanced tepal2med Parameters - type "tepal2med --help" in the Terminal.

    +Advanced tetrahpc2med Parameters - type tetrahpc2med --help in the Terminal.

    \verbatim -myname@myhost > /export/home/myname/salome_5/GHS3DPRLPLUGIN_5/bin/salome/tepal2med --help -Available options: - --help : produces this help message - --casename : path and name of input tepal2med files which are - - output files of tepal .msg .noboite .faces .points .glo - - output file of GHS3DPRL_Plugin casename_skin.med (optional) - with initial skin and its initial groups - --number : number of partitions - --medname : path and name of output MED files - --limitswap : max size of working cpu memory (Mo) (before swapping on .temp files) - --verbose : trace of execution (0->6) - --test : more tests about joints, before generation of output files - --menu : a GUI menu for option number - --launchtepal : also launch tepal on files casename.faces and casename.points and option number - --meshholes : force parameter component of tetmesh-ghs3d to mesh holes - --background : force background mode from launch tepal and generation of final MED files (big meshes) - --deletegroups : regular expression (see QRegExp) which matches unwanted groups in final MED files - (try --deletegroups="(\bAll_Nodes|\bAll_Faces)" - (try --deletegroups="((\bAll_|\bNew_)(N|F|T))" +myname@myhost > /export/home/myname/salome_7/GHS3DPRLPLUGIN/bin/salome/tetrahpc2med --help +tetrahpc2med V3.0 (MED3+tetra-hpc) Available options: + --help : produces this help message + --casename : path and name of input tetrahpc2med files which are + - output files of GHS3DPRL_Plugin .mesh + - output file of GHS3DPRL_Plugin casename_skin.med (optional) + with initial skin and its initial groups + --number : number of partitions + --medname : path and name of output MED files + --limitswap : max size of working cpu memory (Mo) (before swapping on .temp files) + --verbose : trace of execution (0->6) + --test : more tests about joints, before generation of output files + --menu : a GUI menu for option number + --launchtetra : also launch tetra-hpc on files casename.mesh and option number + --merge_subdomains : merge the subdomains into one mesh and write the output .mesh(b) file + --tag_subdomains : use the parallel subdomain index as tag into the merged output mesh + to identify the parallel subdomains (used in combination with the merge_subdomains option) + --output_interfaces : write the parallel subdomains interface triangles into the merged output mesh + (used in combination with the merge_subdomains option) + --discard_subdomains : discard the parallel subdomains informations output (mesh, global numbering and interfaces) + --background : force background mode from launch tetra-hpc and generation of final MED files (big meshes) + --deletegroups : regular expression (see QRegExp) which matches unwanted groups in final MED files + (try --deletegroups="(\bJOINT)" + (try --deletegroups="(\bAll_Nodes|\bAll_Faces)" + (try --deletegroups="((\bAll_|\bNew_)(N|F|T))" example: - tepal2med --casename=/tmp/GHS3DPRL --number=2 --medname=DOMAIN --limitswap=1000 - --verbose=0 --test=yes --menu=no --launchtepal=no + tetrahpcl2med --casename=/tmp/GHS3DPRL --number=2 --medname=DOMAIN --limitswap=1000 --verbose=0 --test=yes --menu=no --launchtetra=no \endverbatim \n

  • -Advanced Tepal_V1.4 Parameters

    +Advanced tetra_hpc parameters (2014)

    \verbatim -USAGE : tepal options - -With options : - --filename name (-f name) : - Prefix of the input case (MANDATORY) - - --ndom n (-n n) : - Number of subdomains to make (MANDATORY) - - --ghs3d ghs3d options (-g ghs3d options) : - Runs temesh ghs3d on a previously generated subdomain. (ghs3d options must be "quoted") - - --memory m (-m m) : - Max amount of memory (megabytes) allowed for ghs in the cutting process. (default is 0 : unlimited) - - --mesh_only (-Z ) : - Only (re)meshes all subdomains and updates communications messages - - --mesh_call command (-c command) : - Calls the user specified command for meshing all the - subomains after their skin has been generated - - --stats_only (-S ) : - Only computes and shows some statistics on subdomains - - --rebuild (-r ) : - Merges final subdomains skins - - --rebuild_tetra (-R ) : - Merges final subdomains skins and tetraedra - - --rebuild_iface (-i ) : - Includes interfaces in final subdomains merge - - --rebuild_retag (-t ) : - Tags vertices, faces (and tetra if selected) with their - subdomain number in the final merge of subdomains (keeps the lowest tag for shared elements) - - --rebuild_ensight_parts (-e ) : - Builds ensight geom file with parts - - --tetmesh_args str (-G str) : - Arguments to pass to Tetmesh during cutting process +Usage: tetra_hpc.exe [options] + +Options: + + Short option (if it exists) + / Long option + | / Description + | | / + v v v + + --help + print this help + + --in + Sets the input file + (MANDATORY) + + --out + Sets the output file + (MANDATORY) + + --merge_subdomains + Describes whether to merge the subdomains into one mesh and write the + output .mesh(b) file or not. + if is + yes : the subdomains will be merged into one mesh and written to + the output .mesh(b), + no : the subdomains will not be merged. + default : no + + --tag_subdomains + Describes whether to use the parallel subdomain index as tag into the + merged output mesh or not (used in combination with the + merge_subdomains option). + if is + yes : the tags of the tetrahedra in the merged output will + identify the parallel subdomains, + no : the tag will keep its standard meaning of volume domain. + default : no + + --output_interfaces + Describes whether to write the parallel subdomains interface + triangles into the merged output mesh or not (used in combination + with the merge_subdomains option). + if is + yes : the parallel subdomains interface triangles will be written + into the merged output mesh, + no : they will not be added to the merged output mesh. + default : no + + --verbose + Set the verbosity level, increasing from 0 to 10. + values are increasing from 0 to 10 : + 0 : no details + 10 : very detailed + default : 3 + + --discard_subdomains + Describes whether to discard the parallel subdomains (mesh, global + numbering and interfaces) or not. + if is + yes : the subdomain informations (mesh, global numbering and + interfaces) will be discarded, + no : they will be written to disk as output. + default : no \endverbatim \n

  • -
  • -Advanced ghs3d Parameters (through Tepal_V1.4's --tetmesh_args) - type "ghs3d -h" in a Terminal.

    -\verbatim -myname@myhost > ghs3d -h - -USE - /export/home/myname/ghs3d-4.0/DISTENE/Tools/TetMesh-GHS3D4.0/bin/Linux/ghs3dV4.0 - [-u] [-m memory>] [-M MEMORY] [-f prefix] [-v verbose] - [-c component] [-p0] [-C] [-E count] [-t] [-o level] - [-I filetype] [-a/-b] [-O n m] - -DESCRIPTION - - -u (-h) : prints this message. - - -m memory : launches the software with memory in Megabytes. - The default value of this parameter is 64 Megabytes and its - minimum value is 10 Megabytes. - It is also possible to set this parameter with the - environment variable GHS3D_MEMORY by means of an operation - equivalent to: - setenv GHS3D_MEMORY memory, - the value specified in the command line has the priority on - the environment variable. - - -M MEMORY : provides the automatic memory adjustment feature. - If MEMORY (in Megabytes) is equal to zero, the size of the work space is - calculated from the input. If MEMORY is not equal to - zero, the software starts with MEMORY amount of work space. - The software reallocates memory as necessary. - The start value of MEMORY can range from 0 to 64 Megabytes, - the maximum depends on -m option and the actual memory available. - - -f prefix : defines the generic prefix of the files. - - -v verbose : sets the output level parameter (the verbose parameter - must be in the range 0 to 10). - - -c component : chooses the meshed component. If the parameter is - 0, all components will be meshed, if - 1, only the main (outermost) component will be meshed - - -p0 : disables creation of internal points. - - -C : uses an alternative boundary recovery mechanism. It should be used only - when the standard boundary recovery fails. - - -E count : sets the extended output for error messages. If -E is used, - the error messages will be printed, it is possible - to indicate the maximum number of printed messages between 1 and 100. - - -t : generates an error file prefix.Log - - -o level : sets the required optimisation level. - Valid optimisation levels are: - none, light, standard or strong, - with increase of "quality vs speed" ratio. - - -I filetype : defines the input mesh format as follows: - -IP input files are ascii files, named prefix.points - and prefix.faces - this is the default type of files - -IPb input files are binary files, named prefix.pointsb - and prefix.facesb - -IM input file is ascii file, named prefix.mesh - where prefix is defined with -f option - - -a/-b : selects the output file type: - -a for ascii (the default) and - -b for binary. - - -On : saves a NOPO file in addition. NOPO is the mesh data - structure of the Simail and Modulef software packages. - -Om : saves a mesh file in addition. - -Omn : saves both NOPO and mesh files. - - ============================================================================== - TETMESH-GHS3D SOFTWARE 4.0-3 (December, 2006) - END OF SESSION - COPYRIGHT (C)1989-2006 INRIA ALL RIGHTS RESERVED - ============================================================================== - ( Distene SAS - Phone: +33(0)1-69-26-62-10 Fax: +33(0)1-69-26-90-33 - EMail: support@distene.com ) - -\endverbatim -\n -

  • Saving user's preferred GHS3DPRL Advanced Parameters


    -GHS3DPRL Plugin launches standalone binary executable tepal2med.
    -You may rename file tepal2med as tepal2med.exe for example, and replace -tepal2med by a shell script at your convenience to overriding parameters. -
    ... or else $PATH modification... .
    Idem for file tepal.

    +GHS3DPRL Plugin launches standalone binary executable tetrahpc2med.
    +You may rename file tetrahpc2med as tetrahpc2med.exe for example, and replace +tetrahpc2med by a shell script at your convenience to overriding parameters. +
    ... or else $PATH modification... .
  • -Advanced tepal2med Parameters - overriding parameter deletegroups

    -You may rename tepal2med as tepal2med.exe for example. +Advanced tetrahpc2med Parameters - overriding parameter deletegroups

    +You may rename tetrahpc2med as tetrahpc2med.exe for example. \code #!/bin/bash -#script tepal2med overriding parameter deletegroups -#we have renamed binary executable tepal2med as tepal2med.exe -#echo tepal2med initial parameters are $1 $2 $3 $4 ... or $* +#script tetrahpc2med overriding parameter deletegroups +#we have renamed binary executable tetrahpc2med as tetrahpc2med.exe +#echo tetrahpc2med initial parameters are $1 $2 $3 $4 ... or $* #$0 is ignored -tepal2med.exe $* --deletegroups="(\bAll_Nodes|\bAll_Faces)" - -\endcode -\n -

  • -
  • -Advanced Tepal_V1.4 Parameters - overriding parameter component of ghs3d (to mesh holes).

    -You may rename tepal as tepal.exe for example. - -\code -#!/bin/bash -#script tepal overriding parameter component of tetmesh-ghs3d -#we have renamed binary executable tepal as tepal.exe - -#optionnaly we could set licence only for us -DISTENE_LICENSE_FILE="Use global envvar: DLIM8VAR" -DLIM8VAR="dlim8 1:1:29030@is142356/0016175ef08c::a1ba1...etc...e19" -SIMULOGD_LICENSE_FILE=29029@is142356 - -tepal.exe $* --tetmesh_args "-c 0" - -\endcode -\n -

  • -
  • -Advanced tepal Parameters - overriding launching tepal on other host.

    -You may rename tepal as tepal.exe for example. - -\code -#!/bin/bash -#script tepal overriding launching tepal on other host (tepal run 64 bits only) -#we have renamed binary executable tepal as tepal.exe -#common file system (same path) otherwise scp... on input or result files -#ssh -keygen -t rsa done and files id_rsa et id-rsa.pub move in ~/.ssh - -#example of typical command -#tepal -f /home/myname/tmp/GHS3DPRL -n 4 > /home/myname/tmp/tepal.log -#echo parameters $1 $2 $3 $4 ... or $* - -#tepal licence ought to be known on otherhost -ssh otherhost "tepal.exe $* > /home/myname/tmp/tepal.log" - -#or more and more -#ssh otherhost "tepal.exe $* --tetmesh_args \"-c 0\"" > /home/myname/tmp/tepal.log +tetrahpc2med.exe $* --deletegroups="(\bAll_Nodes|\bAll_Faces)" \endcode \n

  • -

    Tepal_V2.0 and MPI use.


    -This all new beta-version needs MPI, (openmpi-1.3.1 was used). To use it you have to proceed -as done in "overriding parameter component of ghs3d". -Advanced ghs3d Parameters (through Tepal_V1.4's --tetmesh_args) are not assumed yet. -It meshes holes. -\n You may rename tepal as tepal64_v2.exe for example, and replace tepal by a shell script like below. +

    tetra_hpc and MPI use.


    +This 2014 beta-version needs MPI, (openmpi was used). To use it you have to proceed as below.
  • -example tepal_v2_mpirun.

    +Obsolete example tepal_v2_mpirun.

    \code @@ -444,8 +348,8 @@ algo2d.SetPhySize(5) algo2d.SetGeometricMesh(0) -# 3D mesh with tepal -# ------------------ +# 3D mesh with tetra-hpc (formerly tepal v3 (2014)) +# ---------------------------------------------------- algo3d = m.Tetrahedron(smeshBuilder.GHS3DPRL) @@ -453,7 +357,10 @@ algo3d.SetMEDName(results) algo3d.SetNbPart(4) algo3d.SetBackground(False) algo3d.SetKeepFiles(False) -algo3d.SetToMeshHoles(True) +algo3d.SetToMergeSubdomains(False) +algo3d.SetToTagSubdomains(False) +algo3d.SetToOutputInterfaces(False) +algo3d.SetToDiscardSubdomains(False) # Launch meshers # -------------- @@ -464,9 +371,9 @@ status = m.Compute() # ---------- if os.access(results+".xml", os.F_OK): - print "Ok: tepal" + print "Ok: tetra_hpc" else: - print "KO: tepal" + print "KO: tetra_hpc" \endcode \n

  • diff --git a/idl/GHS3DPRLPlugin_Algorithm.idl b/idl/GHS3DPRLPlugin_Algorithm.idl index 3d3f201..e961862 100755 --- a/idl/GHS3DPRLPlugin_Algorithm.idl +++ b/idl/GHS3DPRLPlugin_Algorithm.idl @@ -56,8 +56,20 @@ module GHS3DPRLPlugin void SetBackground(in boolean value); boolean GetBackground(); - void SetToMeshHoles(in boolean value); - boolean GetToMeshHoles(); + //void SetToMeshHoles(in boolean value); + //boolean GetToMeshHoles(); + + void SetToMergeSubdomains(in boolean value); + boolean GetToMergeSubdomains(); + + void SetToTagSubdomains(in boolean value); + boolean GetToTagSubdomains(); + + void SetToOutputInterfaces(in boolean value); + boolean GetToOutputInterfaces(); + + void SetToDiscardSubdomains(in boolean value); + boolean GetToDiscardSubdomains(); }; }; diff --git a/src/GHS3DPRLPlugin/GHS3DPRLPluginBuilder.py b/src/GHS3DPRLPlugin/GHS3DPRLPluginBuilder.py index 245d6f5..ee2f34e 100644 --- a/src/GHS3DPRLPlugin/GHS3DPRLPluginBuilder.py +++ b/src/GHS3DPRLPlugin/GHS3DPRLPluginBuilder.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- # Copyright (C) 2007-2013 CEA/DEN, EDF R&D # # This library is free software; you can redistribute it and/or @@ -109,8 +110,32 @@ class GHS3DPRL_Algorithm(Mesh_Algorithm): ## To mesh "holes" in a solid or not. Default is to mesh. # @param toMesh "mesh holes" flag value - def SetToMeshHoles(self, toMesh): - self.Parameters().SetToMeshHoles(toMesh) + #def SetToMeshHoles(self, toMesh): + # self.Parameters().SetToMeshHoles(toMesh) + # pass + + ## To Merge Subdomains. Default is to no. + # @param toMesh "MergeSubdomains" flag value + def SetToMergeSubdomains(self, toMesh): + self.Parameters().SetToMergeSubdomains(toMesh) + pass + + ## To Tag Subdomains. Default is to no. + # @param toMesh "TagSubdomains" flag value + def SetToTagSubdomains(self, toMesh): + self.Parameters().SetToTagSubdomains(toMesh) + pass + + ## To Output Interfaces. Default is to no. + # @param toMesh "OutputInterfaces" flag value + def SetToOutputInterfaces(self, toMesh): + self.Parameters().SetToOutputInterfaces(toMesh) + pass + + ## To Discard Subdomains. Default is to no. + # @param toMesh "DiscardSubdomains" flag value + def SetToDiscardSubdomains(self, toMesh): + self.Parameters().SetToDiscardSubdomains(toMesh) pass pass # end of GHS3DPRL_Algorithm class diff --git a/src/GHS3DPRLPlugin/GHS3DPRLPlugin_GHS3DPRL.cxx b/src/GHS3DPRLPlugin/GHS3DPRLPlugin_GHS3DPRL.cxx index 153fac7..96d723b 100755 --- a/src/GHS3DPRLPlugin/GHS3DPRLPlugin_GHS3DPRL.cxx +++ b/src/GHS3DPRLPlugin/GHS3DPRLPlugin_GHS3DPRL.cxx @@ -407,7 +407,10 @@ void GHS3DPRLPlugin_GHS3DPRL::SetParameters(const GHS3DPRLPlugin_Hypothesis* hyp _NbPart = hyp->GetNbPart(); _KeepFiles = hyp->GetKeepFiles(); _Background = hyp->GetBackground(); - _ToMeshHoles = hyp->GetToMeshHoles(); + _ToMergeSubdomains = hyp->GetToMergeSubdomains(); + _ToTagSubdomains = hyp->GetToTagSubdomains(); + _ToOutputInterfaces = hyp->GetToOutputInterfaces(); + _ToDiscardSubdomains = hyp->GetToDiscardSubdomains(); } } @@ -440,9 +443,171 @@ static TCollection_AsciiString getTmpDir() } //============================================================================= -// Here we are going to use the GHS3DPRL mesher +// Here we are going to use the GHS3DPRL mesher for tetra-hpc (formerly tepal in v3 (2014)) bool GHS3DPRLPlugin_GHS3DPRL::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape& theShape) +{ + bool Ok=false; + TCollection_AsciiString pluginerror("ghs3dprl: "); + SMESHDS_Mesh* meshDS = theMesh.GetMeshDS(); + //cout<<"GetMeshDS done\n"; + if (_countSubMesh==0){ + MESSAGE("GHS3DPRLPlugin_GHS3DPRL::Compute for tetra-hpc"); + _countTotal=0; + TopExp_Explorer expf(meshDS->ShapeToMesh(), TopAbs_SOLID); + for ( ; expf.More(); expf.Next() ) _countTotal++; + } + _countSubMesh++; + //cout<<"Compute _countSubMesh "<<_countSubMesh<0) { + path=casenamemed.SubString(1,n); + casenamemed=casenamemed.SubString(n+1,casenamemed.Length()); + } + else + path=tmpDir; + + if (casenamemed.Length()>20){ + casenamemed=casenamemed.SubString(1,20); + cerr<<"MEDName truncated (no more 20 characters) = "< avoid warning message + //med_idt fid=MEDouvrir((const char *)fileskinmed.ToCString(),MED_CREATION); + //med_err ret=MEDfermer(fid); + //fileskinmed=fileskinmed + "cp /home/wambeke/empty.med "+ path + "GHS3DPRL_skin.med"; + //system( fileskinmed.ToCString() ); + fileskinmed=path + "GHS3DPRL_skin.med"; + cout<<"Write file "< 0) { - //Processus père + //Processus p�re cout<<"le pere est la\n"; system("echo le pere > lepere.tmp"); system("sleep 10"); @@ -601,7 +768,7 @@ bool GHS3DPRLPlugin_GHS3DPRL::Compute(SMESH_Mesh& theMesh, } else if (pid == 0) { //Processus fils cout<<"le fils est la\n"; - //On rend le fils indépendant de tout terminal + //On rend le fils ind�pendant de tout terminal setsid(); system("sleep 20"); system("echo le fils > lefils.tmp"); diff --git a/src/GHS3DPRLPlugin/GHS3DPRLPlugin_GHS3DPRL.hxx b/src/GHS3DPRLPlugin/GHS3DPRLPlugin_GHS3DPRL.hxx index d82fbfe..e93a908 100755 --- a/src/GHS3DPRLPlugin/GHS3DPRLPlugin_GHS3DPRL.hxx +++ b/src/GHS3DPRLPlugin/GHS3DPRLPlugin_GHS3DPRL.hxx @@ -40,17 +40,16 @@ public: GHS3DPRLPlugin_GHS3DPRL(int hypId, int studyId, SMESH_Gen* gen); virtual ~GHS3DPRLPlugin_GHS3DPRL(); - virtual bool CheckHypothesis(SMESH_Mesh& aMesh, - const TopoDS_Shape& aShape, + virtual bool CheckHypothesis(SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape, SMESH_Hypothesis::Hypothesis_Status& aStatus); void SetParameters(const GHS3DPRLPlugin_Hypothesis* hyp); - virtual bool Compute(SMESH_Mesh& aMesh, - const TopoDS_Shape& aShape); + virtual bool Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape); + virtual bool ComputeForTepal(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape); //obsolescent - virtual bool Evaluate(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape, - MapShapeNbElems& aResMap); + virtual bool Evaluate(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape, MapShapeNbElems& aResMap); ostream & SaveTo(ostream & save); istream & LoadFrom(istream & load); @@ -68,7 +67,11 @@ private: int _NbPart; //number of partitions bool _KeepFiles; //tepal file .noboite binary or not bool _Background; //true for big meshes - bool _ToMeshHoles; + //ToMergeSubdomains ToTagSubdomains ToOutputInterfaces ToDiscardSubdomains + bool _ToMergeSubdomains; + bool _ToTagSubdomains; + bool _ToOutputInterfaces; + bool _ToDiscardSubdomains; }; #endif diff --git a/src/GHS3DPRLPlugin/GHS3DPRLPlugin_Hypothesis.cxx b/src/GHS3DPRLPlugin/GHS3DPRLPlugin_Hypothesis.cxx index 76b0e60..0cd578a 100755 --- a/src/GHS3DPRLPlugin/GHS3DPRLPlugin_Hypothesis.cxx +++ b/src/GHS3DPRLPlugin/GHS3DPRLPlugin_Hypothesis.cxx @@ -30,14 +30,16 @@ * */ //============================================================================= -GHS3DPRLPlugin_Hypothesis::GHS3DPRLPlugin_Hypothesis (int hypId, int studyId, - SMESH_Gen * gen) +GHS3DPRLPlugin_Hypothesis::GHS3DPRLPlugin_Hypothesis (int hypId, int studyId, SMESH_Gen * gen) : SMESH_Hypothesis(hypId, studyId, gen), _MEDName( GetDefaultMEDName() ), _NbPart( GetDefaultNbPart() ), _KeepFiles( GetDefaultKeepFiles() ), _Background( GetDefaultBackground() ), - _ToMeshHoles( GetDefaultToMeshHoles() ) + _ToMergeSubdomains( GetDefaultToMergeSubdomains() ), + _ToTagSubdomains( GetDefaultToTagSubdomains() ), + _ToOutputInterfaces( GetDefaultToOutputInterfaces() ), + _ToDiscardSubdomains( GetDefaultToDiscardSubdomains() ) { MESSAGE("GHS3DPRLPlugin_Hypothesis::GHS3DPRLPlugin_Hypothesis"); _name = "GHS3DPRL_Parameters"; @@ -114,11 +116,39 @@ void GHS3DPRLPlugin_Hypothesis::SetBackground(bool theVal) { } } -void GHS3DPRLPlugin_Hypothesis::SetToMeshHoles(bool theVal) { +/*void GHS3DPRLPlugin_Hypothesis::SetToMeshHoles(bool theVal) { if (theVal != _ToMeshHoles) { _ToMeshHoles = theVal; NotifySubMeshesHypothesisModification(); } +}*/ + +void GHS3DPRLPlugin_Hypothesis::SetToMergeSubdomains(bool theVal) { + if (theVal != _ToMergeSubdomains) { + _ToMergeSubdomains = theVal; + NotifySubMeshesHypothesisModification(); + } +} + +void GHS3DPRLPlugin_Hypothesis::SetToTagSubdomains(bool theVal) { + if (theVal != _ToTagSubdomains) { + _ToTagSubdomains = theVal; + NotifySubMeshesHypothesisModification(); + } +} + +void GHS3DPRLPlugin_Hypothesis::SetToOutputInterfaces(bool theVal) { + if (theVal != _ToOutputInterfaces) { + _ToOutputInterfaces = theVal; + NotifySubMeshesHypothesisModification(); + } +} + +void GHS3DPRLPlugin_Hypothesis::SetToDiscardSubdomains(bool theVal) { + if (theVal != _ToDiscardSubdomains) { + _ToDiscardSubdomains = theVal; + NotifySubMeshesHypothesisModification(); + } } @@ -137,7 +167,11 @@ std::ostream& GHS3DPRLPlugin_Hypothesis::SaveTo(std::ostream& save) //save without any whitespaces! save<<"MEDName="<<_MEDName<<";"; save<<"NbPart="<<_NbPart<<";"; - save<<"ToMeshHoles="<<(int) _ToMeshHoles<<";"; + //save<<"ToMeshHoles="<<(int) _ToMeshHoles<<";"; + save<<"ToMergeSubdomains="<<(int) _ToMergeSubdomains<<";"; + save<<"ToTagSubdomains="<<(int) _ToTagSubdomains<<";"; + save<<"ToOutputInterfaces="<<(int) _ToOutputInterfaces<<";"; + save<<"ToDiscardSubdomains="<<(int) _ToDiscardSubdomains<<";"; save<<"KeepFiles="<<(int) _KeepFiles<<";"; save<<"Background="<<(int) _Background<<";"; return save; @@ -174,7 +208,11 @@ std::istream& GHS3DPRLPlugin_Hypothesis::LoadFrom(std::istream& load) if (str3=="MEDName") _MEDName = str4.c_str(); if (str3=="NbPart") _NbPart = atoi(str4.c_str()); if (str3=="KeepFiles") _KeepFiles = (bool) atoi(str4.c_str()); - if (str3=="ToMeshHoles") _ToMeshHoles = (bool) atoi(str4.c_str()); + //if (str3=="ToMeshHoles") _ToMeshHoles = (bool) atoi(str4.c_str()); + if (str3=="ToMergeSubdomains") _ToMergeSubdomains = (bool) atoi(str4.c_str()); + if (str3=="ToTagSubdomains") _ToTagSubdomains = (bool) atoi(str4.c_str()); + if (str3=="ToOutputInterfaces") _ToOutputInterfaces = (bool) atoi(str4.c_str()); + if (str3=="ToDiscardSubdomains") _ToDiscardSubdomains = (bool) atoi(str4.c_str()); if (str3=="Background") _Background = (bool) atoi(str4.c_str()); } return load; @@ -252,7 +290,31 @@ bool GHS3DPRLPlugin_Hypothesis::GetDefaultBackground() } //============================================================================= -bool GHS3DPRLPlugin_Hypothesis::GetDefaultToMeshHoles() +//bool GHS3DPRLPlugin_Hypothesis::GetDefaultToMeshHoles() +//{ +// return false; +//} + +//============================================================================= +bool GHS3DPRLPlugin_Hypothesis::GetDefaultToMergeSubdomains() +{ + return false; +} + +//============================================================================= +bool GHS3DPRLPlugin_Hypothesis::GetDefaultToTagSubdomains() +{ + return false; +} + +//============================================================================= +bool GHS3DPRLPlugin_Hypothesis::GetDefaultToOutputInterfaces() +{ + return false; +} + +//============================================================================= +bool GHS3DPRLPlugin_Hypothesis::GetDefaultToDiscardSubdomains() { return false; } diff --git a/src/GHS3DPRLPlugin/GHS3DPRLPlugin_Hypothesis.hxx b/src/GHS3DPRLPlugin/GHS3DPRLPlugin_Hypothesis.hxx index 76f785d..a09e0c5 100755 --- a/src/GHS3DPRLPlugin/GHS3DPRLPlugin_Hypothesis.hxx +++ b/src/GHS3DPRLPlugin/GHS3DPRLPlugin_Hypothesis.hxx @@ -50,9 +50,19 @@ public: void SetBackground(bool theVal); bool GetBackground() const { return _Background; } - - void SetToMeshHoles(bool theVal); - bool GetToMeshHoles() const { return _ToMeshHoles; } + + //ToMergeSubdomains ToTagSubdomains ToOutputInterfaces ToDiscardSubdomains + void SetToMergeSubdomains(bool theVal); + bool GetToMergeSubdomains() const { return _ToMergeSubdomains; } + + void SetToTagSubdomains(bool theVal); + bool GetToTagSubdomains() const { return _ToTagSubdomains; } + + void SetToOutputInterfaces(bool theVal); + bool GetToOutputInterfaces() const { return _ToOutputInterfaces; } + + void SetToDiscardSubdomains(bool theVal); + bool GetToDiscardSubdomains() const { return _ToDiscardSubdomains; } // the parameters default values @@ -60,7 +70,10 @@ public: static int GetDefaultNbPart(); static bool GetDefaultKeepFiles(); static bool GetDefaultBackground(); - static bool GetDefaultToMeshHoles(); + static bool GetDefaultToMergeSubdomains(); + static bool GetDefaultToTagSubdomains(); + static bool GetDefaultToOutputInterfaces(); + static bool GetDefaultToDiscardSubdomains(); // Persistence virtual std::ostream& SaveTo(std::ostream& save); @@ -90,7 +103,10 @@ private: int _NbPart; // number of partitions bool _KeepFiles; // keep intermediates tepal files or not bool _Background; // tepal in background - bool _ToMeshHoles; -}; + bool _ToMergeSubdomains; + bool _ToTagSubdomains; + bool _ToOutputInterfaces; + bool _ToDiscardSubdomains; + }; #endif diff --git a/src/GHS3DPRLPlugin/GHS3DPRLPlugin_Hypothesis_i.cxx b/src/GHS3DPRLPlugin/GHS3DPRLPlugin_Hypothesis_i.cxx index cf66c1b..1a3bac8 100755 --- a/src/GHS3DPRLPlugin/GHS3DPRLPlugin_Hypothesis_i.cxx +++ b/src/GHS3DPRLPlugin/GHS3DPRLPlugin_Hypothesis_i.cxx @@ -37,16 +37,11 @@ */ //============================================================================= GHS3DPRLPlugin_Hypothesis_i:: -GHS3DPRLPlugin_Hypothesis_i (PortableServer::POA_ptr thePOA, - int theStudyId, - ::SMESH_Gen* theGenImpl) - : SALOME::GenericObj_i( thePOA ), - SMESH_Hypothesis_i( thePOA ) +GHS3DPRLPlugin_Hypothesis_i (PortableServer::POA_ptr thePOA, int theStudyId, ::SMESH_Gen* theGenImpl) + : SALOME::GenericObj_i( thePOA ), SMESH_Hypothesis_i( thePOA ) { MESSAGE( "GHS3DPRLPlugin_Hypothesis_i::GHS3DPRLPlugin_Hypothesis_i" ); - myBaseImpl = new ::GHS3DPRLPlugin_Hypothesis (theGenImpl->GetANewId(), - theStudyId, - theGenImpl); + myBaseImpl = new ::GHS3DPRLPlugin_Hypothesis (theGenImpl->GetANewId(), theStudyId, theGenImpl); } //============================================================================= @@ -67,7 +62,10 @@ GHS3DPRLPlugin_Hypothesis_i::~GHS3DPRLPlugin_Hypothesis_i() * GHS3DPRLPlugin_Hypothesis_i::SetNbPart * GHS3DPRLPlugin_Hypothesis_i::SetKeepFiles * GHS3DPRLPlugin_Hypothesis_i::SetBackground - * GHS3DPRLPlugin_Hypothesis_i::SetToMeshHoles + * GHS3DPRLPlugin_Hypothesis_i::SetToMergeSubdomains + * GHS3DPRLPlugin_Hypothesis_i::SetToTagSubdomains + * GHS3DPRLPlugin_Hypothesis_i::SetToOutputInterfaces + * GHS3DPRLPlugin_Hypothesis_i::SetToDiscardSubdomains */ //============================================================================= @@ -103,12 +101,36 @@ void GHS3DPRLPlugin_Hypothesis_i::SetBackground (CORBA::Boolean theValue) SMESH::TPythonDump() << _this() << ".SetBackground( " << theValue << " )"; } -void GHS3DPRLPlugin_Hypothesis_i::SetToMeshHoles (CORBA::Boolean theValue) +void GHS3DPRLPlugin_Hypothesis_i::SetToMergeSubdomains (CORBA::Boolean theValue) { - MESSAGE("GHS3DPRLPlugin_Hypothesis_i::SetToMeshHoles"); + MESSAGE("GHS3DPRLPlugin_Hypothesis_i::SetToMergeSubdomains"); ASSERT(myBaseImpl); - this->GetImpl()->SetToMeshHoles(theValue); - SMESH::TPythonDump() << _this() << ".SetToMeshHoles( " << theValue << " )"; + this->GetImpl()->SetToMergeSubdomains(theValue); + SMESH::TPythonDump() << _this() << ".SetToMergeSubdomains( " << theValue << " )"; +} + +void GHS3DPRLPlugin_Hypothesis_i::SetToTagSubdomains (CORBA::Boolean theValue) +{ + MESSAGE("GHS3DPRLPlugin_Hypothesis_i::SetToTagSubdomains"); + ASSERT(myBaseImpl); + this->GetImpl()->SetToTagSubdomains(theValue); + SMESH::TPythonDump() << _this() << ".SetToTagSubdomains( " << theValue << " )"; +} + +void GHS3DPRLPlugin_Hypothesis_i::SetToOutputInterfaces (CORBA::Boolean theValue) +{ + MESSAGE("GHS3DPRLPlugin_Hypothesis_i::SetToOutputInterfaces"); + ASSERT(myBaseImpl); + this->GetImpl()->SetToOutputInterfaces(theValue); + SMESH::TPythonDump() << _this() << ".SetToOutputInterfaces( " << theValue << " )"; +} + +void GHS3DPRLPlugin_Hypothesis_i::SetToDiscardSubdomains (CORBA::Boolean theValue) +{ + MESSAGE("GHS3DPRLPlugin_Hypothesis_i::SetToDiscardSubdomains"); + ASSERT(myBaseImpl); + this->GetImpl()->SetToDiscardSubdomains(theValue); + SMESH::TPythonDump() << _this() << ".SetToDiscardSubdomains( " << theValue << " )"; } //============================================================================= @@ -117,7 +139,10 @@ void GHS3DPRLPlugin_Hypothesis_i::SetToMeshHoles (CORBA::Boolean theValue) * GHS3DPRLPlugin_Hypothesis_i::GetNbPart * GHS3DPRLPlugin_Hypothesis_i::GetKeepFiles * GHS3DPRLPlugin_Hypothesis_i::GetBackground - * GHS3DPRLPlugin_Hypothesis_i::GetToMeshHoles + * GHS3DPRLPlugin_Hypothesis_i::GetToMergeSubdomains + * GHS3DPRLPlugin_Hypothesis_i::GetToTagSubdomains + * GHS3DPRLPlugin_Hypothesis_i::GetToOutputInterfaces + * GHS3DPRLPlugin_Hypothesis_i::GetToDiscardSubdomains */ //============================================================================= @@ -151,11 +176,32 @@ CORBA::Boolean GHS3DPRLPlugin_Hypothesis_i::GetBackground() return this->GetImpl()->GetBackground(); } -CORBA::Boolean GHS3DPRLPlugin_Hypothesis_i::GetToMeshHoles() +CORBA::Boolean GHS3DPRLPlugin_Hypothesis_i::GetToMergeSubdomains() +{ + MESSAGE("GHS3DPRLPlugin_Hypothesis_i::GetToMergeSubdomains"); + ASSERT(myBaseImpl); + return this->GetImpl()->GetToMergeSubdomains(); +} + +CORBA::Boolean GHS3DPRLPlugin_Hypothesis_i::GetToTagSubdomains() +{ + MESSAGE("GHS3DPRLPlugin_Hypothesis_i::GetToTagSubdomains"); + ASSERT(myBaseImpl); + return this->GetImpl()->GetToTagSubdomains(); +} + +CORBA::Boolean GHS3DPRLPlugin_Hypothesis_i::GetToOutputInterfaces() +{ + MESSAGE("GHS3DPRLPlugin_Hypothesis_i::GetToOutputInterfaces"); + ASSERT(myBaseImpl); + return this->GetImpl()->GetToOutputInterfaces(); +} + +CORBA::Boolean GHS3DPRLPlugin_Hypothesis_i::GetToDiscardSubdomains() { - MESSAGE("GHS3DPRLPlugin_Hypothesis_i::GetToMeshHoles"); + MESSAGE("GHS3DPRLPlugin_Hypothesis_i::GetToDiscardSubdomains"); ASSERT(myBaseImpl); - return this->GetImpl()->GetToMeshHoles(); + return this->GetImpl()->GetToDiscardSubdomains(); } //============================================================================= diff --git a/src/GHS3DPRLPlugin/GHS3DPRLPlugin_Hypothesis_i.hxx b/src/GHS3DPRLPlugin/GHS3DPRLPlugin_Hypothesis_i.hxx index a62a189..70cc6f8 100755 --- a/src/GHS3DPRLPlugin/GHS3DPRLPlugin_Hypothesis_i.hxx +++ b/src/GHS3DPRLPlugin/GHS3DPRLPlugin_Hypothesis_i.hxx @@ -43,9 +43,7 @@ class GHS3DPRLPLUGIN_EXPORT GHS3DPRLPlugin_Hypothesis_i: { public: // Constructor - GHS3DPRLPlugin_Hypothesis_i (PortableServer::POA_ptr thePOA, - int theStudyId, - ::SMESH_Gen* theGenImpl); + GHS3DPRLPlugin_Hypothesis_i (PortableServer::POA_ptr thePOA, int theStudyId, ::SMESH_Gen* theGenImpl); // Destructor virtual ~GHS3DPRLPlugin_Hypothesis_i(); @@ -62,8 +60,17 @@ class GHS3DPRLPLUGIN_EXPORT GHS3DPRLPlugin_Hypothesis_i: void SetBackground(CORBA::Boolean theVal); CORBA::Boolean GetBackground(); - void SetToMeshHoles(CORBA::Boolean theVal); - CORBA::Boolean GetToMeshHoles(); + void SetToMergeSubdomains(CORBA::Boolean theVal); + CORBA::Boolean GetToMergeSubdomains(); + + void SetToTagSubdomains(CORBA::Boolean theVal); + CORBA::Boolean GetToTagSubdomains(); + + void SetToOutputInterfaces(CORBA::Boolean theVal); + CORBA::Boolean GetToOutputInterfaces(); + + void SetToDiscardSubdomains(CORBA::Boolean theVal); + CORBA::Boolean GetToDiscardSubdomains(); // Get implementation ::GHS3DPRLPlugin_Hypothesis* GetImpl(); diff --git a/src/gui/GHS3DPRLPluginGUI_HypothesisCreator.cxx b/src/gui/GHS3DPRLPluginGUI_HypothesisCreator.cxx index 12b9d79..a4026d9 100755 --- a/src/gui/GHS3DPRLPluginGUI_HypothesisCreator.cxx +++ b/src/gui/GHS3DPRLPluginGUI_HypothesisCreator.cxx @@ -46,7 +46,7 @@ GHS3DPRLPluginGUI_HypothesisCreator::GHS3DPRLPluginGUI_HypothesisCreator( const : SMESHGUI_GenericHypothesisCreator( theHypType ), myIs3D( true ) { - printf("Hypo creator !!!!!!!!!!!!!!!!!!!!!!!!!! RNV"); + printf("Hypo creator GHS3DPRLPlugin"); } GHS3DPRLPluginGUI_HypothesisCreator::~GHS3DPRLPluginGUI_HypothesisCreator() @@ -113,9 +113,25 @@ QFrame* GHS3DPRLPluginGUI_HypothesisCreator::buildFrame() myBackground->setWhatsThis( tr( "GHS3DPRL_WhatsThis_Background" ) ); l->addWidget( myBackground, row++, 0, 1, 2 ); - myToMeshHoles = new QCheckBox( tr( "GHS3DPRL_ToMeshHoles" ), GroupC1 ); - myToMeshHoles->setWhatsThis( tr( "GHS3DPRL_WhatsThis_ToMeshHoles" ) ); - l->addWidget( myToMeshHoles, row++, 0, 1, 2 ); + //myToMeshHoles = new QCheckBox( tr( "GHS3DPRL_ToMeshHoles" ), GroupC1 ); + //myToMeshHoles->setWhatsThis( tr( "GHS3DPRL_WhatsThis_ToMeshHoles" ) ); + //l->addWidget( myToMeshHoles, row++, 0, 1, 2 ); + + myToMergeSubdomains = new QCheckBox( tr( "GHS3DPRL_ToMergeSubdomains" ), GroupC1 ); + myToMergeSubdomains->setWhatsThis( tr( "GHS3DPRL_WhatsThis_ToMergeSubdomains" ) ); + l->addWidget( myToMergeSubdomains, row++, 0, 1, 2 ); + + myToTagSubdomains = new QCheckBox( tr( "GHS3DPRL_ToTagSubdomains" ), GroupC1 ); + myToTagSubdomains->setWhatsThis( tr( "GHS3DPRL_WhatsThis_ToTagSubdomains" ) ); + l->addWidget( myToTagSubdomains, row++, 0, 1, 2 ); + + myToOutputInterfaces = new QCheckBox( tr( "GHS3DPRL_ToOutputInterfaces" ), GroupC1 ); + myToOutputInterfaces->setWhatsThis( tr( "GHS3DPRL_WhatsThis_ToOutputInterfaces" ) ); + l->addWidget( myToOutputInterfaces, row++, 0, 1, 2 ); + + myToDiscardSubdomains = new QCheckBox( tr( "GHS3DPRL_ToDiscardSubdomains" ), GroupC1 ); + myToDiscardSubdomains->setWhatsThis( tr( "GHS3DPRL_WhatsThis_ToDiscardSubdomains" ) ); + l->addWidget( myToDiscardSubdomains, row++, 0, 1, 2 ); myIs3D = true; @@ -132,7 +148,11 @@ void GHS3DPRLPluginGUI_HypothesisCreator::retrieveParams() const myNbPart->setValue( data.myNbPart ); myKeepFiles->setChecked( data.myKeepFiles ); myBackground->setChecked( data.myBackground ); - myToMeshHoles->setChecked( data.myToMeshHoles ); + //myToMeshHoles->setChecked( data.myToMeshHoles ); + myToMergeSubdomains->setChecked( data.myToMergeSubdomains ); + myToTagSubdomains->setChecked( data.myToTagSubdomains ); + myToOutputInterfaces->setChecked( data.myToOutputInterfaces ); + myToDiscardSubdomains->setChecked( data.myToDiscardSubdomains ); //myNbPart->setEnabled( true ); } @@ -145,7 +165,11 @@ QString GHS3DPRLPluginGUI_HypothesisCreator::storeParams() const QString valStr; valStr += tr( "GHS3DPRL_MEDName" ) + " = " + data.myMEDName + "; "; valStr += tr( "GHS3DPRL_NbPart" ) + " = " + QString::number( data.myNbPart ) + "; "; - valStr += tr( "GHS3DPRL_ToMeshHoles" ) + " = " + QString::number( data.myToMeshHoles ) + "; "; + //valStr += tr( "GHS3DPRL_ToMeshHoles" ) + " = " + QString::number( data.myToMeshHoles ) + "; "; + valStr += tr( "GHS3DPRL_ToMergeSubdomains" ) + " = " + QString::number( data.myToMergeSubdomains ) + "; "; + valStr += tr( "GHS3DPRL_ToTagSubdomains" ) + " = " + QString::number( data.myToTagSubdomains ) + "; "; + valStr += tr( "GHS3DPRL_ToOutputInterfaces" ) + " = " + QString::number( data.myToOutputInterfaces ) + "; "; + valStr += tr( "GHS3DPRL_ToDiscardSubdomains" ) + " = " + QString::number( data.myToDiscardSubdomains ) + "; "; valStr += tr( "GHS3DPRL_KeepFiles" ) + " = " + QString::number( data.myKeepFiles ) + "; "; valStr += tr( "GHS3DPRL_Background" ) + " = " + QString::number( data.myBackground ) + "; "; @@ -163,7 +187,11 @@ bool GHS3DPRLPluginGUI_HypothesisCreator::readParamsFromHypo( GHS3DPRLHypothesis h_data.myNbPart = h->GetNbPart(); h_data.myKeepFiles = h->GetKeepFiles(); h_data.myBackground = h->GetBackground(); - h_data.myToMeshHoles = h->GetToMeshHoles(); + //h_data.myToMeshHoles = h->GetToMeshHoles(); + h_data.myToMergeSubdomains = h->GetToMergeSubdomains(); + h_data.myToTagSubdomains = h->GetToTagSubdomains(); + h_data.myToOutputInterfaces = h->GetToOutputInterfaces(); + h_data.myToDiscardSubdomains = h->GetToDiscardSubdomains(); return true; } @@ -183,7 +211,11 @@ bool GHS3DPRLPluginGUI_HypothesisCreator::storeParamsToHypo( const GHS3DPRLHypot h->SetNbPart( h_data.myNbPart ); h->SetKeepFiles( h_data.myKeepFiles ); h->SetBackground( h_data.myBackground ); - h->SetToMeshHoles( h_data.myToMeshHoles ); + //h->SetToMeshHoles( h_data.myToMeshHoles ); + h->SetToMergeSubdomains( h_data.myToMergeSubdomains ); + h->SetToTagSubdomains( h_data.myToTagSubdomains ); + h->SetToOutputInterfaces( h_data.myToOutputInterfaces ); + h->SetToDiscardSubdomains( h_data.myToDiscardSubdomains ); } catch ( const SALOME::SALOME_Exception& ex ) { @@ -200,7 +232,11 @@ bool GHS3DPRLPluginGUI_HypothesisCreator::readParamsFromWidgets( GHS3DPRLHypothe h_data.myNbPart = myNbPart->value(); h_data.myKeepFiles = myKeepFiles->isChecked(); h_data.myBackground = myBackground->isChecked(); - h_data.myToMeshHoles = myToMeshHoles->isChecked(); + //h_data.myToMeshHoles = myToMeshHoles->isChecked(); + h_data.myToMergeSubdomains = myToMergeSubdomains->isChecked(); + h_data.myToTagSubdomains = myToTagSubdomains->isChecked(); + h_data.myToOutputInterfaces = myToOutputInterfaces->isChecked(); + h_data.myToDiscardSubdomains = myToDiscardSubdomains->isChecked(); return true; } diff --git a/src/gui/GHS3DPRLPluginGUI_HypothesisCreator.h b/src/gui/GHS3DPRLPluginGUI_HypothesisCreator.h index 558c32c..d5bbf1c 100755 --- a/src/gui/GHS3DPRLPluginGUI_HypothesisCreator.h +++ b/src/gui/GHS3DPRLPluginGUI_HypothesisCreator.h @@ -49,7 +49,11 @@ typedef struct int myNbPart; bool myKeepFiles; bool myBackground; - bool myToMeshHoles; + //bool myToMeshHoles; + bool myToMergeSubdomains; + bool myToTagSubdomains; + bool myToOutputInterfaces; + bool myToDiscardSubdomains; } GHS3DPRLHypothesisData; /*! @@ -86,7 +90,11 @@ private: QtxIntSpinBox* myNbPart; QCheckBox* myKeepFiles; QCheckBox* myBackground; - QCheckBox* myToMeshHoles; + //QCheckBox* myToMeshHoles; + QCheckBox* myToMergeSubdomains; + QCheckBox* myToTagSubdomains; + QCheckBox* myToOutputInterfaces; + QCheckBox* myToDiscardSubdomains; bool myIs3D; }; diff --git a/src/gui/GHS3DPRLPlugin_msg_en.ts b/src/gui/GHS3DPRLPlugin_msg_en.ts index 1cc4e4f..7bdea86 100644 --- a/src/gui/GHS3DPRLPlugin_msg_en.ts +++ b/src/gui/GHS3DPRLPlugin_msg_en.ts @@ -17,11 +17,27 @@ GHS3DPRL_Background - Tepal in background + Tetra_hpc in background GHS3DPRL_ToMeshHoles - To mesh holes + Mesh holes + + + GHS3DPRL_ToMergeSubdomains + Merge subdomains + + + GHS3DPRL_ToTagSubdomains + Tag subdomains + + + GHS3DPRL_ToOutputInterfaces + Output interfaces + + + GHS3DPRL_ToDiscardSubdomains + Discard subdomains GHS3DPRL_MEDName diff --git a/src/tepal2med/CMakeLists.txt b/src/tepal2med/CMakeLists.txt index f4bdd03..ba53f7b 100644 --- a/src/tepal2med/CMakeLists.txt +++ b/src/tepal2med/CMakeLists.txt @@ -66,9 +66,11 @@ SET(_other_SOURCES ghs3dprl_mesh_wrap.cxx ghs3dprl_msg_parser.cxx dlg_ghs3dmain.cxx - tepal2med.cxx ) +# tepal2med.cxx +# tetrahpc2med.cxx + # resource files / to be processed by uic SET(_uic_files dlg_ghs3dmain.ui @@ -78,10 +80,13 @@ SET(_uic_files QT4_WRAP_UI(_uic_HEADERS ${_uic_files}) # sources / to compile -SET(tepal2med_SOURCES ${_other_SOURCES} ${_moc_SOURCES} ${_uic_HEADERS}) +SET(tepal2med_SOURCES tepal2med.cxx ${_other_SOURCES} ${_moc_SOURCES} ${_uic_HEADERS}) +SET(tetrahpc2med_SOURCES tetrahpc2med.cxx ${_other_SOURCES} ${_moc_SOURCES} ${_uic_HEADERS}) # --- rules --- ADD_EXECUTABLE(tepal2med ${tepal2med_SOURCES}) +ADD_EXECUTABLE(tetrahpc2med ${tetrahpc2med_SOURCES}) TARGET_LINK_LIBRARIES(tepal2med ${_link_LIBRARIES}) -INSTALL(TARGETS tepal2med EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_BINS}) +TARGET_LINK_LIBRARIES(tetrahpc2med ${_link_LIBRARIES}) +INSTALL(TARGETS tepal2med tetrahpc2med EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_BINS}) diff --git a/src/tepal2med/ghs3dprl_mesh_wrap.cxx b/src/tepal2med/ghs3dprl_mesh_wrap.cxx index d3a344f..79e03bd 100755 --- a/src/tepal2med/ghs3dprl_mesh_wrap.cxx +++ b/src/tepal2med/ghs3dprl_mesh_wrap.cxx @@ -448,6 +448,40 @@ bool CVW_FindString(const std::string &str,std::fstream &Ff, long &count) return true; } +//************************************ +bool CVW_FindStringInFirstLines(const std::string &str,std::fstream &Ff, long &maxline) +//find in file maximum maxline first lines with string str in first position of line +//converts count value expected after " " in line found +{ + std::string line; + long nbLine=0; + do + { + if (getline(Ff,line)) + { + nbLine++; + if (line[0]==str[0]) //faster + { + if (line.find(str)==0) + { + return true; + } + } + if (nbLine>=maxline) + { + std::cerr<<"Problem line '"< for speed (and so no test) +{ + QString tmp; + std::fstream Ff(FileName.toLatin1().constData(),std::ios_base::in); + std::string line; + long i,count,meshversion,maxline; + bool ok; + + if (!Ff.is_open()) + { + std::cerr<<"Problem File '"<2) std::cout<<"MeshVersionFormatted_"<nofile<<" ok"<nbfiles++; + return true; +} + ///************************************ bool ghs3dprl_mesh_wrap::ReadFileGLO(const QString FileName) //read file .glo with no parser xml because big file (volume) @@ -645,6 +707,171 @@ bool ghs3dprl_mesh_wrap::ReadFileFACES(const QString FileName) return true; } +//************************************ +bool ghs3dprl_mesh_wrap::ReadFileMESH(const QString FileName) +//read file .mesh from tetra_hpc (with volume) +{ + std::string line(" "); + QString tmp; + std::fstream Ff(FileName.toLatin1().constData(),std::ios_base::in); + long Mversion=0,Mdim=0,Mvert=0,Mtria=0,Mtetra=0; + med_int garbage; + //long ne,np,npfixe,subnumber,reste; + bool ok; + if (verbose>=6)std::cout<<"Read File '"<>tmflo[i]>>tmflo[i+1]>>tmflo[i+2]>>garbage; + if (verbose>4) std::cout<<"Vertices "<nofile); + ok=this->insert_key(tmp,montab); + + getline(Ff,line); + getline(Ff,line); + + if (!(getline(Ff,line) && (line.find("Triangles")==0))) + { + std::cerr<<"Problem on line 'Triangles' of file: not found"<>tmint[i]>>tmint[i+1]>>tmint[i+2]>>garbage; + tmint[i+3]=0; + tmint[i+4]=0; + tmint[i+5]=0; + tmint[i+6]=0; + } + if (verbose>4) std::cout<<"Triangles "<nofile); + ok=this->insert_key(tmp,montab); + + getline(Ff,line); + getline(Ff,line); + + if (!(getline(Ff,line) && (line.find("Tetrahedra")==0))) + { + std::cerr<<"Problem on line 'Tetrahedra' of file: not found"<=2) + { + std::cout<<"MeshVersionFormatted="<nofile); + ok=this->insert_key(tmp,montab); + + //swap on file if too big for memory in one cpu + //default 1GOctet/8(for double)/10(for arrays in memory at the same time) + if (Mvert*3>this->nbelem_limit_swap) + this->SwapOutOfMemory_key_mesh_wrap(QRegExp("NB",Qt::CaseSensitive,QRegExp::RegExp)); + //beware record 6 lenght 1 + //ferme le fichier : + Ff.close(); + this->nbfiles++; + return true; +} + //************************************ bool ghs3dprl_mesh_wrap::ReadFileNOBOITE(const QString FileName) //read file .noboite (volume) @@ -1381,7 +1608,7 @@ bool ghs3dprl_mesh_wrap::Write_masterxmlMEDfile() //Description tag node = xmlNewChild(root_node,0, BAD_CAST "description",0); - xmlNewProp(node, BAD_CAST "what", BAD_CAST "tetrahedral mesh by tepal"); + xmlNewProp(node, BAD_CAST "what", BAD_CAST "tetrahedral mesh by MeshGems-Tetra-hpc (formerly tepal)"); #ifdef WIN32 SYSTEMTIME present; GetLocalTime ( &present ); @@ -1522,7 +1749,8 @@ bool ghs3dprl_mesh_wrap::Write_MEDfiles_v2(bool deletekeys) cmd.toLatin1().constData()<<"> does not exist\n"; } //define family 0 if not existing, no groups - families.add("0",""); + //La famille FAMILLE_ZERO n'a pas été trouvée, elle est obligatoire + families.add("0","FAMILLE_ZERO"); //define family Group_of_New_Nodes (which not exists before tetrahedra) famallnodes=0; if (QString("All_Nodes").contains(deletegroups)==0){ @@ -1647,6 +1875,7 @@ bool ghs3dprl_mesh_wrap::Write_MEDfiles_v2(bool deletekeys) MEDfileClose(fid); //but loop on others domains } + MEDfileClose(fidjoint); //no error if (verbose>0)std::cout<<"\nTotalNumberOftetrahedra="<restore_key(key); //tab1=this->mestab[key1]; if (!tab) { - tmp=pathini+casename+tmp.sprintf(format.toLatin1().constData(),nbfilestot,idom)+".noboite"; - ok=this->ReadFileNOBOITE(tmp); + if (!for_tetrahpc) { + tmp=pathini+casename+tmp.sprintf(format.toLatin1().constData(),nbfilestot,idom)+".noboite"; + ok=this->ReadFileNOBOITE(tmp); + } + if (for_tetrahpc) { + tmp=pathini+casename+tmp.sprintf(format_tetra.toLatin1().constData(),idom)+".mesh"; + ok=this->ReadFileMESH(tmp); + } tab=this->restore_key(key); //tab1=this->mestab[key1]; if (!tab) return false; } @@ -1690,8 +1925,14 @@ bool ghs3dprl_mesh_wrap::idom_nodes() key1=key1.sprintf("GL%d VE",idom); //global numerotation tab1=this->restore_key(key1); //tab1=this->mestab[key1]; if (!tab1) { - tmp=pathini+casename+tmp.sprintf(format.toLatin1().constData(),nbfilestot,idom)+".glo"; - ok=this->ReadFileGLO(tmp); + if (!for_tetrahpc) { + tmp=pathini+casename+tmp.sprintf(format.toLatin1().constData(),nbfilestot,idom)+".glo"; + ok=this->ReadFileGLO(tmp); + } + if (for_tetrahpc) { + tmp=pathini+casename+tmp.sprintf(format_tetra.toLatin1().constData(),idom)+".glo"; + ok=this->ReadFileGLO(tmp); + } if (!ok) {std::cerr<<"Problem file "<restore_key(key1); //tab1=this->mestab[key1]; if (!tab1) return false; @@ -1942,17 +2183,14 @@ bool ghs3dprl_mesh_wrap::idom_joints() //qt3 if (this->nb_key_mesh_wrap(QRegExp(tmp,true,true))<=0) { if (this->nb_key_mesh_wrap(QRegExp(tmp,Qt::CaseSensitive,QRegExp::RegExp))<=0) { this->nofile=idom; - /*old version with xml parser too slow - ghs3dprl_msg_parser handler; - handler.mailw=this; - QXmlSimpleReader reader; - reader.setContentHandler(&handler); - tmp=pathini+casename+tmp.sprintf(format,nbfilestot,idom)+".msg"; - QFile File(tmp); - QXmlInputSource source(&File); - reader.parse(source); - File.close();*/ - tmp=pathini+casename+tmp.sprintf(format.toLatin1().constData(),nbfilestot,idom)+".msg"; + + if (!for_tetrahpc) { + tmp=pathini+casename+tmp.sprintf(format.toLatin1().constData(),nbfilestot,idom)+".msg"; + } + if (for_tetrahpc) { + tmp=pathini+casename+tmp.sprintf(format_tetra.toLatin1().constData(),idom)+".msg"; + } + ok=this->ReadFileMSGnew(tmp); if (!ok) { std::cerr<<"Problem in file "<restore_key(key1); //if not yet loaded (first time) try to load necessary file msg of neighbourg if (!tab2) { - tmp=pathini+casename+tmp.sprintf(format.toLatin1().constData(),nbfilestot,ineig)+".msg"; + + if (!for_tetrahpc) { + tmp=pathini+casename+tmp.sprintf(format.toLatin1().constData(),nbfilestot,ineig)+".msg"; + } + if (for_tetrahpc) { + tmp=pathini+casename+tmp.sprintf(format_tetra.toLatin1().constData(),ineig)+".msg"; + } + this->nofile=ineig; //neighbourg file ok=this->ReadFileMSGnew(tmp); this->nofile=idom; //restaure initial domain @@ -2019,14 +2264,14 @@ bool ghs3dprl_mesh_wrap::idom_joints() //two indices for one correspondence arrayi=new med_int[nb*2]; arraynodes=new med_float[nbnodesneig*3]; //for file DOMAIN_join.med - inodes=new med_int[nbnodes]; //for file DOMAIN_join.med + inodes=new med_int[nbnodes]; //for file DOMAIN_join.med med_int * fammore=new med_int[nbnodes]; - for (i=0; i equals tab1->tmint[i]==tab2->tmint[i] - j=tab1->tmint[i]-1; //contents of tab1 1 to nb - inodes[j]=k; k++; //indices 0->n-1 of nodes of joint from nodes of domain + j=tab1->tmint[i]-1; //contents of tab1 1->nb, j 0->nb-1 + inodes[j]=k; k++; //contents of inodes 1->n ,nodes of joint from nodes of domain arraynodes[jj]=tab->tmflo[j*3]; jj++; arraynodes[jj]=tab->tmflo[j*3+1]; jj++; arraynodes[jj]=tab->tmflo[j*3+2]; jj++; @@ -2061,7 +2306,7 @@ bool ghs3dprl_mesh_wrap::idom_joints() key1=key1.sprintf("MS%d NE%d FA SE",ineig,idom); //SE or RE identicals tab2=this->restore_key(key1); if (!tab2) std::cerr<<"Problem existing triangles of joint in domain "<size; nbtria3neig=tab2->size; if (nb!=nbtria3neig) { std::cerr<<"Problem in file "<restore_key(key); //tab1=this->mestab[key1]; med_int nb=tab1->size; nbtria3neig=nb; - if (verbose>4) - std::cout<<"NumberOfTrianglesOfJoint_"<=0) std::cout<<"NumberOfTrianglesOfJoint_"<tmint[i]; ii++; + arrayi[ii]=tab2->tmint[i]; ii++; //correspondance indices triangles in 2 domains + fammore[tab1->tmint[i]-1]=famjoint; //famtria3[tab1->tmint[i]-1]=famjoint; - arrayi[ii]=tab2->tmint[i]; ii++; - //std::cout<tmint[i]-1)*7; //indice of node connectivity - arrayfaces[jj]=inodes[tab->tmint[k]-1]+1; jj++; - arrayfaces[jj]=inodes[tab->tmint[k+1]-1]+1; jj++; - arrayfaces[jj]=inodes[tab->tmint[k+2]-1]+1; jj++; + + k=tab1->tmint[i]-1; //indice of node connectivity + //std::cout<<"k="<tmint[k]-1]; jj++; + arrayfaces[jj]=inodes[tab->tmint[k+1]-1]; jj++; + arrayfaces[jj]=inodes[tab->tmint[k+2]-1]; jj++; + } + int happens=0; + for (i=0; isize ; i++) std::cout<<"triangle i "<tmint[i]<size ; i=i+7) std::cout<<"conn i "<tmint[i]<<" "<tmint[i+1]<<" "<tmint[i+2]<0) { //for (i=0; i5) - std::cout<<"CreateFamilyInMEDFile <"<\tNbGroups="<\tNbGroups="<5)std::cout<name; + char attdes[MED_COMMENT_SIZE+1]="_NO_DESCRIPTION"; + + char *gro; + med_int i,attide=1,attval=1,natt=1,num=0,ngro=0; + + gro=new char[MED_LNAME_SIZE*ngro+2]; + if (verbose>3)std::cout<<"\ncreate_family_ZERO "<verbose>3){ med_float *coo=new med_float[nnoe*sdim]; /* table des numeros de familles des noeuds profil : (nombre de noeuds) */ med_int *famnodesskin=new med_int[nnoe]; - med_int *pfltab=new med_int[1]; //inutilise car on lit tout + //med_int *pfltab=new med_int[1]; //inutilise car on lit tout //lecture des noeuds : coordonnees ret=MEDmeshNodeCoordinateRd(fid,mymailw->nommaa,MED_NO_DT,MED_NO_IT,MED_FULL_INTERLACE,coo); //mdim,coo,mode_coo,MED_ALL,pfltab,0,&rep,mymailw->nomcoo,mymailw->unicoo); @@ -378,10 +379,10 @@ if (mymailw->verbose>3){ } std::cout<nommaa,MED_NO_DT,MED_NO_IT, - MED_CELL,MED_TRIA3,MED_NODAL,MED_FULL_INTERLACE,pfltab); + MED_CELL,MED_TRIA3,MED_NODAL,MED_FULL_INTERLACE,conn3); //MEDconnLire(fid,mymailw->nommaa,mdim,conn3,mode_coo,pfltab,0,MED_MAILLE,MED_TRIA3,MED_NOD); if (ret < 0){ std::cerr<<"Problem reading MED_TRIA3\n"; @@ -529,7 +530,7 @@ int main(int argc, char *argv[]) QString path,pathini,casename,casenamemed,fileskinmed, tmp,cmd,format, test,menu,launchtepal,background,deletegroups, - version="V2.0 (MED3)"; + version="V3.0 (MED3+tepalv1)"; char *chelp=NULL, *ccasename=NULL, @@ -667,7 +668,7 @@ int main(int argc, char *argv[]) if (menu=="yes") { QApplication a(argc,argv); dlg_ghs3dmain *m = new dlg_ghs3dmain(); - m->setWindowTitle("tepal2med 2.1"); + m->setWindowTitle("tepal2med 3.0"); m->show(); a.exec(); if ( m->result() == QDialog::Accepted ) { @@ -776,6 +777,8 @@ int main(int argc, char *argv[]) int nbf=format.length(); format=format.sprintf(".%%.%dd.%%.%dd",nbf,nbf); mymailw->format=format; + mymailw->format_tetra=format; //here is tepal: not used + mymailw->for_tetrahpc=false; //to know what files to read: .noboite or .mesh //something like "/home/wambeke/tmp/GHS3DPRL_skin.med" fileskinmed=pathini+casename+"_skin.med"; diff --git a/src/tepal2med/tetrahpc2med.cxx b/src/tepal2med/tetrahpc2med.cxx new file mode 100755 index 0000000..7bcfc58 --- /dev/null +++ b/src/tepal2med/tetrahpc2med.cxx @@ -0,0 +1,830 @@ +// Copyright (C) 2007-2013 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +// --- +// File : tetrahpc2med.cxx +// Author : Christian VAN WAMBEKE (CEA) +// --- +// +/* +** prog principal de ghs3dprl +*/ + +#include /* printf clrscr fopen fread fwrite fclose */ +#include +#include +#include +#include +#include +#include +#include +#ifndef WIN32 +#include +#endif + +#include + +#include +#include +#include + +#include "ghs3dprl_msg_parser.h" +#include "dlg_ghs3dmain.h" + +#ifdef WIN32 +#include +#include +#define F_OK 0 +#endif + +//#include "MEDMEM_Exception.hxx" +//#include "MEDMEM_define.hxx" + +extern "C" { +#include +//#include +//#include +//#include +} + +//************************************ +med_idt ouvre_fichier_MED(char *fichier,int verbose) +{ + med_idt fid = 0; + med_err ret = 0; + med_int majeur,mineur,release; + + /* on regarde si le fichier existe */ + ret = (int) access(fichier,F_OK); + if (ret < 0) return fid; + + /* on regarde s'il s'agit d'un fichier au format HDF5 */ + med_bool hdfok,medok; + ret = MEDfileCompatibility(fichier,&hdfok,&medok); + if (ret < 0){ + std::cerr<<"File "<0)fprintf(stdout,"\nReading %s with MED V%d.%d.%d", + fichier,majeur,mineur,release); + + /* Ouverture du fichier MED en lecture seule */ + fid = MEDfileOpen(fichier,MED_ACC_RDONLY); + if (ret < 0) return fid; + + MEDfileNumVersionRd(fid, &majeur, &mineur, &release); + if (majeur < 2 || majeur == 2 && mineur < 2) { + fprintf(stderr,"File %s from MED V%d.%d.%d not assumed\n", + fichier,majeur,mineur,release); + //" version est ant�ieure �la version 2.2"; + ret = MEDfileClose(fid); + fid=0; } + else { + if (verbose>0)fprintf(stdout,", file from MED V%d.%d.%d\n",majeur,mineur,release); } + + return fid; +} + +//************************************ +bool ReadFileMED(QString nomfilemed,ghs3dprl_mesh_wrap *mymailw) +{ + med_err ret; + med_idt fid=0; + med_int i,j,sdim,mdim,nmaa,edim,majeur_lu,mineur_lu,release_lu,nprofils,nstep; + med_mesh_type type_maillage; + char dtunit[MED_SNAME_SIZE+1]; + char axisname[MED_SNAME_SIZE+1]; + char axisunit[MED_SNAME_SIZE*3+1]; + med_sorting_type sortingtype; + med_axis_type axistype; + int numero=1; + QString key,tmp; + med_bool chan; + med_bool tran; + + //version qt3 + char* chaine = (char*)malloc((nomfilemed.length()+1)*sizeof(char)); + strncpy(chaine,nomfilemed.toLatin1().constData(),nomfilemed.length()+1); + //std::cout<<"*** ReadFileMED *** "<verbose); + free(chaine); + if (fid == 0) { + std::cerr<<"Problem opening file "< 1) std::cout<<"More than one mesh in "<nommaa,&sdim,&mdim,&type_maillage,mymailw->maillage_description, + dtunit,&sortingtype,&nstep,&axistype,axisname,axisunit); + if (ret < 0){ + std::cerr<<"Problem MEDmeshInfo in "<nommaa,MED_NO_DT,MED_NO_IT, + MED_NODE,MED_NO_GEOTYPE,MED_COORDINATE,MED_NO_CMODE,&chan,&tran); + //(med_geometrie_element)0,(med_connectivite)0); + if (nnoe<1){ + std::cerr<<"Problem number of Vertices < 1\n"; + ret = MEDfileClose(fid); + return false; + } + + //nombre d'objets MED : mailles, faces, aretes , ... + med_int nmailles[MED_N_CELL_GEO],nbtria3; + med_int nfaces[MED_N_FACE_GEO]; + med_int naretes[MED_N_EDGE_FIXED_GEO],nbseg2; + //med_int nmailles[MED_NBR_GEOMETRIE_MAILLE],nbtria3; + //med_int nfaces[MED_NBR_GEOMETRIE_FACE]; + //med_int naretes[MED_NBR_GEOMETRIE_ARETE],nbseg2; + //polygones et polyedres familles equivalences joints + med_int nmpolygones,npolyedres,nfpolygones,nfam,nequ,njnt; + + //Combien de mailles, faces ou aretes pour chaque type geometrique ? + /*for (i=0;inommaa,MED_CONN,MED_MAILLE,typmai[i],typ_con); + //lecture_nombre_mailles_standards(fid,nommaa,typmai[i],typ_con,i); + if (mymailw->verbose>6) std::cout<<"NumberOf"<nommaa,MED_NO_DT,MED_NO_IT, + MED_CELL,MED_TRIA3,MED_CONNECTIVITY,MED_NODAL,&chan,&tran); + nbseg2=MEDmeshnEntity(fid,mymailw->nommaa,MED_NO_DT,MED_NO_IT, + MED_CELL,MED_SEG2,MED_CONNECTIVITY,MED_NODAL,&chan,&tran); + + //combien de familles ? + nfam=MEDnFamily(fid,mymailw->nommaa); + if (mymailw->verbose>2) { + std::cout<<"\nNumberOfFamilies="< famdelete = std::vector(nfam); +{ + med_int ngro; + char *gro; + char nomfam[MED_NAME_SIZE+1]; + med_int numfam; + char str1[MED_COMMENT_SIZE+1]; + char str2[MED_LNAME_SIZE+1]; + med_err ret = 0; + + for (i=0;inommaa,i+1); + if (ngro < 0){ + std::cerr<<"Problem reading number of groups of family\n"; + continue; + } + + //atributs obsolete MED3 + //allocation memoire par exces + gro = (char*) malloc(MED_LNAME_SIZE*(ngro+1)); + + ret = MEDfamilyInfo(fid,mymailw->nommaa,i+1,nomfam,&numfam,gro); + if (ret < 0){ + std::cerr<<"Problem reading informations of family\n"; + continue; + } + + if (mymailw->verbose>8) { + std::cout<<"Family "<deletegroups)>0) { + //std::cout<<"idelete++ "<0) { //only delete family whith all delete groups + //std::cout<<"famdelete++ "<deletegroups)==0){ + if (sgro.contains(qgroup)>0) { + sgro="Skin_"+sgro; //pas sur que ce soit pertinent + } + if (mymailw->verbose>8) std::cout<<"families.add("<families.add(sfam,sgro); + } + else { + //sgro="Skin_"+sgro; //pas sur que ce soit pertinent + //std::cout<<"--deletegroups matches \""<verbose>3) std::cout<<"--deletegroups matches \""<< + sgro.toLatin1().constData()<< + "\" in family "<deletegroups)==0){ + //sgro="Skin_"+sgro; //pas sur que ce soit pertinent + std::cout<<"families.add("<families.add(sfam,sgro); + } + else { + std::cout<<"--deletegroups matches \""<verbose>3){ + std::cout<<"\nFamiliesAndGroupsOf "<families.write(); +} + /* Allocations memoires */ + /* table des coordonnees profil : (space dimension * nombre de noeuds ) */ + med_float *coo=new med_float[nnoe*sdim]; + /* table des numeros de familles des noeuds profil : (nombre de noeuds) */ + med_int *famnodesskin=new med_int[nnoe]; + //med_int *pfltab=new med_int[1]; //inutilise car on lit tout + //lecture des noeuds : coordonnees + ret=MEDmeshNodeCoordinateRd(fid,mymailw->nommaa,MED_NO_DT,MED_NO_IT,MED_FULL_INTERLACE,coo); + //mdim,coo,mode_coo,MED_ALL,pfltab,0,&rep,mymailw->nomcoo,mymailw->unicoo); + if (ret < 0){ + std::cerr<<"Problem reading nodes\n"; + ret = MEDfileClose(fid); + //return false; + } + ret=MEDmeshEntityFamilyNumberRd(fid,mymailw->nommaa,MED_NO_DT,MED_NO_IT,MED_NODE,MED_NONE,famnodesskin); + //famnodesskin,nnoe,MED_NOEUD,(med_geometrie_element) 0); + if (ret < 0){ + std::cerr<<"Problem reading families of nodes\n"; + ret = MEDfileClose(fid); + return false; + } + if (mymailw->verbose>9) { + std::cout<<"\nVertices: no x y z family\n"; + for (i=0;inommaa,MED_NO_DT,MED_NO_IT, + MED_CELL,MED_SEG2,MED_NODAL,MED_FULL_INTERLACE,conn2); + //mdim,conn2,mode_coo,pfltab,0,MED_MAILLE,MED_SEG2,MED_NOD); + if (ret < 0){ + std::cerr<<"Problem reading MED_SEG2\n"; + ret = MEDfileClose(fid); + //return false; + } + med_int *famseg2skin=new med_int[nbseg2]; + ret=MEDmeshEntityFamilyNumberRd(fid,mymailw->nommaa,MED_NO_DT,MED_NO_IT,MED_CELL,MED_SEG2,famseg2skin); + //MEDfamLire(fid,mymailw->nommaa,famseg2skin,nbseg2,MED_MAILLE,MED_SEG2); + if (ret < 0){ + std::cerr<<"Problem reading families of MED_SEG2\n"; + ret = MEDfileClose(fid); + return false; + } + if (mymailw->verbose>9) { + std::cout<<"\nConnectivity MED_SEG2: no node1 node2 family\n"; + for (i=0;inommaa,MED_NO_DT,MED_NO_IT, + MED_CELL,MED_TRIA3,MED_NODAL,MED_FULL_INTERLACE,conn3); + //MEDconnLire(fid,mymailw->nommaa,mdim,conn3,mode_coo,pfltab,0,MED_MAILLE,MED_TRIA3,MED_NOD); + if (ret < 0){ + std::cerr<<"Problem reading MED_TRIA3\n"; + ret = MEDfileClose(fid); + //return false; + } + med_int *famtria3skin=new med_int[nbtria3]; + ret=MEDmeshEntityFamilyNumberRd(fid,mymailw->nommaa,MED_NO_DT,MED_NO_IT,MED_CELL,MED_TRIA3,famtria3skin); + //MEDfamLire(fid,mymailw->nommaa,famtria3skin,nbtria3,MED_MAILLE,MED_TRIA3); + if (ret < 0){ + std::cerr<<"Problem reading families of MED_TRIA3\n"; + ret = MEDfileClose(fid); + return false; + } + if (mymailw->verbose>9) { + std::cout<<"\nConnectivity MED_TRIA3: no node1 node2 node3 family\n"; + for (i=0;i0) { + //std::cout<<"!!!!!!!!nodes "<insert_key(tmp,montab); + + montab=new CVWtab(nnoe,famnodesskin); + tmp="SKIN_VERTICES_FAMILIES"; + ok=mymailw->insert_key(tmp,montab); + + montab=new CVWtab(nbseg2*2,conn2); + tmp="SKIN_SEG2_CONNECTIVITIES"; + ok=mymailw->insert_key(tmp,montab); + + montab=new CVWtab(nbtria3,famseg2skin); + tmp="SKIN_SEG2_FAMILIES"; + ok=mymailw->insert_key(tmp,montab); + + montab=new CVWtab(nbtria3*3,conn3); + tmp="SKIN_TRIA3_CONNECTIVITIES"; + ok=mymailw->insert_key(tmp,montab); + + montab=new CVWtab(nbtria3,famtria3skin); + tmp="SKIN_TRIA3_FAMILIES"; + ok=mymailw->insert_key(tmp,montab); + + //if (mymailw->verbose>6) ok=mymailw->list_keys_mesh_wrap(); + + ret = MEDfileClose(fid); + if (ret < 0){ + std::cerr<<"Problem closing "<6)\n"<< + " --test : more tests about joints, before generation of output files\n"<< + " --menu : a GUI menu for option number\n"<< + " --launchtetra : also launch tetra-hpc on files casename.mesh and option number\n"<< + " --merge_subdomains : merge the subdomains into one mesh and write the output .mesh(b) file\n"<< + " --tag_subdomains : use the parallel subdomain index as tag into the merged output mesh\n"<< + " to identify the parallel subdomains (used in combination with the merge_subdomains option)\n"<< + " --output_interfaces : write the parallel subdomains interface triangles into the merged output mesh\n"<< + " (used in combination with the merge_subdomains option)\n"<< + " --discard_subdomains : discard the parallel subdomains informations output (mesh, global numbering and interfaces)\n"<< + " --background : force background mode from launch tetra-hpc and generation of final MED files (big meshes)\n"<< + " --deletegroups : regular expression (see QRegExp) which matches unwanted groups in final MED files\n"<< + " (try --deletegroups=\"(\\bJOINT)\"\n"<< + " (try --deletegroups=\"(\\bAll_Nodes|\\bAll_Faces)\"\n"<< + " (try --deletegroups=\"((\\bAll_|\\bNew_)(N|F|T))\"\n"; + std::cout<<"example:\n tetrahpcl2med --casename=/tmp/GHS3DPRL --number=2 --medname=DOMAIN "<< + "--limitswap=1000 --verbose=0 --test=yes --menu=no --launchtetra=no\n\n"; + return 1; //no output files + } + + if (!ccasename){ + std::cerr<<"--casename: a path/name is expected\n\n"; + return 1; + } + casename=ccasename; + if (!cnumber){ + std::cerr<<"--number: an integer is expected\n\n"; + return 1; + } + tmp=cnumber; + nbfiles=tmp.toLong(&ok,10); + if (!ok){ + std::cerr<<"--number: an integer is expected\n\n"; + return 1; + } + if (nbfiles<=0){ + std::cerr<<"--number: a positive integer is expected\n\n"; + return 1; + } + if (nbfiles>2048){ //delirium in 2014 + std::cerr<<"--number: a positive integer <= 2048 is expected\n\n"; + return 1; + } + if (!cmedname) cmedname=ccasename; + casenamemed=cmedname; + limit_swap_defaut=1000; //1000Mo + limit_swap=limit_swap_defaut; + if (climitswap){ + tmp=climitswap; + limit_swap=tmp.toLong(&ok,10); + if (!ok){ + std::cerr<<"--limitswap: an integer is expected. try 1000\n\n"; + return 1; + } + if (limit_swap<1 || limit_swap>32000){ + std::cerr<<"--limitswap: [1->32000] expected. try 1000\n\n"; + return 1; + } + } + //default 1GOctet/8(for float) + nbelem_limit_swap=limit_swap*1000000; //100% + CVWtab::memorymax=nbelem_limit_swap; + + verbose=1; //default + if (cverbose){ + tmp=cverbose; + verbose=tmp.toLong(&ok,10); + if (!ok){ + std::cerr<<"--verbose: an integer is expected\n\n"; + return 1; + } + if (verbose<0){ + std::cerr<<"--verbose: a positive integer is expected\n\n"; + return 1; + } + } + + test="no"; //default + if (ctest){ + tmp=ctest; + if (tmp=="yes") test="yes"; + } + + menu="no"; //default + if (cmenu){ + tmp=cmenu; + if (tmp=="yes") menu="yes"; + } + + launchtetra="no"; //default + if (claunchtetra){ + tmp=claunchtetra; + if (tmp=="yes") launchtetra="yes"; + } + + ToMergeSubdomains="no"; //default + if (cToMergeSubdomains){ + tmp=cToMergeSubdomains; + if (tmp=="yes") ToMergeSubdomains="yes"; + } + + ToTagSubdomains="no"; //default + if (cToTagSubdomains){ + tmp=cToTagSubdomains; + if (tmp=="yes") ToTagSubdomains="yes"; + } + + ToOutputInterfaces="no"; //default + if (cToOutputInterfaces){ + tmp=cToOutputInterfaces; + if (tmp=="yes") ToOutputInterfaces="yes"; + } + + ToDiscardSubdomains="no"; //default + if (cToDiscardSubdomains){ + tmp=cToDiscardSubdomains; + if (tmp=="yes") ToDiscardSubdomains="yes"; + } + + background="no"; //default + if (cbackground){ + tmp=cbackground; + if (tmp=="yes") background="yes"; + } + + + // We must always have an application + if (menu=="yes") { + QApplication a(argc,argv); + dlg_ghs3dmain *m = new dlg_ghs3dmain(); + m->setWindowTitle("tetrahpc2med 3.0"); + m->show(); + a.exec(); + if ( m->result() == QDialog::Accepted ) { + std::cout<<"parameters "<KeepFiles()<<" "<NbPart()<NbPart(); + } + else { + return 1; + } + delete m; + } + + int n=casenamemed.count('/'); + if (n>0) + path=casenamemed.section('/',-n-1,-2)+"/"; + else + path="./"; + casenamemed=casenamemed.section('/',-1); + if (casenamemed.length()>20){ + std::cerr<<"--medname truncated (no more 20 characters)"<0) + pathini=casename.section('/',-n-1,-2)+"/"; + else + pathini="./"; + casename=casename.section('/',-1); + if (casename.length()>20){ + std::cerr<<"--casename truncated (no more 20 characters)"<0) + std::cout<<"tetrahpc2med "< 0) { + //Process father + exit(0); //temporary ok for plugin + } + //process children + //On rend le fils independant de tout terminal + //from here everything in background: tetrahpc AND generation of final MED files + setsid(); + system("sleep 10"); //for debug + } +#else + printf("background mode is not supported on win32 platform !\n"); +#endif + + //"tetrahpc -f exemple1 -n 4" + if (launchtetra=="yes"){ + //tetra_hpc.exe --help + //mpirun -n 3 tetra_hpc.exe --in GHS3DPRL.mesh --out TOTO.mesh + cmd="mpirun -n "+cmd.sprintf("%d",nbfiles)+" tetra_hpc.exe --in "+ + pathini+casename+".mesh --out "+ + pathini+casename+".mesh"+ + " --merge_subdomains "+ToMergeSubdomains+ + " --tag_subdomains "+ToTagSubdomains+ + " --output_interfaces "+ToOutputInterfaces+ + " --discard_subdomains "+ToDiscardSubdomains+ + " > "+path+"tetrahpc.log"; + std::cout<<"\nlaunchtetra command: background="<nbfiles=0; + mymailw->nbfilestot=nbfiles; + //for huge cases big array swap in huge binary files + mymailw->nbelem_limit_swap=nbelem_limit_swap; + mymailw->verbose=verbose; + mymailw->casename=casename; + mymailw->medname=casenamemed; + mymailw->path=path; + mymailw->pathini=pathini; + mymailw->deletegroups=QRegExp(deletegroups,Qt::CaseSensitive,QRegExp::RegExp); + ghs3dprl_msg_parser handler; + //constructor later maybe + //handler.verbose=true; + handler.mailw=mymailw; + mymailw->families.no=1; + //std::cout<<"coucou1 "<families.no<families.add(casename,casenamemed); + format=format.sprintf("%d",nbfiles); + int nbf=format.length(); + format=format.sprintf(".%%0%dd.%%0%dd",nbf,nbf); + format_tetra=".%05d"; + if (verbose>10)std::cout<<"format "<10)std::cout<<"format_tetra "<format=format; + mymailw->format_tetra=format_tetra; + mymailw->for_tetrahpc=true; //to know what files to read: .noboite or .mesh + + //something like "/home/wambeke/tmp/GHS3DPRL_skin.med" + fileskinmed=pathini+casename+"_skin.med"; + //fileskinmed="/home/wambeke/tmp/GHS3DPRL_skin.med"; + /*for debug + { + char ctmp[fileskinmed.length()+1] ; strcpy(ctmp,fileskinmed); + int res=dumpMED(&ctmp[0],1); + }*/ + int ret = access(fileskinmed.toLatin1().constData(),F_OK); //on regarde si le fichier existe + if (ret >= 0) { + ok=ReadFileMED(fileskinmed,mymailw); } + else { + if (verbose>0)std::cout<<"Initial skin file <"< does not exist\n"; } + + +//if test quickly read all files before (or only small files) + if (test=="yes"){ + if (verbose>0) std::cout<<"\nReading output files of tetrahpc as input files of tetrahpc2med...\n"; + //only read beginning of files .xxxxx.mesh + //supposed big files big arrays so only see first lines + mymailw->nbfiles=0; + for (int i=1; i<=nbfiles; i++){ + mymailw->nofile=i; + tmp=pathini+casename+tmp.sprintf(format_tetra.toLatin1().constData(),i)+".mesh"; + if (verbose>0) std::cout<<"FileName="<TestExistingFileMESHnew(tmp); + } + if (verbose>0) + std::cout<<"NumberOfFilesMESHTested="<nbfiles<<": ok\n\n"; + if (mymailw->nbfiles != nbfiles){ + std::cerr<<"NumberOfFiles != NumberOfFilesTested is unexpected\n\n"; + return 1; + } + } //end if test + + ok=mymailw->Write_MEDfiles_v2(true); //deletekeys=true + + nb=mymailw->remove_all_keys_mesh_wrap(); + if (verbose>3)std::cout<<"***remove_all_key_mesh_wrap*** "<0)std::cout<