From da425c6a4aa2f29deb92e1ebbebbd0855f373b16 Mon Sep 17 00:00:00 2001 From: eap Date: Fri, 17 Feb 2006 14:15:27 +0000 Subject: [PATCH] add QuadraticMesh hypothesis --- idl/SMESH_BasicHypothesis.idl | 14 +++ resources/StdMeshers.xml | 6 ++ src/SMESH_I/SMESH_2smeshpy.cxx | 5 + src/SMESH_SWIG/smesh.py | 12 +++ src/StdMeshers/Makefile.in | 6 +- src/StdMeshers/StdMeshers_QuadraticMesh.cxx | 100 ++++++++++++++++++ src/StdMeshers/StdMeshers_QuadraticMesh.hxx | 54 ++++++++++ src/StdMeshers/StdMeshers_Regular_1D.cxx | 9 +- src/StdMeshersGUI/StdMeshers_images.po | 6 +- src/StdMeshers_I/Makefile.in | 6 +- .../StdMeshers_QuadraticMesh_i.cxx | 99 +++++++++++++++++ .../StdMeshers_QuadraticMesh_i.hxx | 64 +++++++++++ src/StdMeshers_I/StdMeshers_i.cxx | 3 + 13 files changed, 377 insertions(+), 7 deletions(-) create mode 100644 src/StdMeshers/StdMeshers_QuadraticMesh.cxx create mode 100644 src/StdMeshers/StdMeshers_QuadraticMesh.hxx create mode 100644 src/StdMeshers_I/StdMeshers_QuadraticMesh_i.cxx create mode 100644 src/StdMeshers_I/StdMeshers_QuadraticMesh_i.hxx diff --git a/idl/SMESH_BasicHypothesis.idl b/idl/SMESH_BasicHypothesis.idl index b6367b75d..7880020e7 100644 --- a/idl/SMESH_BasicHypothesis.idl +++ b/idl/SMESH_BasicHypothesis.idl @@ -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 diff --git a/resources/StdMeshers.xml b/resources/StdMeshers.xml index 2c1cd12cc..6daf06253 100644 --- a/resources/StdMeshers.xml +++ b/resources/StdMeshers.xml @@ -57,6 +57,12 @@ icon-id="mesh_algo_quad.png" dim="2"/> + + 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"; diff --git a/src/SMESH_SWIG/smesh.py b/src/SMESH_SWIG/smesh.py index fe237e511..71051056f 100644 --- a/src/SMESH_SWIG/smesh.py +++ b/src/SMESH_SWIG/smesh.py @@ -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 # --------------------------------- diff --git a/src/StdMeshers/Makefile.in b/src/StdMeshers/Makefile.in index 592ff2b2b..e0d879a73 100644 --- a/src/StdMeshers/Makefile.in +++ b/src/StdMeshers/Makefile.in @@ -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 index 000000000..86b4379c3 --- /dev/null +++ b/src/StdMeshers/StdMeshers_QuadraticMesh.cxx @@ -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 index 000000000..6f2cc7e83 --- /dev/null +++ b/src/StdMeshers/StdMeshers_QuadraticMesh.hxx @@ -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 diff --git a/src/StdMeshers/StdMeshers_Regular_1D.cxx b/src/StdMeshers/StdMeshers_Regular_1D.cxx index 6bc2ca700..d3d92f9ea 100644 --- a/src/StdMeshers/StdMeshers_Regular_1D.cxx +++ b/src/StdMeshers/StdMeshers_Regular_1D.cxx @@ -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 @@ -41,12 +43,11 @@ using namespace std; #include "StdMeshers_Arithmetic1D.hxx" #include "StdMeshers_StartEndLength.hxx" #include "StdMeshers_Deflection1D.hxx" -#include +#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 ); diff --git a/src/StdMeshersGUI/StdMeshers_images.po b/src/StdMeshersGUI/StdMeshers_images.po index c5978633b..64828da63 100644 --- a/src/StdMeshersGUI/StdMeshers_images.po +++ b/src/StdMeshersGUI/StdMeshers_images.po @@ -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" diff --git a/src/StdMeshers_I/Makefile.in b/src/StdMeshers_I/Makefile.in index cb445cb85..0f5cbcd18 100644 --- a/src/StdMeshers_I/Makefile.in +++ b/src/StdMeshers_I/Makefile.in @@ -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 index 000000000..7f1818771 --- /dev/null +++ b/src/StdMeshers_I/StdMeshers_QuadraticMesh_i.cxx @@ -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 + +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 index 000000000..c2a3f3f3d --- /dev/null +++ b/src/StdMeshers_I/StdMeshers_QuadraticMesh_i.hxx @@ -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 +#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 + diff --git a/src/StdMeshers_I/StdMeshers_i.cxx b/src/StdMeshers_I/StdMeshers_i.cxx index 768d2c4fb..a379e81ac 100644 --- a/src/StdMeshers_I/StdMeshers_i.cxx +++ b/src/StdMeshers_I/StdMeshers_i.cxx @@ -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; else if (strcmp(aHypName, "QuadranglePreference") == 0) aCreator = new HypothesisCreator_i; + else if (strcmp(aHypName, "QuadraticMesh") == 0) + aCreator = new HypothesisCreator_i; // Algorithms else if (strcmp(aHypName, "Regular_1D") == 0) -- 2.39.2