Salome HOME
Updated copyright comment
[modules/hexablock.git] / src / HEXABLOCK / HexCloner.cxx
old mode 100755 (executable)
new mode 100644 (file)
index 31edc5a..7d211f1
@@ -1,12 +1,12 @@
 
 // C++ : Copiteur d'hexaedres
 
-// Copyright (C) 2009-2012  CEA/DEN, EDF R&D
+// Copyright (C) 2009-2024  CEA, EDF
 //
 // 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
 #include "HexVertex.hxx"
 
 #include "HexElements.hxx"
-#include "HexShape.hxx"
+#include "HexVertexShape.hxx"
+#include "HexEdgeShape.hxx"
+#include "HexFaceShape.hxx"
 
 BEGIN_NAMESPACE_HEXA
 
-void transfo_brep (string& brep, Matrix* matrice, string& trep);
-void geom_dump_asso (Edge* edge);
+void transfo_brep (std::string& brep, Matrix* matrice, std::string& trep);
 static bool db = false;
 
 // ============================================================= Constructeur
@@ -44,30 +45,20 @@ Cloner::Cloner  (Matrix* mat)
 // ============================================================== clonerVertex
 Vertex* Cloner::clonerVertex (Vertex* orig)
 {
-    if (orig == NULL)
-        return orig;
-
-    Vertex* copie = clone_vertex [orig];
-    if (copie != NULL)
-        return copie;
+   if (orig == NULL)
+       return orig;
 
-    copie = new Vertex (orig);
-    matrice -> perform (copie);
-    clone_vertex [orig] = copie;
+   Vertex* copie = clone_vertex [orig];
+   if (copie != NULL)
+       return copie;
 
-   Shape* tshape = copie->getAssociation ();
-   Shape* shape  = orig ->getAssociation ();
-   if (tshape != NULL || shape == NULL)
-      return copie;
+   copie = new Vertex (orig);
+   matrice -> perform (copie);
+   clone_vertex [orig] = copie;
 
-   string brep  = shape->getBrep();
-   string trep;
-   transfo_brep (brep, matrice, trep);
-   tshape = new Shape (trep);
-   copie ->setAssociation (tshape);
    if (db)
       {
-      printf ( " --- Cloner::Asso (%s) -> asso (%s)\n", orig ->getName  (), 
+      printf ( " --- Cloner::Asso (%s) -> asso (%s)\n", orig ->getName  (),
                                                         copie->getName ());
       }
    return copie;
@@ -96,31 +87,32 @@ Edge* Cloner::clonerEdge (Edge* orig)
       orig ->printName ("\n");
       }
 
-   const  Shapes & new_asso = copie->getAssociations ();
-   int    nbass             = new_asso.size();
-   if (nbass!=0) 
-      return copie;
+/***********************
+   // const  Shapes & new_asso = copie->getAssociations ();  TODO  New Shape
+   // int    nbass             = new_asso.size();
+   // if (nbass!=0)
+      // return copie;
 
    const Shapes & tab_asso = orig->getAssociations ();
    nbass             = tab_asso.size();
    for (int nro=0 ; nro < nbass ; nro++)
        {
        Shape* shape = tab_asso [nro];
-       string brep  = shape->getBrep();
-       string trep;
+       std::string brep  = shape->getBrep();
+       std::string trep;
        transfo_brep (brep, matrice, trep);
        Shape* tshape = new Shape (trep);
-       tshape->setBounds (shape->debut, shape->fin);
+       tshape->setBounds (shape->getStart(), shape->getEnd());
        copie ->addAssociation (tshape);
        if (db)
           {
-          printf ( " --- Cloner::Asso (%s) -> asso (%s)\n", orig ->getName (), 
+          printf ( " --- Cloner::Asso (%s) -> asso (%s)\n", orig ->getName (),
                                                             copie->getName ());
-          geom_dump_asso (orig );
-          geom_dump_asso (copie);
+          // geom_dump_asso (orig );
+          // geom_dump_asso (copie);
           }
        }
-
+***************************************************/
    return copie;
 }
 // ============================================================== clonerQuad
@@ -135,18 +127,18 @@ Quad* Cloner::clonerQuad (Quad* orig)
 
    copie = new Quad (orig);
 
-   for (int nro=0 ; nro<QUAD4 ; nro++) 
+   for (int nro=0 ; nro<QUAD4 ; nro++)
        copie->q_edge [nro] = clonerEdge (orig->q_edge [nro]);
 
-   for (int nro=0 ; nro<QUAD4 ; nro++) 
+   for (int nro=0 ; nro<QUAD4 ; nro++)
        copie->q_vertex [nro] = clonerVertex (orig->q_vertex [nro]);
 
    copie->majReferences ();
    clone_quad [orig] = copie;
-
+/*******************************************************************
    const  Shapes & new_asso = copie->getAssociations ();
    int    nbass             = new_asso.size();
-   if (nbass!=0) 
+   if (nbass!=0)
       return copie;
 
    const Shapes & tab_asso = orig->getAssociations ();
@@ -154,16 +146,17 @@ Quad* Cloner::clonerQuad (Quad* orig)
    for (int nro=0 ; nro < nbass ; nro++)
        {
        Shape* shape = tab_asso [nro];
-       string brep  = shape->getBrep();
-       string trep;
+       std::string brep  = shape->getBrep();
+       std::string trep;
        transfo_brep (brep, matrice, trep);
        Shape* tshape = new Shape (trep);
        copie ->addAssociation (tshape);
        if (db)
-          printf ( " --- Asso (%s) -> asso (%s)\n", orig ->getName (), 
+          printf ( " --- Asso (%s) -> asso (%s)\n", orig ->getName (),
                                                     copie->getName ());
        }
 
+***************************************************/
    return copie;
 }
 // ============================================================== clonerHexa
@@ -180,10 +173,10 @@ Hexa* Cloner::clonerHexa (Hexa* orig)
    for (int nro=0 ; nro<HQ_MAXI ; nro++)
        copie->h_quad [nro] = clonerQuad (orig->h_quad [nro]);
 
-   for (int nro=0 ; nro<HE_MAXI ; nro++) 
+   for (int nro=0 ; nro<HE_MAXI ; nro++)
        copie->h_edge [nro] = clonerEdge (orig->h_edge [nro]);
 
-   for (int nro=0 ; nro<HV_MAXI ; nro++) 
+   for (int nro=0 ; nro<HV_MAXI ; nro++)
        copie->h_vertex [nro] = clonerVertex (orig->h_vertex [nro]);
 
    copie->majReferences ();