void ConstitutiveModelParameters<EvalT, Traits>::
evaluateFields(typename Traits::EvalData workset)
{
  typename std::map<std::string, PHX::MDField<ScalarT, Cell, QuadPoint> >::iterator it;
  for (it = field_map_.begin();
      it != field_map_.end();
      ++it) {
    ScalarT constant_value = constant_value_map_[it->first];
    if (is_constant_map_[it->first]) {
      for (std::size_t cell(0); cell < workset.numCells; ++cell) {
        for (std::size_t pt(0); pt < num_pts_; ++pt) {
          it->second(cell, pt) = constant_value;
        }
      }
    } else {
      for (std::size_t cell(0); cell < workset.numCells; ++cell) {
        for (std::size_t pt(0); pt < num_pts_; ++pt) {
          Teuchos::Array<MeshScalarT> point(num_dims_);
          for (std::size_t i(0); i < num_dims_; ++i)
            point[i] = Sacado::ScalarValue<MeshScalarT>::eval(
                coord_vec_(cell, pt, i));
          it->second(cell, pt) =
              exp_rf_kl_map_[it->first]->evaluate(point, rv_map_[it->first]);
        }
      }
    }
    if (have_temperature_) {
      if (temp_type_map_[it->first] == "Linear" ) {
        RealType dPdT = dparam_dtemp_map_[it->first];
        RealType ref_temp = ref_temp_map_[it->first];
        for (std::size_t cell(0); cell < workset.numCells; ++cell) {
          for (std::size_t pt(0); pt < num_pts_; ++pt) {
            it->second(cell, pt) += dPdT * (temperature_(cell, pt) - ref_temp);
          }
        }
      } else if (temp_type_map_[it->first] == "Arrhenius") {
        RealType pre_exp_ = pre_exp_map_[it->first];
        RealType exp_param_ = exp_param_map_[it->first];
        for (std::size_t cell(0); cell < workset.numCells; ++cell) {
          for (std::size_t pt(0); pt < num_pts_; ++pt) {
            it->second(cell, pt) = pre_exp_ 
              * std::exp( -exp_param_ / temperature_(cell, pt) );
          }
        }
      }
    }
  }
}
 T ConstructionFactory<T>::constructObject(const std::string& key) const {
     typename std::map<std::string, Constructor>::const_iterator it = this->_constructors.find(key);
     if (it != this->_constructors.end()) {
         if (it->second) {
             return it->second();
         }
         return fl::null;
     }
     std::ostringstream ss;
     ss << "[factory error] constructor of " + _name + " <" << key << "> not registered";
     throw fl::Exception(ss.str(), FL_AT);
 }
Exemple #3
0
 bool call(const std::string& command,
     CommandArgumentsType const& arguments) const
 {
     typename std::map<std::string,
         boost::function<Signature> >::const_iterator i;
     i = callbacks_.find(command);
     if (i == callbacks_.end()) {
         return BaseType::call(command, arguments);
     }
     else {
         return i->second(command, arguments);
     }
 }