CMS 3D CMS Logo

Public Member Functions | Private Attributes

DDI::LogicalPart Class Reference

#include <LogicalPart.h>

List of all members.

Public Member Functions

void addSpecifics (const std::pair< DDPartSelection *, DDsvalues_type * > &)
const std::vector< std::pair
< DDPartSelection
*, DDsvalues_type * > > & 
attachedSpecifics () const
DDEnums::Category category () const
bool hasDDValue (const DDValue &) const
 LogicalPart (const DDMaterial &, const DDSolid &, DDEnums::Category=DDEnums::unspecified)
const DDMaterialmaterial () const
DDsvalues_type mergedSpecifics () const
void mergedSpecificsV (DDsvalues_type &res) const
void removeSpecifics (const std::pair< DDPartSelection *, DDsvalues_type * > &)
const DDSolidsolid () const
std::vector< const
DDsvalues_type * > 
specifics () const
void specificsV (std::vector< const DDsvalues_type * > &result) const
void stream (std::ostream &)
double & weight ()

Private Attributes

DDEnums::Category cat_
std::vector< bool > hasDDValue_
DDMaterial material_
DDSolid solid_
std::vector< std::pair
< DDPartSelection
*, DDsvalues_type * > > 
specifics_
std::map< DDValue, std::vector
< DDPartSelection * > > 
valToParsel_
double weight_

Detailed Description

Definition at line 18 of file LogicalPart.h.


Constructor & Destructor Documentation

LogicalPart::LogicalPart ( const DDMaterial m,
const DDSolid s,
DDEnums::Category  c = DDEnums::unspecified 
)

Definition at line 11 of file LogicalPart.cc.

 : material_(m), solid_(s), cat_(c), weight_(0), specifics_(0), hasDDValue_(1,false)
{ }

Member Function Documentation

void LogicalPart::addSpecifics ( const std::pair< DDPartSelection *, DDsvalues_type * > &  s)

Definition at line 30 of file LogicalPart.cc.

References benchmark_cfg::cerr, DCOUT, hasDDValue_, DDValue::name(), specifics_, and DDValue::strings().

{
  if ( ! (s.first && s.second) ) {
    // FIXME
    std::cerr << "LogicalPart::addSpecific error pointer 0 " 
              << s.first << "," << s.second << std::endl;
    return;
  }
  specifics_.push_back(s);
  DDsvalues_type::const_iterator it = s.second->begin();
  DDsvalues_type::const_iterator ed = s.second->end();
  for (; it != ed; ++it) {
    unsigned int id = it->first;
    if ( id < hasDDValue_.size() ) {
      hasDDValue_[id] = true;
    }
    else {
      hasDDValue_.resize(id+1,false);
      hasDDValue_[id] = true;
    }
    
    DCOUT('S', "hasValue_.size()=" << hasDDValue_.size() << " DDValue_id=" << id << std::flush
          << " DDValue_name=" << DDValue(id).name() << std::flush 
           << " DDValue_string=" << DDValue(id).strings().size() );
  }
}
const std::vector<std::pair< DDPartSelection*, DDsvalues_type* > >& DDI::LogicalPart::attachedSpecifics ( ) const [inline]

Definition at line 34 of file LogicalPart.h.

References specifics_.

{ return specifics_; }
DDEnums::Category LogicalPart::category ( ) const

Definition at line 22 of file LogicalPart.cc.

References cat_.

{ return cat_; }
bool LogicalPart::hasDDValue ( const DDValue v) const

Definition at line 57 of file LogicalPart.cc.

References hasDDValue_, DDValue::id(), and query::result.

{
   bool result = false;
   unsigned int id = v.id();
   if ( id < hasDDValue_.size()) {
     result = hasDDValue_[id];
   }
   return result; 
}
const DDMaterial & LogicalPart::material ( ) const

Definition at line 20 of file LogicalPart.cc.

References material_.

Referenced by stream().

{ return material_; }
DDsvalues_type LogicalPart::mergedSpecifics ( ) const

Definition at line 96 of file LogicalPart.cc.

References mergedSpecificsV().

                                                  {
  DDsvalues_type merged;
  mergedSpecificsV(merged);  
  return merged;
}
void LogicalPart::mergedSpecificsV ( DDsvalues_type res) const

Definition at line 103 of file LogicalPart.cc.

References relval_steps::merge(), and specificsV().

Referenced by mergedSpecifics().

                                                                {
  merged.clear();
  std::vector<const DDsvalues_type *> unmerged; specificsV(unmerged);
  if (unmerged.size()==1) {
    merged = *(unmerged[0]);
  }
  else if (unmerged.size()>1) {
    std::vector<const DDsvalues_type *>::const_iterator it = unmerged.begin();
    std::vector<const DDsvalues_type *>::const_iterator ed = unmerged.end();
    for (; it != ed; ++it) {
      merge(merged, **it);
    } 
  }
}  
void LogicalPart::removeSpecifics ( const std::pair< DDPartSelection *, DDsvalues_type * > &  s)

Definition at line 67 of file LogicalPart.cc.

References spr::find(), asciidump::s, and specifics_.

{
   std::vector<std::pair<DDPartSelection*,DDsvalues_type* > >::iterator it = 
     std::find(specifics_.begin(),specifics_.end(),s);
   specifics_.erase(it);
}
const DDSolid & LogicalPart::solid ( ) const

Definition at line 21 of file LogicalPart.cc.

References solid_.

Referenced by stream().

{ return solid_; }
std::vector< const DDsvalues_type * > LogicalPart::specifics ( ) const

Definition at line 75 of file LogicalPart.cc.

References query::result, and specificsV().

{
   std::vector<const DDsvalues_type*> result;
   specificsV(result);
   return result;

}
void LogicalPart::specificsV ( std::vector< const DDsvalues_type * > &  result) const

Definition at line 83 of file LogicalPart.cc.

References ddanylogp, and specifics_.

Referenced by mergedSpecificsV(), and specifics().

{
  typedef std::vector<std::pair<DDPartSelection*,DDsvalues_type* > > sp_type;
  sp_type::const_iterator it = specifics_.begin();
  sp_type::const_iterator ed = specifics_.end();
  for (; it != ed; ++it) {
    DDPartSelection & ps = *(it->first);
    if (ps.size()==1 && ps[0].selectionType_==ddanylogp) {
      result.push_back(it->second);
    }
  }
}
void LogicalPart::stream ( std::ostream &  os)

Definition at line 23 of file LogicalPart.cc.

References DDBase< N, C >::ddname(), material(), and solid().

{
  os << std::endl << " mat=" << material().ddname() << std::endl << " solid=" << solid();
}
double & LogicalPart::weight ( )

Definition at line 28 of file LogicalPart.cc.

References weight_.

{ return weight_; }

Member Data Documentation

Definition at line 42 of file LogicalPart.h.

Referenced by category().

std::vector<bool> DDI::LogicalPart::hasDDValue_ [private]

Definition at line 48 of file LogicalPart.h.

Referenced by addSpecifics(), and hasDDValue().

Definition at line 40 of file LogicalPart.h.

Referenced by material().

Definition at line 41 of file LogicalPart.h.

Referenced by solid().

std::vector<std::pair<DDPartSelection*,DDsvalues_type* > > DDI::LogicalPart::specifics_ [private]

Definition at line 47 of file LogicalPart.h.

Referenced by addSpecifics(), attachedSpecifics(), removeSpecifics(), and specificsV().

std::map<DDValue, std::vector<DDPartSelection*> > DDI::LogicalPart::valToParsel_ [private]

Definition at line 46 of file LogicalPart.h.

double DDI::LogicalPart::weight_ [private]

Definition at line 43 of file LogicalPart.h.

Referenced by weight().