Andrew,

> Assume my (scalar but could be vector) nodal unknowns are the set u,v,w. I
> want to set all nodal w using the class InitialWValues (derives from
> Function class). It does not seem possible to do the following:
> VectorTools::project (dof_handler,
>                           constraints,
>                          
> QGauss<deal_II_dimension>(quadrature_formula.n_quadrature_points + 2),
> InitialWValues(1),
>                           X.block(2));                        // send in only 
> the W block
>
> as I get an error:
> The violated condition was:
> dof.get_fe().n_components() == function.n_components
>
> I have setup the function InitialWValues to expect only the number of
> components in w (1 in this case) InitialWValues:: InitialWValues ( :
>         Function<deal_II_dimension>(1)
> {}
>
> It's obvious how to set all the blocks of X to a value as done in the
> example problems, but not just for one block  (using a single DoFHandler).

I think the VectorTools::project function doesn't support this right away, but 
you can of course do the following:
- define the function you want to project to have 3 components, where only
  the last component does something useful (namely what you have right now)
- project this function onto a *temporary* block vector with 3 components
- copy the tmp.block(2) into X.block(2)

One could discuss extending VectorTools::project to do what you want right 
away, but this seems like the simpler choice.

Best
 W.

-------------------------------------------------------------------------
Wolfgang Bangerth                email:            [email protected]
                                 www: http://www.math.tamu.edu/~bangerth/

_______________________________________________
dealii mailing list http://poisson.dealii.org/mailman/listinfo/dealii

Reply via email to