0029915: Porting to VC 2017 : Regressions in Modeling Algorithms on VC 2017
[occt.git] / src / RWStepElement / RWStepElement_RWCurveElementSectionDerivedDefinitions.cxx
1 // Created on: 2002-12-12
2 // Created by: data exchange team
3 // Copyright (c) 2002-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 // Generator:   ExpToCas (EXPRESS -> CASCADE/XSTEP Translator) V1.2
17
18 #include <Interface_Check.hxx>
19 #include <Interface_EntityIterator.hxx>
20 #include <RWStepElement_RWCurveElementSectionDerivedDefinitions.hxx>
21 #include <Standard_Real.hxx>
22 #include <StepData_StepReaderData.hxx>
23 #include <StepData_StepWriter.hxx>
24 #include <StepElement_CurveElementSectionDerivedDefinitions.hxx>
25 #include <StepElement_HArray1OfMeasureOrUnspecifiedValue.hxx>
26 #include <StepElement_MeasureOrUnspecifiedValue.hxx>
27 #include <TColStd_HArray1OfReal.hxx>
28
29 //=======================================================================
30 //function : RWStepElement_RWCurveElementSectionDerivedDefinitions
31 //purpose  : 
32 //=======================================================================
33 RWStepElement_RWCurveElementSectionDerivedDefinitions::RWStepElement_RWCurveElementSectionDerivedDefinitions ()
34 {
35 }
36
37 //=======================================================================
38 //function : ReadStep
39 //purpose  : 
40 //=======================================================================
41
42 void RWStepElement_RWCurveElementSectionDerivedDefinitions::ReadStep (const Handle(StepData_StepReaderData)& data,
43                                                                       const Standard_Integer num,
44                                                                       Handle(Interface_Check)& ach,
45                                                                       const Handle(StepElement_CurveElementSectionDerivedDefinitions) &ent) const
46 {
47   // Check number of parameters
48   if ( ! data->CheckNbParams(num,12,ach,"curve_element_section_derived_definitions") ) return;
49
50   // Inherited fields of CurveElementSectionDefinition
51
52   Handle(TCollection_HAsciiString) aCurveElementSectionDefinition_Description;
53   data->ReadString (num, 1, "curve_element_section_definition.description", ach, aCurveElementSectionDefinition_Description);
54
55   Standard_Real aCurveElementSectionDefinition_SectionAngle;
56   data->ReadReal (num, 2, "curve_element_section_definition.section_angle", ach, aCurveElementSectionDefinition_SectionAngle);
57
58   // Own fields of CurveElementSectionDerivedDefinitions
59
60   Standard_Real aCrossSectionalArea;
61   data->ReadReal (num, 3, "cross_sectional_area", ach, aCrossSectionalArea);
62
63   Handle(StepElement_HArray1OfMeasureOrUnspecifiedValue) aShearArea;
64   Standard_Integer sub4 = 0;
65   if ( data->ReadSubList (num, 4, "shear_area", ach, sub4) ) {
66     Standard_Integer nb0 = data->NbParams(sub4);
67     aShearArea = new StepElement_HArray1OfMeasureOrUnspecifiedValue (1, nb0);
68     Standard_Integer num2 = sub4;
69     for ( Standard_Integer i0=1; i0 <= nb0; i0++ ) {
70       StepElement_MeasureOrUnspecifiedValue anIt0;
71       data->ReadEntity (num2, i0, "measure_or_unspecified_value", ach, anIt0);
72       aShearArea->SetValue(i0, anIt0);
73     }
74   }
75
76   Handle(TColStd_HArray1OfReal) aSecondMomentOfArea;
77   Standard_Integer sub5 = 0;
78   if ( data->ReadSubList (num, 5, "second_moment_of_area", ach, sub5) ) {
79     Standard_Integer nb0 = data->NbParams(sub5);
80     aSecondMomentOfArea = new TColStd_HArray1OfReal (1, nb0);
81     Standard_Integer num2 = sub5;
82     for ( Standard_Integer i0=1; i0 <= nb0; i0++ ) {
83       Standard_Real anIt0;
84       data->ReadReal (num2, i0, "real", ach, anIt0);
85       aSecondMomentOfArea->SetValue(i0, anIt0);
86     }
87   }
88
89   Standard_Real aTorsionalConstant;
90   data->ReadReal (num, 6, "torsional_constant", ach, aTorsionalConstant);
91
92   StepElement_MeasureOrUnspecifiedValue aWarpingConstant;
93   data->ReadEntity (num, 7, "warping_constant", ach, aWarpingConstant);
94
95   Handle(StepElement_HArray1OfMeasureOrUnspecifiedValue) aLocationOfCentroid;
96   Standard_Integer sub8 = 0;
97   if ( data->ReadSubList (num, 8, "location_of_centroid", ach, sub8) ) {
98     Standard_Integer nb0 = data->NbParams(sub8);
99     aLocationOfCentroid = new StepElement_HArray1OfMeasureOrUnspecifiedValue (1, nb0);
100     Standard_Integer num2 = sub8;
101     for ( Standard_Integer i0=1; i0 <= nb0; i0++ ) {
102       StepElement_MeasureOrUnspecifiedValue anIt0;
103       data->ReadEntity (num2, i0, "measure_or_unspecified_value", ach, anIt0);
104       aLocationOfCentroid->SetValue(i0, anIt0);
105     }
106   }
107
108   Handle(StepElement_HArray1OfMeasureOrUnspecifiedValue) aLocationOfShearCentre;
109   Standard_Integer sub9 = 0;
110   if ( data->ReadSubList (num, 9, "location_of_shear_centre", ach, sub9) ) {
111     Standard_Integer nb0 = data->NbParams(sub9);
112     aLocationOfShearCentre = new StepElement_HArray1OfMeasureOrUnspecifiedValue (1, nb0);
113     Standard_Integer num2 = sub9;
114     for ( Standard_Integer i0=1; i0 <= nb0; i0++ ) {
115       StepElement_MeasureOrUnspecifiedValue anIt0;
116       data->ReadEntity (num2, i0, "measure_or_unspecified_value", ach, anIt0);
117       aLocationOfShearCentre->SetValue(i0, anIt0);
118     }
119   }
120
121   Handle(StepElement_HArray1OfMeasureOrUnspecifiedValue) aLocationOfNonStructuralMass;
122   Standard_Integer sub10 = 0;
123   if ( data->ReadSubList (num, 10, "location_of_non_structural_mass", ach, sub10) ) {
124     Standard_Integer nb0 = data->NbParams(sub10);
125     aLocationOfNonStructuralMass = new StepElement_HArray1OfMeasureOrUnspecifiedValue (1, nb0);
126     Standard_Integer num2 = sub10;
127     for ( Standard_Integer i0=1; i0 <= nb0; i0++ ) {
128       StepElement_MeasureOrUnspecifiedValue anIt0;
129       data->ReadEntity (num2, i0, "measure_or_unspecified_value", ach, anIt0);
130       aLocationOfNonStructuralMass->SetValue(i0, anIt0);
131     }
132   }
133
134   StepElement_MeasureOrUnspecifiedValue aNonStructuralMass;
135   data->ReadEntity (num, 11, "non_structural_mass", ach, aNonStructuralMass);
136
137   StepElement_MeasureOrUnspecifiedValue aPolarMoment;
138   data->ReadEntity (num, 12, "polar_moment", ach, aPolarMoment);
139
140   // Initialize entity
141   ent->Init(aCurveElementSectionDefinition_Description,
142             aCurveElementSectionDefinition_SectionAngle,
143             aCrossSectionalArea,
144             aShearArea,
145             aSecondMomentOfArea,
146             aTorsionalConstant,
147             aWarpingConstant,
148             aLocationOfCentroid,
149             aLocationOfShearCentre,
150             aLocationOfNonStructuralMass,
151             aNonStructuralMass,
152             aPolarMoment);
153 }
154
155 //=======================================================================
156 //function : WriteStep
157 //purpose  : 
158 //=======================================================================
159
160 void RWStepElement_RWCurveElementSectionDerivedDefinitions::WriteStep (StepData_StepWriter& SW,
161                                                                        const Handle(StepElement_CurveElementSectionDerivedDefinitions) &ent) const
162 {
163
164   // Inherited fields of CurveElementSectionDefinition
165
166   SW.Send (ent->StepElement_CurveElementSectionDefinition::Description());
167
168   SW.Send (ent->StepElement_CurveElementSectionDefinition::SectionAngle());
169
170   // Own fields of CurveElementSectionDerivedDefinitions
171
172   SW.Send (ent->CrossSectionalArea());
173
174   SW.OpenSub();
175   for (Standard_Integer i3=1; i3 <= ent->ShearArea()->Length(); i3++ ) {
176     StepElement_MeasureOrUnspecifiedValue Var0 = ent->ShearArea()->Value(i3);
177     SW.Send (Var0.Value());
178   }
179   SW.CloseSub();
180
181   SW.OpenSub();
182   for (Standard_Integer i4=1; i4 <= ent->SecondMomentOfArea()->Length(); i4++ ) {
183     Standard_Real Var0 = ent->SecondMomentOfArea()->Value(i4);
184     SW.Send (Var0);
185   }
186   SW.CloseSub();
187
188   SW.Send (ent->TorsionalConstant());
189
190   SW.Send (ent->WarpingConstant().Value());
191
192   SW.OpenSub();
193   for (Standard_Integer i7=1; i7 <= ent->LocationOfCentroid()->Length(); i7++ ) {
194     StepElement_MeasureOrUnspecifiedValue Var0 = ent->LocationOfCentroid()->Value(i7);
195     SW.Send (Var0.Value());
196   }
197   SW.CloseSub();
198
199   SW.OpenSub();
200   for (Standard_Integer i8=1; i8 <= ent->LocationOfShearCentre()->Length(); i8++ ) {
201     StepElement_MeasureOrUnspecifiedValue Var0 = ent->LocationOfShearCentre()->Value(i8);
202     SW.Send (Var0.Value());
203   }
204   SW.CloseSub();
205
206   SW.OpenSub();
207   for (Standard_Integer i9=1; i9 <= ent->LocationOfNonStructuralMass()->Length(); i9++ ) {
208     StepElement_MeasureOrUnspecifiedValue Var0 = ent->LocationOfNonStructuralMass()->Value(i9);
209     SW.Send (Var0.Value());
210   }
211   SW.CloseSub();
212
213   SW.Send (ent->NonStructuralMass().Value());
214
215   SW.Send (ent->PolarMoment().Value());
216 }
217
218 //=======================================================================
219 //function : Share
220 //purpose  : 
221 //=======================================================================
222
223 void RWStepElement_RWCurveElementSectionDerivedDefinitions::Share (const Handle(StepElement_CurveElementSectionDerivedDefinitions) &ent,
224                                                                    Interface_EntityIterator& iter) const
225 {
226
227   // Inherited fields of CurveElementSectionDefinition
228
229   // Own fields of CurveElementSectionDerivedDefinitions
230
231   for (Standard_Integer i1=1; i1 <= ent->ShearArea()->Length(); i1++ ) {
232     StepElement_MeasureOrUnspecifiedValue Var0 = ent->ShearArea()->Value(i1);
233     iter.AddItem (Var0.Value());
234   }
235
236   iter.AddItem (ent->WarpingConstant().Value());
237
238   for (Standard_Integer i3=1; i3 <= ent->LocationOfCentroid()->Length(); i3++ ) {
239     StepElement_MeasureOrUnspecifiedValue Var0 = ent->LocationOfCentroid()->Value(i3);
240     iter.AddItem (Var0.Value());
241   }
242
243   for (Standard_Integer i4=1; i4 <= ent->LocationOfShearCentre()->Length(); i4++ ) {
244     StepElement_MeasureOrUnspecifiedValue Var0 = ent->LocationOfShearCentre()->Value(i4);
245     iter.AddItem (Var0.Value());
246   }
247
248   for (Standard_Integer i5=1; i5 <= ent->LocationOfNonStructuralMass()->Length(); i5++ ) {
249     StepElement_MeasureOrUnspecifiedValue Var0 = ent->LocationOfNonStructuralMass()->Value(i5);
250     iter.AddItem (Var0.Value());
251   }
252
253   iter.AddItem (ent->NonStructuralMass().Value());
254
255   iter.AddItem (ent->PolarMoment().Value());
256 }