void PrescribedVectorValueDirichletOldStyleBCFactory::add_funcs( const GetPot& input,
                                                                  MultiphysicsSystem& system,
                                                                  const std::string& input_string,
                                                                  const std::vector<std::string>& var_names,
                                                                  libMesh::CompositeFunction<libMesh::Number>& composite_func ) const
 {
   for( unsigned int n = 0; n < var_names.size(); n++ )
     {
       std::vector<VariableIndex> dbc_vars(1,system.variable_number(var_names[n]));
       libMesh::Number value = input(input_string, 0.0, n);
       libMesh::ConstFunction<libMesh::Number> const_func(value);
       composite_func.attach_subfunction(const_func, dbc_vars);
     }
 }
コード例 #2
0
  libMesh::UniquePtr<FunctionType>
  ParsedFunctionDirichletOldStyleBCFactory<FunctionType>::build_func( const GetPot& input,
                                                                      MultiphysicsSystem& system,
                                                                      std::vector<std::string>& var_names,
                                                                      const std::string& section )
  {
    libmesh_assert_equal_to( var_names.size(), 1 );

    std::vector<VariableIndex> dbc_vars(1,system.variable_number(var_names[0]));

    std::string section_str = section+"/"+DirichletBCFactoryFunctionOldStyleBase<FunctionType>::_value_var_old_style;
    std::string expression = input(section_str,"DIE!",DirichletBCFactoryFunctionOldStyleBase<FunctionType>::_value_idx_old_style);

    libMesh::UniquePtr<FunctionType> all_funcs = this->build_composite_func();

    typedef typename TypeFrom<FunctionType>::to_composite composite_type;
    composite_type * composite_func =
      libMesh::cast_ptr<composite_type *>(all_funcs.get());

    composite_func->attach_subfunction
      (TypeFrom<FunctionType>::to_parsed(system, expression), dbc_vars);

    return all_funcs;
  }