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 // UNFINISHED & UNSTARTED
20 #include <IGESAppli_ElementResults.ixx>
21 #include <Standard_OutOfRange.hxx>
24 IGESAppli_ElementResults::IGESAppli_ElementResults () { }
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
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");
63 theSubcaseNumber = aSubCase;
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
79 void IGESAppli_ElementResults::SetFormNumber (const Standard_Integer form)
81 if (form < 0 || form > 34) Standard_OutOfRange::Raise
82 ("IGESAppli_ElementResults : SetFormNumber");
83 InitTypeAndForm(148,form);
87 Handle(IGESDimen_GeneralNote) IGESAppli_ElementResults::Note () const
92 Standard_Integer IGESAppli_ElementResults::SubCaseNumber () const
94 return theSubcaseNumber;
97 Standard_Real IGESAppli_ElementResults::Time () const
102 Standard_Integer IGESAppli_ElementResults::NbResultValues () const
104 return theNbResultValues;
107 Standard_Integer IGESAppli_ElementResults::ResultReportFlag () const
109 return theResultReportFlag;
112 Standard_Integer IGESAppli_ElementResults::NbElements () const
114 return theElements->Length();
117 Standard_Integer IGESAppli_ElementResults::ElementIdentifier
118 (const Standard_Integer Index) const
120 return theElementIdentifiers->Value(Index);
123 Handle(IGESAppli_FiniteElement) IGESAppli_ElementResults::Element
124 (const Standard_Integer Index) const
126 return theElements->Value(Index);
129 Standard_Integer IGESAppli_ElementResults::ElementTopologyType
130 (const Standard_Integer Index) const
132 return theElementTopologyTypes->Value(Index);
135 Standard_Integer IGESAppli_ElementResults::NbLayers
136 (const Standard_Integer Index) const
138 return theNbLayers->Value(Index);
141 Standard_Integer IGESAppli_ElementResults::DataLayerFlag
142 (const Standard_Integer Index) const
144 return theDataLayerFlags->Value(Index);
147 Standard_Integer IGESAppli_ElementResults::NbResultDataLocs
148 (const Standard_Integer Index) const
150 return theNbResultDataLocs->Value(Index);
155 Standard_Integer IGESAppli_ElementResults::ResultDataLoc
156 (const Standard_Integer NElem, const Standard_Integer NLoc) const
158 return theResultDataLocs->Value(NElem)->Value(NLoc);
161 Standard_Integer IGESAppli_ElementResults::NbResults
162 (const Standard_Integer Index) const
164 return theResultData->Value(Index)->Length();
167 Standard_Real IGESAppli_ElementResults::ResultData
168 (const Standard_Integer NElem, const Standard_Integer num) const
170 return theResultData->Value(NElem)->Value(num);
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
177 Standard_Integer num = NVal + theNbResultValues *
178 (NLay + theNbLayers->Value(NElem) * NLoc);
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
186 return theResultData->Value(NElem)->Value(ResultRank(NElem,NVal,NLay,NLoc));
189 Handle(TColStd_HArray1OfReal) IGESAppli_ElementResults::ResultList
190 (const Standard_Integer NElem) const
192 return theResultData->Value(NElem);