PAL10467. Add "Quadrangle Preference" hypothesis for "Quadrangle(Mapping)" algo

This commit is contained in:
eap 2005-12-23 10:00:03 +00:00
parent 7ba3124c8a
commit 236b583d31
15 changed files with 388 additions and 9 deletions

View File

@ -258,6 +258,18 @@ module StdMeshers
{
};
/*!
* StdMeshers_QuadranglePreference: interface of "QuadranglePreference" hypothesis.
* This hypothesis is used by StdMeshers_Quadrangle_2D algorithm.
* Presence of this hypothesis forces construction of quadrangles if the number
* of nodes on opposite edges is not the same in the case where the global number
* of nodes on edges is even
*/
interface StdMeshers_QuadranglePreference : SMESH::SMESH_Hypothesis
{
};
/*!
* StdMeshers_Regular_1D: interface of "Wire discretisation" algorithm
*/

View File

@ -52,6 +52,11 @@
icon-id="mesh_hypo_length.png"
dim="2"/>
<hypothesis type="QuadranglePreference"
label-id="Quadrangle Preference"
icon-id="mesh_algo_quad.png"
dim="2"/>
<hypothesis type="MaxElementArea"
label-id="Max. Element Area"
icon-id="mesh_hypo_area.png"

View File

@ -701,6 +701,11 @@ Handle(_pyHypothesis) _pyHypothesis::NewHypothesis( const Handle(_pyCommand)& th
algo->myDim = 2;
algo->myCreationMethod = "Quadrangle";
}
else if ( hypType == "QuadranglePreference" ) {
hyp->myDim = 2;
hyp->myCreationMethod = "QuadranglePreference";
hyp->myType = "MEFISTO_2D";
}
// 3D ----------
else if ( hypType == "NETGEN_3D") {
algo->myDim = 3;

View File

@ -27,6 +27,8 @@
*
* The only API method here is SMESH_2smeshpy::ConvertScript(), the rest ones are
* for internal usage
*
* See comments to _pyHypothesis class to know how to assure convertion of a new hypothesis
*/
class Resource_DataMapOfAsciiStringAsciiString;
@ -187,7 +189,20 @@ private:
};
/*!
* \brief Root class for smesh.Mesh_Algorithm
* \brief Root class for hypothesis
*
* HOWTO assure convertion of a new hypothesis
* In NewHypothesis():
* 1. add a case for the name of the new hypothesis and
* 2. initialize _pyHypothesis fields:
* . myDim - hypothesis dimention;
* . myType - type name of the algorithm creating the hypothesis;
* . myCreationMethod - method name of the algorithm creating the hypothesis;
* . append to myArgMethods interface methods setting param values in the
* order they are used when myCreationMethod is called. It is supposed that
* each interface method sets only one parameter, if it is not so, you are
* to derive a specific class from _pyHypothesis that would redefine Process(),
* see _pyComplexParamHypo for example
*/
class _pyHypothesis: public _pyObject
{

View File

@ -281,6 +281,15 @@ class Mesh_Quadrangle(Mesh_Algorithm):
"""
self.Create(mesh, geom, "Quadrangle_2D")
def QuadranglePreference(self):
"""
Define "QuadranglePreference" hypothesis, forcing construction
of quadrangles if the number of nodes on opposite edges is not the same
in the case where the global number of nodes on edges is even
"""
hyp = self.Hypothesis("QuadranglePreference")
return hyp
# Public class: Mesh_Tetrahedron
# ------------------------------

View File

@ -49,7 +49,8 @@ EXPORT_HEADERS = \
StdMeshers_Quadrangle_2D.hxx \
StdMeshers_MEFISTO_2D.hxx \
StdMeshers_Hexa_3D.hxx \
StdMeshers_AutomaticLength.hxx
StdMeshers_AutomaticLength.hxx \
StdMeshers_QuadranglePreference.hxx
EXPORT_PYSCRIPTS =
@ -73,7 +74,8 @@ LIB_SRC = \
StdMeshers_MEFISTO_2D.cxx \
StdMeshers_Penta_3D.cxx \
StdMeshers_Hexa_3D.cxx \
StdMeshers_AutomaticLength.cxx
StdMeshers_AutomaticLength.cxx \
StdMeshers_QuadranglePreference.cxx
LIB_SERVER_IDL =

View File

@ -0,0 +1,100 @@
// SMESH StdMeshers_QuadranglePreference : 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_QuadranglePreference.cxx
// Module : SMESH
// $Header$
#include "StdMeshers_QuadranglePreference.hxx"
#include "utilities.h"
using namespace std;
//=============================================================================
/*!
*
*/
//=============================================================================
StdMeshers_QuadranglePreference::StdMeshers_QuadranglePreference(int hypId,
int studyId,
SMESH_Gen * gen)
:SMESH_Hypothesis(hypId, studyId, gen)
{
_name = "QuadranglePreference";
_param_algo_dim = 2; // is used by StdMeshers_Quadrangle_2D
}
//=============================================================================
/*!
*
*/
//=============================================================================
StdMeshers_QuadranglePreference::~StdMeshers_QuadranglePreference()
{
}
//=============================================================================
/*!
*
*/
//=============================================================================
ostream & StdMeshers_QuadranglePreference::SaveTo(ostream & save)
{
return save;
}
//=============================================================================
/*!
*
*/
//=============================================================================
istream & StdMeshers_QuadranglePreference::LoadFrom(istream & load)
{
return load;
}
//=============================================================================
/*!
*
*/
//=============================================================================
ostream & operator <<(ostream & save, StdMeshers_QuadranglePreference & hyp)
{
return hyp.SaveTo( save );
}
//=============================================================================
/*!
*
*/
//=============================================================================
istream & operator >>(istream & load, StdMeshers_QuadranglePreference & hyp)
{
return hyp.LoadFrom( load );
}

View File

@ -0,0 +1,52 @@
// 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_QuadranglePreference.hxx
// Module : SMESH
// $Header$
#ifndef _StdMeshers_QuadranglePreference_HXX_
#define _StdMeshers_QuadranglePreference_HXX_
#include "SMESH_Hypothesis.hxx"
#include "Utils_SALOME_Exception.hxx"
/*!
* \brief Hypothesis for StdMeshers_Quadrangle_2D, forcing construction
* of quadrangles if the number of nodes on opposite edges is not the same.
* GIBI can do it if the global number of nodes is even (DALL operator).
* See PAL10467
*/
class StdMeshers_QuadranglePreference:public SMESH_Hypothesis
{
public:
StdMeshers_QuadranglePreference(int hypId, int studyId, SMESH_Gen * gen);
virtual ~ StdMeshers_QuadranglePreference();
virtual std::ostream & SaveTo(std::ostream & save);
virtual std::istream & LoadFrom(std::istream & load);
friend std::ostream & operator <<(std::ostream & save, StdMeshers_QuadranglePreference & hyp);
friend std::istream & operator >>(std::istream & load, StdMeshers_QuadranglePreference & hyp);
};
#endif

View File

@ -68,6 +68,7 @@ StdMeshers_Quadrangle_2D::StdMeshers_Quadrangle_2D (int hypId, int studyId, SMES
MESSAGE("StdMeshers_Quadrangle_2D::StdMeshers_Quadrangle_2D");
_name = "Quadrangle_2D";
_shapeType = (1 << TopAbs_FACE);
_compatibleHypothesis.push_back("QuadranglePreference");
}
//=============================================================================
@ -88,14 +89,16 @@ StdMeshers_Quadrangle_2D::~StdMeshers_Quadrangle_2D()
//=============================================================================
bool StdMeshers_Quadrangle_2D::CheckHypothesis
(SMESH_Mesh& aMesh,
const TopoDS_Shape& aShape,
(SMESH_Mesh& aMesh,
const TopoDS_Shape& aShape,
SMESH_Hypothesis::Hypothesis_Status& aStatus)
{
bool isOk = true;
aStatus = SMESH_Hypothesis::HYP_OK;
// nothing to check
// there is only one compatible Hypothesis so far
const list <const SMESHDS_Hypothesis * >&hyps = GetUsedHypothesis(aMesh, aShape);
myQuadranglePreference = hyps.size() > 0;
return isOk;
}

View File

@ -99,6 +99,11 @@ protected:
UVPtStruct* MakeEdgePoints(SMESH_Mesh& aMesh,
const TopoDS_Face& F, const TopoDS_Edge& E,
double first, double last, int nb_segm);
// true if QuadranglePreference hypothesis is assigned that forces
// construction of quadrangles if the number of nodes on opposite edges
// is not the same in the case where the global number of nodes on edges is even
bool myQuadranglePreference;
};
#endif

View File

@ -5,7 +5,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"POT-Creation-Date: 2002-05-28 10:57:43 AM CEST\n"
"PO-Revision-Date: 2005-11-01 12:58+0300\n"
"PO-Revision-Date: 2005-12-23 11:15+0300\n"
"Last-Translator: FULLNAME <EMAIL@ADDRESS>\n"
"Content-Type: text/plain; charset=iso-8859-1\n"
@ -80,6 +80,10 @@ msgstr "mesh_tree_algo_quad.png"
msgid "ICON_SMESH_TREE_HYPO_MaxElementArea"
msgstr "mesh_tree_hypo_area.png"
#mesh_tree_hypo_area
msgid "ICON_SMESH_TREE_HYPO_QuadranglePreference"
msgstr "mesh_tree_algo_quad.png"
#mesh_tree_hypo_length
msgid "ICON_SMESH_TREE_HYPO_LocalLength"
msgstr "mesh_tree_hypo_length.png"

View File

@ -51,7 +51,8 @@ EXPORT_HEADERS = \
StdMeshers_Quadrangle_2D_i.hxx \
StdMeshers_MEFISTO_2D_i.hxx \
StdMeshers_Hexa_3D_i.hxx \
StdMeshers_AutomaticLength_i.hxx
StdMeshers_AutomaticLength_i.hxx \
StdMeshers_QuadranglePreference_i.hxx
# Libraries targets
@ -73,7 +74,8 @@ LIB_SRC = \
StdMeshers_Quadrangle_2D_i.cxx \
StdMeshers_MEFISTO_2D_i.cxx \
StdMeshers_Hexa_3D_i.cxx \
StdMeshers_AutomaticLength_i.cxx
StdMeshers_AutomaticLength_i.cxx \
StdMeshers_QuadranglePreference_i.cxx
LIB_SERVER_IDL = SMESH_BasicHypothesis.idl

View File

@ -0,0 +1,98 @@
// 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_QuadranglePreference_i.cxx
// Moved here from SMESH_LocalLength_i.cxx
// Author : Paul RASCLE, EDF
// Module : SMESH
// $Header$
using namespace std;
#include "StdMeshers_QuadranglePreference_i.hxx"
#include "SMESH_Gen_i.hxx"
#include "SMESH_Gen.hxx"
#include "Utils_CorbaException.hxx"
#include "utilities.h"
#include <TCollection_AsciiString.hxx>
//=============================================================================
/*!
* StdMeshers_QuadranglePreference_i::StdMeshers_QuadranglePreference_i
*
* Constructor
*/
//=============================================================================
StdMeshers_QuadranglePreference_i::StdMeshers_QuadranglePreference_i
( PortableServer::POA_ptr thePOA,
int theStudyId,
::SMESH_Gen* theGenImpl ): SALOME::GenericObj_i( thePOA ),
SMESH_Hypothesis_i( thePOA )
{
myBaseImpl = new ::StdMeshers_QuadranglePreference( theGenImpl->GetANewId(),
theStudyId,
theGenImpl );
}
//=============================================================================
/*!
* StdMeshers_QuadranglePreference_i::~StdMeshers_QuadranglePreference_i
*
* Destructor
*/
//=============================================================================
StdMeshers_QuadranglePreference_i::~StdMeshers_QuadranglePreference_i()
{
}
//=============================================================================
/*!
* StdMeshers_QuadranglePreference_i::GetImpl
*
* Get implementation
*/
//=============================================================================
::StdMeshers_QuadranglePreference* StdMeshers_QuadranglePreference_i::GetImpl()
{
return ( ::StdMeshers_QuadranglePreference* )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_QuadranglePreference_i::IsDimSupported( SMESH::Dimension type )
{
return type == SMESH::DIM_2D;
}

View File

@ -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_QuadranglePreference_i.hxx
// Moved here from SMESH_LocalLength_i.hxx
// Author : Paul RASCLE, EDF
// Module : SMESH
// $Header$
#ifndef _SMESH_QuadranglePreference_I_HXX_
#define _SMESH_QuadranglePreference_I_HXX_
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SMESH_BasicHypothesis)
#include "SMESH_Hypothesis_i.hxx"
#include "StdMeshers_QuadranglePreference.hxx"
class SMESH_Gen;
// ======================================================
// Local Length hypothesis
// ======================================================
class StdMeshers_QuadranglePreference_i:
public virtual POA_StdMeshers::StdMeshers_QuadranglePreference,
public virtual SMESH_Hypothesis_i
{
public:
// Constructor
StdMeshers_QuadranglePreference_i( PortableServer::POA_ptr thePOA,
int theStudyId,
::SMESH_Gen* theGenImpl );
// Destructor
virtual ~StdMeshers_QuadranglePreference_i();
// Get implementation
::StdMeshers_QuadranglePreference* GetImpl();
// Verify whether hypothesis supports given entity type
CORBA::Boolean IsDimSupported( SMESH::Dimension type );
};
#endif

View File

@ -38,6 +38,7 @@ using namespace std;
#include "StdMeshers_Deflection1D_i.hxx"
#include "StdMeshers_Propagation_i.hxx"
#include "StdMeshers_LengthFromEdges_i.hxx"
#include "StdMeshers_QuadranglePreference_i.hxx"
#include "StdMeshers_MaxElementArea_i.hxx"
#include "StdMeshers_MaxElementVolume_i.hxx"
#include "StdMeshers_NotConformAllowed_i.hxx"
@ -84,6 +85,8 @@ extern "C"
aCreator = new HypothesisCreator_i<StdMeshers_Arithmetic1D_i>;
else if (strcmp(aHypName, "AutomaticLength") == 0)
aCreator = new HypothesisCreator_i<StdMeshers_AutomaticLength_i>;
else if (strcmp(aHypName, "QuadranglePreference") == 0)
aCreator = new HypothesisCreator_i<StdMeshers_QuadranglePreference_i>;
// Algorithms
else if (strcmp(aHypName, "Regular_1D") == 0)