2 // class : Au nom de la loi
4 // Copyright (C) 2009-2013 CEA/DEN, EDF R&D
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.
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.
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
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
25 #include "Hex_defines.hxx"
26 #include "HexEltBase.hxx"
27 #include "HexXmlWriter.hxx"
31 class HEXABLOCKENGINE_EXPORT Law : public EltBase
34 const char* getName () { return law_name.c_str() ; }
35 char* getNextName (pchar buffer);
36 int getNodes () { return nbr_nodes ; }
37 double getCoefficient () { return law_coefficient ; }
38 KindLaw getKind () { return law_type ; }
40 int setNodes (int nbre);
41 int setCoefficient (double coeff);
42 void setKind (KindLaw type) { law_type = type ; }
43 void setKind (cpchar type);
44 int setName (cpchar nom);
46 Law (Document* dad, cpchar name, int nbnodes);
48 void saveXml (XmlWriter* xml);
52 static int last_law_id;
56 double law_coefficient;
59 // ================================================== setNodes
60 inline int Law::setNodes (int nbre)
65 // ================================================== setCoefficient
66 inline int Law::setCoefficient (double coeff)
68 law_coefficient = coeff;
71 // ================================================== setName
72 inline int Law::setName (cpchar name)
77 // ================================================== saveXml
78 inline void Law::saveXml (XmlWriter* xml)
80 cpchar kind_law [] = { "Uniform", "Arithmetic", "Geometric" };
82 xml->openMark ("Law");
83 xml->addAttribute ("id", getName ());
84 xml->addAttribute ("kind", kind_law [law_type]);
85 xml->addAttribute ("nodes", nbr_nodes);
86 xml->addAttribute ("coeff", law_coefficient);
89 // ================================================== setKind
90 inline void Law::setKind (cpchar type)
92 #define VerifKind(t,k) if (strcmp(t,#k)==0) law_type = k
93 VerifKind (type, Uniform);
94 VerifKind (type, Arithmetic);
95 VerifKind (type, Geometric);