]> SALOME platform Git repositories - modules/hexablock.git/blob - src/HEXABLOCK_I/HexLaw_impl.cxx
Salome HOME
Merge from V6_main 01/04/2013
[modules/hexablock.git] / src / HEXABLOCK_I / HexLaw_impl.cxx
1 // Copyright (C) 2009-2013  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.
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 using namespace std;
20 #include "HEXABLOCK.hxx"
21 #include "utilities.h"
22
23 #include <string>
24
25 #include "hexa_base.hxx"
26 #include "HexLaw_impl.hxx"
27
28 Law_impl::Law_impl( HEXA_NS::Law *ptrCpp ):_law_cpp(ptrCpp)
29 {
30 }
31
32 HEXA_NS::Law* Law_impl::GetImpl()
33 throw (SALOME::SALOME_Exception)
34 {
35   return _law_cpp;
36 }
37
38 // HEXA_NS::Vertex* v = _hexa_cpp->getVertex(n);
39 //   Vertex_impl* servantCorba = new Vertex_impl(v);
40 //   return servantCorba->_this();
41
42
43 void Law_impl::setName(const char* name)
44 throw (SALOME::SALOME_Exception)
45 {
46   _law_cpp->setName(name);
47 }
48
49 char* Law_impl::getName()
50 throw (SALOME::SALOME_Exception)
51 {
52   return CORBA::string_dup( _law_cpp->getName() );
53 }
54
55 void Law_impl::setNodes(::CORBA::Long n)
56 throw (SALOME::SALOME_Exception)
57 {
58   _law_cpp->setNodes(n);
59 }
60
61 ::CORBA::Long Law_impl::getNodes()
62 throw (SALOME::SALOME_Exception)
63 {
64   return _law_cpp->getNodes();
65 }
66
67 void Law_impl::setKind( HEXABLOCK_ORB::KindLaw kIn )
68 throw (SALOME::SALOME_Exception)
69 {
70   HEXA_NS::KindLaw k_impl;
71   switch (kIn) {
72     case HEXABLOCK_ORB::UNIFORM    : k_impl = HEXA_NS::Uniform; break;
73     case HEXABLOCK_ORB::ARITHMETIC : k_impl = HEXA_NS::Arithmetic;  break;
74     case HEXABLOCK_ORB::GEOMETRIC  : k_impl = HEXA_NS::Geometric;   break;
75   }
76   _law_cpp->setKind(k_impl);
77 }
78
79 HEXABLOCK_ORB::KindLaw Law_impl::getKind()
80 throw (SALOME::SALOME_Exception)
81 {
82   HEXABLOCK_ORB::KindLaw k;
83   HEXA_NS::KindLaw k_cpp = _law_cpp->getKind();
84   switch (k_cpp) {
85     case HEXA_NS::Uniform :    k = HEXABLOCK_ORB::UNIFORM; break;
86     case HEXA_NS::Arithmetic : k = HEXABLOCK_ORB::ARITHMETIC; break;
87     case HEXA_NS::Geometric :  k = HEXABLOCK_ORB::GEOMETRIC; break;
88     default :                  ASSERT( false ); break;
89   }
90   return k;
91 }
92
93
94 void Law_impl::setCoefficient(::CORBA::Double c)
95 throw (SALOME::SALOME_Exception)
96 {
97   _law_cpp->setCoefficient(c);
98 }
99
100 ::CORBA::Double Law_impl::getCoefficient()
101 throw (SALOME::SALOME_Exception)
102 {
103   return _law_cpp->getCoefficient();
104 }