2 // class : Au nom de la loi
4 // Copyright (C) 2009-2012 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 "HexXmlWriter.hxx"
32 const char* getName () { return law_name.c_str() ; }
33 int getNodes () { return nbr_nodes ; }
34 double getCoefficient () { return law_coefficient ; }
35 KindLaw getKind () { return law_type ; }
37 int setNodes (int nbre);
38 int setCoefficient (double coeff);
39 void setKind (KindLaw type) { law_type = type ; }
40 void setKind (cpchar type);
41 int setName (cpchar nom);
43 Law (cpchar name, int nbnodes);
45 void saveXml (XmlWriter* xml);
49 static int last_law_id;
53 double law_coefficient;
56 // ================================================== setNodes
57 inline int Law::setNodes (int nbre)
62 // ================================================== setCoefficient
63 inline int Law::setCoefficient (double coeff)
65 law_coefficient = coeff;
68 // ================================================== setName
69 inline int Law::setName (cpchar name)
74 // ================================================== saveXml
75 inline void Law::saveXml (XmlWriter* xml)
77 cpchar kind_law [] = { "Uniform", "Arithmetic", "Geometric" };
79 xml->openMark ("Law");
80 xml->addAttribute ("id", getName ());
81 xml->addAttribute ("kind", kind_law [law_type]);
82 xml->addAttribute ("nodes", nbr_nodes);
83 xml->addAttribute ("coeff", law_coefficient);
86 // ================================================== setKind
87 inline void Law::setKind (cpchar type)
89 #define VerifKind(t,k) if (strcmp(t,#k)==0) law_type = k
90 VerifKind (type, Uniform);
91 VerifKind (type, Arithmetic);
92 VerifKind (type, Geometric);