1 // Created by: CKY / Contract Toubro-Larsen
2 // Copyright (c) 1993-1999 Matra Datavision
3 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 //--------------------------------------------------------------------
17 //--------------------------------------------------------------------
19 #include <IGESAppli_FiniteElement.hxx>
20 #include <IGESAppli_HArray1OfNode.hxx>
21 #include <IGESAppli_Node.hxx>
22 #include <IGESAppli_ToolFiniteElement.hxx>
23 #include <IGESData_DirChecker.hxx>
24 #include <IGESData_Dump.hxx>
25 #include <IGESData_IGESDumper.hxx>
26 #include <IGESData_IGESReaderData.hxx>
27 #include <IGESData_IGESWriter.hxx>
28 #include <IGESData_ParamCursor.hxx>
29 #include <IGESData_ParamReader.hxx>
30 #include <Interface_Check.hxx>
31 #include <Interface_CopyTool.hxx>
32 #include <Interface_EntityIterator.hxx>
33 #include <Interface_Macros.hxx>
34 #include <Interface_ShareTool.hxx>
35 #include <Standard_DomainError.hxx>
36 #include <TCollection_HAsciiString.hxx>
38 IGESAppli_ToolFiniteElement::IGESAppli_ToolFiniteElement () { }
41 void IGESAppli_ToolFiniteElement::ReadOwnParams
42 (const Handle(IGESAppli_FiniteElement)& ent,
43 const Handle(IGESData_IGESReaderData)& IR, IGESData_ParamReader& PR) const
45 Standard_Integer tempTopology;
46 Handle(TCollection_HAsciiString) tempName;
47 Standard_Integer nbval = 0;
48 //Standard_Boolean st; //szv#4:S4163:12Mar99 not needed
49 Handle(IGESAppli_HArray1OfNode) tempData;
51 //szv#4:S4163:12Mar99 `st=` not needed
52 PR.ReadInteger(PR.Current(),"Topology type",tempTopology);
53 PR.ReadInteger(PR.Current(),"No. of nodes defining element",nbval);
54 tempData = new IGESAppli_HArray1OfNode(1,nbval);
55 for (Standard_Integer i = 1; i <= nbval; i ++)
57 Handle(IGESAppli_Node) tempNode;
58 //szv#4:S4163:12Mar99 moved in if
59 if (PR.ReadEntity (IR,PR.Current(),"Node defining element", STANDARD_TYPE(IGESAppli_Node),tempNode))
60 tempData->SetValue(i,tempNode);
62 PR.ReadText(PR.Current(),"Element type name",tempName); //szv#4:S4163:12Mar99 `st=` not needed
64 DirChecker(ent).CheckTypeAndForm(PR.CCheck(),ent);
65 ent->Init(tempTopology,tempData,tempName);
68 void IGESAppli_ToolFiniteElement::WriteOwnParams
69 (const Handle(IGESAppli_FiniteElement)& ent, IGESData_IGESWriter& IW) const
71 Standard_Integer upper = ent->NbNodes();
72 IW.Send(ent->Topology());
74 for (Standard_Integer i= 1; i <= upper ; i ++)
75 IW.Send(ent->Node(i));
79 void IGESAppli_ToolFiniteElement::OwnShared
80 (const Handle(IGESAppli_FiniteElement)& ent, Interface_EntityIterator& iter) const
82 Standard_Integer upper = ent->NbNodes();
83 for (Standard_Integer i= 1; i <= upper ; i ++)
84 iter.GetOneItem(ent->Node(i));
87 void IGESAppli_ToolFiniteElement::OwnCopy
88 (const Handle(IGESAppli_FiniteElement)& another,
89 const Handle(IGESAppli_FiniteElement)& ent, Interface_CopyTool& TC) const
91 Standard_Integer aTopology = another->Topology();
92 Handle(TCollection_HAsciiString) aName =
93 new TCollection_HAsciiString(another->Name());
94 Standard_Integer nbval = another->NbNodes();
95 Handle(IGESAppli_HArray1OfNode) aList = new
96 IGESAppli_HArray1OfNode(1,nbval);
97 for (Standard_Integer i=1;i <=nbval;i++)
99 DeclareAndCast(IGESAppli_Node,aEntity,TC.Transferred(another->Node(i)));
100 aList->SetValue(i,aEntity);
102 ent->Init(aTopology,aList,aName);
105 IGESData_DirChecker IGESAppli_ToolFiniteElement::DirChecker
106 (const Handle(IGESAppli_FiniteElement)& /* ent */ ) const
108 IGESData_DirChecker DC(136,0); //Form no = 0 & Type = 136
109 DC.Structure(IGESData_DefVoid);
110 DC.LineFont(IGESData_DefAny);
111 DC.LineWeight(IGESData_DefVoid);
112 DC.Color(IGESData_DefAny);
113 DC.BlankStatusIgnored();
114 DC.SubordinateStatusIgnored();
116 DC.HierarchyStatusIgnored();
120 void IGESAppli_ToolFiniteElement::OwnCheck
121 (const Handle(IGESAppli_FiniteElement)& /* ent */,
122 const Interface_ShareTool& , Handle(Interface_Check)& /* ach */) const
126 void IGESAppli_ToolFiniteElement::OwnDump
127 (const Handle(IGESAppli_FiniteElement)& ent, const IGESData_IGESDumper& dumper,
128 Standard_OStream& S, const Standard_Integer level) const
130 S << "IGESAppli_FiniteElement\n";
132 S << "Topology type : " << ent->Topology() << "\n";
134 IGESData_DumpEntities(S,dumper ,level,1, ent->NbNodes(),ent->Node);
135 S << "\nElement Name : " << ent->Name()->String();