-// Copyright (C) 2006-2013 EDF R&D
+// Copyright (C) 2006-2016 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.
+// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
debug = false;
string ficMEDin;
string ficMEDout;
- float xNormal;
- float yNormal;
- float zNormal;
- float xm;
- float ym;
- float zm;
- float tolerance;
+ float xNormal = 0;
+ float yNormal = 0;
+ float zNormal = 0;
+ float xm = 0;
+ float ym = 0;
+ float zm = 0;
+ float tolerance = 0;
try
{
if (argc != 13)
char *id_maillagenew = argv[3];
str_id_maillagenew = (string) id_maillagenew;
- // Groupes créés
+ // Groupes crees
char *id_GMplus = argv[4];
str_id_GMplus = (string) id_GMplus;
char *id_GMmoins = argv[5];
char *charzm = argv[11];
zm = char2float(charzm);
- // Tolérance : epsilon = tolérance * longueur arête moyenne - où epsilon est la tolérance absolue (distance)
+ // Tolerance : epsilon = tolerance * longueur arete moyenne - où epsilon est la tolerance absolue (distance)
char *chtolerance = argv[12];
tolerance = char2float(chtolerance);
}
pointPlan[1] = ym;
pointPlan[2] = zm;
- // Calcul du coefficient d de l'équation du plan xn x + yn y + zn n + d = 0
+ // Calcul du coefficient d de l'equation du plan xn x + yn y + zn n + d = 0
d = -normale[0] * xm - normale[1] * ym - normale[2] * zm;
intersections.clear();
//int NG[4]; // Num. globaux des sommets
// Acquisition maillage initial
- //cout << chrono() << " - Acquisition du maillage initial" << endl;
+ //cout << salome_chrono() << " - Acquisition du maillage initial" << endl;
MAILLAGE1 = new Maillage((string) "TEMP");
MAILLAGE1->inputMED(ficMEDin);
- cout << chrono() << " - End of mesh read" << endl;
+ cout << salome_chrono() << " - End of mesh read" << endl;
indexNouveauxNoeuds = MAILLAGE1->nombreNoeudsMaillage;
// Le maillage ne contient aucun TETRA4 : on rend le maillage initial sans modification
cout << "WARNING: mesh does not contain tetra4 elements, it will not be modified" << endl;
MAILLAGE1->ID = str_id_maillagenew;
MAILLAGE1->outputMED(ficMEDout);
- cout << chrono() << " - Finished!" << endl << endl;
+ cout << salome_chrono() << " - Finished!" << endl << endl;
exit(0);
}
- // A partir de cet instant le maillage contient forcément des TETRA4
+ // A partir de cet instant le maillage contient forcement des TETRA4
// Chargement des distances noeud-plan DNP
DNP = (float*) malloc(sizeof(float) * MAILLAGE1->nombreNoeudsMaillage);
for (int k = 0; k < MAILLAGE1->nombreNoeudsMaillage; k++)
DNP[k] = distanceNoeudPlan(k + 1);
- cout << chrono() << " - End of computation of distances between nodes and plane" << endl;
+ cout << salome_chrono() << " - End of computation of distances between nodes and plane" << endl;
- // Longueur d'arête moyenne des T4 intersectant le plan de coupe
+ // Longueur d'arete moyenne des T4 intersectant le plan de coupe
float LONGUEURS = 0.0;
int cptLONGUEURS = 0;
for (int it4 = 0; it4 < MAILLAGE1->EFFECTIFS_TYPES[TETRA4]; it4++)
}
if (plus && moins)
{
- // Ce tetra est à cheval sur le plan de coupe: on calcule ses longueurs d'arêtes
+ // Ce tetra est a cheval sur le plan de coupe: on calcule ses longueurs d'aretes
LONGUEURS += longueurSegment(*(offset + 0), *(offset + 1));
cptLONGUEURS++;
LONGUEURS += longueurSegment(*(offset + 0), *(offset + 2));
}
}
- // Aucun TETRA4 intercepté par le plan de coupe : on rend MAILLAGE1
+ // Aucun TETRA4 intercepte par le plan de coupe : on rend MAILLAGE1
if (cptLONGUEURS == 0)
{
cout
<< endl;
MAILLAGE1->ID = str_id_maillagenew;
MAILLAGE1->outputMED(ficMEDout);
- cout << chrono() << " - Finished!" << endl << endl;
+ cout << salome_chrono() << " - Finished!" << endl << endl;
exit(0);
}
- // A partir de cet instant le maillage contient forcément des TETRA4 intersectant le plan de coupe
+ // A partir de cet instant le maillage contient forcement des TETRA4 intersectant le plan de coupe
float longueurMoyenne = LONGUEURS / cptLONGUEURS;
epsilon = tolerance * longueurMoyenne;
int nT4coupe = cptLONGUEURS / 6;
- cout << chrono() << " - End of computation of mean length of tetra4 edges near the cut plane" << endl;
+ cout << salome_chrono() << " - End of computation of mean length of tetra4 edges near the cut plane" << 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
+ // Determination des positions de noeuds par rapport au plan de coupe - POSN
POSN = (int*) malloc(sizeof(int) * MAILLAGE1->nombreNoeudsMaillage);
for (int k = 0; k < MAILLAGE1->nombreNoeudsMaillage; k++)
{
else
POSN[k] = 0;
}
- cout << chrono() << " - End of nodes qualification above or below the cut plane" << endl;
+ cout << salome_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++)
GMmoins[TETRA4].push_back(it4);
else if (S[0] == -1 && S[1] == -1 && S[2] == -1 && S[3] == 1)
- { // Cas 3 - Arêtes 2 4 5
+ { // Cas 3 - Aretes 2 4 5
V[0] = -1;
V[1] = -1;
V[2] = intersectionSegmentPlan(it4, 2);
GMmoins[TETRA4].push_back(it4);
else if (S[0] == -1 && S[1] == -1 && S[2] == 0 && S[3] == 1)
- { // Cas 2, arêtes 2 4
+ { // Cas 2, aretes 2 4
V[0] = -1;
V[1] = -1;
V[2] = intersectionSegmentPlan(it4, 2);
// -------------------------------------------------------------------
else if (S[0] == -1 && S[1] == -1 && S[2] == 1 && S[3] == -1)
- { // Cas 3, arêtes 1 3 5
+ { // Cas 3, aretes 1 3 5
V[0] = -1;
V[1] = intersectionSegmentPlan(it4, 1);
V[2] = -1;
}
else if (S[0] == -1 && S[1] == -1 && S[2] == 1 && S[3] == 0)
- { // Cas 2, arêtes 1 3
+ { // Cas 2, aretes 1 3
V[0] = -1;
V[1] = intersectionSegmentPlan(it4, 1);
V[2] = -1;
}
else if (S[0] == -1 && S[1] == -1 && S[2] == 1 && S[3] == 1)
- { // Cas 4, arêtes 1 2 3 4
+ { // Cas 4, aretes 1 2 3 4
V[0] = -1;
V[1] = intersectionSegmentPlan(it4, 1);
V[2] = intersectionSegmentPlan(it4, 2);
GMmoins[TETRA4].push_back(it4);
else if (S[0] == -1 && S[1] == 0 && S[2] == -1 && S[3] == 1)
- { // Cas 2, arêtes 2 5
+ { // Cas 2, aretes 2 5
V[0] = -1;
V[1] = -1;
V[2] = intersectionSegmentPlan(it4, 2);
GMmoins[TETRA4].push_back(it4);
else if (S[0] == -1 && S[1] == 0 && S[2] == 0 && S[3] == 1)
- { // Cas 1, arête 2
+ { // Cas 1, arete 2
V[0] = -1;
V[1] = -1;
V[2] = intersectionSegmentPlan(it4, 2);
// -------------------------------------------------------------------
else if (S[0] == -1 && S[1] == 0 && S[2] == 1 && S[3] == -1)
- { // Cas 2, arêtes 1 5
+ { // Cas 2, aretes 1 5
V[0] = -1;
V[1] = intersectionSegmentPlan(it4, 1);
V[2] = -1;
}
else if (S[0] == -1 && S[1] == 0 && S[2] == 1 && S[3] == 0)
- { // Cas 1, arête 1
+ { // Cas 1, arete 1
V[0] = -1;
V[1] = intersectionSegmentPlan(it4, 1);
V[2] = -1;
}
else if (S[0] == -1 && S[1] == 0 && S[2] == 1 && S[3] == 1)
- { // Cas 2, arêtes 1 2
+ { // Cas 2, aretes 1 2
V[0] = -1;
V[1] = intersectionSegmentPlan(it4, 1);
V[2] = intersectionSegmentPlan(it4, 2);
// -------------------------------------------------------------------
else if (S[0] == -1 && S[1] == 1 && S[2] == -1 && S[3] == -1)
- { // Cas 3, arêtes 0 3 4
+ { // Cas 3, aretes 0 3 4
V[0] = intersectionSegmentPlan(it4, 0);
V[1] = -1;
V[2] = -1;
}
else if (S[0] == -1 && S[1] == 1 && S[2] == -1 && S[3] == 0)
- { // Cas 2, arêtes 0 3
+ { // Cas 2, aretes 0 3
V[0] = intersectionSegmentPlan(it4, 0);
V[1] = -1;
V[2] = -1;
}
else if (S[0] == -1 && S[1] == 1 && S[2] == -1 && S[3] == 1)
- { // Cas 4, arêtes 0 2 3 5
+ { // Cas 4, aretes 0 2 3 5
V[0] = intersectionSegmentPlan(it4, 0);
V[1] = -1;
V[2] = intersectionSegmentPlan(it4, 2);
// -------------------------------------------------------------------
else if (S[0] == -1 && S[1] == 1 && S[2] == 0 && S[3] == -1)
- { // Cas 2, arêtes 0 4
+ { // Cas 2, aretes 0 4
V[0] = intersectionSegmentPlan(it4, 0);
V[1] = -1;
V[2] = -1;
}
else if (S[0] == -1 && S[1] == 1 && S[2] == 0 && S[3] == 0)
- { // Cas 1, arête 0
+ { // Cas 1, arete 0
V[0] = intersectionSegmentPlan(it4, 0);
V[1] = -1;
V[2] = -1;
}
else if (S[0] == -1 && S[1] == 1 && S[2] == 0 && S[3] == 1)
- { // Cas 2, arêtes 0 2
+ { // Cas 2, aretes 0 2
V[0] = intersectionSegmentPlan(it4, 0);
V[1] = -1;
V[2] = intersectionSegmentPlan(it4, 2);
// -------------------------------------------------------------------
else if (S[0] == -1 && S[1] == 1 && S[2] == 1 && S[3] == -1)
- { // Cas 4, arêtes 0 1 4 5
+ { // Cas 4, aretes 0 1 4 5
V[0] = intersectionSegmentPlan(it4, 0);
V[1] = intersectionSegmentPlan(it4, 1);
V[2] = -1;
}
else if (S[0] == -1 && S[1] == 1 && S[2] == 1 && S[3] == 0)
- { // Cas 2, arêtes 0 1
+ { // Cas 2, aretes 0 1
V[0] = intersectionSegmentPlan(it4, 0);
V[1] = intersectionSegmentPlan(it4, 1);
V[2] = -1;
}
else if (S[0] == -1 && S[1] == 1 && S[2] == 1 && S[3] == 1)
- { // Cas 3, arêtes 0 1 2
+ { // Cas 3, aretes 0 1 2
V[0] = intersectionSegmentPlan(it4, 0);
V[1] = intersectionSegmentPlan(it4, 1);
V[2] = intersectionSegmentPlan(it4, 2);
GMmoins[TETRA4].push_back(it4);
else if (S[0] == 0 && S[1] == -1 && S[2] == -1 && S[3] == 1)
- { // Cas 2, arêtes 4 5
+ { // Cas 2, aretes 4 5
V[0] = -1;
V[1] = -1;
V[2] = -1;
GMmoins[TETRA4].push_back(it4);
else if (S[0] == 0 && S[1] == -1 && S[2] == 0 && S[3] == 1)
- { // Cas 1, arête 4
+ { // Cas 1, arete 4
V[0] = -1;
V[1] = -1;
V[2] = -1;
// -------------------------------------------------------------------
else if (S[0] == 0 && S[1] == -1 && S[2] == 1 && S[3] == -1)
- { // Cas 2, arêtes 3 5
+ { // Cas 2, aretes 3 5
V[0] = -1;
V[1] = -1;
V[2] = -1;
}
else if (S[0] == 0 && S[1] == -1 && S[2] == 1 && S[3] == 0)
- { // Cas 1, arête 3
+ { // Cas 1, arete 3
V[0] = -1;
V[1] = -1;
V[2] = -1;
}
else if (S[0] == 0 && S[1] == -1 && S[2] == 1 && S[3] == 1)
- { // Cas 2, arêtes 3 4
+ { // Cas 2, aretes 3 4
V[0] = -1;
V[1] = -1;
V[2] = -1;
GMmoins[TETRA4].push_back(it4);
else if (S[0] == 0 && S[1] == 0 && S[2] == -1 && S[3] == 1)
- { // Cas 1, arête 5
+ { // Cas 1, arete 5
V[0] = -1;
V[1] = -1;
V[2] = -1;
// -------------------------------------------------------------------
else if (S[0] == 0 && S[1] == 0 && S[2] == 1 && S[3] == -1)
- { // Cas 1, arête 5
+ { // Cas 1, arete 5
V[0] = -1;
V[1] = -1;
V[2] = -1;
// -------------------------------------------------------------------
else if (S[0] == 0 && S[1] == 1 && S[2] == -1 && S[3] == -1)
- { // Cas 2, arêtes 3 4
+ { // Cas 2, aretes 3 4
V[0] = -1;
V[1] = -1;
V[2] = -1;
}
else if (S[0] == 0 && S[1] == 1 && S[2] == -1 && S[3] == 0)
- { // Cas 1, arête 3
+ { // Cas 1, arete 3
V[0] = -1;
V[1] = -1;
V[2] = -1;
}
else if (S[0] == 0 && S[1] == 1 && S[2] == -1 && S[3] == 1)
- { // Cas 2, arêtes 3 5
+ { // Cas 2, aretes 3 5
V[0] = -1;
V[1] = -1;
V[2] = -1;
// -------------------------------------------------------------------
else if (S[0] == 0 && S[1] == 1 && S[2] == 0 && S[3] == -1)
- { // Cas 1, arête 4
+ { // Cas 1, arete 4
V[0] = -1;
V[1] = -1;
V[2] = -1;
// -------------------------------------------------------------------
else if (S[0] == 0 && S[1] == 1 && S[2] == 1 && S[3] == -1)
- { // Cas 2, arêtes 4 5
+ { // Cas 2, aretes 4 5
V[0] = -1;
V[1] = -1;
V[2] = -1;
// -------------------------------------------------------------------
else if (S[0] == 1 && S[1] == -1 && S[2] == -1 && S[3] == -1)
- { // Cas 3, arêtes 0 1 2
+ { // Cas 3, aretes 0 1 2
V[0] = intersectionSegmentPlan(it4, 0);
V[1] = intersectionSegmentPlan(it4, 1);
V[2] = intersectionSegmentPlan(it4, 2);
}
else if (S[0] == 1 && S[1] == -1 && S[2] == -1 && S[3] == 0)
- { // Cas 2, arêtes 0 1
+ { // Cas 2, aretes 0 1
V[0] = intersectionSegmentPlan(it4, 0);
V[1] = intersectionSegmentPlan(it4, 1);
V[2] = -1;
}
else if (S[0] == 1 && S[1] == -1 && S[2] == -1 && S[3] == 1)
- { // Cas 4, arêtes 0 1 4 5
+ { // Cas 4, aretes 0 1 4 5
V[0] = intersectionSegmentPlan(it4, 0);
V[1] = intersectionSegmentPlan(it4, 1);
V[2] = -1;
// -------------------------------------------------------------------
else if (S[0] == 1 && S[1] == -1 && S[2] == 0 && S[3] == -1)
- { // Cas 2, arêtes 0 2
+ { // Cas 2, aretes 0 2
V[0] = intersectionSegmentPlan(it4, 0);
V[1] = -1;
V[2] = intersectionSegmentPlan(it4, 2);
}
else if (S[0] == 1 && S[1] == -1 && S[2] == 0 && S[3] == 0)
- { // Cas 1, arête 0
+ { // Cas 1, arete 0
V[0] = intersectionSegmentPlan(it4, 0);
V[1] = -1;
V[2] = -1;
}
else if (S[0] == 1 && S[1] == -1 && S[2] == 0 && S[3] == 1)
- { // Cas 2, arêtes 0 4
+ { // Cas 2, aretes 0 4
V[0] = intersectionSegmentPlan(it4, 0);
V[1] = -1;
V[2] = -1;
// -------------------------------------------------------------------
else if (S[0] == 1 && S[1] == -1 && S[2] == 1 && S[3] == -1)
- { // Cas 4, arêtes 0 2 3 5
+ { // Cas 4, aretes 0 2 3 5
V[0] = intersectionSegmentPlan(it4, 0);
V[1] = -1;
V[2] = intersectionSegmentPlan(it4, 2);
}
else if (S[0] == 1 && S[1] == -1 && S[2] == 1 && S[3] == 0)
- { // Cas 2, arêtes 0 3
+ { // Cas 2, aretes 0 3
V[0] = intersectionSegmentPlan(it4, 0);
V[1] = -1;
V[2] = -1;
}
else if (S[0] == 1 && S[1] == -1 && S[2] == 1 && S[3] == 1)
- { // Cas 3, arêtes 0 3 4
+ { // Cas 3, aretes 0 3 4
V[0] = intersectionSegmentPlan(it4, 0);
V[1] = -1;
V[2] = -1;
// -------------------------------------------------------------------
else if (S[0] == 1 && S[1] == 0 && S[2] == -1 && S[3] == -1)
- { // Cas 2, arêtes 1 2
+ { // Cas 2, aretes 1 2
V[0] = -1;
V[1] = intersectionSegmentPlan(it4, 1);
V[2] = intersectionSegmentPlan(it4, 2);
}
else if (S[0] == 1 && S[1] == 0 && S[2] == -1 && S[3] == 0)
- { // Cas 1, arête 1
+ { // Cas 1, arete 1
V[0] = -1;
V[1] = intersectionSegmentPlan(it4, 1);
V[2] = -1;
}
else if (S[0] == 1 && S[1] == 0 && S[2] == -1 && S[3] == 1)
- { // Cas 2, arêtes 1 5
+ { // Cas 2, aretes 1 5
V[0] = -1;
V[1] = intersectionSegmentPlan(it4, 1);
V[2] = -1;
// -------------------------------------------------------------------
else if (S[0] == 1 && S[1] == 0 && S[2] == 0 && S[3] == -1)
- { // Cas 1, arête 2
+ { // Cas 1, arete 2
V[0] = -1;
V[1] = -1;
V[2] = intersectionSegmentPlan(it4, 2);
// -------------------------------------------------------------------
else if (S[0] == 1 && S[1] == 0 && S[2] == 1 && S[3] == -1)
- { // Cas 2, arêtes 2 5
+ { // Cas 2, aretes 2 5
V[0] = -1;
V[1] = -1;
V[2] = intersectionSegmentPlan(it4, 2);
// -------------------------------------------------------------------
else if (S[0] == 1 && S[1] == 1 && S[2] == -1 && S[3] == -1)
- { // Cas 4, arêtes 1 2 3 4
+ { // Cas 4, aretes 1 2 3 4
V[0] = -1;
V[1] = intersectionSegmentPlan(it4, 1);
V[2] = intersectionSegmentPlan(it4, 2);
}
else if (S[0] == 1 && S[1] == 1 && S[2] == -1 && S[3] == 0)
- { // Cas 2, arêtes 1 3
+ { // Cas 2, aretes 1 3
V[0] = -1;
V[1] = intersectionSegmentPlan(it4, 1);
V[2] = -1;
}
else if (S[0] == 1 && S[1] == 1 && S[2] == -1 && S[3] == 1)
- { // Cas 3, arêtes 1 3 5
+ { // Cas 3, aretes 1 3 5
V[0] = -1;
V[1] = intersectionSegmentPlan(it4, 1);
V[2] = -1;
// -------------------------------------------------------------------
else if (S[0] == 1 && S[1] == 1 && S[2] == 0 && S[3] == -1)
- { // Cas 2, arêtes 2 4
+ { // Cas 2, aretes 2 4
V[0] = -1;
V[1] = -1;
V[2] = intersectionSegmentPlan(it4, 2);
// -------------------------------------------------------------------
else if (S[0] == 1 && S[1] == 1 && S[2] == 1 && S[3] == -1)
- { // Cas 3, arêtes 2 4 5
+ { // Cas 3, aretes 2 4 5
V[0] = -1;
V[1] = -1;
V[2] = intersectionSegmentPlan(it4, 2);
ERREUR("Case not taken into account");
}
- cout << chrono() << " - End of iteration on tetra4" << endl;
+ cout << salome_chrono() << " - End of iteration on tetra4" << endl;
// cout << "indexNouveauxNoeuds = " << indexNouveauxNoeuds << endl;
newXX.resize(indexNouveauxNoeuds - MAILLAGE1->nombreNoeudsMaillage);
// 2. Constitution du maillage final
// =========================================================================================
- cout << chrono() << " - Constitution of final mesh" << endl;
+ cout << salome_chrono() << " - Constitution of final mesh" << endl;
MAILLAGE2 = new Maillage(str_id_maillagenew);
MAILLAGE2->dimensionMaillage = MAILLAGE1->dimensionMaillage;
MAILLAGE2->nombreMaillesMaillage = MAILLAGE1->nombreMaillesMaillage + cptNouvellesMailles[TETRA4]
+ cptNouvellesMailles[PYRAM5] + cptNouvellesMailles[PENTA6];
- // ---------- Coordonnées
- // Optimisation de la mémoire au détriment du temps
+ // ---------- Coordonnees
+ // Optimisation de la memoire au detriment du temps
- // Héritage des coordonnées MAILLAGE1
+ // Heritage des coordonnees MAILLAGE1
MAILLAGE2->XX = (float*) malloc(sizeof(float) * MAILLAGE2->nombreNoeudsMaillage);
for (int i = 0; i < MAILLAGE1->nombreNoeudsMaillage; i++)
*(MAILLAGE2->XX + i) = *(MAILLAGE1->XX + i);
*(MAILLAGE2->ZZ + i) = *(MAILLAGE1->ZZ + i);
free(MAILLAGE1->ZZ);
- // Coordonnées des noeuds créés
+ // Coordonnees des noeuds crees
for (int i = 0; i < MAILLAGE2->nombreNoeudsMaillage - MAILLAGE1->nombreNoeudsMaillage; i++)
{
*(MAILLAGE2->XX + MAILLAGE1->nombreNoeudsMaillage + i) = newXX[i];
}
else
{
- // Pour les types TETRA4 PYRAM5 PENTA6 on recopie CNX1 et on ajoute à la suite les newCNX
+ // Pour les types TETRA4 PYRAM5 PENTA6 on recopie CNX1 et on ajoute a la suite les newCNX
// cout << "Legacy " << tm << " effectif " << MAILLAGE1->EFFECTIFS_TYPES[tm] << endl;
int tailleType = Nnoeuds(tm);
MAILLAGE2->eliminationMailles(TETRA4, cutTetras);
- cout << chrono() << " - MED file writing" << endl;
+ cout << salome_chrono() << " - MED file writing" << endl;
MAILLAGE2->outputMED(ficMEDout);
- cout << chrono() << " - Finished!" << endl << endl;
+ cout << salome_chrono() << " - Finished!" << endl << endl;
return 0;