g4tools  5.4.0
Public Member Functions | List of all members
tools::hep::sf_polyhedron Class Reference
Inheritance diagram for tools::hep::sf_polyhedron:
Inheritance graph
[legend]
Collaboration diagram for tools::hep::sf_polyhedron:
Collaboration graph
[legend]

Public Member Functions

virtual bool write (io::iwbuf &a_buffer)
 
virtual bool read (io::irbuf &a_buffer)
 
virtual bool dump (std::ostream &)
 
virtual bool s_value (std::string &a_s) const
 
virtual bool s2value (const std::string &)
 
 sf_polyhedron ()
 
 sf_polyhedron (const polyhedron &a_value)
 
virtual ~sf_polyhedron ()
 
 sf_polyhedron (const sf_polyhedron &a_from)
 
sf_polyhedronoperator= (const sf_polyhedron &a_from)
 
sf_polyhedronoperator= (const polyhedron &a_value)
 
- Public Member Functions inherited from tools::sg::bsf< polyhedron >
virtual void * cast (const std::string &a_class) const
 
virtual const std::string & s_cls () const
 
 bsf (const polyhedron &a_value)
 
 bsf (const bsf &a_from)
 
virtual ~bsf ()
 
bsfoperator= (const bsf &a_from)
 
bsfoperator= (const polyhedron &a_value)
 
bool operator== (const bsf &a_from) const
 
bool operator== (const polyhedron &a_value) const
 
bool operator!= (const bsf &a_from) const
 
bool operator!= (const polyhedron &a_value) const
 
 operator const polyhedron & () const
 
 operator polyhedron ()
 
polyhedronvalue ()
 
const polyhedronvalue () const
 
void value (const polyhedron &a_value)
 
void value_no_cmp (const polyhedron &a_value)
 
void setValue (const polyhedron &a_value)
 
const polyhedrongetValue () const
 
- Public Member Functions inherited from tools::sg::field
virtual const std::string & s_cls () const =0
 
virtual ~field ()
 
void touch ()
 
bool touched () const
 
void reset_touched ()
 

Additional Inherited Members

- Static Public Member Functions inherited from tools::sg::bsf< polyhedron >
static const std::string & s_class ()
 
- Protected Member Functions inherited from tools::sg::bsf< polyhedron >
 bsf ()
 
- Protected Member Functions inherited from tools::sg::field
 field ()
 
 field (const field &)
 
fieldoperator= (const field &)
 
- Protected Attributes inherited from tools::sg::bsf< polyhedron >
polyhedron m_value
 
- Protected Attributes inherited from tools::sg::field
bool m_touched
 

Detailed Description

Definition at line 17 of file sf_polyhedron.

Constructor & Destructor Documentation

◆ sf_polyhedron() [1/3]

tools::hep::sf_polyhedron::sf_polyhedron ( )
inline

Definition at line 98 of file sf_polyhedron.

98 :parent(){}

◆ sf_polyhedron() [2/3]

tools::hep::sf_polyhedron::sf_polyhedron ( const polyhedron a_value)
inline

Definition at line 99 of file sf_polyhedron.

99 :parent(a_value){}

◆ ~sf_polyhedron()

virtual tools::hep::sf_polyhedron::~sf_polyhedron ( )
inlinevirtual

Definition at line 100 of file sf_polyhedron.

100 {}

◆ sf_polyhedron() [3/3]

tools::hep::sf_polyhedron::sf_polyhedron ( const sf_polyhedron a_from)
inline

Definition at line 102 of file sf_polyhedron.

102 :parent(a_from){}

Member Function Documentation

◆ dump()

virtual bool tools::hep::sf_polyhedron::dump ( std::ostream &  )
inlinevirtual

Implements tools::sg::field.

Definition at line 92 of file sf_polyhedron.

92  {
93  return true;
94  }

◆ operator=() [1/2]

sf_polyhedron& tools::hep::sf_polyhedron::operator= ( const polyhedron a_value)
inline

Definition at line 108 of file sf_polyhedron.

108  {
109  parent::operator=(a_value);
110  return *this;
111  }

◆ operator=() [2/2]

sf_polyhedron& tools::hep::sf_polyhedron::operator= ( const sf_polyhedron a_from)
inline

Definition at line 103 of file sf_polyhedron.

103  {
104  parent::operator=(a_from);
105  return *this;
106  }

◆ read()

virtual bool tools::hep::sf_polyhedron::read ( io::irbuf a_buffer)
inlinevirtual

Implements tools::sg::field.

Definition at line 56 of file sf_polyhedron.

56  {
57  double* ds;
58  uint32 sz;
59  if(!a_buffer.read_vec(sz,ds)) return false;
60  uint32 di=0;
61  //FIXME : check di vs sz.
62 
63  int nvert = (int)ds[di];di++;
64  HVPoint3D* pV = new HVPoint3D[nvert+1];
65  for(int index=1;index<=nvert;index++) {
66  HVPoint3D& p = pV[index];
67  p[0] = ds[di];di++;
68  p[1] = ds[di];di++;
69  p[2] = ds[di];di++;
70  }
71 
72  int nface = (int)ds[di];di++;
73  SbFacet* pF = new SbFacet[nface+1];
74  int v[8];
75  for(int index=1;index<=nface;index++) {
76  SbFacet& fc = pF[index];
77  for(int i=0;i<8;i++) {
78  v[i] = (int)ds[di];di++;
79  }
80  fc.Set(v);
81  }
82 
83  m_value.Set(nvert,pV,nface,pF); //it takes ownership of pV,pF.
84 
85  delete [] ds;
86 #ifdef TOOLS_MEM
87  mem::decrement(s_new().c_str());
88 #endif
89 
90  return true;
91  }

◆ s2value()

virtual bool tools::hep::sf_polyhedron::s2value ( const std::string &  )
inlinevirtual

Implements tools::sg::field.

Definition at line 96 of file sf_polyhedron.

96 {return false;}

◆ s_value()

virtual bool tools::hep::sf_polyhedron::s_value ( std::string &  a_s) const
inlinevirtual

Implements tools::sg::field.

Definition at line 95 of file sf_polyhedron.

95 {a_s.clear();return false;}

◆ write()

virtual bool tools::hep::sf_polyhedron::write ( io::iwbuf a_buffer)
inlinevirtual

Implements tools::sg::field.

Definition at line 20 of file sf_polyhedron.

20  {
21  //FIXME : write fNumberOfSteps ?
22 
23  int nvert = m_value.GetNoVertices();
24  int nface = m_value.GetNoFacets();
25  double* ds = new double[1+3*nvert+1+8*nface];
26  uint32 di=0;
27 
28  {ds[di] = nvert;di++;
29  HVPoint3D* pV = m_value.GetPV();
30  for(int index=1;index<=nvert;index++) { //CERN still in FORTRAN...
31  HVPoint3D& p = pV[index];
32  ds[di] = p[0];di++;
33  ds[di] = p[1];di++;
34  ds[di] = p[2];di++;
35  }}
36 
37  {ds[di] = nface;di++;
38  SbFacet* pF = m_value.GetPF();
39  int v,f;
40  for(int index=1;index<=nface;index++) {
41  SbFacet& fc = pF[index]; //yes, yes +1
42  for(int i=0;i<4;i++) {
43  fc.GetEdge(i,v,f);
44  ds[di] = v;di++;
45  ds[di] = f;di++;
46  }
47  }}
48 
49  bool status = a_buffer.write_vec(di,ds);
50 
51  delete [] ds;
52 
53  return status;
54  }

The documentation for this class was generated from the following file:
tools::sg::bsf< polyhedron >::m_value
polyhedron m_value
Definition: bsf:120
tools::hep::HVPoint3D
vec3d HVPoint3D
Definition: polyhedron:37
tools::sg::field::operator=
field & operator=(const field &)
Definition: field:57
tools::uint32
unsigned int uint32
Definition: typedefs:71