Salome HOME
edd0049d830b5a91361bb2ed65241ab531bd419e
[plugins/hexablockplugin.git] / src / HEXABLOCKPlugin / HEXABLOCKPlugin_Hypothesis_i.cxx
1 // Copyright (C) 2009-2014  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 // File      : HEXABLOCKPlugin_Hypothesis_i.cxx
21 // Created   : Wed Apr  2 13:53:01 2008
22 // Author    : Lioka RAZAFINDRAZAKA (CEA)
23 //
24 #include <SMESH_Gen.hxx>
25 #include <SMESH_PythonDump.hxx>
26 #include <SMESH_Mesh_i.hxx>
27
28 // #include "HEXABLOCK.hxx"
29 #include "HEXABLOCKPlugin_Hypothesis_i.hxx"
30 // #include "HexDocument_impl.hxx"    // Perime
31 #include "HexDocument.hxx"
32
33 #include <Utils_CorbaException.hxx>
34 #include <utilities.h>
35
36 #ifdef _DEBUG_
37 static int MYDEBUG = HEXA_NS::on_debug ();
38 #else
39 static int MYDEBUG = 0;
40 #endif
41
42 //=======================================================================
43 //function : HEXABLOCKPlugin_Hypothesis_i
44 //=======================================================================
45
46 HEXABLOCKPlugin_Hypothesis_i::HEXABLOCKPlugin_Hypothesis_i (PortableServer::POA_ptr thePOA,
47                                   int             theStudyId,
48                                   ::SMESH_Gen*    theGenImpl)
49   : SALOME::GenericObj_i( thePOA ), 
50     SMESH_Hypothesis_i( thePOA )
51 {
52   if(MYDEBUG) MESSAGE( "HEXABLOCKPlugin_Hypothesis_i::HEXABLOCKPlugin_Hypothesis_i" );
53   myBaseImpl = new ::HEXABLOCKPlugin_Hypothesis (theGenImpl->GetANewId(),
54                                               theStudyId,
55                                               theGenImpl);
56   _poa = PortableServer::POA::_duplicate(thePOA);
57 }
58
59 //=======================================================================
60 //function : ~HEXABLOCKPlugin_Hypothesis_i
61 //=======================================================================
62
63 HEXABLOCKPlugin_Hypothesis_i::~HEXABLOCKPlugin_Hypothesis_i()
64 {
65   if(MYDEBUG) MESSAGE( "HEXABLOCKPlugin_Hypothesis_i::~HEXABLOCKPlugin_Hypothesis_i" );
66 }
67
68 //=============================================================================
69 /*!
70  *  Get implementation
71  */
72 //=============================================================================
73
74 ::HEXABLOCKPlugin_Hypothesis* HEXABLOCKPlugin_Hypothesis_i::GetImpl()
75 {
76   return (::HEXABLOCKPlugin_Hypothesis*)myBaseImpl;
77 }
78
79 //================================================================================
80 /*!
81  * \brief Verify whether hypothesis supports given entity type 
82  */
83 //================================================================================  
84
85 CORBA::Boolean HEXABLOCKPlugin_Hypothesis_i::IsDimSupported( SMESH::Dimension type )
86 {
87   return type == SMESH::DIM_3D;
88 }
89
90 //================================================================================
91 /*!
92  * Define the document to be meshed, mandatory
93  */
94 //================================================================================
95 // ================================================================= GetDocument
96 char* HEXABLOCKPlugin_Hypothesis_i::GetDocument ()
97 {
98   ASSERT (myBaseImpl);
99   cpchar xml = this->GetImpl()->GetXmlFlow ();
100   return CORBA::string_dup (xml);
101 }
102
103 // ================================================================= SetDocument
104 void HEXABLOCKPlugin_Hypothesis_i::SetDocument (const char* name)
105 {
106     ASSERT (myBaseImpl);
107     // this->GetImpl()->SetXmlFlow (xml);
108     this->GetImpl()->SetDocument (name);
109 }
110
111 //================================================================================
112 /*!
113  * To define the hight dimension to generated: 3 = hexas, 2 = quads, 1 = segments, 0 = nodes
114  */
115 //================================================================================
116
117 CORBA::Long HEXABLOCKPlugin_Hypothesis_i::GetDimension() {
118   ASSERT(myBaseImpl);
119   return this->GetImpl()->GetDimension();
120 }
121
122 void HEXABLOCKPlugin_Hypothesis_i::SetDimension(CORBA::Long dim) {
123   ASSERT(myBaseImpl);
124   this->GetImpl()->SetDimension(dim);
125 }