I have many data structures for my fem program. For example, I have a Rectangular section which is defined by Width and Height. and It has several properties such as Area, Ixx, Iyy and so on.
It seems to me that there are two choices that can be used. One is like this
The other is to subclass TDF_Attribute:
which I dont know exactly how to do.
Which one is better do you think ?
I have a few hundred of these data structures. For example cross section can be rectangle, circular, T shaped, general and so on.
Then there is the material classes, isometric, linear, nonlinear and so on
and many other objects. Which method makes more sense ?
It seems to me that there are two choices that can be used. One is like this
Code:
class IData
{
private:
TDF_Label root;
TDF_Label t2;
TDF_Label t3;
TDataStd_RealArray prop; //(A, A2s, A3s, J, I22, I33, S22, S33, R22, R33)
public:
IData(const TDF_Label& label) : root(label)
{
TDataStd_Name::Set(label, "Rectangle");
t2 = label.FindChild(1);
t3 = label.FindChild(2);
}
IData(const TDF_Label& label, float T2, float T3) : root(label)
{
TDataStd_Name::Set(label, "Rectangle");
t2 = label.FindChild(1);
t3 = label.FindChild(2);
TDataStd_Name::Set(t2, "Width");
TDataStd_Name::Set(t3, "Height");
TDataStd_Real::Set(t2, double(T2));
TDataStd_Real::Set(t3, double(T3));
// also fill in the properities A, ...
}
float getT2(){} // get T2
float getT3(){} // get T3
double getA() {}
double getJ() {}
double getI22() {}
double getI33() {}
double getR22() {}
double getR33() {} // and so on ...
};
The other is to subclass TDF_Attribute:
Code:
class IData : public TDF_attribute
{
...
}
which I dont know exactly how to do.
Which one is better do you think ?
I have a few hundred of these data structures. For example cross section can be rectangle, circular, T shaped, general and so on.
Then there is the material classes, isometric, linear, nonlinear and so on
and many other objects. Which method makes more sense ?
Last edited by a moderator: