Dear Martin

>> So if I call the method 
>> add_selected_constraints
>> from an empty ConstraintMatrix C I would expect to get
>> the ConstraintMatrix A again. 
>> ConstraintMatrix C;
>> C.
>> add_selected_constraints
>> (A,filter);
>> 
>> 
>> But I get this for C:
>> 0 = 0
>> 1 = 0
>> 2 = 0
>> 3 = 0
>> 4 = 0
>> 5 = 0
>> 6 = 0
>> 7 = 0
>> 
>> So, now 4 appears constrained in C! This must be wrong as 4 is not in the 
>> filter and the documentations states:
>>      "elements not present in the IndexSet are ignored"
>> 
>> 
>> What am I missing? 
> 
> The function add_selected_constraints transforms the indices to the
> local index space of the filter. A typical application of that function
> would be:
> - work on a block system, say two components, with a common dof handler
> and a common ConstraintMatrix
> - want to get constraints for the first block without recreating them,
> for working on the submatrix (1,1)
> 
> For your application, this is not the right thing to do. You do not want
> to apply the transformation to local indices (that's why there is a four
> now, however, I am a bit confused why there still should be the entry
> "7" - does A actually continue beyond index 7?).

A does extend beyond 7, I took only some of the first entries to illustrate the 
issue.
I should have mentioned this.

> 
> 
>> I have two  ConstraintMatrix objects A and B. I wish to remove from A
>> dof constrained in A that are already constrained in B. 
>> My strategy is as follows:
>> loop over all dof dd
>> check if the dof dd is constrained in A: A.is_constrained(dd)
>> check if the dof dd is constrained in B: B.is_constrained(dd)
>> if the current dof dd is constrained in A but not in B then I add the
>> current dof to an IndexSet called filter
>> end_loop
> 
> If you know that all your constraints are of the form "dof_i = 0", then
> you can do this quite easily by using C.add_line (dd) in you loop above
> if dd is in A but not in B. If there are actually some entries, things
> get more complicated, because we do not offer any way to access the
> entries field from outside.
> In my opinion, it would be useful to have a
> method 
>    const std::vector<std::pair<unsigned int,double> >*
>    get_constraint_entries (unsigned int line) const;
> that returns a pointer to the entries field in the CM in case a DoF is
> constrained, and a NULL pointer if it is not constrained. Then, one
> could easily add all kinds of constraints again with the function
> add_entries

agreed. that would be extremely useful.

> 
> I actually need this information in some of my own programs, too, so
> I've already implemented such a function for myself and could check it
> in right now if nobody objects. ;-)

I obviously have no objections :) Many thanks for this Martin

> 
> Best,
> Martin
> 
> 
_______________________________________________
dealii mailing list http://poisson.dealii.org/mailman/listinfo/dealii

Reply via email to