RhoCp<EvalT, Traits>:: RhoCp(Teuchos::ParameterList& p, const Teuchos::RCP<Albany::Layouts>& dl) : coord_ (p.get<std::string>("Coordinate Name"), dl->qp_vector), rho_cp_ (p.get<std::string>("Rho Cp Name"), dl->qp_scalar) { this->addDependentField(coord_); this->addEvaluatedField(rho_cp_); Teuchos::RCP<PHX::DataLayout> scalar_dl = dl->qp_scalar; std::vector<PHX::Device::size_type> dims; scalar_dl->dimensions(dims); workset_size_ = dims[0]; num_qps_ = dims[1]; Teuchos::ParameterList* cond_list = p.get<Teuchos::ParameterList*>("Parameter List"); Teuchos::RCP<const Teuchos::ParameterList> reflist = this->getValidRhoCpParameters(); cond_list->validateParameters(*reflist, 0, Teuchos::VALIDATE_USED_ENABLED, Teuchos::VALIDATE_DEFAULTS_DISABLED); ScalarT value = cond_list->get("Value", 1.0); init_constant(value,p); this->setName("RhoCp"+PHX::typeAsString<EvalT>()); }
Permittivity<EvalT, Traits>:: Permittivity(Teuchos::ParameterList& p) : permittivity(p.get<std::string>("QP Variable Name"), p.get<Teuchos::RCP<PHX::DataLayout> >("QP Scalar Data Layout")) { randField = CONSTANT; Teuchos::ParameterList* cond_list = p.get<Teuchos::ParameterList*>("Parameter List"); Teuchos::RCP<const Teuchos::ParameterList> reflist = this->getValidPermittivityParameters(); // Check the parameters contained in the input file. Do not check the defaults // set programmatically cond_list->validateParameters(*reflist, 0, Teuchos::VALIDATE_USED_ENABLED, Teuchos::VALIDATE_DEFAULTS_DISABLED); Teuchos::RCP<PHX::DataLayout> vector_dl = p.get< Teuchos::RCP<PHX::DataLayout> >("QP Vector Data Layout"); std::vector<PHX::DataLayout::size_type> dims; vector_dl->dimensions(dims); numQPs = dims[1]; numDims = dims[2]; std::string ebName = p.get<std::string>("Element Block Name", "Missing"); type = cond_list->get("Permittivity Type", "Constant"); if (type == "Constant") { ScalarT value = cond_list->get("Value", 1.0); init_constant(value, p); } else if (type == "Truncated KL Expansion" || type == "Log Normal RF") { init_KL_RF(type, *cond_list, p); } else if (type == "Block Dependent") { // We have a multiple material problem and need to map element blocks to material data if(p.isType<Teuchos::RCP<QCAD::MaterialDatabase> >("MaterialDB")){ materialDB = p.get< Teuchos::RCP<QCAD::MaterialDatabase> >("MaterialDB"); } else { TEUCHOS_TEST_FOR_EXCEPTION( true, Teuchos::Exceptions::InvalidParameter, std::endl << "Error! Must specify a material database if using block dependent " << "permittivity" << std::endl); } // Get the sublist for permittivity for the element block in the mat DB (the material in the // elem block ebName. Teuchos::ParameterList& subList = materialDB->getElementBlockSublist(ebName, "Permittivity"); std::string typ = subList.get("Permittivity Type", "Constant"); if (typ == "Constant") { ScalarT value = subList.get("Value", 1.0); init_constant(value, p); } else if (typ == "Truncated KL Expansion" || typ == "Log Normal RF") { init_KL_RF(typ, subList, p); } } // Block dependent else { TEUCHOS_TEST_FOR_EXCEPTION(true, Teuchos::Exceptions::InvalidParameter, "Invalid permittivity type " << type); } this->addEvaluatedField(permittivity); this->setName("Permittivity"+PHX::TypeString<EvalT>::value); }