Back to index

salome-med  6.5.0
test_MEDSPLITTER.py
Go to the documentation of this file.
00001 #  -*- coding: iso-8859-1 -*-
00002 # Copyright (C) 2007-2012  CEA/DEN, EDF R&D
00003 #
00004 # This library is free software; you can redistribute it and/or
00005 # modify it under the terms of the GNU Lesser General Public
00006 # License as published by the Free Software Foundation; either
00007 # version 2.1 of the License.
00008 #
00009 # This library is distributed in the hope that it will be useful,
00010 # but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012 # Lesser General Public License for more details.
00013 #
00014 # You should have received a copy of the GNU Lesser General Public
00015 # License along with this library; if not, write to the Free Software
00016 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00017 #
00018 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00019 #
00020 
00021 from MEDSPLITTER import *
00022 import os
00023 
00024 #Beginning of the computation
00025 
00026 #Loading the mesh collection
00027 print "reading files"
00028 
00029 data_dir = os.getenv("MED_ROOT_DIR")
00030 filename_rd = os.path.join( data_dir, "share/salome/resources/med/pointe.med")
00031 meshname="maa1"
00032 
00033 collection = MESHCollection(filename_rd,meshname)
00034 
00035 print "MEDSPLITTER - computing partition "
00036   
00037  
00038 new_topo = collection.createPartition(4,METIS);
00039 
00040 # Creating a new mesh collection from the partitioning
00041 new_collection = MESHCollection(collection, new_topo, 1, 1);
00042 
00043 
00044 new_collection.setSubdomainBoundaryCreates(1);
00045 
00046 print "MEDSPLITTER - writing output files "
00047 new_collection.write("/tmp/myOutput.med")
00048 
00049 # Casting the fields on the new collection
00050 new_collection.castAllFields(collection);
00051