0022048: Visualization, AIS_InteractiveContext - single object selection should alway...
[occt.git] / src / IGESAppli / IGESAppli_ElementResults.cxx
CommitLineData
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//
d5f74e42 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
973c2be1 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//--------------------------------------------------------------------
7fd59977 18// UNFINISHED & UNSTARTED
7fd59977 19
42cf5bc1 20#include <IGESAppli_ElementResults.hxx>
21#include <IGESAppli_FiniteElement.hxx>
22#include <IGESBasic_HArray1OfHArray1OfInteger.hxx>
23#include <IGESBasic_HArray1OfHArray1OfReal.hxx>
24#include <IGESDimen_GeneralNote.hxx>
25#include <Standard_DimensionMismatch.hxx>
26#include <Standard_OutOfRange.hxx>
27#include <Standard_Type.hxx>
7fd59977 28
92efcf78 29IMPLEMENT_STANDARD_RTTIEXT(IGESAppli_ElementResults,IGESData_IGESEntity)
30
b311480e 31IGESAppli_ElementResults::IGESAppli_ElementResults () { }
7fd59977 32
33 void IGESAppli_ElementResults::Init
34 (const Handle(IGESDimen_GeneralNote)& aNote,
35 const Standard_Integer aSubCase, const Standard_Real aTime,
36 const Standard_Integer nbResults, const Standard_Integer aResRepFlag,
37 const Handle(TColStd_HArray1OfInteger)& allElementIdents,
38 const Handle(IGESAppli_HArray1OfFiniteElement)& allFiniteElems,
39 const Handle(TColStd_HArray1OfInteger)& allTopTypes,
40 const Handle(TColStd_HArray1OfInteger)& nbLayers,
41 const Handle(TColStd_HArray1OfInteger)& allDataLayerFlags,
42 const Handle(TColStd_HArray1OfInteger)& allnbResDataLocs,
43 const Handle(IGESBasic_HArray1OfHArray1OfInteger)& allResDataLocs,
44 const Handle(IGESBasic_HArray1OfHArray1OfReal)& allResults) // UNFINISHED
45{
46 // raises exception if sizes are not consistent, (lower = 1 too)
47 // but how to check is not clear ??
48 Standard_Integer num = allElementIdents->Length();
49 if (allElementIdents->Lower() != 1 ||
50 allFiniteElems->Lower() != 1 || allFiniteElems->Upper() != num ||
51 allTopTypes->Lower() != 1 || allTopTypes->Upper() != num ||
52 nbLayers->Lower() != 1 || nbLayers->Upper() != num ||
53 allDataLayerFlags->Lower() != 1 || allDataLayerFlags->Upper() != num ||
54 allnbResDataLocs->Lower() != 1 || allnbResDataLocs->Upper() != num ||
55 allResDataLocs->Lower() != 1 || allResDataLocs->Upper() != num ||
56 allResults->Lower() != 1 || allResults->Upper() != num )
9775fa61 57 throw Standard_DimensionMismatch("IGESAppli_ElementsResults : Init");
7fd59977 58 for (Standard_Integer i = 1; i <= num; i ++) {
59 Standard_Integer nl = nbLayers->Value(i);
60 Standard_Integer nrl = allnbResDataLocs->Value(i);
61 if (allResDataLocs->Value(i)->Lower() != 1 ||
62 allResDataLocs->Value(i)->Upper() != nrl)
9775fa61 63 throw Standard_DimensionMismatch("IGESAppli_ElementsResults : DataLoc");
7fd59977 64 if (allResults->Value(i)->Lower() != 1 ||
65 allResults->Value(i)->Upper() != nl*nrl*nbResults)
9775fa61 66 throw Standard_DimensionMismatch("IGESAppli_ElementsResults : Results");
7fd59977 67 }
68
69 theNote = aNote;
70 theSubcaseNumber = aSubCase;
71 theTime = aTime;
72 theNbResultValues = nbResults;
73 theResultReportFlag = aResRepFlag;
74 theElementIdentifiers = allElementIdents;
75 theElements = allFiniteElems;
76 theElementTopologyTypes = allTopTypes;
77 theNbLayers = nbLayers;
78 theDataLayerFlags = allDataLayerFlags;
79 theNbResultDataLocs = allnbResDataLocs;
80 theResultDataLocs = allResDataLocs;
81 theResultData = allResults;
82 InitTypeAndForm(148,FormNumber());
83// FormNumber -> Type of the Results
84}
85
86 void IGESAppli_ElementResults::SetFormNumber (const Standard_Integer form)
87{
9775fa61 88 if (form < 0 || form > 34) throw Standard_OutOfRange("IGESAppli_ElementResults : SetFormNumber");
7fd59977 89 InitTypeAndForm(148,form);
90}
91
92
93 Handle(IGESDimen_GeneralNote) IGESAppli_ElementResults::Note () const
94{
95 return theNote;
96}
97
98 Standard_Integer IGESAppli_ElementResults::SubCaseNumber () const
99{
100 return theSubcaseNumber;
101}
102
103 Standard_Real IGESAppli_ElementResults::Time () const
104{
105 return theTime;
106}
107
108 Standard_Integer IGESAppli_ElementResults::NbResultValues () const
109{
110 return theNbResultValues;
111}
112
113 Standard_Integer IGESAppli_ElementResults::ResultReportFlag () const
114{
115 return theResultReportFlag;
116}
117
118 Standard_Integer IGESAppli_ElementResults::NbElements () const
119{
120 return theElements->Length();
121}
122
123 Standard_Integer IGESAppli_ElementResults::ElementIdentifier
124 (const Standard_Integer Index) const
125{
126 return theElementIdentifiers->Value(Index);
127}
128
129 Handle(IGESAppli_FiniteElement) IGESAppli_ElementResults::Element
130 (const Standard_Integer Index) const
131{
132 return theElements->Value(Index);
133}
134
135 Standard_Integer IGESAppli_ElementResults::ElementTopologyType
136 (const Standard_Integer Index) const
137{
138 return theElementTopologyTypes->Value(Index);
139}
140
141 Standard_Integer IGESAppli_ElementResults::NbLayers
142 (const Standard_Integer Index) const
143{
144 return theNbLayers->Value(Index);
145}
146
147 Standard_Integer IGESAppli_ElementResults::DataLayerFlag
148 (const Standard_Integer Index) const
149{
150 return theDataLayerFlags->Value(Index);
151}
152
153 Standard_Integer IGESAppli_ElementResults::NbResultDataLocs
154 (const Standard_Integer Index) const
155{
156 return theNbResultDataLocs->Value(Index);
157}
158
159// ?? VERIFIER
160
161 Standard_Integer IGESAppli_ElementResults::ResultDataLoc
162 (const Standard_Integer NElem, const Standard_Integer NLoc) const
163{
164 return theResultDataLocs->Value(NElem)->Value(NLoc);
165}
166
167 Standard_Integer IGESAppli_ElementResults::NbResults
168 (const Standard_Integer Index) const
169{
170 return theResultData->Value(Index)->Length();
171}
172
173 Standard_Real IGESAppli_ElementResults::ResultData
174 (const Standard_Integer NElem, const Standard_Integer num) const
175{
176 return theResultData->Value(NElem)->Value(num);
177}
178
179 Standard_Integer IGESAppli_ElementResults::ResultRank
180 (const Standard_Integer NElem, const Standard_Integer NVal,
181 const Standard_Integer NLay, const Standard_Integer NLoc) const
182{
183 Standard_Integer num = NVal + theNbResultValues *
184 (NLay + theNbLayers->Value(NElem) * NLoc);
185 return num;
186}
187
188 Standard_Real IGESAppli_ElementResults::ResultData
189 (const Standard_Integer NElem, const Standard_Integer NVal,
190 const Standard_Integer NLay, const Standard_Integer NLoc) const
191{
192 return theResultData->Value(NElem)->Value(ResultRank(NElem,NVal,NLay,NLoc));
193}
194
195 Handle(TColStd_HArray1OfReal) IGESAppli_ElementResults::ResultList
196 (const Standard_Integer NElem) const
197{
198 return theResultData->Value(NElem);
199}