1 // Created by: CKY / Contract Toubro-Larsen
2 // Copyright (c) 1993-1999 Matra Datavision
3 // Copyright (c) 1999-2012 OPEN CASCADE SAS
5 // The content of this file is subject to the Open CASCADE Technology Public
6 // License Version 6.5 (the "License"). You may not use the content of this file
7 // except in compliance with the License. Please obtain a copy of the License
8 // at http://www.opencascade.org and read it completely before using this file.
10 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
11 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
13 // The Original Code and all software distributed under the License is
14 // distributed on an "AS IS" basis, without warranty of any kind, and the
15 // Initial Developer hereby disclaims all such warranties, including without
16 // limitation, any warranties of merchantability, fitness for a particular
17 // purpose or non-infringement. Please see the License for the specific terms
18 // and conditions governing the rights and limitations under the License.
20 //--------------------------------------------------------------------
21 //--------------------------------------------------------------------
23 // UNFINISHED & UNSTARTED
24 #include <IGESAppli_ElementResults.ixx>
25 #include <Standard_OutOfRange.hxx>
28 IGESAppli_ElementResults::IGESAppli_ElementResults () { }
30 void IGESAppli_ElementResults::Init
31 (const Handle(IGESDimen_GeneralNote)& aNote,
32 const Standard_Integer aSubCase, const Standard_Real aTime,
33 const Standard_Integer nbResults, const Standard_Integer aResRepFlag,
34 const Handle(TColStd_HArray1OfInteger)& allElementIdents,
35 const Handle(IGESAppli_HArray1OfFiniteElement)& allFiniteElems,
36 const Handle(TColStd_HArray1OfInteger)& allTopTypes,
37 const Handle(TColStd_HArray1OfInteger)& nbLayers,
38 const Handle(TColStd_HArray1OfInteger)& allDataLayerFlags,
39 const Handle(TColStd_HArray1OfInteger)& allnbResDataLocs,
40 const Handle(IGESBasic_HArray1OfHArray1OfInteger)& allResDataLocs,
41 const Handle(IGESBasic_HArray1OfHArray1OfReal)& allResults) // UNFINISHED
43 // raises exception if sizes are not consistent, (lower = 1 too)
44 // but how to check is not clear ??
45 Standard_Integer num = allElementIdents->Length();
46 if (allElementIdents->Lower() != 1 ||
47 allFiniteElems->Lower() != 1 || allFiniteElems->Upper() != num ||
48 allTopTypes->Lower() != 1 || allTopTypes->Upper() != num ||
49 nbLayers->Lower() != 1 || nbLayers->Upper() != num ||
50 allDataLayerFlags->Lower() != 1 || allDataLayerFlags->Upper() != num ||
51 allnbResDataLocs->Lower() != 1 || allnbResDataLocs->Upper() != num ||
52 allResDataLocs->Lower() != 1 || allResDataLocs->Upper() != num ||
53 allResults->Lower() != 1 || allResults->Upper() != num )
54 Standard_DimensionMismatch::Raise("IGESAppli_ElementsResults : Init");
55 for (Standard_Integer i = 1; i <= num; i ++) {
56 Standard_Integer nl = nbLayers->Value(i);
57 Standard_Integer nrl = allnbResDataLocs->Value(i);
58 if (allResDataLocs->Value(i)->Lower() != 1 ||
59 allResDataLocs->Value(i)->Upper() != nrl)
60 Standard_DimensionMismatch::Raise("IGESAppli_ElementsResults : DataLoc");
61 if (allResults->Value(i)->Lower() != 1 ||
62 allResults->Value(i)->Upper() != nl*nrl*nbResults)
63 Standard_DimensionMismatch::Raise("IGESAppli_ElementsResults : Results");
67 theSubcaseNumber = aSubCase;
69 theNbResultValues = nbResults;
70 theResultReportFlag = aResRepFlag;
71 theElementIdentifiers = allElementIdents;
72 theElements = allFiniteElems;
73 theElementTopologyTypes = allTopTypes;
74 theNbLayers = nbLayers;
75 theDataLayerFlags = allDataLayerFlags;
76 theNbResultDataLocs = allnbResDataLocs;
77 theResultDataLocs = allResDataLocs;
78 theResultData = allResults;
79 InitTypeAndForm(148,FormNumber());
80 // FormNumber -> Type of the Results
83 void IGESAppli_ElementResults::SetFormNumber (const Standard_Integer form)
85 if (form < 0 || form > 34) Standard_OutOfRange::Raise
86 ("IGESAppli_ElementResults : SetFormNumber");
87 InitTypeAndForm(148,form);
91 Handle(IGESDimen_GeneralNote) IGESAppli_ElementResults::Note () const
96 Standard_Integer IGESAppli_ElementResults::SubCaseNumber () const
98 return theSubcaseNumber;
101 Standard_Real IGESAppli_ElementResults::Time () const
106 Standard_Integer IGESAppli_ElementResults::NbResultValues () const
108 return theNbResultValues;
111 Standard_Integer IGESAppli_ElementResults::ResultReportFlag () const
113 return theResultReportFlag;
116 Standard_Integer IGESAppli_ElementResults::NbElements () const
118 return theElements->Length();
121 Standard_Integer IGESAppli_ElementResults::ElementIdentifier
122 (const Standard_Integer Index) const
124 return theElementIdentifiers->Value(Index);
127 Handle(IGESAppli_FiniteElement) IGESAppli_ElementResults::Element
128 (const Standard_Integer Index) const
130 return theElements->Value(Index);
133 Standard_Integer IGESAppli_ElementResults::ElementTopologyType
134 (const Standard_Integer Index) const
136 return theElementTopologyTypes->Value(Index);
139 Standard_Integer IGESAppli_ElementResults::NbLayers
140 (const Standard_Integer Index) const
142 return theNbLayers->Value(Index);
145 Standard_Integer IGESAppli_ElementResults::DataLayerFlag
146 (const Standard_Integer Index) const
148 return theDataLayerFlags->Value(Index);
151 Standard_Integer IGESAppli_ElementResults::NbResultDataLocs
152 (const Standard_Integer Index) const
154 return theNbResultDataLocs->Value(Index);
159 Standard_Integer IGESAppli_ElementResults::ResultDataLoc
160 (const Standard_Integer NElem, const Standard_Integer NLoc) const
162 return theResultDataLocs->Value(NElem)->Value(NLoc);
165 Standard_Integer IGESAppli_ElementResults::NbResults
166 (const Standard_Integer Index) const
168 return theResultData->Value(Index)->Length();
171 Standard_Real IGESAppli_ElementResults::ResultData
172 (const Standard_Integer NElem, const Standard_Integer num) const
174 return theResultData->Value(NElem)->Value(num);
177 Standard_Integer IGESAppli_ElementResults::ResultRank
178 (const Standard_Integer NElem, const Standard_Integer NVal,
179 const Standard_Integer NLay, const Standard_Integer NLoc) const
181 Standard_Integer num = NVal + theNbResultValues *
182 (NLay + theNbLayers->Value(NElem) * NLoc);
186 Standard_Real IGESAppli_ElementResults::ResultData
187 (const Standard_Integer NElem, const Standard_Integer NVal,
188 const Standard_Integer NLay, const Standard_Integer NLoc) const
190 return theResultData->Value(NElem)->Value(ResultRank(NElem,NVal,NLay,NLoc));
193 Handle(TColStd_HArray1OfReal) IGESAppli_ElementResults::ResultList
194 (const Standard_Integer NElem) const
196 return theResultData->Value(NElem);