0024624: Lost word in license statement in source files
[occt.git] / src / IGESAppli / IGESAppli_ElementResults.cxx
1 // Created by: CKY / Contract Toubro-Larsen
2 // Copyright (c) 1993-1999 Matra Datavision
3 // Copyright (c) 1999-2014 OPEN CASCADE SAS
4 //
5 // This file is part of Open CASCADE Technology software library.
6 //
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.
12 //
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
15
16 //--------------------------------------------------------------------
17 //--------------------------------------------------------------------
18
19 // UNFINISHED & UNSTARTED
20 #include <IGESAppli_ElementResults.ixx>
21 #include <Standard_OutOfRange.hxx>
22
23
24 IGESAppli_ElementResults::IGESAppli_ElementResults ()    {  }
25
26     void  IGESAppli_ElementResults::Init
27   (const Handle(IGESDimen_GeneralNote)& aNote,
28    const Standard_Integer aSubCase, const Standard_Real aTime,
29    const Standard_Integer nbResults, const Standard_Integer aResRepFlag,
30    const Handle(TColStd_HArray1OfInteger)& allElementIdents,
31    const Handle(IGESAppli_HArray1OfFiniteElement)&    allFiniteElems,
32    const Handle(TColStd_HArray1OfInteger)&            allTopTypes,
33    const Handle(TColStd_HArray1OfInteger)&            nbLayers,
34    const Handle(TColStd_HArray1OfInteger)&            allDataLayerFlags,
35    const Handle(TColStd_HArray1OfInteger)&            allnbResDataLocs,
36    const Handle(IGESBasic_HArray1OfHArray1OfInteger)& allResDataLocs,
37    const Handle(IGESBasic_HArray1OfHArray1OfReal)&    allResults) // UNFINISHED
38 {
39   // raises exception if sizes are not consistent, (lower = 1 too)
40   // but how to check is not clear ??
41   Standard_Integer num = allElementIdents->Length();
42   if (allElementIdents->Lower()  != 1 ||
43       allFiniteElems->Lower()    != 1 || allFiniteElems->Upper()    != num ||
44       allTopTypes->Lower()       != 1 || allTopTypes->Upper()       != num ||
45       nbLayers->Lower()          != 1 || nbLayers->Upper()          != num ||
46       allDataLayerFlags->Lower() != 1 || allDataLayerFlags->Upper() != num ||
47       allnbResDataLocs->Lower()  != 1 || allnbResDataLocs->Upper()  != num ||
48       allResDataLocs->Lower()    != 1 || allResDataLocs->Upper()    != num ||
49       allResults->Lower()        != 1 || allResults->Upper()        != num )
50     Standard_DimensionMismatch::Raise("IGESAppli_ElementsResults : Init");
51   for (Standard_Integer i = 1; i <= num; i ++) {
52     Standard_Integer nl  = nbLayers->Value(i);
53     Standard_Integer nrl = allnbResDataLocs->Value(i);
54     if (allResDataLocs->Value(i)->Lower() != 1 || 
55         allResDataLocs->Value(i)->Upper() != nrl)
56       Standard_DimensionMismatch::Raise("IGESAppli_ElementsResults : DataLoc");
57     if (allResults->Value(i)->Lower() != 1 ||
58         allResults->Value(i)->Upper() != nl*nrl*nbResults)
59       Standard_DimensionMismatch::Raise("IGESAppli_ElementsResults : Results");
60   }
61
62   theNote                 = aNote;
63   theSubcaseNumber        = aSubCase;
64   theTime                 = aTime;
65   theNbResultValues       = nbResults;
66   theResultReportFlag     = aResRepFlag;
67   theElementIdentifiers   = allElementIdents;
68   theElements             = allFiniteElems;
69   theElementTopologyTypes = allTopTypes;
70   theNbLayers             = nbLayers;
71   theDataLayerFlags       = allDataLayerFlags;
72   theNbResultDataLocs     = allnbResDataLocs;
73   theResultDataLocs       = allResDataLocs;
74   theResultData           = allResults;
75   InitTypeAndForm(148,FormNumber());
76 // FormNumber -> Type of the Results
77 }
78
79     void  IGESAppli_ElementResults::SetFormNumber (const Standard_Integer form)
80 {
81   if (form < 0 || form > 34) Standard_OutOfRange::Raise
82     ("IGESAppli_ElementResults : SetFormNumber");
83   InitTypeAndForm(148,form);
84 }
85
86
87     Handle(IGESDimen_GeneralNote)  IGESAppli_ElementResults::Note () const
88 {
89   return theNote;
90 }
91
92     Standard_Integer  IGESAppli_ElementResults::SubCaseNumber () const
93 {
94   return theSubcaseNumber;
95 }
96
97     Standard_Real  IGESAppli_ElementResults::Time () const
98 {
99   return theTime;
100 }
101
102     Standard_Integer  IGESAppli_ElementResults::NbResultValues () const
103 {
104   return theNbResultValues;
105 }
106
107     Standard_Integer  IGESAppli_ElementResults::ResultReportFlag () const
108 {
109   return theResultReportFlag;
110 }
111
112     Standard_Integer  IGESAppli_ElementResults::NbElements () const
113 {
114   return theElements->Length();
115 }
116
117     Standard_Integer  IGESAppli_ElementResults::ElementIdentifier
118   (const Standard_Integer Index) const
119 {
120   return theElementIdentifiers->Value(Index);
121 }
122
123     Handle(IGESAppli_FiniteElement)  IGESAppli_ElementResults::Element
124   (const Standard_Integer Index) const
125 {
126   return theElements->Value(Index);
127 }
128
129     Standard_Integer  IGESAppli_ElementResults::ElementTopologyType
130   (const Standard_Integer Index) const
131 {
132   return theElementTopologyTypes->Value(Index);
133 }
134
135     Standard_Integer  IGESAppli_ElementResults::NbLayers
136   (const Standard_Integer Index) const
137 {
138   return theNbLayers->Value(Index);
139 }
140
141     Standard_Integer  IGESAppli_ElementResults::DataLayerFlag
142   (const Standard_Integer Index) const
143 {
144   return theDataLayerFlags->Value(Index);
145 }
146
147     Standard_Integer  IGESAppli_ElementResults::NbResultDataLocs
148   (const Standard_Integer Index) const
149 {
150   return theNbResultDataLocs->Value(Index);
151 }
152
153 //  ?? VERIFIER
154
155     Standard_Integer  IGESAppli_ElementResults::ResultDataLoc
156   (const Standard_Integer NElem, const Standard_Integer NLoc) const
157 {
158   return theResultDataLocs->Value(NElem)->Value(NLoc);
159 }
160
161     Standard_Integer  IGESAppli_ElementResults::NbResults
162   (const Standard_Integer Index) const
163 {
164   return theResultData->Value(Index)->Length();
165 }
166
167     Standard_Real  IGESAppli_ElementResults::ResultData
168   (const Standard_Integer NElem, const Standard_Integer num) const
169 {
170   return theResultData->Value(NElem)->Value(num);
171 }
172
173     Standard_Integer  IGESAppli_ElementResults::ResultRank
174   (const Standard_Integer NElem, const Standard_Integer NVal,
175    const Standard_Integer NLay, const Standard_Integer NLoc) const
176 {
177   Standard_Integer num = NVal + theNbResultValues *
178     (NLay + theNbLayers->Value(NElem) * NLoc);
179   return num;
180 }
181
182     Standard_Real  IGESAppli_ElementResults::ResultData
183   (const Standard_Integer NElem, const Standard_Integer NVal,
184    const Standard_Integer NLay, const Standard_Integer NLoc) const
185 {
186   return theResultData->Value(NElem)->Value(ResultRank(NElem,NVal,NLay,NLoc));
187 }
188
189     Handle(TColStd_HArray1OfReal)  IGESAppli_ElementResults::ResultList
190   (const Standard_Integer NElem) const
191 {
192   return theResultData->Value(NElem);
193 }