summaryrefslogtreecommitdiff
path: root/src/IGESAppli/IGESAppli_ToolFiniteElement.cxx
blob: 608071865031daf0b93e02b40d962f94a077f83f (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
//--------------------------------------------------------------------
//
//  File Name : IGESAppli_FiniteElement.cxx
//  Date      :
//  Author    : CKY / Contract Toubro-Larsen
//  Copyright : MATRA-DATAVISION 1993
//
//--------------------------------------------------------------------

#include <IGESAppli_ToolFiniteElement.ixx>
#include <IGESData_ParamCursor.hxx>
#include <IGESAppli_Node.hxx>
#include <IGESAppli_HArray1OfNode.hxx>
#include <TCollection_HAsciiString.hxx>
#include <IGESData_Dump.hxx>
#include <Interface_Macros.hxx>


IGESAppli_ToolFiniteElement::IGESAppli_ToolFiniteElement ()    {  }


void  IGESAppli_ToolFiniteElement::ReadOwnParams
  (const Handle(IGESAppli_FiniteElement)& ent,
   const Handle(IGESData_IGESReaderData)& IR, IGESData_ParamReader& PR) const
{
  Standard_Integer tempTopology;
  Handle(TCollection_HAsciiString) tempName;
  Standard_Integer nbval = 0;
  //Standard_Boolean st; //szv#4:S4163:12Mar99 not needed
  Handle(IGESAppli_HArray1OfNode) tempData;

  //szv#4:S4163:12Mar99 `st=` not needed
  PR.ReadInteger(PR.Current(),"Topology type",tempTopology);
  PR.ReadInteger(PR.Current(),"No. of nodes defining element",nbval);
  tempData = new IGESAppli_HArray1OfNode(1,nbval);
  for (Standard_Integer i = 1; i <= nbval; i ++)
    {
      Handle(IGESAppli_Node) tempNode;
      //szv#4:S4163:12Mar99 moved in if
      if (PR.ReadEntity (IR,PR.Current(),"Node defining element", STANDARD_TYPE(IGESAppli_Node),tempNode))
	tempData->SetValue(i,tempNode);
    }
  PR.ReadText(PR.Current(),"Element type name",tempName); //szv#4:S4163:12Mar99 `st=` not needed

  DirChecker(ent).CheckTypeAndForm(PR.CCheck(),ent);
  ent->Init(tempTopology,tempData,tempName);
}

void  IGESAppli_ToolFiniteElement::WriteOwnParams
  (const Handle(IGESAppli_FiniteElement)& ent, IGESData_IGESWriter& IW) const
{
  Standard_Integer upper = ent->NbNodes();
  IW.Send(ent->Topology());
  IW.Send(upper);
  for (Standard_Integer i= 1; i <= upper ; i ++)
    IW.Send(ent->Node(i));
  IW.Send(ent->Name());
}

void  IGESAppli_ToolFiniteElement::OwnShared
  (const Handle(IGESAppli_FiniteElement)& ent, Interface_EntityIterator& iter) const
{
  Standard_Integer upper = ent->NbNodes();
  for (Standard_Integer i= 1; i <= upper ; i ++)
    iter.GetOneItem(ent->Node(i));
}

void  IGESAppli_ToolFiniteElement::OwnCopy
  (const Handle(IGESAppli_FiniteElement)& another,
   const Handle(IGESAppli_FiniteElement)& ent, Interface_CopyTool& TC) const
{
  Standard_Integer aTopology = another->Topology();
  Handle(TCollection_HAsciiString) aName =
    new TCollection_HAsciiString(another->Name());
  Standard_Integer nbval = another->NbNodes();
  Handle(IGESAppli_HArray1OfNode) aList = new
    IGESAppli_HArray1OfNode(1,nbval);
  for (Standard_Integer i=1;i <=nbval;i++)
    {
      DeclareAndCast(IGESAppli_Node,aEntity,TC.Transferred(another->Node(i)));
      aList->SetValue(i,aEntity);
    }
  ent->Init(aTopology,aList,aName);
}

IGESData_DirChecker  IGESAppli_ToolFiniteElement::DirChecker
  (const Handle(IGESAppli_FiniteElement)& /* ent */ ) const
{
  IGESData_DirChecker DC(136,0);  //Form no = 0 & Type = 136
  DC.Structure(IGESData_DefVoid);
  DC.LineFont(IGESData_DefAny);
  DC.LineWeight(IGESData_DefVoid);
  DC.Color(IGESData_DefAny);
  DC.BlankStatusIgnored();
  DC.SubordinateStatusIgnored();
  DC.UseFlagIgnored();
  DC.HierarchyStatusIgnored();
  return DC;
}

void  IGESAppli_ToolFiniteElement::OwnCheck
  (const Handle(IGESAppli_FiniteElement)& /* ent */,
   const Interface_ShareTool& , Handle(Interface_Check)& /* ach */) const
{
}

void  IGESAppli_ToolFiniteElement::OwnDump
  (const Handle(IGESAppli_FiniteElement)& ent, const IGESData_IGESDumper& dumper,
   const Handle(Message_Messenger)& S, const Standard_Integer level) const
{
  S << "IGESAppli_FiniteElement" << endl;

  S << "Topology type : " << ent->Topology() << endl;
  S << "Nodes : ";
  IGESData_DumpEntities(S,dumper ,level,1, ent->NbNodes(),ent->Node);
  S << endl << "Element Name : " << ent->Name();
  S << endl;
}