summaryrefslogtreecommitdiff
path: root/src/IGESDefs/IGESDefs_TabularData.cxx
blob: 97ee31288dbbc8d3e86d91fd43093e4f06805ea6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
//--------------------------------------------------------------------
//
//  File Name : IGESDefs_TabularData.cxx
//  Date      :
//  Author    : CKY / Contract Toubro-Larsen
//  Copyright : MATRA-DATAVISION 1993
//
//--------------------------------------------------------------------

// UNFINISHED
// The last field (theDependentValues) not resolved. Queried to mdtv

#include <IGESDefs_TabularData.ixx>
#include <Standard_DimensionMismatch.hxx>
#include <TColStd_HArray1OfReal.hxx>


    IGESDefs_TabularData::IGESDefs_TabularData ()    {  }


    void IGESDefs_TabularData::Init
  (const Standard_Integer nbProps,
   const Standard_Integer propType,
/*     const Standard_Integer nbDeps, */
/*     const Standard_Integer nbIndeps, */
   const Handle(TColStd_HArray1OfInteger)& typesInd,
   const Handle(TColStd_HArray1OfInteger)& nbValuesInd,
   const Handle(IGESBasic_HArray1OfHArray1OfReal)& valuesInd,
   const Handle(IGESBasic_HArray1OfHArray1OfReal)& valuesDep)
{
  Standard_Integer num = typesInd->Length();
  if (typesInd->Lower() != 1 ||
      nbValuesInd->Lower() != 1 || nbValuesInd->Length() != num ||
      valuesInd->Lower()   != 1 || valuesInd->Length()   != num ||
      valuesDep->Lower()   != 1 )
    Standard_DimensionMismatch::Raise("IGESDefs_TabularData : Init");
  theNbPropertyValues = nbProps;
  thePropertyType               = propType;
/*     theNbDependents = nbDeps; */
/*     theNbIndependents = nbIndeps; */
  theTypeOfIndependentVariables = typesInd;
  theNbValues                   = nbValuesInd;
  theIndependentValues          = valuesInd;
  theDependentValues            = valuesDep;
  InitTypeAndForm(406,11);
}

    Standard_Integer IGESDefs_TabularData::NbPropertyValues () const
{
  return theNbPropertyValues;
}

    Standard_Integer IGESDefs_TabularData::ComputedNbPropertyValues () const
{
  return theNbPropertyValues;  // pas malin ... a ameliorer
}

    Standard_Boolean IGESDefs_TabularData::OwnCorrect ()
{
  Standard_Integer newnb = ComputedNbPropertyValues();
  if (newnb == theNbPropertyValues) return Standard_False;
  theNbPropertyValues = newnb;
  return Standard_True;
}


    Standard_Integer IGESDefs_TabularData::PropertyType () const
{
  return thePropertyType;
}

    Standard_Integer IGESDefs_TabularData::NbDependents () const
{
  return theDependentValues->Length();
}

    Standard_Integer IGESDefs_TabularData::NbIndependents () const
{
  return theTypeOfIndependentVariables->Length();
}

    Standard_Integer IGESDefs_TabularData::TypeOfIndependents
  (const Standard_Integer num) const
{
  return theTypeOfIndependentVariables->Value(num);
}

    Standard_Integer IGESDefs_TabularData::NbValues (const Standard_Integer num) const
{
  return theNbValues->Value(num);
}

    Standard_Real IGESDefs_TabularData::IndependentValue
  (const Standard_Integer variablenum, const Standard_Integer valuenum) const
{
  return (theIndependentValues->Value(variablenum))->Value(valuenum);
}

    Handle(TColStd_HArray1OfReal)  IGESDefs_TabularData::DependentValues
  (const Standard_Integer num) const
{
  return theDependentValues->Value(num);
}

// UNFINISHED
// Array limits not sure.
    Standard_Real IGESDefs_TabularData::DependentValue
  (const Standard_Integer variablenum, const Standard_Integer valuenum) const
{
  Standard_Real val = 0.;
#if 0
  Standard_Integer sum = 0;
  for (Standard_Integer i = 1; i < variablenum; i++)
    {
      sum += theNbValues->Value(i);
    }
  sum += valuenum;
  val = theDependentValues->Value(sum);
#endif
  return val;
}