#include <DDErrorDetection.h>
Public Member Functions | |
DDErrorDetection (const DDCompactView &cpv) | |
void | errors () |
const std::map< std::string, std::set< DDLogicalPart > > & | lp_cpv (const DDCompactView &cpv) |
const std::vector< std::pair < std::string, DDName > > & | ma () |
const std::map< DDMaterial, std::set< DDLogicalPart > > & | ma_lp () |
void | nix () |
bool | noErrorsInTheReport (const DDCompactView &cpv) |
void | report (const DDCompactView &cpv, std::ostream &o) |
void | scan (const DDCompactView &cpv) |
const std::map< DDSolid, std::set< DDSolid > > & | so () |
const std::map< DDSolid, std::set< DDLogicalPart > > & | so_lp () |
void | warnings () |
~DDErrorDetection () | |
Private Member Functions | |
DDErrorDetection () |
Definition at line 118 of file DDErrorDetection.h.
DDErrorDetection::DDErrorDetection | ( | const DDCompactView & | cpv | ) |
Definition at line 25 of file DDErrorDetection.cc.
References DDI::Singleton< I >::instance().
{ DDMaterial::StoreT::instance().setReadOnly(false); DDSolid::StoreT::instance().setReadOnly(false); DDLogicalPart::StoreT::instance().setReadOnly(false); DDSpecifics::StoreT::instance().setReadOnly(false); DDRotation::StoreT::instance().setReadOnly(false); scan(cpv); }
DDErrorDetection::~DDErrorDetection | ( | ) |
Definition at line 36 of file DDErrorDetection.cc.
References DDI::Singleton< I >::instance().
{ DDMaterial::StoreT::instance().setReadOnly(true); DDSolid::StoreT::instance().setReadOnly(true); DDLogicalPart::StoreT::instance().setReadOnly(true); DDSpecifics::StoreT::instance().setReadOnly(true); DDRotation::StoreT::instance().setReadOnly(true); }
DDErrorDetection::DDErrorDetection | ( | ) | [inline, private] |
Definition at line 144 of file DDErrorDetection.h.
{ };
void DDErrorDetection::errors | ( | ) |
Definition at line 64 of file DDErrorDetection.cc.
References gather_cfg::cout.
{ std::cout << "What does DDErrorDetection::errors() do? nothing." << std::endl; }
const std::map< std::string, std::set< DDLogicalPart > > & DDErrorDetection::lp_cpv | ( | const DDCompactView & | cpv | ) |
Definition at line 75 of file DDErrorDetection.cc.
References begin, DDBase< N, C >::ddname(), graph< N, E >::edges(), end, DDName::fullname(), g, DDCompactView::graph(), DDI::Singleton< I >::instance(), graph< N, E >::nodeData(), and graph< N, E >::nodeIndex().
{ static std::map<std::string, std::set<DDLogicalPart> > result_; if (result_.size()) return result_; // DDCompactView cpv; const DDCompactView::graph_type & g = cpv.graph(); std::map<std::string, std::set<DDLogicalPart> >::const_iterator it(lp_err::instance().begin()), ed(lp_err::instance().end()); for (; it != ed; ++it) { std::set<DDLogicalPart>::const_iterator sit(it->second.begin()), sed(it->second.end()); for( ; sit != sed; ++sit) { const DDLogicalPart & lp = *sit; DDCompactView::graph_type::const_edge_range er = g.edges(lp); if (g.nodeIndex(lp).second) { result_.insert(make_pair(lp.ddname().fullname(), std::set<DDLogicalPart>())); } for (; er.first != er.second; ++er.first) { result_[lp.ddname().fullname()].insert(g.nodeData(er.first->first)); } } } return result_; }
Definition at line 169 of file DDErrorDetection.cc.
References DDCheckMaterials(), and connectstrParser::o.
{ static std::vector<pair<std::string,DDName> > result_; ofstream o("/dev/null"); if (result_.size()) return result_; DDCheckMaterials(o,&result_); return result_; /* */ }
const std::map< DDMaterial, std::set< DDLogicalPart > > & DDErrorDetection::ma_lp | ( | ) |
Definition at line 141 of file DDErrorDetection.cc.
References i, m, and asciidump::s.
{ static std::map<DDMaterial, std::set<DDLogicalPart> > result_; if (result_.size()) return result_; const std::vector<pair<std::string,DDName> > & err_mat = ma(); std::vector<pair<std::string,DDName> >::const_iterator it(err_mat.begin()), ed(err_mat.end()); for (; it != ed; ++it) { std::set<DDLogicalPart> s; DDMaterial m(it->second); result_[m]=s; //std::cout << "insert: " << m.name() << std::endl; } DDLogicalPart::iterator<DDLogicalPart> lpit,lped; lped.end(); for (; lpit != lped; ++lpit) { if (lpit->isDefined().second) { std::map<DDMaterial, std::set<DDLogicalPart> >::iterator i = result_.find(lpit->material()); //std::cout << "searching: " << lpit->name() << std::endl; if ( i != result_.end() ) { //std::cout << std::endl << "FOUND: " << lpit->name() << std::endl << std::endl; i->second.insert(*lpit); } } } return result_; }
void DDErrorDetection::nix | ( | ) |
bool DDErrorDetection::noErrorsInTheReport | ( | const DDCompactView & | cpv | ) |
Definition at line 280 of file DDErrorDetection.cc.
References DDI::Singleton< I >::instance().
{ return lp_err::instance().empty() && ma_err::instance().empty() && so_err::instance().empty() && ro_err::instance().empty() && sp_err::instance().empty() && lp_cpv(cpv).empty() && ma().empty() && so().empty() && ma_lp().empty() && so_lp().empty(); }
void DDErrorDetection::report | ( | const DDCompactView & | cpv, |
std::ostream & | o | ||
) |
void DDErrorDetection::scan | ( | const DDCompactView & | cpv | ) |
Definition at line 45 of file DDErrorDetection.cc.
References gather_cfg::cout, dd_error_scan(), and DDI::Singleton< I >::instance().
{ std::cout << "DDErrorDetection::scan(): Scanning for DDD errors ..." << std::flush; DDLogicalPart lp_dummy; DDMaterial ma_dummy; DDRotation ro_dummy; DDSpecifics sp_dummy; DDSolid so_dummy; lp_err::instance() = dd_error_scan(lp_dummy); ma_err::instance() = dd_error_scan(ma_dummy); ro_err::instance() = dd_error_scan(ro_dummy); sp_err::instance() = dd_error_scan(sp_dummy); so_err::instance() = dd_error_scan(so_dummy); std::cout << " ... finished." << std::endl; }
Definition at line 184 of file DDErrorDetection.cc.
References a, b, gather_cfg::cout, ddintersection, ddsubtraction, ddunion, DDBase< N, C >::isDefined(), m, mag(), DDSolid::shape(), DDBooleanSolid::solidA(), and DDBooleanSolid::solidB().
{ static std::map<DDSolid, std::set<DDSolid> > result_; if (result_.size()) return result_; // build the material dependency graph typedef graph<DDSolid,double> ma_graph_t; typedef graphwalker<DDSolid,double> ma_walker_t; ma_graph_t mag; std::vector<DDSolid> errs; DDSolid::iterator<DDSolid> it, ed; ed.end(); for (; it != ed; ++it) { DDSolid ma = *it; if (ma.isDefined().second) { DDSolidShape sh = ma.shape(); if ( (sh == ddunion) || (sh == ddintersection) || (sh == ddsubtraction) ) { DDBooleanSolid bs(ma); DDSolid a(bs.solidA()),b(bs.solidB()); //DDRotation r(bs.rotation()); //DDTranslation t(bs.translation); mag.addEdge(a, ma, 0); mag.addEdge(b, ma, 0); } } else { errs.push_back(ma); } } std::vector<DDSolid>::const_iterator mit(errs.begin()), med(errs.end()); for (; mit != med; ++mit) { try { // loop over erroreous materials ma_walker_t w(mag,*mit); while (w.next()) { result_[*mit].insert(w.current().first); } std::cout << std::endl; } catch(DDSolid m) { ; //std::cout << "no such material: " << m << " for creating a walker." << std::endl; } } return result_; }
const std::map< DDSolid, std::set< DDLogicalPart > > & DDErrorDetection::so_lp | ( | ) |
Definition at line 102 of file DDErrorDetection.cc.
References i, m, and asciidump::s.
{ static std::map<DDSolid, std::set<DDLogicalPart> > result_; if (result_.size()) return result_; const std::map<DDSolid, std::set<DDSolid> > & err_mat = so(); std::map<DDSolid, std::set<DDSolid> >::const_iterator it(err_mat.begin()), ed(err_mat.end()); for (; it != ed; ++it) { std::set<DDLogicalPart> s; DDSolid m(it->first); result_[m]=s; std::set<DDSolid>::const_iterator sit(it->second.begin()), sed(it->second.end()); for(; sit != sed; ++sit) { result_[*sit] = s; } //std::cout << "insert: " << m.name() << std::endl; } DDLogicalPart::iterator<DDLogicalPart> lpit,lped; lped.end(); for (; lpit != lped; ++lpit) { if (lpit->isDefined().second) { std::map<DDSolid, std::set<DDLogicalPart> >::iterator i = result_.find(lpit->solid()); //std::cout << "searching: " << lpit->name() << std::endl; if ( i != result_.end() ) { //std::cout << std::endl << "FOUND: " << lpit->name() << std::endl << std::endl; i->second.insert(*lpit); } } } return result_; }
void DDErrorDetection::warnings | ( | ) |
Definition at line 69 of file DDErrorDetection.cc.
References gather_cfg::cout.
{ std::cout << "What does DDErrorDetection::warnings() do? nothing." << std::endl; }