0027104: DownCast() cannot return null for mismatched handle
[occt.git] / src / IGESAppli / IGESAppli_NodalResults.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//--------------------------------------------------------------------
18
42cf5bc1 19#include <IGESAppli_NodalResults.hxx>
20#include <IGESAppli_Node.hxx>
21#include <IGESDimen_GeneralNote.hxx>
22#include <Standard_DimensionMismatch.hxx>
7fd59977 23#include <Standard_OutOfRange.hxx>
42cf5bc1 24#include <Standard_Type.hxx>
7fd59977 25#include <TColStd_HArray1OfReal.hxx>
26
92efcf78 27IMPLEMENT_STANDARD_RTTIEXT(IGESAppli_NodalResults,IGESData_IGESEntity)
28
b311480e 29IGESAppli_NodalResults::IGESAppli_NodalResults () { }
7fd59977 30
31
32// Data : Col -> // Nodes. Row : Data per Node
33
34 void IGESAppli_NodalResults::Init
35 (const Handle(IGESDimen_GeneralNote)& aNote,
36 const Standard_Integer aNumber, const Standard_Real aTime,
37 const Handle(TColStd_HArray1OfInteger)& allNodeIdentifiers,
38 const Handle(IGESAppli_HArray1OfNode)& allNodes,
39 const Handle(TColStd_HArray2OfReal)& allData)
40{
41 if (allNodes->Lower() != 1 || allNodeIdentifiers->Lower() != 1 ||
42 allNodes->Length() != allNodeIdentifiers->Length() ||
43 allData->LowerCol() != 1 || allData->LowerRow() != 1 ||
44 allNodes->Length() != allData->UpperRow() )
45 Standard_DimensionMismatch::Raise("IGESAppli_NodalResults : Init");
46 theNote = aNote;
47 theSubCaseNum = aNumber;
48 theTime = aTime;
49 theNodeIdentifiers = allNodeIdentifiers;
50 theNodes = allNodes;
51 theData = allData;
52 InitTypeAndForm(146,FormNumber());
53// FormNumber -> Type of the Results
54}
55
56 void IGESAppli_NodalResults::SetFormNumber (const Standard_Integer form)
57{
58 if (form < 0 || form > 34) Standard_OutOfRange::Raise
59 ("IGESAppli_NodalResults : SetFormNumber");
60 InitTypeAndForm(146,form);
61}
62
63
64 Handle(IGESDimen_GeneralNote) IGESAppli_NodalResults::Note () const
65{
66 return theNote;
67}
68
69 Handle(IGESAppli_Node) IGESAppli_NodalResults::Node
70 (const Standard_Integer Index) const
71{
72 return theNodes->Value(Index);
73}
74
75 Standard_Integer IGESAppli_NodalResults::NbNodes () const
76{
77 return theNodes->Length();
78}
79
80 Standard_Integer IGESAppli_NodalResults::SubCaseNumber () const
81{
82 return theSubCaseNum;
83}
84
85 Standard_Real IGESAppli_NodalResults::Time () const
86{
87 return theTime;
88}
89
90 Standard_Integer IGESAppli_NodalResults::NbData () const
91{
92 return theData->RowLength();
93}
94
95 Standard_Integer IGESAppli_NodalResults::NodeIdentifier
96 (const Standard_Integer Index) const
97{
98 return theNodeIdentifiers->Value(Index);
99}
100
101 Standard_Real IGESAppli_NodalResults::Data
102 (const Standard_Integer NodeNum, const Standard_Integer DataNum) const
103{
104 return theData->Value(NodeNum,DataNum);
105}