Salome HOME
bos #18858 Use sphinx_rtd_theme as theme for SALOME documentation built with Sphinx
[modules/hexablock.git] / src / HEXABLOCK / HexElements_ter.cxx
old mode 100755 (executable)
new mode 100644 (file)
index 4cb09df..4d5a462
@@ -1,11 +1,11 @@
 // C++ : Table d'hexaedres (Evol Versions 3)
 
-// Copyright (C) 2009-2013  CEA/DEN, EDF R&D
+// Copyright (C) 2009-2019  CEA/DEN, 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
 
 BEGIN_NAMESPACE_HEXA
 
-// static bool db=false;
+static bool db=false;
 
-// ====================================================== makeRind
-int Elements::makeRind (EnumGrid type, Vertex* center, Vector* vx, Vector* vz,
-                        double radext, double radint, double radhole,
-                       Vertex* plorig, double angle, int nr, int na, int nl)
-{
-   double phi1;
-   int ier = controlRind (type, center, vx, vz, radext, radint, radhole,
-                          plorig, angle, nr, na, nl, cyl_phi0, phi1);
-   if (ier!=HOK)
-      return ier;
-
-   resize (type, nr, na, nl);
-
-   cyl_radext  = radext;
-   cyl_radint  = radint;
-   cyl_radhole = radhole;
-   cyl_closed  = type==GR_HEMISPHERIC || type==GR_RIND;
-
-   double theta  = cyl_closed ? 2*M_PI : M_PI*angle/180;
-   cyl_dphi      = (phi1-cyl_phi0)/ size_hz;
-   cyl_dtheta    = theta / size_hy;
-
-   int nb_secteurs = cyl_closed ? size_vy-1 : size_vy;
-
-   for (int ny=0 ; ny<nb_secteurs ; ny++)
-       for (int nx=0 ; nx<size_vx ; nx++)
-           for (int nz=0 ; nz<size_vz ; nz++)
-               {
-               double px, py, pz;
-               getCylPoint (nx, ny, nz, px, py, pz);
-               Vertex* node = el_root->addVertex (px, py, pz);
-               setVertex (node, nx, ny, nz);
-               }
-   if (cyl_closed)
-      for (int nx=0 ; nx<size_vx ; nx++)
-          for (int nz=0 ; nz<size_vz ; nz++)
-              {
-              Vertex* node = getVertexIJK (nx, 0, nz);
-              setVertex (node, nx, size_vy-1, nz);
-              }
-
-   transfoVertices (center, vx, vz);
-   fillGrid ();
-   assoCylinder (center, vz, angle);
-   return HOK;
-}
 // ====================================================== getCylPoint
 int Elements::getCylPoint (int nr, int na, int nh, double& px, double& py,
                            double& pz)
@@ -217,7 +171,7 @@ void Elements::assoCylinders (double* ori, double* vk, double angle,
    NewShape* geom = el_root->addShape (name, SH_CYLINDER);
    geom -> openShape();
 
-   string brep;
+   std::string brep;
    // Real3 vk = { normal->getDx(), normal->getDy(), normal->getDz() };
    // normer_vecteur (vk);
 
@@ -249,8 +203,9 @@ void Elements::assoCylinders (double* ori, double* vk, double angle,
                double pmax = t_angles [ny+1]/360;
                Edge*  edge = getEdgeJ (nx, ny, nz);
                geom->addAssociation (edge, subid, pmin, pmax);
-               cout << " assoCylinders : ny= " << ny << ", nz= " << nz 
-                    << " param = (" << pmin << ", " << pmax  << ")\n";
+               if (db) std::cout << " assoCylinders : ny= " << ny 
+                                << ", nz= " << nz << " param = (" 
+                                << pmin << ", " << pmax  << ")\n";
                }
            }
        }
@@ -314,8 +269,8 @@ void Elements::assoRind (double* ori, double* vi, int nx, NewShape* geom)
            Vertex* nd2 = edge->getVertex (V_AVAL);
            double pmin = calcul_param (ori, vi, nd1);
            double pmax = calcul_param (ori, vi, nd2);
-           cout << " assoRind : ny= " << ny << ", nz= " << nz 
-                << " param = (" << pmin << ", " << pmax  << ")\n";
+           std::cout << " assoRind : ny= " << ny << ", nz= " << nz 
+                    << " param = (" << pmin << ", " << pmax  << ")\n";
 
            geom->addAssociation (edge, subid, pmin, pmax);
            geom->addAssociation (quad, sphid);
@@ -328,7 +283,7 @@ void Elements::assoCircle (double* center, Edge* ed1, Edge* ed2, NewShape* geom)
 {
    Real3 oa,  ob, normal;
    Real3 pta, ptb, ptc, ptd;
-   string brep;
+   std::string brep;
 
 //  Les 2 edges dont les petits cotes d'un rectangle de rapport L/l=sqrt(2)
 //  Soit le cercle circonscrit a ce rectangle.
@@ -356,7 +311,7 @@ void Elements::assoCircle (double* center, Edge* ed1, Edge* ed2, NewShape* geom)
    double rayon = calc_norme (oa);
    int    subid = geom->addCircle (center, rayon, normal, oa);
 
-   const double alpha = atan (sqrt(2)/2)/M_PI; //  angle proche de 70.528 degres
+   const double alpha = atan (sqrt(2.)/2)/M_PI; //  angle proche de 70.528 degres
    // asso1->setBounds (0,   alpha);
    // asso2->setBounds (0.5, alpha + 0.5);
 
@@ -411,7 +366,7 @@ int Elements::propagateAssociation (Edge* orig, Edge* dest, Edge* dir)
    if (vo1==NULL || vd1==NULL)
       return HERR;
 
-   string  trep;
+   std::string  trep;
    Real3   pa, pb, vdir1, vdir2;
    calc_vecteur (vo1->getPoint (pa), vd1->getPoint (pb), vdir1);
    calc_vecteur (vo2->getPoint (pa), vd2->getPoint (pb), vdir2);
@@ -426,7 +381,7 @@ int Elements::propagateAssociation (Edge* orig, Edge* dest, Edge* dir)
           Shape* shape  = tab_shapes[nro];
           if (shape!=NULL)
              {
-             string brep   = shape->getBrep();
+             std::string brep   = shape->getBrep();
              translate_brep (brep, vdir1, trep);
              // Shape* tshape = new Shape (trep);
              // tshape->setBounds (shape->getStart(), shape->getEnd());
@@ -441,7 +396,7 @@ int Elements::propagateAssociation (Edge* orig, Edge* dest, Edge* dir)
        Shape* shape = vo1->getAssociation ();
        if (shape!=NULL && vd1->getAssociation ()==NULL)
           {
-          string brep   = shape->getBrep();
+          std::string brep   = shape->getBrep();
           translate_brep (brep, vdir, trep);
           // Shape* tshape = new Shape (trep);
           // vd1->setAssociation (tshape);
@@ -475,7 +430,7 @@ int Elements::prismAssociation (Edge* lorig, Edge* ldest, int nh)
        char       name [24];
 
        sprintf (name, "0x%lx#%d", (unsigned long) shape, nh);
-       map<string,int>::iterator iter = map_shape.find (name);
+       std::map<std::string,int>::iterator iter = map_shape.find (name);
        if (iter != map_shape.end())
           subid = iter->second;
        else
@@ -705,7 +660,7 @@ int Elements::saveVtk  (cpchar radical, int &nro)
    sprintf (num, "%d", nro);
    nro ++;
 
-   string filename = radical;
+   std::string filename = radical;
    filename += num;
    filename += ".vtk";
    int ier = saveVtk (filename.c_str());