diff --git a/Cassiopee/KCore/KCore/Connect/hashFunctions.h b/Cassiopee/KCore/KCore/Connect/hashFunctions.h
index 160b5044d..645d87bc3 100644
--- a/Cassiopee/KCore/KCore/Connect/hashFunctions.h
+++ b/Cassiopee/KCore/KCore/Connect/hashFunctions.h
@@ -17,6 +17,9 @@
along with Cassiopee. If not, see .
*/
+#include
+#include
+
/* Hash functions */
// Template parameter is a topology struct (see topologyMapping.h), unless
// otherwise stated
diff --git a/Cassiopee/KCore/KCore/Connect/topologyMapping.h b/Cassiopee/KCore/KCore/Connect/topologyMapping.h
index e83a023de..8b123794a 100644
--- a/Cassiopee/KCore/KCore/Connect/topologyMapping.h
+++ b/Cassiopee/KCore/KCore/Connect/topologyMapping.h
@@ -106,15 +106,15 @@ struct Topology
};
// Same as Topology but optimised (no dynamic allocation)
-const std::size_t nmaxitems = 8;
+const std::size_t nmaxitems = 8; // nbre d'index par item
struct TopologyOpt
{
E_Bool isDegen_; // whether the Topology is degenerated
std::size_t n_; // number of items contained in the Topology
std::size_t size_; // number of unique items contained in the Topology
- E_Int p_[nmaxitems];
+ E_Int p_[nmaxitems]; // indices
- TopologyOpt() {}
+ TopologyOpt() { for (size_t i = 0; i < nmaxitems; i++) p_[i] = -1; }
TopologyOpt(const E_Int* p, const std::size_t n, E_Bool search4Degen=false)
{
set(p, n, search4Degen);
diff --git a/Cassiopee/Post/Post/selectExteriorFaces.cpp b/Cassiopee/Post/Post/selectExteriorFaces.cpp
index 4a1c91f39..18cff10ce 100644
--- a/Cassiopee/Post/Post/selectExteriorFaces.cpp
+++ b/Cassiopee/Post/Post/selectExteriorFaces.cpp
@@ -808,7 +808,7 @@ PyObject* K_POST::selectExteriorFacesNGon3D(char* varString, FldArrayF& f,
// cFE: connectivite face/elements.
// Si une face n'a pas d'element gauche ou droit, retourne 0 pour
- // cet element.
+ // cet element.
FldArrayI cFE; K_CONNECT::connectNG2FE(cn, cFE);
E_Int* cFE1 = cFE.begin(1);
E_Int* cFE2 = cFE.begin(2);
@@ -831,6 +831,7 @@ PyObject* K_POST::selectExteriorFacesNGon3D(char* varString, FldArrayF& f,
vector edge(2);
std::pair initEdge(-1, false);
//TopologyOpt E; std::map > edgeMap;
+ //Topology E; std::unordered_map, JenkinsHash > edgeMap;
TopologyOpt E; std::unordered_map, JenkinsHash > edgeMap;
for (E_Int i = 0; i < nfaces; i++)
@@ -874,7 +875,7 @@ PyObject* K_POST::selectExteriorFacesNGon3D(char* varString, FldArrayF& f,
nptsExt = vertexMap.size();
nedgesExt = edgeMap.size();
sizeFN2 = (2+shift)*nedgesExt;
-
+
PyObject* indir = NULL;
E_Int* indirp = NULL;
if (boolIndir)
@@ -883,6 +884,7 @@ PyObject* K_POST::selectExteriorFacesNGon3D(char* varString, FldArrayF& f,
indirp = K_NUMPY::getNumpyPtrI(indir);
}
cFE.malloc(0);
+
// Calcul des nouvelles connectivites Elmt/Faces et Face/Noeuds
E_Int ngonType = 1; // CGNSv3 compact array1
if (api == 2) ngonType = 2; // CGNSv3, array2
@@ -896,28 +898,34 @@ PyObject* K_POST::selectExteriorFacesNGon3D(char* varString, FldArrayF& f,
E_Int* ngon2 = cn2->getNGon();
E_Int* nface2 = cn2->getNFace();
E_Int *indPG2 = NULL, *indPH2 = NULL;
+
if (api == 2 || api == 3)
{
indPG2 = cn2->getIndPG(); indPH2 = cn2->getIndPH();
}
E_Int c1 = 0, c2 = 0; // positions in ngon2 and nface2
- for (E_Int i = 0; i < nfacesExt; i++)
+ for (E_Int i = 0; i < nfacesExt; i++)
{
fidx = exteriorFaces[i];
E_Int* face = cn.getFace(fidx-1, nbnodes, ngon, indPG);
if (boolIndir) indirp[i] = fidx;
-
+
nface2[c2] = nbnodes;
if (api == 2 || api == 3) indPH2[i] = nbnodes;
+
for (E_Int p = 0; p < nbnodes; p++)
{
- edge[0] = face[p]-1;
+ edge[0] = face[p]-1;
edge[1] = face[(p+1)%nbnodes]-1;
+
//E.set(edge); // version with Topology
E.set(edge.data(), 2); // version with TopologyOpt
+
// Find the edge in the edge map
auto resE = edgeMap.find(E);
+ //if (resE == edgeMap.end()) { printf("not found\n"); fflush(stdout); }
+
if (not resE->second.second)
{
resE->second.second = true;
@@ -930,7 +938,7 @@ PyObject* K_POST::selectExteriorFacesNGon3D(char* varString, FldArrayF& f,
}
c2 += nbnodes+shift;
}
-
+
#pragma omp parallel
{
E_Int indf;
@@ -952,7 +960,7 @@ PyObject* K_POST::selectExteriorFacesNGon3D(char* varString, FldArrayF& f,
}
}
}
-
+
if (boolIndir)
{
PyList_Append(indices, indir); Py_DECREF(indir);
@@ -1009,6 +1017,9 @@ PyObject* K_POST::selectExteriorFacesNGon2D(char* varString, FldArrayF& f,
vector exteriorEdges;
TopologyOpt E;
std::unordered_map > edgeMap;
+ //Topology E;
+ //std::unordered_map > edgeMap;
+
for (E_Int i = 0; i < nfaces; i++)
{
@@ -1036,6 +1047,8 @@ PyObject* K_POST::selectExteriorFacesNGon2D(char* varString, FldArrayF& f,
}
E.set(edge.data(), 2);
+ //E.set(edge);
+
auto resE = edgeMap.insert(std::make_pair(E, 0));
if (++resE.first->second == 1)
{