In this segment we'll move on to looking at the actual declaration, or the definition rather, of the functions that we looked at previously. All right, so let's move over to the code, and the first function that we're looking at is the constructor. Remember the 2 inputs are an unsigned int called order and an unsigned int called problem. Now here, I actually have something going on here between this declaration of the function name and its inputs, and the {. And this is so that we can call the constructor of some of these data objects that were declared earlier as class objects. So if I scroll up here, you can see that here's fe, which is an FESystem and dof_handler. Now when we're declaring objects in the class declaration, we can't call their constructor. But normally, we actually call the constructor when we declare an object, right? So in order to get around that difficulty, we can call the constructor here with, the constructor for these class objects we can call within the constructor for the class itself, okay? So in the constructor for fe, we input this FE_Q, which again is a deal.II object, but notice the input is order. So FE_Q will keep track of what Lagrangian basis function order we're using. And the reason it needs to know that is so that it can keep track of how many nodes there are, right? Because obviously if we're using a higher order of basis function, then there are more nodes. We have midside nodes. All right, so we tell it the order, and we also give it the dim, which again is the dimension. Now, again, this is that template parameter I was talking about in main.cc, and we input a 1, all right? So anytime we see dim in this template, it will actually be 1 because that's what we've declared it as in main.cc. All right, dof_handler now will take in triangulation. Triangulation again was the mesh, or holds the information about the mesh. And dof_handler holds information about the degrees of freedom, and obviously they're related, okay? Now we'll get into the constructor function itself, and here I'm just passing variables. So order is the input, and now I'm storing it in the global integer basisFunctionOrder. And the same thing for problem. Problem is an input to the constructor, and I'm storing it in the global integer of prob. Now you'll notice here I have an if statement, if(problem == 1 | | problem == 2){prob = problem;}. Otherwise, I output an Error saying that the problem number should be 1 or 2. So if you try to input problem part 3, it'll give you an error. Why, because obviously there is no part 3. You could have a similar sort of if statement and check on the basisFunctionOrder. However, some of you may want to use the generalized formula for the Lagrangian basis functions. So, orders higher than 3 may be valid, so that's why he didn't put that check in there. But, if you'd like to, you're free to go ahead and do that. All right, the second part of the constructor, again, has to do with the solution names for outputting results. So I won't look too much at that. The destructor is short, but there is something in it, dof_handler.clear(). Again, that's something going on with the deal.II data object, so I won't go into that too much either, all right? So that's the constructor and destructor. Let's move down now to xi node. Now here, I want to explain to you a little bit about how deal.II actually does its node numbering. And we'll look at it for linear, quadratic, and cubic basis functions, okay? So for linear basis functions, it's exactly the same as in the class. So here's an element, sorry, it's not exactly the same. In the class, or in the lectures, I should say, The node numbers started at 1 and went to 2. For deal.II, The node numbers start at 0, okay? Now globally, so this would be for an element. And for the system, globally It would be very similar. So, here I'll just do a 3 element mesh, and in deal.II the numbering just goes sequentially up, 0,1,2,3. Whereas in the lectures, it was started at 1, of course, but that's the only difference there. For quadratic, it starts to get a little bit more different here. Okay, so now we have our element. We have 1 midside node now, all right? In the lectures we again just started 1, 2, 3, right? In deal.II, there's a significant difference here in that the left node is always 0, and the right node is always 1, and then we go to the midside nodes. Okay, we actually follow that same pattern, or a similar pattern, here on the global scale. Here each element has 1 midside node. Again, in the lectures we just went straight across. In deal II, globally, we sort of go element by element following the same pattern. So, we do 0, 1 then our midside node, 2. Then the right node of the next element, so 3, 4,5,6, okay? And then cubic Follows that same pattern. All right, so we have our 2 midside nodes now, again in the lectures. We went sequentially 1, 2, 3, 4 in deal.II. Again the left node is 1, the right node is, or sorry, the left node is 0, the right node is 1, and then, 2, 3. All right, and again, we'll do it globally as well. With 2 midside nodes, Or 2 internal nodes per element. And I'm not going to bother with the lecture in method. It's just sequential as before, but for deal.II at 0, 1, and then 2,3 on the midside, 4,5,6,7,8,9, okay? This will come into play when we're defining our basis functions. Now, getting back to the code, why do I have this xi node? This will take your deal.II node number, and it will output the value of xi. So for example here, xi of 0 is = -1. Xi of 1 = 1, xi of 2 = -1/3, and xi of 3 = 1/3, okay? And so what this function does if you input a 0, and you're working with cubic bases functions, if you input a 0, go get -1. If you input a 1, you'll also get 1. So this is your input. And your output. All right? Actually, for any basis function if you put in a 0 you will get -1 and put in a 1, you'll get a 1 because of the way they're numbered. However, if it's a cubic basis function and you input a 2, Then you'll output a -3, or a -1/3, excuse me. Or if you input a 3, you'll receive a 1/3 as your output. All right, obviously that would be different than for quadratic, if you input a 2, you would get 0 here, right? See 2 = 0 in this case, all right? So that will come into play as you're defining your basis functions as you'll see in a minute. All right, so you actually don't need 2 of them. There's nothing you need to define within this object's xi node, it's just there in case you want to use it. You actually don't need to use it if you don't want to. All right, let's move on to the next functions, and these are our basis_function and the basis_gradient. All right, so, for the basis_function, We have input the node number, and you're inputting the value xi, xi again is in the bi-unit domain so it's from, anywhere from -1 to 1. Generally, you'll be using the basis_function in your quadrature when you're numerically integrating. And so usually the value of xi will be add the value of the quadrature point that you're at. Okay, and again, basisFunctionOrder is a global value, so you can access that here. They're a couple of ways you can define your basis functions, you can just use if statements. For example, you would say, if basisFunctionOrder = 1 and if node = 0, then you would define your linear basis_function for node 0 evaluated at xi, or you could use your generalized basis_function. Now that's in the lectures, but I'll write it again here just to point out some things, okay? So here's our basis_function at node A evaluated at xi, so you can see it's the same inputs. We have input of xi. In the function, and we have the input here. Of the node. Okay? Now, I'm going to change this formula just slightly from the lectures. Because our basis functions or our node numbering, rather, in deal.II start at 0 instead of 1. So, remember this, big pi is a product. It's similar to a summation with sigma, only now, we multiply each term instead of adding each term. All right, so we start at B=0, and we'll skip it. We'll skip B=A, and as long as < # nodes el. Okay, so of course that upper bound will change depending on the basisFunctionOrder. Okay, that's actually what this is. So the number of nodes in the element is basisFunctionOrder + 1. Okay, and then within this product we take xi, which is the same as this xi here,- xiB/xiA- xiB. And again to get this value, you could use the function xi_at_node, and you would input, for example in this case, (B). Okay, so that's an example of where you might use that function. Of course, you don't have to, you can use if statements as well if you like, okay? Now you'll store whatever that value is, you'll store that value within this double value, and you see that's what we return. And it is a double, okay? Now again, in the code we move on to basis_gradient. In general, a gradient would be a vector. All right, but this is 1 d, so there's just 1 component, so I'm only returning a double. But we have the same inputs, node and xi. All right, and remember this is just the derivative with respect to xi, it's not the derivative with respect to x in the real domain. Again, we're dealing strictly with a bi-unit domain here. And again, you'll store that value within this variable value which is then returned. All right, so those are the basis functions and basis gradients. You need to be sure to use deal.II's node numbering here, all right? So that's very important for you to remember that. So if you're doing your if statements, remember to do 0 is always at the left, 1 is always at the right. And then you count up on your midside nodes, as we showed on the previous slide, okay? If you use the function xi node in this generalized formula, it's already taken into account the deal.II node numbering, okay? So let's wrap up this segment here, and in the next segment we'll move on to generating the mesh and the boundary conditions.