Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce a class that can't be used. #5075

Merged
merged 2 commits into from Sep 14, 2017
Merged

Conversation

bangerth
Copy link
Member

@bangerth bangerth commented Sep 13, 2017

Specifically, declare DoFInvalidAccessor that is the accessor
for cases where dim>spacedim -- i.e., things that can't logically
happen, but that at times do happen in code like

  for (quad=0; quad<GeometryInfo<dim>::quads_per_cell; ++quad)
    cell->quad(quad)->do_something();

Here, the code is not executed in 1d, but we want it to be syntactically
correct so that we can compile the function. Having a DoFInvalidAccessor
then serves the same purpose that InvalidAccessor already does for
tria accessor functions: such objects cannot be created but rather
throw an exception, but they provide the correct syntax.

Specifically, declare DoFInvalidAccessor that is the accessor
for cases where dim>spacedim -- i.e., things that can't logically
happen, but that at times do happen in code like

  for (quad=0; quad<GeometryInfo<dim>::quads_per_cell; ++quad)
    cell->quad(quad)->do_something();

Here, the code is not executed in 1d, but we want it to be syntactically
correct so that we can compile the function. Having a DoFInvalidAccessor
then serves the same purpose that InvalidAccessor already does for
tria accessor functions: such objects cannot be created but rather
throw an exception, but they provide the correct syntax.
@bangerth
Copy link
Member Author

/run-tests

@bangerth
Copy link
Member Author

ping

Copy link
Member

@tamiko tamiko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.



/**
* A class that represents DoF accessor objects to iterators that don't make sense
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to -> for ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah. Now I understand that sentence.

@tamiko tamiko merged commit 4c906b7 into dealii:master Sep 14, 2017
@bangerth bangerth deleted the invalid-accessor branch September 14, 2017 19:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants