b311480e |
1 | // Created by: CKY / Contract Toubro-Larsen |
2 | // Copyright (c) 1993-1999 Matra Datavision |
973c2be1 |
3 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
4 | // |
973c2be1 |
5 | // This file is part of Open CASCADE Technology software library. |
7fd59977 |
6 | // |
973c2be1 |
7 | // This library is free software; you can redistribute it and / or modify it |
8 | // under the terms of the GNU Lesser General Public 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. |
7fd59977 |
12 | // |
973c2be1 |
13 | // Alternatively, this file may be used under the terms of Open CASCADE |
14 | // commercial license or contractual agreement. |
b311480e |
15 | |
16 | //-------------------------------------------------------------------- |
7fd59977 |
17 | //-------------------------------------------------------------------- |
18 | |
19 | #include <IGESAppli_ToolNodalResults.ixx> |
20 | #include <IGESData_ParamCursor.hxx> |
21 | #include <IGESDimen_GeneralNote.hxx> |
22 | #include <IGESAppli_Node.hxx> |
23 | #include <IGESAppli_HArray1OfNode.hxx> |
24 | #include <TColStd_HArray1OfInteger.hxx> |
25 | #include <TColStd_HArray1OfReal.hxx> |
26 | #include <TColStd_HArray2OfReal.hxx> |
27 | #include <IGESData_Dump.hxx> |
28 | #include <Interface_Macros.hxx> |
29 | |
30 | |
31 | IGESAppli_ToolNodalResults::IGESAppli_ToolNodalResults () { } |
32 | |
33 | |
34 | void IGESAppli_ToolNodalResults::ReadOwnParams |
35 | (const Handle(IGESAppli_NodalResults)& ent, |
36 | const Handle(IGESData_IGESReaderData)& IR, IGESData_ParamReader& PR) const |
37 | { |
38 | Standard_Integer tempSubCaseNum = 0; |
39 | Standard_Real tempTime; |
40 | Standard_Integer nbval = 0; |
41 | Standard_Integer nbnodes = 0; |
42 | //Standard_Boolean st; //szv#4:S4163:12Mar99 not needed |
43 | Handle(IGESDimen_GeneralNote) tempNote; |
44 | Handle(TColStd_HArray2OfReal) tempData ; |
45 | Handle(IGESAppli_HArray1OfNode) tempNodes ; |
46 | Handle(TColStd_HArray1OfInteger) tempNodeIdentifiers ; |
47 | |
48 | //szv#4:S4163:12Mar99 `st=` not needed |
49 | PR.ReadEntity(IR,PR.Current(),"General Note describing the analysis case", |
50 | STANDARD_TYPE(IGESDimen_GeneralNote), tempNote); |
51 | PR.ReadInteger (PR.Current(),"Subcase number",tempSubCaseNum); |
52 | PR.ReadReal(PR.Current(),"Analysis time used",tempTime); |
53 | Standard_Boolean tempFlag = PR.ReadInteger(PR.Current(),"No. of values",nbval); |
54 | //szv#4:S4163:12Mar99 moved in if |
55 | if (PR.ReadInteger(PR.Current(),"No. of nodes",nbnodes)) { |
56 | tempData = new TColStd_HArray2OfReal(1,nbnodes,1,nbval); |
57 | tempNodes = new IGESAppli_HArray1OfNode(1,nbnodes); |
58 | tempNodeIdentifiers = new TColStd_HArray1OfInteger(1,nbnodes); |
59 | for (Standard_Integer i = 1; i <= nbnodes; i ++) { |
60 | Standard_Integer aitem; |
61 | //Check whether nbval properly read or not. |
62 | Handle(IGESAppli_Node) aNode ; |
63 | |
64 | if (PR.ReadInteger(PR.Current(),"Node no. identifier",aitem)) |
65 | tempNodeIdentifiers->SetValue(i,aitem); |
66 | if (PR.ReadEntity(IR,PR.Current(),"FEM Node", STANDARD_TYPE(IGESAppli_Node), aNode)) |
67 | tempNodes->SetValue(i,aNode); |
68 | if (tempFlag) |
69 | //Check whether nbval properly read or not. |
70 | for (Standard_Integer j = 1; j <= nbval; j ++) { |
71 | Standard_Real aval; |
72 | if (PR.ReadReal(PR.Current(),"Value",aval)) |
73 | tempData->SetValue(i,j,aval); |
74 | } |
75 | } |
76 | } |
77 | DirChecker(ent).CheckTypeAndForm(PR.CCheck(),ent); |
78 | ent->Init(tempNote,tempSubCaseNum,tempTime,tempNodeIdentifiers,tempNodes,tempData); |
79 | } |
80 | |
81 | void IGESAppli_ToolNodalResults::WriteOwnParams |
82 | (const Handle(IGESAppli_NodalResults)& ent, IGESData_IGESWriter& IW) const |
83 | { |
84 | Standard_Integer nbnodes = ent->NbNodes(); |
85 | Standard_Integer nbdata = ent->NbData (); |
86 | IW.Send(ent->Note()); |
87 | IW.Send(ent->SubCaseNumber()); |
88 | IW.Send(ent->Time()); |
89 | IW.Send(nbdata); |
90 | IW.Send(nbnodes); |
91 | for (Standard_Integer i = 1; i <= nbnodes; i++) |
92 | { |
93 | IW.Send(ent->NodeIdentifier(i)); |
94 | IW.Send(ent->Node(i)); |
95 | for (Standard_Integer j = 1; j <= nbdata; j++) |
96 | IW.Send(ent->Data(i,j)); |
97 | } |
98 | } |
99 | |
100 | void IGESAppli_ToolNodalResults::OwnShared |
101 | (const Handle(IGESAppli_NodalResults)& ent, Interface_EntityIterator& iter) const |
102 | { |
103 | Standard_Integer nbnodes = ent->NbNodes(); |
104 | iter.GetOneItem(ent->Note()); |
105 | for (Standard_Integer i = 1; i <= nbnodes; i++) |
106 | iter.GetOneItem(ent->Node(i)); |
107 | } |
108 | |
109 | void IGESAppli_ToolNodalResults::OwnCopy |
110 | (const Handle(IGESAppli_NodalResults)& another, |
111 | const Handle(IGESAppli_NodalResults)& ent, Interface_CopyTool& TC) const |
112 | { |
113 | DeclareAndCast(IGESDimen_GeneralNote,aNote,TC.Transferred(another->Note())); |
114 | Standard_Integer aSubCaseNum = another->SubCaseNumber(); |
115 | Standard_Real aTime = another->Time(); |
116 | Standard_Integer nbnodes = another->NbNodes(); |
117 | Standard_Integer nbval = another->NbData(); |
118 | Handle(TColStd_HArray1OfInteger) aNodeIdentifiers = |
119 | new TColStd_HArray1OfInteger(1,nbnodes); |
120 | Handle(IGESAppli_HArray1OfNode) aNodes = |
121 | new IGESAppli_HArray1OfNode(1,nbnodes); |
122 | Handle(TColStd_HArray2OfReal) aData = |
123 | new TColStd_HArray2OfReal(1,nbnodes,1,nbval); |
124 | |
125 | for (Standard_Integer i=1; i <= nbnodes; i++) |
126 | { |
127 | Standard_Integer aItem = another->NodeIdentifier(i); |
128 | aNodeIdentifiers->SetValue(i,aItem); |
129 | DeclareAndCast(IGESAppli_Node,anentity,TC.Transferred(another->Node(i))); |
130 | aNodes->SetValue(i,anentity); |
131 | for (Standard_Integer j=1; j <= nbval; j++) |
132 | aData->SetValue(i,j, another->Data(i,j)); |
133 | } |
134 | |
135 | ent->Init(aNote,aSubCaseNum,aTime,aNodeIdentifiers,aNodes,aData); |
136 | ent->SetFormNumber(another->FormNumber()); |
137 | } |
138 | |
139 | IGESData_DirChecker IGESAppli_ToolNodalResults::DirChecker |
140 | (const Handle(IGESAppli_NodalResults)& /* ent */ ) const |
141 | { |
142 | IGESData_DirChecker DC(146,0,34); // Type = 146 Form No. = 0 to 34 |
143 | DC.Structure(IGESData_DefVoid); |
144 | DC.LineFont(IGESData_DefVoid); |
145 | DC.LineWeight(IGESData_DefVoid); |
146 | DC.Color(IGESData_DefAny); |
147 | DC.BlankStatusIgnored(); |
148 | DC.UseFlagRequired(03); |
149 | DC.HierarchyStatusIgnored(); |
150 | return DC; |
151 | } |
152 | |
153 | void IGESAppli_ToolNodalResults::OwnCheck |
154 | (const Handle(IGESAppli_NodalResults)& ent, |
155 | const Interface_ShareTool& , Handle(Interface_Check)& ach) const |
156 | { |
157 | Standard_Integer FormNum = ent->FormNumber(); |
158 | Standard_Integer nv = ent->NbData(); |
159 | Standard_Boolean OK = Standard_True; |
160 | switch (FormNum) { |
161 | case 0 : if (nv < 0) OK = Standard_False; break; |
162 | case 1 : if (nv != 1) OK = Standard_False; break; |
163 | case 2 : if (nv != 1) OK = Standard_False; break; |
164 | case 3 : if (nv != 3) OK = Standard_False; break; |
165 | case 4 : if (nv != 6) OK = Standard_False; break; |
166 | case 5 : if (nv != 3) OK = Standard_False; break; |
167 | case 6 : if (nv != 3) OK = Standard_False; break; |
168 | case 7 : if (nv != 3) OK = Standard_False; break; |
169 | case 8 : if (nv != 3) OK = Standard_False; break; |
170 | case 9 : if (nv != 3) OK = Standard_False; break; |
171 | case 10 : if (nv != 1) OK = Standard_False; break; |
172 | case 11 : if (nv != 1) OK = Standard_False; break; |
173 | case 12 : if (nv != 3) OK = Standard_False; break; |
174 | case 13 : if (nv != 1) OK = Standard_False; break; |
175 | case 14 : if (nv != 1) OK = Standard_False; break; |
176 | case 15 : if (nv != 3) OK = Standard_False; break; |
177 | case 16 : if (nv != 1) OK = Standard_False; break; |
178 | case 17 : if (nv != 3) OK = Standard_False; break; |
179 | case 18 : if (nv != 3) OK = Standard_False; break; |
180 | case 19 : if (nv != 3) OK = Standard_False; break; |
181 | case 20 : if (nv != 3) OK = Standard_False; break; |
182 | case 21 : if (nv != 3) OK = Standard_False; break; |
183 | case 22 : if (nv != 3) OK = Standard_False; break; |
184 | case 23 : if (nv != 6) OK = Standard_False; break; |
185 | case 24 : if (nv != 6) OK = Standard_False; break; |
186 | case 25 : if (nv != 6) OK = Standard_False; break; |
187 | case 26 : if (nv != 6) OK = Standard_False; break; |
188 | case 27 : if (nv != 6) OK = Standard_False; break; |
189 | case 28 : if (nv != 6) OK = Standard_False; break; |
190 | case 29 : if (nv != 9) OK = Standard_False; break; |
191 | case 30 : if (nv != 9) OK = Standard_False; break; |
192 | case 31 : if (nv != 9) OK = Standard_False; break; |
193 | case 32 : if (nv != 9) OK = Standard_False; break; |
194 | case 33 : if (nv != 9) OK = Standard_False; break; |
195 | case 34 : if (nv != 9) OK = Standard_False; break; |
196 | default : ach->AddFail("Incorrect Form Number"); break; |
197 | } |
198 | if (!OK) ach->AddFail |
199 | ("Incorrect count of real values in array V for FEM node"); |
200 | } |
201 | |
202 | void IGESAppli_ToolNodalResults::OwnDump |
203 | (const Handle(IGESAppli_NodalResults)& ent, const IGESData_IGESDumper& dumper, |
204 | const Handle(Message_Messenger)& S, const Standard_Integer level) const |
205 | { |
206 | // Standard_Integer nbnodes = ent->NbNodes(); |
207 | // Standard_Integer nbdata = ent->NbData (); |
208 | S << "IGESAppli_NodalResults" << endl; |
209 | |
210 | S << "General Note : "; |
211 | dumper.Dump(ent->Note(),S, (level <= 4) ? 0 : 1); |
212 | S << endl; |
213 | S << "Analysis subcase number : " << ent->SubCaseNumber() << " "; |
214 | S << "Time used : " << ent->Time() << endl; |
215 | S << "No. of nodes : " << ent->NbNodes() << " "; |
216 | S << "No. of values for a node : " << ent->NbData() << endl; |
217 | S << "Node Identifiers : " << endl; |
218 | S << "Nodes : " << endl; |
219 | S << "Data : "; if (level < 6) S << " [ask level > 5]"; |
220 | // IGESData_DumpRectVals(S ,-level,1, ent->NbData(),ent->Data); |
221 | S << endl; |
222 | if (level > 4) |
223 | { |
224 | for (Standard_Integer i=1; i <= ent->NbNodes(); i++) |
225 | { |
226 | S << "[" << i << "]: "; |
227 | S << "NodeIdentifier : " << ent->NodeIdentifier(i) << " "; |
228 | S << "Node : "; |
229 | dumper.Dump (ent->Node(i),S, 1); |
230 | S << endl; |
231 | if (level < 6) continue; |
232 | S << "Data : [ "; |
233 | for (Standard_Integer j = 1; j <= ent->NbData(); j ++) |
234 | S << " " << ent->Data(i,j); |
235 | S << " ]" << endl; |
236 | } |
237 | } |
238 | } |