| 1 |
// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE |
| 2 |
// |
| 3 |
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, |
| 4 |
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS |
| 5 |
// |
| 6 |
// This library is free software; you can redistribute it and/or |
| 7 |
// modify it under the terms of the GNU Lesser General Public |
| 8 |
// License as published by the Free Software Foundation; either |
| 9 |
// version 2.1 of the License, or (at your option) any later version. |
| 10 |
// |
| 11 |
// This library is distributed in the hope that it will be useful, |
| 12 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 |
// Lesser General Public License for more details. |
| 15 |
// |
| 16 |
// You should have received a copy of the GNU Lesser General Public |
| 17 |
// License along with this library; if not, write to the Free Software |
| 18 |
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 19 |
// |
| 20 |
// See http://www.salome-platform.org/ or email : [email protected] |
| 21 |
// |
| 22 |
|
| 23 |
// NETGENPlugin : C++ implementation |
| 24 |
// File : NETGENPlugin_Hypothesis_i.hxx |
| 25 |
// Author : Michael Sazonov (OCN) |
| 26 |
// Date : 03/04/2006 |
| 27 |
// Project : SALOME |
| 28 |
//============================================================================= |
| 29 |
// |
| 30 |
#ifndef _NETGENPlugin_Hypothesis_i_HXX_ |
| 31 |
#define _NETGENPlugin_Hypothesis_i_HXX_ |
| 32 |
|
| 33 |
#include "NETGENPlugin_Defs.hxx" |
| 34 |
|
| 35 |
//#include <SALOMEconfig.h> |
| 36 |
//#include CORBA_SERVER_HEADER(NETGENPlugin_Algorithm) |
| 37 |
|
| 38 |
// #include "SMESH_Hypothesis_i.hxx" |
| 39 |
#include "NETGENPlugin_Hypothesis.hxx" |
| 40 |
|
| 41 |
class SMESH_Gen; |
| 42 |
//class GEOM_Object; |
| 43 |
|
| 44 |
// NETGENPlugin parameters hypothesis |
| 45 |
|
| 46 |
class NETGENPLUGIN_EXPORT NETGENPlugin_Hypothesis_i: |
| 47 |
public virtual POA_NETGENPlugin::NETGENPlugin_Hypothesis, |
| 48 |
public virtual SMESH_Hypothesis_i |
| 49 |
{ |
| 50 |
public: |
| 51 |
// Constructor |
| 52 |
NETGENPlugin_Hypothesis_i (PortableServer::POA_ptr thePOA, |
| 53 |
int theStudyId, |
| 54 |
::SMESH_Gen* theGenImpl); |
| 55 |
// Destructor |
| 56 |
virtual ~NETGENPlugin_Hypothesis_i(); |
| 57 |
|
| 58 |
void SetMaxSize(CORBA::Double theSize); |
| 59 |
CORBA::Double GetMaxSize(); |
| 60 |
|
| 61 |
void SetMinSize(CORBA::Double theSize); |
| 62 |
CORBA::Double GetMinSize(); |
| 63 |
|
| 64 |
void SetSecondOrder(CORBA::Boolean theVal); |
| 65 |
CORBA::Boolean GetSecondOrder(); |
| 66 |
|
| 67 |
void SetOptimize(CORBA::Boolean theVal); |
| 68 |
CORBA::Boolean GetOptimize(); |
| 69 |
|
| 70 |
void SetFineness(CORBA::Long theFineness); |
| 71 |
CORBA::Long GetFineness(); |
| 72 |
|
| 73 |
void SetGrowthRate(CORBA::Double theRate); |
| 74 |
CORBA::Double GetGrowthRate(); |
| 75 |
|
| 76 |
void SetNbSegPerEdge(CORBA::Double theVal); |
| 77 |
CORBA::Double GetNbSegPerEdge(); |
| 78 |
|
| 79 |
void SetNbSegPerRadius(CORBA::Double theVal); |
| 80 |
CORBA::Double GetNbSegPerRadius(); |
| 81 |
|
| 82 |
void SetLocalSizeOnShape(GEOM::GEOM_Object_ptr GeomObj, CORBA::Double localSize) |
| 83 |
throw (SALOME::SALOME_Exception); |
| 84 |
void SetLocalSizeOnEntry(const char* entry, CORBA::Double localSize); |
| 85 |
CORBA::Double GetLocalSizeOnEntry(const char* entry); |
| 86 |
NETGENPlugin::string_array* GetLocalSizeEntries(); |
| 87 |
void UnsetLocalSizeOnEntry(const char* entry); |
| 88 |
|
| 89 |
void SetQuadAllowed(CORBA::Boolean theVal); |
| 90 |
CORBA::Boolean GetQuadAllowed(); |
| 91 |
|
| 92 |
void SetUseSurfaceCurvature(CORBA::Boolean theVal); |
| 93 |
CORBA::Boolean GetUseSurfaceCurvature(); |
| 94 |
|
| 95 |
void SetFuseEdges(CORBA::Boolean theVal); |
| 96 |
CORBA::Boolean GetFuseEdges(); |
| 97 |
|
| 98 |
// Get implementation |
| 99 |
::NETGENPlugin_Hypothesis* GetImpl(); |
| 100 |
|
| 101 |
// Verify whether hypothesis supports given entity type |
| 102 |
CORBA::Boolean IsDimSupported( SMESH::Dimension type ); |
| 103 |
|
| 104 |
protected: |
| 105 |
|
| 106 |
// to remember whether a parameter is already set (issue 0021364) |
| 107 |
enum SettingMethod |
| 108 |
{ |
| 109 |
METH_SetMaxSize = 1, |
| 110 |
METH_SetMinSize = 2, |
| 111 |
METH_SetSecondOrder = 4, |
| 112 |
METH_SetOptimize = 8, |
| 113 |
METH_SetFineness = 16, |
| 114 |
METH_SetGrowthRate = 32, |
| 115 |
METH_SetNbSegPerEdge = 64, |
| 116 |
METH_SetNbSegPerRadius = 128, |
| 117 |
METH_SetLocalSizeOnEntry = 256, |
| 118 |
METH_SetQuadAllowed = METH_SetLocalSizeOnEntry * 2, |
| 119 |
METH_SetSurfaceCurvature = METH_SetQuadAllowed * 2, |
| 120 |
METH_SetFuseEdges = METH_SetSurfaceCurvature * 2, |
| 121 |
METH_LAST = METH_SetFuseEdges |
| 122 |
}; |
| 123 |
int mySetMethodFlags; |
| 124 |
|
| 125 |
// Return true if a parameter is not yet set, else return true if a parameter changes. |
| 126 |
// PythonDumping depends on the result of this function. |
| 127 |
// Checking only change of a parameter is not enough because then the default values are |
| 128 |
// not dumped and if the defaults will change then the behaviour of scripts |
| 129 |
// created without dump of the default parameters will also change what is not good. |
| 130 |
template<typename T> |
| 131 |
bool isToSetParameter(T curValue, T newValue, /*SettingMethod*/int meth) |
| 132 |
{ |
| 133 |
if ( mySetMethodFlags & meth ) // already set, check if a value is changing |
| 134 |
return ( curValue != newValue ); |
| 135 |
else |
| 136 |
return ( mySetMethodFlags |= meth ); // == return true |
| 137 |
} |
| 138 |
|
| 139 |
public: |
| 140 |
// method intended to remove explicit treatment of Netgen hypotheses from |
| 141 |
// SMESH_NoteBook to assure backward compatibility after implemeneting |
| 142 |
// issue 0021308: Remove hard-coded dependency of the external mesh plugins |
| 143 |
virtual int getParamIndex(const TCollection_AsciiString& method, int nbVars) const; |
| 144 |
|
| 145 |
// method used to convert variable parameters stored in an old study |
| 146 |
// into myMethod2VarParams. It should return a method name for an index of |
| 147 |
// variable parameters. Index is countered from zero |
| 148 |
virtual std::string getMethodOfParameter(const int paramIndex, int nbVars) const; |
| 149 |
}; |
| 150 |
|
| 151 |
#endif |