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 <Message_Messenger.hxx>
36 #include <Standard_DomainError.hxx>
37 #include <TCollection_HAsciiString.hxx>
39 IGESAppli_ToolFiniteElement::IGESAppli_ToolFiniteElement () { }
42 void IGESAppli_ToolFiniteElement::ReadOwnParams
43 (const Handle(IGESAppli_FiniteElement)& ent,
44 const Handle(IGESData_IGESReaderData)& IR, IGESData_ParamReader& PR) const
46 Standard_Integer tempTopology;
47 Handle(TCollection_HAsciiString) tempName;
48 Standard_Integer nbval = 0;
49 //Standard_Boolean st; //szv#4:S4163:12Mar99 not needed
50 Handle(IGESAppli_HArray1OfNode) tempData;
52 //szv#4:S4163:12Mar99 `st=` not needed
53 PR.ReadInteger(PR.Current(),"Topology type",tempTopology);
54 PR.ReadInteger(PR.Current(),"No. of nodes defining element",nbval);
55 tempData = new IGESAppli_HArray1OfNode(1,nbval);
56 for (Standard_Integer i = 1; i <= nbval; i ++)
58 Handle(IGESAppli_Node) tempNode;
59 //szv#4:S4163:12Mar99 moved in if
60 if (PR.ReadEntity (IR,PR.Current(),"Node defining element", STANDARD_TYPE(IGESAppli_Node),tempNode))
61 tempData->SetValue(i,tempNode);
63 PR.ReadText(PR.Current(),"Element type name",tempName); //szv#4:S4163:12Mar99 `st=` not needed
65 DirChecker(ent).CheckTypeAndForm(PR.CCheck(),ent);
66 ent->Init(tempTopology,tempData,tempName);
69 void IGESAppli_ToolFiniteElement::WriteOwnParams
70 (const Handle(IGESAppli_FiniteElement)& ent, IGESData_IGESWriter& IW) const
72 Standard_Integer upper = ent->NbNodes();
73 IW.Send(ent->Topology());
75 for (Standard_Integer i= 1; i <= upper ; i ++)
76 IW.Send(ent->Node(i));
80 void IGESAppli_ToolFiniteElement::OwnShared
81 (const Handle(IGESAppli_FiniteElement)& ent, Interface_EntityIterator& iter) const
83 Standard_Integer upper = ent->NbNodes();
84 for (Standard_Integer i= 1; i <= upper ; i ++)
85 iter.GetOneItem(ent->Node(i));
88 void IGESAppli_ToolFiniteElement::OwnCopy
89 (const Handle(IGESAppli_FiniteElement)& another,
90 const Handle(IGESAppli_FiniteElement)& ent, Interface_CopyTool& TC) const
92 Standard_Integer aTopology = another->Topology();
93 Handle(TCollection_HAsciiString) aName =
94 new TCollection_HAsciiString(another->Name());
95 Standard_Integer nbval = another->NbNodes();
96 Handle(IGESAppli_HArray1OfNode) aList = new
97 IGESAppli_HArray1OfNode(1,nbval);
98 for (Standard_Integer i=1;i <=nbval;i++)
100 DeclareAndCast(IGESAppli_Node,aEntity,TC.Transferred(another->Node(i)));
101 aList->SetValue(i,aEntity);
103 ent->Init(aTopology,aList,aName);
106 IGESData_DirChecker IGESAppli_ToolFiniteElement::DirChecker
107 (const Handle(IGESAppli_FiniteElement)& /* ent */ ) const
109 IGESData_DirChecker DC(136,0); //Form no = 0 & Type = 136
110 DC.Structure(IGESData_DefVoid);
111 DC.LineFont(IGESData_DefAny);
112 DC.LineWeight(IGESData_DefVoid);
113 DC.Color(IGESData_DefAny);
114 DC.BlankStatusIgnored();
115 DC.SubordinateStatusIgnored();
117 DC.HierarchyStatusIgnored();
121 void IGESAppli_ToolFiniteElement::OwnCheck
122 (const Handle(IGESAppli_FiniteElement)& /* ent */,
123 const Interface_ShareTool& , Handle(Interface_Check)& /* ach */) const
127 void IGESAppli_ToolFiniteElement::OwnDump
128 (const Handle(IGESAppli_FiniteElement)& ent, const IGESData_IGESDumper& dumper,
129 const Handle(Message_Messenger)& S, const Standard_Integer level) const
131 S << "IGESAppli_FiniteElement" << Message_EndLine;
133 S << "Topology type : " << ent->Topology() << Message_EndLine;
135 IGESData_DumpEntities(S,dumper ,level,1, ent->NbNodes(),ent->Node);
136 S << Message_EndLine << "Element Name : " << ent->Name();
137 S << Message_EndLine;