Salome HOME
add QuadraticMesh hypothesis
authoreap <eap@opencascade.com>
Fri, 17 Feb 2006 14:15:27 +0000 (14:15 +0000)
committereap <eap@opencascade.com>
Fri, 17 Feb 2006 14:15:27 +0000 (14:15 +0000)
13 files changed:
idl/SMESH_BasicHypothesis.idl
resources/StdMeshers.xml
src/SMESH_I/SMESH_2smeshpy.cxx
src/SMESH_SWIG/smesh.py
src/StdMeshers/Makefile.in
src/StdMeshers/StdMeshers_QuadraticMesh.cxx [new file with mode: 0644]
src/StdMeshers/StdMeshers_QuadraticMesh.hxx [new file with mode: 0644]
src/StdMeshers/StdMeshers_Regular_1D.cxx
src/StdMeshersGUI/StdMeshers_images.po
src/StdMeshers_I/Makefile.in
src/StdMeshers_I/StdMeshers_QuadraticMesh_i.cxx [new file with mode: 0644]
src/StdMeshers_I/StdMeshers_QuadraticMesh_i.hxx [new file with mode: 0644]
src/StdMeshers_I/StdMeshers_i.cxx

index b6367b75ddec63826c7e21e57a168988ad956e69..7880020e72ee0ac27001647277fefdce42df8c2b 100644 (file)
@@ -286,6 +286,20 @@ module StdMeshers
   {
   };
 
+  /*!
+   * StdMeshers_QuadraticMesh: interface of "QuadraticMesh" hypothesis.
+   * This is an auxiliary 1D hypothesis whose presence forces construction 
+   * of quadratic edges.
+   * If the 2D mesher sees that all boundary edges are quadratic ones,
+   * it generates quadratic faces, else it generates linear faces using
+   * medium nodes as if they were vertex ones.
+   * The 3D mesher generates quadratic volumes only if all boundary faces
+   * are quadratic ones, else it fails.
+   */
+  interface StdMeshers_QuadraticMesh : SMESH::SMESH_Hypothesis
+  {
+  };
+
 
   /*!
    * StdMeshers_Regular_1D: interface of "Wire discretisation" algorithm
index 2c1cd12cccdea1748c34fda3467bb921d77a8acb..6daf06253c936a2ea5d1435d88479271cbca3c5d 100644 (file)
                 icon-id="mesh_algo_quad.png"
                 dim="2"/>
 
+    <hypothesis type="QuadraticMesh"
+                label-id="Quadratic Mesh"
+                icon-id="mesh_algo_quad.png"
+                dim="1"
+                auxiliary="true"/>                
+
     <hypothesis type="MaxElementArea"
                 label-id="Max. Element Area"
                 icon-id="mesh_hypo_area.png"
index 6d8150db80a4ca98f62420780a0af5d6d1f45f1a..8d1bba78e816067870d7ec25aaea7c88b4c48c45 100644 (file)
@@ -663,6 +663,11 @@ Handle(_pyHypothesis) _pyHypothesis::NewHypothesis( const Handle(_pyCommand)& th
     hyp->myCreationMethod = "Propagation";
     hyp->myType = "Regular_1D";
   }
+  else if ( hypType == "QuadraticMesh" ) {
+    hyp->myDim = 1;
+    hyp->myCreationMethod = "QuadraticMesh";
+    hyp->myType = "Regular_1D";
+  }
   else if ( hypType == "AutomaticLength" ) {
     hyp->myDim = 1;
     hyp->myCreationMethod = "AutomaticLength";
index fe237e511c83a47bde0b8043dce92de8526f0f28..71051056f0a986e1ab2f58e64e7bb2dec6585513 100644 (file)
@@ -215,6 +215,18 @@ class Mesh_Segment(Mesh_Algorithm):
         hyp.SetFineness( fineness )
         return hyp
 
+    def QuadraticMesh(self):
+        """
+         Define "QuadraticMesh" hypothesis, forcing construction of quadratic edges.
+         If the 2D mesher sees that all boundary edges are quadratic ones,
+         it generates quadratic faces, else it generates linear faces using
+         medium nodes as if they were vertex ones.
+         The 3D mesher generates quadratic volumes only if all boundary faces
+         are quadratic ones, else it fails.
+        """
+        hyp = self.Hypothesis("QuadraticMesh")
+        return hyp
+
 # Public class: Mesh_Segment_Python
 # ---------------------------------
 
index 592ff2b2b14620ec1ee2ce3755518ca7a51b201a..e0d879a73eb47e88882c5e679c779bcd5be3adca 100644 (file)
@@ -50,7 +50,8 @@ EXPORT_HEADERS = \
        StdMeshers_Hexa_3D.hxx \
        StdMeshers_AutomaticLength.hxx \
        StdMeshers_Distribution.hxx \
-       StdMeshers_QuadranglePreference.hxx
+       StdMeshers_QuadranglePreference.hxx \
+       StdMeshers_QuadraticMesh.hxx
 
 EXPORT_PYSCRIPTS =
 
@@ -76,7 +77,8 @@ LIB_SRC = \
        StdMeshers_Hexa_3D.cxx \
        StdMeshers_AutomaticLength.cxx \
        StdMeshers_Distribution.cxx \
-       StdMeshers_QuadranglePreference.cxx
+       StdMeshers_QuadranglePreference.cxx \
+       StdMeshers_QuadraticMesh.cxx
 
 LIB_SERVER_IDL = 
 
diff --git a/src/StdMeshers/StdMeshers_QuadraticMesh.cxx b/src/StdMeshers/StdMeshers_QuadraticMesh.cxx
new file mode 100644 (file)
index 0000000..86b4379
--- /dev/null
@@ -0,0 +1,100 @@
+//  SMESH StdMeshers_QuadraticMesh : implementaion of SMESH idl descriptions
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
+// 
+//  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. 
+// 
+//  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//
+//  File   : StdMeshers_QuadraticMesh.cxx
+//  Module : SMESH
+//  $Header$
+
+#include "StdMeshers_QuadraticMesh.hxx"
+#include "utilities.h"
+
+using namespace std;
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+StdMeshers_QuadraticMesh::StdMeshers_QuadraticMesh(int         hypId,
+                                                   int         studyId,
+                                                   SMESH_Gen * gen)
+     :SMESH_Hypothesis(hypId, studyId, gen)
+{
+  _name = "QuadraticMesh";
+  _param_algo_dim = 1; // is used by StdMeshers_Regular_1D
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+StdMeshers_QuadraticMesh::~StdMeshers_QuadraticMesh()
+{
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+ostream & StdMeshers_QuadraticMesh::SaveTo(ostream & save)
+{
+  return save;
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+istream & StdMeshers_QuadraticMesh::LoadFrom(istream & load)
+{
+  return load;
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+ostream & operator <<(ostream & save, StdMeshers_QuadraticMesh & hyp)
+{
+  return hyp.SaveTo( save );
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+istream & operator >>(istream & load, StdMeshers_QuadraticMesh & hyp)
+{
+  return hyp.LoadFrom( load );
+}
diff --git a/src/StdMeshers/StdMeshers_QuadraticMesh.hxx b/src/StdMeshers/StdMeshers_QuadraticMesh.hxx
new file mode 100644 (file)
index 0000000..6f2cc7e
--- /dev/null
@@ -0,0 +1,54 @@
+//  SMESH StdMeshers : implementaion of SMESH idl descriptions
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
+// 
+//  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. 
+// 
+//  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//
+//  File   : StdMeshers_QuadraticMesh.hxx
+//  Module : SMESH
+//  $Header$
+
+#ifndef _StdMeshers_QuadraticMesh_HXX_
+#define _StdMeshers_QuadraticMesh_HXX_
+
+#include "SMESH_Hypothesis.hxx"
+#include "Utils_SALOME_Exception.hxx"
+
+/*!
+ * \brief Hypothesis for StdMeshers_Regular_1D, forcing construction of quadratic edges.
+ * If the 2D mesher sees that all boundary edges are quadratic ones,
+ * it generates quadratic faces, else it generates linear faces using
+ * medium nodes as if they were vertex ones.
+ * The 3D mesher generates quadratic volumes only if all boundary faces
+ * are quadratic ones, else it fails.
+ */
+class StdMeshers_QuadraticMesh:public SMESH_Hypothesis
+{
+ public:
+  StdMeshers_QuadraticMesh(int hypId, int studyId, SMESH_Gen * gen);
+  virtual ~ StdMeshers_QuadraticMesh();
+  
+  virtual std::ostream & SaveTo(std::ostream & save);
+  virtual std::istream & LoadFrom(std::istream & load);
+  friend std::ostream & operator <<(std::ostream & save, StdMeshers_QuadraticMesh & hyp);
+  friend std::istream & operator >>(std::istream & load, StdMeshers_QuadraticMesh & hyp);
+};
+
+#endif
index 6bc2ca700932b7d02c985aeb06ddff93f572a55b..d3d92f9ea20d8a66a327c83c04ee3208f5623fbc 100644 (file)
@@ -33,6 +33,8 @@ using namespace std;
 #include "StdMeshers_Distribution.hxx"
 #include "SMESH_Gen.hxx"
 #include "SMESH_Mesh.hxx"
+#include "SMESH_HypoFilter.hxx"
+#include "SMESH_subMesh.hxx"
 
 #include <OSD.hxx>
 
@@ -41,12 +43,11 @@ using namespace std;
 #include "StdMeshers_Arithmetic1D.hxx"
 #include "StdMeshers_StartEndLength.hxx"
 #include "StdMeshers_Deflection1D.hxx"
-#include <StdMeshers_AutomaticLength.hxx>
+#include "StdMeshers_AutomaticLength.hxx"
 
 #include "SMDS_MeshElement.hxx"
 #include "SMDS_MeshNode.hxx"
 #include "SMDS_EdgePosition.hxx"
-#include "SMESH_subMesh.hxx"
 
 #include "Utils_SALOME_Exception.hxx"
 #include "utilities.h"
@@ -507,6 +508,10 @@ bool StdMeshers_Regular_1D::Compute(SMESH_Mesh & aMesh, const TopoDS_Shape & aSh
   SMESHDS_Mesh * meshDS = aMesh.GetMeshDS();
   aMesh.GetSubMesh(aShape);
 
+  // quardatic mesh required?
+  SMESH_HypoFilter filter( SMESH_HypoFilter::HasName( "QuadraticMesh" ));
+  bool isQuadraticMesh = aMesh->GetHypothesis( aShape, filter, true );
+
   const TopoDS_Edge & EE = TopoDS::Edge(aShape);
   TopoDS_Edge E = TopoDS::Edge(EE.Oriented(TopAbs_FORWARD));
   int shapeID = meshDS->ShapeToIndex( E );
index c5978633b7c83adf77460ff2c2f825b720b72f92..64828da636f5904365dc2c9b3bf53581a1d8911a 100644 (file)
@@ -80,10 +80,14 @@ msgstr "mesh_tree_algo_quad.png"
 msgid "ICON_SMESH_TREE_HYPO_MaxElementArea"
 msgstr "mesh_tree_hypo_area.png"
 
-#mesh_tree_hypo_area
+#mesh_tree_hypo_quadranglepreference
 msgid "ICON_SMESH_TREE_HYPO_QuadranglePreference"
 msgstr "mesh_tree_algo_quad.png"
 
+#mesh_tree_hypo_quadraticmesh
+msgid "ICON_SMESH_TREE_HYPO_QuadraticMesh"
+msgstr "mesh_tree_hypo_length.png"
+
 #mesh_tree_hypo_length
 msgid "ICON_SMESH_TREE_HYPO_LocalLength"
 msgstr "mesh_tree_hypo_length.png"
index cb445cb85b7b9b3d61444c1e18157fe5163ace35..0f5cbcd180c883227661cc2c6202de26bccf5c26 100644 (file)
@@ -52,7 +52,8 @@ EXPORT_HEADERS = \
        StdMeshers_MEFISTO_2D_i.hxx \
        StdMeshers_Hexa_3D_i.hxx \
        StdMeshers_AutomaticLength_i.hxx \
-       StdMeshers_QuadranglePreference_i.hxx
+       StdMeshers_QuadranglePreference_i.hxx \
+       StdMeshers_QuadraticMesh_i.hxx
 
 # Libraries targets
 
@@ -75,7 +76,8 @@ LIB_SRC = \
         StdMeshers_MEFISTO_2D_i.cxx \
        StdMeshers_Hexa_3D_i.cxx \
        StdMeshers_AutomaticLength_i.cxx \
-       StdMeshers_QuadranglePreference_i.cxx
+       StdMeshers_QuadranglePreference_i.cxx \
+       StdMeshers_QuadraticMesh_i.cxx
 
 LIB_SERVER_IDL = SMESH_BasicHypothesis.idl
 
diff --git a/src/StdMeshers_I/StdMeshers_QuadraticMesh_i.cxx b/src/StdMeshers_I/StdMeshers_QuadraticMesh_i.cxx
new file mode 100644 (file)
index 0000000..7f18187
--- /dev/null
@@ -0,0 +1,99 @@
+//  SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
+// 
+//  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. 
+// 
+//  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//
+//  File   : StdMeshers_QuadraticMesh_i.cxx
+//           Moved here from SMESH_LocalLength_i.cxx
+//  Author : Paul RASCLE, EDF
+//  Module : SMESH
+//  $Header$
+
+#include "StdMeshers_QuadraticMesh_i.hxx"
+#include "SMESH_Gen_i.hxx"
+#include "SMESH_Gen.hxx"
+
+#include "Utils_CorbaException.hxx"
+#include "utilities.h"
+
+//#include <TCollection_AsciiString.hxx>
+
+using namespace std;
+
+//=============================================================================
+/*!
+ *  StdMeshers_QuadraticMesh_i::StdMeshers_QuadraticMesh_i
+ *
+ *  Constructor
+ */
+//=============================================================================
+
+StdMeshers_QuadraticMesh_i::StdMeshers_QuadraticMesh_i
+( PortableServer::POA_ptr thePOA,
+  int                     theStudyId,
+  ::SMESH_Gen*            theGenImpl )
+  : SALOME::GenericObj_i( thePOA ),SMESH_Hypothesis_i( thePOA )
+{
+  myBaseImpl = new ::StdMeshers_QuadraticMesh( theGenImpl->GetANewId(),
+                                               theStudyId,
+                                               theGenImpl );
+}
+
+//=============================================================================
+/*!
+ *  StdMeshers_QuadraticMesh_i::~StdMeshers_QuadraticMesh_i
+ *
+ *  Destructor
+ */
+//=============================================================================
+
+StdMeshers_QuadraticMesh_i::~StdMeshers_QuadraticMesh_i()
+{
+}
+
+//=============================================================================
+/*!
+ *  StdMeshers_QuadraticMesh_i::GetImpl
+ *
+ *  Get implementation
+ */
+//=============================================================================
+
+::StdMeshers_QuadraticMesh* StdMeshers_QuadraticMesh_i::GetImpl()
+{
+  return ( ::StdMeshers_QuadraticMesh* )myBaseImpl;
+}
+
+//================================================================================
+/*!
+ * \brief Verify whether hypothesis supports given entity type 
+  * \param type - dimension (see SMESH::Dimension enumeration)
+  * \retval CORBA::Boolean - TRUE if dimension is supported, FALSE otherwise
+ * 
+ * Verify whether hypothesis supports given entity type (see SMESH::Dimension enumeration)
+ */
+//================================================================================  
+
+CORBA::Boolean StdMeshers_QuadraticMesh_i::IsDimSupported( SMESH::Dimension type )
+{
+  return type == SMESH::DIM_1D;
+}
+
diff --git a/src/StdMeshers_I/StdMeshers_QuadraticMesh_i.hxx b/src/StdMeshers_I/StdMeshers_QuadraticMesh_i.hxx
new file mode 100644 (file)
index 0000000..c2a3f3f
--- /dev/null
@@ -0,0 +1,64 @@
+//  SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
+// 
+//  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. 
+// 
+//  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//
+//  File   : StdMeshers_QuadraticMesh_i.hxx
+//           Moved here from SMESH_LocalLength_i.hxx
+//  Author : Paul RASCLE, EDF
+//  Module : SMESH
+//  $Header$
+
+#ifndef _SMESH_QuadraticMesh_I_HXX_
+#define _SMESH_QuadraticMesh_I_HXX_
+
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SMESH_BasicHypothesis)
+
+#include "SMESH_Hypothesis_i.hxx"
+#include "StdMeshers_QuadraticMesh.hxx"
+
+class SMESH_Gen;
+
+// ======================================================
+// Local Length hypothesis
+// ======================================================
+class StdMeshers_QuadraticMesh_i:
+  public virtual POA_StdMeshers::StdMeshers_QuadraticMesh,
+  public virtual SMESH_Hypothesis_i
+{
+public:
+  // Constructor
+  StdMeshers_QuadraticMesh_i( PortableServer::POA_ptr thePOA,
+                              int                     theStudyId,
+                              ::SMESH_Gen*            theGenImpl );
+  // Destructor
+  virtual ~StdMeshers_QuadraticMesh_i();
+
+  // Get implementation
+  ::StdMeshers_QuadraticMesh* GetImpl();
+  
+  // Verify whether hypothesis supports given entity type 
+  CORBA::Boolean IsDimSupported( SMESH::Dimension type );
+};
+
+#endif
+
index 768d2c4fb0ed174bf6ec2b7496f9cbfb2357788d..a379e81ac2fa141000679e89bda00f0552757c03 100644 (file)
@@ -39,6 +39,7 @@ using namespace std;
 #include "StdMeshers_Propagation_i.hxx"
 #include "StdMeshers_LengthFromEdges_i.hxx"
 #include "StdMeshers_QuadranglePreference_i.hxx"
+#include "StdMeshers_QuadraticMesh_i.hxx"
 #include "StdMeshers_MaxElementArea_i.hxx"
 #include "StdMeshers_MaxElementVolume_i.hxx"
 #include "StdMeshers_NotConformAllowed_i.hxx"
@@ -87,6 +88,8 @@ extern "C"
       aCreator = new HypothesisCreator_i<StdMeshers_AutomaticLength_i>;
     else if (strcmp(aHypName, "QuadranglePreference") == 0)
       aCreator = new HypothesisCreator_i<StdMeshers_QuadranglePreference_i>;
+    else if (strcmp(aHypName, "QuadraticMesh") == 0)
+      aCreator = new HypothesisCreator_i<StdMeshers_QuadraticMesh_i>;
 
     // Algorithms
     else if (strcmp(aHypName, "Regular_1D") == 0)