Go to the source code of this file.
bool DDCheckMaterial |
( |
DDMaterial & |
mip, |
|
|
std::pair< std::string, DDName > & |
result |
|
) |
| |
Definition at line 8 of file DDCheckMaterials.cc.
References DDMaterial::a(), DDMaterial::constituent(), DDBase< N, C >::ddname(), DDMaterial::density(), DDBase< N, C >::isDefined(), python.cmstools::loop(), DDName::name(), DDBase< N, C >::name(), DDMaterial::noOfConstituents(), DDName::ns(), and DDMaterial::z().
Referenced by DDCheckMaterials().
10 std::string no_composites =
" NO-COMPOSITES ";
11 std::string no_density =
" NO-DENSITY ";
12 std::string costit_nok =
" CONSTITUENT NOK ";
13 std::string no_z =
" NO-Z ";
14 std::string no_a =
" NO-A ";
15 static int rlevel = 0;
17 std::string curr_err =
"";
22 curr_err +=
"material not declared; unknown material!";
30 curr_err +=
"material name=" + mip.
name().
ns() +
":" + mip.
name().
name()
31 +
" is declared but not defined";
46 curr_err += no_density;
58 curr_err += no_composites;
63 curr_err =
" NOT-DEFINED ";
74 for (; loop>=0; --
loop) {
75 std::pair<std::string,DDName> res(
"",
"");
82 curr_err = curr_err + std::string(
" constituents have errors:\n") + std::string(4*rlevel,
' ')
84 + std::string(
" ") + res.first;
double a() const
returns the atomic mass
def_type isDefined() const
DDMaterial is used to define and access material information.
bool DDCheckMaterial(DDMaterial &mip, std::pair< std::string, DDName > &result)
const std::string & ns() const
Returns the namespace.
double z() const
retruns the atomic number
FractionV::value_type constituent(int i) const
returns the i-th compound material and its fraction-mass
double density() const
returns the density
int noOfConstituents() const
returns the number of compound materials or 0 for elementary materials
const std::string & name() const
Returns the name.
bool DDCheckMaterials |
( |
std::ostream & |
os, |
|
|
std::vector< std::pair< std::string, DDName > > * |
res |
|
) |
| |
Checks all registered materials and sends a report /p os.
Definition at line 95 of file DDCheckMaterials.cc.
References DDCheckMaterial(), error, benchmark_cfg::errors, i, j, query::result, and asciidump::s.
Referenced by DDErrorDetection::ma().
98 std::vector<std::pair<std::string,DDName> >
errors;
105 RegT::value_type::iterator
i = mr.begin();
107 for(; i != mr.end(); ++
i) {
108 std::pair<std::string,DDName>
error(
"",
"");
112 errors.push_back(
error);
117 os <<
"[DDCore:Report] Materials " << std::endl;
118 os <<
s << mr.size() <<
" Materials declared" << std::endl;
119 os <<
s <<
"detected errors:" << errors.size() << std::endl;
120 std::vector<std::pair<std::string,DDName> >::iterator
j = errors.begin();
121 for (;j!=errors.end();++
j) {
122 os << std::endl <<
s << j->second <<
" " << j->first << std::endl;
DDMaterial is used to define and access material information.
bool DDCheckMaterial(DDMaterial &mip, std::pair< std::string, DDName > &result)
Container::value_type value_type