X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2Ftepal2med%2Fghs3dprl_mesh_wrap.cxx;fp=src%2Ftepal2med%2Fghs3dprl_mesh_wrap.cxx;h=c9bf196f4109a0d4e577c3a56fef56b87c89bf4b;hb=f2dd979943d3ec1026c73a9927f2b429002de4fa;hp=9fe011766d41a68bf95b8abf6691bd71e75d4466;hpb=e4fe9f86f4133e4010eecc123184cd1939615406;p=plugins%2Fghs3dprlplugin.git diff --git a/src/tepal2med/ghs3dprl_mesh_wrap.cxx b/src/tepal2med/ghs3dprl_mesh_wrap.cxx index 9fe0117..c9bf196 100644 --- a/src/tepal2med/ghs3dprl_mesh_wrap.cxx +++ b/src/tepal2med/ghs3dprl_mesh_wrap.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2019 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 @@ -666,15 +666,19 @@ bool ghs3dprl_mesh_wrap::ReadFileGLOBAL(const QString FileName) CVWtab *montab; bool ok; - if (verbose>=6)std::cout<<"Read file '"<=6) std::cout<<"Read file '"<>vert>>edge>>tria>>tetr; - std::cout<<"First line "<>vert>>edge>>tria>>tetr; + std::cout<<"Global numerotation nb verts "<>tmint[i]; - if (verbose>4) std::cout<<"Vertices ("<>tmint[i]; + if (verbose>4) std::cout<<"Vertices ("<nofile); @@ -711,7 +715,7 @@ bool ghs3dprl_mesh_wrap::ReadFileGLOBAL(const QString FileName) count=edge; tmint=new med_int[count]; - for (int i=0; i>tmint[i]; + for (long i=0; i>tmint[i]; if (verbose>4) std::cout<<"Edges ("<>tmint[i]; + for (long i=0; i>tmint[i]; if (verbose>4) std::cout<<"Triangles ("<>tmint[i]; + for (long i=0; i>tmint[i]; if (verbose>4) std::cout<<"Tetrahedra ("<4) std::cout<<"Default Vertices ("<nofile); + ok=this->insert_key(tmp,montab); + + count=edge; + tmint=new med_int[count]; + for (long i=0; i4) std::cout<<"Default Edges ("<nofile); + ok=this->insert_key(tmp,montab); + + count=tria; + tmint=new med_int[count]; + for (long i=0; i4) std::cout<<"Default Triangles ("<nofile); + ok=this->insert_key(tmp,montab); + + count=tetr; + tmint=new med_int[count]; + for (long i=0; i4) std::cout<<"Default Tetrahedra ("<nofile); + ok=this->insert_key(tmp,montab); + + return true; +} + //************************************ bool ghs3dprl_mesh_wrap::ReadFileFACES(const QString FileName) //read file .faces (wrap) @@ -871,42 +927,47 @@ bool ghs3dprl_mesh_wrap::ReadFileMESH(const QString FileName) getline(Ff,line); getline(Ff,line); + + getline(Ff,line); // get Edges or Triangle, because sometimes Edges absent - if (!(getline(Ff,line) && (line.find("Edges")==0))) - { - std::cerr<<"Problem on line 'Edges' of file '"<>tmint[i]>>tmint[i+1]>>garbage; + count=Medge; + tmint=new med_int[count*2]; //*3 + for (int i=0; i>tmint[i]>>tmint[i+1]>>garbage; + } + if (verbose>4) std::cout<<"Edges ("<nofile); //TODO see if it could serve + ok=this->insert_key(tmp,montab); + + getline(Ff,line); + getline(Ff,line); + getline(Ff,line); } - if (verbose>4) std::cout<<"Edges ("<nofile); //TODO see if it could serve - ok=this->insert_key(tmp,montab); - - getline(Ff,line); - getline(Ff,line); - if (!(getline(Ff,line) && (line.find("Triangles")==0))) + if (!line.find("Triangles")==0) { std::cerr<<"Problem on line 'Triangles' of file '"<nbfiles<nbfiles; ifile >= 1; ifile--) for (int ineig=this->nbfiles; ineig >= ifile+1; ineig--) { @@ -1702,7 +1769,7 @@ bool ghs3dprl_mesh_wrap::Write_masterxmlMEDfile() { QString tmp; - //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!first call + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!first call create xml doc node if (idom==1) { //define master file (.xml) in memory @@ -1721,7 +1788,7 @@ bool ghs3dprl_mesh_wrap::Write_masterxmlMEDfile() med_int majeur,mineur,release; //Quelle version de MED est utilisee MEDlibraryNumVersion(&majeur,&mineur,&release); - if (verbose>0) fprintf(stdout,"Files write with MED V%d.%d.%d\n",majeur,mineur,release); + if (verbose>0) fprintf(stdout,"File write %s with MED V%d.%d.%d\n",filemaster.c_str(),majeur,mineur,release); node = xmlNewChild(root_node, 0, BAD_CAST "version",0); //xmlNewProp(node, BAD_CAST "maj", BAD_CAST int2string2(majeur).c_str()); xmlNewProp(node, BAD_CAST "maj", BAD_CAST i2a(majeur).c_str()); @@ -1730,7 +1797,8 @@ 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 MeshGems-Tetra-hpc (formerly tepal)"); + // .../INSTALL/MeshGems/include/meshgems/meshgems.h:11:#define MESHGEMS_VERSION_LONG "2.9-6" + xmlNewProp(node, BAD_CAST "what", BAD_CAST "tetrahedral mesh by MeshGems-Tetra-hpc 2.9-6 2019"); #ifdef WIN32 SYSTEMTIME present; GetLocalTime ( &present ); @@ -1770,12 +1838,14 @@ bool ghs3dprl_mesh_wrap::Write_masterxmlMEDfile() xmlNewProp(mesh_node, BAD_CAST "name", BAD_CAST domainname.c_str()); } - //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!all calls + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!all calls add xml idom node { + fprintf(stdout,"Xml node write %s idom %d\n",filemaster.c_str(), idom); char *hostname = getenv("HOSTNAME"); node = xmlNewChild(files_node,0,BAD_CAST "subfile",0); xmlNewProp(node, BAD_CAST "id", BAD_CAST i2a(idom).c_str()); node2 = xmlNewChild(node, 0, BAD_CAST "name", BAD_CAST distfilename); + if (hostname == NULL) node2 = xmlNewChild(node, 0, BAD_CAST "machine",BAD_CAST "localhost"); else @@ -1801,14 +1871,17 @@ bool ghs3dprl_mesh_wrap::Write_masterxmlMEDfile() //xmlNewProp(node2, BAD_CAST "number", BAD_CAST i2a(nbtetra4).c_str()); //tepal2med_info about joints of one subdomain - xmlAddChild(node,joints_node); + fprintf(stdout,"MeshGems 2.9-6 tetra-hpc joints are not implemented\n"); //MeshGems 2.9-6 Salome 9.5.0 jan 2020 + // not implemented ... empty joints ... does NOT work ... xmlAddChild(node,joints_node); //tepal2med_info about groups and families of one subdomain xmlAddChild(node,families.xml_groups()); } //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!last call + fprintf(stdout,"xml node idom %d/%d nb tetras total %d\n", idom, nbfilestot, nbtetrastotal); if (idom==nbfilestot) { + fprintf(stdout,"File write %s as last idom nb tetras total %d\n",filemaster.c_str(), nbtetrastotal); node2 = xmlNewChild(info_node, 0, BAD_CAST "global",0); xmlNewProp(node2, BAD_CAST "tetrahedra_number", BAD_CAST i2a(nbtetrastotal).c_str()); //save masterfile @@ -1926,11 +1999,19 @@ bool ghs3dprl_mesh_wrap::Write_MEDfiles_v2(bool deletekeys) //for (idom=1; idom<=nbfilestot; idom++) { if (for_multithread) { nbfilestot=1; - std::cout<<"\nset Number0fFiles as multithread="<"<0){ - if (verbose>2) std::cout<2) { + std::cout<\n"; } @@ -1964,20 +2045,24 @@ bool ghs3dprl_mesh_wrap::Write_MEDfiles_v2(bool deletekeys) if (verbose>4) std::cout<<"\nEnd of Faces ***\n"<4) std::cout<<"\nEnd of Tetrahedra ***\n"<6){std::cout<<"\nFinalsFamilies\n"; families.write();} //for nodes families nb=create_families(fid,1); - if (verbose>5)std::cout<<"NumberOfFamiliesNodes="<5)std::cout<<"NumberOfFamiliesNodes="<8) std::cout<<"MEDmeshEntityFamilyNumberWr nodes "<ReadFileMESH(tmp); + if (for_multithread) { // inexisting file GHS3DPRL_out.000001.global + this->ReadFileDefaultGLOBAL(this->nbvert, this->nbedge, this->nbtria, this->nbtetr); + } } tab=this->restore_key(key); //tab1=this->mestab[key1]; if (!tab) return false; @@ -2045,7 +2133,8 @@ bool ghs3dprl_mesh_wrap::idom_nodes() tmp=tmp.sprintf("NB%d SN",idom); //qt3 xx=this->remove_key_mesh_wrap(QRegExp(tmp,true,true)); xx=this->remove_key_mesh_wrap(QRegExp(tmp,Qt::CaseSensitive,QRegExp::RegExp)); - nbnodes=tab->size/3; + nbnodes=this->nbvert; // for current idom + err=MEDmeshNodeCoordinateWr(fid,nomfinal,MED_NO_DT,MED_NO_IT,0.,MED_FULL_INTERLACE,nbnodes,tab->tmflo); if (err<0) {std::cerr<<"Problem MEDmeshNodeCoordinateWr"<4) std::cout<<"NumberOfNodes="<restore_key(key1); //tab1=this->mestab[key1]; if (!tab1) { @@ -2206,6 +2296,7 @@ bool ghs3dprl_mesh_wrap::idom_edges() bool ok=true; QString tmp; nbseg2=0; + this->nbedge=0; return ok; } @@ -2228,6 +2319,8 @@ bool ghs3dprl_mesh_wrap::idom_faces() if (!tab1) return false; } nbtria3=tab1->size/3; + this->nbtria=nbtria3; // for current idom + if (verbose>4) std::cout<<"NumberOfTriangles="<restore_key(key1); //tab1=this->mestab[key1]; if (nbtria3!=tab1->size){std::cerr<<"Problem size GLi FA!=nbtria3!"<restore_key(key); //tab1=this->mestab[key1]; - //nbnodes=tab->size/3; + nbnodes=tab->size/3; //writing correspondence nodes-nodes //two indices for one correspondence @@ -2598,6 +2692,8 @@ bool ghs3dprl_mesh_wrap::idom_tetras() key1=key1.sprintf("NB%d EV",idom); //files.NoBoite Elements Vertices (tetra only) tab1=this->restore_key(key1); //tab1=this->mestab[key1]; nbtetra4=tab1->size/4; + this->nbtetr=nbtetra4; // for current idom + nbtetrastotal=nbtetrastotal + nbtetra4; if (verbose>5)std::cout<<"NumberOftetrahedra="<tmint); @@ -2614,7 +2710,8 @@ bool ghs3dprl_mesh_wrap::idom_tetras() famtetra4=new med_int[nbtetra4]; for (i=0; i