On 3/7/21 9:00 PM, Nikki Holtzer wrote:
> Yes, I have tried it. The problem I am having is with the 'face->boundary_id()
> == 1' piece. I get an error which states that :
> 'face' was not declared in this scope.
>
> The only other place that 'face' appears in my code is where I set the
> boundary ids like the following:
>
> triangulation.begin_active->face()->set_boundary_id()
>
> Is there an easier way to access that boundary in the second half of that if
> statement above other than
>
> (face->boundary_id() == 1)
So let's start with the root cause, the error you get that
'face' was not declared in this scope
Did you declare a local variable called 'face'? If not, you can clearly not
use it. But if you look at the place where you probably copied that code from,
you will see how you can declare such a variable -- you will just have to copy
the declaration as well.
This falls in a category of problems I see quite a lot in my students, so
you're in good company: You get an error, and you try to work around it ("Is
there an easier way...") without really understanding what the root cause is.
That's a bit like saying
I have two variables x and y which I believe to be equal to 2 and 3, but if
I write x+y I get 6. Is there a different way for me to add x to y so that
the result is 5?
That's not a useful approach. Instead of just walking away from something that
superficially doesn't work as expected, spend the time to read the details of
error messages and to understand *why* it is not working. It will make you a
better programmer if you make that a habit!
Best
Wolfgang