DOFAccessor error with dim=1 and space dim = 3

33 views
Skip to first unread message

Vinayak Vijay

unread,
Nov 8, 2023, 4:44:13 AM11/8/23
to deal.II User Group
Hello,

I am trying to obtain the vertex global dofs using the DOFAccessor. I employ the following code or the same: 

const auto vertex_end = tria.end_vertex();
for (auto vertex = tria.begin_active_vertex(); vertex != vertex_end;
++vertex)
{
DoFAccessor<0, 1, 3, false> vertex_dofs(&tria,
vertex->level(),
vertex->index(),
&dof_handler);
std::cout << vertex_dofs.dof_index(0) << ", " << vertex_dofs.dof_index(1)
<< std::endl;
}

The error that  i obtain is as follows:

    dealii::TriaAccessor<0, 1, spacedim>::TriaAccessor(const dealii::Triangulation<1, spacedim>*, int, int, const AccessorData*) [with int spacedim = 3; dealii::TriaAccessor<0, 1, spacedim>::AccessorData = void]
The violated condition was:
    (level == -2) && (index == -2)
Additional information:
    This exception -- which is used in many places in the library --
    usually indicates that some condition which the author of the code
    thought must be satisfied at a certain point in an algorithm, is not
    fulfilled. An example would be that the first part of an algorithm
    sorts elements of an array in ascending order, and a second part of
    the algorithm later encounters an element that is not larger than the
    previous one.
   
    There is usually not very much you can do if you encounter such an
    exception since it indicates an error in deal.II, not in your own
    program. Try to come up with the smallest possible program that still
    demonstrates the error and contact the deal.II mailing lists with it
    to obtain help.

Can someone help me with this? The main objective is to obtain the global dof indices using the - dealii::TriaActiveIterator<dealii::TriaAccessor<0, 1, 3>>

Thanks
Vinayak

Wolfgang Bangerth

unread,
Nov 8, 2023, 10:16:44 AM11/8/23
to dea...@googlegroups.com
On 11/8/23 02:44, Vinayak Vijay wrote:
>
> Can someone help me with this? The main objective is to obtain the global dof
> indices using the -dealii::TriaActiveIterator<dealii::TriaAccessor<0, 1, 3>>

The error is generated in a place that says that you shouldn't be calling this
constructor. I don't see the backtrace, so can't tell you where that happens,
but if you run your program in a debugger, you should be able to see where
that is. In general, take a look at the constructors of
DoFAccessor<0,1,spacedim>, which are different from the constructors of the
other DoFAccessor classes.

Best
W.

--
------------------------------------------------------------------------
Wolfgang Bangerth email: bang...@colostate.edu
www: http://www.math.colostate.edu/~bangerth/


Reply all
Reply to author
Forward
0 new messages