Salome HOME
first update of those files to administrate the integration of Netgen in the
authornadir <nadir>
Thu, 16 Oct 2003 13:37:09 +0000 (13:37 +0000)
committernadir <nadir>
Thu, 16 Oct 2003 13:37:09 +0000 (13:37 +0000)
SMESH Engine.

15 files changed:
src/DriverMED/DriverMED_W_SMESHDS_Mesh.cxx
src/SMESH/Makefile.in
src/SMESH/SMESH_HypothesisFactory.cxx
src/SMESH/SMESH_MaxElementVolume.cxx
src/SMESH/SMESH_MaxElementVolume.hxx
src/SMESHGUI/SMESHGUI.cxx
src/SMESHGUI/SMESHGUI_icons.po
src/SMESH_I/Makefile.in
src/SMESH_I/SMESH_Gen_i.cxx
src/SMESH_I/SMESH_HypothesisFactory_i.cxx
src/SMESH_I/SMESH_MEDMesh_i.cxx
src/SMESH_I/SMESH_MEDMesh_i.hxx
src/SMESH_I/SMESH_MaxElementVolume_i.cxx
src/SMESH_I/SMESH_MaxElementVolume_i.hxx
src/SMESH_SWIG/Makefile.in

index 1c602e378d794a7f33ffb819c064244c2ad4506b..8459854360677b869d95fb1416372f2de5478849 100644 (file)
@@ -361,6 +361,12 @@ void DriverMED_W_SMESHDS_Mesh::Add()
                        nmailles[9]++;
                        break;
                }
+               case 4 :
+               {
+                       elem_Id[7].push_back(elem->GetID());
+                       nmailles[7]++;
+                       break;
+               }
                }
        }
 
index 2d94ab908c5373e9df2c3f7302716fdfae06e4d9..8de62e1ea896e9f4ac8a1a16d71a871af23f0fd4 100644 (file)
@@ -95,5 +95,14 @@ CXXFLAGS+= $(OCC_CXXFLAGS) $(MED2_INCLUDES) $(HDF5_INCLUDES) -I${KERNEL_ROOT_DIR
 
 LDFLAGS+= $(HDF5_LIBS) $(MED2_LIBS) -lOpUtil -lSMESHDS -lSMDS -lMEFISTO2D -lMeshDriverDAT -lMeshDriverMED -lMeshDriverUNV -L${KERNEL_ROOT_DIR}/lib/salome
 
+ifeq (@WITHNETGEN@,yes)
+  EXPORT_HEADERS+= SMESH_Tetra_3D.hxx
+  LIB_SRC+= SMESH_Tetra_3D.cxx
+  NETGEN_INCLUDES=@NETGEN_INCLUDES@
+  CPPFLAGS+= $(NETGEN_INCLUDES)
+  CXXFLAGS+= $(NETGEN_INCLUDES)
+  LDFLAGS+=  -lNETGEN
+endif
+
 @CONCLUDE@
 
index ec9b492ef4f6a9d4dd423e1db87ea191b3a0d8b9..c7ad83a10df23b05ebc743a637fac775f7eb59d7 100644 (file)
@@ -41,10 +41,12 @@ using namespace std;
 #include "SMESH_LengthFromEdges.hxx"
 #include "SMESH_NumberOfSegments.hxx"
 #include "SMESH_MaxElementArea.hxx"
+#include "SMESH_MaxElementVolume.hxx"
 #include "SMESH_Regular_1D.hxx"
 #include "SMESH_MEFISTO_2D.hxx"
 #include "SMESH_Quadrangle_2D.hxx"
 #include "SMESH_Hexa_3D.hxx"
+#include "SMESH_Tetra_3D.hxx"
 
 //---------------------------------------
 
@@ -87,11 +89,12 @@ _creatorMap["LocalLength"] = new SMESH_HypothesisCreator<SMESH_LocalLength>;
 _creatorMap["NumberOfSegments"] = new SMESH_HypothesisCreator<SMESH_NumberOfSegments>;
 _creatorMap["LengthFromEdges"] = new SMESH_HypothesisCreator<SMESH_LengthFromEdges>;
 _creatorMap["MaxElementArea"] = new SMESH_HypothesisCreator<SMESH_MaxElementArea>;
+_creatorMap["MaxElementVolume"] = new SMESH_HypothesisCreator<SMESH_MaxElementVolume>;
 _creatorMap["Regular_1D"] = new SMESH_HypothesisCreator<SMESH_Regular_1D>;
 _creatorMap["MEFISTO_2D"] = new SMESH_HypothesisCreator<SMESH_MEFISTO_2D>;
 _creatorMap["Quadrangle_2D"] = new SMESH_HypothesisCreator<SMESH_Quadrangle_2D>;
 _creatorMap["Hexa_3D"] = new SMESH_HypothesisCreator<SMESH_Hexa_3D>;
-
+_creatorMap["Tetra_3D"] = new SMESH_HypothesisCreator<SMESH_Tetra_3D>;
 //---------------------------------------
 }
 
index cd77ebe8eaf2036c9d3a6e407bc27d3a700b9824..cb25383d7859f6e84ee2e7d39ea068d720ecded4 100644 (file)
 //  $Header$
 
 using namespace std;
+
+#include "SMESH_MaxElementVolume.hxx"
+#include "utilities.h"
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+SMESH_MaxElementVolume::SMESH_MaxElementVolume(int hypId, int studyId, SMESH_Gen* gen)
+  : SMESH_Hypothesis(hypId, studyId, gen)
+{
+  _maxVolume =1.;
+  _name = "MaxElementVolume";
+//   SCRUTE(_name);
+  SCRUTE(&_name);
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+SMESH_MaxElementVolume::~SMESH_MaxElementVolume()
+{
+  MESSAGE("SMESH_MaxElementVolume::~SMESH_MaxElementVolume");
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+void SMESH_MaxElementVolume::SetMaxVolume(double maxVolume)
+  throw (SALOME_Exception)
+{
+  double oldVolume = _maxVolume;
+  if (maxVolume <= 0) 
+    throw SALOME_Exception(LOCALIZED("maxVolume must be positive"));
+  _maxVolume = maxVolume;
+  if (_maxVolume != oldVolume)
+    NotifySubMeshesHypothesisModification();
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+double SMESH_MaxElementVolume::GetMaxVolume() const
+{
+  return _maxVolume;
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+ostream & SMESH_MaxElementVolume::SaveTo(ostream & save)
+{
+  return save << this;
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+istream & SMESH_MaxElementVolume::LoadFrom(istream & load)
+{
+  return load >> (*this);
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+ostream & operator << (ostream & save, SMESH_MaxElementVolume & hyp)
+{
+  save << hyp._maxVolume;
+  return save;
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+istream & operator >> (istream & load, SMESH_MaxElementVolume & hyp)
+{
+  bool isOK = true;
+  double a;
+  isOK = (load >> a);
+  if (isOK) hyp._maxVolume = a;
+  else load.clear(ios::badbit | load.rdstate());
+  return load;
+}
+
index fe530497f23067b928b518ce9f66fae6200308d4..f69fb7747443f922d6b948246f6ed6c40893f947 100644 (file)
 //  Module : SMESH
 //  $Header$
 
+#ifndef _SMESH_MAXELEMENTVOLUME_HXX_
+#define _SMESH_MAXELEMENTVOLUME_HXX_
+
+#include "SMESH_Hypothesis.hxx"
+#include "Utils_SALOME_Exception.hxx"
+
+class SMESH_MaxElementVolume:
+  public SMESH_Hypothesis
+{
+public:
+  SMESH_MaxElementVolume(int hypId, int studyId, SMESH_Gen* gen);
+  virtual ~SMESH_MaxElementVolume();
+
+  void SetMaxVolume(double maxVolume)
+    throw (SALOME_Exception);
+
+  double GetMaxVolume() const;
+
+  virtual ostream & SaveTo(ostream & save);
+  virtual istream & LoadFrom(istream & load);
+  friend ostream & operator << (ostream & save, SMESH_MaxElementVolume & hyp);
+  friend istream & operator >> (istream & load, SMESH_MaxElementVolume & hyp);
+
+protected:
+  double _maxVolume;
+};
+
+#endif
index dcb6d7c98308c2fc74de8bc0ad4de1b3689ab591..f87fa254605cf42ffa64127a7d0a3560577c5cd6 100644 (file)
@@ -846,6 +846,8 @@ void SMESHGUI::CreateAlgorithm( QString TypeAlgo, QString NameAlgo )
       Hyp = myComponentMesh->CreateHypothesis( TypeAlgo, myStudyId );
     else if ( TypeAlgo.compare("Hexa_3D") == 0 )
       Hyp = myComponentMesh->CreateHypothesis( TypeAlgo, myStudyId );
+    else if ( TypeAlgo.compare("Tetra_3D") == 0 )
+      Hyp = myComponentMesh->CreateHypothesis( TypeAlgo, myStudyId );
     
     if ( !Hyp->_is_nil() ) {
       SALOMEDS::SObject_var SHyp = myStudyAPI.AddNewAlgorithms( Hyp );
@@ -2283,7 +2285,7 @@ bool SMESHGUI::OnGUIEvent(int theCommandID,       QAD_Desktop* parent)
              double beforeMaxVolume = MEV->GetMaxElementVolume() ;
              double MaxVolume = smeshGUI->Parameter( res, 
                                                      beforeMaxVolume,
-                                                     tr("SMESH_MAX_ELEMENT_AREA_HYPOTHESIS"), 
+                                                     tr("SMESH_MAX_ELEMENT_VOLUME_HYPOTHESIS"), 
                                                      tr("SMESH_VALUE"), 
                                                      1.0E-5, 1E6, 6 ) ;
              if ( res && MaxVolume != beforeMaxVolume ) {
@@ -2487,7 +2489,12 @@ bool SMESHGUI::OnGUIEvent(int theCommandID,      QAD_Desktop* parent)
       }
     case 5020: 
       {
-       smeshGUI->CreateAlgorithm("Hexa_3D","Hexaedral (i,j,k)");       
+       smeshGUI->CreateAlgorithm("Hexa_3D","Hexahedral (i,j,k)");      
+       break;
+      }
+    case 5021: 
+      {
+       smeshGUI->CreateAlgorithm("Tetra_3D","Tetrahedral (Netgen)");   
        break;
       }
 
index 2ccb593df31dab5d17c6bbccb373e0ac7c601fab..32b840bbc8dfc2f74132456aaba9e7cab7f1887e 100644 (file)
@@ -168,6 +168,10 @@ msgstr "mesh_tree_algo_mefisto.png"
 msgid "ICON_SMESH_TREE_ALGO_Quadrangle_2D"
 msgstr "mesh_tree_algo_quad.png"
 
+#mesh_tree_algo_tetra
+msgid "ICON_SMESH_TREE_ALGO_Tetra_3D"
+msgstr "mesh_tree_algo_tetra.png"
+
 #mesh_tree_hypo
 msgid "ICON_SMESH_TREE_HYPO"
 msgstr "mesh_tree_hypo.png"
index 2ed45ada358b1b63abbeab5668d15156200dd773..a1667387e930980223863b6aa9cbddaa00187867 100644 (file)
@@ -78,5 +78,10 @@ CXXFLAGS+= $(OCC_CXXFLAGS) $(MED2_INCLUDES) $(HDF5_INCLUDES) -I${KERNEL_ROOT_DIR
 
 LDFLAGS+= $(HDF5_LIBS) $(MED2_LIBS) -lSMESHimpl -lSalomeContainer -lSalomeNS -lSalomeDS -lRegistry -lSalomeHDFPersist -lOpUtil -lGEOMClient -lSMESHDS -lSMDS -lMEFISTO2D -lMeshDriverMED -lSalomeLifeCycleCORBA -L${KERNEL_ROOT_DIR}/lib/salome -L${GEOM_ROOT_DIR}/lib/salome
 
+ifeq (@WITHNETGEN@,yes)
+  LIB_SRC += SMESH_Tetra_3D_i.cxx
+  LDFLAGS += -lNETGEN
+endif
+
 @CONCLUDE@
 
index fa5152ed2c257e1a491fa917d507e17899ec1531..d9c404cd93a4b90b4425cbecf6cb4fc7b82a0e42 100644 (file)
@@ -53,6 +53,7 @@ using namespace std;
 #include "SMESH_LocalLength_i.hxx"
 #include "SMESH_NumberOfSegments_i.hxx"
 #include "SMESH_MaxElementArea_i.hxx"
+#include "SMESH_MaxElementVolume_i.hxx"
 
 #include "SMESHDS_Document.hxx"
 
@@ -465,7 +466,7 @@ SALOMEDS::TMPFile* SMESH_Gen_i::Save(SALOMEDS::SComponent_ptr theComponent,
 //************branch 1 : hypothesis
     if (gotBranch->Tag()==Tag_HypothesisRoot) { //hypothesis = tag 1
 
-      double length,maxElementsArea;
+      double length,maxElementsArea,maxElementsVolume;
       int numberOfSegments;
 
       destFile = fopen( hypofile.ToCString() ,"w");
@@ -495,6 +496,11 @@ SALOMEDS::TMPFile* SMESH_Gen_i::Save(SALOMEDS::SComponent_ptr theComponent,
             maxElementsArea = MEA->GetMaxElementArea();
             fprintf(destFile,"%f\n",maxElementsArea);
           }
+          else if (strcmp(myHyp->GetName(),"MaxElementVolume")==0) {
+            SMESH::SMESH_MaxElementVolume_var MEV = SMESH::SMESH_MaxElementVolume::_narrow( myHyp );
+            maxElementsVolume = MEV->GetMaxElementVolume();
+            fprintf(destFile,"%f\n",maxElementsVolume);
+          }
         }
       }
       fclose(destFile);
@@ -945,7 +951,7 @@ bool SMESH_Gen_i::Load(SALOMEDS::SComponent_ptr theComponent,
 //***************
       if (strcmp(name,"Hypothesis")==0) {
         
-        double length,maxElementsArea;
+        double length,maxElementsArea,maxElementsVolume;
         int numberOfSegments;
 
         hdf_group[Tag_HypothesisRoot] = new HDFgroup(name,hdf_file); 
@@ -1000,6 +1006,16 @@ bool SMESH_Gen_i::Load(SALOMEDS::SComponent_ptr theComponent,
             sprintf(objectId,"%d",MEA->GetId());
             _SMESHCorbaObj[string("Hypo_")+string(objectId)] = iorString;
           }
+          else if (strcmp(aLine,"MaxElementVolume")==0) {
+            SMESH::SMESH_Hypothesis_var myHyp  = this->CreateHypothesis(aLine,studyId);
+            SMESH::SMESH_MaxElementVolume_var MEV = SMESH::SMESH_MaxElementVolume::_narrow( myHyp );
+            fscanf(loadedFile,"%s",aLine);
+            maxElementsVolume = atof(aLine);
+            MEV->SetMaxElementVolume(maxElementsVolume);
+            string iorString = _orb->object_to_string(MEV);
+            sprintf(objectId,"%d",MEV->GetId());
+            _SMESHCorbaObj[string("Hypo_")+string(objectId)] = iorString;
+          }
           
 
         }
index d292a78fcb7b300ef3049ffaeeabb83f70ec2fcb..c7bff63948cfe27c89f85be5d6b514645df5208c 100644 (file)
@@ -39,10 +39,12 @@ using namespace std;
 #include "SMESH_LocalLength_i.hxx"
 #include "SMESH_NumberOfSegments_i.hxx"
 #include "SMESH_MaxElementArea_i.hxx"
+#include "SMESH_MaxElementVolume_i.hxx"
 #include "SMESH_Regular_1D_i.hxx"
 #include "SMESH_MEFISTO_2D_i.hxx"
 #include "SMESH_Quadrangle_2D_i.hxx"
 #include "SMESH_Hexa_3D_i.hxx"
+#include "SMESH_Tetra_3D_i.hxx"
 
 //---------------------------------------
 
@@ -83,10 +85,12 @@ SMESH_HypothesisFactory_i::SMESH_HypothesisFactory_i()
 _creatorMap["LocalLength"] = new HypothesisCreator_i<SMESH_LocalLength_i>;
 _creatorMap["NumberOfSegments"] = new HypothesisCreator_i<SMESH_NumberOfSegments_i>;
 _creatorMap["MaxElementArea"] = new HypothesisCreator_i<SMESH_MaxElementArea_i>;
+_creatorMap["MaxElementVolume"] = new HypothesisCreator_i<SMESH_MaxElementVolume_i>;
 _creatorMap["Regular_1D"] = new HypothesisCreator_i<SMESH_Regular_1D_i>;
 _creatorMap["MEFISTO_2D"] = new HypothesisCreator_i<SMESH_MEFISTO_2D_i>;
 _creatorMap["Quadrangle_2D"] = new HypothesisCreator_i<SMESH_Quadrangle_2D_i>;
 _creatorMap["Hexa_3D"] = new HypothesisCreator_i<SMESH_Hexa_3D_i>;
+_creatorMap["Tetra_3D"] = new HypothesisCreator_i<SMESH_Tetra_3D_i>;
 
 //---------------------------------------
 }
index e4ca92bf5b57c764766824d417cf8dde1c5fafbd..f652c6da544e87de6f56513b92d2216011d37075 100644 (file)
@@ -196,7 +196,7 @@ SMESH_MEDMesh_i::existConnectivity(SALOME_MED::medConnectivity connectivityType,
  * CORBA: Accessor for Coordinate
  */
 //=============================================================================
-double SMESH_MEDMesh_i::getCoordinate(CORBA::Long Number, CORBA::Long Axis)
+CORBA::Double SMESH_MEDMesh_i::getCoordinate(CORBA::Long Number, CORBA::Long Axis)
   throw (SALOME::SALOME_Exception)
 {
   MESSAGE("!!!!!! NOT YET IMPLEMENTED !!!!");
index 0f7f1523a353598b4def877b32793ffaf5960319..5e275446dd5f957f78d085a88db2d8e1dd944c22 100644 (file)
@@ -91,7 +91,7 @@ class SMESH_MEDMesh_i:
        SALOME_MED::double_array * getCoordinates(SALOME_MED::medModeSwitch typeSwitch)
                throw(SALOME::SALOME_Exception);
 
-        double getCoordinate(CORBA::Long Number, CORBA::Long Axis)
+        CORBA::Double getCoordinate(CORBA::Long Number, CORBA::Long Axis)
          throw (SALOME::SALOME_Exception);
 
        SALOME_MED::string_array * getCoordinatesNames()
index dfbb37b80f60beb9374f8e837e142824dd856d8b..9ed53a08dcd6228a78d17038dddfafd2cba119e2 100644 (file)
 //  $Header$
 
 using namespace std;
+
+#include "SMESH_MaxElementVolume_i.hxx"
+#include "SMESH_Gen.hxx"
+#include "SMESH_HypothesisFactory.hxx"
+
+#include "Utils_CorbaException.hxx"
+#include "utilities.h"
+
+//=============================================================================
+/*!
+ *  Constructor: 
+ *  _name is related to the class name: prefix = SMESH_ ; suffix = _i .
+ */
+//=============================================================================
+
+SMESH_MaxElementVolume_i::SMESH_MaxElementVolume_i(const char* anHyp,
+                                                  int studyId,
+                                                  ::SMESH_Gen* genImpl)
+{
+  MESSAGE("SMESH_MaxElementVolume_i::SMESH_MaxElementVolume_i");
+  _impl = new ::SMESH_MaxElementVolume(genImpl->_hypothesisFactory.GetANewId(),
+                                      studyId,
+                                      genImpl);
+  _baseImpl = _impl;
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+SMESH_MaxElementVolume_i::~SMESH_MaxElementVolume_i()
+{
+  MESSAGE("SMESH_MaxElementVolume_i::~SMESH_MaxElementVolume_i()");
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+void SMESH_MaxElementVolume_i::SetMaxElementVolume(CORBA::Double volume)
+  throw (SALOME::SALOME_Exception)
+{
+  ASSERT(_impl);
+  try
+    {
+      _impl->SetMaxVolume(volume);
+    }
+  catch (SALOME_Exception& S_ex)
+    {
+      THROW_SALOME_CORBA_EXCEPTION(S_ex.what(), \
+                                  SALOME::BAD_PARAM);
+    }
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+CORBA::Double SMESH_MaxElementVolume_i::GetMaxElementVolume()
+{
+  ASSERT(_impl);
+  return _impl->GetMaxVolume();
+}
+
index 8ffd245d775aff343fd1535268c113b694263a4c..c59fd65b11e4b5a73901db81f6c156dc6bbe6c31 100644 (file)
 //  Module : SMESH
 //  $Header$
 
+#ifndef _SMESH_MAXELEMENTVOLUME_I_HXX_
+#define _SMESH_MAXELEMENTVOLUME_I_HXX_
+
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SMESH_BasicHypothesis)
+
+#include "SMESH_Hypothesis_i.hxx"
+
+#include "SMESH_MaxElementVolume.hxx"
+
+class SMESH_MaxElementVolume_i:
+  public POA_SMESH::SMESH_MaxElementVolume,
+  public SMESH_Hypothesis_i
+{
+public:
+  SMESH_MaxElementVolume_i(const char* anHyp,
+                          int studyId,
+                          ::SMESH_Gen* genImpl);
+  virtual ~SMESH_MaxElementVolume_i();
+
+  void SetMaxElementVolume(CORBA::Double volume)
+    throw (SALOME::SALOME_Exception);
+
+  CORBA::Double GetMaxElementVolume();
+
+protected:
+  ::SMESH_MaxElementVolume* _impl;
+};
+
+#endif
index f2a1c70252e8d290258bd419d9d7dae2e83a45c4..3750b92f2d190ef4ac3510c0c0fb91ece1b5819b 100644 (file)
@@ -39,7 +39,16 @@ LIB_SRC =
 
 SWIG_DEF = libSMESH_Swig.i
 EXPORT_PYSCRIPTS = libSMESH_Swig.py \
-                   SMESH_test0.py SMESH_test1.py SMESH_test2.py SMESH_test3.py SMESH_mechanic.py SMESH_fixation.py batchmode_smesh.py
+                   SMESH_test0.py\
+                  SMESH_test1.py \
+                  SMESH_test2.py \
+                  SMESH_test3.py \
+                  SMESH_mechanic.py \
+                  SMESH_mechanic_tetra.py \
+                  SMESH_fixation.py \
+                  batchmode_smesh.py \
+                  SMESH_box_tetra.py \
+                  SMESH_box2_tetra.py
 
 LIB_CLIENT_IDL = SALOMEDS.idl \
                 SALOME_Exception.idl \