Integration of OCCT 6.5.0 from SVN
[occt.git] / src / RWStepFEA / RWStepFEA_RWFeaModel.cxx
1 // File:        RWStepFEA_RWFeaModel.cxx
2 // Created:     Thu Dec 12 17:51:05 2002 
3 // Author:      data exchange team
4 // Generator:   ExpToCas (EXPRESS -> CASCADE/XSTEP Translator) V1.2
5 // Copyright:   Open CASCADE 2002
6
7 #include <RWStepFEA_RWFeaModel.ixx>
8 #include <StepRepr_HArray1OfRepresentationItem.hxx>
9 #include <StepRepr_RepresentationItem.hxx>
10 #include <TColStd_HArray1OfAsciiString.hxx>
11 #include <TCollection_HAsciiString.hxx>
12
13 //=======================================================================
14 //function : RWStepFEA_RWFeaModel
15 //purpose  : 
16 //=======================================================================
17
18 RWStepFEA_RWFeaModel::RWStepFEA_RWFeaModel ()
19 {
20 }
21
22 //=======================================================================
23 //function : ReadStep
24 //purpose  : 
25 //=======================================================================
26
27 void RWStepFEA_RWFeaModel::ReadStep (const Handle(StepData_StepReaderData)& data,
28                                      const Standard_Integer num,
29                                      Handle(Interface_Check)& ach,
30                                      const Handle(StepFEA_FeaModel) &ent) const
31 {
32   // Check number of parameters
33   if ( ! data->CheckNbParams(num,7,ach,"fea_model") ) return;
34
35   // Inherited fields of Representation
36
37   Handle(TCollection_HAsciiString) aRepresentation_Name;
38   data->ReadString (num, 1, "representation.name", ach, aRepresentation_Name);
39
40   Handle(StepRepr_HArray1OfRepresentationItem) aRepresentation_Items;
41   Standard_Integer sub2 = 0;
42   if ( data->ReadSubList (num, 2, "representation.items", ach, sub2) ) {
43     Standard_Integer nb0 = data->NbParams(sub2);
44     aRepresentation_Items = new StepRepr_HArray1OfRepresentationItem (1, nb0);
45     Standard_Integer num2 = sub2;
46     for ( Standard_Integer i0=1; i0 <= nb0; i0++ ) {
47       Handle(StepRepr_RepresentationItem) anIt0;
48       data->ReadEntity (num2, i0, "representation_item", ach, STANDARD_TYPE(StepRepr_RepresentationItem), anIt0);
49       aRepresentation_Items->SetValue(i0, anIt0);
50     }
51   }
52
53   Handle(StepRepr_RepresentationContext) aRepresentation_ContextOfItems;
54   data->ReadEntity (num, 3, "representation.context_of_items", ach, STANDARD_TYPE(StepRepr_RepresentationContext), aRepresentation_ContextOfItems);
55
56   // Own fields of FeaModel
57
58   Handle(TCollection_HAsciiString) aCreatingSoftware;
59   data->ReadString (num, 4, "creating_software", ach, aCreatingSoftware);
60
61   Handle(TColStd_HArray1OfAsciiString) aIntendedAnalysisCode;
62   Standard_Integer sub5 = 0;
63   if ( data->ReadSubList (num, 5, "intended_analysis_code", ach, sub5) ) {
64     Standard_Integer nb0 = data->NbParams(sub5);
65     aIntendedAnalysisCode = new TColStd_HArray1OfAsciiString (1, nb0);
66     Standard_Integer num2 = sub5;
67     for ( Standard_Integer i0=1; i0 <= nb0; i0++ ) {
68       Handle(TCollection_HAsciiString) anIt0;
69       data->ReadString (num2, i0, "h_ascii_string", ach, anIt0);
70       aIntendedAnalysisCode->SetValue(i0, anIt0->String());
71     }
72   }
73
74   Handle(TCollection_HAsciiString) aDescription;
75   data->ReadString (num, 6, "description", ach, aDescription);
76
77   Handle(TCollection_HAsciiString) aAnalysisType;
78   data->ReadString (num, 7, "analysis_type", ach, aAnalysisType);
79
80   // Initialize entity
81   ent->Init(aRepresentation_Name,
82             aRepresentation_Items,
83             aRepresentation_ContextOfItems,
84             aCreatingSoftware,
85             aIntendedAnalysisCode,
86             aDescription,
87             aAnalysisType);
88 }
89
90 //=======================================================================
91 //function : WriteStep
92 //purpose  : 
93 //=======================================================================
94
95 void RWStepFEA_RWFeaModel::WriteStep (StepData_StepWriter& SW,
96                                       const Handle(StepFEA_FeaModel) &ent) const
97 {
98
99   // Inherited fields of Representation
100
101   SW.Send (ent->StepRepr_Representation::Name());
102
103   SW.OpenSub();
104   for (Standard_Integer i1=1; i1 <= ent->StepRepr_Representation::Items()->Length(); i1++ ) {
105     Handle(StepRepr_RepresentationItem) Var0 = ent->StepRepr_Representation::Items()->Value(i1);
106     SW.Send (Var0);
107   }
108   SW.CloseSub();
109
110   SW.Send (ent->StepRepr_Representation::ContextOfItems());
111
112   // Own fields of FeaModel
113
114   SW.Send (ent->CreatingSoftware());
115
116   SW.OpenSub();
117   for (Standard_Integer i4=1; i4 <= ent->IntendedAnalysisCode()->Length(); i4++ ) {
118     Handle(TCollection_HAsciiString) Var0 = 
119       new TCollection_HAsciiString(ent->IntendedAnalysisCode()->Value(i4));
120     SW.Send (Var0);
121   }
122   SW.CloseSub();
123
124   SW.Send (ent->Description());
125
126   SW.Send (ent->AnalysisType());
127 }
128
129 //=======================================================================
130 //function : Share
131 //purpose  : 
132 //=======================================================================
133
134 void RWStepFEA_RWFeaModel::Share (const Handle(StepFEA_FeaModel) &ent,
135                                   Interface_EntityIterator& iter) const
136 {
137
138   // Inherited fields of Representation
139
140   for (Standard_Integer i1=1; i1 <= ent->StepRepr_Representation::Items()->Length(); i1++ ) {
141     Handle(StepRepr_RepresentationItem) Var0 = ent->StepRepr_Representation::Items()->Value(i1);
142     iter.AddItem (Var0);
143   }
144
145   iter.AddItem (ent->StepRepr_Representation::ContextOfItems());
146
147   // Own fields of FeaModel
148 }