1 //--------------------------------------------------------------------
3 // File Name : IGESAppli_NodalResults.cxx
5 // Author : CKY / Contract Toubro-Larsen
6 // Copyright : MATRA-DATAVISION 1993
8 //--------------------------------------------------------------------
10 #include <IGESAppli_ToolNodalResults.ixx>
11 #include <IGESData_ParamCursor.hxx>
12 #include <IGESDimen_GeneralNote.hxx>
13 #include <IGESAppli_Node.hxx>
14 #include <IGESAppli_HArray1OfNode.hxx>
15 #include <TColStd_HArray1OfInteger.hxx>
16 #include <TColStd_HArray1OfReal.hxx>
17 #include <TColStd_HArray2OfReal.hxx>
18 #include <IGESData_Dump.hxx>
19 #include <Interface_Macros.hxx>
22 IGESAppli_ToolNodalResults::IGESAppli_ToolNodalResults () { }
25 void IGESAppli_ToolNodalResults::ReadOwnParams
26 (const Handle(IGESAppli_NodalResults)& ent,
27 const Handle(IGESData_IGESReaderData)& IR, IGESData_ParamReader& PR) const
29 Standard_Integer tempSubCaseNum = 0;
30 Standard_Real tempTime;
31 Standard_Integer nbval = 0;
32 Standard_Integer nbnodes = 0;
33 //Standard_Boolean st; //szv#4:S4163:12Mar99 not needed
34 Handle(IGESDimen_GeneralNote) tempNote;
35 Handle(TColStd_HArray2OfReal) tempData ;
36 Handle(IGESAppli_HArray1OfNode) tempNodes ;
37 Handle(TColStd_HArray1OfInteger) tempNodeIdentifiers ;
39 //szv#4:S4163:12Mar99 `st=` not needed
40 PR.ReadEntity(IR,PR.Current(),"General Note describing the analysis case",
41 STANDARD_TYPE(IGESDimen_GeneralNote), tempNote);
42 PR.ReadInteger (PR.Current(),"Subcase number",tempSubCaseNum);
43 PR.ReadReal(PR.Current(),"Analysis time used",tempTime);
44 Standard_Boolean tempFlag = PR.ReadInteger(PR.Current(),"No. of values",nbval);
45 //szv#4:S4163:12Mar99 moved in if
46 if (PR.ReadInteger(PR.Current(),"No. of nodes",nbnodes)) {
47 tempData = new TColStd_HArray2OfReal(1,nbnodes,1,nbval);
48 tempNodes = new IGESAppli_HArray1OfNode(1,nbnodes);
49 tempNodeIdentifiers = new TColStd_HArray1OfInteger(1,nbnodes);
50 for (Standard_Integer i = 1; i <= nbnodes; i ++) {
51 Standard_Integer aitem;
52 //Check whether nbval properly read or not.
53 Handle(IGESAppli_Node) aNode ;
55 if (PR.ReadInteger(PR.Current(),"Node no. identifier",aitem))
56 tempNodeIdentifiers->SetValue(i,aitem);
57 if (PR.ReadEntity(IR,PR.Current(),"FEM Node", STANDARD_TYPE(IGESAppli_Node), aNode))
58 tempNodes->SetValue(i,aNode);
60 //Check whether nbval properly read or not.
61 for (Standard_Integer j = 1; j <= nbval; j ++) {
63 if (PR.ReadReal(PR.Current(),"Value",aval))
64 tempData->SetValue(i,j,aval);
68 DirChecker(ent).CheckTypeAndForm(PR.CCheck(),ent);
69 ent->Init(tempNote,tempSubCaseNum,tempTime,tempNodeIdentifiers,tempNodes,tempData);
72 void IGESAppli_ToolNodalResults::WriteOwnParams
73 (const Handle(IGESAppli_NodalResults)& ent, IGESData_IGESWriter& IW) const
75 Standard_Integer nbnodes = ent->NbNodes();
76 Standard_Integer nbdata = ent->NbData ();
78 IW.Send(ent->SubCaseNumber());
82 for (Standard_Integer i = 1; i <= nbnodes; i++)
84 IW.Send(ent->NodeIdentifier(i));
85 IW.Send(ent->Node(i));
86 for (Standard_Integer j = 1; j <= nbdata; j++)
87 IW.Send(ent->Data(i,j));
91 void IGESAppli_ToolNodalResults::OwnShared
92 (const Handle(IGESAppli_NodalResults)& ent, Interface_EntityIterator& iter) const
94 Standard_Integer nbnodes = ent->NbNodes();
95 iter.GetOneItem(ent->Note());
96 for (Standard_Integer i = 1; i <= nbnodes; i++)
97 iter.GetOneItem(ent->Node(i));
100 void IGESAppli_ToolNodalResults::OwnCopy
101 (const Handle(IGESAppli_NodalResults)& another,
102 const Handle(IGESAppli_NodalResults)& ent, Interface_CopyTool& TC) const
104 DeclareAndCast(IGESDimen_GeneralNote,aNote,TC.Transferred(another->Note()));
105 Standard_Integer aSubCaseNum = another->SubCaseNumber();
106 Standard_Real aTime = another->Time();
107 Standard_Integer nbnodes = another->NbNodes();
108 Standard_Integer nbval = another->NbData();
109 Handle(TColStd_HArray1OfInteger) aNodeIdentifiers =
110 new TColStd_HArray1OfInteger(1,nbnodes);
111 Handle(IGESAppli_HArray1OfNode) aNodes =
112 new IGESAppli_HArray1OfNode(1,nbnodes);
113 Handle(TColStd_HArray2OfReal) aData =
114 new TColStd_HArray2OfReal(1,nbnodes,1,nbval);
116 for (Standard_Integer i=1; i <= nbnodes; i++)
118 Standard_Integer aItem = another->NodeIdentifier(i);
119 aNodeIdentifiers->SetValue(i,aItem);
120 DeclareAndCast(IGESAppli_Node,anentity,TC.Transferred(another->Node(i)));
121 aNodes->SetValue(i,anentity);
122 for (Standard_Integer j=1; j <= nbval; j++)
123 aData->SetValue(i,j, another->Data(i,j));
126 ent->Init(aNote,aSubCaseNum,aTime,aNodeIdentifiers,aNodes,aData);
127 ent->SetFormNumber(another->FormNumber());
130 IGESData_DirChecker IGESAppli_ToolNodalResults::DirChecker
131 (const Handle(IGESAppli_NodalResults)& /* ent */ ) const
133 IGESData_DirChecker DC(146,0,34); // Type = 146 Form No. = 0 to 34
134 DC.Structure(IGESData_DefVoid);
135 DC.LineFont(IGESData_DefVoid);
136 DC.LineWeight(IGESData_DefVoid);
137 DC.Color(IGESData_DefAny);
138 DC.BlankStatusIgnored();
139 DC.UseFlagRequired(03);
140 DC.HierarchyStatusIgnored();
144 void IGESAppli_ToolNodalResults::OwnCheck
145 (const Handle(IGESAppli_NodalResults)& ent,
146 const Interface_ShareTool& , Handle(Interface_Check)& ach) const
148 Standard_Integer FormNum = ent->FormNumber();
149 Standard_Integer nv = ent->NbData();
150 Standard_Boolean OK = Standard_True;
152 case 0 : if (nv < 0) OK = Standard_False; break;
153 case 1 : if (nv != 1) OK = Standard_False; break;
154 case 2 : if (nv != 1) OK = Standard_False; break;
155 case 3 : if (nv != 3) OK = Standard_False; break;
156 case 4 : if (nv != 6) OK = Standard_False; break;
157 case 5 : if (nv != 3) OK = Standard_False; break;
158 case 6 : if (nv != 3) OK = Standard_False; break;
159 case 7 : if (nv != 3) OK = Standard_False; break;
160 case 8 : if (nv != 3) OK = Standard_False; break;
161 case 9 : if (nv != 3) OK = Standard_False; break;
162 case 10 : if (nv != 1) OK = Standard_False; break;
163 case 11 : if (nv != 1) OK = Standard_False; break;
164 case 12 : if (nv != 3) OK = Standard_False; break;
165 case 13 : if (nv != 1) OK = Standard_False; break;
166 case 14 : if (nv != 1) OK = Standard_False; break;
167 case 15 : if (nv != 3) OK = Standard_False; break;
168 case 16 : if (nv != 1) OK = Standard_False; break;
169 case 17 : if (nv != 3) OK = Standard_False; break;
170 case 18 : if (nv != 3) OK = Standard_False; break;
171 case 19 : if (nv != 3) OK = Standard_False; break;
172 case 20 : if (nv != 3) OK = Standard_False; break;
173 case 21 : if (nv != 3) OK = Standard_False; break;
174 case 22 : if (nv != 3) OK = Standard_False; break;
175 case 23 : if (nv != 6) OK = Standard_False; break;
176 case 24 : if (nv != 6) OK = Standard_False; break;
177 case 25 : if (nv != 6) OK = Standard_False; break;
178 case 26 : if (nv != 6) OK = Standard_False; break;
179 case 27 : if (nv != 6) OK = Standard_False; break;
180 case 28 : if (nv != 6) OK = Standard_False; break;
181 case 29 : if (nv != 9) OK = Standard_False; break;
182 case 30 : if (nv != 9) OK = Standard_False; break;
183 case 31 : if (nv != 9) OK = Standard_False; break;
184 case 32 : if (nv != 9) OK = Standard_False; break;
185 case 33 : if (nv != 9) OK = Standard_False; break;
186 case 34 : if (nv != 9) OK = Standard_False; break;
187 default : ach->AddFail("Incorrect Form Number"); break;
189 if (!OK) ach->AddFail
190 ("Incorrect count of real values in array V for FEM node");
193 void IGESAppli_ToolNodalResults::OwnDump
194 (const Handle(IGESAppli_NodalResults)& ent, const IGESData_IGESDumper& dumper,
195 const Handle(Message_Messenger)& S, const Standard_Integer level) const
197 // Standard_Integer nbnodes = ent->NbNodes();
198 // Standard_Integer nbdata = ent->NbData ();
199 S << "IGESAppli_NodalResults" << endl;
201 S << "General Note : ";
202 dumper.Dump(ent->Note(),S, (level <= 4) ? 0 : 1);
204 S << "Analysis subcase number : " << ent->SubCaseNumber() << " ";
205 S << "Time used : " << ent->Time() << endl;
206 S << "No. of nodes : " << ent->NbNodes() << " ";
207 S << "No. of values for a node : " << ent->NbData() << endl;
208 S << "Node Identifiers : " << endl;
209 S << "Nodes : " << endl;
210 S << "Data : "; if (level < 6) S << " [ask level > 5]";
211 // IGESData_DumpRectVals(S ,-level,1, ent->NbData(),ent->Data);
215 for (Standard_Integer i=1; i <= ent->NbNodes(); i++)
217 S << "[" << i << "]: ";
218 S << "NodeIdentifier : " << ent->NodeIdentifier(i) << " ";
220 dumper.Dump (ent->Node(i),S, 1);
222 if (level < 6) continue;
224 for (Standard_Integer j = 1; j <= ent->NbData(); j ++)
225 S << " " << ent->Data(i,j);