From 0f50a65f3fdeee18d005b99783677fd672b98e88 Mon Sep 17 00:00:00 2001 From: admin Date: Thu, 17 Feb 2011 14:40:28 +0000 Subject: [PATCH] This commit was generated by cvs2git to create branch 'PortingMED3'. Sprout from V6_main 2011-02-17 14:40:05 UTC adam 'Remove warnings' Delete: src/tools/Makefile.am src/tools/facespoints2mesh.py src/tools/mesh2facespoints.py --- src/tools/Makefile.am | 34 --------- src/tools/facespoints2mesh.py | 67 ----------------- src/tools/mesh2facespoints.py | 135 ---------------------------------- 3 files changed, 236 deletions(-) delete mode 100644 src/tools/Makefile.am delete mode 100755 src/tools/facespoints2mesh.py delete mode 100755 src/tools/mesh2facespoints.py diff --git a/src/tools/Makefile.am b/src/tools/Makefile.am deleted file mode 100644 index 9ce4c2a..0000000 --- a/src/tools/Makefile.am +++ /dev/null @@ -1,34 +0,0 @@ -# Copyright (C) 2007-2010 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 : Makefile.in -# Module : GHS3DPRLPLUGIN -# -include $(top_srcdir)/adm_local/unix/make_common_starter.am - - -# Scripts to be installed. -dist_salomescript_DATA= \ - facespoints2mesh.py \ - mesh2facespoints.py - -install-data-hook: - @for f in $(dist_salomescript_DATA) ; do \ - chmod -f a+x $(DESTDIR)$(salomescriptdir)/$$f ; \ - done diff --git a/src/tools/facespoints2mesh.py b/src/tools/facespoints2mesh.py deleted file mode 100755 index 030a032..0000000 --- a/src/tools/facespoints2mesh.py +++ /dev/null @@ -1,67 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# Copyright (C) 2007-2010 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 -# - -""" -these file is using in GHS3DPRL Plugin -to convert input files .faces and .points of Tepal V1 -to input file .mesh of Tepal V2 -assume compatibility GHS3DPRL Plugin Tepal V1 => Tepal V2 -example of use (when Tepal V2): - facespoints2mesh.py GHS3DPRL - tepal2med --casename=GHS3DPRL --number=12 --medname=DOMAIN --launchtepal=no - mesh2facespoints.py DOMAIN -""" - -import os -import sys - -file_fp='GHS3DPRL' -if len(sys.argv)==2: - file_fp=sys.argv[1] - -f1=file_fp+'.points' -f2=file_fp+'.faces' -f3=file_fp+'.mesh' - -fs=open(f1, 'r') -ft=open(f3, 'w') -ft.write('MeshVersionFormatted 1\n') -ft.write('\nDimension\n3\n') -tmp=fs.readline() -nb=int(tmp) -ft.write('\nVertices\n') -ft.write(tmp) -for i in xrange(0,nb): - lig=fs.readline() - ft.write(lig) -fs.close() - -fs=open(f2, 'r') -lig=fs.readline() -nb=int(lig.split()[0]) -ft.write('\nTriangles\n'+lig.split()[0]+'\n') -for i in xrange(0,nb): - lig=fs.readline() - lig=lig.split() - ft.write(lig[1]+' '+lig[2]+' '+lig[3]+' '+lig[4]+'\n') -ft.write('\nEnd\n') -ft.close() -print 'facespoints2mesh creation of file '+f3 diff --git a/src/tools/mesh2facespoints.py b/src/tools/mesh2facespoints.py deleted file mode 100755 index 8a1e252..0000000 --- a/src/tools/mesh2facespoints.py +++ /dev/null @@ -1,135 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# Copyright (C) 2007-2010 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 -# - -""" -these file is using in GHS3DPRL Plugin -to convert output files .mesh of Tepal V2 -to output files files .faces and .points of Tepal V1 -assume compatibility GHS3DPRL Plugin Tepal V1 => Tepal V2 -example of use (when Tepal V2): - facespoints2mesh.py GHS3DPRL - tepal2med --casename=GHS3DPRL --number=12 --medname=DOMAIN --launchtepal=no - mesh2facespoints.py DOMAIN -""" - -import os -import sys -import glob -import fileinput -import string - -file_m='GHS3DPRL' -if len(sys.argv)==2: - file_m=sys.argv[1] - -def find_cr_or_not(fs,tag): - """find number after tag with cr or sp""" - for line in fs: - if tag+'\n' in line: - #print tag+'' - res=fs.readline() - break - if tag+' ' in line: - #print 'vertices' - res=line.split()[1] - break - res=res.strip("\t\n ") - print tag+' '+res - return res - -def m2fp(f1): - """convert .mesh file to .points and .faces and .noboite""" - print '\nconversion '+f1+' to .points and .faces and .noboite' - #fs=open(f1, 'r') - #fs=fileinput.FileInput(f1,mode='r') #mode not in v2.4.4 - fs=fileinput.FileInput(f1) - (shortname, extension)=os.path.splitext(f1) - f2=shortname+'.points' - print 'creating',f2 - fp=open(f2, 'w') - nb=find_cr_or_not(fs,'Vertices') - np=nb #for .noboite - fp.write(nb+'\n') - for i in xrange(0,int(nb)): - fp.write(fs.readline()) - fp.close() - - f2=shortname+'.faces' - print 'creating',f2 - ff=open(f2, 'w') - nb=find_cr_or_not(fs,'Triangles') - ff.write(nb+' 0\n') - for i in xrange(0,int(nb)): - ff.write('3 '+fs.readline().strip('\t\n ')+' 0 0 0\n') - ff.close() - - ne=find_cr_or_not(fs,'Tetrahedra') - f3=shortname+'.noboite' - fb=open(f3, 'w') - npfixe="0" - fb.write(ne+' '+np+' '+npfixe+' 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n') - for i in xrange(0,int(ne)): - lig=fs.readline().strip('\t\n ') - lig=lig.split() - fb.write(lig[0]+" "+lig[1]+" "+lig[2]+" "+lig[3]+" ") - fb.write('\n') - fs.close() - fs=fileinput.FileInput(shortname+'.points') - nb=fs.readline() #eqal to np - for i in xrange(0,int(nb)): - lig=fs.readline().strip('\t\n ') - lig=lig.split() - fb.write(lig[0]+" "+lig[1]+" "+lig[2]+" ") - fb.write('\n0\n') #subnumber - fs.close() - fb.close() - -def rename_tepal_v1(f1,imax): - """rename files as version v1 of tepal expect""" - (shortname, extension)=os.path.splitext(f1) - fs=os.path.splitext(shortname) - i=int(fs[1].strip('.')) - ff=fs[0]+'.'+str(imax)+'.'+string.zfill(str(i),len(str(imax))) - #noboite en ".32.02.noboite!" - mvcp='mv ' #ou 'cp ' - f2=shortname+'.points' ; f3=ff+os.path.splitext(f2)[1] - print f2,'->',f3 ; os.system(mvcp+f2+' '+f3) - f2=shortname+'.faces' ; f3=ff+os.path.splitext(f2)[1] - print f2,'->',f3 ; os.system(mvcp+f2+' '+f3) - f2=shortname+'.noboite' ; f3=ff+os.path.splitext(f2)[1] - print f2,'->',f3 ; os.system(mvcp+f2+' '+f3) - f2=shortname+'.glo' ; f3=ff+os.path.splitext(f2)[1] - print f2,'->',f3 ; os.system(mvcp+f2+' '+f3) - f2=shortname+'.msg' ; f3=ff+os.path.splitext(f2)[1] - print f2,'->',f3 ; os.system(mvcp+f2+' '+f3) - -def my_test(a): return int(os.path.basename(a).split('.')[1]) - -f0=file_m+'.?????.mesh' -#print f0 -fics=glob.glob(f0) -fics.sort(lambda a, b: cmp(my_test(b), my_test(a))) #tri ordre decroissant -print 'conversion of files:\n',fics - -imax=len(fics) -for f in fics: - m2fp(f) - rename_tepal_v1(f,imax) -- 2.39.2