Salome HOME
Updated copyright comment
[modules/hexablock.git] / src / HEXABLOCK / HexVertex.cxx
old mode 100755 (executable)
new mode 100644 (file)
index 795c9f0..eb0d46b
@@ -1,12 +1,12 @@
 
 //  C++ Les noeuds
 
-// Copyright (C) 2009-2013  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
@@ -30,6 +30,8 @@
 #include "HexVertexShape.hxx"
 #include "HexKas_functions.hxx"
 
+#include <algorithm>
+
 BEGIN_NAMESPACE_HEXA
 
 static bool db =  on_debug ();  // == getenv ("HEXA_DB") > 0
@@ -131,9 +133,9 @@ int Vertex::setAssociation (VertexShape* forme)
    forme->getCoords (gc_x, gc_y, gc_z);
    v_shape = forme;
 
-   if (db) cout << " Vertex "           << el_name
-                << " setAssociation-> " << forme->getName ()
-                << " = (" << gc_x << ", " << gc_y << ", " << gc_z << ") \n" ;
+   if (db) std::cout << " Vertex "           << el_name
+                    << " setAssociation-> " << forme->getName ()
+                    << " = (" << gc_x << ", " << gc_y << ", " << gc_z << ") \n" ;
 
    is_associated = true;
    return HOK;
@@ -268,4 +270,32 @@ double Vertex::dist2 (Vertex* other)
                                         + carre (v_z-other->v_z);
    return dist;
 }
+// ========================================================= anaVertices
+void Vertex::anaVertices (Vertices& cont, double pmin[], double pmax[], 
+                                                         double center[])
+{
+    Real3 point;
+    int nbre = cont.size();
+    if (nbre==0)
+       {
+       for (int nc=0 ; nc<DIM3 ; nc++)
+            pmin [nc] = pmax[nc] =  center[nc] = 0;
+       return;
+       }
+
+    cont[0]->getPoint (pmin);
+    cont[0]->getPoint (pmax);
+    for (int nro=1 ; nro<nbre ; ++nro)
+        {
+        cont[nro]->getPoint (point);
+        for (int nc=0 ; nc<DIM3 ; nc++)
+            {
+            pmin [nc] = std::min (pmin[nc], point[nc]);
+            pmax [nc] = std::max (pmax[nc], point[nc]);
+            }
+        }
+
+    for (int nc=0 ; nc<DIM3 ; nc++)
+        center [nc] = (pmin[nc] + pmax[nc])/2;
+}
 END_NAMESPACE_HEXA