Re: [deal.II] Adding dirichlet values to ConstraintMatrix

2016-06-23 Thread Wolfgang Bangerth

On 06/23/2016 02:46 AM, Praveen C wrote:


void add_dirichlet_constraints (const
std::map ,
ConstraintMatrix
 )
{
   for (const auto  : values)
   {
  constraints.add_line (pair.first);
  constraints.set_inhomogeneity (pair.first, pair.second);
   }
}



Yes, this would work. I would add an assertion that pair.first is not already 
constrained. You'll also have to avoid using the C++11-style for loop. Other 
than that, this looks good!


Best
 W.

--

Wolfgang Bangerth   email:bange...@math.tamu.edu
www: http://www.math.tamu.edu/~bangerth/

--
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 dealii+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [deal.II] Adding dirichlet values to ConstraintMatrix

2016-06-23 Thread Praveen C
Thanks Wolfgang. I will test this. Following function should work.

best
praveen

   void add_dirichlet_constraints (const
std::map ,
   ConstraintMatrix
  )
   {
  for (const auto  : values)
  {
 constraints.add_line (pair.first);
 constraints.set_inhomogeneity (pair.first, pair.second);
  }
   }


On 23-Jun-2016, at 11:23 AM, Wolfgang Bangerth  wrote:

On 06/23/2016 12:48 AM, Praveen C wrote:


I have created a

std::map boundary_values;

I want to add this to a ConstraintMatrix but I could not find any function
to
do this.

>From the documentation, I could do

for each dirichlet dof
{
add_line(...)
set_inhomogeneity(...)
}

Is this the only way to accomplish what I want ?


Praveen -- yes, at the moment it is. But I think it would be useful to have
such a function in ConstraintMatrix. Want to give it a try? Maybe call it
add_identity_constraints()?

Cheers
W.

-- 
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 dealii+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[deal.II] Adding dirichlet values to ConstraintMatrix

2016-06-22 Thread Praveen C
 Dear all

I have created a

std::map boundary_values;

I want to add this to a ConstraintMatrix but I could not find any function
to do this.

>From the documentation, I could do

for each dirichlet dof
{
add_line(...)
set_inhomogeneity(...)
}

Is this the only way to accomplish what I want ?

I am using parallel::distributed::Triangulation and Trilinos vectors and
matrices.

Thanks
praveen

-- 
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 dealii+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.