Salome HOME
Updated copyright comment
[modules/hexablock.git] / src / HEXABLOCK / HexQuad.hxx
old mode 100755 (executable)
new mode 100644 (file)
index 812c034..789b785
@@ -1,12 +1,12 @@
 
 // class : Les Quadrangles
 
-// 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
@@ -26,6 +26,7 @@
 
 BEGIN_NAMESPACE_HEXA
 
+#ifndef SWIG
 struct StrOrient
 {
    Vertex* v11;     // 1er sommet 1er quad
@@ -41,21 +42,31 @@ StrOrient ( StrOrient* s)
     : v11 (s->v11), v12(s->v12), v21(s->v21), v22(s->v22), dir(s->dir){}
 
 };
+#endif
 
-class Quad : public EltBase
+class HexaExport Quad : public EltBase
 {
 public:
     virtual Edge*   getEdge   (int  nro);
     virtual Vertex* getVertex (int  nro);
 
-    virtual int countEdge   () { return QUAD4; } 
-    virtual int countVertex () { return QUAD4; } 
-public:
+    int   addAssociation (NewShape*  forme, int subid);
+    virtual void  clearAssociation  ();
+
+    void setColor  (double valeur);
+    Vertex* nearestVertex (Vertex* other);
+    double* getCenter     (double* center);
+
     Quad (Vertex* va, Vertex* vb, Vertex* vc, Vertex* vd);
+
+#ifndef SWIG
+public:
     Quad (Edge* ea, Edge* eb, Edge* ec, Edge* ed);
     Quad (Quad* other);
 
+    virtual int countEdge   () { return QUAD4; }
+    virtual int countVertex () { return QUAD4; }
+
     Hexa* getParent (int nro);
 
     Edge* findEdge   (Vertex* v1, Vertex*v2);
@@ -63,177 +74,69 @@ public:
     int   anaMerge (Vertex* v1, Vertex* v2, Vertex* tv[], Edge* te[]);
 
     int   ordoVertex (Vertex* v1, Vertex* v2, Vertex* tv[]);
-    int   prepaMerge (Vertex* tv1[], Vertex* tv2[], Edge* te1[]);
+    int   ordonner   (Vertex* v1, Vertex* v2, Vertex* tv[], Edge* ted[]);
 
     int   inter     (Quad* other, int& nro);
+    Edge* inter     (Quad* other);
     bool  definedBy (Vertex* v1, Vertex* v2);
     bool  definedBy (Edge*   e1,  Edge*   e2);
 
     int   indexVertex (Vertex* elt);
     int   indexEdge   (Edge*   elt);
 
-    int   accoupler (Quad* other, StrOrient* orient);
+    //int   accoupler (Quad* other, StrOrient* orient);
     int   coupler (Quad* other, StrOrient* orient, Elements* table);
 
     Edge*   getOpposEdge   (Edge* arete, int &sens);
     Vertex* getOpposVertex (Vertex* sommet);
+    Hexa*   opposedHexa (Hexa* hexa);
 
     virtual void majReferences();            // M.A.J relation "utilise par"
     virtual void dump ();
     virtual void dumpPlus ();
     virtual void saveXml (XmlWriter* xml);
-    void setScalar (double valeur);
-    void setColor  (double valeur)          { setScalar (valeur) ; }
+    void setScalar (double valeur)              { setColor (valeur); }
 
     void         replace (Quad* old);
     virtual void replaceEdge   (Edge*   old, Edge*   nouveau);
     virtual void replaceVertex (Vertex* old, Vertex* nouveau);
 
-    virtual void  setAssociation (Shape* forme);
-    virtual int   addAssociation (Shape* forme); 
-    virtual void  clearAssociation  ()      { tab_assoc.clear() ; }
-    virtual bool  isAssociated ()           { return tab_assoc.size() > 0  ; }
+    virtual void  setAssociation (Shape* forme) {}              // PERIME
+    virtual int   addAssociation (Shape* forme) {return HOK ; } // PERIME
 
-    const Shapes& getAssociations ()        { return tab_assoc ; }
+
+    // const Shapes& getAssociations ()        { return tab_shapes ; }
 
 
     virtual void duplicate ();
     Quad* getClone ()               {  return q_clone ; }
 
-    Edge* getOpposEdge     (Edge* arete);   // Version simplifiee 
-    Edge* getPerpendicular (Edge* arete, Vertex* node); 
+    Edge* getOpposEdge     (Edge* arete);   // Version simplifiee
+    Edge* getPerpendicular (Edge* arete, Vertex* node);
     int   getOrientation ()            { return q_orientation; }
     int   setOrientation ();
     void  setOrientation (int ori);
+    void  reorienter ();
+                                                      // Hexa5
+    int   addAssociation (FaceShape* forme);
+    int   countAssociation ()                     { return tab_assoc.size () ; }
+    FaceShape* getAssociation (int nro);
+
+    double  dist2         (double* point);
 
 private:
     friend class Cloner;
     Quad* getBrother (StrOrient* orient);
-    
+
 private:
     Edge*   q_edge   [QUAD4];
     Vertex* q_vertex [QUAD4];
     Quad*   q_clone;
-    int     q_orientation; 
+    int     q_orientation;
 
-    Shapes tab_assoc;
+    FaceShapes tab_assoc;
+#endif
 };
-// ----------------------------------------------- Inlining
-// ========================================================== addAssociation
-inline int Quad::addAssociation (Shape* forme)
-{
-   if (forme != NULL)
-       tab_assoc.push_back (forme);
-   return HOK;
-}
-// ============================================================  getEdge
-inline Edge* Quad::getEdge (int nro) 
-{
-   Edge* elt = NULL;
-   if (nro >=0 && nro < QUAD4 && el_status == HOK && q_edge [nro]->isValid())
-      elt = q_edge [nro]; 
-
-   return elt;
-}
-// ============================================================  getVertex
-inline Vertex* Quad::getVertex (int nro) 
-{
-   Vertex* elt = NULL;
-   if (nro >=0 && nro < QUAD4 && el_status == HOK && q_vertex [nro]->isValid())
-      elt = q_vertex [nro]; 
-
-   return elt;
-}
-// ======================================================== commonEdge
-inline Edge* Quad::commonEdge (Quad* other)
-{
-   for (int ne1=0 ; ne1<QUAD4 ; ne1++) 
-       for (int ne2=0 ; ne2<QUAD4 ; ne2++) 
-           if (q_edge [ne1] == other->q_edge [ne2])
-              return q_edge [ne1];
-
-   return NULL;
-}
-
-// ======================================================== Inter
-inline int Quad::inter (Quad* other, int& nother)
-{
-   for (int ne1=0 ; ne1<QUAD4 ; ne1++) 
-       for (int ne2=0 ; ne2<QUAD4 ; ne2++) 
-           if (q_edge [ne1] == other->q_edge [ne2])
-              {
-              nother = ne2;
-              return  ne1;
-              }
-
-   nother = NOTHING;
-   return NOTHING;
-}
-// ============================================================ definedBy (v)
-inline bool Quad::definedBy  (Vertex* v1, Vertex* v2)
-{
-   for (int n1=0 ; n1< QUAD4 ; n1++)
-       if (v1 == q_vertex[n1] && v2 == q_vertex[(n1+2) MODULO QUAD4])
-          return true;
-
-   return false;
-}
-// ============================================================ definedBy (e)
-inline bool Quad::definedBy  (Edge* e1, Edge* e2)
-{
-   for (int n1=0 ; n1< QUAD4 ; n1++)
-       if (e1 == q_edge[n1] && e2 == q_edge[(n1+2) MODULO QUAD4])
-          return true;
-
-   return false;
-}
-// =============================================================== findEdge
-inline Edge* Quad::findEdge (Vertex* v1, Vertex* v2)
-{
-   for (int nro=0 ; nro< QUAD4 ; nro++)
-       {
-       Vertex* va = q_edge[nro]->getVertex(V_AMONT) ;
-       Vertex* vb = q_edge[nro]->getVertex(V_AVAL) ;
-       if ((v1==va && v2==vb) || (v1==vb && v2==va))
-           return q_edge [nro];
-       }
-
-   return NULL;
-}
-// =============================================================== indexVertex
-inline int Quad::indexVertex  (Vertex* elt)
-{
-   for (int n1=0 ; n1< QUAD4 ; n1++)
-       if (elt == q_vertex[n1]) 
-          return n1;
-
-   return NOTHING;
-}
-// =============================================================== indexEdge
-inline int Quad::indexEdge  (Edge* elt)
-{
-   for (int n1=0 ; n1< QUAD4 ; n1++)
-       if (elt == q_edge[n1]) 
-          return n1;
-
-   return NOTHING;
-}
-// =============================================================== setScalar
-inline void Quad::setScalar  (double val)
-{
-   for (int n1=0 ; n1< QUAD4 ; n1++)
-       q_vertex[n1] -> setScalar (val);
-}
-// =============================================================== duplicate
-inline void Quad::duplicate  ()
-{
-   q_orientation  = Q_UNDEFINED;
-   q_clone = new Quad (GetClone (q_edge [E_A]), 
-                       GetClone (q_edge [E_B]), 
-                       GetClone (q_edge [E_C]), 
-                       GetClone (q_edge [E_D]));
-   q_clone->tab_assoc = tab_assoc;
-}
 END_NAMESPACE_HEXA
 #endif