← Back to team overview

dolfin team mailing list archive

Re: Dirichlet Boundary conditions revisited

 

>
> Hi, I discussed this a bit with Anders. The simplest way to do it, I
> think, is to create
> a vector of length the total number of dofs containing booleans. This
> vector can then
> be passed to a function which is basically similar to restriction. The
> difference with this
> new restriction is that you don't check whether you are on a cell, but you
> check each dof.
>
> ie.
>
> something like
>
>
>   for (; !cell.end(); ++cell)
>   {
>     ufc_cell.update(*cell);
>     use_cell = meshfunction.get(cell->index());
>     ufc_dof_map->init_cell(ufc_mesh, ufc_cell);
>     ufc_dof_map->tabulate_dofs(dofs, ufc_mesh, ufc_cell);
>
>      for (uint k=0; k<n; k++) {
>

sorry, hit the wrong button...

  Array<bool> indicators;

  for (; !cell.end(); ++cell)
  {
    ufc_cell.update(*cell);
    use_cell = meshfunction.get(cell->index());
    ufc_dof_map->init_cell(ufc_mesh, ufc_cell);
    ufc_dof_map->tabulate_dofs(dofs, ufc_mesh, ufc_cell);
    for (uint k=0; k<n; k++) {
          if (indicators[dofs[k]]) {
               if (R.find(dofs[k]) == R.end()){
                     R[dofs[k]] = dof_counter;
                     dof_counter++;
               }
          dof_map[cell->index()*n + k] = R[dofs[k]];
          }
     }


Kent


>
>
>> I have just tried, and the petsc is now also working.
>>
>> Thanks again.  Now I will see if I can make some sense of the rest of it
>> :)
>>
>> Evan
>>
>> On Wed, Feb 11, 2009 at 9:41 PM, Evan Lezar <evanlezar@xxxxxxxxx> wrote:
>>
>>> I will pull the latest source and try again.
>>>
>>> Thanks
>>> Evan
>>>
>>>
>>> On Wed, Feb 11, 2009 at 9:23 PM, <kent-and@xxxxxxxxx> wrote:
>>>
>>>> > On Mon, Feb 9, 2009 at 1:05 PM, Anders Logg <logg@xxxxxxxxx> wrote:
>>>> >
>>>> >> On Mon, Feb 09, 2009 at 11:58:28AM +0100, Kent Andre wrote:
>>>> >> >
>>>> >> > Is it the code in DofMap that is not understandable ?
>>>> >> >
>>>> >> > The idea behind the code is that the dof_map provides a numbering
>>>> >> > of the unknowns ie. the global dofs are  D = [0, 1, .....N-1].
>>>> >> > In the restricted function space we need a corresponding
>>>> numbering
>>>> >> > R = [0, 1, .... M-1] where M < N.
>>>> >> >
>>>> >> > The code in restriction is such that it runs through all dofs in
>>>> the
>>>> >> > restricted mesh (as it is now by runing through the whole mesh
>>>> except
>>>> >> > for the ones marked by the meshfunction). I run through all the
>>>> dofs
>>>> >> > and for each dof I check the dof in the global mesh, If I already
>>>> have
>>>> >> > seen this dof I use the same dof_number as last time (stored in
>>>> >> > R[dofs[k]]). If the dof is new I update the dof_counter and add
>>>> >> > the new dof to R. By doing this I get a new dof_map where each
>>>> >> > node is numbered in an increasing sequence.
>>>> >> >
>>>> >> > Check also the demo under dolfin/demo/function/restriction. You
>>>> can
>>>> >> eg.
>>>> >> > probably begin by changing demo.
>>>> >> >
>>>> >> >
>>>> >> > Kent
>>>> >>
>>>> >> The demo looks a little unfinished. Could you move it to
>>>> >>
>>>> >>  dolfin/demo/function/restriction/python/demo.py
>>>> >>
>>>> >> then add the copyright headers etc like in the other demos, clean
>>>> it
>>>> >> up a little, add a C++ version in the cpp directory (or a copy of
>>>> the
>>>> >> README file from other demos where the C++ version is missing). You
>>>> >> can also move it to the sandbox until it's finished.
>>>> >>
>>>> >> --
>>>> >> Anders
>>>> >>
>>>> >>
>>>> > Regarding the demo.
>>>> >
>>>> > I have just tried to run it, and it fails with Petsc reporting a
>>>> > Segmentation Violation.
>>>> >
>>>> > Evan
>>>> >
>>>>
>>>> I fixed a bug yesterday, do you have the newest dev version ?
>>>> (I have only tested the trilinos and uBlas version.)
>>>>
>>>> Kent
>>>>
>>>>
>>>>
>>>>
>>>
>>
>
>
>




References