Dear Elena,
I want to do something like below code, but I don't know how to write it
> correctly:
>
> template <int dim>
> void
> Solver<dim>::*assemble_linear_system *(LinearSystem &linear_system)
> {
> ....
> VectorTools::interpolate_boundary_values (dof_handler,
> 0,
>
> **boundary_values(0),*
>
> boundary_value_map);
>
> VectorTools::interpolate_boundary_values (dof_handler,
> 1,
>
> **boundary_values(1),*
>
> boundary_value_map);
> ...
> }
>
>
> template<int dim>
> void* My_Case_2*<dim>::*BoundaryValues::vector_value*(const
> Point<dim> &p,
>
>
> Vector<double> &values) const
> {
> ...
> if (boundary_indicator == 0) {
> BC = p(0) + p(1);
> } else if (boundary_indicator == 1) {
> BC = p(0)*p(0) + p(1);
> }
> ...
> }
>
You can do something like this if you define a member variable
current_boundary_indicator and set it correctly before calling
interpolate_boundary_values(), i.e. you would do
> boundary_values.current_boundary_indicator=0;
VectorTools::interpolate_boundary_values (dof_handler,0,boundary_values,
> boundary_value_map);
>
boundary_values.current_boundary_indicator=1;
VectorTools::interpolate_boundary_values (dof_handler,1,boundary_values,
> boundary_value_map);
>
If you have a look at the documentation of
VectorTools::interpolate_boundary_value [1], you see that there are
multiple functions with this name.
In particular, the one with the signature
> void VectorTools::interpolate_boundary_values
(const DoFHandlerType< dim, spacedim > &
> dof,
const std::map< types::boundary_id, const Function< spacedim, number > *
> > & function_map,
std::map< types::global_dof_index, number > &
> boundary_values,
const ComponentMask &
> component_mask = ComponentMask() )
might be a good alternative for you as also Bruno (with a ConstraintMatrix
instead of std::map< types::global_dof_index, number > &) already pointed
out.
Then, you would define one Function for each boundary_indicator and call
VectorTools::interpolate_boundary_values only once.
Best,
Daniel
[1]
https://www.dealii.org/8.5.0/doxygen/deal.II/namespaceVectorTools.html#a9f3e3ae1396811f998cc35f94cbaa926
--
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see
https://groups.google.com/d/forum/dealii?hl=en
---
You received this message because you are subscribed to the Google Groups
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.