+// Copyright (C) 2006-2011 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
+//
+
// Classes et fonctions XMeshLab
#include "MeshCut_Utils.hxx"
std::map<TYPE_MAILLE, std::vector<int> > MESHCUT::newCNX;
std::map<TYPE_MAILLE, int> MESHCUT::cptNouvellesMailles;
std::map<TYPE_MAILLE, std::vector<int> > MESHCUT::GMplus, MESHCUT::GMmoins;
+std::vector<int> MESHCUT::cutTetras;
float *MESHCUT::DNP;
int *MESHCUT::POSN;
ERREUR("--> check arguments!");
}
- cout << "Découpe plane :" << endl;
- cout << "\t" << "Maillage source: " << ficMEDin << endl;
- cout << "\t" << "Maillage cible: " << ficMEDout << endl;
- cout << "\t" << "ID nouveau maillage: " << str_id_maillagenew << endl;
- cout << "\t" << "Nom GMplus: " << str_id_GMplus << endl;
- cout << "\t" << "Nom GMmoins: " << str_id_GMmoins << endl;
- cout << "\t" << "Vecteur normal du plan de coupe: xn=" << xNormal << " yn=" << yNormal << " zn=" << zNormal << endl;
- cout << "\t" << "Point du plan de coupe: xm=" << xm << " ym=" << ym << " zm=" << zm << endl;
- cout << "\t" << "Tolérance: " << tolerance << endl;
+ cout << "Cut by a plane :" << endl;
+ cout << " source mesh: " << ficMEDin << endl;
+ cout << " result mesh: " << ficMEDout << endl;
+ cout << " mesh name: " << str_id_maillagenew << endl;
+ cout << " group above plane: " << str_id_GMplus << endl;
+ cout << " group below plane: " << str_id_GMmoins << endl;
+ cout << " vector normal to the cut plane: xn=" << xNormal << " yn=" << yNormal << " zn=" << zNormal << endl;
+ cout << " point in the cut plane: xm=" << xm << " ym=" << ym << " zm=" << zm << endl;
+ cout << " tolerance: " << tolerance << endl;
cout << endl;
if (tolerance <= 0.0)
- ERREUR("L'argument tolérance doit être strictement positif");
+ ERREUR("Tolerance must not be negative or null");
// Il faut normer la normale
float normeNormal = sqrt(xNormal * xNormal + yNormal * yNormal + zNormal * zNormal);
if (normeNormal == 0.0)
- ERREUR("Vecteur normal nul");
+ ERREUR("null normal vector");
normale[0] = xNormal / normeNormal;
normale[1] = yNormal / normeNormal;
normale[2] = zNormal / normeNormal;
int V[6];
int S[4]; // Signature du T4 courant
- int NG[4]; // Num. globaux des sommets
+ //int NG[4]; // Num. globaux des sommets
// Acquisition maillage initial
//cout << chrono() << " - Acquisition du maillage initial" << endl;
MAILLAGE1 = new Maillage((string) "TEMP");
MAILLAGE1->inputMED(ficMEDin);
- cout << chrono() << " - Fin d'acquisition maillage" << endl;
+ cout << chrono() << " - End of mesh read" << endl;
indexNouveauxNoeuds = MAILLAGE1->nombreNoeudsMaillage;
// Le maillage ne contient aucun TETRA4 : on rend le maillage initial sans modification
if (!MAILLAGE1->EFFECTIFS_TYPES[TETRA4])
{
- cout << "WARNING : le maillage ne contient aucun élément TETRA4, il ne sera donc pas modifié" << endl;
+ cout << "WARNING: mesh does not contain tetra4 elements, it will not be modified" << endl;
MAILLAGE1->ID = str_id_maillagenew;
MAILLAGE1->outputMED(ficMEDout);
- cout << chrono() << " - Terminé" << endl << endl;
+ cout << chrono() << " - Finished!" << endl << endl;
exit(0);
}
// A partir de cet instant le maillage contient forcément des TETRA4
DNP = (float*) malloc(sizeof(float) * MAILLAGE1->nombreNoeudsMaillage);
for (int k = 0; k < MAILLAGE1->nombreNoeudsMaillage; k++)
DNP[k] = distanceNoeudPlan(k + 1);
- cout << chrono() << " - Fin de chargement des distances noeud-plan" << endl;
+ cout << chrono() << " - End of computation of distances between nodes and plane" << endl;
// Longueur d'arête moyenne des T4 intersectant le plan de coupe
float LONGUEURS = 0.0;
if (cptLONGUEURS == 0)
{
cout
- << "WARNING : le plan de coupe n'intersecte aucun élément TETRA4, le maillage initial ne sera donc pas modifié"
+ << "WARNING: the cut plane does not cut any tetra4 element, initial mesh will not be modified"
<< endl;
MAILLAGE1->ID = str_id_maillagenew;
MAILLAGE1->outputMED(ficMEDout);
- cout << chrono() << " - Terminé" << endl << endl;
+ cout << chrono() << " - Finished!" << endl << endl;
exit(0);
}
// A partir de cet instant le maillage contient forcément des TETRA4 intersectant le plan de coupe
epsilon = tolerance * longueurMoyenne;
int nT4coupe = cptLONGUEURS / 6;
- cout << chrono() << " - Fin du calcul de la longueur moyenne des arêtes TETRA4 au voisinage du plan de coupe" << endl;
+ cout << chrono() << " - End of computation of mean length of tetra4 edges near the cut plane" << endl;
- cout << "Nombre de TETRA4 impliqués dans la coupe = " << nT4coupe << endl;
- cout << "Longueur moyenne = " << longueurMoyenne << endl;
- cout << "Tolérance = " << tolerance << endl;
+ cout << "Number of tetra4 to be cut = " << nT4coupe << endl;
+ cout << "Mean length = " << longueurMoyenne << endl;
+ cout << "Tolerance = " << tolerance << endl;
cout << "Epsilon = " << epsilon << endl;
// Détermination des positions de noeuds par rapport au plan de coupe - POSN
else
POSN[k] = 0;
}
- cout << chrono() << " - Fin du positionnement des points par rapport au plan de coupe" << endl;
- cout << "Début de la boucle sur les TETRA4" << endl;
+ cout << chrono() << " - End of nodes qualification above or below the cut plane" << endl;
+ cout << "Start of iteration on tetra4" << endl;
for (int it4 = 0; it4 < MAILLAGE1->EFFECTIFS_TYPES[TETRA4]; it4++)
{
for (int is = 0; is < 4; is++)
{
int ng = *(MAILLAGE1->CNX[TETRA4] + 4 * it4 + is);
- NG[is] = ng;
+ //NG[is] = ng;
S[is] = *(POSN + ng - 1);
}
else if (S[0] == 0 && S[1] == 0 && S[2] == 0 && S[3] == 0)
{
- cout << "WARNING : TETRA4 numéro " << it4
- << " entièrement inclus dans la zone de tolérance autour du plan de coupe" << endl;
- cout << " --> affecté au groupe " << str_id_GMmoins << endl;
+ cout << "WARNING: TETRA4 number " << it4
+ << " entirely in the tolerance zone near the cut plane" << endl;
+ cout << " --> affected to group " << str_id_GMmoins << endl;
GMmoins[TETRA4].push_back(it4);
}
GMplus[TETRA4].push_back(it4);
else
- ERREUR("Cas non prévu");
+ ERREUR("Case not taken into account");
}
- cout << chrono() << " - Fin de la boucle sur les TETRA4" << endl;
+ cout << chrono() << " - End of iteration on tetra4" << endl;
// cout << "indexNouveauxNoeuds = " << indexNouveauxNoeuds << endl;
newXX.resize(indexNouveauxNoeuds - MAILLAGE1->nombreNoeudsMaillage);
// 2. Constitution du maillage final
// =========================================================================================
- cout << chrono() << " - Constitution du maillage final" << endl;
+ cout << chrono() << " - Constitution of final mesh" << endl;
MAILLAGE2 = new Maillage(str_id_maillagenew);
MAILLAGE2->dimensionMaillage = MAILLAGE1->dimensionMaillage;
// cout << "Nouveaux noeuds, indice " << i << " : " << newXX[i] << " " << newYY[i] << " " << newZZ[i] << " " << endl;
}
- // Legacy mailles maillage 1 +
- for (int itm = (int) POI1; itm <= (int) HEXA20; itm++)
+ // Legacy mailles maillage 1 (volumes seulement)
+ for (int itm = (int) TETRA4; itm <= (int) HEXA20; itm++)
{
TYPE_MAILLE tm = (TYPE_MAILLE) itm;
if (tm != TETRA4 && tm != PYRAM5 && tm != PENTA6)
MAILLAGE2->GN = MAILLAGE1->GN;
- cout << chrono() << " - Ecriture du fichier MED" << endl;
+ MAILLAGE2->eliminationMailles(TETRA4, cutTetras);
+
+ cout << chrono() << " - MED file writing" << endl;
MAILLAGE2->outputMED(ficMEDout);
- cout << chrono() << " - Terminé" << endl << endl;
+ cout << chrono() << " - Finished!" << endl << endl;
return 0;