/* /////////////////////////////////////////////////////////////////////////// // Routine: initPoint // // Purpose: Do once-per-point initialization. // // Input: PDE = pointer to the PDE object // pointType = type of this point (interior or boundary) // chart = chart in which the point coordinates are provided // txq[] = coordinates of the point // tU[] = current solution at the point // tdU[] = current solution gradient at the point // // Output: None // // Speed: This function is called by MC for every quadrature point // during an assmebly, and needs to be a fast as possible. // // Author: Kaihsu Tai, after Michael Holst /////////////////////////////////////////////////////////////////////////// */ VPUBLIC void initPoint(PDE *thee, int pointType, int chart, double txq[], double tU[], double tdU[][3]) { int i, j; /* the point, and the solution value and gradient at the point */ for (i=0; i<thee->vec; i++) { U[i] = tU[i]; for (j=0; j<thee->dim; j++) { if (i==0) xq[j] = txq[j]; dU[i][j] = tdU[i][j]; } } /* interior form case */ if (pointType == 0) { A = my_A(thee->dim, thee->vec, xq); B = my_B(thee->dim, thee->vec, xq, PDE_getTime(thee) ); /* boundary form case */ } else { /* (pointType == 1) */ C = my_C(thee->dim, thee->vec, xq); } }
int main ( int argc, char* args[] ) { //Stack my_X;// 'Default Constructor' Called. // The 'Default Constructor' is private so this is not allowed! //Stack my_X();// This is a 'Function Declaration'! // This declares a function with no parameters, and Stack as a return type! Stack my_A( 10 );// 'Constructor' Called. my_A.Push( 5 ); my_A.Push( 2 ); my_A.Push( 97 ); my_A.Push( 33 ); std::cout <<"A: "<< my_A <<"\n\n\n"; Stack my_B = my_A;// 'Copy Constructor' Called. my_B.Push( -55 ); std::cout <<"B: "<< my_B <<"\n\n\n"; Stack my_C( my_B );// 'Copy Constructor' Called. my_B.Push( 999 ); std::cout <<"C: "<< my_B <<"\n\n\n"; my_B = my_A;// 'Assignment Operator' Called. std::cout <<"B: " << my_B <<"\n\n\n"; Stack my_D = my_A = my_B = my_C;// Two: 'Assignment Operators' Called, and then a: 'Copy Constructor'. std::cout <<"D: " << my_B <<"\n\n\n"; return 0; // Four 'Destructors' Called. }