当前位置: 首页>>代码示例>>C++>>正文


C++ KVNameValueList::GetDoubleValue方法代码示例

本文整理汇总了C++中KVNameValueList::GetDoubleValue方法的典型用法代码示例。如果您正苦于以下问题:C++ KVNameValueList::GetDoubleValue方法的具体用法?C++ KVNameValueList::GetDoubleValue怎么用?C++ KVNameValueList::GetDoubleValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在KVNameValueList的用法示例。


在下文中一共展示了KVNameValueList::GetDoubleValue方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Initialize

void KVRangeYanezMaterial::Initialize()
{
   KVIonRangeTableMaterial::Initialize();
   if(IsCompound()){
      fNelem=0;
      iabso=-1;
      TIter next(fComposition);
      KVNameValueList* nvl;
      while( (nvl = (KVNameValueList*)next()) ){
         fAbsorb[fNelem].z = nvl->GetIntValue("Z");
         fAbsorb[fNelem].a = nvl->GetIntValue("A");
         fAbsorb[fNelem].w = nvl->GetDoubleValue("Ar*Weight");
         fNelem++;
      }
   }
   else if(IsMixture()){
      fNelem=0;
      iabso=-1;
      TIter next(fComposition);
      KVNameValueList* nvl;
      while( (nvl = (KVNameValueList*)next()) ){
         fAbsorb[fNelem].z = nvl->GetIntValue("Z");
         fAbsorb[fNelem].a = nvl->GetIntValue("A");
         fAbsorb[fNelem].w = nvl->GetDoubleValue("Ar*Weight");
         fNelem++;
      }
   }
}
开发者ID:pwigg,项目名称:kaliveda,代码行数:28,代码来源:KVRangeYanezMaterial.cpp

示例2: GetTGeoMaterial

TGeoMaterial* KVIonRangeTableMaterial::GetTGeoMaterial() const
{
   // Create and return pointer to a TGeoMaterial or TGeoMixture (for compound materials)
   // with the properties of this material.
   // gGeoManager must exist.

   TGeoMaterial* gmat = 0x0;
   if (!gGeoManager) return gmat;
   if (IsCompound()) {
      gmat = new TGeoMixture(GetTitle(), GetComposition()->GetEntries(), GetDensity());
      TIter next(GetComposition());
      KVNameValueList* nvl;
      while ((nvl = (KVNameValueList*)next())) {
         KVNucleus n(nvl->GetIntValue("Z"), nvl->GetIntValue("A"));
         TGeoElement* gel = gGeoManager->GetElementTable()->FindElement(n.GetSymbol("EL"));
         float poids = nvl->GetDoubleValue("NormWeight");
         ((TGeoMixture*)gmat)->AddElement(gel, poids);
      }
   }
   else {
      gmat = new TGeoMaterial(GetTitle(), GetMass(), GetZ(), GetDensity());
   }
   // set state of material
   if (IsGas()) gmat->SetState(TGeoMaterial::kMatStateGas);
   else gmat->SetState(TGeoMaterial::kMatStateSolid);
   return gmat;
}
开发者ID:FableQuentin,项目名称:kaliveda,代码行数:27,代码来源:KVIonRangeTableMaterial.cpp

示例3: Initialize

void KVIonRangeTableMaterial::Initialize()
{
   // Correctly initialize material ready for use
   // For compound or mixed materials, calculate normalised weights of components,
   // effective Z and A, and molar weight of substance

   fMoleWt = 0.;
   if (IsCompound() || IsMixture()) {
      // mixture or compound
      // calculate molar weight and effective Z & A
      fZmat = fAmat = 0;
      TIter next(fComposition);
      KVNameValueList* nvl;
      Double_t totW = 0;
      while ((nvl = (KVNameValueList*)next())) {
         Double_t arw = nvl->GetDoubleValue("Ar*Weight");
         Double_t poid = nvl->GetDoubleValue("Weight");
         fMoleWt += arw;
         totW += poid;
         fZmat += poid * nvl->GetIntValue("Z");
         fAmat += poid * nvl->GetIntValue("A");
      }
      fZmat /= totW;
      fAmat /= totW;
      next.Reset();
      while ((nvl = (KVNameValueList*)next())) {
         Double_t prop = nvl->GetDoubleValue("Weight");
         nvl->SetValue("NormWeight", prop / totW);
      }
   }
   else {
      // isotopically-pure elemental material
      // get mass of 1 mole of element
      KVNucleus n(fZmat, fAmat);
      fMoleWt = n.GetAtomicMass();
   }
}
开发者ID:FableQuentin,项目名称:kaliveda,代码行数:37,代码来源:KVIonRangeTableMaterial.cpp

示例4: PrintComposition

void KVIonRangeTableMaterial::PrintComposition(ostream& output) const
{
   // Print to stream the composition of this material, in a format compatible with the VEDALOSS parameter file.
   if (IsCompound()) output << "COMPOUND";
   else if (IsMixture()) output << "MIXTURE";
   else output << "ELEMENT";
   output << endl;
   if (IsCompound() || IsMixture()) {
      output << fComposition->GetEntries() << endl;
      TIter next(fComposition);
      KVNameValueList* nvl;
      while ((nvl = (KVNameValueList*)next())) {
         KVNucleus n(nvl->GetIntValue("Z"), nvl->GetIntValue("A"));
         output << n.GetZ() << " " << n.GetA() << " " << nvl->GetIntValue("Natoms");
         if (IsMixture()) output << " " << nvl->GetDoubleValue("Proportion");
         output << endl;
      }
   }
}
开发者ID:FableQuentin,项目名称:kaliveda,代码行数:19,代码来源:KVIonRangeTableMaterial.cpp

示例5: Print

void KVIonRangeTableMaterial::Print(Option_t*) const
{
   printf("Material : %s (%s)   State : %s\n",
          GetName(), GetSymbol(), fState.Data());
   printf("\tEffective Z=%f, A=%f  ", fZmat, fAmat);
   if (IsGas()) printf(" Molar Weight = %f g.", fMoleWt);
   else printf(" Density = %f g/cm**3", fDens);
   printf("\n");
   if (IsCompound()) printf("\tCompound material:\n");
   else if (IsMixture())  printf("\tMixed material:\n");
   if (IsCompound() || IsMixture()) {
      TIter next(fComposition);
      KVNameValueList* nvl;
      while ((nvl = (KVNameValueList*)next())) {
         KVNucleus n(nvl->GetIntValue("Z"), nvl->GetIntValue("A"));
         printf("\t\tElement: %s   Ar=%f g.   Natoms=%d", n.GetSymbol(), n.GetAtomicMass(), nvl->GetIntValue("Natoms"));
         if (IsMixture()) printf("   Proportion=%f", nvl->GetDoubleValue("Proportion"));
         printf("\n");
      }
   }
   printf("\n\n");
}
开发者ID:FableQuentin,项目名称:kaliveda,代码行数:22,代码来源:KVIonRangeTableMaterial.cpp


注:本文中的KVNameValueList::GetDoubleValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。