2 // class : Au nom de la loi
4 // Copyright (C) 2009-2019 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, or (at your option) any later version.
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 "HexEltBase.hxx"
26 #include "HexXmlWriter.hxx"
30 class HexaExport Law : public EltBase
33 const char* getName () { return law_name.c_str() ; }
34 char* getNextName (pchar buffer);
35 int getNodes () { return nbr_nodes ; }
36 double getCoefficient () { return law_coefficient ; }
37 KindLaw getKind () { return law_type ; }
39 int setNodes (int nbre);
40 int setCoefficient (double coeff);
41 void setKind (KindLaw type) { law_type = type ; }
42 void setKind (cpchar type);
43 int setName (cpchar nom);
45 Law (Document* dad, cpchar name, int nbnodes);
47 void saveXml (XmlWriter* xml);
51 static int last_law_id;
55 double law_coefficient;
58 // ================================================== setNodes
59 inline int Law::setNodes (int nbre)
64 // ================================================== setCoefficient
65 inline int Law::setCoefficient (double coeff)
67 law_coefficient = coeff;
70 // ================================================== setName
71 inline int Law::setName (cpchar name)
76 // ================================================== saveXml
77 inline void Law::saveXml (XmlWriter* xml)
79 cpchar kind_law [] = { "Uniform", "Arithmetic", "Geometric" };
81 xml->openMark ("Law");
82 xml->addAttribute ("id", getName ());
83 xml->addAttribute ("kind", kind_law [law_type]);
84 xml->addAttribute ("nodes", nbr_nodes);
85 xml->addAttribute ("coeff", law_coefficient);
88 // ================================================== setKind
89 inline void Law::setKind (cpchar type)
91 #define VerifKind(t,k) if (strcmp(t,#k)==0) law_type = k
92 VerifKind (type, Uniform);
93 VerifKind (type, Arithmetic);
94 VerifKind (type, Geometric);