X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2Ftepal2med%2Ftetrahpc2med.cxx;h=5a47586b43b0a47a636cb7cc9c541ca6a3ee5539;hb=0ab6a3e0b79a17ae0777497eea855925d5b1464b;hp=a845e54831e7bc1ab6e9dcd3ca0fc522e874b505;hpb=57939317ca86d0c18ef1d4595597942dc4595df5;p=plugins%2Fghs3dprlplugin.git diff --git a/src/tepal2med/tetrahpc2med.cxx b/src/tepal2med/tetrahpc2med.cxx old mode 100755 new mode 100644 index a845e54..5a47586 --- a/src/tepal2med/tetrahpc2med.cxx +++ b/src/tepal2med/tetrahpc2med.cxx @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D +// Copyright (C) 2007-2020 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -45,7 +45,7 @@ #include #include "ghs3dprl_msg_parser.h" -#include "dlg_ghs3dmain.h" +//#include "dlg_ghs3dmain.h" #ifdef WIN32 #include @@ -90,7 +90,7 @@ med_idt ouvre_fichier_MED(char *fichier,int verbose) if (ret < 0) return fid; MEDfileNumVersionRd(fid, &majeur, &mineur, &release); - if (majeur < 2 || majeur == 2 && mineur < 2) { + 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"; @@ -107,7 +107,7 @@ 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_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]; @@ -174,14 +174,14 @@ bool ReadFileMED(QString nomfilemed,ghs3dprl_mesh_wrap *mymailw) } //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_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; + med_int /*nmpolygones,npolyedres,nfpolygones,*/nfam/*,nequ,njnt*/; //Combien de mailles, faces ou aretes pour chaque type geometrique ? /*for (i=0;i famdelete = std::vector(nfam); char *gro; char nomfam[MED_NAME_SIZE+1]; med_int numfam; - char str1[MED_COMMENT_SIZE+1]; + //char str1[MED_COMMENT_SIZE+1]; char str2[MED_LNAME_SIZE+1]; med_err ret = 0; @@ -468,17 +468,196 @@ if (mymailw->verbose>3){ return true; } +/* +mg-tetra_hpc_mpi.exe --help + + ============================================= + MG-Tetra_HPC -- MeshGems 2.9-6 (August, 2019) + ============================================= + + Distene SAS + Campus Teratec + 2, rue de la Piquetterie + 91680 Bruyeres le Chatel + FRANCE + Phone: +33(0)970-650-219 Fax: +33(0)169-269-033 + EMail: + + Running MG-Tetra_HPC (Copyright 2014-2019 by Distene SAS) + date of run: 25-Feb-2020 AT 08:47:20 + running on : Linux 3.10.0-1062.9.1.el7.x86_64 x86_64 + using modules: + MeshGems-Core 2.9-6 + + MeshGems is a Registered Trademark of Distene SAS + + + +Usage: tetra_hpc_mpi.exe [options] + +Options: + + Short option (if it exists) + / Long option + | / Description + | | / + v v v + + --components + Selects which mesh components to process. + If is: + all : all components are to be meshed. + outside_components : only the main (outermost) component is to be + meshed. + Default: all + + --gradation + Sets the size gradation value. + is the desired maximum ratio between 2 adjacent + tetrahedron edges. The closer it is to 1.0, the more uniform the mesh + will be. + Default: 1.05 + + --gradation_mode + Sets the gradation behaviour. + Possible values for are : + without_size: apply gradation only when no size is provided by + the input sizemap(s) + always: always apply the gradation. This can partially smooth the + provided input sizemap(s) + Default: without_size + + --help + Prints this help. + + --in + Sets the input file. + (MANDATORY) + + --max_edge_length + Sets the desired maximum accepted edge length. + Default: 0 (no maximum length). + + --max_size + Sets the desired maximum cell size value. + Default: 0 (no maximum size). + + --metric + Sets the type of metric governing the mesh generation. + Possible values for are : + isotropic: the metric induces the same size in all directions. + anisotropic: the metric induces different sizes depending on the + directions. + Default: isotropic + + --min_edge_length + Sets the desired minimum accepted edge length. + Default: 0 (no minimum length). + + --min_size + Sets the desired minimum cell size value. + Default: 0 (no minimum size). + + --optimisation + Sets whether to optimise mesh quality or not. + Default: yes. + + --optimisation_level + Sets the desired optimisation level for mesh quality. + Possible values for are (in increasing order of quality vs + speed ratio): light, standard, strong + Default: standard. + + --out + Sets the output file. + Using an existing file is not allowed. + Using the same file as --in is not allowed. + If unset, _tetra_hpc is appended to the input file basename. + + --parallel_strategy + Sets the desired parallel strategy, influencing the level of + reproducibility of the result and the potential performances. + Possible values for are (in decreasing order for + reproducibility and increasing order for performances): + reproducible: result is entirely reproducible but performances + may not be optimal. + aggressive: result may not be reproducible but all parallel + optimizations are allowed. + Default: reproducible. + + --sizemap + Sets the optional input sizemap file. The sizemap must provide the + requested size at the input surface or volume mesh vertices. + Default : none. + + --split_overconstrained_edges + Sets whether to split over-constrained edges or not. An edge is + considered as over-constrained when its two vertices belong to the + surface. + If is: + yes: correction is applied upon mesh generation/optimisation + no: no correction is applied. + Default: no + + --split_overconstrained_elements + Sets whether to split over-constrained elements or not. An edge is + considered as over-constrained when its two vertices belong to the + surface. A tetrahedron is considered as over-constrained when at + least two of its faces belong to the surface. + If is: + yes: correction is applied upon mesh generation/optimisation + no: no correction is applied. + Default: no + + --split_overconstrained_tetrahedra + Sets whether to split over-constrained tetrahedra or not. A + tetrahedron is considered as over-constrained when at least two of + its faces belong to the surface. + If is: + yes: correction is applied upon mesh generation/optimisation + no: no correction is applied. + Default: no + + --verbose + Set the verbosity level, increasing from 0 to 10. + Possible values are increasing from 0 to 10 : + 0 : no details. + 10 : very detailed. + Default: 3. + + --volume_proximity_layers + Sets the desired minimum number of tetrahedra layers inside the + volume. + Default: 0 (no minimum). + + --write_sizemap + Sets the optional output sizemap file. + Using an existing file is not allowed. + If unset, the output sizemap will not be written. + + +================================================================================ + MG-Tetra_HPC -- MeshGems 2.9-6 (August, 2019) + END OF SESSION - MG-Tetra_HPC (Copyright 2014-2019 by Distene SAS) + compiled Sep 2 2019 09:58:40 on Linux_64 + MeshGems is a Registered Trademark of Distene SAS +================================================================================ + ( Distene SAS + Phone: +33(0)970-650-219 Fax: +33(0)169-269-033 + EMail: ) +*/ + //************************************ int main(int argc, char *argv[]) { bool ok; - int i,nb,nbfiles,limit_swap,nbelem_limit_swap,limit_swap_defaut,verbose; + int i,nb,nbfiles,limit_swap,nbelem_limit_swap,limit_swap_defaut,verbose,res; + float gradation,min_size,max_size; QString path,pathini,casename,casenamemed,fileskinmed, tmp,cmd,format,format_tetra, - test,menu,launchtetra,background,deletegroups, - ToMergeSubdomains,ToTagSubdomains,ToOutputInterfaces,ToDiscardSubdomains, - version="V3.0 (MED3+tetra-hpc)"; + test,launchtetra,background,multithread,deletegroups, + version="V4.0 (MED3 + tetra-hpc v2.3 Sept 2016)"; char *chelp=NULL, *ccasename=NULL, @@ -486,31 +665,27 @@ int main(int argc, char *argv[]) *cmedname=NULL, *climitswap=NULL, *cverbose=NULL, - *ctest=NULL, - *cmenu=NULL, *claunchtetra=NULL, - *cToMergeSubdomains=NULL, - *cToTagSubdomains=NULL, - *cToOutputInterfaces=NULL, - *cToDiscardSubdomains=NULL, + *cgradation=NULL, + *cmin_size=NULL, + *cmax_size=NULL, *cbackground=NULL, + *cmultithread=NULL, *cdeletegroups=NULL; for (i = 0; i < argc; i++){ if (!strncmp (argv[i], "--help", sizeof ("--help"))) chelp = &(argv[i][0]); else if (!strncmp (argv[i], "--casename=", sizeof ("--casename"))) ccasename = &(argv[i][sizeof ("--casename")]); else if (!strncmp (argv[i], "--number=", sizeof ("--number"))) cnumber = &(argv[i][sizeof ("--number")]); - else if (!strncmp (argv[i], "--medname=", sizeof ("--medname"))) cmedname = &(argv[i][sizeof ("--medname")]); else if (!strncmp (argv[i], "--limitswap=", sizeof ("--limitswap"))) climitswap = &(argv[i][sizeof ("--limitswap")]); + else if (!strncmp (argv[i], "--medname=", sizeof ("--medname"))) cmedname = &(argv[i][sizeof ("--medname")]); else if (!strncmp (argv[i], "--verbose=", sizeof ("--verbose"))) cverbose = &(argv[i][sizeof ("--verbose")]); - else if (!strncmp (argv[i], "--test=", sizeof ("--test"))) ctest = &(argv[i][sizeof ("--test")]); - else if (!strncmp (argv[i], "--menu=", sizeof ("--menu"))) cmenu = &(argv[i][sizeof ("--menu")]); else if (!strncmp (argv[i], "--launchtetra=", sizeof ("--launchtetra"))) claunchtetra = &(argv[i][sizeof ("--launchtetra")]); - else if (!strncmp (argv[i], "--merge_subdomains=", sizeof ("--merge_subdomains"))) cToMergeSubdomains = &(argv[i][sizeof ("--")]); - else if (!strncmp (argv[i], "--tag_subdomains=", sizeof ("--tag_subdomains"))) cToTagSubdomains = &(argv[i][sizeof ("--")]); - else if (!strncmp (argv[i], "--output_interfaces=", sizeof ("--output_interfaces"))) cToOutputInterfaces = &(argv[i][sizeof ("--")]); - else if (!strncmp (argv[i], "--discard_subdomains=", sizeof ("--discard_subdomains"))) cToDiscardSubdomains = &(argv[i][sizeof ("--")]); + else if (!strncmp (argv[i], "--gradation=", sizeof ("--gradation"))) cgradation = &(argv[i][sizeof ("--gradation")]); + else if (!strncmp (argv[i], "--min_size=", sizeof ("--min_size"))) cmin_size = &(argv[i][sizeof ("--min_size")]); + else if (!strncmp (argv[i], "--max_size=", sizeof ("--max_size"))) cmax_size = &(argv[i][sizeof ("--max_size")]); else if (!strncmp (argv[i], "--background=", sizeof ("--background"))) cbackground = &(argv[i][sizeof ("--background")]); + else if (!strncmp (argv[i], "--multithread=", sizeof ("--multithread"))) cmultithread = &(argv[i][sizeof ("--multithread")]); else if (!strncmp (argv[i], "--deletegroups=", sizeof ("--deletegroups"))) cdeletegroups = &(argv[i][sizeof ("--deletegroups")]); } @@ -525,22 +700,19 @@ int main(int argc, char *argv[]) " --medname : path and name of output MED files\n"<< " --limitswap : max size of working cpu memory (Mo) (before swapping on .temp files)\n"<< " --verbose : trace of execution (0->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"<< + " --launchtetra : launch mg_tetra_hpc on files casename.mesh and option number,\n"<< + " else only use existing input/output files\n"<< + " --gradation : the desired maximum ratio between 2 adjacent tetrahedron edges (Default 1.05). The closer it is to 1.0\n"<< + " --min_size : the desired maximum cell size value (Default: 0 no maximum size)\n"<< + " --max_size : the desired minimum cell size value (Default: 0 no minimum size)\n"<< " --background : force background mode from launch tetra-hpc and generation of final MED files (big meshes)\n"<< + " --multithread : launch mg_tetra_hpc multithread version, else mpi version\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"; + std::cout<<"example:\n tetrahpc2med --casename=/tmp/GHS3DPRL --number=2 --medname=DOMAIN "<< + "--verbose=0 --launchtetra=no\n\n"; return 1; //no output files } @@ -563,12 +735,13 @@ int main(int argc, char *argv[]) std::cerr<<"--number: a positive integer is expected\n\n"; return 1; } - if (nbfiles>2048){ //delirium in 2014 + if (nbfiles>2048){ //delirium in 2016 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){ @@ -583,10 +756,7 @@ int main(int argc, char *argv[]) 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; @@ -601,46 +771,54 @@ int main(int argc, char *argv[]) } } - 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"; + gradation=1.05; //default + if (cgradation){ + tmp=cgradation; + gradation=tmp.toFloat(&ok); + if (!ok){ + std::cerr<<"--gradation: a float { 0; ]1,3] } is expected\n\n"; + return 1; + } + if (gradation>3.){ + std::cerr<<"--gradation: a float <= 3. is expected\n\n"; + return 1; + } + if (gradation<0.){ + std::cerr<<"--gradation: a float >= 0. is expected\n\n"; + return 1; + } } - ToOutputInterfaces="no"; //default - if (cToOutputInterfaces){ - tmp=cToOutputInterfaces; - if (tmp=="yes") ToOutputInterfaces="yes"; + if (cmin_size){ + tmp=cmin_size; + min_size=tmp.toFloat(&ok); + if (!ok){ + std::cerr<<"--min_size: a float >= 0. is expected\n\n"; + return 1; + } + if (gradation<0.){ + std::cerr<<"--min_size: a float >= 0. is expected\n\n"; + return 1; + } } - ToDiscardSubdomains="no"; //default - if (cToDiscardSubdomains){ - tmp=cToDiscardSubdomains; - if (tmp=="yes") ToDiscardSubdomains="yes"; + if (cmax_size){ + tmp=cmax_size; + max_size=tmp.toFloat(&ok); + if (!ok){ + std::cerr<<"--max_size: a float >= 0. is expected\n\n"; + return 1; + } + if (gradation<0.){ + std::cerr<<"--max_size: a float >= 0. is expected\n\n"; + return 1; + } } background="no"; //default @@ -649,24 +827,13 @@ int main(int argc, char *argv[]) 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; + multithread="no"; //default + if (cmultithread){ + tmp=cmultithread; + if (tmp=="yes") multithread="yes"; } + int n=casenamemed.count('/'); if (n>0) path=casenamemed.section('/',-n-1,-2)+"/"; @@ -689,8 +856,8 @@ int main(int argc, char *argv[]) casename.truncate(20); } - /*std::cout<<"CaseNameMed="<0) - std::cout<<"tetrahpc2med "< " + path + "tetrahpc.log"; + std::cout<<"\nlaunch tetra_hpc command:"<< + "\n "< "+path+"tetrahpc.log"; - std::cout<<"\nlaunchtetra command: background="<0) + { + std::cout<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); + mymailw->for_multithread=false; + if (multithread=="yes") mymailw->for_multithread=true; ghs3dprl_msg_parser handler; //constructor later maybe //handler.verbose=true; @@ -778,13 +956,19 @@ int main(int argc, char *argv[]) format=format.sprintf("%d",nbfiles); int nbf=format.length(); format=format.sprintf(".%%0%dd.%%0%dd",nbf,nbf); - format_tetra=".%05d"; + format_tetra=".%06d"; 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 + //default 1GOctet/8(for float) + nbelem_limit_swap=limit_swap*1000000; //100% + CVWtab::memorymax=nbelem_limit_swap; + mymailw->nbelem_limit_swap=nbelem_limit_swap; + + //something like "/home/wambeke/tmp/GHS3DPRL_skin.med" fileskinmed=pathini+casename+"_skin.med"; //fileskinmed="/home/wambeke/tmp/GHS3DPRL_skin.med"; @@ -800,31 +984,32 @@ int main(int argc, char *argv[]) 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 + //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<=0)std::cout<