-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "MEDSPLITTERTest.hxx"
-#include <cppunit/TestAssert.h>
+#include "MEDSPLITTERTest_Utils.hxx"
#include "MEDMEM_ConnectZone.hxx"
#include "MEDMEM_DriversDef.hxx"
#include "MEDSPLITTER_Topology.hxx"
#include "MEDSPLITTER_ParallelTopology.hxx"
#include "MEDSPLITTER_SequentialTopology.hxx"
-//#include "MEDSPLITTER_METISGraph.hxx"
-//#include "MEDSPLITTER_SCOTCHGraph.hxx"
#include "MEDSPLITTER_MESHCollection.hxx"
#include "MEDSPLITTER_MESHCollectionDriver.hxx"
#include "MEDMEM_Exception.hxx"
#include <string>
+#include <cppunit/TestAssert.h>
// use this define to enable lines, execution of which leads to Segmentation Fault
//#define ENABLE_FAULTS
void MEDSPLITTERTest::testMESHCollection_constructor()
{
- string data_dir = getenv("MED_ROOT_DIR");
- string filename_rd = data_dir + "/share/salome/resources/med/carre_en_quad4_import22.med";
- string fileNotExist_rd = "notExist22.med";
- string emptyfilename = "";
+ string filename_rd = MEDSPLITTERTest_Utils::getResourceFile("carre_en_quad4.med");
+ string fileNotExist_rd = "notExist22.med";
+ string emptyfilename = "";
//--------------------------Test READ ONLY part------------------------------//
/////////////////////////////////////////////////////////////
- // TEST1a: Open not existing sequential and parallel file //
- /////////////////////////////////////////////////////////////
+ // TEST1a: Open not existing sequential and parallel file //
+ /////////////////////////////////////////////////////////////
string meshname="non_existent";
CPPUNIT_ASSERT_THROW(MESHCollection mc1(fileNotExist_rd, meshname), MEDEXCEPTION);
CPPUNIT_ASSERT_THROW(MESHCollection mc3(filename_rd, meshname), MEDEXCEPTION);
- // //////////////////////////////////////////////
- // // TEST1b: Open file with empty file name ///
- // //////////////////////////////////////////////
- //
+ // //////////////////////////////////////////////
+ // // TEST1b: Open file with empty file name ///
+ // //////////////////////////////////////////////
+ //
CPPUNIT_ASSERT_THROW(MESHCollection mc4(emptyfilename, meshname), MEDEXCEPTION);
CPPUNIT_ASSERT_THROW(MESHCollection mc5(emptyfilename), MEDEXCEPTION);
//! Testing basic manipulation for a sequential file
void MEDSPLITTERTest::testMESHCollection_read_seq()
{
- string data_dir = getenv("MED_ROOT_DIR");
- string tmp_dir = getenv("TMP");
- if (tmp_dir == "")
- tmp_dir = "/tmp";
- string filename_rd = data_dir + "/share/salome/resources/med/pointe_import22.med";
- string filename_seq_wr = tmp_dir + "/myWrField_seq_pointe22";
- string filename_seq_med = tmp_dir + "/myWrField_seq_pointe221.med";
+ string filename_rd = MEDSPLITTERTest_Utils::getResourceFile("pointe.med");
+ string filename_seq_wr = MEDSPLITTERTest_Utils::makeTmpFile("myWrField_seq_pointe22");
+ string filename_seq_med = MEDSPLITTERTest_Utils::makeTmpFile("myWrField_seq_pointe221.med");
// To remove tmp files from disk
MEDSPLITTERTest_TmpFilesRemover aRemover;
aRemover.Register(filename_seq_wr);
aRemover.Register(filename_seq_med);
- //--------------------------Test READ ONLY part------------------------------//
+ //--------------------------Test READ ONLY part------------------------------//
- // /////////////////////////////////////////////
- // // TEST2: Manipulation of a single MED file
- // /////////////////////////////////////////////
+ // /////////////////////////////////////////////
+ // // TEST2: Manipulation of a single MED file
+ // /////////////////////////////////////////////
string meshname="maa1";
MESHCollection collection(filename_rd,meshname);
- collection.setDriverType(MEDSPLITTER::MedAscii);
+ collection.setDriverType(MEDSPLITTER::MedAscii);
CPPUNIT_ASSERT_EQUAL(meshname,collection.getName());
string newname = "New_name";
collection.setName(newname);
CPPUNIT_ASSERT_EQUAL(systemname,collection.getSystem());
CPPUNIT_ASSERT_EQUAL(3,collection.getMeshDimension());
CPPUNIT_ASSERT_EQUAL(3,collection.getSpaceDimension());
-
+
collection.write(filename_seq_wr);
//Reading from the master file
void MEDSPLITTERTest::testMESHCollection_read_para()
{
- string data_dir = getenv("MED_ROOT_DIR");
- string tmp_dir = getenv("TMP");
- if (tmp_dir == "")
- tmp_dir = "/tmp";
- string filename_rd = data_dir + "/share/salome/resources/med/pointe_import22.med";
- string filename_para_wr = tmp_dir + "/myWrField_para_pointe22_";
- string filename_xml = tmp_dir + "/myWrField_para_pointe22_.xml";
- string filename_para_med0 = tmp_dir + "/myWrField_para_pointe22_1.med";
- string filename_para_med1 = tmp_dir + "/myWrField_para_pointe22_2.med";
+ string filename_rd = MEDSPLITTERTest_Utils::getResourceFile("pointe.med");
+ string filename_para_wr = MEDSPLITTERTest_Utils::makeTmpFile("myWrField_para_pointe22_");
+ string filename_xml = MEDSPLITTERTest_Utils::makeTmpFile("myWrField_para_pointe22_.xml");
+ string filename_para_med0 = MEDSPLITTERTest_Utils::makeTmpFile("myWrField_para_pointe22_1.med");
+ string filename_para_med1 = MEDSPLITTERTest_Utils::makeTmpFile("myWrField_para_pointe22_2.med");
// To remove tmp files from disk
Topology* topo=0;
CPPUNIT_ASSERT_THROW(topo=collection.createPartition(0,Graph::METIS),MEDEXCEPTION);
if (topo!=0) delete topo;
-#ifdef ENABLE_METIS
+#ifdef MED_ENABLE_METIS
CPPUNIT_ASSERT_NO_THROW(topo=collection.createPartition(2,Graph::METIS));
#else
CPPUNIT_ASSERT_THROW(topo=collection.createPartition(2,Graph::METIS), MEDEXCEPTION);
void MEDSPLITTERTest::testMESHCollection_square()
{
- string data_dir = getenv("MED_ROOT_DIR");
- string tmp_dir = getenv("TMP");
- if (tmp_dir == "")
- tmp_dir = "/tmp";
- string filename_rd = data_dir + "/share/salome/resources/med/carre_en_quad4_import22.med";
- string filename_wr = tmp_dir+"/carre_split";
- string filename_wr_1 = tmp_dir+"/carre_split1.med";
- string filename_wr_2 = tmp_dir+"/carre_split2.med";
+ string filename_rd = MEDSPLITTERTest_Utils::getResourceFile("carre_en_quad4.med");
+ string filename_wr = MEDSPLITTERTest_Utils::makeTmpFile("carre_split");
+ string filename_wr_1 = MEDSPLITTERTest_Utils::makeTmpFile("carre_split1.med");
+ string filename_wr_2 = MEDSPLITTERTest_Utils::makeTmpFile("carre_split2.med");
// To remove tmp files from disk
MEDSPLITTERTest_TmpFilesRemover aRemover;
MESHCollection collection(filename_rd,meshname);
MEDSPLITTER::Topology* topo;
-#ifdef ENABLE_METIS
+#ifdef MED_ENABLE_METIS
CPPUNIT_ASSERT_NO_THROW(topo = collection.createPartition(2,Graph::METIS));
#else
CPPUNIT_ASSERT_THROW(topo = collection.createPartition(2,Graph::METIS), MEDEXCEPTION);
//testing number of joints
- med_2_3::med_idt fid1 = med_2_3::MEDouvrir(const_cast<char*> (filename_wr_1.c_str()),med_2_3::MED_LECTURE);
- med_2_3::med_idt fid2 = med_2_3::MEDouvrir(const_cast<char*> (filename_wr_2.c_str()),med_2_3::MED_LECTURE);
- int nj1= med_2_3::MEDnJoint(fid1, meshname1);
- int nj2= med_2_3::MEDnJoint(fid2, meshname2);
+ med_2_3::med_idt fid1 = med_2_3::MEDfileOpen(filename_wr_1.c_str(),med_2_3::MED_ACC_RDONLY);
+ med_2_3::med_idt fid2 = med_2_3::MEDfileOpen(filename_wr_2.c_str(),med_2_3::MED_ACC_RDONLY);
+ int nj1= med_2_3::MEDnSubdomainJoint(fid1, meshname1);
+ int nj2= med_2_3::MEDnSubdomainJoint(fid2, meshname2);
CPPUNIT_ASSERT_EQUAL(nj1,1);
CPPUNIT_ASSERT_EQUAL(nj2,1);
//testing distant domains
- char desc1[MED_TAILLE_DESC];
- char maa_dist1[MED_TAILLE_NOM], jn1[MED_TAILLE_NOM];
- char desc2[MED_TAILLE_DESC], maa_dist2[MED_TAILLE_NOM], jn2[MED_TAILLE_NOM];
+ char desc1[MED_COMMENT_SIZE+1];
+ char maa_dist1[MED_NAME_SIZE+1], jn1[MED_NAME_SIZE+1];
+ char desc2[MED_COMMENT_SIZE+1], maa_dist2[MED_NAME_SIZE+1], jn2[MED_NAME_SIZE+1];
int dom1, dom2;
- med_2_3::MEDjointInfo(fid1, meshname1, 1, jn1, desc1, &dom1, maa_dist1);
- med_2_3::MEDjointInfo(fid2, meshname2, 1, jn2, desc2, &dom2, maa_dist2);
- CPPUNIT_ASSERT(strcmp(jn1,"joint_2")==0);
- CPPUNIT_ASSERT(strcmp(jn2,"joint_1")==0);
+ int nstep,nocstp;
+ med_2_3::MEDsubdomainJointInfo(fid1, meshname1, 1, jn1, desc1, &dom1, maa_dist1, &nstep, &nocstp);
+ med_2_3::MEDsubdomainJointInfo(fid2, meshname2, 1, jn2, desc2, &dom2, maa_dist2, &nstep, &nocstp);
+ CPPUNIT_ASSERT(strcmp(jn1,"joint_2")==0);
+ CPPUNIT_ASSERT(strcmp(jn2,"joint_1")==0);
CPPUNIT_ASSERT_EQUAL(dom1,1);
CPPUNIT_ASSERT_EQUAL(dom2,0);
// testing node-node correspondency
- med_2_3::med_entite_maillage typ_ent_loc=med_2_3::MED_NOEUD;
- med_2_3::med_entite_maillage typ_ent_dist=med_2_3::MED_NOEUD;
- med_2_3::med_geometrie_element typ_geo_loc= med_2_3::MED_POINT1;
- med_2_3::med_geometrie_element typ_geo_dist= med_2_3::MED_POINT1;
+ med_2_3::med_entity_type typ_ent_loc=med_2_3::MED_NODE;
+ med_2_3::med_entity_type typ_ent_dist=med_2_3::MED_NODE;
+ med_2_3::med_geometry_type typ_geo_loc= MED_POINT1;
+ med_2_3::med_geometry_type typ_geo_dist= MED_POINT1;
- int n1 = med_2_3::MEDjointnCorres(fid1,meshname1,jn1,typ_ent_loc, typ_geo_loc,typ_ent_dist, typ_geo_dist);
+ int n1;
+ med_2_3::MEDsubdomainCorrespondenceSize(fid1,meshname1,jn1,MED_NO_DT, MED_NO_IT, typ_ent_loc, typ_geo_loc,typ_ent_dist, typ_geo_dist, &n1);
med_2_3::med_int* tab = new med_2_3::med_int[2*n1];
- med_2_3::MEDjointLire(fid1,meshname1,jn1,tab,n1,typ_ent_loc, typ_geo_loc,typ_ent_dist, typ_geo_dist);
+ med_2_3::MEDsubdomainCorrespondenceRd(fid1,meshname1,jn1,MED_NO_DT, MED_NO_IT,typ_ent_loc, typ_geo_loc,typ_ent_dist, typ_geo_dist, tab);
med_2_3::med_int tabreference1[6] = {2,1,3,4,6,5};
for (int i=0; i<2*n1; i++)
- CPPUNIT_ASSERT_EQUAL(tab[i],tabreference1[i]);
+ CPPUNIT_ASSERT_EQUAL(tab[i],tabreference1[i]);
delete[] tab;
- int n2 =med_2_3::MEDjointnCorres(fid2,meshname2,jn2,typ_ent_loc, typ_geo_loc,typ_ent_dist, typ_geo_dist);
+ int n2;
+ med_2_3::MEDsubdomainCorrespondenceSize(fid2,meshname2,jn2,MED_NO_DT, MED_NO_IT,typ_ent_loc, typ_geo_loc,typ_ent_dist, typ_geo_dist,&n2);
tab = new med_2_3::med_int[2*n2];
- med_2_3::MEDjointLire(fid2,meshname2,jn2,tab,n2,typ_ent_loc, typ_geo_loc,typ_ent_dist, typ_geo_dist);
+ med_2_3::MEDsubdomainCorrespondenceRd(fid2,meshname2,jn2,MED_NO_DT, MED_NO_IT,typ_ent_loc, typ_geo_loc,typ_ent_dist, typ_geo_dist,tab);
med_2_3::med_int tabreference2[] = {1,2,4,3,5,6};
for (int i=0; i<2*n1; i++)
- CPPUNIT_ASSERT_EQUAL(tab[i],tabreference2[i]);
+ CPPUNIT_ASSERT_EQUAL(tab[i],tabreference2[i]);
delete[] tab;
//testing nodes global numbering
med_2_3::med_int* num = new med_2_3::med_int[6];
- cout << "Reading global " << MEDglobalNumLire(fid1, meshname1, num, 6, typ_ent_loc, typ_geo_loc) << endl;
+ cout << "Reading global " << MEDmeshGlobalNumberRd(fid1, meshname1, MED_NO_DT, MED_NO_IT, typ_ent_loc, typ_geo_loc, num) << endl;
med_2_3::med_int globnoderef1[] = {4,5,2,1,7,8};
for (int i=0; i<6; i++)
- CPPUNIT_ASSERT_EQUAL(num[i],globnoderef1[i]);
+ CPPUNIT_ASSERT_EQUAL(num[i],globnoderef1[i]);
delete[] num;
//testing nodes global numbering
num = new med_2_3::med_int[6];
- MEDglobalNumLire(fid2, meshname2, num, 6, typ_ent_loc, typ_geo_loc);
+ MEDmeshGlobalNumberRd(fid2, meshname2, MED_NO_DT, MED_NO_IT, typ_ent_loc, typ_geo_loc, num);
med_2_3::med_int globnoderef2[] = {5,6,3,2,8,9};
for (int i=0; i<6; i++)
CPPUNIT_ASSERT_EQUAL(num[i],globnoderef2[i]);
delete[] num;
//testing cell-cell correspondency
- typ_ent_loc=med_2_3::MED_MAILLE;
- typ_ent_dist=med_2_3::MED_MAILLE;
- typ_geo_loc= med_2_3::MED_QUAD4;
- typ_geo_dist= med_2_3::MED_QUAD4;
+ typ_ent_loc=med_2_3::MED_CELL;
+ typ_ent_dist=med_2_3::MED_CELL;
+ typ_geo_loc= MED_QUAD4;
+ typ_geo_dist= MED_QUAD4;
//joint1
- n1=med_2_3::MEDjointnCorres(fid1,meshname1,jn1,typ_ent_loc, typ_geo_loc,typ_ent_dist, typ_geo_dist);
+ med_2_3::MEDsubdomainCorrespondenceSize(fid1,meshname1,jn1,MED_NO_DT, MED_NO_IT,typ_ent_loc, typ_geo_loc,typ_ent_dist, typ_geo_dist,&n1);
CPPUNIT_ASSERT_EQUAL(n1,2);
tab = new med_2_3::med_int[2*n1];
- med_2_3::MEDjointLire(fid1,meshname1,jn1,tab,n1,typ_ent_loc, typ_geo_loc,typ_ent_dist, typ_geo_dist);
+ med_2_3::MEDsubdomainCorrespondenceRd(fid1,meshname1,jn1,MED_NO_DT, MED_NO_IT,typ_ent_loc, typ_geo_loc,typ_ent_dist, typ_geo_dist,tab);
med_2_3::med_int tabreferencecell1[4] = {1,1,2,2};
for (int i=0; i<2*n1; i++)
CPPUNIT_ASSERT_EQUAL(tab[i],tabreferencecell1[i]);
- n2=med_2_3::MEDjointnCorres(fid2,meshname2,jn2,typ_ent_loc, typ_geo_loc,typ_ent_dist, typ_geo_dist);
+ med_2_3::MEDsubdomainCorrespondenceSize(fid2,meshname2,jn2,MED_NO_DT, MED_NO_IT, typ_ent_loc, typ_geo_loc,typ_ent_dist, typ_geo_dist, &n2);
CPPUNIT_ASSERT_EQUAL(n2,2);
delete[] tab;
//joint2
tab = new med_2_3::med_int[2*n2];
- med_2_3::MEDjointLire(fid2,meshname2,jn2,tab,n2,typ_ent_loc, typ_geo_loc,typ_ent_dist, typ_geo_dist);
+ med_2_3::MEDsubdomainCorrespondenceRd(fid2,meshname2,jn2,MED_NO_DT, MED_NO_IT,typ_ent_loc, typ_geo_loc,typ_ent_dist, typ_geo_dist,tab);
med_2_3::med_int tabreferencecell2[4] = {1,1,2,2};
for (int i=0; i<n2; i++)
//testing cells global numbering
num = new med_2_3::med_int[2];
- MEDglobalNumLire(fid1, meshname1, num, 2, typ_ent_loc, typ_geo_loc);
+ MEDmeshGlobalNumberRd(fid1, meshname1, MED_NO_DT, MED_NO_IT, typ_ent_loc, typ_geo_loc, num);
med_2_3::med_int* globcellref = new med_2_3::med_int[2];
globcellref[0]=1;
globcellref[1]=3;
//testing cells global numbering
num = new med_2_3::med_int[2];
- MEDglobalNumLire(fid2, meshname2, num, 2, typ_ent_loc, typ_geo_loc);
+ MEDmeshGlobalNumberRd(fid2, meshname2, MED_NO_DT, MED_NO_IT, typ_ent_loc, typ_geo_loc, num);
globcellref[0]=2;
globcellref[1]=4;
for (int i=0; i<2; i++)
void MEDSPLITTERTest::testMESHCollection_square_with_faces()
{
- string data_dir = getenv("MED_ROOT_DIR");
- string tmp_dir = getenv("TMP");
- if (tmp_dir == "")
- tmp_dir = "/tmp";
- string filename_rd = data_dir + "/share/salome/resources/med/carre_en_quad4_import22.med";
- string filename_wr = tmp_dir+"/carre_split_faces";
- string filename_wr_1 = tmp_dir+"/carre_split_faces1.med";
- string filename_wr_2 = tmp_dir+"/carre_split_faces2.med";
+ string filename_rd = MEDSPLITTERTest_Utils::getResourceFile("carre_en_quad4.med");
+ string filename_wr = MEDSPLITTERTest_Utils::makeTmpFile("carre_split_faces");
+ string filename_wr_1 = MEDSPLITTERTest_Utils::makeTmpFile("carre_split_faces1.med");
+ string filename_wr_2 = MEDSPLITTERTest_Utils::makeTmpFile("carre_split_faces2.med");
// To remove tmp files from disk
MEDSPLITTERTest_TmpFilesRemover aRemover;
//testing number of joints
- med_2_3::med_idt fid1 = med_2_3::MEDouvrir(const_cast<char*> (filename_wr_1.c_str()),med_2_3::MED_LECTURE);
- med_2_3::med_idt fid2 = med_2_3::MEDouvrir(const_cast<char*> (filename_wr_2.c_str()),med_2_3::MED_LECTURE);
- int nj1= med_2_3::MEDnJoint(fid1, meshname1);
- int nj2= med_2_3::MEDnJoint(fid2, meshname2);
+ med_2_3::med_idt fid1 = med_2_3::MEDfileOpen(filename_wr_1.c_str(),med_2_3::MED_ACC_RDONLY);
+ med_2_3::med_idt fid2 = med_2_3::MEDfileOpen(filename_wr_2.c_str(),med_2_3::MED_ACC_RDONLY);
+ int nj1= med_2_3::MEDnSubdomainJoint(fid1, meshname1);
+ int nj2= med_2_3::MEDnSubdomainJoint(fid2, meshname2);
CPPUNIT_ASSERT_EQUAL(nj1,1);
CPPUNIT_ASSERT_EQUAL(nj2,1);
//testing distant domains
- char desc1[MED_TAILLE_DESC];
- char maa_dist1[MED_TAILLE_NOM], jn1[MED_TAILLE_NOM];
- char desc2[MED_TAILLE_DESC], maa_dist2[MED_TAILLE_NOM], jn2[MED_TAILLE_NOM];
+ char desc1[MED_COMMENT_SIZE+1];
+ char maa_dist1[MED_NAME_SIZE+1], jn1[MED_NAME_SIZE+1];
+ char desc2[MED_COMMENT_SIZE+1], maa_dist2[MED_NAME_SIZE+1], jn2[MED_NAME_SIZE+1];
int dom1, dom2;
- med_2_3::MEDjointInfo(fid1, meshname1, 1, jn1, desc1, &dom1, maa_dist1);
- med_2_3::MEDjointInfo(fid2, meshname2, 1, jn2, desc2, &dom2, maa_dist2);
+ int nstep,nocstp;
+ med_2_3::MEDsubdomainJointInfo(fid1, meshname1, 1, jn1, desc1, &dom1, maa_dist1, &nstep, &nocstp);
+ med_2_3::MEDsubdomainJointInfo(fid2, meshname2, 1, jn2, desc2, &dom2, maa_dist2, &nstep, &nocstp);
CPPUNIT_ASSERT_EQUAL(dom1,1);
CPPUNIT_ASSERT_EQUAL(dom2,0);
// testing node-node correspondency
- med_2_3::med_entite_maillage typ_ent_loc=med_2_3::MED_NOEUD;
- med_2_3::med_entite_maillage typ_ent_dist=med_2_3::MED_NOEUD;
- med_2_3::med_geometrie_element typ_geo_loc= med_2_3::MED_POINT1;
- med_2_3::med_geometrie_element typ_geo_dist= med_2_3::MED_POINT1;
+ med_2_3::med_entity_type typ_ent_loc=med_2_3::MED_NODE;
+ med_2_3::med_entity_type typ_ent_dist=med_2_3::MED_NODE;
+ med_2_3::med_geometry_type typ_geo_loc= MED_POINT1;
+ med_2_3::med_geometry_type typ_geo_dist= MED_POINT1;
- int n1 =med_2_3::MEDjointnCorres(fid1,meshname1,jn1,typ_ent_loc, typ_geo_loc,typ_ent_dist, typ_geo_dist);
+ int n1;
+ med_2_3::MEDsubdomainCorrespondenceSize(fid1,meshname1,jn1, MED_NO_DT, MED_NO_IT, typ_ent_loc, typ_geo_loc,typ_ent_dist, typ_geo_dist, &n1);
+ CPPUNIT_ASSERT_EQUAL(3,n1);
med_2_3::med_int* tab = new med_2_3::med_int[2*n1];
- med_2_3::MEDjointLire(fid1,meshname1,jn1,tab,n1,typ_ent_loc, typ_geo_loc,typ_ent_dist, typ_geo_dist);
+ med_2_3::MEDsubdomainCorrespondenceRd(fid1,meshname1,jn1, MED_NO_DT, MED_NO_IT,typ_ent_loc, typ_geo_loc,typ_ent_dist, typ_geo_dist, tab);
med_2_3::med_int tabreference1[6] = {2,1,3,4,6,5};
for (int i=0; i<2*n1; i++)
delete[] tab;
- int n2 = med_2_3::MEDjointnCorres(fid2,meshname2,jn2,typ_ent_loc, typ_geo_loc,typ_ent_dist, typ_geo_dist);
+ int n2;
+ med_2_3::MEDsubdomainCorrespondenceSize(fid2,meshname2,jn2, MED_NO_DT, MED_NO_IT, typ_ent_loc, typ_geo_loc,typ_ent_dist, typ_geo_dist,&n2);
tab = new med_2_3::med_int[2*n2];
- med_2_3::MEDjointLire(fid2,meshname2,jn2,tab,n2,typ_ent_loc, typ_geo_loc,typ_ent_dist, typ_geo_dist);
+ med_2_3::MEDsubdomainCorrespondenceRd(fid2,meshname2,jn2,MED_NO_DT, MED_NO_IT, typ_ent_loc, typ_geo_loc,typ_ent_dist, typ_geo_dist,tab);
med_2_3::med_int tabreference2[]={1,2,4,3,5,6};
for (int i=0; i<2*n1; i++)
//testing nodes global numbering
med_2_3::med_int* num = new med_2_3::med_int[6];
- cout << "Reading global " << MEDglobalNumLire(fid1, meshname1, num, 6, typ_ent_loc, typ_geo_loc) << endl;
+ cout << "Reading global " << MEDmeshGlobalNumberRd(fid1, meshname1, MED_NO_DT, MED_NO_IT, typ_ent_loc, typ_geo_loc, num) << endl;
med_2_3::med_int globnoderef1[]={4,5,2,1,7,8};
//testing nodes global numbering
num = new med_2_3::med_int[6];
- MEDglobalNumLire(fid2, meshname2, num, 6, typ_ent_loc, typ_geo_loc);
+ MEDmeshGlobalNumberRd(fid2, meshname2, MED_NO_DT, MED_NO_IT, typ_ent_loc, typ_geo_loc, num);
med_2_3::med_int globnoderef2[]={5,6,3,2,8,9};
for (int i=0; i<6; i++)
CPPUNIT_ASSERT_EQUAL(num[i],globnoderef2[i]);
delete[] num;
//testing cell-cell correspondency
- typ_ent_loc=med_2_3::MED_MAILLE;
- typ_ent_dist=med_2_3::MED_MAILLE;
- typ_geo_loc= med_2_3::MED_QUAD4;
- typ_geo_dist= med_2_3::MED_QUAD4;
+ typ_ent_loc=med_2_3::MED_CELL;
+ typ_ent_dist=med_2_3::MED_CELL;
+ typ_geo_loc= MED_QUAD4;
+ typ_geo_dist= MED_QUAD4;
//joint1
- n1=med_2_3::MEDjointnCorres(fid1,meshname1,jn1,typ_ent_loc, typ_geo_loc,typ_ent_dist, typ_geo_dist);
+ med_2_3::MEDsubdomainCorrespondenceSize(fid1,meshname1,jn1,MED_NO_DT, MED_NO_IT,typ_ent_loc, typ_geo_loc,typ_ent_dist, typ_geo_dist,&n1);
CPPUNIT_ASSERT_EQUAL(n1,2);
tab = new med_2_3::med_int[2*n1];
- med_2_3::MEDjointLire(fid1,meshname1,jn1,tab,n1,typ_ent_loc, typ_geo_loc,typ_ent_dist, typ_geo_dist);
+ med_2_3::MEDsubdomainCorrespondenceRd(fid1,meshname1,jn1,MED_NO_DT, MED_NO_IT,typ_ent_loc, typ_geo_loc,typ_ent_dist, typ_geo_dist,tab);
med_2_3::med_int tabreferencecell1[4]={1,1,2,2};
for (int i=0; i<2*n1; i++)
CPPUNIT_ASSERT_EQUAL(tab[i],tabreferencecell1[i]);
- n2=med_2_3::MEDjointnCorres(fid2,meshname2,jn2,typ_ent_loc, typ_geo_loc,typ_ent_dist, typ_geo_dist);
+ med_2_3::MEDsubdomainCorrespondenceSize(fid2,meshname2,jn2,MED_NO_DT, MED_NO_IT,typ_ent_loc, typ_geo_loc,typ_ent_dist, typ_geo_dist,&n2);
CPPUNIT_ASSERT_EQUAL(n2,2);
delete[] tab;
//joint2
tab = new med_2_3::med_int[2*n2];
- med_2_3::MEDjointLire(fid2,meshname2,jn2,tab,n2,typ_ent_loc, typ_geo_loc,typ_ent_dist, typ_geo_dist);
+ med_2_3::MEDsubdomainCorrespondenceRd(fid2,meshname2,jn2,MED_NO_DT, MED_NO_IT,typ_ent_loc, typ_geo_loc,typ_ent_dist, typ_geo_dist,tab);
med_2_3::med_int tabreferencecell2[4]={1,1,2,2};
for (int i=0; i<n2; i++)
//testing cells global numbering
num = new med_2_3::med_int[2];
- MEDglobalNumLire(fid1, meshname1, num, 2, typ_ent_loc, typ_geo_loc);
+ MEDmeshGlobalNumberRd(fid1, meshname1, MED_NO_DT, MED_NO_IT, typ_ent_loc, typ_geo_loc,num);
med_2_3::med_int* globcellref = new int[2];
globcellref[0]=1;
globcellref[1]=3;
//testing cells global numbering
num = new med_2_3::med_int[2];
- MEDglobalNumLire(fid2, meshname2, num, 2, typ_ent_loc, typ_geo_loc);
+ MEDmeshGlobalNumberRd(fid2, meshname2, MED_NO_DT, MED_NO_IT, typ_ent_loc, typ_geo_loc,num);
globcellref[0]=2;
globcellref[1]=4;
for (int i=0; i<2; i++)
delete[] num;
//testing face/face/correspondency
- typ_ent_loc=med_2_3::MED_MAILLE;
- typ_ent_dist=med_2_3::MED_MAILLE;
- typ_geo_loc= med_2_3::MED_SEG2;
- typ_geo_dist= med_2_3::MED_SEG2;
+ typ_ent_loc=med_2_3::MED_CELL;
+ typ_ent_dist=med_2_3::MED_CELL;
+ typ_geo_loc= MED_SEG2;
+ typ_geo_dist= MED_SEG2;
//joint1
- n1=med_2_3::MEDjointnCorres(fid1,meshname1,jn1,typ_ent_loc, typ_geo_loc,typ_ent_dist, typ_geo_dist);
+ med_2_3::MEDsubdomainCorrespondenceSize(fid1,meshname1,jn1,MED_NO_DT, MED_NO_IT,typ_ent_loc, typ_geo_loc,typ_ent_dist, typ_geo_dist, &n1);
CPPUNIT_ASSERT_EQUAL(n1,2);
tab = new med_2_3::med_int[2*n1];
- med_2_3::MEDjointLire(fid1,meshname1,jn1,tab,n1,typ_ent_loc, typ_geo_loc,typ_ent_dist, typ_geo_dist);
+ med_2_3::MEDsubdomainCorrespondenceRd(fid1,meshname1,jn1,MED_NO_DT, MED_NO_IT, typ_ent_loc, typ_geo_loc,typ_ent_dist, typ_geo_dist,tab);
med_2_3::med_int tabreferencecell3[4]={1,1,2,2};
for (int i=0; i<2*n1; i++)
CPPUNIT_ASSERT_EQUAL(tab[i],tabreferencecell3[i]);
- n2=med_2_3::MEDjointnCorres(fid2,meshname2,jn2,typ_ent_loc, typ_geo_loc,typ_ent_dist, typ_geo_dist);
+ med_2_3::MEDsubdomainCorrespondenceSize(fid2,meshname2,jn2,MED_NO_DT, MED_NO_IT,typ_ent_loc, typ_geo_loc,typ_ent_dist, typ_geo_dist, &n2);
CPPUNIT_ASSERT_EQUAL(n2,2);
delete[] tab;
//joint2
tab = new med_2_3::med_int[2*n2];
- med_2_3::MEDjointLire(fid2,meshname2,jn2,tab,n2,typ_ent_loc, typ_geo_loc,typ_ent_dist, typ_geo_dist);
+ med_2_3::MEDsubdomainCorrespondenceRd(fid2,meshname2,jn2,MED_NO_DT, MED_NO_IT,typ_ent_loc, typ_geo_loc,typ_ent_dist, typ_geo_dist,tab);
med_2_3::med_int tabreferencecell4[4]={1,1,2,2};
for (int i=0; i<n2; i++)
void MEDSPLITTERTest::testMESHCollection_indivisible()
{
- string data_dir = getenv("MED_ROOT_DIR");
- string tmp_dir = getenv("TMP");
- if (tmp_dir == "")
- tmp_dir = "/tmp";
- string filename_rd = data_dir + "/share/salome/resources/med/maill.00.med";
- string filename_wr = tmp_dir + "/carre_indivisible";
- string filename_wr_xml = tmp_dir + "/carre_indivisible.xml";
- string filename_wr_1 = tmp_dir + "/carre_indivisible1.med";
- string filename_wr_2 = tmp_dir + "/carre_indivisible2.med";
- string filename_wr_3 = tmp_dir + "/carre_indivisible3.med";
- string filename_wr_4 = tmp_dir + "/carre_indivisible4.med";
+ string filename_rd = MEDSPLITTERTest_Utils::getResourceFile("maill.00.med");
+ string filename_wr = MEDSPLITTERTest_Utils::makeTmpFile("carre_indivisible");
+ string filename_wr_xml = MEDSPLITTERTest_Utils::makeTmpFile("carre_indivisible.xml");
+ string filename_wr_1 = MEDSPLITTERTest_Utils::makeTmpFile("carre_indivisible1.med");
+ string filename_wr_2 = MEDSPLITTERTest_Utils::makeTmpFile("carre_indivisible2.med");
+ string filename_wr_3 = MEDSPLITTERTest_Utils::makeTmpFile("carre_indivisible3.med");
+ string filename_wr_4 = MEDSPLITTERTest_Utils::makeTmpFile("carre_indivisible4.med");
- // To remove tmp files from disk
+ // To remove tmp files from disk
MEDSPLITTERTest_TmpFilesRemover aRemover;
aRemover.Register(filename_wr);
aRemover.Register(filename_wr_xml);
char meshname[20] = "MAILTRQU";
- char family[MED_TAILLE_NOM]="QUAD";
+ char family[MED_NAME_SIZE]="QUAD";
MESHCollection collection(filename_rd,meshname);
collection.setIndivisibleGroup(family);
Topology* topo;
-#ifdef ENABLE_SCOTCH
+#ifdef MED_ENABLE_SCOTCH
CPPUNIT_ASSERT_NO_THROW(topo = collection.createPartition(4,Graph::SCOTCH));
#else
CPPUNIT_ASSERT_THROW(topo = collection.createPartition(4,Graph::SCOTCH), MEDEXCEPTION);
void MEDSPLITTERTest::testMESHCollection_user_partition()
{
- string data_dir = getenv("MED_ROOT_DIR");
- string tmp_dir = getenv("TMP");
- if (tmp_dir == "")
- tmp_dir = "/tmp";
- string filename_rd = data_dir + "/share/salome/resources/med/carre_en_quad4_import22.med";
- string filename_wr = tmp_dir+"/carre_split_user";
- string filename_wr_1 = tmp_dir+"/carre_split_user1.med";
- string filename_wr_2 = tmp_dir+"/carre_split_user2.med";
+ string filename_rd = MEDSPLITTERTest_Utils::getResourceFile("carre_en_quad4.med");
+ string filename_wr = MEDSPLITTERTest_Utils::makeTmpFile("carre_split_user");
+ string filename_wr_1 = MEDSPLITTERTest_Utils::makeTmpFile("carre_split_user1.med");
+ string filename_wr_2 = MEDSPLITTERTest_Utils::makeTmpFile("carre_split_user2.med");
// To remove tmp files from disk
MEDSPLITTERTest_TmpFilesRemover aRemover;
CPPUNIT_ASSERT_EQUAL(nbelem2,2);
//testing number of joints
- med_2_3::med_idt fid1 = med_2_3::MEDouvrir(const_cast<char*>(filename_wr_1.c_str()),med_2_3::MED_LECTURE);
- med_2_3::med_idt fid2 = med_2_3::MEDouvrir(const_cast<char*>(filename_wr_2.c_str()),med_2_3::MED_LECTURE);
+ med_2_3::med_idt fid1 = med_2_3::MEDfileOpen(filename_wr_1.c_str(),med_2_3::MED_ACC_RDONLY);
+ med_2_3::med_idt fid2 = med_2_3::MEDfileOpen(filename_wr_2.c_str(),med_2_3::MED_ACC_RDONLY);
- int nj1= med_2_3::MEDnJoint(fid1, meshname1);
- int nj2= med_2_3::MEDnJoint(fid2, meshname2);
+ int nj1= med_2_3::MEDnSubdomainJoint(fid1, meshname1);
+ int nj2= med_2_3::MEDnSubdomainJoint(fid2, meshname2);
CPPUNIT_ASSERT_EQUAL(nj1,1);
CPPUNIT_ASSERT_EQUAL(nj2,1);
//testing distant domains
- char desc1[MED_TAILLE_DESC];
- char maa_dist1[MED_TAILLE_NOM], jn1[MED_TAILLE_NOM];
- char desc2[MED_TAILLE_DESC];
- char maa_dist2[MED_TAILLE_NOM], jn2[MED_TAILLE_NOM];
+ char desc1[MED_COMMENT_SIZE+1];
+ char maa_dist1[MED_NAME_SIZE+1], jn1[MED_NAME_SIZE+1];
+ char desc2[MED_COMMENT_SIZE+1];
+ char maa_dist2[MED_NAME_SIZE+1], jn2[MED_NAME_SIZE+1];
//int dom1, dom2;
med_2_3::med_int dom1, dom2;
- med_2_3::MEDjointInfo(fid1, meshname1, 1, jn1, desc1, &dom1, maa_dist1);
- med_2_3::MEDjointInfo(fid2, meshname2, 1, jn2, desc2, &dom2, maa_dist2);
+ int nstep,nocstp;
+ med_2_3::MEDsubdomainJointInfo(fid1, meshname1, 1, jn1, desc1, &dom1, maa_dist1, &nstep, &nocstp);
+ med_2_3::MEDsubdomainJointInfo(fid2, meshname2, 1, jn2, desc2, &dom2, maa_dist2, &nstep, &nocstp);
CPPUNIT_ASSERT_EQUAL(dom1,1);
CPPUNIT_ASSERT_EQUAL(dom2,0);
// testing node-node correspondency
- med_2_3::med_entite_maillage typ_ent_loc=med_2_3::MED_NOEUD;
- med_2_3::med_entite_maillage typ_ent_dist=med_2_3::MED_NOEUD;
- med_2_3::med_geometrie_element typ_geo_loc= med_2_3::MED_POINT1;
- med_2_3::med_geometrie_element typ_geo_dist= med_2_3::MED_POINT1;
-
- int n1 = med_2_3::MEDjointnCorres(fid1,meshname1,jn1,typ_ent_loc, typ_geo_loc,typ_ent_dist, typ_geo_dist);
+ med_2_3::med_entity_type typ_ent_loc=med_2_3::MED_NODE;
+ med_2_3::med_entity_type typ_ent_dist=med_2_3::MED_NODE;
+ med_2_3::med_geometry_type typ_geo_loc= MED_POINT1;
+ med_2_3::med_geometry_type typ_geo_dist= MED_POINT1;
+
+ int n1;
+ med_2_3::MEDsubdomainCorrespondenceSize(fid1,meshname1,jn1,MED_NO_DT, MED_NO_IT,typ_ent_loc, typ_geo_loc,typ_ent_dist, typ_geo_dist,&n1);
+ CPPUNIT_ASSERT_EQUAL(5,n1);
med_2_3::med_int* tab = new med_2_3::med_int[2*n1];
- med_2_3::MEDjointLire(fid1,meshname1,jn1,tab,n1,typ_ent_loc, typ_geo_loc,typ_ent_dist, typ_geo_dist);
+ med_2_3::MEDsubdomainCorrespondenceRd(fid1,meshname1,jn1,MED_NO_DT, MED_NO_IT,typ_ent_loc, typ_geo_loc,typ_ent_dist, typ_geo_dist,tab);
med_2_3::med_int tabreference1[10] = {1,7,2,1,3,4,5,6,7,2};
for (int i=0; i<2*n1; i++)
CPPUNIT_ASSERT_EQUAL(tab[i],tabreference1[i]);
delete[] tab;
-
- int n2 = med_2_3::MEDjointnCorres(fid2,meshname2,jn2,typ_ent_loc, typ_geo_loc,typ_ent_dist, typ_geo_dist);
+ int n2;
+ med_2_3::MEDsubdomainCorrespondenceSize(fid2,meshname2,jn2,MED_NO_DT, MED_NO_IT,typ_ent_loc, typ_geo_loc,typ_ent_dist, typ_geo_dist,&n2);
tab = new med_2_3::med_int[2*n2];
- med_2_3::MEDjointLire(fid2,meshname2,jn2,tab,n2,typ_ent_loc, typ_geo_loc,typ_ent_dist, typ_geo_dist);
+ med_2_3::MEDsubdomainCorrespondenceRd(fid2,meshname2,jn2,MED_NO_DT, MED_NO_IT,typ_ent_loc, typ_geo_loc,typ_ent_dist, typ_geo_dist,tab);
med_2_3::med_int tabreference2[10] = {1,2,2,7,4,3,6,5,7,1};
for (int i=0; i<2*n2; i++)
- CPPUNIT_ASSERT_EQUAL(tab[i],tabreference2[i]);
+ CPPUNIT_ASSERT_EQUAL(tab[i],tabreference2[i]);
delete[] tab;
//testing nodes global numbering
med_2_3::med_int* num = new med_2_3::med_int[7];
- cout << "Reading global " << MEDglobalNumLire(fid1, meshname1, num, 7, typ_ent_loc, typ_geo_loc) << endl;
+ cout << "Reading global " << MEDmeshGlobalNumberRd(fid1, meshname1, MED_NO_DT, MED_NO_IT, typ_ent_loc, typ_geo_loc, num) << endl;
med_2_3::med_int globnoderef1[7] = {4,5,2,1,8,9,6};
for (int i=0; i<7; i++)
- CPPUNIT_ASSERT_EQUAL(num[i],globnoderef1[i]);
+ CPPUNIT_ASSERT_EQUAL(num[i],globnoderef1[i]);
delete[] num;
//testing nodes global numbering
num = new med_2_3::med_int[7];
- MEDglobalNumLire(fid2, meshname2, num, 7, typ_ent_loc, typ_geo_loc);
+ MEDmeshGlobalNumberRd(fid2, meshname2, MED_NO_DT, MED_NO_IT, typ_ent_loc, typ_geo_loc, num);
med_2_3::med_int globnoderef2[7] = {5,6,3,2,7,8,4};
for (int i=0; i<7; i++)
- CPPUNIT_ASSERT_EQUAL(num[i],globnoderef2[i]);
+ CPPUNIT_ASSERT_EQUAL(num[i],globnoderef2[i]);
delete[] num;
//testing cell-cell correspondency
- typ_ent_loc=med_2_3::MED_MAILLE;
- typ_ent_dist=med_2_3::MED_MAILLE;
- typ_geo_loc= med_2_3::MED_QUAD4;
- typ_geo_dist= med_2_3::MED_QUAD4;
+ typ_ent_loc=med_2_3::MED_CELL;
+ typ_ent_dist=med_2_3::MED_CELL;
+ typ_geo_loc= MED_QUAD4;
+ typ_geo_dist= MED_QUAD4;
//joint1
- n1 = med_2_3::MEDjointnCorres(fid1,meshname1,jn1,typ_ent_loc, typ_geo_loc,typ_ent_dist, typ_geo_dist);
+ med_2_3::MEDsubdomainCorrespondenceSize(fid1,meshname1,jn1,MED_NO_DT, MED_NO_IT,typ_ent_loc, typ_geo_loc,typ_ent_dist, typ_geo_dist, &n1);
tab = new med_2_3::med_int[2*n1];
- med_2_3::MEDjointLire(fid1,meshname1,jn1,tab,n1,typ_ent_loc, typ_geo_loc,typ_ent_dist, typ_geo_dist);
+ med_2_3::MEDsubdomainCorrespondenceRd(fid1,meshname1,jn1,MED_NO_DT, MED_NO_IT,typ_ent_loc, typ_geo_loc,typ_ent_dist, typ_geo_dist,tab);
med_2_3::med_int tabreferencecell1[8] = {1,1,1,2,2,1,2,2};
for (int i=0; i<2*n1; i++)
- CPPUNIT_ASSERT_EQUAL(tab[i],tabreferencecell1[i]);
+ CPPUNIT_ASSERT_EQUAL(tab[i],tabreferencecell1[i]);
- n2 = med_2_3::MEDjointnCorres(fid1,meshname1,jn1,typ_ent_loc, typ_geo_loc,typ_ent_dist, typ_geo_dist);
+ med_2_3::MEDsubdomainCorrespondenceSize(fid1,meshname1,jn1,MED_NO_DT, MED_NO_IT,typ_ent_loc, typ_geo_loc,typ_ent_dist, typ_geo_dist,&n2);
delete[] tab;
//joint2
tab = new med_2_3::med_int[2*n2];
- med_2_3::MEDjointLire(fid2,meshname2,jn2,tab,n2,typ_ent_loc, typ_geo_loc,typ_ent_dist, typ_geo_dist);
+ med_2_3::MEDsubdomainCorrespondenceRd(fid2,meshname2,jn2,MED_NO_DT, MED_NO_IT,typ_ent_loc, typ_geo_loc,typ_ent_dist, typ_geo_dist, tab);
med_2_3::med_int tabreferencecell2[8] = {1,1,1,2,2,1,2,2};
for (int i=0; i<n2; i++)
- CPPUNIT_ASSERT_EQUAL(tab[i],tabreferencecell2[i]);
+ CPPUNIT_ASSERT_EQUAL(tab[i],tabreferencecell2[i]);
delete[] tab;
//testing cells global numbering
num = new med_2_3::med_int[2];
- MEDglobalNumLire(fid1, meshname1, num, 2, typ_ent_loc, typ_geo_loc);
+ MEDmeshGlobalNumberRd(fid1, meshname1, MED_NO_DT, MED_NO_IT, typ_ent_loc, typ_geo_loc, num);
med_2_3::med_int globcellref1[2] = {1,4};
for (int i=0; i<2; i++)
CPPUNIT_ASSERT_EQUAL(num[i],globcellref1[i]);
//testing cells global numbering
num = new med_2_3::med_int[2];
- MEDglobalNumLire(fid2, meshname2, num, 2, typ_ent_loc, typ_geo_loc);
+ MEDmeshGlobalNumberRd(fid2, meshname2, MED_NO_DT, MED_NO_IT, typ_ent_loc, typ_geo_loc, num);
med_2_3::med_int globcellref2[2] = {2,3};
for (int i=0; i<2; i++)
CPPUNIT_ASSERT_EQUAL(num[i],globcellref2[i]);
void MEDSPLITTERTest::testMESHCollection_complete_sequence()
{
- string data_dir = getenv("MED_ROOT_DIR");
- string tmp_dir = getenv("TMP");
- if (tmp_dir == "")
- tmp_dir = "/tmp";
- string filename_rd = data_dir + "/share/salome/resources/med/pointe_import22.med";
- string filename_para_wr = tmp_dir + "/myWrField_para1_pointe22_";
- string filename_para_med1 = tmp_dir + "/myWrField_para1_pointe22_1.med";
- string filename_para_med2 = tmp_dir + "/myWrField_para1_pointe22_2.med";
- string filename_para2_wr = tmp_dir + "/myWrField_para2_pointe22_";
- string filename_para2_med1 = tmp_dir + "/myWrField_para2_pointe22_1.med";
- string filename_para2_med2 = tmp_dir + "/myWrField_para2_pointe22_2.med";
- string filename_para2_med3 = tmp_dir + "/myWrField_para2_pointe22_3.med";
- string filename_seq_wr = tmp_dir + "/myWrField_seq_pointe22_";
- string filename_seq_med = tmp_dir + "/myWrField_seq_pointe22_1.med";
+ string filename_rd = MEDSPLITTERTest_Utils::getResourceFile("pointe.med");
+ string filename_para_wr = MEDSPLITTERTest_Utils::makeTmpFile("myWrField_para1_pointe22_");
+ string filename_para_med1 = MEDSPLITTERTest_Utils::makeTmpFile("myWrField_para1_pointe22_1.med");
+ string filename_para_med2 = MEDSPLITTERTest_Utils::makeTmpFile("myWrField_para1_pointe22_2.med");
+ string filename_para2_wr = MEDSPLITTERTest_Utils::makeTmpFile("myWrField_para2_pointe22_");
+ string filename_para2_med1 = MEDSPLITTERTest_Utils::makeTmpFile("myWrField_para2_pointe22_1.med");
+ string filename_para2_med2 = MEDSPLITTERTest_Utils::makeTmpFile("myWrField_para2_pointe22_2.med");
+ string filename_para2_med3 = MEDSPLITTERTest_Utils::makeTmpFile("myWrField_para2_pointe22_3.med");
+ string filename_seq_wr = MEDSPLITTERTest_Utils::makeTmpFile("myWrField_seq_pointe22_");
+ string filename_seq_med = MEDSPLITTERTest_Utils::makeTmpFile("myWrField_seq_pointe22_1.med");
// To remove tmp files from disk
string meshname="maa1";
MESHCollection collection(filename_rd,meshname);
Topology* topo2;
-#ifdef ENABLE_METIS
+#ifdef MED_ENABLE_METIS
CPPUNIT_ASSERT_NO_THROW(topo2 = collection.createPartition(2,Graph::METIS));
#else
CPPUNIT_ASSERT_THROW(topo2 = collection.createPartition(2,Graph::METIS), MEDEXCEPTION);
CPPUNIT_FAIL("METIS is not available, further test execution is not possible.");
#endif
MESHCollection new_collection(collection, topo2);
- new_collection.setDriverType(MEDSPLITTER::MedAscii);
+ new_collection.setDriverType(MEDSPLITTER::MedAscii);
new_collection.write(filename_para_wr);
MESHCollection new_collection2(filename_para_wr);
CPPUNIT_ASSERT_EQUAL(collection.getName(),new_collection2.getName());
Topology* topo3;
-#ifdef ENABLE_SCOTCH
+#ifdef MED_ENABLE_SCOTCH
CPPUNIT_ASSERT_NO_THROW(topo3 = new_collection2.createPartition(3,Graph::SCOTCH));
#else
CPPUNIT_ASSERT_THROW(topo3 = new_collection2.createPartition(3,Graph::SCOTCH), MEDEXCEPTION);
#endif
MESHCollection new_collection3(new_collection2,topo3);
CPPUNIT_ASSERT_EQUAL(topo3->nbCells(),topo2->nbCells());
- new_collection3.setDriverType(MEDSPLITTER::MedAscii);
+ new_collection3.setDriverType(MEDSPLITTER::MedAscii);
new_collection3.write(filename_para2_wr);
MESHCollection new_collection4(filename_para2_wr);
void MEDSPLITTERTest::testMESHCollection_complete_sequence_with_polygon()
{
- string data_dir = getenv("MED_ROOT_DIR");
- string tmp_dir = getenv("TMP");
- if (tmp_dir == "")
- tmp_dir = "/tmp";
- string filename_rd = data_dir + "/share/salome/resources/med/recoll_bord.med";
- string filename_para_wr = tmp_dir + "/myWrField_para_recoll_";
- string filename_para_med1 = tmp_dir + "/myWrField_para_recoll_1.med";
- string filename_para_med2 = tmp_dir + "/myWrField_para_recoll_2.med";
- string filename_para2_wr = tmp_dir + "/myWrField_para2_recoll_";
- string filename_para2_med1 = tmp_dir + "/myWrField_para2_recoll_1.med";
- string filename_para2_med2 = tmp_dir + "/myWrField_para2_recoll_2.med";
- string filename_para2_med3 = tmp_dir + "/myWrField_para2_recoll_3.med";
- string filename_seq_wr = tmp_dir + "/myWrField_seq_recoll_";
- string filename_seq_med = tmp_dir + "/myWrField_seq_recoll_1.med";
+ string filename_rd = MEDSPLITTERTest_Utils::getResourceFile("recoll_bord.med");
+ string filename_para_wr = MEDSPLITTERTest_Utils::makeTmpFile("myWrField_para_recoll_");
+ string filename_para_med1 = MEDSPLITTERTest_Utils::makeTmpFile("myWrField_para_recoll_1.med");
+ string filename_para_med2 = MEDSPLITTERTest_Utils::makeTmpFile("myWrField_para_recoll_2.med");
+ string filename_para2_wr = MEDSPLITTERTest_Utils::makeTmpFile("myWrField_para2_recoll_");
+ string filename_para2_med1 = MEDSPLITTERTest_Utils::makeTmpFile("myWrField_para2_recoll_1.med");
+ string filename_para2_med2 = MEDSPLITTERTest_Utils::makeTmpFile("myWrField_para2_recoll_2.med");
+ string filename_para2_med3 = MEDSPLITTERTest_Utils::makeTmpFile("myWrField_para2_recoll_3.med");
+ string filename_seq_wr = MEDSPLITTERTest_Utils::makeTmpFile("myWrField_seq_recoll_");
+ string filename_seq_med = MEDSPLITTERTest_Utils::makeTmpFile("myWrField_seq_recoll_1.med");
// To remove tmp files from disk
MEDSPLITTERTest_TmpFilesRemover aRemover;
- aRemover.Register(filename_para_wr);
+ aRemover.Register(filename_para_wr);
aRemover.Register(filename_para_med1);
aRemover.Register(filename_para_med2);
aRemover.Register(filename_para2_wr);
MESHCollection new_collection4(filename_para2_wr);
Topology* topo1;
-#ifdef ENABLE_METIS
+#ifdef MED_ENABLE_METIS
CPPUNIT_ASSERT_NO_THROW(topo1 = new_collection4.createPartition(1,Graph::METIS));
#else
CPPUNIT_ASSERT_THROW(topo1 = new_collection4.createPartition(1,Graph::METIS), MEDEXCEPTION);
void MEDSPLITTERTest::testMESHCollection_complete_sequence_with_polyhedra()
{
- string data_dir = getenv("MED_ROOT_DIR");
- string tmp_dir = getenv("TMP");
- if (tmp_dir == "")
- tmp_dir = "/tmp";
- string filename_rd = data_dir + "/share/salome/resources/med/poly3D.med";
- //string filename_rd = "/tmp/polyedres.med" ;
- string filename_para_wr = tmp_dir + "/myWrField_para_poly3D_";
- string filename_para_med1 = tmp_dir + "/myWrField_para_poly3D_1.med";
- string filename_para_med2 = tmp_dir + "/myWrField_para_poly3D_2.med";
- string filename_para2_wr = tmp_dir + "/myWrField_para2_poly3D_";
- string filename_para2_med1 = tmp_dir + "/myWrField_para2_poly3D_1.med";
- string filename_para2_med2 = tmp_dir + "/myWrField_para2_poly3D_2.med";
- string filename_para2_med3 = tmp_dir + "/myWrField_para2_poly3D_3.med";
- string filename_seq_wr = tmp_dir + "/myWrField_seq_poly3D_";
- string filename_seq_med = tmp_dir + "/myWrField_seq_poly3D_1.med";
+ string filename_rd = MEDSPLITTERTest_Utils::getResourceFile("poly3D.med");
+ string filename_para_wr = MEDSPLITTERTest_Utils::makeTmpFile("myWrField_para_poly3D_");
+ string filename_para_med1 = MEDSPLITTERTest_Utils::makeTmpFile("myWrField_para_poly3D_1.med");
+ string filename_para_med2 = MEDSPLITTERTest_Utils::makeTmpFile("myWrField_para_poly3D_2.med");
+ string filename_para2_wr = MEDSPLITTERTest_Utils::makeTmpFile("myWrField_para2_poly3D_");
+ string filename_para2_med1 = MEDSPLITTERTest_Utils::makeTmpFile("myWrField_para2_poly3D_1.med");
+ string filename_para2_med2 = MEDSPLITTERTest_Utils::makeTmpFile("myWrField_para2_poly3D_2.med");
+ string filename_para2_med3 = MEDSPLITTERTest_Utils::makeTmpFile("myWrField_para2_poly3D_3.med");
+ string filename_seq_wr = MEDSPLITTERTest_Utils::makeTmpFile("myWrField_seq_poly3D_");
+ string filename_seq_med = MEDSPLITTERTest_Utils::makeTmpFile("myWrField_seq_poly3D_1.med");
// To remove tmp files from disk
}
/*! Testing a TRIO_U scenario with subzones defined as families
-
-
+
+
*/
void MEDSPLITTERTest::testMESHCollection_families()
{
- string data_dir = getenv("MED_ROOT_DIR");
- string tmp_dir = getenv("TMP");
- if (tmp_dir == "")
- tmp_dir = "/tmp";
- string filename_rd = data_dir + "/share/salome/resources/med/trio_2D.med";
- string filename_wr = tmp_dir+"/trio_split_faces";
- string filename_wr_1 = tmp_dir+"/trio_split_faces1.med";
- string filename_wr_2 = tmp_dir+"/trio_split_faces2.med";
+ string filename_rd = MEDSPLITTERTest_Utils::getResourceFile("trio_2D.med");
+ string filename_wr = MEDSPLITTERTest_Utils::makeTmpFile("trio_split_faces");
+ string filename_wr_1 = MEDSPLITTERTest_Utils::makeTmpFile("trio_split_faces1.med");
+ string filename_wr_2 = MEDSPLITTERTest_Utils::makeTmpFile("trio_split_faces2.med");
// To remove tmp files from disk
MEDSPLITTERTest_TmpFilesRemover aRemover;
MESHCollection* collection = new MESHCollection (filename_rd,meshname);
MEDSPLITTER::Topology* topo = collection->createPartition(2,Graph::METIS);
MESHCollection* new_collection = new MESHCollection (*collection, topo, true, true);
- new_collection->setSubdomainBoundaryCreates(true);
+ new_collection->setSubdomainBoundaryCreates(true);
//collection.write("/export/home/test_splitter");
new_collection->write(filename_wr);
new_collection->castAllFields(*collection);
-
+ delete topo;
delete collection;
delete new_collection;
int nbelem2=mesh2.getNumberOfElements(MED_EN::MED_CELL,MED_EN::MED_ALL_ELEMENTS);
CPPUNIT_ASSERT_EQUAL(nbelem1+nbelem2,2020);
-
-
-
+
+
+
//testing number of joints
- med_2_3::med_idt fid1 = med_2_3::MEDouvrir(const_cast<char*> (filename_wr_1.c_str()),med_2_3::MED_LECTURE);
- med_2_3::med_idt fid2 = med_2_3::MEDouvrir(const_cast<char*> (filename_wr_2.c_str()),med_2_3::MED_LECTURE);
- int nj1= med_2_3::MEDnJoint(fid1, meshname1);
- int nj2= med_2_3::MEDnJoint(fid2, meshname2);
+ med_2_3::med_idt fid1 = med_2_3::MEDfileOpen(filename_wr_1.c_str(),med_2_3::MED_ACC_RDONLY);
+ med_2_3::med_idt fid2 = med_2_3::MEDfileOpen(filename_wr_2.c_str(),med_2_3::MED_ACC_RDONLY);
+ int nj1= med_2_3::MEDnSubdomainJoint(fid1, meshname1);
+ int nj2= med_2_3::MEDnSubdomainJoint(fid2, meshname2);
CPPUNIT_ASSERT_EQUAL(nj1,1);
CPPUNIT_ASSERT_EQUAL(nj2,1);
-
+
//testing distant domains
-
- char desc1[MED_TAILLE_DESC+1];
- char maa_dist1[MED_TAILLE_NOM+1], jn1[MED_TAILLE_NOM+1];
- char desc2[MED_TAILLE_DESC+1], maa_dist2[MED_TAILLE_NOM+1], jn2[MED_TAILLE_NOM+1];
+
+ char desc1[MED_COMMENT_SIZE+1];
+ char maa_dist1[MED_NAME_SIZE+1], jn1[MED_NAME_SIZE+1];
+ char desc2[MED_COMMENT_SIZE+1], maa_dist2[MED_NAME_SIZE+1], jn2[MED_NAME_SIZE+1];
int dom1, dom2;
- med_2_3::MEDjointInfo(fid1, meshname1, 1, jn1, desc1, &dom1, maa_dist1);
- med_2_3::MEDjointInfo(fid2, meshname2, 1, jn2, desc2, &dom2, maa_dist2);
+ int nstep,nocstp;
+ med_2_3::MEDsubdomainJointInfo(fid1, meshname1, 1, jn1, desc1, &dom1, maa_dist1, &nstep, &nocstp);
+ med_2_3::MEDsubdomainJointInfo(fid2, meshname2, 1, jn2, desc2, &dom2, maa_dist2, &nstep, &nocstp);
CPPUNIT_ASSERT_EQUAL(dom1,1);
CPPUNIT_ASSERT_EQUAL(dom2,0);
-
- int nbEdgesFamilies1= med_2_3::MEDnFam(fid1, meshname1);
- int nbEdgesFamilies2= med_2_3::MEDnFam(fid2, meshname2);
- CPPUNIT_ASSERT_EQUAL(nbEdgesFamilies1,7); // six initial families + a joint
- CPPUNIT_ASSERT_EQUAL(nbEdgesFamilies2,7); // six initial families + a joint
+ int nbEdgesFamilies1= med_2_3::MEDnFamily(fid1, meshname1);
+ int nbEdgesFamilies2= med_2_3::MEDnFamily(fid2, meshname2);
+
+ CPPUNIT_ASSERT_EQUAL(nbEdgesFamilies1,7); // six initial families + a joint
+ CPPUNIT_ASSERT_EQUAL(nbEdgesFamilies2,7); // six initial families + a joint
+
+ // EAP 16 Apr 2012: order of families is actually unpredictable
+ // string fam_name = mesh1.getFamily(MED_EN::MED_EDGE,1)->getName();
+ // char test_name[MED_NAME_SIZE+1]="Sortie";
+ // CPPUNIT_ASSERT(strcmp(fam_name.c_str(),test_name)==0);
- string fam_name = mesh1.getFamily(MED_EN::MED_EDGE,1)->getName();
- char test_name[MED_TAILLE_NOM]="Sortie";
- CPPUNIT_ASSERT(strcmp(fam_name.c_str(),test_name)==0);
-
}