+// Copyright (C) 2006-2012 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
+//
+
#include "MeshCut_Maillage.hxx"
#include "MeshCut_Cube.hxx"
fid = MEDfileOpen(string2char(fichierMED), MED_ACC_RDONLY);
if (fid < 0)
{
- ERREUR("Erreur a l'ouverture du fichier\n");
+ ERREUR("Error file open\n");
}
//cout << chrono() << " --- inputMED: MEDfileOpen: ouverture du maillage en lecture seule, OK" << endl;
// Lecture des infos concernant le premier maillage
if (MEDmeshInfo(fid, 1, maa, &spacedim, &mdim, &type, desc, dtunit, &sortingtype, &nPasTemps, &axistype, axisname,
unitname) < 0)
- ERREUR("Erreur a la lecture des informations sur le maillage ");
+ ERREUR("Error while reading mesh informations ");
//cout << chrono() << " --- inputMED: MEDmeshInfo: OK" << endl;
- cerr << "maa=" << maa << endl;
- cerr << "spacedim=" << spacedim << endl;
- cerr << "mdim=" << mdim << endl;
- cerr << "type=" << type << endl;
- cerr << "desc=" << desc << endl;
- cerr << "dtunit=" << dtunit << endl;
- cerr << "sortingtype=" << sortingtype << endl;
- cerr << "nPasTemps=" << nPasTemps << endl;
- cerr << "axistype=" << axistype << endl;
- cerr << "axisname=" << axisname << endl;
- cerr << "unitname=" << unitname << endl;
+// cerr << "maa=" << maa << endl;
+// cerr << "spacedim=" << spacedim << endl;
+// cerr << "mdim=" << mdim << endl;
+// cerr << "type=" << type << endl;
+// cerr << "desc=" << desc << endl;
+// cerr << "dtunit=" << dtunit << endl;
+// cerr << "sortingtype=" << sortingtype << endl;
+// cerr << "nPasTemps=" << nPasTemps << endl;
+// cerr << "axistype=" << axistype << endl;
+// cerr << "axisname=" << axisname << endl;
+// cerr << "unitname=" << unitname << endl;
dimensionMaillage = mdim;
dimensionEspace = spacedim;
med_int nFamilles;
char nomGroupeChar[MED_LNAME_SIZE + 1];
if ((nFamilles = MEDnFamily(fid, maa)) < 0)
- ERREUR("ERREUR MEDnFamily");
+ ERREUR("ERROR MEDnFamily");
// Initialisation des tailles: tailleFAMILLES et tailleGROUPES
med_int numfam, *attide, *attval, natt, ngro;
if ((ngro = MEDnFamilyGroup(fid, maa, i + 1)) < 0)
- ERREUR("ERREUR MEDnFamilyGroup");
+ ERREUR("ERROR MEDnFamilyGroup");
if ((natt = MEDnFamily23Attribute(fid, maa, i + 1)) < 0)
- ERREUR("ERREUR MEDnFamily23Attribute");
+ ERREUR("ERROR MEDnFamily23Attribute");
attide = (med_int *) malloc(sizeof(med_int) * natt);
attval = (med_int *) malloc(sizeof(med_int) * natt);
gro = (char *) malloc(MED_LNAME_SIZE * ngro + 1);
if (MEDfamilyInfo(fid, maa, (med_int) (i + 1), nomfam, &numfam, gro) < 0)
- ERREUR("ERREUR MEDfamilyInfo");
+ ERREUR("ERROR MEDfamilyInfo");
for (int ig = 1; ig <= ngro; ig++)
{
&coordinatechangement, &geotransformation);
if (nnoe < 0)
- ERREUR("Erreur a la lecture du nombre de noeuds");
+ ERREUR("Error while reading number of nodes");
nombreNoeudsMaillage = nnoe;
if (nnoe > 0)
{
if (MEDmeshEntityFamilyNumberRd(fid, maa, MED_NO_DT, MED_NO_IT, MED_NODE, MED_NONE, famNoeuds) < 0)
- ERREUR("Erreur a la lecture des familles de noeuds (MEDmeshEntityFamilyNumberRd)");
+ ERREUR("Error while reading family node number (MEDmeshEntityFamilyNumberRd)");
}
/* Allocations memoires */
// Lecture des composantes des coordonnees des noeuds
if (nnoe > 0)
if (MEDmeshNodeCoordinateRd(fid, maa, MED_NO_DT, MED_NO_IT, MED_FULL_INTERLACE, coo1) < 0)
- ERREUR("Erreur a la lecture des coordonnees des noeuds");
+ ERREUR("Error while reading nodes coordinates");
// // Les noeuds ont-ils un nom? un numéro?
// if (nnoe > 0)
if (MEDmeshElementRd(fid, maa, MED_NO_DT, MED_NO_IT, MED_CELL, typeBanaliseMED, MED_NODAL, MED_FULL_INTERLACE,
CNX[TYPE], &inomTYPE, nomTYPE, &inumTYPE, numTYPE, &ifamTYPE, famTYPE) < 0)
- ERREUR("Erreur a la lecture des coordonnees des noeuds");
+ ERREUR("Error while reading elements");
// Conversion HL
conversionCNX(CNX[TYPE], TYPE, nTYPE);
// Sortie sur erreur en cas de maillage sans noeuds
if (nombreNoeudsMaillage <= 0)
{
- ERREUR("Ce maillage ne contient aucun noeud\n"); /* cout << "Maillage sans noeuds" << endl; */
+ ERREUR("This mesh does not contain any node\n"); /* cout << "Maillage sans noeuds" << endl; */
}
// ########################################################################
med_idt fid = MEDfileOpen(string2char(fichierMED), MED_ACC_CREAT);
if (fid < 0)
{
- ERREUR("Erreur MEDfileOpen\n");
- cout << "Erreur MEDfileOpen" << endl;
+ ERREUR("Error MEDfileOpen\n");
+ cout << "Error MEDfileOpen" << endl;
}
// Création du maillage
char desc[MED_COMMENT_SIZE + 1]; // Description du maillage
strcpy(desc, string2char(ID));
med_mesh_type type = MED_UNSTRUCTURED_MESH;
- cerr << "maa=" << maa << endl;
- cerr << "spacedim=" << spacedim << endl;
- cerr << "mdim=" << mdim << endl;
- cerr << "type=" << type << endl;
- cerr << "axisname=" << axisname << endl;
- cerr << "unitname=" << unitname << endl;
+// cerr << "maa=" << maa << endl;
+// cerr << "spacedim=" << spacedim << endl;
+// cerr << "mdim=" << mdim << endl;
+// cerr << "type=" << type << endl;
+// cerr << "axisname=" << axisname << endl;
+// cerr << "unitname=" << unitname << endl;
if (MEDmeshCr(fid, maa, spacedim, mdim, type, desc, "s", MED_SORT_DTIT, MED_CARTESIAN, axisname, unitname) < 0)
{
- ERREUR("Erreur MEDmeshCr");
- cout << "Erreur MEDmeshCr" << endl;
+ ERREUR("Error MEDmeshCr");
+ cout << "Error MEDmeshCr" << endl;
}
// ============================= CREATION FAMILLE ZERO
strcpy(nomfam, "FAMILLE_0");
numfam = 0;
if (MEDfamilyCr(fid, maa, nomfam, numfam, 0, MED_NO_GROUP) < 0)
- ERREUR("Erreur MEDfamilyCr (creation famille 0)");
+ ERREUR("Error MEDfamilyCr (create family 0)");
// ########################################################################
// GROUPES DE NOEUDS
ngro = ETIQFAM[ifam].size();
// Noms des groupes de la famille: variable nomsGN
- char gro[ngro * MED_LNAME_SIZE + 1];
+ char *gro = new char[ngro * MED_LNAME_SIZE + 1];
int cptGN = 0;
for (unsigned int ign = 0; ign < ETIQFAM[ifam].size(); ign++)
{
// Création de la famille
if (MEDfamilyCr(fid, maa, nomfam, numfam, 0, MED_NO_GROUP) < 0)
- ERREUR("Erreur MEDfamilyCr");
-
+ ERREUR("Error MEDfamilyCr");
+ delete gro;
}
}
med_float *coo; // Table des coordonnées
// Noms des coordonnées (variable nomcoo)
- char nomcoo[mdim * MED_SNAME_SIZE + 1];
+ char* nomcoo = new char[mdim * MED_SNAME_SIZE + 1];
string strX = (string) "X";
while (strX.size() < MED_SNAME_SIZE)
strX += (string) " ";
nomcoo[mdim * MED_SNAME_SIZE] = '\0';
// Unités des coordonnées (variable unicoo)
- char unicoo[mdim * MED_SNAME_SIZE + 1];
+ char* unicoo = new char[mdim * MED_SNAME_SIZE + 1];
string strmesure = (string) "SI";
while (strmesure.size() < MED_SNAME_SIZE)
strmesure += (string) " ";
if (MEDmeshNodeWr(fid, maa, MED_NO_DT, MED_NO_IT, MED_UNDEF_DT, MED_FULL_INTERLACE, nnoe, coo, inonoe, nomnoe,
inunoe, numnoe, MED_TRUE, nufano) < 0)
{
- ERREUR("Erreur MEDmeshNodeWr");
- cout << "Erreur MEDmeshNodeWr" << endl;
+ ERREUR("Error MEDmeshNodeWr");
+ cout << "Error MEDmeshNodeWr" << endl;
}
// ########################################################################
ngro = ETIQFAM[ifam].size();
// Noms des groupes de la famille
- char gro[ngro * MED_LNAME_SIZE + 1];
+ char* gro = new char[ngro * MED_LNAME_SIZE + 1];
int cptGM = 0;
for (unsigned int ign = 0; ign < ETIQFAM[ifam].size(); ign++)
{
// Création de la famille
if (MEDfamilyCr(fid, maa, nomfam, numfam, 1, gro) < 0)
- ERREUR("Erreur MEDfamilyCr");
- }
+ ERREUR("Error MEDfamilyCr");
+ delete gro;
+ }
}
// ########################################################################
// Chargement numTYPE
//for (int nl=0; nl<nTYPE; nl++) *(numTYPE+nl) = (med_int) ( NUM_MAILLES[tm][nl] );
- cerr << "maa=" << maa << endl;
- cerr << "MGE=" << MGE << endl;
- cerr << "nTYPE=" << nTYPE << endl;
- cerr << "inomTYPE=" << inomTYPE << endl;
- //cerr << "nomTYPE=" << nomTYPE << endl;
- cerr << "inumTYPE=" << inumTYPE << endl;
- this->afficheMailles(tm);
+// cerr << "maa=" << maa << endl;
+// cerr << "MGE=" << MGE << endl;
+// cerr << "nTYPE=" << nTYPE << endl;
+// cerr << "inomTYPE=" << inomTYPE << endl;
+// //cerr << "nomTYPE=" << nomTYPE << endl;
+// cerr << "inumTYPE=" << inumTYPE << endl;
+// this->afficheMailles(tm);
if (MEDmeshElementWr(fid, maa, MED_NO_DT, MED_NO_IT, MED_UNDEF_DT, MED_CELL, MGE, MED_NODAL,
MED_FULL_INTERLACE, nTYPE, CNX[tm], inomTYPE, nomTYPE, inumTYPE, numTYPE, MED_FALSE,
famTYPE) < 0)
{
- ERREUR("Erreur MEDmeshElementWr");
- cout << "Erreur MEDmeshElementWr, type " << stype << endl;
+ ERREUR("Error MEDmeshElementWr");
+ cout << "Error MEDmeshElementWr, type " << stype << endl;
}
if (MEDmeshEntityFamilyNumberWr(fid, maa, MED_NO_DT, MED_NO_IT,
MED_CELL, MGE, nTYPE, famTYPE) < 0)
{
- ERREUR("Erreur MEDmeshEntityFamilyNumberWr");
- cout << "Erreur MEDmeshEntityFamilyNumberWr, type " << stype << endl;
+ ERREUR("Error MEDmeshEntityFamilyNumberWr");
+ cout << "Error MEDmeshEntityFamilyNumberWr, type " << stype << endl;
}
// free(nomTYPE);
if (MEDfileClose(fid) < 0)
{
- ERREUR("Erreur a la fermeture du fichier MED\n");
- cout << "Erreur a la fermeture du fichier MED" << endl;
+ ERREUR("Error on close MED file\n");
+ cout << "Error on close MED file" << endl;
}
+ delete unicoo;
+ delete nomcoo;
+
// cout << endl << endl << "Fin procédure outputMED" << endl;
} // outputMED
- nPYRAM13 - nPENTA6 - nPENTA15 - nHEXA8 - 1;
}
else
- ERREUR("Routine NLOCAL: type non reconnu");
+ ERREUR("method NLOCAL: unknown type");
return 0;
}
{
map<int, int> TABLE_NL; // Table des num. locaux dans le type tm
- // cout << "Fonction eliminationMailles, listeMaillesSuppr.size()=" << listeMaillesSuppr.size() << endl;
+ cout << "Method eliminationMailles, listeMaillesSuppr.size()=" << listeMaillesSuppr.size() << endl;
// ************* Modification de la connectivité du type concerné
// Contrôle
if (offset != listeMaillesSuppr.size())
{
- ERREUR("Incohérence offset, fonction eliminationMailles");
+ ERREUR("Incoherent offset, method eliminationMailles");
exit(0);
}
if (GM[nomGM][tm].size())
{
-
+ //cout << "GM[" << nomGM <<"][" << tm << "].size()=" << GM[nomGM][tm].size() << endl;
vector<int> mailles = GM[nomGM][tm];
vector<int> mailles2; //mailles2.resize(mailles.size()-listeMaillesSuppr.size());
unsigned int cptMailles = 0;
cptMailles++;
}
}
- // Vérification
- if (cptMailles != mailles.size() - listeMaillesSuppr.size())
- {
- int delta = mailles.size() - listeMaillesSuppr.size();
- cout << "mailles.size() = " << mailles.size() << endl;
- cout << "cptMailles = " << cptMailles << endl;
- cout << "delta = " << delta << endl;
- ERREUR("Incohérence sur le nombre de mailles conservées, fonction eliminationMailles");
- exit(0);
- }
GM[nomGM][tm].clear();
mailles2.resize(cptMailles);
}
// ************* Mise à jour des effectifs
+
EFFECTIFS_TYPES[tm] = EFFECTIFS_TYPES[tm] - listeMaillesSuppr.size();
nombreMaillesMaillage = nombreMaillesMaillage - listeMaillesSuppr.size();