Salome HOME
Merge from V6_main 11/02/2013 V7_siman
authorvsr <vsr@opencascade.com>
Tue, 12 Feb 2013 15:04:07 +0000 (15:04 +0000)
committervsr <vsr@opencascade.com>
Tue, 12 Feb 2013 15:04:07 +0000 (15:04 +0000)
src/HEXABLOCK/HexCrossElements_build.cxx
src/HEXABLOCK/HexVertex.hxx
src/HEXABLOCK/Makefile.am
src/HEXABLOCK/test_hexa1.cxx
src/HEXABLOCK/test_tools.cxx
src/HEXABLOCKGUI/HEXABLOCKGUI.cxx
src/TEST_CPP/Makefile.am
src/TEST_CPP/test_hexa1.cxx
src/TEST_CPP/test_tools.cxx

index e866a94d0dbb5fde53345c8417a78813854908fa..ba9ff3df7704e09c0f3fabc893a9c151e7619072 100755 (executable)
@@ -277,6 +277,16 @@ int CrossElements::crossCylinders (Cylinder* lun, Cylinder* lautre, bool fill)
       cross_cyl2 = lun;
       }
 
+   double pr = cross_cyl1->getRadius ();
+   double gr = cross_cyl2->getRadius ();
+   if (pr>=gr*0.95)
+      {
+      cout << " **** crossCylinders : les deux rayons sont trop proches"
+           << endl;
+      setError (HERR);
+      return HERR;
+      }
+
    cross_center = cross_cyl2->interCylinder (cross_cyl1, at_left, at_right);
    if (cross_center==NULL)
       {
@@ -319,7 +329,6 @@ int CrossElements::crossCylinders (Cylinder* lun, Cylinder* lautre, bool fill)
    createLittleCyl ();
    createBigCyl    ();
 
-   Vertex* node = NULL;
    double h1=0, h3=0, dx=1 , dy=1;
    if (cyl_left!=NO_PIPE)
       {
index 612ee572a37e270b5e349a62aed5dbb748bbddb7..d5fc0f09f480cabff9b8ead15c98bd76d3f790cf 100755 (executable)
@@ -63,7 +63,6 @@ public :
 
 public :
    Vertex (Document* prev, double x=0.0, double y=0.0, double z=0.0);
-   Vertex (Document* cible, Vertex* other);
    Vertex (Vertex* other);
    virtual ~Vertex () {}
    virtual void dump () ;
@@ -113,12 +112,16 @@ inline Vertex::Vertex (Vertex* other)
       gc_x   = other->gc_x;
       gc_y   = other->gc_y;
       gc_z   = other->gc_z;
+      v_clone  = NULL;
+      v_shape  = other->v_shape;
       }
    else
       {
       v_x  = v_y  = v_z  = 0;
       gc_x = gc_y = gc_z = 0;
       v_scalar = 0;
+      v_shape  = NULL;
+      v_clone  = NULL;
       }
 }
 // ===================================================== getCoord
index 103974495b53434e35f2afb21af95183f8bdff5c..51278becc94942d982619b00ee7c1b007a2a0bd2 100755 (executable)
@@ -84,7 +84,7 @@ dist_libHEXABLOCKimpl_la_SOURCES = \
        HexQuad.cxx \
        HexHexa.cxx \
        HexVector.cxx \
-       HexElements.cxx \
+       HexElements.cxx \
        HexElements_bis.cxx \
        HexElements_ter.cxx \
        HexElements_piq.cxx \
@@ -139,7 +139,7 @@ libHEXABLOCKimpl_la_CPPFLAGS = \
 
 libHEXABLOCKimpl_la_LDFLAGS = \
        $(CAS_KERNEL) -lTKBRep -lTKPrim -lTKG2d -lTKG3d -lTKTopAlgo -lTKGeomBase -lTKGeomAlgo  -lTKBool -lTKBO \
-       $(KERNEL_LDFLAGS) -lSalomeGenericObj -lSALOMELocalTrace -lSALOMEBasics
+       $(KERNEL_LDFLAGS) -lSALOMELocalTrace -lSALOMEBasics
 
 ####  libHexaBlockimpl_la_CPPFLAGS =  \
        ####  $(KERNEL_CXXFLAGS)    \
index 61af7bb4f3afcb46a4a230106f335f10fe548b01..5888da87205e0cebe3a4a865752d4324666dc418 100755 (executable)
@@ -627,9 +627,9 @@ int test_gen_xml (int nbargs, cpchar tabargs[])
    Hex::Elements*  grid = doc->makeCartesian (orig, dir, size_x,size_y,size_z);
 
    Hex::Hexa*   cell    = grid->getHexa (0);
-   Hex::Quad*   face    = cell->getQuad (0);
-   Hex::Edge*   arete   = cell->getEdge (0);
-   Hex::Vertex* noeud   = cell->getVertex (0);
+   // Hex::Quad*   face    = cell->getQuad (0);
+   // Hex::Edge*   arete   = cell->getEdge (0);
+   // Hex::Vertex* noeud   = cell->getVertex (0);
 
    // Hex::Shape* shape1 = new Hex::Shape("riri");
    // Hex::Shape* shape2 = new Hex::Shape("fifi");
@@ -679,9 +679,9 @@ int test_string_xml (int nbargs, cpchar tabargs[])
    Hex::Elements*  grid = doc->makeCartesian (orig, dir, size_x,size_y,size_z);
 
    Hex::Hexa*   cell    = grid->getHexa (0);
-   Hex::Quad*   face    = cell->getQuad (0);
-   Hex::Edge*   arete   = cell->getEdge (0);
-   Hex::Vertex* noeud   = cell->getVertex (0);
+   // Hex::Quad*   face    = cell->getQuad (0);
+   // Hex::Edge*   arete   = cell->getEdge (0);
+   // Hex::Vertex* noeud   = cell->getVertex (0);
 
    // Hex::Shape* shape1 = new Hex::Shape("riri");
    // Hex::Shape* shape2 = new Hex::Shape("fifi");
@@ -862,57 +862,6 @@ int test_grille_cyl (int nbargs, cpchar tabargs[])
 
    return HOK;
 }
-// ================================================== test_asso_line
-int test_asso_line (int nbargs, cpchar tabargs[])
-{
-   Hex::Hex mon_ex;
-   Hex::Document* doc = mon_ex.addDocument ();
-
-   Hex::Vertex* orig1 = doc->addVertex ( 0, 0,0);
-
-   Hex::Vector* vz = doc->addVector (0,0,1);
-   Hex::Vector* vx = doc->addVector (1,0,0);
-
-   double dr = 1;
-   double dl = 1;
-   int    nr = 2;
-   int    nl = 3;
-   int    ntheta = 8;
-
-   Hex::Elements *c1 = NULL;
-
-   c1 = doc->makeCylindrical (orig1, vx,vz,dr, 360, dl,nr, ntheta, nl, true);
-
-   Hex::Edges m_line;
-   Hex::Edge* m_start = c1->getEdgeJ (nr, 1, 0);
-
-   for (int na=2 ; na<ntheta ; na++)
-       {
-       Hex::Edge*  arete = c1->getEdgeJ (nr, na, 0);
-       arete->setScalar (5);
-       m_line.push_back (arete);
-       }
-
-   // m_line.push_back (c1->getEdgeJ (nr, 0, 2));
-   // m_line.push_back (NULL);
-   Hex::Shape* gstart = NULL;
-   Hex::Shapes gline;
-   double pstart = 0 , pend = 0;
-
-   int ier = doc-> associateOpenedLine (m_start, m_line,
-                                        gstart,  pstart, gline, pend);
-   HexDisplay (ier);
-   doc->saveVtk ("asso_line.vtk");
-
-  m_line.push_back (c1->getEdgeJ (nr, 0, 0));
-   Hex::Vertex* m_first = m_start->getVertex (Hex::V_AMONT);
-   ier = doc-> associateClosedLine (m_first, m_start, m_line,
-                                        gstart, pstart, false, gline);
-   HexDisplay (ier);
-   // doc->dump ();
-
-   return HOK;
-}
 // ===================================================== test_cylindrical
 int test_cylindrical (int nbargs, cpchar tabargs[])
 {
index 1b6c61fcccf259813b4bebe1b1e190a49007231c..1daed11af6c4fb9a6e92c63551886e6c530e628c 100755 (executable)
 #include <cstdlib>
 #include <unistd.h>
 
+#include <sys/types.h>   // pour getpid()
+#include <unistd.h>      // pour getpid()
+
 static int nbr_vtk = 0;
 static cpchar case_name = "hexa";
 static Hex::Document*   docu = NULL;
 
 static string workspace = "/tmp/test_hexablock";
+static bool   w_default = true;
 
 // ======================================================== call_system 
 void call_system (const string&  command)
@@ -44,6 +48,15 @@ void goto_workspace ()
    string rmdir = "rm -rf ";
    string mkdir = "mkdir -p ";
 
+   if (w_default)
+      {
+      pid_t pid = getpid ();
+      char     bufpid [8];
+      sprintf (bufpid, "_p%d", pid);
+      workspace += bufpid;
+      w_default = false;
+      }
+
    call_system (rmdir + workspace);
    call_system (mkdir + workspace);
 
index 8e6be3a54e592c8f83e9302546cd2a702250324a..b72b608831385b01b224c50978775a324eecb301 100755 (executable)
@@ -151,7 +151,6 @@ GEOMGUI_OCCSelector*    HEXABLOCKGUI::currentOccSelector = NULL;
 
 HEXABLOCKGUI::HEXABLOCKGUI() :
           SalomeApp_Module( "HEXABLOCK" ), // default name
-          LightApp_Module( "HEXABLOCK" ),
           _menuId(190),
           _dwPattern(0),
           _dwAssociation(0),
@@ -1851,7 +1850,7 @@ void HEXABLOCKGUI::showActor()
     if (aStudy == NULL || vman == NULL) return;
 
     Handle(SALOME_InteractiveObject) anIO = currentVtkGView->getDocumentActor()->getIO();
-    aStudy->setObjectProperty(vman->getId(), anIO->getEntry(), VISIBILITY_PROP, 1 );
+    aStudy->setObjectProperty(vman->getId(), anIO->getEntry(), GEOM::propertyName(GEOM::Visibility), 1 );
     displayer()->setVisibilityState(anIO->getEntry(), Qtx::ShownState);
 }
 
@@ -1883,7 +1882,7 @@ void HEXABLOCKGUI::showOnlyActor()
             anIO = actor->getIO();
             if( anIO->hasEntry())
             {
-                aStudy->setObjectProperty(vman->getId(), anIO->getEntry(), VISIBILITY_PROP, 0 );
+                aStudy->setObjectProperty(vman->getId(), anIO->getEntry(), GEOM::propertyName(GEOM::Visibility), 0 );
                 displayer()->setVisibilityState(anIO->getEntry(), Qtx::HiddenState);
             }//if
         }//if
@@ -1895,7 +1894,7 @@ void HEXABLOCKGUI::showOnlyActor()
     currentVtkGView->update();
     currentVtkGView->getViewWindow()->onFitAll();
     anIO = currentVtkGView->getDocumentActor()->getIO();
-    aStudy->setObjectProperty(vman->getId(), anIO->getEntry(), VISIBILITY_PROP, 1 );
+    aStudy->setObjectProperty(vman->getId(), anIO->getEntry(), GEOM::propertyName(GEOM::Visibility), 1 );
     displayer()->setVisibilityState(anIO->getEntry(), Qtx::ShownState);
 
 
@@ -1966,7 +1965,7 @@ void HEXABLOCKGUI::hideActor()
     if (aStudy == NULL || vman == NULL) return;
 
     Handle(SALOME_InteractiveObject) anIO = currentVtkGView->getDocumentActor()->getIO();
-    aStudy->setObjectProperty(vman->getId(), anIO->getEntry(), VISIBILITY_PROP, 0 );
+    aStudy->setObjectProperty(vman->getId(), anIO->getEntry(), GEOM::propertyName(GEOM::Visibility), 0 );
     displayer()->setVisibilityState(anIO->getEntry(), Qtx::HiddenState);
 }
 
index 715ef28569ffe23d37de78a363b23ddc5b8a1450..f57f58dc5aa5882642a2f424677db9479f786f95 100755 (executable)
@@ -29,7 +29,6 @@ include $(top_srcdir)/adm_local/unix/make_common_starter.am
 
 # Scripts to be installed
 
-
 #
 # ===============================================================
 # Local definitions
@@ -45,16 +44,12 @@ RPATH=..
 COMMON_CPPFLAGS = \
        @CPPUNIT_INCLUDES@ \
        -I$(srcdir)/$(RPATH)/HEXABLOCK/ \
-       -I$(top_builddir)/idl \
-       @CORBA_CXXFLAGS@ @CORBA_INCLUDES@
-
+       -I$(top_builddir)/idl
 
 # This local variable defines the list of dependant libraries common to all target in this package.
 COMMON_LIBS =\
        @CPPUNIT_LIBS@ \
-       $(RPATH)/HEXABLOCK/libHEXABLOCKimpl.la \
-       $(KERNEL_LDFLAGS) \
-       -lSalomeGenericObj
+       $(RPATH)/HEXABLOCK/libHEXABLOCKimpl.la
 
 # ===============================================================
 # Libraries targets
index 17716208971dee4b4083098da45663fd933afb62..5888da87205e0cebe3a4a865752d4324666dc418 100755 (executable)
@@ -1,26 +1,24 @@
 
 // C++ : Tests unitaires
 
-// Copyright (C) 2009-2012  CEA/DEN, EDF R&D
+//  Copyright (C) 2009-2011  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.
+//  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.
 //
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// Lesser General Public License for more details.
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
 //
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-
-#include "test_unit.hxx"
+//  See http://www.salome-platform.org/
+//  or email : webmaster.salome@opencascade.com
 
 #include "test_unit.hxx"
 
@@ -35,6 +33,7 @@
 #include "HexVertex.hxx"
 
 #include "HexPropagation.hxx"
+#include "HexOldShape.hxx"
 #include "HexLaw.hxx"
 #include "HexMatrix.hxx"
 #include "HexCramer.hxx"
@@ -107,7 +106,7 @@ int test_sphere (int nbargs, cpchar tabargs[])
    Hex::Document* doc = mon_ex.addDocument ();
    Hex::Vertex*  orig = doc->addVertex (0,0,0);
 
-   int    ncouches = 0;
+   int    ncouches = 2;
    double k      = 1;
    double rayon  = 1;
    Hex::Elements* sphere = doc->makeSpherical (orig, rayon, ncouches, k);
@@ -628,9 +627,17 @@ int test_gen_xml (int nbargs, cpchar tabargs[])
    Hex::Elements*  grid = doc->makeCartesian (orig, dir, size_x,size_y,size_z);
 
    Hex::Hexa*   cell    = grid->getHexa (0);
-   Hex::Quad*   face    = cell->getQuad (0);
-   Hex::Edge*   arete   = cell->getEdge (0);
-   Hex::Vertex* noeud   = cell->getVertex (0);
+   // Hex::Quad*   face    = cell->getQuad (0);
+   // Hex::Edge*   arete   = cell->getEdge (0);
+   // Hex::Vertex* noeud   = cell->getVertex (0);
+
+   // Hex::Shape* shape1 = new Hex::Shape("riri");
+   // Hex::Shape* shape2 = new Hex::Shape("fifi");
+   // Hex::Shape* shape3 = new Hex::Shape("loulou");
+
+   // noeud->setAssociation (shape1);
+   // arete->setAssociation (shape2);
+   // face ->setAssociation (shape3);
 
    Hex::Law* law1 = doc->addLaw("loi1", 1);
    Hex::Law* law2 = doc->addLaw("loi2", 2);
@@ -672,9 +679,17 @@ int test_string_xml (int nbargs, cpchar tabargs[])
    Hex::Elements*  grid = doc->makeCartesian (orig, dir, size_x,size_y,size_z);
 
    Hex::Hexa*   cell    = grid->getHexa (0);
-   Hex::Quad*   face    = cell->getQuad (0);
-   Hex::Edge*   arete   = cell->getEdge (0);
-   Hex::Vertex* noeud   = cell->getVertex (0);
+   // Hex::Quad*   face    = cell->getQuad (0);
+   // Hex::Edge*   arete   = cell->getEdge (0);
+   // Hex::Vertex* noeud   = cell->getVertex (0);
+
+   // Hex::Shape* shape1 = new Hex::Shape("riri");
+   // Hex::Shape* shape2 = new Hex::Shape("fifi");
+   // Hex::Shape* shape3 = new Hex::Shape("loulou");
+
+   // noeud->setAssociation (shape1);
+   // arete->setAssociation (shape2);
+   // face ->setAssociation (shape3);
 
    Hex::Law* law1 = doc->addLaw("loi1", 1);
    Hex::Law* law2 = doc->addLaw("loi2", 2);
@@ -1089,15 +1104,15 @@ int test_croix (int nbargs, cpchar tabargs[])
    Hex::Hex mon_ex;
    docu = mon_ex.addDocument ();
 
-   Hex::Vertex* ori1 = docu->addVertex ( 0,0,0);
+   Hex::Vertex* ori1 = docu->addVertex ( 100,0,0);
    Hex::Vertex* ori2 = docu->addVertex (-5,0,5);
    Hex::Vector* vz   = docu->addVector ( 0,0,1);
    Hex::Vector* vx   = docu->addVector ( 1,0,0);
 
    double r1 = 2;
    double r2 = 3;
+   double l1 = 5;
    double l2 = 10;
-   double l1 = 10;
 
    Hex::Cylinder*      cyl1 = docu->addCylinder (ori1, vz, r1, l1);
    Hex::Cylinder*      cyl2 = docu->addCylinder (ori2, vx, r2, l2);
@@ -1105,6 +1120,13 @@ int test_croix (int nbargs, cpchar tabargs[])
 
    case_name = "croix";
    save_vtk ();
+   PutData ((BadElement (grid)));
+
+
+   Hex::Edge* pipo = docu->addEdge (ori1, ori1);
+   PutData (pipo->isValid());
+   PutData ((BadElement (pipo)));
+   return HOK;
 
    del_tranche (grid, 0, 1, 0);
    del_tranche (grid, 0, 1, 5);
@@ -1328,18 +1350,18 @@ int test_disconnect2 (int nbargs, cpchar tabargs[])
 // === Disconnect Edges
 int test_disconnect4 (int nbargs, cpchar tabargs[])
 {
-   const int size_x = 2;
+   const int size_x = 1;
    const int size_y = 2;
-   const int size_z = 5;
+   const int size_z = 2;
 
    Hex::Hex mon_ex;
    Hex::Document* doc = mon_ex.addDocument ();
 
    Hex::Vertex*   orig2 = doc->addVertex (0,0,0);
-   Hex::Vector*   dir   = doc->addVector (1,1,1);
-   Hex::Elements* grid2 = doc->makeCartesian (orig2, dir, size_x,size_y,size_z);
-
-   // doc->dump ();
+   Hex::Vector*   vx    = doc->addVector (1,0,0);
+   Hex::Vector*   vy    = doc->addVector (0,1,0);
+   Hex::Vector*   vz    = doc->addVector (0,0,1);
+   Hex::Elements* grid2 = doc->makeCartesian (orig2, vx,vy,vz, size_x,size_y,size_z);
 
    int nvtk = 0;
    doc->setLevel (1);
@@ -1348,8 +1370,8 @@ int test_disconnect4 (int nbargs, cpchar tabargs[])
    Hex::Edges t_edges;
    for (int nk=0 ; nk< size_z; nk++)
        {
-       Hex::Hexa* hexa2 = grid2->getHexaIJK (1,1,nk);
-       Hex::Edge* edge  = grid2->getEdgeK   (1,2,nk);
+       Hex::Hexa* hexa2 = grid2->getHexaIJK (0,0,nk);
+       Hex::Edge* edge  = grid2->getEdgeK   (0,1,nk);
 
        hexa2->setScalar  (2);
        edge->setScalar   (5);
@@ -1357,13 +1379,13 @@ int test_disconnect4 (int nbargs, cpchar tabargs[])
        t_edges.push_back (edge);
 
        doc->setLevel (4);
-
        }
 
+   doc->dump ();
    doc->saveVtk ("test_disco", nvtk);
-   Hex::Elements* disco_edges =  doc->disconnectEdges (t_hexas, t_edges);
+   /* Hex::Elements* disco_edges = */  doc->disconnectEdges (t_hexas, t_edges);
    doc->saveVtk ("test_disco", nvtk);
-   // doc->dump ();
+   doc->dump ();
    // hexa2->dumpFull ();
 
    doc->setLevel (4);
@@ -1860,11 +1882,35 @@ int test_cylindricals (int nbargs, cpchar tabargs[])
    doc->clearAssociation();
    return HOK;
 }
+// ======================================================== test_edge
+int test_edge (int nbargs, cpchar tabargs[])
+{
+   Hex::Hex mon_ex;
+   Hex::Document* doc = mon_ex.addDocument ();
+
+   Hex::Vertex* orig = doc->addVertex (0, 0, 0);
+   Hex::Vector* vx   = doc->addVector (1 ,0, 0);
+   doc->addEdge   (orig, vx);
+
+   HexDisplay (doc->countVertex());
+   HexDisplay (doc->countEdge());
+   doc->dump ();
+   return HOK;
+}
 // ======================================================== test_hexa
 int test_hexa (int nbargs, cpchar tabargs[])
 {
+   int ier = 0;
+   Hex::Hex mon_ex;
+   Hex::Document* doc1 = mon_ex.loadDocument ("bielle_triang");
+   Hex::Document* doc2 = mon_ex.loadDocument ("bielle_triang");
+   PutData (doc1->getName ());
+   PutData (doc2->getName ());
+   return ier;
+
+
    goto_workspace ();
-   int ier = test_cylindricals (nbargs, tabargs);
+   ier = test_cylindricals (nbargs, tabargs);
    ier = test_transfo (nbargs, tabargs);
    free_workspace ();
 
index 1b6c61fcccf259813b4bebe1b1e190a49007231c..1daed11af6c4fb9a6e92c63551886e6c530e628c 100755 (executable)
 #include <cstdlib>
 #include <unistd.h>
 
+#include <sys/types.h>   // pour getpid()
+#include <unistd.h>      // pour getpid()
+
 static int nbr_vtk = 0;
 static cpchar case_name = "hexa";
 static Hex::Document*   docu = NULL;
 
 static string workspace = "/tmp/test_hexablock";
+static bool   w_default = true;
 
 // ======================================================== call_system 
 void call_system (const string&  command)
@@ -44,6 +48,15 @@ void goto_workspace ()
    string rmdir = "rm -rf ";
    string mkdir = "mkdir -p ";
 
+   if (w_default)
+      {
+      pid_t pid = getpid ();
+      char     bufpid [8];
+      sprintf (bufpid, "_p%d", pid);
+      workspace += bufpid;
+      w_default = false;
+      }
+
    call_system (rmdir + workspace);
    call_system (mkdir + workspace);